summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2024-05-03 10:09:52 -0700
committerFangrui Song <i@maskray.me>2024-05-03 10:09:52 -0700
commitb9ae06ba15936c9802d5668cea260ad36a243a10 (patch)
tree287ae10f4ec266da90c5157f84a0efe4da3f4481
parent2265df9696d55846644fa914b5f22df539e2d2bc (diff)
[test] Convert text files from CRLF to LF
Skip *.pdb, *.rc, *crlf*, and FileCheck/dos-style-eol.txt
-rw-r--r--llvm/test/Analysis/MustExecute/const-cond.ll94
-rw-r--r--llvm/test/CodeGen/MIR/X86/dbg-value-list.mir128
-rw-r--r--llvm/test/CodeGen/NVPTX/bf16x2-instructions-approx.ll84
-rw-r--r--llvm/test/CodeGen/NVPTX/bf16x2-instructions.ll1064
-rw-r--r--llvm/test/CodeGen/NVPTX/zeroext-32bit.ll54
-rw-r--r--llvm/test/CodeGen/SPARC/LeonSMACUMACInstructionUT.ll40
-rw-r--r--llvm/test/CodeGen/X86/dbg-value-superreg-copy2.mir2
-rw-r--r--llvm/test/CodeGen/X86/non-value-mem-operand.mir586
-rw-r--r--llvm/test/CodeGen/X86/patchable-prologue-debuginfo.ll112
-rw-r--r--llvm/test/CodeGen/X86/post-ra-sched-with-debug.mir4
-rw-r--r--llvm/test/CodeGen/X86/windows-seh-EHa-CppCatchDotDotDot.ll580
-rw-r--r--llvm/test/CodeGen/X86/windows-seh-EHa-CppDtors01.ll510
-rw-r--r--llvm/test/CodeGen/X86/windows-seh-EHa-TryInFinally.ll448
-rw-r--r--llvm/test/Demangle/ms-options.test86
-rw-r--r--llvm/test/MC/AMDGPU/v_illegal-atomics.s12
-rw-r--r--llvm/test/MC/AsmParser/directive_file-g.s48
-rw-r--r--llvm/test/Transforms/InstCombine/debuginfo-sink.ll62
-rw-r--r--llvm/test/Transforms/InstSimplify/ConstProp/gep-constanfolding-error.ll104
-rw-r--r--llvm/test/Transforms/InstSimplify/ConstProp/timeout.ll140
-rw-r--r--llvm/test/Transforms/LoopStrengthReduce/pr51329.ll108
-rw-r--r--llvm/test/Transforms/PhaseOrdering/pr32544.ll2
-rw-r--r--llvm/test/Transforms/Reassociate/undef_intrinsics_when_deleting_instructions.ll122
-rw-r--r--llvm/test/Transforms/ThinLTOBitcodeWriter/split-typed-decl.ll24
23 files changed, 2207 insertions, 2207 deletions
diff --git a/llvm/test/Analysis/MustExecute/const-cond.ll b/llvm/test/Analysis/MustExecute/const-cond.ll
index d36598cc63ee..e829db349ca6 100644
--- a/llvm/test/Analysis/MustExecute/const-cond.ll
+++ b/llvm/test/Analysis/MustExecute/const-cond.ll
@@ -1,47 +1,47 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -disable-output -passes=print-mustexecute %s 2>&1 | FileCheck %s
-; RUN: opt -disable-output -passes=print-mustexecute %s 2>&1 | FileCheck %s
-
-; In general the CFG below is easily simplified but this is useful for
-; pass ordering issue elimination.
-define i1 @const_cond(i32 %high) {
-; CHECK-LABEL: @const_cond(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: br label [[LOOP:%.*]]
-; CHECK: loop:
-; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ] ; (mustexec in: loop)
-; CHECK-NEXT: br i1 true, label [[NEXT:%.*]], label [[NEVER1:%.*]] ; (mustexec in: loop)
-; CHECK: next:
-; CHECK-NEXT: br i1 false, label [[NEVER2:%.*]], label [[BACKEDGE]] ; (mustexec in: loop)
-; CHECK: backedge:
-; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i32 [[IV]], 1 ; (mustexec in: loop)
-; CHECK-NEXT: [[EXIT_TEST:%.*]] = icmp slt i32 [[IV]], [[HIGH:%.*]] ; (mustexec in: loop)
-; CHECK-NEXT: br i1 [[EXIT_TEST]], label [[LOOP]], label [[EXIT:%.*]] ; (mustexec in: loop)
-; CHECK: exit:
-; CHECK-NEXT: ret i1 false
-; CHECK: never1:
-; CHECK-NEXT: unreachable
-; CHECK: never2:
-; CHECK-NEXT: unreachable
-;
-entry:
- br label %loop
-
-loop:
- %iv = phi i32 [0, %entry], [%iv.next, %backedge]
- br i1 true, label %next, label %never1
-next:
- br i1 false, label %never2, label %backedge
-backedge:
- %iv.next = add nsw nuw i32 %iv, 1
- %exit.test = icmp slt i32 %iv, %high
- br i1 %exit.test, label %loop, label %exit
-
-exit:
- ret i1 false
-never1:
- unreachable
-never2:
- unreachable
-}
-
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -disable-output -passes=print-mustexecute %s 2>&1 | FileCheck %s
+; RUN: opt -disable-output -passes=print-mustexecute %s 2>&1 | FileCheck %s
+
+; In general the CFG below is easily simplified but this is useful for
+; pass ordering issue elimination.
+define i1 @const_cond(i32 %high) {
+; CHECK-LABEL: @const_cond(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[LOOP:%.*]]
+; CHECK: loop:
+; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ] ; (mustexec in: loop)
+; CHECK-NEXT: br i1 true, label [[NEXT:%.*]], label [[NEVER1:%.*]] ; (mustexec in: loop)
+; CHECK: next:
+; CHECK-NEXT: br i1 false, label [[NEVER2:%.*]], label [[BACKEDGE]] ; (mustexec in: loop)
+; CHECK: backedge:
+; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i32 [[IV]], 1 ; (mustexec in: loop)
+; CHECK-NEXT: [[EXIT_TEST:%.*]] = icmp slt i32 [[IV]], [[HIGH:%.*]] ; (mustexec in: loop)
+; CHECK-NEXT: br i1 [[EXIT_TEST]], label [[LOOP]], label [[EXIT:%.*]] ; (mustexec in: loop)
+; CHECK: exit:
+; CHECK-NEXT: ret i1 false
+; CHECK: never1:
+; CHECK-NEXT: unreachable
+; CHECK: never2:
+; CHECK-NEXT: unreachable
+;
+entry:
+ br label %loop
+
+loop:
+ %iv = phi i32 [0, %entry], [%iv.next, %backedge]
+ br i1 true, label %next, label %never1
+next:
+ br i1 false, label %never2, label %backedge
+backedge:
+ %iv.next = add nsw nuw i32 %iv, 1
+ %exit.test = icmp slt i32 %iv, %high
+ br i1 %exit.test, label %loop, label %exit
+
+exit:
+ ret i1 false
+never1:
+ unreachable
+never2:
+ unreachable
+}
+
diff --git a/llvm/test/CodeGen/MIR/X86/dbg-value-list.mir b/llvm/test/CodeGen/MIR/X86/dbg-value-list.mir
index c419638be669..d2886d0fff31 100644
--- a/llvm/test/CodeGen/MIR/X86/dbg-value-list.mir
+++ b/llvm/test/CodeGen/MIR/X86/dbg-value-list.mir
@@ -1,64 +1,64 @@
-# RUN: llc -march=x86-64 -run-pass machineverifier -o - %s | FileCheck %s
-# Simple round-trip test for DBG_VALUE_LIST.
-# CHECK: [[VAR_C:![0-9]+]] = !DILocalVariable(name: "c"
-# CHECK: DBG_VALUE_LIST [[VAR_C]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), $edi, $esi, debug-location
---- |
- ; ModuleID = 'test.cpp'
- source_filename = "test.cpp"
- target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
- target triple = "x86_64-unknown-linux-gnu"
-
- ; Function Attrs: norecurse nounwind readnone uwtable
- define dso_local i32 @_Z3fooii(i32 %a, i32 %b) local_unnamed_addr !dbg !7 {
- entry:
- call void @llvm.dbg.value(metadata i32 %a, metadata !12, metadata !DIExpression()), !dbg !15
- call void @llvm.dbg.value(metadata i32 %b, metadata !13, metadata !DIExpression()), !dbg !15
- call void @llvm.dbg.value(metadata i32 undef, metadata !14, metadata !DIExpression()), !dbg !15
- %mul = mul nsw i32 %b, %a, !dbg !16
- ret i32 %mul, !dbg !17
- }
-
- ; Function Attrs: nounwind readnone speculatable willreturn
- declare void @llvm.dbg.value(metadata, metadata, metadata)
-
- !llvm.dbg.cu = !{!0}
- !llvm.module.flags = !{!3, !4, !5}
- !llvm.ident = !{!6}
-
- !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
- !1 = !DIFile(filename: "test.cpp", directory: "/")
- !2 = !{}
- !3 = !{i32 7, !"Dwarf Version", i32 4}
- !4 = !{i32 2, !"Debug Info Version", i32 3}
- !5 = !{i32 1, !"wchar_size", i32 4}
- !6 = !{!"clang version 11.0.0"}
- !7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooii", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
- !8 = !DISubroutineType(types: !9)
- !9 = !{!10, !10, !10}
- !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
- !11 = !{!12, !13, !14}
- !12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)
- !13 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 2, type: !10)
- !14 = !DILocalVariable(name: "c", scope: !7, file: !1, line: 3, type: !10)
- !15 = !DILocation(line: 0, scope: !7)
- !16 = !DILocation(line: 4, column: 12, scope: !7)
- !17 = !DILocation(line: 4, column: 3, scope: !7)
-
-...
----
-name: _Z3fooii
-body: |
- bb.0.entry:
- liveins: $edi, $esi
-
- DBG_VALUE $edi, $noreg, !12, !DIExpression(), debug-location !15
- DBG_VALUE $esi, $noreg, !13, !DIExpression(), debug-location !15
- $eax = MOV32rr $edi
- DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), $edi, $esi, debug-location !15
- DBG_VALUE $esi, $noreg, !13, !DIExpression(), debug-location !15
- DBG_VALUE $eax, $noreg, !12, !DIExpression(), debug-location !15
- renamable $eax = nsw IMUL32rr killed renamable $eax, killed renamable $esi, implicit-def dead $eflags, debug-location !16
- RET64 $eax, debug-location !17
-
-...
-
+# RUN: llc -march=x86-64 -run-pass machineverifier -o - %s | FileCheck %s
+# Simple round-trip test for DBG_VALUE_LIST.
+# CHECK: [[VAR_C:![0-9]+]] = !DILocalVariable(name: "c"
+# CHECK: DBG_VALUE_LIST [[VAR_C]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), $edi, $esi, debug-location
+--- |
+ ; ModuleID = 'test.cpp'
+ source_filename = "test.cpp"
+ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-unknown-linux-gnu"
+
+ ; Function Attrs: norecurse nounwind readnone uwtable
+ define dso_local i32 @_Z3fooii(i32 %a, i32 %b) local_unnamed_addr !dbg !7 {
+ entry:
+ call void @llvm.dbg.value(metadata i32 %a, metadata !12, metadata !DIExpression()), !dbg !15
+ call void @llvm.dbg.value(metadata i32 %b, metadata !13, metadata !DIExpression()), !dbg !15
+ call void @llvm.dbg.value(metadata i32 undef, metadata !14, metadata !DIExpression()), !dbg !15
+ %mul = mul nsw i32 %b, %a, !dbg !16
+ ret i32 %mul, !dbg !17
+ }
+
+ ; Function Attrs: nounwind readnone speculatable willreturn
+ declare void @llvm.dbg.value(metadata, metadata, metadata)
+
+ !llvm.dbg.cu = !{!0}
+ !llvm.module.flags = !{!3, !4, !5}
+ !llvm.ident = !{!6}
+
+ !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
+ !1 = !DIFile(filename: "test.cpp", directory: "/")
+ !2 = !{}
+ !3 = !{i32 7, !"Dwarf Version", i32 4}
+ !4 = !{i32 2, !"Debug Info Version", i32 3}
+ !5 = !{i32 1, !"wchar_size", i32 4}
+ !6 = !{!"clang version 11.0.0"}
+ !7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooii", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
+ !8 = !DISubroutineType(types: !9)
+ !9 = !{!10, !10, !10}
+ !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+ !11 = !{!12, !13, !14}
+ !12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)
+ !13 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 2, type: !10)
+ !14 = !DILocalVariable(name: "c", scope: !7, file: !1, line: 3, type: !10)
+ !15 = !DILocation(line: 0, scope: !7)
+ !16 = !DILocation(line: 4, column: 12, scope: !7)
+ !17 = !DILocation(line: 4, column: 3, scope: !7)
+
+...
+---
+name: _Z3fooii
+body: |
+ bb.0.entry:
+ liveins: $edi, $esi
+
+ DBG_VALUE $edi, $noreg, !12, !DIExpression(), debug-location !15
+ DBG_VALUE $esi, $noreg, !13, !DIExpression(), debug-location !15
+ $eax = MOV32rr $edi
+ DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), $edi, $esi, debug-location !15
+ DBG_VALUE $esi, $noreg, !13, !DIExpression(), debug-location !15
+ DBG_VALUE $eax, $noreg, !12, !DIExpression(), debug-location !15
+ renamable $eax = nsw IMUL32rr killed renamable $eax, killed renamable $esi, implicit-def dead $eflags, debug-location !16
+ RET64 $eax, debug-location !17
+
+...
+
diff --git a/llvm/test/CodeGen/NVPTX/bf16x2-instructions-approx.ll b/llvm/test/CodeGen/NVPTX/bf16x2-instructions-approx.ll
index dde8555c35af..f61205eb88fc 100644
--- a/llvm/test/CodeGen/NVPTX/bf16x2-instructions-approx.ll
+++ b/llvm/test/CodeGen/NVPTX/bf16x2-instructions-approx.ll
@@ -1,42 +1,42 @@
-; RUN: llc < %s -march=nvptx64 -mcpu=sm_80 -mattr=+ptx71 --enable-unsafe-fp-math | FileCheck --check-prefixes=CHECK %s
-; RUN: %if ptxas-11.8 %{ llc < %s -march=nvptx64 -mcpu=sm_80 -mattr=+ptx71 --enable-unsafe-fp-math | %ptxas-verify -arch=sm_80 %}
-
-target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
-
-declare <2 x bfloat> @llvm.sin.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.cos.f16(<2 x bfloat> %a) #0
-
-; CHECK-LABEL: test_sin(
-; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_sin_param_0];
-; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
-; CHECK-DAG: cvt.f32.bf16 [[AF0:%f[0-9]+]], [[A0]];
-; CHECK-DAG: cvt.f32.bf16 [[AF1:%f[0-9]+]], [[A1]];
-; CHECK-DAG: sin.approx.f32 [[RF0:%f[0-9]+]], [[AF0]];
-; CHECK-DAG: sin.approx.f32 [[RF1:%f[0-9]+]], [[AF1]];
-; CHECK-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[RF0]];
-; CHECK-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[RF1]];
-; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
-; CHECK: st.param.b32 [func_retval0+0], [[R]];
-; CHECK: ret;
-define <2 x bfloat> @test_sin(<2 x bfloat> %a) #0 #1 {
- %r = call <2 x bfloat> @llvm.sin.f16(<2 x bfloat> %a)
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_cos(
-; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_cos_param_0];
-; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
-; CHECK-DAG: cvt.f32.bf16 [[AF0:%f[0-9]+]], [[A0]];
-; CHECK-DAG: cvt.f32.bf16 [[AF1:%f[0-9]+]], [[A1]];
-; CHECK-DAG: cos.approx.f32 [[RF0:%f[0-9]+]], [[AF0]];
-; CHECK-DAG: cos.approx.f32 [[RF1:%f[0-9]+]], [[AF1]];
-; CHECK-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[RF0]];
-; CHECK-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[RF1]];
-; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
-; CHECK: st.param.b32 [func_retval0+0], [[R]];
-; CHECK: ret;
-define <2 x bfloat> @test_cos(<2 x bfloat> %a) #0 #1 {
- %r = call <2 x bfloat> @llvm.cos.f16(<2 x bfloat> %a)
- ret <2 x bfloat> %r
-}
-
+; RUN: llc < %s -march=nvptx64 -mcpu=sm_80 -mattr=+ptx71 --enable-unsafe-fp-math | FileCheck --check-prefixes=CHECK %s
+; RUN: %if ptxas-11.8 %{ llc < %s -march=nvptx64 -mcpu=sm_80 -mattr=+ptx71 --enable-unsafe-fp-math | %ptxas-verify -arch=sm_80 %}
+
+target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+
+declare <2 x bfloat> @llvm.sin.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.cos.f16(<2 x bfloat> %a) #0
+
+; CHECK-LABEL: test_sin(
+; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_sin_param_0];
+; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
+; CHECK-DAG: cvt.f32.bf16 [[AF0:%f[0-9]+]], [[A0]];
+; CHECK-DAG: cvt.f32.bf16 [[AF1:%f[0-9]+]], [[A1]];
+; CHECK-DAG: sin.approx.f32 [[RF0:%f[0-9]+]], [[AF0]];
+; CHECK-DAG: sin.approx.f32 [[RF1:%f[0-9]+]], [[AF1]];
+; CHECK-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[RF0]];
+; CHECK-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[RF1]];
+; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
+; CHECK: st.param.b32 [func_retval0+0], [[R]];
+; CHECK: ret;
+define <2 x bfloat> @test_sin(<2 x bfloat> %a) #0 #1 {
+ %r = call <2 x bfloat> @llvm.sin.f16(<2 x bfloat> %a)
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_cos(
+; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_cos_param_0];
+; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
+; CHECK-DAG: cvt.f32.bf16 [[AF0:%f[0-9]+]], [[A0]];
+; CHECK-DAG: cvt.f32.bf16 [[AF1:%f[0-9]+]], [[A1]];
+; CHECK-DAG: cos.approx.f32 [[RF0:%f[0-9]+]], [[AF0]];
+; CHECK-DAG: cos.approx.f32 [[RF1:%f[0-9]+]], [[AF1]];
+; CHECK-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[RF0]];
+; CHECK-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[RF1]];
+; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
+; CHECK: st.param.b32 [func_retval0+0], [[R]];
+; CHECK: ret;
+define <2 x bfloat> @test_cos(<2 x bfloat> %a) #0 #1 {
+ %r = call <2 x bfloat> @llvm.cos.f16(<2 x bfloat> %a)
+ ret <2 x bfloat> %r
+}
+
diff --git a/llvm/test/CodeGen/NVPTX/bf16x2-instructions.ll b/llvm/test/CodeGen/NVPTX/bf16x2-instructions.ll
index 9bde89cdf044..7030e5435f72 100644
--- a/llvm/test/CodeGen/NVPTX/bf16x2-instructions.ll
+++ b/llvm/test/CodeGen/NVPTX/bf16x2-instructions.ll
@@ -1,532 +1,532 @@
-; RUN: llc < %s -march=nvptx64 -mcpu=sm_80 -mattr=+ptx71 | FileCheck --check-prefixes=CHECK,SM80 %s
-; RUN: llc < %s -march=nvptx64 -mcpu=sm_90 -mattr=+ptx78 | FileCheck --check-prefixes=CHECK,SM90 %s
-; RUN: %if ptxas-11.8 %{ llc < %s -march=nvptx64 -mcpu=sm_80 -mattr=+ptx71 | %ptxas-verify -arch=sm_80 %}
-; RUN: %if ptxas-11.8 %{ llc < %s -march=nvptx64 -mcpu=sm_90 -mattr=+ptx78 | %ptxas-verify -arch=sm_90 %}
-
-target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
-
-; CHECK-LABEL: test_ret_const(
-; CHECK: mov.b32 [[T:%r[0-9+]]], 1073758080;
-; CHECK: st.param.b32 [func_retval0+0], [[T]];
-; CHECK-NEXT: ret;
-
-define <2 x bfloat> @test_ret_const() #0 {
- ret <2 x bfloat> <bfloat 1.0, bfloat 2.0>
-}
-
-; Check that we can lower fadd with immediate arguments.
-; CHECK-LABEL: test_fadd_imm_0(
-; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fadd_imm_0_param_0];
-;
-; SM90-DAG: mov.b32 [[I:%r[0-9+]]], 1073758080;
-; SM90-DAG: add.rn.bf16x2 [[R:%r[0-9]+]], [[A]], [[I]];
-;
-; SM80-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
-; SM80-DAG: cvt.f32.bf16 [[FA0:%f[0-9]+]], [[A0]]
-; SM80-DAG: cvt.f32.bf16 [[FA1:%f[0-9]+]], [[A1]]
-; SM80-DAG: add.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], 0f3F800000;
-; SM80-DAG: add.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], 0f40000000;
-; SM80-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[FR0]]
-; SM80-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[FR1]]
-; SM80-DAG: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
-;
-; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
-; CHECK-NEXT: ret;
-
-define <2 x bfloat> @test_fadd_imm_0(<2 x bfloat> %a) #0 {
- %r = fadd <2 x bfloat> <bfloat 1.0, bfloat 2.0>, %a
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_fadd_imm_1(
-; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_fadd_imm_1_param_0];
-; SM90: mov.b16 [[B:%rs[0-9]+]], 0x3F80;
-; SM90: add.rn.bf16 [[R:%rs[0-9]+]], [[A]], [[B]];
-
-; SM80-DAG: cvt.f32.bf16 [[FA:%f[0-9]+]], [[A]];
-; SM80: add.rn.f32 [[FR:%f[0-9]+]], [[FA]], 0f3F800000;
-; SM80: cvt.rn.bf16.f32 [[R:%rs[0-9]+]], [[FR]];
-
-; CHECK: st.param.b16 [func_retval0+0], [[R]];
-; CHECK-NEXT: ret;
-
-define bfloat @test_fadd_imm_1(bfloat %a) #0 {
- %r = fadd bfloat %a, 1.0
- ret bfloat %r
-}
-
-; CHECK-LABEL: test_fsubx2(
-; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fsubx2_param_0];
-; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fsubx2_param_1];
-; SM90: sub.rn.bf16x2 [[R:%r[0-9]+]], [[A]], [[B]];
-
-; SM80-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
-; SM80-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]];
-; SM80-DAG: cvt.f32.bf16 [[FA1:%f[0-9]+]], [[A1]];
-; SM80-DAG: cvt.f32.bf16 [[FA0:%f[0-9]+]], [[A0]];
-; SM80-DAG: cvt.f32.bf16 [[FB0:%f[0-9]+]], [[B0]];
-; SM80-DAG: cvt.f32.bf16 [[FB1:%f[0-9]+]], [[B1]];
-; SM80-DAG: sub.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], [[FB0]];
-; SM80-DAG: sub.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], [[FB1]];
-; SM80-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[FR0]];
-; SM80-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[FR1]];
-; SM80: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]};
-
-; CHECK: st.param.b32 [func_retval0+0], [[R]];
-; CHECK: ret;
-
-define <2 x bfloat> @test_fsubx2(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
- %r = fsub <2 x bfloat> %a, %b
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_fmulx2(
-; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fmulx2_param_0];
-; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fmulx2_param_1];
-; SM90: mul.rn.bf16x2 [[R:%r[0-9]+]], [[A]], [[B]];
-
-; SM80-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
-; SM80-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]];
-; SM80-DAG: cvt.f32.bf16 [[FA1:%f[0-9]+]], [[A1]];
-; SM80-DAG: cvt.f32.bf16 [[FA0:%f[0-9]+]], [[A0]];
-; SM80-DAG: cvt.f32.bf16 [[FB0:%f[0-9]+]], [[B0]];
-; SM80-DAG: cvt.f32.bf16 [[FB1:%f[0-9]+]], [[B1]];
-; SM80-DAG: mul.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], [[FB0]];
-; SM80-DAG: mul.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], [[FB1]];
-; SM80-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[FR0]];
-; SM80-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[FR1]];
-; SM80: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]};
-
-; CHECK: st.param.b32 [func_retval0+0], [[R]];
-; CHECK: ret;
-
-define <2 x bfloat> @test_fmulx2(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
- %r = fmul <2 x bfloat> %a, %b
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_fdiv(
-; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fdiv_param_0];
-; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fdiv_param_1];
-; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
-; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
-; CHECK-DAG: cvt.f32.bf16 [[FA0:%f[0-9]+]], [[A0]];
-; CHECK-DAG: cvt.f32.bf16 [[FA1:%f[0-9]+]], [[A1]];
-; CHECK-DAG: cvt.f32.bf16 [[FB0:%f[0-9]+]], [[B0]];
-; CHECK-DAG: cvt.f32.bf16 [[FB1:%f[0-9]+]], [[B1]];
-; CHECK-DAG: div.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], [[FB0]];
-; CHECK-DAG: div.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], [[FB1]];
-; CHECK-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[FR0]];
-; CHECK-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[FR1]];
-; CHECK-NEXT: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
-; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
-; CHECK-NEXT: ret;
-
-define <2 x bfloat> @test_fdiv(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
- %r = fdiv <2 x bfloat> %a, %b
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_fneg(
-; CHECK-DAG: ld.param.u32 [[A:%r[0-9]+]], [test_fneg_param_0];
-
-; CHECK-DAG: xor.b32 [[IHH0:%r[0-9]+]], [[A]], -2147450880;
-; CHECK-NEXT: st.param.b32 [func_retval0+0], [[IHH0]];
-; CHECK-NEXT: ret;
-define <2 x bfloat> @test_fneg(<2 x bfloat> %a) #0 {
- %r = fneg <2 x bfloat> %a
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: .func test_ldst_v2bf16(
-; CHECK-DAG: ld.param.u64 %[[A:rd[0-9]+]], [test_ldst_v2bf16_param_0];
-; CHECK-DAG: ld.param.u64 %[[B:rd[0-9]+]], [test_ldst_v2bf16_param_1];
-; CHECK-DAG: ld.b32 [[E:%r[0-9]+]], [%[[A]]]
-; CHECK-DAG: st.b32 [%[[B]]], [[E]];
-; CHECK: ret;
-define void @test_ldst_v2bf16(ptr %a, ptr %b) {
- %t1 = load <2 x bfloat>, ptr %a
- store <2 x bfloat> %t1, ptr %b, align 16
- ret void
-}
-
-; CHECK-LABEL: .func test_ldst_v3bf16(
-; CHECK-DAG: ld.param.u64 %[[A:rd[0-9]+]], [test_ldst_v3bf16_param_0];
-; CHECK-DAG: ld.param.u64 %[[B:rd[0-9]+]], [test_ldst_v3bf16_param_1];
-; -- v3 is inconvenient to capture as it's lowered as ld.b64 + fair
-; number of bitshifting instructions that may change at llvm's whim.
-; So we only verify that we only issue correct number of writes using
-; correct offset, but not the values we write.
-; CHECK-DAG: ld.u64
-; CHECK-DAG: st.u32 [%[[B]]],
-; CHECK-DAG: st.b16 [%[[B]]+4],
-; CHECK: ret;
-define void @test_ldst_v3bf16(ptr %a, ptr %b) {
- %t1 = load <3 x bfloat>, ptr %a
- store <3 x bfloat> %t1, ptr %b, align 16
- ret void
-}
-
-declare <2 x bfloat> @test_callee(<2 x bfloat> %a, <2 x bfloat> %b) #0
-
-; CHECK-LABEL: test_call(
-; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_call_param_0];
-; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_call_param_1];
-; CHECK: {
-; CHECK-DAG: .param .align 4 .b8 param0[4];
-; CHECK-DAG: .param .align 4 .b8 param1[4];
-; CHECK-DAG: st.param.b32 [param0+0], [[A]];
-; CHECK-DAG: st.param.b32 [param1+0], [[B]];
-; CHECK-DAG: .param .align 4 .b8 retval0[4];
-; CHECK: call.uni (retval0),
-; CHECK-NEXT: test_callee,
-; CHECK: );
-; CHECK-NEXT: ld.param.b32 [[R:%r[0-9]+]], [retval0+0];
-; CHECK-NEXT: }
-; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
-; CHECK-NEXT: ret;
-
-define <2 x bfloat> @test_call(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
- %r = call <2 x bfloat> @test_callee(<2 x bfloat> %a, <2 x bfloat> %b)
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_select(
-; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_select_param_0];
-; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_select_param_1];
-; CHECK-DAG: ld.param.u8 [[C:%rs[0-9]+]], [test_select_param_2]
-; CHECK-DAG: setp.eq.b16 [[PRED:%p[0-9]+]], %rs{{.*}}, 1;
-; CHECK-NEXT: selp.b32 [[R:%r[0-9]+]], [[A]], [[B]], [[PRED]];
-; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
-; CHECK-NEXT: ret;
-
-define <2 x bfloat> @test_select(<2 x bfloat> %a, <2 x bfloat> %b, i1 zeroext %c) #0 {
- %r = select i1 %c, <2 x bfloat> %a, <2 x bfloat> %b
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_select_cc(
-; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_select_cc_param_0];
-; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_select_cc_param_1];
-; CHECK-DAG: ld.param.b32 [[C:%r[0-9]+]], [test_select_cc_param_2];
-; CHECK-DAG: ld.param.b32 [[D:%r[0-9]+]], [test_select_cc_param_3];
-;
-; SM90: setp.neu.bf16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[C]], [[D]]
-;
-; SM80-DAG: mov.b32 {[[C0:%rs[0-9]+]], [[C1:%rs[0-9]+]]}, [[C]]
-; SM80-DAG: mov.b32 {[[D0:%rs[0-9]+]], [[D1:%rs[0-9]+]]}, [[D]]
-; SM80-DAG: cvt.f32.bf16 [[DF0:%f[0-9]+]], [[D0]];
-; SM80-DAG: cvt.f32.bf16 [[CF0:%f[0-9]+]], [[C0]];
-; SM80-DAG: cvt.f32.bf16 [[DF1:%f[0-9]+]], [[D1]];
-; SM80-DAG: cvt.f32.bf16 [[CF1:%f[0-9]+]], [[C1]];
-; SM80-DAG: setp.neu.f32 [[P0:%p[0-9]+]], [[CF0]], [[DF0]]
-; SM80-DAG: setp.neu.f32 [[P1:%p[0-9]+]], [[CF1]], [[DF1]]
-;
-; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
-; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
-; CHECK-DAG: selp.b16 [[R0:%rs[0-9]+]], [[A0]], [[B0]], [[P0]];
-; CHECK-DAG: selp.b16 [[R1:%rs[0-9]+]], [[A1]], [[B1]], [[P1]];
-; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
-; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
-; CHECK-NEXT: ret;
-
-define <2 x bfloat> @test_select_cc(<2 x bfloat> %a, <2 x bfloat> %b, <2 x bfloat> %c, <2 x bfloat> %d) #0 {
- %cc = fcmp une <2 x bfloat> %c, %d
- %r = select <2 x i1> %cc, <2 x bfloat> %a, <2 x bfloat> %b
- ret <2 x bfloat> %r
-}
-
-
-; CHECK-LABEL: test_select_cc_f32_bf16(
-; CHECK-DAG: ld.param.v2.f32 {[[A0:%f[0-9]+]], [[A1:%f[0-9]+]]}, [test_select_cc_f32_bf16_param_0];
-; CHECK-DAG: ld.param.b32 [[C:%r[0-9]+]], [test_select_cc_f32_bf16_param_2];
-; CHECK-DAG: ld.param.b32 [[D:%r[0-9]+]], [test_select_cc_f32_bf16_param_3];
-; SM90: setp.neu.bf16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[C]], [[D]]
-; CHECK-DAG: ld.param.v2.f32 {[[B0:%f[0-9]+]], [[B1:%f[0-9]+]]}, [test_select_cc_f32_bf16_param_1];
-
-; SM80-DAG: mov.b32 {[[C0:%rs[0-9]+]], [[C1:%rs[0-9]+]]}, [[C]]
-; SM80-DAG: mov.b32 {[[D0:%rs[0-9]+]], [[D1:%rs[0-9]+]]}, [[D]]
-; SM80-DAG: cvt.f32.bf16 [[DF0:%f[0-9]+]], [[D0]];
-; SM80-DAG: cvt.f32.bf16 [[CF0:%f[0-9]+]], [[C0]];
-; SM80-DAG: cvt.f32.bf16 [[DF1:%f[0-9]+]], [[D1]];
-; SM80-DAG: cvt.f32.bf16 [[CF1:%f[0-9]+]], [[C1]];
-; SM80-DAG: setp.neu.f32 [[P0:%p[0-9]+]], [[CF0]], [[DF0]]
-; SM80-DAG: setp.neu.f32 [[P1:%p[0-9]+]], [[CF1]], [[DF1]]
-;
-; CHECK-DAG: selp.f32 [[R0:%f[0-9]+]], [[A0]], [[B0]], [[P0]];
-; CHECK-DAG: selp.f32 [[R1:%f[0-9]+]], [[A1]], [[B1]], [[P1]];
-; CHECK-NEXT: st.param.v2.f32 [func_retval0+0], {[[R0]], [[R1]]};
-; CHECK-NEXT: ret;
-define <2 x float> @test_select_cc_f32_bf16(<2 x float> %a, <2 x float> %b,
- <2 x bfloat> %c, <2 x bfloat> %d) #0 {
- %cc = fcmp une <2 x bfloat> %c, %d
- %r = select <2 x i1> %cc, <2 x float> %a, <2 x float> %b
- ret <2 x float> %r
-}
-
-; CHECK-LABEL: test_select_cc_bf16_f32(
-; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_select_cc_bf16_f32_param_0];
-; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_select_cc_bf16_f32_param_1];
-; CHECK-DAG: ld.param.v2.f32 {[[C0:%f[0-9]+]], [[C1:%f[0-9]+]]}, [test_select_cc_bf16_f32_param_2];
-; CHECK-DAG: ld.param.v2.f32 {[[D0:%f[0-9]+]], [[D1:%f[0-9]+]]}, [test_select_cc_bf16_f32_param_3];
-; CHECK-DAG: setp.neu.f32 [[P0:%p[0-9]+]], [[C0]], [[D0]]
-; CHECK-DAG: setp.neu.f32 [[P1:%p[0-9]+]], [[C1]], [[D1]]
-; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
-; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
-; CHECK-DAG: selp.b16 [[R0:%rs[0-9]+]], [[A0]], [[B0]], [[P0]];
-; CHECK-DAG: selp.b16 [[R1:%rs[0-9]+]], [[A1]], [[B1]], [[P1]];
-; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
-; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
-; CHECK-NEXT: ret;
-define <2 x bfloat> @test_select_cc_bf16_f32(<2 x bfloat> %a, <2 x bfloat> %b,
- <2 x float> %c, <2 x float> %d) #0 {
- %cc = fcmp une <2 x float> %c, %d
- %r = select <2 x i1> %cc, <2 x bfloat> %a, <2 x bfloat> %b
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_fptrunc_2xfloat(
-; CHECK: ld.param.v2.f32 {[[A0:%f[0-9]+]], [[A1:%f[0-9]+]]}, [test_fptrunc_2xfloat_param_0];
-; CHECK-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[A0]];
-; CHECK-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[A1]];
-; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
-; CHECK: st.param.b32 [func_retval0+0], [[R]];
-; CHECK: ret;
-define <2 x bfloat> @test_fptrunc_2xfloat(<2 x float> %a) #0 {
- %r = fptrunc <2 x float> %a to <2 x bfloat>
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_fpext_2xfloat(
-; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_fpext_2xfloat_param_0];
-; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
-; CHECK-DAG: cvt.f32.bf16 [[R0:%f[0-9]+]], [[A0]];
-; CHECK-DAG: cvt.f32.bf16 [[R1:%f[0-9]+]], [[A1]];
-; CHECK-NEXT: st.param.v2.f32 [func_retval0+0], {[[R0]], [[R1]]};
-; CHECK: ret;
-define <2 x float> @test_fpext_2xfloat(<2 x bfloat> %a) #0 {
- %r = fpext <2 x bfloat> %a to <2 x float>
- ret <2 x float> %r
-}
-
-; CHECK-LABEL: test_bitcast_2xbf16_to_2xi16(
-; CHECK: ld.param.u32 [[A:%r[0-9]+]], [test_bitcast_2xbf16_to_2xi16_param_0];
-; CHECK: st.param.b32 [func_retval0+0], [[A]]
-; CHECK: ret;
-define <2 x i16> @test_bitcast_2xbf16_to_2xi16(<2 x bfloat> %a) #0 {
- %r = bitcast <2 x bfloat> %a to <2 x i16>
- ret <2 x i16> %r
-}
-
-
-; CHECK-LABEL: test_bitcast_2xi16_to_2xbf16(
-; CHECK: ld.param.b32 [[R]], [test_bitcast_2xi16_to_2xbf16_param_0];
-; CHECK: st.param.b32 [func_retval0+0], [[R]];
-; CHECK: ret;
-define <2 x bfloat> @test_bitcast_2xi16_to_2xbf16(<2 x i16> %a) #0 {
- %r = bitcast <2 x i16> %a to <2 x bfloat>
- ret <2 x bfloat> %r
-}
-
-declare <2 x bfloat> @llvm.sqrt.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.powi.f16(<2 x bfloat> %a, <2 x i32> %b) #0
-declare <2 x bfloat> @llvm.sin.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.cos.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.pow.f16(<2 x bfloat> %a, <2 x bfloat> %b) #0
-declare <2 x bfloat> @llvm.exp.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.exp2.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.log.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.log10.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.log2.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.fma.f16(<2 x bfloat> %a, <2 x bfloat> %b, <2 x bfloat> %c) #0
-declare <2 x bfloat> @llvm.fabs.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.minnum.f16(<2 x bfloat> %a, <2 x bfloat> %b) #0
-declare <2 x bfloat> @llvm.maxnum.f16(<2 x bfloat> %a, <2 x bfloat> %b) #0
-declare <2 x bfloat> @llvm.copysign.f16(<2 x bfloat> %a, <2 x bfloat> %b) #0
-declare <2 x bfloat> @llvm.floor.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.ceil.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.trunc.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.rint.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.nearbyint.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.round.f16(<2 x bfloat> %a) #0
-declare <2 x bfloat> @llvm.fmuladd.f16(<2 x bfloat> %a, <2 x bfloat> %b, <2 x bfloat> %c) #0
-
-
-; CHECK-LABEL: test_sqrt(
-; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_sqrt_param_0];
-; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
-; CHECK-DAG: cvt.f32.bf16 [[AF0:%f[0-9]+]], [[A0]];
-; CHECK-DAG: cvt.f32.bf16 [[AF1:%f[0-9]+]], [[A1]];
-; CHECK-DAG: sqrt.rn.f32 [[RF0:%f[0-9]+]], [[AF0]];
-; CHECK-DAG: sqrt.rn.f32 [[RF1:%f[0-9]+]], [[AF1]];
-; CHECK-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[RF0]];
-; CHECK-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[RF1]];
-; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
-; CHECK: st.param.b32 [func_retval0+0], [[R]];
-; CHECK: ret;
-define <2 x bfloat> @test_sqrt(<2 x bfloat> %a) #0 {
- %r = call <2 x bfloat> @llvm.sqrt.f16(<2 x bfloat> %a)
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_fmuladd(
-; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fmuladd_param_0];
-; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fmuladd_param_1];
-; CHECK-DAG: ld.param.b32 [[C:%r[0-9]+]], [test_fmuladd_param_2];
-;
-; CHECK: fma.rn.bf16x2 [[RA:%r[0-9]+]], [[A]], [[B]], [[C]];
-; CHECK-NEXT: st.param.b32 [func_retval0+0], [[RA]];
-; CHECK: ret;
-define <2 x bfloat> @test_fmuladd(<2 x bfloat> %a, <2 x bfloat> %b, <2 x bfloat> %c) #0 {
- %r = call <2 x bfloat> @llvm.fmuladd.f16(<2 x bfloat> %a, <2 x bfloat> %b, <2 x bfloat> %c)
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_fabs(
-; CHECK: ld.param.u32 [[A:%r[0-9]+]], [test_fabs_param_0];
-; CHECK: and.b32 [[R:%r[0-9]+]], [[A]], 2147450879;
-; CHECK: st.param.b32 [func_retval0+0], [[R]];
-; CHECK: ret;
-define <2 x bfloat> @test_fabs(<2 x bfloat> %a) #0 {
- %r = call <2 x bfloat> @llvm.fabs.f16(<2 x bfloat> %a)
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_fabs_add(
-; CHECK: abs.bf16x2
-; CHECK: ret;
-define <2 x bfloat> @test_fabs_add(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
- %s = fadd <2 x bfloat> %a, %a
- %r = call <2 x bfloat> @llvm.fabs.f16(<2 x bfloat> %s)
- %d = fadd <2 x bfloat> %r, %b
- ret <2 x bfloat> %d
-}
-
-
-; CHECK-LABEL: test_minnum(
-; CHECK-DAG: ld.param.b32 [[AF0:%r[0-9]+]], [test_minnum_param_0];
-; CHECK-DAG: ld.param.b32 [[BF0:%r[0-9]+]], [test_minnum_param_1];
-; CHECK-DAG: min.bf16x2 [[RF0:%r[0-9]+]], [[AF0]], [[BF0]];
-; CHECK: st.param.b32 [func_retval0+0], [[RF0]];
-; CHECK: ret;
-define <2 x bfloat> @test_minnum(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
- %r = call <2 x bfloat> @llvm.minnum.f16(<2 x bfloat> %a, <2 x bfloat> %b)
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_maxnum(
-; CHECK-DAG: ld.param.b32 [[AF0:%r[0-9]+]], [test_maxnum_param_0];
-; CHECK-DAG: ld.param.b32 [[BF0:%r[0-9]+]], [test_maxnum_param_1];
-; CHECK-DAG: max.bf16x2 [[RF0:%r[0-9]+]], [[AF0]], [[BF0]];
-; CHECK: st.param.b32 [func_retval0+0], [[RF0]];
-; CHECK: ret;
-define <2 x bfloat> @test_maxnum(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
- %r = call <2 x bfloat> @llvm.maxnum.f16(<2 x bfloat> %a, <2 x bfloat> %b)
- ret <2 x bfloat> %r
-}
-
-
-
-; CHECK-LABEL: test_floor(
-; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_floor_param_0];
-; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
-; SM90: cvt.rmi.bf16.bf16 [[R1:%rs[0-9]+]], [[A1]];
-; SM90: cvt.rmi.bf16.bf16 [[R0:%rs[0-9]+]], [[A0]];
-; SM80-DAG: cvt.f32.bf16 [[FA0:%f[0-9]+]], [[A0]];
-; SM80-DAG: cvt.f32.bf16 [[FA1:%f[0-9]+]], [[A1]];
-; SM80-DAG: cvt.rmi.f32.f32 [[RF0:%f[0-9]+]], [[FA0]];
-; SM80-DAG: cvt.rmi.f32.f32 [[RF1:%f[0-9]+]], [[FA1]];
-; SM80-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[RF0]];
-; SM80-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[RF1]];
-; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
-; CHECK: st.param.b32 [func_retval0+0], [[R]];
-; CHECK: ret;
-define <2 x bfloat> @test_floor(<2 x bfloat> %a) #0 {
- %r = call <2 x bfloat> @llvm.floor.f16(<2 x bfloat> %a)
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_ceil(
-; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_ceil_param_0];
-; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
-; SM90: cvt.rpi.bf16.bf16 [[R1:%rs[0-9]+]], [[A1]];
-; SM90: cvt.rpi.bf16.bf16 [[R0:%rs[0-9]+]], [[A0]];
-; SM80-DAG: cvt.f32.bf16 [[FA0:%f[0-9]+]], [[A0]];
-; SM80-DAG: cvt.f32.bf16 [[FA1:%f[0-9]+]], [[A1]];
-; SM80-DAG: cvt.rpi.f32.f32 [[RF0:%f[0-9]+]], [[FA0]];
-; SM80-DAG: cvt.rpi.f32.f32 [[RF1:%f[0-9]+]], [[FA1]];
-; SM80-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[RF0]];
-; SM80-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[RF1]];
-; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
-; CHECK: st.param.b32 [func_retval0+0], [[R]];
-; CHECK: ret;
-define <2 x bfloat> @test_ceil(<2 x bfloat> %a) #0 {
- %r = call <2 x bfloat> @llvm.ceil.f16(<2 x bfloat> %a)
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_trunc(
-; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_trunc_param_0];
-; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
-; SM90: cvt.rzi.bf16.bf16 [[R1:%rs[0-9]+]], [[A1]];
-; SM90: cvt.rzi.bf16.bf16 [[R0:%rs[0-9]+]], [[A0]];
-; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
-; CHECK: st.param.b32 [func_retval0+0], [[R]];
-; CHECK: ret;
-define <2 x bfloat> @test_trunc(<2 x bfloat> %a) #0 {
- %r = call <2 x bfloat> @llvm.trunc.f16(<2 x bfloat> %a)
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_rint(
-; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_rint_param_0];
-; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
-; SM90: cvt.rni.bf16.bf16 [[R1:%rs[0-9]+]], [[A1]];
-; SM90: cvt.rni.bf16.bf16 [[R0:%rs[0-9]+]], [[A0]];
-; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
-; CHECK: st.param.b32 [func_retval0+0], [[R]];
-; CHECK: ret;
-define <2 x bfloat> @test_rint(<2 x bfloat> %a) #0 {
- %r = call <2 x bfloat> @llvm.rint.f16(<2 x bfloat> %a)
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_round(
-; CHECK: ld.param.b32 {{.*}}, [test_round_param_0];
-; check the use of sign mask and 0.5 to implement round
-; CHECK: and.b32 [[R1:%r[0-9]+]], {{.*}}, -2147483648;
-; CHECK: or.b32 {{.*}}, [[R1]], 1056964608;
-; CHECK: and.b32 [[R2:%r[0-9]+]], {{.*}}, -2147483648;
-; CHECK: or.b32 {{.*}}, [[R2]], 1056964608;
-; CHECK: st.param.b32 [func_retval0+0], {{.*}};
-; CHECK: ret;
-define <2 x bfloat> @test_round(<2 x bfloat> %a) #0 {
- %r = call <2 x bfloat> @llvm.round.f16(<2 x bfloat> %a)
- ret <2 x bfloat> %r
-}
-
-; CHECK-LABEL: test_copysign(
-; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_copysign_param_0];
-; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_copysign_param_1];
-; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
-; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
-; CHECK-DAG: abs.bf16 [[AW1:%rs[0-9]+]], [[A1]];
-; CHECK-DAG: neg.bf16 [[AY1:%rs[0-9]+]], [[AW1]];
-; CHECK-DAG: shr.u16 [[BS1:%rs[0-9]+]], [[B1]], 15;
-; CHECK-DAG: and.b16 [[BR1:%rs[0-9]+]], [[BS1]], 1;
-; CHECK-DAG: setp.eq.b16 [[P1:%p[0-9]+]], [[BR1]], 1;
-; CHECK-DAG: selp.b16 [[RS1:%rs[0-9]+]], [[AY1]], [[AW1]], [[P1]]
-; CHECK-DAG: abs.bf16 [[AW0:%rs[0-9]+]], [[A0]];
-; CHECK-DAG: neg.bf16 [[AY0:%rs[0-9]+]], [[AW0]];
-; CHECK-DAG: shr.u16 [[BS0:%rs[0-9]+]], [[B0]], 15;
-; CHECK-DAG: and.b16 [[BR0:%rs[0-9]+]], [[BS0]], 1;
-; CHECK-DAG: setp.eq.b16 [[P0:%p[0-9]+]], [[BR0]], 1;
-; CHECK-DAG: selp.b16 [[RS0:%rs[0-9]+]], [[AY0]], [[AW0]], [[P0]]
-; CHECK-DAG: mov.b32 [[R:%r[0-9]+]], {[[RS0]], [[RS1]]}
-; CHECK: st.param.b32 [func_retval0+0], [[R]];
-; CHECK: ret;
-define <2 x bfloat> @test_copysign(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
- %r = call <2 x bfloat> @llvm.copysign.f16(<2 x bfloat> %a, <2 x bfloat> %b)
- ret <2 x bfloat> %r
-}
-
+; RUN: llc < %s -march=nvptx64 -mcpu=sm_80 -mattr=+ptx71 | FileCheck --check-prefixes=CHECK,SM80 %s
+; RUN: llc < %s -march=nvptx64 -mcpu=sm_90 -mattr=+ptx78 | FileCheck --check-prefixes=CHECK,SM90 %s
+; RUN: %if ptxas-11.8 %{ llc < %s -march=nvptx64 -mcpu=sm_80 -mattr=+ptx71 | %ptxas-verify -arch=sm_80 %}
+; RUN: %if ptxas-11.8 %{ llc < %s -march=nvptx64 -mcpu=sm_90 -mattr=+ptx78 | %ptxas-verify -arch=sm_90 %}
+
+target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+
+; CHECK-LABEL: test_ret_const(
+; CHECK: mov.b32 [[T:%r[0-9+]]], 1073758080;
+; CHECK: st.param.b32 [func_retval0+0], [[T]];
+; CHECK-NEXT: ret;
+
+define <2 x bfloat> @test_ret_const() #0 {
+ ret <2 x bfloat> <bfloat 1.0, bfloat 2.0>
+}
+
+; Check that we can lower fadd with immediate arguments.
+; CHECK-LABEL: test_fadd_imm_0(
+; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fadd_imm_0_param_0];
+;
+; SM90-DAG: mov.b32 [[I:%r[0-9+]]], 1073758080;
+; SM90-DAG: add.rn.bf16x2 [[R:%r[0-9]+]], [[A]], [[I]];
+;
+; SM80-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
+; SM80-DAG: cvt.f32.bf16 [[FA0:%f[0-9]+]], [[A0]]
+; SM80-DAG: cvt.f32.bf16 [[FA1:%f[0-9]+]], [[A1]]
+; SM80-DAG: add.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], 0f3F800000;
+; SM80-DAG: add.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], 0f40000000;
+; SM80-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[FR0]]
+; SM80-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[FR1]]
+; SM80-DAG: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
+;
+; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
+; CHECK-NEXT: ret;
+
+define <2 x bfloat> @test_fadd_imm_0(<2 x bfloat> %a) #0 {
+ %r = fadd <2 x bfloat> <bfloat 1.0, bfloat 2.0>, %a
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_fadd_imm_1(
+; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_fadd_imm_1_param_0];
+; SM90: mov.b16 [[B:%rs[0-9]+]], 0x3F80;
+; SM90: add.rn.bf16 [[R:%rs[0-9]+]], [[A]], [[B]];
+
+; SM80-DAG: cvt.f32.bf16 [[FA:%f[0-9]+]], [[A]];
+; SM80: add.rn.f32 [[FR:%f[0-9]+]], [[FA]], 0f3F800000;
+; SM80: cvt.rn.bf16.f32 [[R:%rs[0-9]+]], [[FR]];
+
+; CHECK: st.param.b16 [func_retval0+0], [[R]];
+; CHECK-NEXT: ret;
+
+define bfloat @test_fadd_imm_1(bfloat %a) #0 {
+ %r = fadd bfloat %a, 1.0
+ ret bfloat %r
+}
+
+; CHECK-LABEL: test_fsubx2(
+; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fsubx2_param_0];
+; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fsubx2_param_1];
+; SM90: sub.rn.bf16x2 [[R:%r[0-9]+]], [[A]], [[B]];
+
+; SM80-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
+; SM80-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]];
+; SM80-DAG: cvt.f32.bf16 [[FA1:%f[0-9]+]], [[A1]];
+; SM80-DAG: cvt.f32.bf16 [[FA0:%f[0-9]+]], [[A0]];
+; SM80-DAG: cvt.f32.bf16 [[FB0:%f[0-9]+]], [[B0]];
+; SM80-DAG: cvt.f32.bf16 [[FB1:%f[0-9]+]], [[B1]];
+; SM80-DAG: sub.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], [[FB0]];
+; SM80-DAG: sub.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], [[FB1]];
+; SM80-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[FR0]];
+; SM80-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[FR1]];
+; SM80: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]};
+
+; CHECK: st.param.b32 [func_retval0+0], [[R]];
+; CHECK: ret;
+
+define <2 x bfloat> @test_fsubx2(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
+ %r = fsub <2 x bfloat> %a, %b
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_fmulx2(
+; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fmulx2_param_0];
+; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fmulx2_param_1];
+; SM90: mul.rn.bf16x2 [[R:%r[0-9]+]], [[A]], [[B]];
+
+; SM80-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
+; SM80-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]];
+; SM80-DAG: cvt.f32.bf16 [[FA1:%f[0-9]+]], [[A1]];
+; SM80-DAG: cvt.f32.bf16 [[FA0:%f[0-9]+]], [[A0]];
+; SM80-DAG: cvt.f32.bf16 [[FB0:%f[0-9]+]], [[B0]];
+; SM80-DAG: cvt.f32.bf16 [[FB1:%f[0-9]+]], [[B1]];
+; SM80-DAG: mul.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], [[FB0]];
+; SM80-DAG: mul.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], [[FB1]];
+; SM80-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[FR0]];
+; SM80-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[FR1]];
+; SM80: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]};
+
+; CHECK: st.param.b32 [func_retval0+0], [[R]];
+; CHECK: ret;
+
+define <2 x bfloat> @test_fmulx2(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
+ %r = fmul <2 x bfloat> %a, %b
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_fdiv(
+; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fdiv_param_0];
+; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fdiv_param_1];
+; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
+; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
+; CHECK-DAG: cvt.f32.bf16 [[FA0:%f[0-9]+]], [[A0]];
+; CHECK-DAG: cvt.f32.bf16 [[FA1:%f[0-9]+]], [[A1]];
+; CHECK-DAG: cvt.f32.bf16 [[FB0:%f[0-9]+]], [[B0]];
+; CHECK-DAG: cvt.f32.bf16 [[FB1:%f[0-9]+]], [[B1]];
+; CHECK-DAG: div.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], [[FB0]];
+; CHECK-DAG: div.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], [[FB1]];
+; CHECK-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[FR0]];
+; CHECK-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[FR1]];
+; CHECK-NEXT: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
+; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
+; CHECK-NEXT: ret;
+
+define <2 x bfloat> @test_fdiv(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
+ %r = fdiv <2 x bfloat> %a, %b
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_fneg(
+; CHECK-DAG: ld.param.u32 [[A:%r[0-9]+]], [test_fneg_param_0];
+
+; CHECK-DAG: xor.b32 [[IHH0:%r[0-9]+]], [[A]], -2147450880;
+; CHECK-NEXT: st.param.b32 [func_retval0+0], [[IHH0]];
+; CHECK-NEXT: ret;
+define <2 x bfloat> @test_fneg(<2 x bfloat> %a) #0 {
+ %r = fneg <2 x bfloat> %a
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: .func test_ldst_v2bf16(
+; CHECK-DAG: ld.param.u64 %[[A:rd[0-9]+]], [test_ldst_v2bf16_param_0];
+; CHECK-DAG: ld.param.u64 %[[B:rd[0-9]+]], [test_ldst_v2bf16_param_1];
+; CHECK-DAG: ld.b32 [[E:%r[0-9]+]], [%[[A]]]
+; CHECK-DAG: st.b32 [%[[B]]], [[E]];
+; CHECK: ret;
+define void @test_ldst_v2bf16(ptr %a, ptr %b) {
+ %t1 = load <2 x bfloat>, ptr %a
+ store <2 x bfloat> %t1, ptr %b, align 16
+ ret void
+}
+
+; CHECK-LABEL: .func test_ldst_v3bf16(
+; CHECK-DAG: ld.param.u64 %[[A:rd[0-9]+]], [test_ldst_v3bf16_param_0];
+; CHECK-DAG: ld.param.u64 %[[B:rd[0-9]+]], [test_ldst_v3bf16_param_1];
+; -- v3 is inconvenient to capture as it's lowered as ld.b64 + fair
+; number of bitshifting instructions that may change at llvm's whim.
+; So we only verify that we only issue correct number of writes using
+; correct offset, but not the values we write.
+; CHECK-DAG: ld.u64
+; CHECK-DAG: st.u32 [%[[B]]],
+; CHECK-DAG: st.b16 [%[[B]]+4],
+; CHECK: ret;
+define void @test_ldst_v3bf16(ptr %a, ptr %b) {
+ %t1 = load <3 x bfloat>, ptr %a
+ store <3 x bfloat> %t1, ptr %b, align 16
+ ret void
+}
+
+declare <2 x bfloat> @test_callee(<2 x bfloat> %a, <2 x bfloat> %b) #0
+
+; CHECK-LABEL: test_call(
+; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_call_param_0];
+; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_call_param_1];
+; CHECK: {
+; CHECK-DAG: .param .align 4 .b8 param0[4];
+; CHECK-DAG: .param .align 4 .b8 param1[4];
+; CHECK-DAG: st.param.b32 [param0+0], [[A]];
+; CHECK-DAG: st.param.b32 [param1+0], [[B]];
+; CHECK-DAG: .param .align 4 .b8 retval0[4];
+; CHECK: call.uni (retval0),
+; CHECK-NEXT: test_callee,
+; CHECK: );
+; CHECK-NEXT: ld.param.b32 [[R:%r[0-9]+]], [retval0+0];
+; CHECK-NEXT: }
+; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
+; CHECK-NEXT: ret;
+
+define <2 x bfloat> @test_call(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
+ %r = call <2 x bfloat> @test_callee(<2 x bfloat> %a, <2 x bfloat> %b)
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_select(
+; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_select_param_0];
+; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_select_param_1];
+; CHECK-DAG: ld.param.u8 [[C:%rs[0-9]+]], [test_select_param_2]
+; CHECK-DAG: setp.eq.b16 [[PRED:%p[0-9]+]], %rs{{.*}}, 1;
+; CHECK-NEXT: selp.b32 [[R:%r[0-9]+]], [[A]], [[B]], [[PRED]];
+; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
+; CHECK-NEXT: ret;
+
+define <2 x bfloat> @test_select(<2 x bfloat> %a, <2 x bfloat> %b, i1 zeroext %c) #0 {
+ %r = select i1 %c, <2 x bfloat> %a, <2 x bfloat> %b
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_select_cc(
+; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_select_cc_param_0];
+; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_select_cc_param_1];
+; CHECK-DAG: ld.param.b32 [[C:%r[0-9]+]], [test_select_cc_param_2];
+; CHECK-DAG: ld.param.b32 [[D:%r[0-9]+]], [test_select_cc_param_3];
+;
+; SM90: setp.neu.bf16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[C]], [[D]]
+;
+; SM80-DAG: mov.b32 {[[C0:%rs[0-9]+]], [[C1:%rs[0-9]+]]}, [[C]]
+; SM80-DAG: mov.b32 {[[D0:%rs[0-9]+]], [[D1:%rs[0-9]+]]}, [[D]]
+; SM80-DAG: cvt.f32.bf16 [[DF0:%f[0-9]+]], [[D0]];
+; SM80-DAG: cvt.f32.bf16 [[CF0:%f[0-9]+]], [[C0]];
+; SM80-DAG: cvt.f32.bf16 [[DF1:%f[0-9]+]], [[D1]];
+; SM80-DAG: cvt.f32.bf16 [[CF1:%f[0-9]+]], [[C1]];
+; SM80-DAG: setp.neu.f32 [[P0:%p[0-9]+]], [[CF0]], [[DF0]]
+; SM80-DAG: setp.neu.f32 [[P1:%p[0-9]+]], [[CF1]], [[DF1]]
+;
+; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
+; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
+; CHECK-DAG: selp.b16 [[R0:%rs[0-9]+]], [[A0]], [[B0]], [[P0]];
+; CHECK-DAG: selp.b16 [[R1:%rs[0-9]+]], [[A1]], [[B1]], [[P1]];
+; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
+; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
+; CHECK-NEXT: ret;
+
+define <2 x bfloat> @test_select_cc(<2 x bfloat> %a, <2 x bfloat> %b, <2 x bfloat> %c, <2 x bfloat> %d) #0 {
+ %cc = fcmp une <2 x bfloat> %c, %d
+ %r = select <2 x i1> %cc, <2 x bfloat> %a, <2 x bfloat> %b
+ ret <2 x bfloat> %r
+}
+
+
+; CHECK-LABEL: test_select_cc_f32_bf16(
+; CHECK-DAG: ld.param.v2.f32 {[[A0:%f[0-9]+]], [[A1:%f[0-9]+]]}, [test_select_cc_f32_bf16_param_0];
+; CHECK-DAG: ld.param.b32 [[C:%r[0-9]+]], [test_select_cc_f32_bf16_param_2];
+; CHECK-DAG: ld.param.b32 [[D:%r[0-9]+]], [test_select_cc_f32_bf16_param_3];
+; SM90: setp.neu.bf16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[C]], [[D]]
+; CHECK-DAG: ld.param.v2.f32 {[[B0:%f[0-9]+]], [[B1:%f[0-9]+]]}, [test_select_cc_f32_bf16_param_1];
+
+; SM80-DAG: mov.b32 {[[C0:%rs[0-9]+]], [[C1:%rs[0-9]+]]}, [[C]]
+; SM80-DAG: mov.b32 {[[D0:%rs[0-9]+]], [[D1:%rs[0-9]+]]}, [[D]]
+; SM80-DAG: cvt.f32.bf16 [[DF0:%f[0-9]+]], [[D0]];
+; SM80-DAG: cvt.f32.bf16 [[CF0:%f[0-9]+]], [[C0]];
+; SM80-DAG: cvt.f32.bf16 [[DF1:%f[0-9]+]], [[D1]];
+; SM80-DAG: cvt.f32.bf16 [[CF1:%f[0-9]+]], [[C1]];
+; SM80-DAG: setp.neu.f32 [[P0:%p[0-9]+]], [[CF0]], [[DF0]]
+; SM80-DAG: setp.neu.f32 [[P1:%p[0-9]+]], [[CF1]], [[DF1]]
+;
+; CHECK-DAG: selp.f32 [[R0:%f[0-9]+]], [[A0]], [[B0]], [[P0]];
+; CHECK-DAG: selp.f32 [[R1:%f[0-9]+]], [[A1]], [[B1]], [[P1]];
+; CHECK-NEXT: st.param.v2.f32 [func_retval0+0], {[[R0]], [[R1]]};
+; CHECK-NEXT: ret;
+define <2 x float> @test_select_cc_f32_bf16(<2 x float> %a, <2 x float> %b,
+ <2 x bfloat> %c, <2 x bfloat> %d) #0 {
+ %cc = fcmp une <2 x bfloat> %c, %d
+ %r = select <2 x i1> %cc, <2 x float> %a, <2 x float> %b
+ ret <2 x float> %r
+}
+
+; CHECK-LABEL: test_select_cc_bf16_f32(
+; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_select_cc_bf16_f32_param_0];
+; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_select_cc_bf16_f32_param_1];
+; CHECK-DAG: ld.param.v2.f32 {[[C0:%f[0-9]+]], [[C1:%f[0-9]+]]}, [test_select_cc_bf16_f32_param_2];
+; CHECK-DAG: ld.param.v2.f32 {[[D0:%f[0-9]+]], [[D1:%f[0-9]+]]}, [test_select_cc_bf16_f32_param_3];
+; CHECK-DAG: setp.neu.f32 [[P0:%p[0-9]+]], [[C0]], [[D0]]
+; CHECK-DAG: setp.neu.f32 [[P1:%p[0-9]+]], [[C1]], [[D1]]
+; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
+; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
+; CHECK-DAG: selp.b16 [[R0:%rs[0-9]+]], [[A0]], [[B0]], [[P0]];
+; CHECK-DAG: selp.b16 [[R1:%rs[0-9]+]], [[A1]], [[B1]], [[P1]];
+; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
+; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
+; CHECK-NEXT: ret;
+define <2 x bfloat> @test_select_cc_bf16_f32(<2 x bfloat> %a, <2 x bfloat> %b,
+ <2 x float> %c, <2 x float> %d) #0 {
+ %cc = fcmp une <2 x float> %c, %d
+ %r = select <2 x i1> %cc, <2 x bfloat> %a, <2 x bfloat> %b
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_fptrunc_2xfloat(
+; CHECK: ld.param.v2.f32 {[[A0:%f[0-9]+]], [[A1:%f[0-9]+]]}, [test_fptrunc_2xfloat_param_0];
+; CHECK-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[A0]];
+; CHECK-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[A1]];
+; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
+; CHECK: st.param.b32 [func_retval0+0], [[R]];
+; CHECK: ret;
+define <2 x bfloat> @test_fptrunc_2xfloat(<2 x float> %a) #0 {
+ %r = fptrunc <2 x float> %a to <2 x bfloat>
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_fpext_2xfloat(
+; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_fpext_2xfloat_param_0];
+; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
+; CHECK-DAG: cvt.f32.bf16 [[R0:%f[0-9]+]], [[A0]];
+; CHECK-DAG: cvt.f32.bf16 [[R1:%f[0-9]+]], [[A1]];
+; CHECK-NEXT: st.param.v2.f32 [func_retval0+0], {[[R0]], [[R1]]};
+; CHECK: ret;
+define <2 x float> @test_fpext_2xfloat(<2 x bfloat> %a) #0 {
+ %r = fpext <2 x bfloat> %a to <2 x float>
+ ret <2 x float> %r
+}
+
+; CHECK-LABEL: test_bitcast_2xbf16_to_2xi16(
+; CHECK: ld.param.u32 [[A:%r[0-9]+]], [test_bitcast_2xbf16_to_2xi16_param_0];
+; CHECK: st.param.b32 [func_retval0+0], [[A]]
+; CHECK: ret;
+define <2 x i16> @test_bitcast_2xbf16_to_2xi16(<2 x bfloat> %a) #0 {
+ %r = bitcast <2 x bfloat> %a to <2 x i16>
+ ret <2 x i16> %r
+}
+
+
+; CHECK-LABEL: test_bitcast_2xi16_to_2xbf16(
+; CHECK: ld.param.b32 [[R]], [test_bitcast_2xi16_to_2xbf16_param_0];
+; CHECK: st.param.b32 [func_retval0+0], [[R]];
+; CHECK: ret;
+define <2 x bfloat> @test_bitcast_2xi16_to_2xbf16(<2 x i16> %a) #0 {
+ %r = bitcast <2 x i16> %a to <2 x bfloat>
+ ret <2 x bfloat> %r
+}
+
+declare <2 x bfloat> @llvm.sqrt.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.powi.f16(<2 x bfloat> %a, <2 x i32> %b) #0
+declare <2 x bfloat> @llvm.sin.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.cos.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.pow.f16(<2 x bfloat> %a, <2 x bfloat> %b) #0
+declare <2 x bfloat> @llvm.exp.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.exp2.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.log.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.log10.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.log2.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.fma.f16(<2 x bfloat> %a, <2 x bfloat> %b, <2 x bfloat> %c) #0
+declare <2 x bfloat> @llvm.fabs.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.minnum.f16(<2 x bfloat> %a, <2 x bfloat> %b) #0
+declare <2 x bfloat> @llvm.maxnum.f16(<2 x bfloat> %a, <2 x bfloat> %b) #0
+declare <2 x bfloat> @llvm.copysign.f16(<2 x bfloat> %a, <2 x bfloat> %b) #0
+declare <2 x bfloat> @llvm.floor.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.ceil.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.trunc.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.rint.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.nearbyint.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.round.f16(<2 x bfloat> %a) #0
+declare <2 x bfloat> @llvm.fmuladd.f16(<2 x bfloat> %a, <2 x bfloat> %b, <2 x bfloat> %c) #0
+
+
+; CHECK-LABEL: test_sqrt(
+; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_sqrt_param_0];
+; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
+; CHECK-DAG: cvt.f32.bf16 [[AF0:%f[0-9]+]], [[A0]];
+; CHECK-DAG: cvt.f32.bf16 [[AF1:%f[0-9]+]], [[A1]];
+; CHECK-DAG: sqrt.rn.f32 [[RF0:%f[0-9]+]], [[AF0]];
+; CHECK-DAG: sqrt.rn.f32 [[RF1:%f[0-9]+]], [[AF1]];
+; CHECK-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[RF0]];
+; CHECK-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[RF1]];
+; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
+; CHECK: st.param.b32 [func_retval0+0], [[R]];
+; CHECK: ret;
+define <2 x bfloat> @test_sqrt(<2 x bfloat> %a) #0 {
+ %r = call <2 x bfloat> @llvm.sqrt.f16(<2 x bfloat> %a)
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_fmuladd(
+; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fmuladd_param_0];
+; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fmuladd_param_1];
+; CHECK-DAG: ld.param.b32 [[C:%r[0-9]+]], [test_fmuladd_param_2];
+;
+; CHECK: fma.rn.bf16x2 [[RA:%r[0-9]+]], [[A]], [[B]], [[C]];
+; CHECK-NEXT: st.param.b32 [func_retval0+0], [[RA]];
+; CHECK: ret;
+define <2 x bfloat> @test_fmuladd(<2 x bfloat> %a, <2 x bfloat> %b, <2 x bfloat> %c) #0 {
+ %r = call <2 x bfloat> @llvm.fmuladd.f16(<2 x bfloat> %a, <2 x bfloat> %b, <2 x bfloat> %c)
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_fabs(
+; CHECK: ld.param.u32 [[A:%r[0-9]+]], [test_fabs_param_0];
+; CHECK: and.b32 [[R:%r[0-9]+]], [[A]], 2147450879;
+; CHECK: st.param.b32 [func_retval0+0], [[R]];
+; CHECK: ret;
+define <2 x bfloat> @test_fabs(<2 x bfloat> %a) #0 {
+ %r = call <2 x bfloat> @llvm.fabs.f16(<2 x bfloat> %a)
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_fabs_add(
+; CHECK: abs.bf16x2
+; CHECK: ret;
+define <2 x bfloat> @test_fabs_add(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
+ %s = fadd <2 x bfloat> %a, %a
+ %r = call <2 x bfloat> @llvm.fabs.f16(<2 x bfloat> %s)
+ %d = fadd <2 x bfloat> %r, %b
+ ret <2 x bfloat> %d
+}
+
+
+; CHECK-LABEL: test_minnum(
+; CHECK-DAG: ld.param.b32 [[AF0:%r[0-9]+]], [test_minnum_param_0];
+; CHECK-DAG: ld.param.b32 [[BF0:%r[0-9]+]], [test_minnum_param_1];
+; CHECK-DAG: min.bf16x2 [[RF0:%r[0-9]+]], [[AF0]], [[BF0]];
+; CHECK: st.param.b32 [func_retval0+0], [[RF0]];
+; CHECK: ret;
+define <2 x bfloat> @test_minnum(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
+ %r = call <2 x bfloat> @llvm.minnum.f16(<2 x bfloat> %a, <2 x bfloat> %b)
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_maxnum(
+; CHECK-DAG: ld.param.b32 [[AF0:%r[0-9]+]], [test_maxnum_param_0];
+; CHECK-DAG: ld.param.b32 [[BF0:%r[0-9]+]], [test_maxnum_param_1];
+; CHECK-DAG: max.bf16x2 [[RF0:%r[0-9]+]], [[AF0]], [[BF0]];
+; CHECK: st.param.b32 [func_retval0+0], [[RF0]];
+; CHECK: ret;
+define <2 x bfloat> @test_maxnum(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
+ %r = call <2 x bfloat> @llvm.maxnum.f16(<2 x bfloat> %a, <2 x bfloat> %b)
+ ret <2 x bfloat> %r
+}
+
+
+
+; CHECK-LABEL: test_floor(
+; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_floor_param_0];
+; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
+; SM90: cvt.rmi.bf16.bf16 [[R1:%rs[0-9]+]], [[A1]];
+; SM90: cvt.rmi.bf16.bf16 [[R0:%rs[0-9]+]], [[A0]];
+; SM80-DAG: cvt.f32.bf16 [[FA0:%f[0-9]+]], [[A0]];
+; SM80-DAG: cvt.f32.bf16 [[FA1:%f[0-9]+]], [[A1]];
+; SM80-DAG: cvt.rmi.f32.f32 [[RF0:%f[0-9]+]], [[FA0]];
+; SM80-DAG: cvt.rmi.f32.f32 [[RF1:%f[0-9]+]], [[FA1]];
+; SM80-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[RF0]];
+; SM80-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[RF1]];
+; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
+; CHECK: st.param.b32 [func_retval0+0], [[R]];
+; CHECK: ret;
+define <2 x bfloat> @test_floor(<2 x bfloat> %a) #0 {
+ %r = call <2 x bfloat> @llvm.floor.f16(<2 x bfloat> %a)
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_ceil(
+; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_ceil_param_0];
+; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
+; SM90: cvt.rpi.bf16.bf16 [[R1:%rs[0-9]+]], [[A1]];
+; SM90: cvt.rpi.bf16.bf16 [[R0:%rs[0-9]+]], [[A0]];
+; SM80-DAG: cvt.f32.bf16 [[FA0:%f[0-9]+]], [[A0]];
+; SM80-DAG: cvt.f32.bf16 [[FA1:%f[0-9]+]], [[A1]];
+; SM80-DAG: cvt.rpi.f32.f32 [[RF0:%f[0-9]+]], [[FA0]];
+; SM80-DAG: cvt.rpi.f32.f32 [[RF1:%f[0-9]+]], [[FA1]];
+; SM80-DAG: cvt.rn.bf16.f32 [[R0:%rs[0-9]+]], [[RF0]];
+; SM80-DAG: cvt.rn.bf16.f32 [[R1:%rs[0-9]+]], [[RF1]];
+; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
+; CHECK: st.param.b32 [func_retval0+0], [[R]];
+; CHECK: ret;
+define <2 x bfloat> @test_ceil(<2 x bfloat> %a) #0 {
+ %r = call <2 x bfloat> @llvm.ceil.f16(<2 x bfloat> %a)
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_trunc(
+; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_trunc_param_0];
+; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
+; SM90: cvt.rzi.bf16.bf16 [[R1:%rs[0-9]+]], [[A1]];
+; SM90: cvt.rzi.bf16.bf16 [[R0:%rs[0-9]+]], [[A0]];
+; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
+; CHECK: st.param.b32 [func_retval0+0], [[R]];
+; CHECK: ret;
+define <2 x bfloat> @test_trunc(<2 x bfloat> %a) #0 {
+ %r = call <2 x bfloat> @llvm.trunc.f16(<2 x bfloat> %a)
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_rint(
+; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_rint_param_0];
+; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
+; SM90: cvt.rni.bf16.bf16 [[R1:%rs[0-9]+]], [[A1]];
+; SM90: cvt.rni.bf16.bf16 [[R0:%rs[0-9]+]], [[A0]];
+; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
+; CHECK: st.param.b32 [func_retval0+0], [[R]];
+; CHECK: ret;
+define <2 x bfloat> @test_rint(<2 x bfloat> %a) #0 {
+ %r = call <2 x bfloat> @llvm.rint.f16(<2 x bfloat> %a)
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_round(
+; CHECK: ld.param.b32 {{.*}}, [test_round_param_0];
+; check the use of sign mask and 0.5 to implement round
+; CHECK: and.b32 [[R1:%r[0-9]+]], {{.*}}, -2147483648;
+; CHECK: or.b32 {{.*}}, [[R1]], 1056964608;
+; CHECK: and.b32 [[R2:%r[0-9]+]], {{.*}}, -2147483648;
+; CHECK: or.b32 {{.*}}, [[R2]], 1056964608;
+; CHECK: st.param.b32 [func_retval0+0], {{.*}};
+; CHECK: ret;
+define <2 x bfloat> @test_round(<2 x bfloat> %a) #0 {
+ %r = call <2 x bfloat> @llvm.round.f16(<2 x bfloat> %a)
+ ret <2 x bfloat> %r
+}
+
+; CHECK-LABEL: test_copysign(
+; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_copysign_param_0];
+; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_copysign_param_1];
+; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
+; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
+; CHECK-DAG: abs.bf16 [[AW1:%rs[0-9]+]], [[A1]];
+; CHECK-DAG: neg.bf16 [[AY1:%rs[0-9]+]], [[AW1]];
+; CHECK-DAG: shr.u16 [[BS1:%rs[0-9]+]], [[B1]], 15;
+; CHECK-DAG: and.b16 [[BR1:%rs[0-9]+]], [[BS1]], 1;
+; CHECK-DAG: setp.eq.b16 [[P1:%p[0-9]+]], [[BR1]], 1;
+; CHECK-DAG: selp.b16 [[RS1:%rs[0-9]+]], [[AY1]], [[AW1]], [[P1]]
+; CHECK-DAG: abs.bf16 [[AW0:%rs[0-9]+]], [[A0]];
+; CHECK-DAG: neg.bf16 [[AY0:%rs[0-9]+]], [[AW0]];
+; CHECK-DAG: shr.u16 [[BS0:%rs[0-9]+]], [[B0]], 15;
+; CHECK-DAG: and.b16 [[BR0:%rs[0-9]+]], [[BS0]], 1;
+; CHECK-DAG: setp.eq.b16 [[P0:%p[0-9]+]], [[BR0]], 1;
+; CHECK-DAG: selp.b16 [[RS0:%rs[0-9]+]], [[AY0]], [[AW0]], [[P0]]
+; CHECK-DAG: mov.b32 [[R:%r[0-9]+]], {[[RS0]], [[RS1]]}
+; CHECK: st.param.b32 [func_retval0+0], [[R]];
+; CHECK: ret;
+define <2 x bfloat> @test_copysign(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
+ %r = call <2 x bfloat> @llvm.copysign.f16(<2 x bfloat> %a, <2 x bfloat> %b)
+ ret <2 x bfloat> %r
+}
+
diff --git a/llvm/test/CodeGen/NVPTX/zeroext-32bit.ll b/llvm/test/CodeGen/NVPTX/zeroext-32bit.ll
index 371543e30591..03a6626b9af2 100644
--- a/llvm/test/CodeGen/NVPTX/zeroext-32bit.ll
+++ b/llvm/test/CodeGen/NVPTX/zeroext-32bit.ll
@@ -1,27 +1,27 @@
-; RUN: llc < %s -march=nvptx64 -mcpu=sm_30 -verify-machineinstrs | FileCheck %s
-; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_30 -verify-machineinstrs | %ptxas-verify %}
-
-; The zeroext attribute below should be silently ignored because
-; we can pass a 32-bit integer across a function call without
-; needing to extend it.
-
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"
-target triple = "nvptx64-unknown-cuda"
-
-; CHECK-LABEL: .visible .func zeroext_test
-; CHECK-NOT: cvt.u32.u16
-define void @zeroext_test() {
- tail call void @call1(i32 zeroext 0)
- ret void
-}
-
-declare void @call1(i32 zeroext)
-
-; CHECK-LABEL: .visible .func signext_test
-; CHECK-NOT: cvt.s32.s16
-define void @signext_test() {
- tail call void @call2(i32 zeroext 0)
- ret void
-}
-
-declare void @call2(i32 zeroext)
+; RUN: llc < %s -march=nvptx64 -mcpu=sm_30 -verify-machineinstrs | FileCheck %s
+; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_30 -verify-machineinstrs | %ptxas-verify %}
+
+; The zeroext attribute below should be silently ignored because
+; we can pass a 32-bit integer across a function call without
+; needing to extend it.
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"
+target triple = "nvptx64-unknown-cuda"
+
+; CHECK-LABEL: .visible .func zeroext_test
+; CHECK-NOT: cvt.u32.u16
+define void @zeroext_test() {
+ tail call void @call1(i32 zeroext 0)
+ ret void
+}
+
+declare void @call1(i32 zeroext)
+
+; CHECK-LABEL: .visible .func signext_test
+; CHECK-NOT: cvt.s32.s16
+define void @signext_test() {
+ tail call void @call2(i32 zeroext 0)
+ ret void
+}
+
+declare void @call2(i32 zeroext)
diff --git a/llvm/test/CodeGen/SPARC/LeonSMACUMACInstructionUT.ll b/llvm/test/CodeGen/SPARC/LeonSMACUMACInstructionUT.ll
index 109fa8bd2bd9..1d960ee53a86 100644
--- a/llvm/test/CodeGen/SPARC/LeonSMACUMACInstructionUT.ll
+++ b/llvm/test/CodeGen/SPARC/LeonSMACUMACInstructionUT.ll
@@ -1,20 +1,20 @@
-; RUN: llc %s -O0 -march=sparc -mcpu=leon2 -o - | FileCheck %s
-; RUN: llc %s -O0 -march=sparc -mcpu=leon3 -o - | FileCheck %s
-; RUN: llc %s -O0 -march=sparc -mcpu=leon4 -o - | FileCheck %s
-
-; CHECK-LABEL: smac_test:
-; CHECK: smac %i1, %i0, %i0
-define i32 @smac_test(ptr %a, ptr %b) {
-entry:
-; %0 = tail call i32 asm sideeffect "smac $2, $1, $0", "={r2},{r3},{r4}"(i16* %a, i16* %b)
- %0 = tail call i32 asm sideeffect "smac $2, $1, $0", "=r,rI,r"(ptr %a, ptr %b)
- ret i32 %0
-}
-
-; CHECK-LABEL: umac_test:
-; CHECK: umac %i1, %i0, %i0
-define i32 @umac_test(ptr %a, ptr %b) {
-entry:
- %0 = tail call i32 asm sideeffect "umac $2, $1, $0", "=r,rI,r"(ptr %a, ptr %b)
- ret i32 %0
-}
+; RUN: llc %s -O0 -march=sparc -mcpu=leon2 -o - | FileCheck %s
+; RUN: llc %s -O0 -march=sparc -mcpu=leon3 -o - | FileCheck %s
+; RUN: llc %s -O0 -march=sparc -mcpu=leon4 -o - | FileCheck %s
+
+; CHECK-LABEL: smac_test:
+; CHECK: smac %i1, %i0, %i0
+define i32 @smac_test(ptr %a, ptr %b) {
+entry:
+; %0 = tail call i32 asm sideeffect "smac $2, $1, $0", "={r2},{r3},{r4}"(i16* %a, i16* %b)
+ %0 = tail call i32 asm sideeffect "smac $2, $1, $0", "=r,rI,r"(ptr %a, ptr %b)
+ ret i32 %0
+}
+
+; CHECK-LABEL: umac_test:
+; CHECK: umac %i1, %i0, %i0
+define i32 @umac_test(ptr %a, ptr %b) {
+entry:
+ %0 = tail call i32 asm sideeffect "umac $2, $1, $0", "=r,rI,r"(ptr %a, ptr %b)
+ ret i32 %0
+}
diff --git a/llvm/test/CodeGen/X86/dbg-value-superreg-copy2.mir b/llvm/test/CodeGen/X86/dbg-value-superreg-copy2.mir
index 86319da8db01..e29d00afcd41 100644
--- a/llvm/test/CodeGen/X86/dbg-value-superreg-copy2.mir
+++ b/llvm/test/CodeGen/X86/dbg-value-superreg-copy2.mir
@@ -40,7 +40,7 @@ body: |
%0:gr16_abcd = MOV16ri 1, debug-instr-number 1, debug-location !9
bb.1:
- DBG_INSTR_REF !7, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(2, 0), debug-location !9
+ DBG_INSTR_REF !7, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(2, 0), debug-location !9
%1:gr16 = COPY %0, debug-location !9
%2:gr16 = COPY %0
diff --git a/llvm/test/CodeGen/X86/non-value-mem-operand.mir b/llvm/test/CodeGen/X86/non-value-mem-operand.mir
index f188e821c2da..db8f0617a873 100644
--- a/llvm/test/CodeGen/X86/non-value-mem-operand.mir
+++ b/llvm/test/CodeGen/X86/non-value-mem-operand.mir
@@ -1,293 +1,293 @@
-# RUN: llc -run-pass implicit-null-checks -mtriple=x86_64-apple-macosx -o - %s | FileCheck %s
-
-# CHECK-NOT: FAULTING_OP
-
---- |
- target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
- target triple = "x86_64-unknown-linux-gnu"
-
- @global = external global i8*
- @global.1 = external global i8*
-
- declare i8* @ham(i8*, i8**)
-
- define void @eggs(i8* %arg) gc "statepoint-example" {
- bb:
- %tmp = call i8* undef(i8* undef, i8** undef)
- %tmp1 = icmp eq i8* %tmp, null
- br i1 %tmp1, label %bb2, label %bb3, !make.implicit !0
-
- bb2: ; preds = %bb
- br i1 undef, label %bb51, label %bb59
-
- bb3: ; preds = %bb
- %tmp4 = getelementptr inbounds i8, i8* %tmp, i64 16
- %tmp5 = bitcast i8* %tmp4 to i64*
- br label %bb7
-
- bb7: ; preds = %bb37, %bb3
- %tmp8 = phi i64* [ %tmp5, %bb3 ], [ %tmp18, %bb37 ]
- %tmp10 = phi i32 [ undef, %bb3 ], [ %tmp48, %bb37 ]
- %tmp12 = phi i32 [ 0, %bb3 ], [ 6, %bb37 ]
- %tmp13 = phi double [ 0.000000e+00, %bb3 ], [ 2.000000e+00, %bb37 ]
- %tmp14 = zext i32 %tmp10 to i64
- br i1 undef, label %bb26, label %bb15
-
- bb15: ; preds = %bb7
- %tmp16 = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* nonnull elementtype(void ()) @wibble, i32 0, i32 0, i32 0, i32 0) ["deopt" (i32 1, i32 0, i32 99, i32 0, i32 12, i32 0, i32 10, i32 %tmp10, i32 10, i32 0, i32 10, i32 %tmp12, i32 10, i32 undef, i32 6, float undef, i32 7, double %tmp13, i32 99, i8* null, i32 7, double undef, i32 99, i8* null, i32 13, i8* %tmp, i32 7, double undef, i32 99, i8* null, i8* undef)]
- br label %bb26
-
- bb26: ; preds = %bb15, %bb7
- %tmp18 = phi i64* [ %tmp8, %bb7 ], [ undef, %bb15 ]
- %tmp20 = sub i32 0, 0
- %tmp21 = select i1 undef, i32 0, i32 %tmp20
- %tmp22 = sext i32 %tmp21 to i64
- %tmp23 = load i8*, i8** @global.1, align 8
- %tmp24 = icmp eq i8* %tmp23, null
- %tmp25 = select i1 %tmp24, i8* null, i8* undef
- %tmp27 = load i32, i32* undef, align 4
- %sunkaddr = mul i64 %tmp14, 8
- %tmp2 = bitcast i64* %tmp18 to i8*
- %sunkaddr1 = getelementptr i8, i8* %tmp2, i64 %sunkaddr
- %tmp3 = bitcast i8* %sunkaddr1 to i64*
- %tmp28 = load i64, i64* %tmp3, align 8
- %tmp29 = add i64 %tmp28, 1
- store i64 %tmp29, i64* %tmp3, align 8
- %tmp30 = trunc i64 %tmp28 to i32
- %tmp31 = sub i32 %tmp27, %tmp30
- store i32 %tmp31, i32* undef, align 4
- %tmp32 = getelementptr inbounds i8, i8* %tmp25, i64 768
- %tmp33 = bitcast i8* %tmp32 to i64*
- %tmp34 = load i64, i64* %tmp33, align 8
- br i1 undef, label %bb37, label %bb35
-
- bb35: ; preds = %bb26
- %tmp36 = call i8* @ham(i8* undef, i8** nonnull @global)
- br label %bb37
-
- bb37: ; preds = %bb35, %bb26
- %tmp38 = phi i8* [ %tmp36, %bb35 ], [ undef, %bb26 ]
- %tmp39 = getelementptr inbounds i8, i8* %tmp38, i64 760
- %tmp40 = bitcast i8* %tmp39 to i64*
- %tmp41 = load i64, i64* %tmp40, align 8
- %tmp42 = icmp slt i64 %tmp34, %tmp41
- %tmp43 = select i1 %tmp42, i64 %tmp41, i64 %tmp34
- %tmp44 = and i64 %tmp43, 63
- %tmp45 = ashr i64 %tmp29, %tmp44
- %sunkaddr2 = mul i64 %tmp14, 8
- %tmp6 = bitcast i64* %tmp18 to i8*
- %sunkaddr3 = getelementptr i8, i8* %tmp6, i64 %sunkaddr2
- %tmp7 = bitcast i8* %sunkaddr3 to i64*
- store i64 %tmp45, i64* %tmp7, align 8
- %tmp46 = sub i64 0, %tmp22
- store i64 %tmp46, i64* undef, align 8
- %tmp47 = add nsw i32 %tmp12, 1
- %tmp48 = add i32 %tmp10, 1
- %tmp49 = icmp sgt i32 %tmp48, 15140
- br i1 %tmp49, label %bb51.loopexit, label %bb7
-
- bb51.loopexit: ; preds = %bb37
- %tmp9 = add i32 %tmp10, 1
- br label %bb51
-
- bb51: ; preds = %bb51.loopexit, %bb2
- %tmp52 = phi i32 [ %tmp47, %bb51.loopexit ], [ 0, %bb2 ]
- %tmp53 = phi double [ 2.000000e+00, %bb51.loopexit ], [ 0.000000e+00, %bb2 ]
- %tmp54 = phi i32 [ %tmp9, %bb51.loopexit ], [ undef, %bb2 ]
- %tmp56 = add i32 %tmp54, 0
- %tmp57 = call token (i64, i32, void (i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidi32f(i64 2882400000, i32 0, void (i32)* nonnull elementtype(void (i32)) @wobble, i32 1, i32 0, i32 -121, i32 0, i32 0) ["deopt" (i32 1, i32 0, i32 270, i32 4, i32 12, i32 0, i32 11, i64 undef, i32 99, i8* null, i32 10, i32 %tmp56, i32 6, float undef, i32 99, i8* null, i32 99, i8* null, i32 10, i32 %tmp52, i32 10, i32 undef, i32 99, i8* null, i32 7, double %tmp53, i32 99, i8* null, i32 7, double undef, i32 99, i8* null, i32 13, i8* undef, i32 99, i8* null, i32 99, i8* null, i8* undef)]
- unreachable
-
- bb59: ; preds = %bb2
- %tmp61 = call token (i64, i32, void (i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidi32f(i64 2882400000, i32 0, void (i32)* nonnull elementtype(void (i32)) @wobble, i32 1, i32 0, i32 8, i32 0, i32 0) ["deopt" (i32 1, i32 0, i32 123, i32 4, i32 12, i32 0, i32 13, i8* null, i32 99, i32 undef, i32 13, i8* null, i32 10, i32 undef, i32 99, i32 undef, i32 99, i32 undef, i32 99, i32 undef, i32 99, i8* null, i32 99, float undef, i32 99, double undef, i32 99, i8* null, i32 99, double undef, i32 99, i8* null, i32 13, i8* null, i32 99, double undef, i32 99, i8* null)]
- unreachable
- }
-
- declare void @wibble()
-
- declare void @wobble(i32)
-
- declare token @llvm.experimental.gc.statepoint.p0f_isVoidi32f(i64, i32, void (i32)*, i32, i32, ...)
-
- declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)
-
- ; Function Attrs: nounwind
- declare void @llvm.stackprotector(i8*, i8**) #0
-
- attributes #0 = { nounwind }
-
- !0 = !{}
-...
----
-name: eggs
-alignment: 16
-tracksRegLiveness: true
-fixedStack:
- - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, callee-saved-register: '$rbx' }
- - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, callee-saved-register: '$r12' }
- - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, callee-saved-register: '$r13' }
- - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, callee-saved-register: '$r14' }
- - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$r15' }
- - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$rbp' }
-stack:
- - { id: 0, offset: -88, size: 8, alignment: 8 }
- - { id: 1, offset: -96, size: 8, alignment: 8 }
- - { id: 2, offset: -104, size: 8, alignment: 8 }
- - { id: 3, offset: -64, size: 8, alignment: 8 }
- - { id: 4, type: spill-slot, offset: -72, size: 8, alignment: 8 }
- - { id: 5, type: spill-slot, offset: -80, size: 8, alignment: 8 }
-constants:
- - id: 0
- value: 'double 2.000000e+00'
- alignment: 8
-body: |
- bb.0.bb:
- successors: %bb.1.bb2(0x00000800), %bb.3.bb3(0x7ffff800)
- liveins: $rbp, $r15, $r14, $r13, $r12, $rbx
-
- frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
- frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp
- frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp
- frame-setup PUSH64r killed $r13, implicit-def $rsp, implicit $rsp
- frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp
- frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
- $rsp = frame-setup SUB64ri8 $rsp, 56, implicit-def dead $eflags
- CALL64r undef $rax, csr_64, implicit $rsp, implicit undef $rdi, implicit undef $rsi, implicit-def $rsp, implicit-def $rax
- TEST64rr $rax, $rax, implicit-def $eflags
- JCC_1 %bb.3.bb3, 5, implicit killed $eflags
-
- bb.1.bb2:
- successors: %bb.2(0x40000000), %bb.13.bb59(0x40000000)
-
- $ebp = XOR32rr undef $ebp, undef $ebp, implicit-def dead $eflags
- TEST8rr $bpl, $bpl, implicit-def $eflags
- JCC_1 %bb.13.bb59, 4, implicit killed $eflags
-
- bb.2:
- successors: %bb.12.bb51(0x80000000)
- liveins: $ebp
-
- $xmm0 = XORPSrr undef $xmm0, undef $xmm0
- $ebx = IMPLICIT_DEF implicit-def $rbx
- JMP_1 %bb.12.bb51
-
- bb.3.bb3:
- successors: %bb.4.bb7(0x80000000)
- liveins: $rax
-
- MOV64mr $rsp, 1, $noreg, 32, $noreg, $rax :: (store (s64) into %stack.5)
- $r12 = MOV64rr killed $rax
- $r12 = ADD64ri8 killed $r12, 16, implicit-def dead $eflags
- $xmm0 = XORPSrr undef $xmm0, undef $xmm0
- $esi = XOR32rr undef $esi, undef $esi, implicit-def dead $eflags
- $rax = MOV64ri %const.0
- $xmm1 = MOVSDrm_alt killed $rax, 1, $noreg, 0, $noreg :: (load (s64) from constant-pool)
- MOVSDmr $rsp, 1, $noreg, 40, $noreg, killed $xmm1 :: (store (s64) into %stack.4)
- $eax = IMPLICIT_DEF
- $ecx = XOR32rr undef $ecx, undef $ecx, implicit-def dead $eflags
-
- bb.4.bb7:
- successors: %bb.6.bb26(0x40000000), %bb.5.bb15(0x40000000)
- liveins: $eax, $ecx, $esi, $r12, $xmm0
-
- $ebp = MOV32rr killed $ecx
- $ebx = MOV32rr killed $eax, implicit-def $rbx
- $r14d = MOV32rr $ebx, implicit-def $r14
- TEST8rr $sil, $sil, implicit-def $eflags
- JCC_1 %bb.6.bb26, 5, implicit $eflags
-
- bb.5.bb15:
- successors: %bb.6.bb26(0x80000000)
- liveins: $ebp, $rbx, $r14, $xmm0
-
- MOV32mr $rsp, 1, $noreg, 24, $noreg, $ebx :: (store (s32) into %stack.0, align 8)
- MOV32mr $rsp, 1, $noreg, 16, $noreg, $ebp :: (store (s32) into %stack.1, align 8)
- MOVSDmr $rsp, 1, $noreg, 8, $noreg, killed $xmm0 :: (store (s64) into %stack.2)
- $rax = MOV64rm $rsp, 1, $noreg, 32, $noreg :: (load (s64) from %stack.5)
- MOV64mr $rsp, 1, $noreg, 48, $noreg, killed $rax :: (store (s64) into %stack.3)
- $rax = MOV64ri @wibble
- STATEPOINT 2882400000, 0, 0, killed $rax, 2, 0, 2, 0, 2, 30, 2, 1, 2, 0, 2, 99, 2, 0, 2, 12, 2, 0, 2, 10, 1, 8, $rsp, 24, 2, 10, 2, 0, 2, 10, 1, 8, $rsp, 16, 2, 10, 2, 4278124286, 2, 6, 2, 4278124286, 2, 7, 1, 8, $rsp, 8, 2, 99, 2, 0, 2, 7, 2, 4278124286, 2, 99, 2, 0, 2, 13, 1, 8, $rsp, 48, 2, 7, 2, 4278124286, 2, 99, 2, 0, 2, 0, 2, 0, 2, 0, csr_64, implicit-def $rsp :: (volatile load (s64) from %stack.0), (volatile load (s64) from %stack.1), (volatile load (s64) from %stack.2), (volatile load (s64) from %stack.3)
- $esi = XOR32rr undef $esi, undef $esi, implicit-def dead $eflags
- $r12 = IMPLICIT_DEF
-
- bb.6.bb26:
- successors: %bb.8.bb37(0x40000000), %bb.7.bb35(0x40000000)
- liveins: $ebp, $esi, $rbx, $r12, $r14
-
- $rax = MOV64ri @global.1
- $rax = MOV64rm killed $rax, 1, $noreg, 0, $noreg :: (dereferenceable load (s64) from @global.1)
- TEST64rr $rax, $rax, implicit-def $eflags
- $rax = CMOV64rr undef $rax, killed $rax, 4, implicit killed $eflags
- $ecx = MOV32rm undef $rax, 1, $noreg, 0, $noreg :: (load (s32) from `i32* undef`)
- $rdx = MOV64rm $r12, 8, $r14, 0, $noreg :: (load (s64) from %ir.tmp3)
- $r15 = LEA64r $rdx, 1, $noreg, 1, _
- MOV64mr $r12, 8, $r14, 0, $noreg, $r15 :: (store (s64) into %ir.tmp3)
- $ecx = SUB32rr killed $ecx, $edx, implicit-def dead $eflags, implicit killed $rdx
- MOV32mr undef $rax, 1, $noreg, 0, $noreg, killed $ecx :: (store (s32) into `i32* undef`)
- $r13 = MOV64rm killed $rax, 1, $noreg, 768, $noreg :: (load (s64) from %ir.tmp33)
- TEST8rr $sil, $sil, implicit-def $eflags
- $rax = IMPLICIT_DEF
- JCC_1 %bb.8.bb37, 5, implicit $eflags
-
- bb.7.bb35:
- successors: %bb.8.bb37(0x80000000)
- liveins: $ebp, $rbx, $r12, $r13, $r14, $r15
-
- $rsi = MOV64ri @global
- $rax = MOV64ri @ham
- CALL64r killed $rax, csr_64, implicit $rsp, implicit undef $rdi, implicit $rsi, implicit-def $rsp, implicit-def $rax
- $esi = XOR32rr undef $esi, undef $esi, implicit-def dead $eflags
-
- bb.8.bb37:
- successors: %bb.9.bb37(0x40000000), %bb.10.bb37(0x40000000)
- liveins: $ebp, $esi, $rax, $rbx, $r12, $r13, $r14, $r15
-
- $rcx = MOV64rm killed $rax, 1, $noreg, 760, $noreg :: (load (s64) from %ir.tmp40)
- CMP64rr $r13, $rcx, implicit-def $eflags
- JCC_1 %bb.10.bb37, 12, implicit $eflags
-
- bb.9.bb37:
- successors: %bb.10.bb37(0x80000000)
- liveins: $ebp, $esi, $rbx, $r12, $r13, $r14, $r15
-
- $cl = MOV8rr $r13b, implicit killed $r13, implicit-def $rcx
-
- bb.10.bb37:
- successors: %bb.11.bb51.loopexit(0x00000800), %bb.4.bb7(0x7ffff800)
- liveins: $ebp, $esi, $rbx, $rcx, $r12, $r14, $r15
-
- $cl = KILL $cl, implicit killed $rcx
- $r15 = SAR64rCL killed $r15, implicit-def dead $eflags, implicit $cl
- MOV64mr $r12, 8, killed $r14, 0, $noreg, killed $r15 :: (store (s64) into %ir.tmp7)
- MOV64mi32 undef $rax, 1, $noreg, 0, $noreg, 0 :: (store (s64) into `i64* undef`)
- $eax = LEA64_32r $rbx, 1, $noreg, 1, _
- $ecx = MOV32ri 6
- CMP32ri $eax, 15141, implicit-def $eflags
- $xmm0 = MOVSDrm_alt $rsp, 1, $noreg, 40, $noreg :: (load (s64) from %stack.4)
- JCC_1 %bb.4.bb7, 12, implicit $eflags
-
- bb.11.bb51.loopexit:
- successors: %bb.12.bb51(0x80000000)
- liveins: $ebp, $rbx
-
- $ebp = INC32r killed $ebp, implicit-def dead $eflags
- $ebx = INC32r $ebx, implicit-def dead $eflags, implicit killed $rbx, implicit-def $rbx
- $rax = MOV64ri %const.0
- $xmm0 = MOVSDrm_alt killed $rax, 1, $noreg, 0, $noreg :: (load (s64) from constant-pool)
-
- bb.12.bb51:
- liveins: $ebp, $rbx, $xmm0
-
- MOV32mr $rsp, 1, $noreg, 24, $noreg, $ebx, implicit killed $rbx :: (store (s32) into %stack.0, align 8)
- MOV32mr $rsp, 1, $noreg, 16, $noreg, killed $ebp :: (store (s32) into %stack.1, align 8)
- MOVSDmr $rsp, 1, $noreg, 8, $noreg, killed $xmm0 :: (store (s64) into %stack.2)
- $rax = MOV64ri @wobble
- $edi = MOV32ri -121
- STATEPOINT 2882400000, 0, 1, killed $rax, $edi, 2, 0, 2, 0, 2, 38, 2, 1, 2, 0, 2, 270, 2, 4, 2, 12, 2, 0, 2, 11, 2, 4278124286, 2, 99, 2, 0, 2, 10, 1, 8, $rsp, 24, 2, 6, 2, 4278124286, 2, 99, 2, 0, 2, 99, 2, 0, 2, 10, 1, 8, $rsp, 16, 2, 10, 2, 4278124286, 2, 99, 2, 0, 2, 7, 1, 8, $rsp, 8, 2, 99, 2, 0, 2, 7, 2, 4278124286, 2, 99, 2, 0, 2, 13, 2, 4278124286, 2, 99, 2, 0, 2, 99, 2, 0, 2, 0, 2, 0, 2, 0, csr_64, implicit-def $rsp :: (volatile load (s64) from %stack.0), (volatile load (s64) from %stack.1), (volatile load (s64) from %stack.2)
-
- bb.13.bb59:
- $rax = MOV64ri @wobble
- $edi = MOV32ri 8
- STATEPOINT 2882400000, 0, 1, killed $rax, $edi, 2, 0, 2, 0, 2, 38, 2, 1, 2, 0, 2, 123, 2, 4, 2, 12, 2, 0, 2, 13, 2, 0, 2, 99, 2, 4278124286, 2, 13, 2, 0, 2, 10, 2, 4278124286, 2, 99, 2, 4278124286, 2, 99, 2, 4278124286, 2, 99, 2, 4278124286, 2, 99, 2, 0, 2, 99, 2, 4278124286, 2, 99, 2, 4278124286, 2, 99, 2, 0, 2, 99, 2, 4278124286, 2, 99, 2, 0, 2, 13, 2, 0, 2, 99, 2, 4278124286, 2, 99, 2, 0, 2, 0, 2, 0, 2, 0, csr_64, implicit-def $rsp
-
-...
+# RUN: llc -run-pass implicit-null-checks -mtriple=x86_64-apple-macosx -o - %s | FileCheck %s
+
+# CHECK-NOT: FAULTING_OP
+
+--- |
+ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-unknown-linux-gnu"
+
+ @global = external global i8*
+ @global.1 = external global i8*
+
+ declare i8* @ham(i8*, i8**)
+
+ define void @eggs(i8* %arg) gc "statepoint-example" {
+ bb:
+ %tmp = call i8* undef(i8* undef, i8** undef)
+ %tmp1 = icmp eq i8* %tmp, null
+ br i1 %tmp1, label %bb2, label %bb3, !make.implicit !0
+
+ bb2: ; preds = %bb
+ br i1 undef, label %bb51, label %bb59
+
+ bb3: ; preds = %bb
+ %tmp4 = getelementptr inbounds i8, i8* %tmp, i64 16
+ %tmp5 = bitcast i8* %tmp4 to i64*
+ br label %bb7
+
+ bb7: ; preds = %bb37, %bb3
+ %tmp8 = phi i64* [ %tmp5, %bb3 ], [ %tmp18, %bb37 ]
+ %tmp10 = phi i32 [ undef, %bb3 ], [ %tmp48, %bb37 ]
+ %tmp12 = phi i32 [ 0, %bb3 ], [ 6, %bb37 ]
+ %tmp13 = phi double [ 0.000000e+00, %bb3 ], [ 2.000000e+00, %bb37 ]
+ %tmp14 = zext i32 %tmp10 to i64
+ br i1 undef, label %bb26, label %bb15
+
+ bb15: ; preds = %bb7
+ %tmp16 = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* nonnull elementtype(void ()) @wibble, i32 0, i32 0, i32 0, i32 0) ["deopt" (i32 1, i32 0, i32 99, i32 0, i32 12, i32 0, i32 10, i32 %tmp10, i32 10, i32 0, i32 10, i32 %tmp12, i32 10, i32 undef, i32 6, float undef, i32 7, double %tmp13, i32 99, i8* null, i32 7, double undef, i32 99, i8* null, i32 13, i8* %tmp, i32 7, double undef, i32 99, i8* null, i8* undef)]
+ br label %bb26
+
+ bb26: ; preds = %bb15, %bb7
+ %tmp18 = phi i64* [ %tmp8, %bb7 ], [ undef, %bb15 ]
+ %tmp20 = sub i32 0, 0
+ %tmp21 = select i1 undef, i32 0, i32 %tmp20
+ %tmp22 = sext i32 %tmp21 to i64
+ %tmp23 = load i8*, i8** @global.1, align 8
+ %tmp24 = icmp eq i8* %tmp23, null
+ %tmp25 = select i1 %tmp24, i8* null, i8* undef
+ %tmp27 = load i32, i32* undef, align 4
+ %sunkaddr = mul i64 %tmp14, 8
+ %tmp2 = bitcast i64* %tmp18 to i8*
+ %sunkaddr1 = getelementptr i8, i8* %tmp2, i64 %sunkaddr
+ %tmp3 = bitcast i8* %sunkaddr1 to i64*
+ %tmp28 = load i64, i64* %tmp3, align 8
+ %tmp29 = add i64 %tmp28, 1
+ store i64 %tmp29, i64* %tmp3, align 8
+ %tmp30 = trunc i64 %tmp28 to i32
+ %tmp31 = sub i32 %tmp27, %tmp30
+ store i32 %tmp31, i32* undef, align 4
+ %tmp32 = getelementptr inbounds i8, i8* %tmp25, i64 768
+ %tmp33 = bitcast i8* %tmp32 to i64*
+ %tmp34 = load i64, i64* %tmp33, align 8
+ br i1 undef, label %bb37, label %bb35
+
+ bb35: ; preds = %bb26
+ %tmp36 = call i8* @ham(i8* undef, i8** nonnull @global)
+ br label %bb37
+
+ bb37: ; preds = %bb35, %bb26
+ %tmp38 = phi i8* [ %tmp36, %bb35 ], [ undef, %bb26 ]
+ %tmp39 = getelementptr inbounds i8, i8* %tmp38, i64 760
+ %tmp40 = bitcast i8* %tmp39 to i64*
+ %tmp41 = load i64, i64* %tmp40, align 8
+ %tmp42 = icmp slt i64 %tmp34, %tmp41
+ %tmp43 = select i1 %tmp42, i64 %tmp41, i64 %tmp34
+ %tmp44 = and i64 %tmp43, 63
+ %tmp45 = ashr i64 %tmp29, %tmp44
+ %sunkaddr2 = mul i64 %tmp14, 8
+ %tmp6 = bitcast i64* %tmp18 to i8*
+ %sunkaddr3 = getelementptr i8, i8* %tmp6, i64 %sunkaddr2
+ %tmp7 = bitcast i8* %sunkaddr3 to i64*
+ store i64 %tmp45, i64* %tmp7, align 8
+ %tmp46 = sub i64 0, %tmp22
+ store i64 %tmp46, i64* undef, align 8
+ %tmp47 = add nsw i32 %tmp12, 1
+ %tmp48 = add i32 %tmp10, 1
+ %tmp49 = icmp sgt i32 %tmp48, 15140
+ br i1 %tmp49, label %bb51.loopexit, label %bb7
+
+ bb51.loopexit: ; preds = %bb37
+ %tmp9 = add i32 %tmp10, 1
+ br label %bb51
+
+ bb51: ; preds = %bb51.loopexit, %bb2
+ %tmp52 = phi i32 [ %tmp47, %bb51.loopexit ], [ 0, %bb2 ]
+ %tmp53 = phi double [ 2.000000e+00, %bb51.loopexit ], [ 0.000000e+00, %bb2 ]
+ %tmp54 = phi i32 [ %tmp9, %bb51.loopexit ], [ undef, %bb2 ]
+ %tmp56 = add i32 %tmp54, 0
+ %tmp57 = call token (i64, i32, void (i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidi32f(i64 2882400000, i32 0, void (i32)* nonnull elementtype(void (i32)) @wobble, i32 1, i32 0, i32 -121, i32 0, i32 0) ["deopt" (i32 1, i32 0, i32 270, i32 4, i32 12, i32 0, i32 11, i64 undef, i32 99, i8* null, i32 10, i32 %tmp56, i32 6, float undef, i32 99, i8* null, i32 99, i8* null, i32 10, i32 %tmp52, i32 10, i32 undef, i32 99, i8* null, i32 7, double %tmp53, i32 99, i8* null, i32 7, double undef, i32 99, i8* null, i32 13, i8* undef, i32 99, i8* null, i32 99, i8* null, i8* undef)]
+ unreachable
+
+ bb59: ; preds = %bb2
+ %tmp61 = call token (i64, i32, void (i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidi32f(i64 2882400000, i32 0, void (i32)* nonnull elementtype(void (i32)) @wobble, i32 1, i32 0, i32 8, i32 0, i32 0) ["deopt" (i32 1, i32 0, i32 123, i32 4, i32 12, i32 0, i32 13, i8* null, i32 99, i32 undef, i32 13, i8* null, i32 10, i32 undef, i32 99, i32 undef, i32 99, i32 undef, i32 99, i32 undef, i32 99, i8* null, i32 99, float undef, i32 99, double undef, i32 99, i8* null, i32 99, double undef, i32 99, i8* null, i32 13, i8* null, i32 99, double undef, i32 99, i8* null)]
+ unreachable
+ }
+
+ declare void @wibble()
+
+ declare void @wobble(i32)
+
+ declare token @llvm.experimental.gc.statepoint.p0f_isVoidi32f(i64, i32, void (i32)*, i32, i32, ...)
+
+ declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)
+
+ ; Function Attrs: nounwind
+ declare void @llvm.stackprotector(i8*, i8**) #0
+
+ attributes #0 = { nounwind }
+
+ !0 = !{}
+...
+---
+name: eggs
+alignment: 16
+tracksRegLiveness: true
+fixedStack:
+ - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, callee-saved-register: '$rbx' }
+ - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, callee-saved-register: '$r12' }
+ - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, callee-saved-register: '$r13' }
+ - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, callee-saved-register: '$r14' }
+ - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$r15' }
+ - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$rbp' }
+stack:
+ - { id: 0, offset: -88, size: 8, alignment: 8 }
+ - { id: 1, offset: -96, size: 8, alignment: 8 }
+ - { id: 2, offset: -104, size: 8, alignment: 8 }
+ - { id: 3, offset: -64, size: 8, alignment: 8 }
+ - { id: 4, type: spill-slot, offset: -72, size: 8, alignment: 8 }
+ - { id: 5, type: spill-slot, offset: -80, size: 8, alignment: 8 }
+constants:
+ - id: 0
+ value: 'double 2.000000e+00'
+ alignment: 8
+body: |
+ bb.0.bb:
+ successors: %bb.1.bb2(0x00000800), %bb.3.bb3(0x7ffff800)
+ liveins: $rbp, $r15, $r14, $r13, $r12, $rbx
+
+ frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
+ frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp
+ frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp
+ frame-setup PUSH64r killed $r13, implicit-def $rsp, implicit $rsp
+ frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp
+ frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
+ $rsp = frame-setup SUB64ri8 $rsp, 56, implicit-def dead $eflags
+ CALL64r undef $rax, csr_64, implicit $rsp, implicit undef $rdi, implicit undef $rsi, implicit-def $rsp, implicit-def $rax
+ TEST64rr $rax, $rax, implicit-def $eflags
+ JCC_1 %bb.3.bb3, 5, implicit killed $eflags
+
+ bb.1.bb2:
+ successors: %bb.2(0x40000000), %bb.13.bb59(0x40000000)
+
+ $ebp = XOR32rr undef $ebp, undef $ebp, implicit-def dead $eflags
+ TEST8rr $bpl, $bpl, implicit-def $eflags
+ JCC_1 %bb.13.bb59, 4, implicit killed $eflags
+
+ bb.2:
+ successors: %bb.12.bb51(0x80000000)
+ liveins: $ebp
+
+ $xmm0 = XORPSrr undef $xmm0, undef $xmm0
+ $ebx = IMPLICIT_DEF implicit-def $rbx
+ JMP_1 %bb.12.bb51
+
+ bb.3.bb3:
+ successors: %bb.4.bb7(0x80000000)
+ liveins: $rax
+
+ MOV64mr $rsp, 1, $noreg, 32, $noreg, $rax :: (store (s64) into %stack.5)
+ $r12 = MOV64rr killed $rax
+ $r12 = ADD64ri8 killed $r12, 16, implicit-def dead $eflags
+ $xmm0 = XORPSrr undef $xmm0, undef $xmm0
+ $esi = XOR32rr undef $esi, undef $esi, implicit-def dead $eflags
+ $rax = MOV64ri %const.0
+ $xmm1 = MOVSDrm_alt killed $rax, 1, $noreg, 0, $noreg :: (load (s64) from constant-pool)
+ MOVSDmr $rsp, 1, $noreg, 40, $noreg, killed $xmm1 :: (store (s64) into %stack.4)
+ $eax = IMPLICIT_DEF
+ $ecx = XOR32rr undef $ecx, undef $ecx, implicit-def dead $eflags
+
+ bb.4.bb7:
+ successors: %bb.6.bb26(0x40000000), %bb.5.bb15(0x40000000)
+ liveins: $eax, $ecx, $esi, $r12, $xmm0
+
+ $ebp = MOV32rr killed $ecx
+ $ebx = MOV32rr killed $eax, implicit-def $rbx
+ $r14d = MOV32rr $ebx, implicit-def $r14
+ TEST8rr $sil, $sil, implicit-def $eflags
+ JCC_1 %bb.6.bb26, 5, implicit $eflags
+
+ bb.5.bb15:
+ successors: %bb.6.bb26(0x80000000)
+ liveins: $ebp, $rbx, $r14, $xmm0
+
+ MOV32mr $rsp, 1, $noreg, 24, $noreg, $ebx :: (store (s32) into %stack.0, align 8)
+ MOV32mr $rsp, 1, $noreg, 16, $noreg, $ebp :: (store (s32) into %stack.1, align 8)
+ MOVSDmr $rsp, 1, $noreg, 8, $noreg, killed $xmm0 :: (store (s64) into %stack.2)
+ $rax = MOV64rm $rsp, 1, $noreg, 32, $noreg :: (load (s64) from %stack.5)
+ MOV64mr $rsp, 1, $noreg, 48, $noreg, killed $rax :: (store (s64) into %stack.3)
+ $rax = MOV64ri @wibble
+ STATEPOINT 2882400000, 0, 0, killed $rax, 2, 0, 2, 0, 2, 30, 2, 1, 2, 0, 2, 99, 2, 0, 2, 12, 2, 0, 2, 10, 1, 8, $rsp, 24, 2, 10, 2, 0, 2, 10, 1, 8, $rsp, 16, 2, 10, 2, 4278124286, 2, 6, 2, 4278124286, 2, 7, 1, 8, $rsp, 8, 2, 99, 2, 0, 2, 7, 2, 4278124286, 2, 99, 2, 0, 2, 13, 1, 8, $rsp, 48, 2, 7, 2, 4278124286, 2, 99, 2, 0, 2, 0, 2, 0, 2, 0, csr_64, implicit-def $rsp :: (volatile load (s64) from %stack.0), (volatile load (s64) from %stack.1), (volatile load (s64) from %stack.2), (volatile load (s64) from %stack.3)
+ $esi = XOR32rr undef $esi, undef $esi, implicit-def dead $eflags
+ $r12 = IMPLICIT_DEF
+
+ bb.6.bb26:
+ successors: %bb.8.bb37(0x40000000), %bb.7.bb35(0x40000000)
+ liveins: $ebp, $esi, $rbx, $r12, $r14
+
+ $rax = MOV64ri @global.1
+ $rax = MOV64rm killed $rax, 1, $noreg, 0, $noreg :: (dereferenceable load (s64) from @global.1)
+ TEST64rr $rax, $rax, implicit-def $eflags
+ $rax = CMOV64rr undef $rax, killed $rax, 4, implicit killed $eflags
+ $ecx = MOV32rm undef $rax, 1, $noreg, 0, $noreg :: (load (s32) from `i32* undef`)
+ $rdx = MOV64rm $r12, 8, $r14, 0, $noreg :: (load (s64) from %ir.tmp3)
+ $r15 = LEA64r $rdx, 1, $noreg, 1, _
+ MOV64mr $r12, 8, $r14, 0, $noreg, $r15 :: (store (s64) into %ir.tmp3)
+ $ecx = SUB32rr killed $ecx, $edx, implicit-def dead $eflags, implicit killed $rdx
+ MOV32mr undef $rax, 1, $noreg, 0, $noreg, killed $ecx :: (store (s32) into `i32* undef`)
+ $r13 = MOV64rm killed $rax, 1, $noreg, 768, $noreg :: (load (s64) from %ir.tmp33)
+ TEST8rr $sil, $sil, implicit-def $eflags
+ $rax = IMPLICIT_DEF
+ JCC_1 %bb.8.bb37, 5, implicit $eflags
+
+ bb.7.bb35:
+ successors: %bb.8.bb37(0x80000000)
+ liveins: $ebp, $rbx, $r12, $r13, $r14, $r15
+
+ $rsi = MOV64ri @global
+ $rax = MOV64ri @ham
+ CALL64r killed $rax, csr_64, implicit $rsp, implicit undef $rdi, implicit $rsi, implicit-def $rsp, implicit-def $rax
+ $esi = XOR32rr undef $esi, undef $esi, implicit-def dead $eflags
+
+ bb.8.bb37:
+ successors: %bb.9.bb37(0x40000000), %bb.10.bb37(0x40000000)
+ liveins: $ebp, $esi, $rax, $rbx, $r12, $r13, $r14, $r15
+
+ $rcx = MOV64rm killed $rax, 1, $noreg, 760, $noreg :: (load (s64) from %ir.tmp40)
+ CMP64rr $r13, $rcx, implicit-def $eflags
+ JCC_1 %bb.10.bb37, 12, implicit $eflags
+
+ bb.9.bb37:
+ successors: %bb.10.bb37(0x80000000)
+ liveins: $ebp, $esi, $rbx, $r12, $r13, $r14, $r15
+
+ $cl = MOV8rr $r13b, implicit killed $r13, implicit-def $rcx
+
+ bb.10.bb37:
+ successors: %bb.11.bb51.loopexit(0x00000800), %bb.4.bb7(0x7ffff800)
+ liveins: $ebp, $esi, $rbx, $rcx, $r12, $r14, $r15
+
+ $cl = KILL $cl, implicit killed $rcx
+ $r15 = SAR64rCL killed $r15, implicit-def dead $eflags, implicit $cl
+ MOV64mr $r12, 8, killed $r14, 0, $noreg, killed $r15 :: (store (s64) into %ir.tmp7)
+ MOV64mi32 undef $rax, 1, $noreg, 0, $noreg, 0 :: (store (s64) into `i64* undef`)
+ $eax = LEA64_32r $rbx, 1, $noreg, 1, _
+ $ecx = MOV32ri 6
+ CMP32ri $eax, 15141, implicit-def $eflags
+ $xmm0 = MOVSDrm_alt $rsp, 1, $noreg, 40, $noreg :: (load (s64) from %stack.4)
+ JCC_1 %bb.4.bb7, 12, implicit $eflags
+
+ bb.11.bb51.loopexit:
+ successors: %bb.12.bb51(0x80000000)
+ liveins: $ebp, $rbx
+
+ $ebp = INC32r killed $ebp, implicit-def dead $eflags
+ $ebx = INC32r $ebx, implicit-def dead $eflags, implicit killed $rbx, implicit-def $rbx
+ $rax = MOV64ri %const.0
+ $xmm0 = MOVSDrm_alt killed $rax, 1, $noreg, 0, $noreg :: (load (s64) from constant-pool)
+
+ bb.12.bb51:
+ liveins: $ebp, $rbx, $xmm0
+
+ MOV32mr $rsp, 1, $noreg, 24, $noreg, $ebx, implicit killed $rbx :: (store (s32) into %stack.0, align 8)
+ MOV32mr $rsp, 1, $noreg, 16, $noreg, killed $ebp :: (store (s32) into %stack.1, align 8)
+ MOVSDmr $rsp, 1, $noreg, 8, $noreg, killed $xmm0 :: (store (s64) into %stack.2)
+ $rax = MOV64ri @wobble
+ $edi = MOV32ri -121
+ STATEPOINT 2882400000, 0, 1, killed $rax, $edi, 2, 0, 2, 0, 2, 38, 2, 1, 2, 0, 2, 270, 2, 4, 2, 12, 2, 0, 2, 11, 2, 4278124286, 2, 99, 2, 0, 2, 10, 1, 8, $rsp, 24, 2, 6, 2, 4278124286, 2, 99, 2, 0, 2, 99, 2, 0, 2, 10, 1, 8, $rsp, 16, 2, 10, 2, 4278124286, 2, 99, 2, 0, 2, 7, 1, 8, $rsp, 8, 2, 99, 2, 0, 2, 7, 2, 4278124286, 2, 99, 2, 0, 2, 13, 2, 4278124286, 2, 99, 2, 0, 2, 99, 2, 0, 2, 0, 2, 0, 2, 0, csr_64, implicit-def $rsp :: (volatile load (s64) from %stack.0), (volatile load (s64) from %stack.1), (volatile load (s64) from %stack.2)
+
+ bb.13.bb59:
+ $rax = MOV64ri @wobble
+ $edi = MOV32ri 8
+ STATEPOINT 2882400000, 0, 1, killed $rax, $edi, 2, 0, 2, 0, 2, 38, 2, 1, 2, 0, 2, 123, 2, 4, 2, 12, 2, 0, 2, 13, 2, 0, 2, 99, 2, 4278124286, 2, 13, 2, 0, 2, 10, 2, 4278124286, 2, 99, 2, 4278124286, 2, 99, 2, 4278124286, 2, 99, 2, 4278124286, 2, 99, 2, 0, 2, 99, 2, 4278124286, 2, 99, 2, 4278124286, 2, 99, 2, 0, 2, 99, 2, 4278124286, 2, 99, 2, 0, 2, 13, 2, 0, 2, 99, 2, 4278124286, 2, 99, 2, 0, 2, 0, 2, 0, 2, 0, csr_64, implicit-def $rsp
+
+...
diff --git a/llvm/test/CodeGen/X86/patchable-prologue-debuginfo.ll b/llvm/test/CodeGen/X86/patchable-prologue-debuginfo.ll
index e713418c8d8e..8802f97d958f 100644
--- a/llvm/test/CodeGen/X86/patchable-prologue-debuginfo.ll
+++ b/llvm/test/CodeGen/X86/patchable-prologue-debuginfo.ll
@@ -1,56 +1,56 @@
-; RUN: llc -verify-machineinstrs < %s | FileCheck %s --check-prefix=CHECK
-
-; Regression test for function patching asserting in some cases when debug info activated.
-; The code below reproduces this crash.
-
-; Compilation flag: clang -target x86_64-none-linux-gnu -c -O2 -g -fms-hotpatch patchable-prologue-debuginfo.c
-; int func( int val ) {
-; int neg = -val;
-; return neg + 1;
-; }
-
-; CHECK: # -- Begin function func
-
-; ModuleID = 'patchable-prologue-debuginfo.c'
-source_filename = "patchable-prologue-debuginfo.c"
-target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-none-linux-gnu"
-
-; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn uwtable
-define dso_local i32 @func(i32 noundef %val) local_unnamed_addr #0 !dbg !9 {
-entry:
- call void @llvm.dbg.value(metadata i32 %val, metadata !14, metadata !DIExpression()), !dbg !16
- call void @llvm.dbg.value(metadata !DIArgList(i32 0, i32 %val), metadata !15, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_minus, DW_OP_stack_value)), !dbg !16
- %add = sub i32 1, %val, !dbg !17
- ret i32 %add, !dbg !18
-}
-
-; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
-declare void @llvm.dbg.value(metadata, metadata, metadata) #1
-
-attributes #0 = { mustprogress nofree norecurse nosync nounwind readnone willreturn uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "patchable-function"="prologue-short-redirect" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
-attributes #1 = { nocallback nofree nosync nounwind readnone speculatable willreturn }
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!2, !3, !4, !5, !6, !7}
-!llvm.ident = !{!8}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 15.0.4 (git@gitlab-ncsa.ubisoft.org:LLVM/llvm-project.git 17850fb41c5bddcd80a9c2714f7e293f49fa8bb2)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
-!1 = !DIFile(filename: "patchable-prologue-debuginfo.c", directory: "D:\\saudi\\bugrepro-llvm-hotpatch-crash")
-!2 = !{i32 7, !"Dwarf Version", i32 4}
-!3 = !{i32 2, !"Debug Info Version", i32 3}
-!4 = !{i32 1, !"wchar_size", i32 4}
-!5 = !{i32 7, !"PIC Level", i32 2}
-!6 = !{i32 7, !"PIE Level", i32 2}
-!7 = !{i32 7, !"uwtable", i32 2}
-!8 = !{!"clang version 15.0.4 (git@gitlab-ncsa.ubisoft.org:LLVM/llvm-project.git 17850fb41c5bddcd80a9c2714f7e293f49fa8bb2)"}
-!9 = distinct !DISubprogram(name: "func", scope: !1, file: !1, line: 1, type: !10, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !13)
-!10 = !DISubroutineType(types: !11)
-!11 = !{!12, !12}
-!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-!13 = !{!14, !15}
-!14 = !DILocalVariable(name: "val", arg: 1, scope: !9, file: !1, line: 1, type: !12)
-!15 = !DILocalVariable(name: "neg", scope: !9, file: !1, line: 3, type: !12)
-!16 = !DILocation(line: 0, scope: !9)
-!17 = !DILocation(line: 4, column: 16, scope: !9)
-!18 = !DILocation(line: 4, column: 5, scope: !9)
+; RUN: llc -verify-machineinstrs < %s | FileCheck %s --check-prefix=CHECK
+
+; Regression test for function patching asserting in some cases when debug info activated.
+; The code below reproduces this crash.
+
+; Compilation flag: clang -target x86_64-none-linux-gnu -c -O2 -g -fms-hotpatch patchable-prologue-debuginfo.c
+; int func( int val ) {
+; int neg = -val;
+; return neg + 1;
+; }
+
+; CHECK: # -- Begin function func
+
+; ModuleID = 'patchable-prologue-debuginfo.c'
+source_filename = "patchable-prologue-debuginfo.c"
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-none-linux-gnu"
+
+; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn uwtable
+define dso_local i32 @func(i32 noundef %val) local_unnamed_addr #0 !dbg !9 {
+entry:
+ call void @llvm.dbg.value(metadata i32 %val, metadata !14, metadata !DIExpression()), !dbg !16
+ call void @llvm.dbg.value(metadata !DIArgList(i32 0, i32 %val), metadata !15, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_minus, DW_OP_stack_value)), !dbg !16
+ %add = sub i32 1, %val, !dbg !17
+ ret i32 %add, !dbg !18
+}
+
+; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
+declare void @llvm.dbg.value(metadata, metadata, metadata) #1
+
+attributes #0 = { mustprogress nofree norecurse nosync nounwind readnone willreturn uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "patchable-function"="prologue-short-redirect" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
+attributes #1 = { nocallback nofree nosync nounwind readnone speculatable willreturn }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!2, !3, !4, !5, !6, !7}
+!llvm.ident = !{!8}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 15.0.4 (git@gitlab-ncsa.ubisoft.org:LLVM/llvm-project.git 17850fb41c5bddcd80a9c2714f7e293f49fa8bb2)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
+!1 = !DIFile(filename: "patchable-prologue-debuginfo.c", directory: "D:\\saudi\\bugrepro-llvm-hotpatch-crash")
+!2 = !{i32 7, !"Dwarf Version", i32 4}
+!3 = !{i32 2, !"Debug Info Version", i32 3}
+!4 = !{i32 1, !"wchar_size", i32 4}
+!5 = !{i32 7, !"PIC Level", i32 2}
+!6 = !{i32 7, !"PIE Level", i32 2}
+!7 = !{i32 7, !"uwtable", i32 2}
+!8 = !{!"clang version 15.0.4 (git@gitlab-ncsa.ubisoft.org:LLVM/llvm-project.git 17850fb41c5bddcd80a9c2714f7e293f49fa8bb2)"}
+!9 = distinct !DISubprogram(name: "func", scope: !1, file: !1, line: 1, type: !10, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !13)
+!10 = !DISubroutineType(types: !11)
+!11 = !{!12, !12}
+!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!13 = !{!14, !15}
+!14 = !DILocalVariable(name: "val", arg: 1, scope: !9, file: !1, line: 1, type: !12)
+!15 = !DILocalVariable(name: "neg", scope: !9, file: !1, line: 3, type: !12)
+!16 = !DILocation(line: 0, scope: !9)
+!17 = !DILocation(line: 4, column: 16, scope: !9)
+!18 = !DILocation(line: 4, column: 5, scope: !9)
diff --git a/llvm/test/CodeGen/X86/post-ra-sched-with-debug.mir b/llvm/test/CodeGen/X86/post-ra-sched-with-debug.mir
index 523940e2d675..65675ced011f 100644
--- a/llvm/test/CodeGen/X86/post-ra-sched-with-debug.mir
+++ b/llvm/test/CodeGen/X86/post-ra-sched-with-debug.mir
@@ -298,8 +298,8 @@ body: |
$rcx = CMOV64rr killed $rcx, killed $rdx, 5, implicit killed $eflags
$rcx = OR64rr killed $rcx, killed $rsi, implicit-def dead $eflags
$rdx = MOVSX64rm32 $rbx, 1, $noreg, 0, $noreg :: (load (s32), align 8)
- DBG_INSTR_REF !46, !17, dbg-instr-ref(1, 0), debug-location !48
- DBG_INSTR_REF !39, !17, dbg-instr-ref(2, 0), debug-location !44
+ DBG_INSTR_REF !46, !17, dbg-instr-ref(1, 0), debug-location !48
+ DBG_INSTR_REF !39, !17, dbg-instr-ref(2, 0), debug-location !44
TEST32mr killed $rcx, 4, killed $rdx, 0, $noreg, killed $eax, implicit-def $eflags :: (load (s32))
JCC_1 %bb.2, 5, implicit $eflags
JMP_1 %bb.3
diff --git a/llvm/test/CodeGen/X86/windows-seh-EHa-CppCatchDotDotDot.ll b/llvm/test/CodeGen/X86/windows-seh-EHa-CppCatchDotDotDot.ll
index 25d92033cc6b..944ffab24a5d 100644
--- a/llvm/test/CodeGen/X86/windows-seh-EHa-CppCatchDotDotDot.ll
+++ b/llvm/test/CodeGen/X86/windows-seh-EHa-CppCatchDotDotDot.ll
@@ -1,290 +1,290 @@
-; RUN: llc -verify-machineinstrs < %s | FileCheck %s
-
-; CHECK-LABEL: "$cppxdata$?crash@@YAXH@Z":
-; CHECK: .long ("$stateUnwindMap$?crash@@YAXH@Z")
-; CHECK: .long ("$tryMap$?crash@@YAXH@Z")@IMGREL # TryBlockMap
-; CHECK-NEXT: .long 6 # IPMapEntries
-; CHECK-NEXT: .long ("$ip2state$?crash@@YAXH@Z")
-
-; CHECK-LABEL: "$stateUnwindMap$?crash@@YAXH@Z":
-; CHECK-NEXT: .long -1
-; CHECK-NEXT: .long 0
-; CHECK-NEXT: .long 0
-; CHECK-NEXT: .long "?dtor$
-; CHECK-NEXT: .long -1
-; CHECK-NEXT: .long 0
-
-; CHECK-LABEL: "$tryMap$?crash@@YAXH@Z":
-; CHECK-NEXT: .long 0
-; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long 2
-; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long ("$handlerMap$
-
-; CHECK: "$handlerMap$0$?crash@@YAXH@Z"
-; CHECK-NEXT: .long 0
-; CHECK-NEXT: .long 0
-; CHECK-NEXT: .long 0
-; CHECK-NEXT: .long "?catch$
-
-; CHECK-LABEL: "$ip2state$?crash@@YAXH@Z":
-; CHECK-NEXT: .long .Lfunc_begin0@IMGREL
-; CHECK-NEXT: .long -1
-; CHECK-NEXT: .long .Ltmp
-; CHECK-NEXT: .long 0
-; CHECK-NEXT: .long .Ltmp
-; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Ltmp
-; CHECK-NEXT: .long 0
-; CHECK-NEXT: .long .Ltmp
-; CHECK-NEXT: .long -1
-; CHECK-NEXT: .long "?catch$
-; CHECK-NEXT: .long 2
-
-; ModuleID = 'windows-seh-EHa-CppCatchDotDotDot.cpp'
-source_filename = "windows-seh-EHa-CppCatchDotDotDot.cpp"
-target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-windows-msvc"
-
-%rtti.TypeDescriptor2 = type { ptr, ptr, [3 x i8] }
-%eh.CatchableType = type { i32, i32, i32, i32, i32, i32, i32 }
-%eh.CatchableTypeArray.1 = type { i32, [1 x i32] }
-%eh.ThrowInfo = type { i32, i32, i32, i32 }
-%struct.A = type { i8 }
-
-$"??_C@_0BJ@EIKFKKLB@?5in?5catch?$CI?4?4?4?$CJ?5funclet?5?6?$AA@" = comdat any
-
-$"??_R0H@8" = comdat any
-
-$"_CT??_R0H@84" = comdat any
-
-$_CTA1H = comdat any
-
-$_TI1H = comdat any
-
-$"??_C@_0CN@MKCAOFNA@?5Test?5CPP?5unwind?3?5in?5except?5hand@" = comdat any
-
-$"??_C@_0N@LJHFFAKD@?5in?5A?5ctor?5?6?$AA@" = comdat any
-
-$"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@" = comdat any
-
-@"?pt1@@3PEAHEA" = dso_local global ptr null, align 8
-@"?pt2@@3PEAHEA" = dso_local global ptr null, align 8
-@"?pt3@@3PEAHEA" = dso_local global ptr null, align 8
-@"?g@@3HA" = dso_local global i32 0, align 4
-@"??_C@_0BJ@EIKFKKLB@?5in?5catch?$CI?4?4?4?$CJ?5funclet?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [25 x i8] c" in catch(...) funclet \0A\00", comdat, align 1
-@"??_7type_info@@6B@" = external constant ptr
-@"??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { ptr @"??_7type_info@@6B@", ptr null, [3 x i8] c".H\00" }, comdat
-@__ImageBase = external dso_local constant i8
-@"_CT??_R0H@84" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 1, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R0H@8" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32), i32 0, i32 -1, i32 0, i32 4, i32 0 }, section ".xdata", comdat
-@_CTA1H = linkonce_odr unnamed_addr constant %eh.CatchableTypeArray.1 { i32 1, [1 x i32] [i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"_CT??_R0H@84" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32)] }, section ".xdata", comdat
-@_TI1H = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 0, i32 0, i32 0, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @_CTA1H to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32) }, section ".xdata", comdat
-@"??_C@_0CN@MKCAOFNA@?5Test?5CPP?5unwind?3?5in?5except?5hand@" = linkonce_odr dso_local unnamed_addr constant [45 x i8] c" Test CPP unwind: in except handler i = %d \0A\00", comdat, align 1
-@"??_C@_0N@LJHFFAKD@?5in?5A?5ctor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in A ctor \0A\00", comdat, align 1
-@"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in A dtor \0A\00", comdat, align 1
-
-; Function Attrs: noinline nounwind optnone
-define dso_local void @"?foo@@YAXXZ"() #0 {
-entry:
- store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
- ret void
-}
-
-; Function Attrs: noinline optnone
-define dso_local void @"?crash@@YAXH@Z"(i32 %i) #1 personality ptr @__CxxFrameHandler3 {
-entry:
- %i.addr = alloca i32, align 4
- %ObjA = alloca %struct.A, align 1
- %tmp = alloca i32, align 4
- store i32 %i, ptr %i.addr, align 4
- %0 = load i32, ptr %i.addr, align 4
- store i32 %0, ptr @"?g@@3HA", align 4
- invoke void @llvm.seh.try.begin()
- to label %invoke.cont unwind label %catch.dispatch
-
-invoke.cont: ; preds = %entry
- %call = invoke ptr @"??0A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjA)
- to label %invoke.cont1 unwind label %catch.dispatch
-
-invoke.cont1: ; preds = %invoke.cont
- invoke void @llvm.seh.scope.begin()
- to label %invoke.cont2 unwind label %ehcleanup
-
-invoke.cont2: ; preds = %invoke.cont1
- %1 = load i32, ptr %i.addr, align 4
- %cmp = icmp eq i32 %1, 1
- br i1 %cmp, label %if.then, label %if.end
-
-if.then: ; preds = %invoke.cont2
- store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
- br label %if.end
-
-if.end: ; preds = %if.then, %invoke.cont2
- invoke void @llvm.seh.scope.end()
- to label %invoke.cont3 unwind label %ehcleanup
-
-invoke.cont3: ; preds = %if.end
- call void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjA) #6
- br label %try.cont
-
-ehcleanup: ; preds = %if.end, %invoke.cont1
- %2 = cleanuppad within none []
- call void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjA) #6 [ "funclet"(token %2) ]
- cleanupret from %2 unwind label %catch.dispatch
-
-catch.dispatch: ; preds = %ehcleanup, %invoke.cont, %entry
- %3 = catchswitch within none [label %catch] unwind to caller
-
-catch: ; preds = %catch.dispatch
- %4 = catchpad within %3 [ptr null, i32 0, ptr null]
- call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0BJ@EIKFKKLB@?5in?5catch?$CI?4?4?4?$CJ?5funclet?5?6?$AA@") [ "funclet"(token %4) ]
- %5 = load i32, ptr %i.addr, align 4
- %cmp4 = icmp eq i32 %5, 1
- br i1 %cmp4, label %if.then5, label %if.end6
-
-if.then5: ; preds = %catch
- %6 = load i32, ptr %i.addr, align 4
- store i32 %6, ptr %tmp, align 4
- %7 = bitcast ptr %tmp to ptr
- call void @_CxxThrowException(ptr %7, ptr @_TI1H) #7 [ "funclet"(token %4) ]
- unreachable
-
-if.end6: ; preds = %catch
- catchret from %4 to label %catchret.dest
-
-catchret.dest: ; preds = %if.end6
- br label %try.cont
-
-try.cont: ; preds = %catchret.dest, %invoke.cont3
- ret void
-}
-
-; Function Attrs: nounwind willreturn
-declare dso_local void @llvm.seh.try.begin() #2
-
-declare dso_local i32 @__CxxFrameHandler3(...)
-
-; Function Attrs: noinline optnone
-define internal ptr @"??0A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr returned %this) unnamed_addr #1 align 2 {
-entry:
- %retval = alloca ptr, align 8
- %this.addr = alloca ptr, align 8
- store ptr %this, ptr %this.addr, align 8
- %this1 = load ptr, ptr %this.addr, align 8
- store ptr %this1, ptr %retval, align 8
- call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0N@LJHFFAKD@?5in?5A?5ctor?5?6?$AA@")
- %0 = load i32, ptr @"?g@@3HA", align 4
- %cmp = icmp eq i32 %0, 0
- br i1 %cmp, label %if.then, label %if.end
-
-if.then: ; preds = %entry
- store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
- br label %if.end
-
-if.end: ; preds = %if.then, %entry
- %1 = load ptr, ptr %retval, align 8
- ret ptr %1
-}
-
-; Function Attrs: nounwind readnone
-declare dso_local void @llvm.seh.scope.begin() #3
-
-; Function Attrs: nounwind readnone
-declare dso_local void @llvm.seh.scope.end() #3
-
-; Function Attrs: noinline nounwind optnone
-define internal void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %this) unnamed_addr #0 align 2 {
-entry:
- %this.addr = alloca ptr, align 8
- store ptr %this, ptr %this.addr, align 8
- %this1 = load ptr, ptr %this.addr, align 8
- call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@")
- ret void
-}
-
-declare dso_local void @"?printf@@YAXZZ"(...) #4
-
-declare dso_local void @_CxxThrowException(ptr, ptr)
-
-; Function Attrs: noinline norecurse optnone
-define dso_local i32 @main() #5 personality ptr @__C_specific_handler {
-entry:
- %retval = alloca i32, align 4
- %i = alloca i32, align 4
- %__exception_code = alloca i32, align 4
- store i32 0, ptr %retval, align 4
- store i32 0, ptr %i, align 4
- br label %for.cond
-
-for.cond: ; preds = %for.inc, %entry
- %0 = load i32, ptr %i, align 4
- %cmp = icmp slt i32 %0, 2
- br i1 %cmp, label %for.body, label %for.end
-
-for.body: ; preds = %for.cond
- invoke void @llvm.seh.try.begin()
- to label %invoke.cont unwind label %catch.dispatch
-
-invoke.cont: ; preds = %for.body
- %1 = load volatile i32, ptr %i, align 4
- invoke void @"?crash@@YAXH@Z"(i32 %1) #8
- to label %invoke.cont1 unwind label %catch.dispatch
-
-invoke.cont1: ; preds = %invoke.cont
- invoke void @llvm.seh.try.end()
- to label %invoke.cont2 unwind label %catch.dispatch
-
-catch.dispatch: ; preds = %invoke.cont1, %invoke.cont, %for.body
- %2 = catchswitch within none [label %__except] unwind to caller
-
-__except: ; preds = %catch.dispatch
- %3 = catchpad within %2 [ptr null]
- catchret from %3 to label %__except3
-
-__except3: ; preds = %__except
- %4 = call i32 @llvm.eh.exceptioncode(token %3)
- store i32 %4, ptr %__exception_code, align 4
- %5 = load i32, ptr %i, align 4
- call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0CN@MKCAOFNA@?5Test?5CPP?5unwind?3?5in?5except?5hand@", i32 %5)
- br label %__try.cont
-
-__try.cont: ; preds = %__except3, %invoke.cont2
- br label %for.inc
-
-for.inc: ; preds = %__try.cont
- %6 = load i32, ptr %i, align 4
- %inc = add nsw i32 %6, 1
- store i32 %inc, ptr %i, align 4
- br label %for.cond
-
-invoke.cont2: ; preds = %invoke.cont1
- br label %__try.cont
-
-for.end: ; preds = %for.cond
- ret i32 0
-}
-
-declare dso_local i32 @__C_specific_handler(...)
-
-; Function Attrs: nounwind willreturn
-declare dso_local void @llvm.seh.try.end() #2
-
-; Function Attrs: nounwind readnone
-declare i32 @llvm.eh.exceptioncode(token) #3
-
-attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #1 = { noinline optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #2 = { nounwind willreturn }
-attributes #3 = { nounwind readnone }
-attributes #4 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #5 = { noinline norecurse optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #6 = { nounwind }
-attributes #7 = { noreturn }
-attributes #8 = { noinline }
-
-!llvm.module.flags = !{!0, !1}
-
-!0 = !{i32 1, !"wchar_size", i32 2}
-!1 = !{i32 2, !"eh-asynch", i32 1}
-
-
+; RUN: llc -verify-machineinstrs < %s | FileCheck %s
+
+; CHECK-LABEL: "$cppxdata$?crash@@YAXH@Z":
+; CHECK: .long ("$stateUnwindMap$?crash@@YAXH@Z")
+; CHECK: .long ("$tryMap$?crash@@YAXH@Z")@IMGREL # TryBlockMap
+; CHECK-NEXT: .long 6 # IPMapEntries
+; CHECK-NEXT: .long ("$ip2state$?crash@@YAXH@Z")
+
+; CHECK-LABEL: "$stateUnwindMap$?crash@@YAXH@Z":
+; CHECK-NEXT: .long -1
+; CHECK-NEXT: .long 0
+; CHECK-NEXT: .long 0
+; CHECK-NEXT: .long "?dtor$
+; CHECK-NEXT: .long -1
+; CHECK-NEXT: .long 0
+
+; CHECK-LABEL: "$tryMap$?crash@@YAXH@Z":
+; CHECK-NEXT: .long 0
+; CHECK-NEXT: .long 1
+; CHECK-NEXT: .long 2
+; CHECK-NEXT: .long 1
+; CHECK-NEXT: .long ("$handlerMap$
+
+; CHECK: "$handlerMap$0$?crash@@YAXH@Z"
+; CHECK-NEXT: .long 0
+; CHECK-NEXT: .long 0
+; CHECK-NEXT: .long 0
+; CHECK-NEXT: .long "?catch$
+
+; CHECK-LABEL: "$ip2state$?crash@@YAXH@Z":
+; CHECK-NEXT: .long .Lfunc_begin0@IMGREL
+; CHECK-NEXT: .long -1
+; CHECK-NEXT: .long .Ltmp
+; CHECK-NEXT: .long 0
+; CHECK-NEXT: .long .Ltmp
+; CHECK-NEXT: .long 1
+; CHECK-NEXT: .long .Ltmp
+; CHECK-NEXT: .long 0
+; CHECK-NEXT: .long .Ltmp
+; CHECK-NEXT: .long -1
+; CHECK-NEXT: .long "?catch$
+; CHECK-NEXT: .long 2
+
+; ModuleID = 'windows-seh-EHa-CppCatchDotDotDot.cpp'
+source_filename = "windows-seh-EHa-CppCatchDotDotDot.cpp"
+target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-windows-msvc"
+
+%rtti.TypeDescriptor2 = type { ptr, ptr, [3 x i8] }
+%eh.CatchableType = type { i32, i32, i32, i32, i32, i32, i32 }
+%eh.CatchableTypeArray.1 = type { i32, [1 x i32] }
+%eh.ThrowInfo = type { i32, i32, i32, i32 }
+%struct.A = type { i8 }
+
+$"??_C@_0BJ@EIKFKKLB@?5in?5catch?$CI?4?4?4?$CJ?5funclet?5?6?$AA@" = comdat any
+
+$"??_R0H@8" = comdat any
+
+$"_CT??_R0H@84" = comdat any
+
+$_CTA1H = comdat any
+
+$_TI1H = comdat any
+
+$"??_C@_0CN@MKCAOFNA@?5Test?5CPP?5unwind?3?5in?5except?5hand@" = comdat any
+
+$"??_C@_0N@LJHFFAKD@?5in?5A?5ctor?5?6?$AA@" = comdat any
+
+$"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@" = comdat any
+
+@"?pt1@@3PEAHEA" = dso_local global ptr null, align 8
+@"?pt2@@3PEAHEA" = dso_local global ptr null, align 8
+@"?pt3@@3PEAHEA" = dso_local global ptr null, align 8
+@"?g@@3HA" = dso_local global i32 0, align 4
+@"??_C@_0BJ@EIKFKKLB@?5in?5catch?$CI?4?4?4?$CJ?5funclet?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [25 x i8] c" in catch(...) funclet \0A\00", comdat, align 1
+@"??_7type_info@@6B@" = external constant ptr
+@"??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { ptr @"??_7type_info@@6B@", ptr null, [3 x i8] c".H\00" }, comdat
+@__ImageBase = external dso_local constant i8
+@"_CT??_R0H@84" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 1, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"??_R0H@8" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32), i32 0, i32 -1, i32 0, i32 4, i32 0 }, section ".xdata", comdat
+@_CTA1H = linkonce_odr unnamed_addr constant %eh.CatchableTypeArray.1 { i32 1, [1 x i32] [i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @"_CT??_R0H@84" to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32)] }, section ".xdata", comdat
+@_TI1H = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 0, i32 0, i32 0, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (ptr @_CTA1H to i64), i64 ptrtoint (ptr @__ImageBase to i64)) to i32) }, section ".xdata", comdat
+@"??_C@_0CN@MKCAOFNA@?5Test?5CPP?5unwind?3?5in?5except?5hand@" = linkonce_odr dso_local unnamed_addr constant [45 x i8] c" Test CPP unwind: in except handler i = %d \0A\00", comdat, align 1
+@"??_C@_0N@LJHFFAKD@?5in?5A?5ctor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in A ctor \0A\00", comdat, align 1
+@"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in A dtor \0A\00", comdat, align 1
+
+; Function Attrs: noinline nounwind optnone
+define dso_local void @"?foo@@YAXXZ"() #0 {
+entry:
+ store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
+ ret void
+}
+
+; Function Attrs: noinline optnone
+define dso_local void @"?crash@@YAXH@Z"(i32 %i) #1 personality ptr @__CxxFrameHandler3 {
+entry:
+ %i.addr = alloca i32, align 4
+ %ObjA = alloca %struct.A, align 1
+ %tmp = alloca i32, align 4
+ store i32 %i, ptr %i.addr, align 4
+ %0 = load i32, ptr %i.addr, align 4
+ store i32 %0, ptr @"?g@@3HA", align 4
+ invoke void @llvm.seh.try.begin()
+ to label %invoke.cont unwind label %catch.dispatch
+
+invoke.cont: ; preds = %entry
+ %call = invoke ptr @"??0A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjA)
+ to label %invoke.cont1 unwind label %catch.dispatch
+
+invoke.cont1: ; preds = %invoke.cont
+ invoke void @llvm.seh.scope.begin()
+ to label %invoke.cont2 unwind label %ehcleanup
+
+invoke.cont2: ; preds = %invoke.cont1
+ %1 = load i32, ptr %i.addr, align 4
+ %cmp = icmp eq i32 %1, 1
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then: ; preds = %invoke.cont2
+ store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
+ br label %if.end
+
+if.end: ; preds = %if.then, %invoke.cont2
+ invoke void @llvm.seh.scope.end()
+ to label %invoke.cont3 unwind label %ehcleanup
+
+invoke.cont3: ; preds = %if.end
+ call void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjA) #6
+ br label %try.cont
+
+ehcleanup: ; preds = %if.end, %invoke.cont1
+ %2 = cleanuppad within none []
+ call void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjA) #6 [ "funclet"(token %2) ]
+ cleanupret from %2 unwind label %catch.dispatch
+
+catch.dispatch: ; preds = %ehcleanup, %invoke.cont, %entry
+ %3 = catchswitch within none [label %catch] unwind to caller
+
+catch: ; preds = %catch.dispatch
+ %4 = catchpad within %3 [ptr null, i32 0, ptr null]
+ call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0BJ@EIKFKKLB@?5in?5catch?$CI?4?4?4?$CJ?5funclet?5?6?$AA@") [ "funclet"(token %4) ]
+ %5 = load i32, ptr %i.addr, align 4
+ %cmp4 = icmp eq i32 %5, 1
+ br i1 %cmp4, label %if.then5, label %if.end6
+
+if.then5: ; preds = %catch
+ %6 = load i32, ptr %i.addr, align 4
+ store i32 %6, ptr %tmp, align 4
+ %7 = bitcast ptr %tmp to ptr
+ call void @_CxxThrowException(ptr %7, ptr @_TI1H) #7 [ "funclet"(token %4) ]
+ unreachable
+
+if.end6: ; preds = %catch
+ catchret from %4 to label %catchret.dest
+
+catchret.dest: ; preds = %if.end6
+ br label %try.cont
+
+try.cont: ; preds = %catchret.dest, %invoke.cont3
+ ret void
+}
+
+; Function Attrs: nounwind willreturn
+declare dso_local void @llvm.seh.try.begin() #2
+
+declare dso_local i32 @__CxxFrameHandler3(...)
+
+; Function Attrs: noinline optnone
+define internal ptr @"??0A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr returned %this) unnamed_addr #1 align 2 {
+entry:
+ %retval = alloca ptr, align 8
+ %this.addr = alloca ptr, align 8
+ store ptr %this, ptr %this.addr, align 8
+ %this1 = load ptr, ptr %this.addr, align 8
+ store ptr %this1, ptr %retval, align 8
+ call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0N@LJHFFAKD@?5in?5A?5ctor?5?6?$AA@")
+ %0 = load i32, ptr @"?g@@3HA", align 4
+ %cmp = icmp eq i32 %0, 0
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then: ; preds = %entry
+ store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
+ br label %if.end
+
+if.end: ; preds = %if.then, %entry
+ %1 = load ptr, ptr %retval, align 8
+ ret ptr %1
+}
+
+; Function Attrs: nounwind readnone
+declare dso_local void @llvm.seh.scope.begin() #3
+
+; Function Attrs: nounwind readnone
+declare dso_local void @llvm.seh.scope.end() #3
+
+; Function Attrs: noinline nounwind optnone
+define internal void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %this) unnamed_addr #0 align 2 {
+entry:
+ %this.addr = alloca ptr, align 8
+ store ptr %this, ptr %this.addr, align 8
+ %this1 = load ptr, ptr %this.addr, align 8
+ call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@")
+ ret void
+}
+
+declare dso_local void @"?printf@@YAXZZ"(...) #4
+
+declare dso_local void @_CxxThrowException(ptr, ptr)
+
+; Function Attrs: noinline norecurse optnone
+define dso_local i32 @main() #5 personality ptr @__C_specific_handler {
+entry:
+ %retval = alloca i32, align 4
+ %i = alloca i32, align 4
+ %__exception_code = alloca i32, align 4
+ store i32 0, ptr %retval, align 4
+ store i32 0, ptr %i, align 4
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %0 = load i32, ptr %i, align 4
+ %cmp = icmp slt i32 %0, 2
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ invoke void @llvm.seh.try.begin()
+ to label %invoke.cont unwind label %catch.dispatch
+
+invoke.cont: ; preds = %for.body
+ %1 = load volatile i32, ptr %i, align 4
+ invoke void @"?crash@@YAXH@Z"(i32 %1) #8
+ to label %invoke.cont1 unwind label %catch.dispatch
+
+invoke.cont1: ; preds = %invoke.cont
+ invoke void @llvm.seh.try.end()
+ to label %invoke.cont2 unwind label %catch.dispatch
+
+catch.dispatch: ; preds = %invoke.cont1, %invoke.cont, %for.body
+ %2 = catchswitch within none [label %__except] unwind to caller
+
+__except: ; preds = %catch.dispatch
+ %3 = catchpad within %2 [ptr null]
+ catchret from %3 to label %__except3
+
+__except3: ; preds = %__except
+ %4 = call i32 @llvm.eh.exceptioncode(token %3)
+ store i32 %4, ptr %__exception_code, align 4
+ %5 = load i32, ptr %i, align 4
+ call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0CN@MKCAOFNA@?5Test?5CPP?5unwind?3?5in?5except?5hand@", i32 %5)
+ br label %__try.cont
+
+__try.cont: ; preds = %__except3, %invoke.cont2
+ br label %for.inc
+
+for.inc: ; preds = %__try.cont
+ %6 = load i32, ptr %i, align 4
+ %inc = add nsw i32 %6, 1
+ store i32 %inc, ptr %i, align 4
+ br label %for.cond
+
+invoke.cont2: ; preds = %invoke.cont1
+ br label %__try.cont
+
+for.end: ; preds = %for.cond
+ ret i32 0
+}
+
+declare dso_local i32 @__C_specific_handler(...)
+
+; Function Attrs: nounwind willreturn
+declare dso_local void @llvm.seh.try.end() #2
+
+; Function Attrs: nounwind readnone
+declare i32 @llvm.eh.exceptioncode(token) #3
+
+attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { noinline optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #2 = { nounwind willreturn }
+attributes #3 = { nounwind readnone }
+attributes #4 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #5 = { noinline norecurse optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #6 = { nounwind }
+attributes #7 = { noreturn }
+attributes #8 = { noinline }
+
+!llvm.module.flags = !{!0, !1}
+
+!0 = !{i32 1, !"wchar_size", i32 2}
+!1 = !{i32 2, !"eh-asynch", i32 1}
+
+
diff --git a/llvm/test/CodeGen/X86/windows-seh-EHa-CppDtors01.ll b/llvm/test/CodeGen/X86/windows-seh-EHa-CppDtors01.ll
index 96b31316f39a..54c1d838a30f 100644
--- a/llvm/test/CodeGen/X86/windows-seh-EHa-CppDtors01.ll
+++ b/llvm/test/CodeGen/X86/windows-seh-EHa-CppDtors01.ll
@@ -1,255 +1,255 @@
-; RUN: llc -verify-machineinstrs < %s | FileCheck %s
-
-; CHECK-LABEL: "$cppxdata$?crash@@YAXH@Z":
-; CHECK: .long ("$stateUnwindMap$?crash@@YAXH@Z")
-; CHECK: .long ("$ip2state$?crash@@YAXH@Z")
-
-; CHECK-LABEL: "$stateUnwindMap$?crash@@YAXH@Z":
-; CHECK: .long -1
-; CHECK: .long "?dtor$
-; CHECK: .long 0
-; CHECK: .long "?dtor$
-; CHECK: .long 1
-; CHECK: .long "?dtor$
-
-; CHECK-LABEL: "$ip2state$?crash@@YAXH@Z":
-; CHECK-NEXT: .long .Lfunc_begin0@IMGREL
-; CHECK-NEXT: .long -1
-; CHECK-NEXT: .long .Ltmp
-; CHECK-NEXT: .long 0
-; CHECK-NEXT: .long .Ltmp
-; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Ltmp
-; CHECK-NEXT: .long 2
-; CHECK-NEXT: .long .Ltmp
-; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Ltmp
-; CHECK-NEXT: .long 0
-; CHECK-NEXT: .long .Ltmp
-; CHECK-NEXT: .long -1
-
-; ModuleID = 'windows-seh-EHa-CppDtors01.cpp'
-source_filename = "windows-seh-EHa-CppDtors01.cpp"
-target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-windows-msvc"
-
-%struct.A = type { i8 }
-%struct.B = type { i8 }
-%struct.C = type { i8 }
-
-$"??_C@_0CM@KAOHJHDK@?5Test?5CPP?5unwind?3?5in?5catch?5handl@" = comdat any
-
-$"??_C@_0N@FCCEEGKL@?5in?5C?5dtor?5?6?$AA@" = comdat any
-
-$"??_C@_0N@EFFPFCOI@?5in?5B?5dtor?5?6?$AA@" = comdat any
-
-$"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@" = comdat any
-
-@"?g@@3HA" = dso_local global i32 0, align 4
-@"??_C@_0CM@KAOHJHDK@?5Test?5CPP?5unwind?3?5in?5catch?5handl@" = linkonce_odr dso_local unnamed_addr constant [44 x i8] c" Test CPP unwind: in catch handler i = %d \0A\00", comdat, align 1
-@"??_C@_0N@FCCEEGKL@?5in?5C?5dtor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in C dtor \0A\00", comdat, align 1
-@"??_C@_0N@EFFPFCOI@?5in?5B?5dtor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in B dtor \0A\00", comdat, align 1
-@"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in A dtor \0A\00", comdat, align 1
-
-; Function Attrs: noinline optnone
-define dso_local void @"?crash@@YAXH@Z"(i32 %i) #0 personality ptr @__CxxFrameHandler3 {
-entry:
- %i.addr = alloca i32, align 4
- %ObjA = alloca %struct.A, align 1
- %ObjB = alloca %struct.B, align 1
- %ObjC = alloca %struct.C, align 1
- store i32 %i, ptr %i.addr, align 4
- invoke void @llvm.seh.scope.begin()
- to label %invoke.cont unwind label %ehcleanup13
-
-invoke.cont: ; preds = %entry
- %0 = load i32, ptr %i.addr, align 4
- %cmp = icmp eq i32 %0, 0
- br i1 %cmp, label %if.then, label %if.end
-
-if.then: ; preds = %invoke.cont
- store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
- br label %if.end
-
-if.end: ; preds = %if.then, %invoke.cont
- invoke void @llvm.seh.scope.begin()
- to label %invoke.cont1 unwind label %ehcleanup11
-
-invoke.cont1: ; preds = %if.end
- %1 = load i32, ptr %i.addr, align 4
- %cmp2 = icmp eq i32 %1, 1
- br i1 %cmp2, label %if.then3, label %if.end4
-
-if.then3: ; preds = %invoke.cont1
- store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
- br label %if.end4
-
-if.end4: ; preds = %if.then3, %invoke.cont1
- invoke void @llvm.seh.scope.begin()
- to label %invoke.cont5 unwind label %ehcleanup
-
-invoke.cont5: ; preds = %if.end4
- %2 = load i32, ptr %i.addr, align 4
- %cmp6 = icmp eq i32 %2, 2
- br i1 %cmp6, label %if.then7, label %if.end8
-
-if.then7: ; preds = %invoke.cont5
- store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
- br label %if.end8
-
-if.end8: ; preds = %if.then7, %invoke.cont5
- invoke void @llvm.seh.scope.end()
- to label %invoke.cont9 unwind label %ehcleanup
-
-invoke.cont9: ; preds = %if.end8
- call void @"??1C@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjC) #6
- invoke void @llvm.seh.scope.end()
- to label %invoke.cont10 unwind label %ehcleanup11
-
-invoke.cont10: ; preds = %invoke.cont9
- call void @"??1B@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjB) #6
- invoke void @llvm.seh.scope.end()
- to label %invoke.cont12 unwind label %ehcleanup13
-
-invoke.cont12: ; preds = %invoke.cont10
- call void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjA) #6
- ret void
-
-ehcleanup: ; preds = %if.end8, %if.end4
- %3 = cleanuppad within none []
- call void @"??1C@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjC) #6 [ "funclet"(token %3) ]
- cleanupret from %3 unwind label %ehcleanup11
-
-ehcleanup11: ; preds = %invoke.cont9, %ehcleanup, %if.end
- %4 = cleanuppad within none []
- call void @"??1B@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjB) #6 [ "funclet"(token %4) ]
- cleanupret from %4 unwind label %ehcleanup13
-
-ehcleanup13: ; preds = %invoke.cont10, %ehcleanup11, %entry
- %5 = cleanuppad within none []
- call void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjA) #6 [ "funclet"(token %5) ]
- cleanupret from %5 unwind to caller
-}
-
-; Function Attrs: nounwind readnone
-declare dso_local void @llvm.seh.scope.begin() #1
-
-declare dso_local i32 @__CxxFrameHandler3(...)
-
-; Function Attrs: nounwind readnone
-declare dso_local void @llvm.seh.scope.end() #1
-
-; Function Attrs: noinline nounwind optnone
-define internal void @"??1C@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %this) unnamed_addr #2 align 2 {
-entry:
- %this.addr = alloca ptr, align 8
- store ptr %this, ptr %this.addr, align 8
- %this1 = load ptr, ptr %this.addr, align 8
- call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0N@FCCEEGKL@?5in?5C?5dtor?5?6?$AA@")
- ret void
-}
-
-; Function Attrs: noinline nounwind optnone
-define internal void @"??1B@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %this) unnamed_addr #2 align 2 {
-entry:
- %this.addr = alloca ptr, align 8
- store ptr %this, ptr %this.addr, align 8
- %this1 = load ptr, ptr %this.addr, align 8
- call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0N@EFFPFCOI@?5in?5B?5dtor?5?6?$AA@")
- ret void
-}
-
-; Function Attrs: noinline nounwind optnone
-define internal void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %this) unnamed_addr #2 align 2 {
-entry:
- %this.addr = alloca ptr, align 8
- store ptr %this, ptr %this.addr, align 8
- %this1 = load ptr, ptr %this.addr, align 8
- call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@")
- ret void
-}
-
-; Function Attrs: noinline norecurse optnone
-define dso_local i32 @main() #3 personality ptr @__C_specific_handler {
-entry:
- %retval = alloca i32, align 4
- %i = alloca i32, align 4
- %__exception_code = alloca i32, align 4
- store i32 0, ptr %retval, align 4
- store i32 0, ptr %i, align 4
- br label %for.cond
-
-for.cond: ; preds = %for.inc, %entry
- %0 = load i32, ptr %i, align 4
- %cmp = icmp slt i32 %0, 3
- br i1 %cmp, label %for.body, label %for.end
-
-for.body: ; preds = %for.cond
- invoke void @llvm.seh.try.begin()
- to label %invoke.cont unwind label %catch.dispatch
-
-invoke.cont: ; preds = %for.body
- %1 = load volatile i32, ptr %i, align 4
- invoke void @"?crash@@YAXH@Z"(i32 %1) #7
- to label %invoke.cont1 unwind label %catch.dispatch
-
-invoke.cont1: ; preds = %invoke.cont
- invoke void @llvm.seh.try.end()
- to label %invoke.cont2 unwind label %catch.dispatch
-
-catch.dispatch: ; preds = %invoke.cont1, %invoke.cont, %for.body
- %2 = catchswitch within none [label %__except] unwind to caller
-
-__except: ; preds = %catch.dispatch
- %3 = catchpad within %2 [ptr null]
- catchret from %3 to label %__except3
-
-__except3: ; preds = %__except
- %4 = call i32 @llvm.eh.exceptioncode(token %3)
- store i32 %4, ptr %__exception_code, align 4
- %5 = load i32, ptr %i, align 4
- call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0CM@KAOHJHDK@?5Test?5CPP?5unwind?3?5in?5catch?5handl@", i32 %5)
- br label %__try.cont
-
-__try.cont: ; preds = %__except3, %invoke.cont2
- br label %for.inc
-
-for.inc: ; preds = %__try.cont
- %6 = load i32, ptr %i, align 4
- %inc = add nsw i32 %6, 1
- store i32 %inc, ptr %i, align 4
- br label %for.cond
-
-invoke.cont2: ; preds = %invoke.cont1
- br label %__try.cont
-
-for.end: ; preds = %for.cond
- ret i32 0
-}
-
-; Function Attrs: nounwind willreturn
-declare dso_local void @llvm.seh.try.begin() #4
-
-declare dso_local i32 @__C_specific_handler(...)
-
-; Function Attrs: nounwind willreturn
-declare dso_local void @llvm.seh.try.end() #4
-
-; Function Attrs: nounwind readnone
-declare i32 @llvm.eh.exceptioncode(token) #1
-
-declare dso_local void @"?printf@@YAXZZ"(...) #5
-
-attributes #0 = { noinline optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #1 = { nounwind readnone }
-attributes #2 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #3 = { noinline norecurse optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #4 = { nounwind willreturn }
-attributes #5 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #6 = { nounwind }
-attributes #7 = { noinline }
-
-!llvm.module.flags = !{!0, !1}
-
-!0 = !{i32 1, !"wchar_size", i32 2}
-!1 = !{i32 2, !"eh-asynch", i32 1}
+; RUN: llc -verify-machineinstrs < %s | FileCheck %s
+
+; CHECK-LABEL: "$cppxdata$?crash@@YAXH@Z":
+; CHECK: .long ("$stateUnwindMap$?crash@@YAXH@Z")
+; CHECK: .long ("$ip2state$?crash@@YAXH@Z")
+
+; CHECK-LABEL: "$stateUnwindMap$?crash@@YAXH@Z":
+; CHECK: .long -1
+; CHECK: .long "?dtor$
+; CHECK: .long 0
+; CHECK: .long "?dtor$
+; CHECK: .long 1
+; CHECK: .long "?dtor$
+
+; CHECK-LABEL: "$ip2state$?crash@@YAXH@Z":
+; CHECK-NEXT: .long .Lfunc_begin0@IMGREL
+; CHECK-NEXT: .long -1
+; CHECK-NEXT: .long .Ltmp
+; CHECK-NEXT: .long 0
+; CHECK-NEXT: .long .Ltmp
+; CHECK-NEXT: .long 1
+; CHECK-NEXT: .long .Ltmp
+; CHECK-NEXT: .long 2
+; CHECK-NEXT: .long .Ltmp
+; CHECK-NEXT: .long 1
+; CHECK-NEXT: .long .Ltmp
+; CHECK-NEXT: .long 0
+; CHECK-NEXT: .long .Ltmp
+; CHECK-NEXT: .long -1
+
+; ModuleID = 'windows-seh-EHa-CppDtors01.cpp'
+source_filename = "windows-seh-EHa-CppDtors01.cpp"
+target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-windows-msvc"
+
+%struct.A = type { i8 }
+%struct.B = type { i8 }
+%struct.C = type { i8 }
+
+$"??_C@_0CM@KAOHJHDK@?5Test?5CPP?5unwind?3?5in?5catch?5handl@" = comdat any
+
+$"??_C@_0N@FCCEEGKL@?5in?5C?5dtor?5?6?$AA@" = comdat any
+
+$"??_C@_0N@EFFPFCOI@?5in?5B?5dtor?5?6?$AA@" = comdat any
+
+$"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@" = comdat any
+
+@"?g@@3HA" = dso_local global i32 0, align 4
+@"??_C@_0CM@KAOHJHDK@?5Test?5CPP?5unwind?3?5in?5catch?5handl@" = linkonce_odr dso_local unnamed_addr constant [44 x i8] c" Test CPP unwind: in catch handler i = %d \0A\00", comdat, align 1
+@"??_C@_0N@FCCEEGKL@?5in?5C?5dtor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in C dtor \0A\00", comdat, align 1
+@"??_C@_0N@EFFPFCOI@?5in?5B?5dtor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in B dtor \0A\00", comdat, align 1
+@"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in A dtor \0A\00", comdat, align 1
+
+; Function Attrs: noinline optnone
+define dso_local void @"?crash@@YAXH@Z"(i32 %i) #0 personality ptr @__CxxFrameHandler3 {
+entry:
+ %i.addr = alloca i32, align 4
+ %ObjA = alloca %struct.A, align 1
+ %ObjB = alloca %struct.B, align 1
+ %ObjC = alloca %struct.C, align 1
+ store i32 %i, ptr %i.addr, align 4
+ invoke void @llvm.seh.scope.begin()
+ to label %invoke.cont unwind label %ehcleanup13
+
+invoke.cont: ; preds = %entry
+ %0 = load i32, ptr %i.addr, align 4
+ %cmp = icmp eq i32 %0, 0
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then: ; preds = %invoke.cont
+ store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
+ br label %if.end
+
+if.end: ; preds = %if.then, %invoke.cont
+ invoke void @llvm.seh.scope.begin()
+ to label %invoke.cont1 unwind label %ehcleanup11
+
+invoke.cont1: ; preds = %if.end
+ %1 = load i32, ptr %i.addr, align 4
+ %cmp2 = icmp eq i32 %1, 1
+ br i1 %cmp2, label %if.then3, label %if.end4
+
+if.then3: ; preds = %invoke.cont1
+ store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
+ br label %if.end4
+
+if.end4: ; preds = %if.then3, %invoke.cont1
+ invoke void @llvm.seh.scope.begin()
+ to label %invoke.cont5 unwind label %ehcleanup
+
+invoke.cont5: ; preds = %if.end4
+ %2 = load i32, ptr %i.addr, align 4
+ %cmp6 = icmp eq i32 %2, 2
+ br i1 %cmp6, label %if.then7, label %if.end8
+
+if.then7: ; preds = %invoke.cont5
+ store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
+ br label %if.end8
+
+if.end8: ; preds = %if.then7, %invoke.cont5
+ invoke void @llvm.seh.scope.end()
+ to label %invoke.cont9 unwind label %ehcleanup
+
+invoke.cont9: ; preds = %if.end8
+ call void @"??1C@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjC) #6
+ invoke void @llvm.seh.scope.end()
+ to label %invoke.cont10 unwind label %ehcleanup11
+
+invoke.cont10: ; preds = %invoke.cont9
+ call void @"??1B@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjB) #6
+ invoke void @llvm.seh.scope.end()
+ to label %invoke.cont12 unwind label %ehcleanup13
+
+invoke.cont12: ; preds = %invoke.cont10
+ call void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjA) #6
+ ret void
+
+ehcleanup: ; preds = %if.end8, %if.end4
+ %3 = cleanuppad within none []
+ call void @"??1C@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjC) #6 [ "funclet"(token %3) ]
+ cleanupret from %3 unwind label %ehcleanup11
+
+ehcleanup11: ; preds = %invoke.cont9, %ehcleanup, %if.end
+ %4 = cleanuppad within none []
+ call void @"??1B@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjB) #6 [ "funclet"(token %4) ]
+ cleanupret from %4 unwind label %ehcleanup13
+
+ehcleanup13: ; preds = %invoke.cont10, %ehcleanup11, %entry
+ %5 = cleanuppad within none []
+ call void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %ObjA) #6 [ "funclet"(token %5) ]
+ cleanupret from %5 unwind to caller
+}
+
+; Function Attrs: nounwind readnone
+declare dso_local void @llvm.seh.scope.begin() #1
+
+declare dso_local i32 @__CxxFrameHandler3(...)
+
+; Function Attrs: nounwind readnone
+declare dso_local void @llvm.seh.scope.end() #1
+
+; Function Attrs: noinline nounwind optnone
+define internal void @"??1C@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %this) unnamed_addr #2 align 2 {
+entry:
+ %this.addr = alloca ptr, align 8
+ store ptr %this, ptr %this.addr, align 8
+ %this1 = load ptr, ptr %this.addr, align 8
+ call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0N@FCCEEGKL@?5in?5C?5dtor?5?6?$AA@")
+ ret void
+}
+
+; Function Attrs: noinline nounwind optnone
+define internal void @"??1B@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %this) unnamed_addr #2 align 2 {
+entry:
+ %this.addr = alloca ptr, align 8
+ store ptr %this, ptr %this.addr, align 8
+ %this1 = load ptr, ptr %this.addr, align 8
+ call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0N@EFFPFCOI@?5in?5B?5dtor?5?6?$AA@")
+ ret void
+}
+
+; Function Attrs: noinline nounwind optnone
+define internal void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(ptr %this) unnamed_addr #2 align 2 {
+entry:
+ %this.addr = alloca ptr, align 8
+ store ptr %this, ptr %this.addr, align 8
+ %this1 = load ptr, ptr %this.addr, align 8
+ call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@")
+ ret void
+}
+
+; Function Attrs: noinline norecurse optnone
+define dso_local i32 @main() #3 personality ptr @__C_specific_handler {
+entry:
+ %retval = alloca i32, align 4
+ %i = alloca i32, align 4
+ %__exception_code = alloca i32, align 4
+ store i32 0, ptr %retval, align 4
+ store i32 0, ptr %i, align 4
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %0 = load i32, ptr %i, align 4
+ %cmp = icmp slt i32 %0, 3
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ invoke void @llvm.seh.try.begin()
+ to label %invoke.cont unwind label %catch.dispatch
+
+invoke.cont: ; preds = %for.body
+ %1 = load volatile i32, ptr %i, align 4
+ invoke void @"?crash@@YAXH@Z"(i32 %1) #7
+ to label %invoke.cont1 unwind label %catch.dispatch
+
+invoke.cont1: ; preds = %invoke.cont
+ invoke void @llvm.seh.try.end()
+ to label %invoke.cont2 unwind label %catch.dispatch
+
+catch.dispatch: ; preds = %invoke.cont1, %invoke.cont, %for.body
+ %2 = catchswitch within none [label %__except] unwind to caller
+
+__except: ; preds = %catch.dispatch
+ %3 = catchpad within %2 [ptr null]
+ catchret from %3 to label %__except3
+
+__except3: ; preds = %__except
+ %4 = call i32 @llvm.eh.exceptioncode(token %3)
+ store i32 %4, ptr %__exception_code, align 4
+ %5 = load i32, ptr %i, align 4
+ call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0CM@KAOHJHDK@?5Test?5CPP?5unwind?3?5in?5catch?5handl@", i32 %5)
+ br label %__try.cont
+
+__try.cont: ; preds = %__except3, %invoke.cont2
+ br label %for.inc
+
+for.inc: ; preds = %__try.cont
+ %6 = load i32, ptr %i, align 4
+ %inc = add nsw i32 %6, 1
+ store i32 %inc, ptr %i, align 4
+ br label %for.cond
+
+invoke.cont2: ; preds = %invoke.cont1
+ br label %__try.cont
+
+for.end: ; preds = %for.cond
+ ret i32 0
+}
+
+; Function Attrs: nounwind willreturn
+declare dso_local void @llvm.seh.try.begin() #4
+
+declare dso_local i32 @__C_specific_handler(...)
+
+; Function Attrs: nounwind willreturn
+declare dso_local void @llvm.seh.try.end() #4
+
+; Function Attrs: nounwind readnone
+declare i32 @llvm.eh.exceptioncode(token) #1
+
+declare dso_local void @"?printf@@YAXZZ"(...) #5
+
+attributes #0 = { noinline optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nounwind readnone }
+attributes #2 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #3 = { noinline norecurse optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #4 = { nounwind willreturn }
+attributes #5 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #6 = { nounwind }
+attributes #7 = { noinline }
+
+!llvm.module.flags = !{!0, !1}
+
+!0 = !{i32 1, !"wchar_size", i32 2}
+!1 = !{i32 2, !"eh-asynch", i32 1}
diff --git a/llvm/test/CodeGen/X86/windows-seh-EHa-TryInFinally.ll b/llvm/test/CodeGen/X86/windows-seh-EHa-TryInFinally.ll
index 340a9afe4a3d..16322cbe9980 100644
--- a/llvm/test/CodeGen/X86/windows-seh-EHa-TryInFinally.ll
+++ b/llvm/test/CodeGen/X86/windows-seh-EHa-TryInFinally.ll
@@ -1,224 +1,224 @@
-; RUN: llc -verify-machineinstrs < %s | FileCheck %s
-
-; CHECK-LABEL: "?fin$0@0@main@@"
-; CHECK: .seh_handlerdata
-; CHECK: .set ".L?fin$0@0@main@@$parent_frame_offset", 48
-; CHECK-NEXT: .long (.Llsda_end1-.Llsda_begin1)/16
-; CHECK-NEXT: .Llsda_begin1:
-; CHECK-NEXT: .long .Ltmp
-; CHECK-NEXT: .long .Ltmp
-; CHECK-NEXT: .long "?dtor$
-; CHECK-NEXT: .long 0
-; CHECK-NEXT: .Llsda_end1:
-
-; ModuleID = 'windows-seh-EHa-TryInFinally.cpp'
-source_filename = "windows-seh-EHa-TryInFinally.cpp"
-target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-windows-msvc"
-
-$"??_C@_0CI@MDFPIOJJ@?5?9?9?9?5Test?5_Try?5in?5_finally?5?9?9?9?5i@" = comdat any
-
-$"??_C@_0BN@HHKJHLBE@?5?5In?5Inner?5_finally?5i?5?$DN?5?$CFd?5?6?$AA@" = comdat any
-
-$"??_C@_0BN@HAIIIOKI@?5?5In?5outer?5_finally?5i?5?$DN?5?$CFd?5?6?$AA@" = comdat any
-
-$"??_C@_0BJ@OJMMAGCD@?5?5In?5outer?5_try?5i?5?$DN?5?$CFd?5?6?$AA@" = comdat any
-
-$"??_C@_0CG@ENDJHCGA@?5?9?9?9?5In?5outer?5except?5handler?5i?5?$DN@" = comdat any
-
-@"??_C@_0CI@MDFPIOJJ@?5?9?9?9?5Test?5_Try?5in?5_finally?5?9?9?9?5i@" = linkonce_odr dso_local unnamed_addr constant [40 x i8] c" --- Test _Try in _finally --- i = %d \0A\00", comdat, align 1
-@"??_C@_0BN@HHKJHLBE@?5?5In?5Inner?5_finally?5i?5?$DN?5?$CFd?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [29 x i8] c" In Inner _finally i = %d \0A\00", comdat, align 1
-@"??_C@_0BN@HAIIIOKI@?5?5In?5outer?5_finally?5i?5?$DN?5?$CFd?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [29 x i8] c" In outer _finally i = %d \0A\00", comdat, align 1
-@"??_C@_0BJ@OJMMAGCD@?5?5In?5outer?5_try?5i?5?$DN?5?$CFd?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [25 x i8] c" In outer _try i = %d \0A\00", comdat, align 1
-@"??_C@_0CG@ENDJHCGA@?5?9?9?9?5In?5outer?5except?5handler?5i?5?$DN@" = linkonce_odr dso_local unnamed_addr constant [38 x i8] c" --- In outer except handler i = %d \0A\00", comdat, align 1
-
-; Function Attrs: noinline norecurse optnone
-define dso_local i32 @main() #0 personality ptr @__C_specific_handler {
-entry:
- %retval = alloca i32, align 4
- %i = alloca i32, align 4
- %__exception_code = alloca i32, align 4
- call void (...) @llvm.localescape(ptr %i)
- store i32 0, ptr %retval, align 4
- store i32 0, ptr %i, align 4
- br label %for.cond
-
-for.cond: ; preds = %for.inc, %entry
- %0 = load i32, ptr %i, align 4
- %cmp = icmp slt i32 %0, 3
- br i1 %cmp, label %for.body, label %for.end
-
-for.body: ; preds = %for.cond
- %1 = load i32, ptr %i, align 4
- call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0CI@MDFPIOJJ@?5?9?9?9?5Test?5_Try?5in?5_finally?5?9?9?9?5i@", i32 %1)
- invoke void @llvm.seh.try.begin()
- to label %invoke.cont unwind label %catch.dispatch
-
-invoke.cont: ; preds = %for.body
- invoke void @llvm.seh.try.begin()
- to label %invoke.cont1 unwind label %ehcleanup
-
-invoke.cont1: ; preds = %invoke.cont
- %2 = load volatile i32, ptr %i, align 4
- invoke void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0BJ@OJMMAGCD@?5?5In?5outer?5_try?5i?5?$DN?5?$CFd?5?6?$AA@", i32 %2) #6
- to label %invoke.cont2 unwind label %ehcleanup
-
-invoke.cont2: ; preds = %invoke.cont1
- %3 = load volatile i32, ptr %i, align 4
- %cmp3 = icmp eq i32 %3, 0
- br i1 %cmp3, label %if.then, label %if.end
-
-if.then: ; preds = %invoke.cont2
- store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
- br label %if.end
-
-if.end: ; preds = %if.then, %invoke.cont2
- invoke void @llvm.seh.try.end()
- to label %invoke.cont4 unwind label %ehcleanup
-
-invoke.cont4: ; preds = %if.end
- %4 = call ptr @llvm.localaddress()
- invoke void @"?fin$0@0@main@@"(i8 0, ptr %4) #6
- to label %invoke.cont5 unwind label %catch.dispatch
-
-invoke.cont5: ; preds = %invoke.cont4
- invoke void @llvm.seh.try.end()
- to label %invoke.cont7 unwind label %catch.dispatch
-
-catch.dispatch: ; preds = %invoke.cont5, %invoke.cont6, %ehcleanup, %invoke.cont4, %for.body
- %5 = catchswitch within none [label %__except] unwind to caller
-
-__except: ; preds = %catch.dispatch
- %6 = catchpad within %5 [ptr null]
- catchret from %6 to label %__except8
-
-__except8: ; preds = %__except
- %7 = call i32 @llvm.eh.exceptioncode(token %6)
- store i32 %7, ptr %__exception_code, align 4
- %8 = load i32, ptr %i, align 4
- call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0CG@ENDJHCGA@?5?9?9?9?5In?5outer?5except?5handler?5i?5?$DN@", i32 %8)
- br label %__try.cont
-
-__try.cont: ; preds = %__except8, %invoke.cont7
- br label %for.inc
-
-for.inc: ; preds = %__try.cont
- %9 = load i32, ptr %i, align 4
- %inc = add nsw i32 %9, 1
- store i32 %inc, ptr %i, align 4
- br label %for.cond
-
-invoke.cont7: ; preds = %invoke.cont5
- br label %__try.cont
-
-ehcleanup: ; preds = %if.end, %invoke.cont1, %invoke.cont
- %10 = cleanuppad within none []
- %11 = call ptr @llvm.localaddress()
- invoke void @"?fin$0@0@main@@"(i8 1, ptr %11) #6 [ "funclet"(token %10) ]
- to label %invoke.cont6 unwind label %catch.dispatch
-
-invoke.cont6: ; preds = %ehcleanup
- cleanupret from %10 unwind label %catch.dispatch
-
-for.end: ; preds = %for.cond
- ret i32 0
-}
-
-declare dso_local void @"?printf@@YAXZZ"(...) #1
-
-; Function Attrs: nounwind willreturn
-declare dso_local void @llvm.seh.try.begin() #2
-
-declare dso_local i32 @__C_specific_handler(...)
-
-; Function Attrs: noinline
-define internal void @"?fin$0@0@main@@"(i8 %abnormal_termination, ptr %frame_pointer) #3 personality ptr @__C_specific_handler {
-entry:
- %frame_pointer.addr = alloca ptr, align 8
- %abnormal_termination.addr = alloca i8, align 1
- %0 = call ptr @llvm.localrecover(ptr @main, ptr %frame_pointer, i32 0)
- %i = bitcast ptr %0 to ptr
- store ptr %frame_pointer, ptr %frame_pointer.addr, align 8
- store i8 %abnormal_termination, ptr %abnormal_termination.addr, align 1
- invoke void @llvm.seh.try.begin()
- to label %invoke.cont unwind label %ehcleanup
-
-invoke.cont: ; preds = %entry
- %1 = load volatile i32, ptr %i, align 4
- invoke void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0BN@HAIIIOKI@?5?5In?5outer?5_finally?5i?5?$DN?5?$CFd?5?6?$AA@", i32 %1) #6
- to label %invoke.cont1 unwind label %ehcleanup
-
-invoke.cont1: ; preds = %invoke.cont
- %2 = load volatile i32, ptr %i, align 4
- %cmp = icmp eq i32 %2, 1
- br i1 %cmp, label %if.then, label %if.end
-
-if.then: ; preds = %invoke.cont1
- store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
- br label %if.end
-
-if.end: ; preds = %if.then, %invoke.cont1
- invoke void @llvm.seh.try.end()
- to label %invoke.cont2 unwind label %ehcleanup
-
-invoke.cont2: ; preds = %if.end
- call void @"?fin$1@0@main@@"(i8 0, ptr %frame_pointer)
- ret void
-
-ehcleanup: ; preds = %if.end, %invoke.cont, %entry
- %3 = cleanuppad within none []
- call void @"?fin$1@0@main@@"(i8 1, ptr %frame_pointer) [ "funclet"(token %3) ]
- cleanupret from %3 unwind to caller
-}
-
-; Function Attrs: nounwind readnone
-declare ptr @llvm.localrecover(ptr, ptr, i32 immarg) #4
-
-; Function Attrs: noinline
-define internal void @"?fin$1@0@main@@"(i8 %abnormal_termination, ptr %frame_pointer) #3 {
-entry:
- %frame_pointer.addr = alloca ptr, align 8
- %abnormal_termination.addr = alloca i8, align 1
- %0 = call ptr @llvm.localrecover(ptr @main, ptr %frame_pointer, i32 0)
- %i = bitcast ptr %0 to ptr
- store ptr %frame_pointer, ptr %frame_pointer.addr, align 8
- store i8 %abnormal_termination, ptr %abnormal_termination.addr, align 1
- %1 = load i32, ptr %i, align 4
- call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0BN@HHKJHLBE@?5?5In?5Inner?5_finally?5i?5?$DN?5?$CFd?5?6?$AA@", i32 %1)
- %2 = load i32, ptr %i, align 4
- %cmp = icmp eq i32 %2, 2
- br i1 %cmp, label %if.then, label %if.end
-
-if.then: ; preds = %entry
- store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
- br label %if.end
-
-if.end: ; preds = %if.then, %entry
- ret void
-}
-
-; Function Attrs: nounwind willreturn
-declare dso_local void @llvm.seh.try.end() #2
-
-; Function Attrs: nounwind readnone
-declare ptr @llvm.localaddress() #4
-
-; Function Attrs: nounwind readnone
-declare i32 @llvm.eh.exceptioncode(token) #4
-
-; Function Attrs: nounwind
-declare void @llvm.localescape(...) #5
-
-attributes #0 = { noinline norecurse optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #2 = { nounwind willreturn }
-attributes #3 = { noinline "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #4 = { nounwind readnone }
-attributes #5 = { nounwind }
-attributes #6 = { noinline }
-
-!llvm.module.flags = !{!0, !1}
-
-!0 = !{i32 1, !"wchar_size", i32 2}
-!1 = !{i32 2, !"eh-asynch", i32 1}
-
+; RUN: llc -verify-machineinstrs < %s | FileCheck %s
+
+; CHECK-LABEL: "?fin$0@0@main@@"
+; CHECK: .seh_handlerdata
+; CHECK: .set ".L?fin$0@0@main@@$parent_frame_offset", 48
+; CHECK-NEXT: .long (.Llsda_end1-.Llsda_begin1)/16
+; CHECK-NEXT: .Llsda_begin1:
+; CHECK-NEXT: .long .Ltmp
+; CHECK-NEXT: .long .Ltmp
+; CHECK-NEXT: .long "?dtor$
+; CHECK-NEXT: .long 0
+; CHECK-NEXT: .Llsda_end1:
+
+; ModuleID = 'windows-seh-EHa-TryInFinally.cpp'
+source_filename = "windows-seh-EHa-TryInFinally.cpp"
+target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-windows-msvc"
+
+$"??_C@_0CI@MDFPIOJJ@?5?9?9?9?5Test?5_Try?5in?5_finally?5?9?9?9?5i@" = comdat any
+
+$"??_C@_0BN@HHKJHLBE@?5?5In?5Inner?5_finally?5i?5?$DN?5?$CFd?5?6?$AA@" = comdat any
+
+$"??_C@_0BN@HAIIIOKI@?5?5In?5outer?5_finally?5i?5?$DN?5?$CFd?5?6?$AA@" = comdat any
+
+$"??_C@_0BJ@OJMMAGCD@?5?5In?5outer?5_try?5i?5?$DN?5?$CFd?5?6?$AA@" = comdat any
+
+$"??_C@_0CG@ENDJHCGA@?5?9?9?9?5In?5outer?5except?5handler?5i?5?$DN@" = comdat any
+
+@"??_C@_0CI@MDFPIOJJ@?5?9?9?9?5Test?5_Try?5in?5_finally?5?9?9?9?5i@" = linkonce_odr dso_local unnamed_addr constant [40 x i8] c" --- Test _Try in _finally --- i = %d \0A\00", comdat, align 1
+@"??_C@_0BN@HHKJHLBE@?5?5In?5Inner?5_finally?5i?5?$DN?5?$CFd?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [29 x i8] c" In Inner _finally i = %d \0A\00", comdat, align 1
+@"??_C@_0BN@HAIIIOKI@?5?5In?5outer?5_finally?5i?5?$DN?5?$CFd?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [29 x i8] c" In outer _finally i = %d \0A\00", comdat, align 1
+@"??_C@_0BJ@OJMMAGCD@?5?5In?5outer?5_try?5i?5?$DN?5?$CFd?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [25 x i8] c" In outer _try i = %d \0A\00", comdat, align 1
+@"??_C@_0CG@ENDJHCGA@?5?9?9?9?5In?5outer?5except?5handler?5i?5?$DN@" = linkonce_odr dso_local unnamed_addr constant [38 x i8] c" --- In outer except handler i = %d \0A\00", comdat, align 1
+
+; Function Attrs: noinline norecurse optnone
+define dso_local i32 @main() #0 personality ptr @__C_specific_handler {
+entry:
+ %retval = alloca i32, align 4
+ %i = alloca i32, align 4
+ %__exception_code = alloca i32, align 4
+ call void (...) @llvm.localescape(ptr %i)
+ store i32 0, ptr %retval, align 4
+ store i32 0, ptr %i, align 4
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %0 = load i32, ptr %i, align 4
+ %cmp = icmp slt i32 %0, 3
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %1 = load i32, ptr %i, align 4
+ call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0CI@MDFPIOJJ@?5?9?9?9?5Test?5_Try?5in?5_finally?5?9?9?9?5i@", i32 %1)
+ invoke void @llvm.seh.try.begin()
+ to label %invoke.cont unwind label %catch.dispatch
+
+invoke.cont: ; preds = %for.body
+ invoke void @llvm.seh.try.begin()
+ to label %invoke.cont1 unwind label %ehcleanup
+
+invoke.cont1: ; preds = %invoke.cont
+ %2 = load volatile i32, ptr %i, align 4
+ invoke void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0BJ@OJMMAGCD@?5?5In?5outer?5_try?5i?5?$DN?5?$CFd?5?6?$AA@", i32 %2) #6
+ to label %invoke.cont2 unwind label %ehcleanup
+
+invoke.cont2: ; preds = %invoke.cont1
+ %3 = load volatile i32, ptr %i, align 4
+ %cmp3 = icmp eq i32 %3, 0
+ br i1 %cmp3, label %if.then, label %if.end
+
+if.then: ; preds = %invoke.cont2
+ store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
+ br label %if.end
+
+if.end: ; preds = %if.then, %invoke.cont2
+ invoke void @llvm.seh.try.end()
+ to label %invoke.cont4 unwind label %ehcleanup
+
+invoke.cont4: ; preds = %if.end
+ %4 = call ptr @llvm.localaddress()
+ invoke void @"?fin$0@0@main@@"(i8 0, ptr %4) #6
+ to label %invoke.cont5 unwind label %catch.dispatch
+
+invoke.cont5: ; preds = %invoke.cont4
+ invoke void @llvm.seh.try.end()
+ to label %invoke.cont7 unwind label %catch.dispatch
+
+catch.dispatch: ; preds = %invoke.cont5, %invoke.cont6, %ehcleanup, %invoke.cont4, %for.body
+ %5 = catchswitch within none [label %__except] unwind to caller
+
+__except: ; preds = %catch.dispatch
+ %6 = catchpad within %5 [ptr null]
+ catchret from %6 to label %__except8
+
+__except8: ; preds = %__except
+ %7 = call i32 @llvm.eh.exceptioncode(token %6)
+ store i32 %7, ptr %__exception_code, align 4
+ %8 = load i32, ptr %i, align 4
+ call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0CG@ENDJHCGA@?5?9?9?9?5In?5outer?5except?5handler?5i?5?$DN@", i32 %8)
+ br label %__try.cont
+
+__try.cont: ; preds = %__except8, %invoke.cont7
+ br label %for.inc
+
+for.inc: ; preds = %__try.cont
+ %9 = load i32, ptr %i, align 4
+ %inc = add nsw i32 %9, 1
+ store i32 %inc, ptr %i, align 4
+ br label %for.cond
+
+invoke.cont7: ; preds = %invoke.cont5
+ br label %__try.cont
+
+ehcleanup: ; preds = %if.end, %invoke.cont1, %invoke.cont
+ %10 = cleanuppad within none []
+ %11 = call ptr @llvm.localaddress()
+ invoke void @"?fin$0@0@main@@"(i8 1, ptr %11) #6 [ "funclet"(token %10) ]
+ to label %invoke.cont6 unwind label %catch.dispatch
+
+invoke.cont6: ; preds = %ehcleanup
+ cleanupret from %10 unwind label %catch.dispatch
+
+for.end: ; preds = %for.cond
+ ret i32 0
+}
+
+declare dso_local void @"?printf@@YAXZZ"(...) #1
+
+; Function Attrs: nounwind willreturn
+declare dso_local void @llvm.seh.try.begin() #2
+
+declare dso_local i32 @__C_specific_handler(...)
+
+; Function Attrs: noinline
+define internal void @"?fin$0@0@main@@"(i8 %abnormal_termination, ptr %frame_pointer) #3 personality ptr @__C_specific_handler {
+entry:
+ %frame_pointer.addr = alloca ptr, align 8
+ %abnormal_termination.addr = alloca i8, align 1
+ %0 = call ptr @llvm.localrecover(ptr @main, ptr %frame_pointer, i32 0)
+ %i = bitcast ptr %0 to ptr
+ store ptr %frame_pointer, ptr %frame_pointer.addr, align 8
+ store i8 %abnormal_termination, ptr %abnormal_termination.addr, align 1
+ invoke void @llvm.seh.try.begin()
+ to label %invoke.cont unwind label %ehcleanup
+
+invoke.cont: ; preds = %entry
+ %1 = load volatile i32, ptr %i, align 4
+ invoke void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0BN@HAIIIOKI@?5?5In?5outer?5_finally?5i?5?$DN?5?$CFd?5?6?$AA@", i32 %1) #6
+ to label %invoke.cont1 unwind label %ehcleanup
+
+invoke.cont1: ; preds = %invoke.cont
+ %2 = load volatile i32, ptr %i, align 4
+ %cmp = icmp eq i32 %2, 1
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then: ; preds = %invoke.cont1
+ store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
+ br label %if.end
+
+if.end: ; preds = %if.then, %invoke.cont1
+ invoke void @llvm.seh.try.end()
+ to label %invoke.cont2 unwind label %ehcleanup
+
+invoke.cont2: ; preds = %if.end
+ call void @"?fin$1@0@main@@"(i8 0, ptr %frame_pointer)
+ ret void
+
+ehcleanup: ; preds = %if.end, %invoke.cont, %entry
+ %3 = cleanuppad within none []
+ call void @"?fin$1@0@main@@"(i8 1, ptr %frame_pointer) [ "funclet"(token %3) ]
+ cleanupret from %3 unwind to caller
+}
+
+; Function Attrs: nounwind readnone
+declare ptr @llvm.localrecover(ptr, ptr, i32 immarg) #4
+
+; Function Attrs: noinline
+define internal void @"?fin$1@0@main@@"(i8 %abnormal_termination, ptr %frame_pointer) #3 {
+entry:
+ %frame_pointer.addr = alloca ptr, align 8
+ %abnormal_termination.addr = alloca i8, align 1
+ %0 = call ptr @llvm.localrecover(ptr @main, ptr %frame_pointer, i32 0)
+ %i = bitcast ptr %0 to ptr
+ store ptr %frame_pointer, ptr %frame_pointer.addr, align 8
+ store i8 %abnormal_termination, ptr %abnormal_termination.addr, align 1
+ %1 = load i32, ptr %i, align 4
+ call void (...) @"?printf@@YAXZZ"(ptr @"??_C@_0BN@HHKJHLBE@?5?5In?5Inner?5_finally?5i?5?$DN?5?$CFd?5?6?$AA@", i32 %1)
+ %2 = load i32, ptr %i, align 4
+ %cmp = icmp eq i32 %2, 2
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then: ; preds = %entry
+ store volatile i32 0, ptr inttoptr (i64 17 to ptr), align 4
+ br label %if.end
+
+if.end: ; preds = %if.then, %entry
+ ret void
+}
+
+; Function Attrs: nounwind willreturn
+declare dso_local void @llvm.seh.try.end() #2
+
+; Function Attrs: nounwind readnone
+declare ptr @llvm.localaddress() #4
+
+; Function Attrs: nounwind readnone
+declare i32 @llvm.eh.exceptioncode(token) #4
+
+; Function Attrs: nounwind
+declare void @llvm.localescape(...) #5
+
+attributes #0 = { noinline norecurse optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #2 = { nounwind willreturn }
+attributes #3 = { noinline "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #4 = { nounwind readnone }
+attributes #5 = { nounwind }
+attributes #6 = { noinline }
+
+!llvm.module.flags = !{!0, !1}
+
+!0 = !{i32 1, !"wchar_size", i32 2}
+!1 = !{i32 2, !"eh-asynch", i32 1}
+
diff --git a/llvm/test/Demangle/ms-options.test b/llvm/test/Demangle/ms-options.test
index 94663a5f9fc4..b0d49d202989 100644
--- a/llvm/test/Demangle/ms-options.test
+++ b/llvm/test/Demangle/ms-options.test
@@ -1,43 +1,43 @@
-; RUN: llvm-undname < %s | FileCheck %s
-; RUN: llvm-undname --no-calling-convention < %s | FileCheck %s --check-prefix=CHECK-NO-CALLING-CONV
-; RUN: llvm-undname --no-return-type < %s | FileCheck %s --check-prefix=CHECK-NO-RETURN
-; RUN: llvm-undname --no-access-specifier < %s | FileCheck %s --check-prefix=CHECK-NO-ACCESS
-; RUN: llvm-undname --no-member-type < %s | FileCheck %s --check-prefix=CHECK-NO-MEMBER-TYPE
-; RUN: llvm-undname --no-variable-type < %s | FileCheck %s --check-prefix=CHECK-NO-VARIABLE-TYPE
-; RUN: llvm-undname --no-calling-convention --no-return-type --no-access-specifier --no-member-type --no-variable-type < %s | FileCheck %s --check-prefix=CHECK-NO-ALL
-
-?func@MyClass@@UEAAHHH@Z
-; CHECK: public: virtual int __cdecl MyClass::func(int, int)
-; CHECK-NO-CALLING-CONV: public: virtual int MyClass::func(int, int)
-; CHECK-NO-RETURN: public: virtual __cdecl MyClass::func(int, int)
-; CHECK-NO-ACCESS: {{^}}virtual int __cdecl MyClass::func(int, int)
-; CHECK-NO-MEMBER-TYPE: public: int __cdecl MyClass::func(int, int)
-; CHECK-NO-VARIABLE-TYPE: public: virtual int __cdecl MyClass::func(int, int)
-; CHECK-NO-ALL: {{^}}MyClass::func(int, int)
-
-?array2d@@3PAY09HA
-; CHECK: int (*array2d)[10]
-; CHECK-NO-CALLING-CONV: int (*array2d)[10]
-; CHECK-NO-RETURN: int (*array2d)[10]
-; CHECK-NO-ACCESS: int (*array2d)[10]
-; CHECK-NO-MEMBER-TYPE: int (*array2d)[10]
-; CHECK-NO-VARIABLE-TYPE: array2d
-; CHECK-NO-ALL: array2d
-
-?a@abc@@3PAY09HA
-; CHECK: int (*abc::a)[10]
-; CHECK-NO-CALLING-CONV: int (*abc::a)[10]
-; CHECK-NO-RETURN: int (*abc::a)[10]
-; CHECK-NO-ACCESS: int (*abc::a)[10]
-; CHECK-NO-MEMBER-TYPE: int (*abc::a)[10]
-; CHECK-NO-VARIABLE-TYPE: abc::a
-; CHECK-NO-ALL: abc::a
-
-?x@@3PEAEEA
-; CHECK: unsigned char *x
-; CHECK-NO-CALLING-CONV: unsigned char *x
-; CHECK-NO-RETURN: unsigned char *x
-; CHECK-NO-ACCESS: unsigned char *x
-; CHECK-NO-MEMBER-TYPE: unsigned char *x
-; CHECK-NO-VARIABLE-TYPE: x
-; CHECK-NO-ALL: x
+; RUN: llvm-undname < %s | FileCheck %s
+; RUN: llvm-undname --no-calling-convention < %s | FileCheck %s --check-prefix=CHECK-NO-CALLING-CONV
+; RUN: llvm-undname --no-return-type < %s | FileCheck %s --check-prefix=CHECK-NO-RETURN
+; RUN: llvm-undname --no-access-specifier < %s | FileCheck %s --check-prefix=CHECK-NO-ACCESS
+; RUN: llvm-undname --no-member-type < %s | FileCheck %s --check-prefix=CHECK-NO-MEMBER-TYPE
+; RUN: llvm-undname --no-variable-type < %s | FileCheck %s --check-prefix=CHECK-NO-VARIABLE-TYPE
+; RUN: llvm-undname --no-calling-convention --no-return-type --no-access-specifier --no-member-type --no-variable-type < %s | FileCheck %s --check-prefix=CHECK-NO-ALL
+
+?func@MyClass@@UEAAHHH@Z
+; CHECK: public: virtual int __cdecl MyClass::func(int, int)
+; CHECK-NO-CALLING-CONV: public: virtual int MyClass::func(int, int)
+; CHECK-NO-RETURN: public: virtual __cdecl MyClass::func(int, int)
+; CHECK-NO-ACCESS: {{^}}virtual int __cdecl MyClass::func(int, int)
+; CHECK-NO-MEMBER-TYPE: public: int __cdecl MyClass::func(int, int)
+; CHECK-NO-VARIABLE-TYPE: public: virtual int __cdecl MyClass::func(int, int)
+; CHECK-NO-ALL: {{^}}MyClass::func(int, int)
+
+?array2d@@3PAY09HA
+; CHECK: int (*array2d)[10]
+; CHECK-NO-CALLING-CONV: int (*array2d)[10]
+; CHECK-NO-RETURN: int (*array2d)[10]
+; CHECK-NO-ACCESS: int (*array2d)[10]
+; CHECK-NO-MEMBER-TYPE: int (*array2d)[10]
+; CHECK-NO-VARIABLE-TYPE: array2d
+; CHECK-NO-ALL: array2d
+
+?a@abc@@3PAY09HA
+; CHECK: int (*abc::a)[10]
+; CHECK-NO-CALLING-CONV: int (*abc::a)[10]
+; CHECK-NO-RETURN: int (*abc::a)[10]
+; CHECK-NO-ACCESS: int (*abc::a)[10]
+; CHECK-NO-MEMBER-TYPE: int (*abc::a)[10]
+; CHECK-NO-VARIABLE-TYPE: abc::a
+; CHECK-NO-ALL: abc::a
+
+?x@@3PEAEEA
+; CHECK: unsigned char *x
+; CHECK-NO-CALLING-CONV: unsigned char *x
+; CHECK-NO-RETURN: unsigned char *x
+; CHECK-NO-ACCESS: unsigned char *x
+; CHECK-NO-MEMBER-TYPE: unsigned char *x
+; CHECK-NO-VARIABLE-TYPE: x
+; CHECK-NO-ALL: x
diff --git a/llvm/test/MC/AMDGPU/v_illegal-atomics.s b/llvm/test/MC/AMDGPU/v_illegal-atomics.s
index 175f017ad9ca..cedb89ce9cd1 100644
--- a/llvm/test/MC/AMDGPU/v_illegal-atomics.s
+++ b/llvm/test/MC/AMDGPU/v_illegal-atomics.s
@@ -1,6 +1,6 @@
-// RUN: llvm-mc -triple=amdgcn -mcpu=gfx1030 -show-encoding %s | FileCheck --check-prefix=GFX1030 %s
-// RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -show-encoding %s | FileCheck --check-prefix=GFX1100 %s
-
-v_illegal
-// GFX1030: encoding: [0x00,0x00,0x00,0x00]
-// GFX1100: encoding: [0x00,0x00,0x00,0x00]
+// RUN: llvm-mc -triple=amdgcn -mcpu=gfx1030 -show-encoding %s | FileCheck --check-prefix=GFX1030 %s
+// RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -show-encoding %s | FileCheck --check-prefix=GFX1100 %s
+
+v_illegal
+// GFX1030: encoding: [0x00,0x00,0x00,0x00]
+// GFX1100: encoding: [0x00,0x00,0x00,0x00]
diff --git a/llvm/test/MC/AsmParser/directive_file-g.s b/llvm/test/MC/AsmParser/directive_file-g.s
index bbf6fbd8a4c4..48f083dc7aa8 100644
--- a/llvm/test/MC/AsmParser/directive_file-g.s
+++ b/llvm/test/MC/AsmParser/directive_file-g.s
@@ -1,24 +1,24 @@
-## Make sure that using -g (or equivalent) on an asm file that already has
-## debug-info directives in it will correctly ignore the -g and produce
-## debug info corresponding to the directives in the source.
-## Note gcc accepts ".file 1" after a label, although not after an opcode.
-## If no other directives appear, gcc emits no debug info at all.
-
-# RUN: llvm-mc -g -triple i386-unknown-unknown -filetype=obj %s -o %t
-# RUN: llvm-dwarfdump -debug-info -debug-line %t | FileCheck %s
-
-foo:
- .file 1 "a.c"
- .loc 1 1 1
- nop
-
-# CHECK: .debug_info
-## gcc does generate a DW_TAG_compile_unit in this case, with or without
-## -g on the command line, but we do not.
-# CHECK-EMPTY:
-# CHECK-NEXT: .debug_line
-# CHECK: file_names[ 1]:
-# CHECK-NEXT: name: "a.c"
-# CHECK-NEXT: dir_index: 0
-# CHECK: 0x{{0+}}0 1 1 1 0 0 0 is_stmt
-# CHECK: 0x{{0+}}1 1 1 1 0 0 0 is_stmt end_sequence
+## Make sure that using -g (or equivalent) on an asm file that already has
+## debug-info directives in it will correctly ignore the -g and produce
+## debug info corresponding to the directives in the source.
+## Note gcc accepts ".file 1" after a label, although not after an opcode.
+## If no other directives appear, gcc emits no debug info at all.
+
+# RUN: llvm-mc -g -triple i386-unknown-unknown -filetype=obj %s -o %t
+# RUN: llvm-dwarfdump -debug-info -debug-line %t | FileCheck %s
+
+foo:
+ .file 1 "a.c"
+ .loc 1 1 1
+ nop
+
+# CHECK: .debug_info
+## gcc does generate a DW_TAG_compile_unit in this case, with or without
+## -g on the command line, but we do not.
+# CHECK-EMPTY:
+# CHECK-NEXT: .debug_line
+# CHECK: file_names[ 1]:
+# CHECK-NEXT: name: "a.c"
+# CHECK-NEXT: dir_index: 0
+# CHECK: 0x{{0+}}0 1 1 1 0 0 0 is_stmt
+# CHECK: 0x{{0+}}1 1 1 1 0 0 0 is_stmt end_sequence
diff --git a/llvm/test/Transforms/InstCombine/debuginfo-sink.ll b/llvm/test/Transforms/InstCombine/debuginfo-sink.ll
index 0c7d30d70c36..311948262fac 100644
--- a/llvm/test/Transforms/InstCombine/debuginfo-sink.ll
+++ b/llvm/test/Transforms/InstCombine/debuginfo-sink.ll
@@ -54,33 +54,33 @@ sink2:
ret i32 %extract
}
-; This GEP is sunk, and has multiple debug uses in the same block. Check that
-; only the last use is cloned into the sunk block, and that both of the
-; original dbg.values are salvaged.
-;
-; CHECK-LABEL: define i32 @baz(ptr
-; CHECK: call void @llvm.dbg.value(metadata ptr %a, metadata !{{[0-9]+}},
-; CHECK-SAME: metadata !DIExpression(DW_OP_plus_uconst, 4, DW_OP_stack_value))
-; CHECK-NEXT: call void @llvm.dbg.value(metadata ptr %a, metadata !{{[0-9]+}},
-; CHECK-SAME: metadata !DIExpression(DW_OP_plus_uconst, 4, DW_OP_plus_uconst, 5, DW_OP_stack_value))
-; CHECK-NEXT: br label %sink1
-
-define i32 @baz(ptr %a) !dbg !80 {
-entry:
- %gep = getelementptr i32, ptr %a, i32 1
- call void @llvm.dbg.value(metadata ptr %gep, metadata !83, metadata !12), !dbg !84
- call void @llvm.dbg.value(metadata ptr %gep, metadata !83, metadata !DIExpression(DW_OP_plus_uconst, 5)), !dbg !85
- br label %sink1
-
-sink1:
-; CHECK-LABEL: sink1:
-; CHECK: call void @llvm.dbg.value(metadata ptr %gep,
-; CHECK-SAME: metadata !{{[0-9]+}}, metadata !DIExpression(DW_OP_plus_uconst, 5))
-; CHECK-NEXT: load
- %0 = load i32, ptr %gep, align 4, !dbg !85
- ret i32 %0, !dbg !85
-}
-
+; This GEP is sunk, and has multiple debug uses in the same block. Check that
+; only the last use is cloned into the sunk block, and that both of the
+; original dbg.values are salvaged.
+;
+; CHECK-LABEL: define i32 @baz(ptr
+; CHECK: call void @llvm.dbg.value(metadata ptr %a, metadata !{{[0-9]+}},
+; CHECK-SAME: metadata !DIExpression(DW_OP_plus_uconst, 4, DW_OP_stack_value))
+; CHECK-NEXT: call void @llvm.dbg.value(metadata ptr %a, metadata !{{[0-9]+}},
+; CHECK-SAME: metadata !DIExpression(DW_OP_plus_uconst, 4, DW_OP_plus_uconst, 5, DW_OP_stack_value))
+; CHECK-NEXT: br label %sink1
+
+define i32 @baz(ptr %a) !dbg !80 {
+entry:
+ %gep = getelementptr i32, ptr %a, i32 1
+ call void @llvm.dbg.value(metadata ptr %gep, metadata !83, metadata !12), !dbg !84
+ call void @llvm.dbg.value(metadata ptr %gep, metadata !83, metadata !DIExpression(DW_OP_plus_uconst, 5)), !dbg !85
+ br label %sink1
+
+sink1:
+; CHECK-LABEL: sink1:
+; CHECK: call void @llvm.dbg.value(metadata ptr %gep,
+; CHECK-SAME: metadata !{{[0-9]+}}, metadata !DIExpression(DW_OP_plus_uconst, 5))
+; CHECK-NEXT: load
+ %0 = load i32, ptr %gep, align 4, !dbg !85
+ ret i32 %0, !dbg !85
+}
+
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5}
!llvm.ident = !{!6}
@@ -105,7 +105,7 @@ sink1:
!72 = !{!10, !10, !10}
!73 = !DILocalVariable(name: "k", scope: !70, file: !1, line: 2, type: !10)
!74 = !DILocation(line: 5, column: 3, scope: !70)
-!80 = distinct !DISubprogram(name: "baz", scope: !1, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
-!83 = !DILocalVariable(name: "l", scope: !80, file: !1, line: 2, type: !10)
-!84 = !DILocation(line: 5, column: 3, scope: !80)
-!85 = !DILocation(line: 6, column: 3, scope: !80)
+!80 = distinct !DISubprogram(name: "baz", scope: !1, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
+!83 = !DILocalVariable(name: "l", scope: !80, file: !1, line: 2, type: !10)
+!84 = !DILocation(line: 5, column: 3, scope: !80)
+!85 = !DILocation(line: 6, column: 3, scope: !80)
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/gep-constanfolding-error.ll b/llvm/test/Transforms/InstSimplify/ConstProp/gep-constanfolding-error.ll
index 474af2d42726..bcba5ce3aa7e 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/gep-constanfolding-error.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/gep-constanfolding-error.ll
@@ -1,52 +1,52 @@
-; RUN: opt -passes=gvn -S -o - %s | FileCheck %s
-; RUN: opt -passes=newgvn -S -o - %s | FileCheck %s
-; Test that the constantfolding getelementptr computation results in
-; j[5][4][1] (j+239)
-; and not [1][4][4][1] (#449) which is an incorrect out-of-range error
-target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
-target triple = "armv7-none-eabi"
-
-@f = local_unnamed_addr global i32 2, align 4
-@t6 = local_unnamed_addr global i32 1, align 4
-@j = local_unnamed_addr global [6 x [6 x [7 x i8]]] [[6 x [7 x i8]] [[7 x i8] c"\06\00\00\00\00\00\00", [7 x i8] zeroinitializer, [7 x i8] zeroinitializer, [7 x i8] zeroinitializer, [7 x i8] zeroinitializer, [7 x i8] zeroinitializer], [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer], align 1
-@p = internal global i64 0, align 8
-@y = local_unnamed_addr global ptr @p, align 4
-@b = internal unnamed_addr global i32 0, align 4
-@h = common local_unnamed_addr global i16 0, align 2
-@a = common local_unnamed_addr global i32 0, align 4
-@k = common local_unnamed_addr global i32 0, align 4
-@t11 = common local_unnamed_addr global i32 0, align 4
-
-; Function Attrs: nounwind
-define i32 @main() local_unnamed_addr {
-entry:
- %0 = load i32, ptr @t6, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, ptr @t6, align 4
- store i16 4, ptr @h, align 2
- %1 = load i32, ptr @a, align 4
- %conv = trunc i32 %1 to i8
- store i32 1, ptr @f, align 4
- %2 = load i64, ptr @p, align 8
- %cmp4 = icmp slt i64 %2, 2
- %conv6 = zext i1 %cmp4 to i8
- %3 = load i16, ptr @h, align 2
- %conv7 = sext i16 %3 to i32
- %add = add nsw i32 %conv7, 1
- %f.promoted = load i32, ptr @f, align 4
- %4 = mul i32 %conv7, 7
- %5 = add i32 %4, 5
- %6 = sub i32 -1, %f.promoted
- %7 = icmp sgt i32 %6, -2
- %smax = select i1 %7, i32 %6, i32 -2
- %8 = sub i32 6, %smax
- %scevgep = getelementptr [6 x [6 x [7 x i8]]], ptr @j, i32 0, i32 0, i32 %5, i32 %8
- %9 = add i32 %f.promoted, %smax
- %10 = add i32 %9, 2
- call void @llvm.memset.p0.i32(ptr %scevgep, i8 %conv6, i32 %10, i1 false)
-; CHECK: call void @llvm.memset.p0.i32(ptr getelementptr inbounds ([6 x [6 x [7 x i8]]], ptr @j, i32 0, i{{32|64}} 5, i{{32|64}} 4, i32 1), i8 %conv6, i32 1, i1 false)
-; CHECK-NOT: call void @llvm.memset.p0.i32(ptr getelementptr ([6 x [6 x [7 x i8]]], ptr @j, i64 1, i64 4, i64 4, i32 1)
- ret i32 0
-}
-; Function Attrs: argmemonly nounwind
-declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1)
+; RUN: opt -passes=gvn -S -o - %s | FileCheck %s
+; RUN: opt -passes=newgvn -S -o - %s | FileCheck %s
+; Test that the constantfolding getelementptr computation results in
+; j[5][4][1] (j+239)
+; and not [1][4][4][1] (#449) which is an incorrect out-of-range error
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
+target triple = "armv7-none-eabi"
+
+@f = local_unnamed_addr global i32 2, align 4
+@t6 = local_unnamed_addr global i32 1, align 4
+@j = local_unnamed_addr global [6 x [6 x [7 x i8]]] [[6 x [7 x i8]] [[7 x i8] c"\06\00\00\00\00\00\00", [7 x i8] zeroinitializer, [7 x i8] zeroinitializer, [7 x i8] zeroinitializer, [7 x i8] zeroinitializer, [7 x i8] zeroinitializer], [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer], align 1
+@p = internal global i64 0, align 8
+@y = local_unnamed_addr global ptr @p, align 4
+@b = internal unnamed_addr global i32 0, align 4
+@h = common local_unnamed_addr global i16 0, align 2
+@a = common local_unnamed_addr global i32 0, align 4
+@k = common local_unnamed_addr global i32 0, align 4
+@t11 = common local_unnamed_addr global i32 0, align 4
+
+; Function Attrs: nounwind
+define i32 @main() local_unnamed_addr {
+entry:
+ %0 = load i32, ptr @t6, align 4
+ %inc = add nsw i32 %0, 1
+ store i32 %inc, ptr @t6, align 4
+ store i16 4, ptr @h, align 2
+ %1 = load i32, ptr @a, align 4
+ %conv = trunc i32 %1 to i8
+ store i32 1, ptr @f, align 4
+ %2 = load i64, ptr @p, align 8
+ %cmp4 = icmp slt i64 %2, 2
+ %conv6 = zext i1 %cmp4 to i8
+ %3 = load i16, ptr @h, align 2
+ %conv7 = sext i16 %3 to i32
+ %add = add nsw i32 %conv7, 1
+ %f.promoted = load i32, ptr @f, align 4
+ %4 = mul i32 %conv7, 7
+ %5 = add i32 %4, 5
+ %6 = sub i32 -1, %f.promoted
+ %7 = icmp sgt i32 %6, -2
+ %smax = select i1 %7, i32 %6, i32 -2
+ %8 = sub i32 6, %smax
+ %scevgep = getelementptr [6 x [6 x [7 x i8]]], ptr @j, i32 0, i32 0, i32 %5, i32 %8
+ %9 = add i32 %f.promoted, %smax
+ %10 = add i32 %9, 2
+ call void @llvm.memset.p0.i32(ptr %scevgep, i8 %conv6, i32 %10, i1 false)
+; CHECK: call void @llvm.memset.p0.i32(ptr getelementptr inbounds ([6 x [6 x [7 x i8]]], ptr @j, i32 0, i{{32|64}} 5, i{{32|64}} 4, i32 1), i8 %conv6, i32 1, i1 false)
+; CHECK-NOT: call void @llvm.memset.p0.i32(ptr getelementptr ([6 x [6 x [7 x i8]]], ptr @j, i64 1, i64 4, i64 4, i32 1)
+ ret i32 0
+}
+; Function Attrs: argmemonly nounwind
+declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1)
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/timeout.ll b/llvm/test/Transforms/InstSimplify/ConstProp/timeout.ll
index 3417d4a6c1f4..2c5b31f099fb 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/timeout.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/timeout.ll
@@ -1,70 +1,70 @@
-; NOTE: This is a timeout test for some O(something silly) constant folding behaviour. It may not be the best test. Providing it finishes, it passes.
-; RUN: opt < %s -O3 -S | FileCheck %s
-target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
-target triple = "armv8-none-eabi"
-
-%struct.ST = type { ptr }
-
-@global = internal global [121 x i8] zeroinitializer, align 1
-
-define void @func() #0 {
-;CHECK-LABEL: func
-entry:
- %s = alloca ptr, align 4
- %j = alloca i32, align 4
- store ptr @global, ptr %s, align 4
- store i32 0, ptr %j, align 4
- br label %for.cond
-
-for.cond: ; preds = %for.inc, %entry
- %0 = load i32, ptr %j, align 4
- %cmp = icmp slt i32 %0, 30
- br i1 %cmp, label %for.body, label %for.end
-
-for.body: ; preds = %for.cond
- %1 = load ptr, ptr %s, align 4
- %add.ptr = getelementptr inbounds i8, ptr %1, i32 4
- %2 = ptrtoint ptr %add.ptr to i32
- %3 = load ptr, ptr %s, align 4
- %add.ptr1 = getelementptr inbounds i8, ptr %3, i32 4
- %4 = ptrtoint ptr %add.ptr1 to i32
- %rem = urem i32 %4, 2
- %cmp2 = icmp eq i32 %rem, 0
- br i1 %cmp2, label %cond.true, label %cond.false
-
-cond.true: ; preds = %for.body
- br label %cond.end
-
-cond.false: ; preds = %for.body
- %5 = load ptr, ptr %s, align 4
- %add.ptr3 = getelementptr inbounds i8, ptr %5, i32 4
- %6 = ptrtoint ptr %add.ptr3 to i32
- %rem4 = urem i32 %6, 2
- br label %cond.end
-
-cond.end: ; preds = %cond.false, %cond.true
- %cond = phi i32 [ 0, %cond.true ], [ %rem4, %cond.false ]
- %add = add i32 %2, %cond
- %7 = inttoptr i32 %add to ptr
- %8 = load ptr, ptr %s, align 4
- %next = getelementptr inbounds %struct.ST, ptr %8, i32 0, i32 0
- store ptr %7, ptr %next, align 4
- %9 = load ptr, ptr %s, align 4
- %next5 = getelementptr inbounds %struct.ST, ptr %9, i32 0, i32 0
- %10 = load ptr, ptr %next5, align 4
- store ptr %10, ptr %s, align 4
- br label %for.inc
-
-for.inc: ; preds = %cond.end
- %11 = load i32, ptr %j, align 4
- %inc = add nsw i32 %11, 1
- store i32 %inc, ptr %j, align 4
- br label %for.cond
-
-for.end: ; preds = %for.cond
- %12 = load ptr, ptr %s, align 4
- %next6 = getelementptr inbounds %struct.ST, ptr %12, i32 0, i32 0
- store ptr null, ptr %next6, align 4
- ret void
-}
-
+; NOTE: This is a timeout test for some O(something silly) constant folding behaviour. It may not be the best test. Providing it finishes, it passes.
+; RUN: opt < %s -O3 -S | FileCheck %s
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
+target triple = "armv8-none-eabi"
+
+%struct.ST = type { ptr }
+
+@global = internal global [121 x i8] zeroinitializer, align 1
+
+define void @func() #0 {
+;CHECK-LABEL: func
+entry:
+ %s = alloca ptr, align 4
+ %j = alloca i32, align 4
+ store ptr @global, ptr %s, align 4
+ store i32 0, ptr %j, align 4
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %0 = load i32, ptr %j, align 4
+ %cmp = icmp slt i32 %0, 30
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %1 = load ptr, ptr %s, align 4
+ %add.ptr = getelementptr inbounds i8, ptr %1, i32 4
+ %2 = ptrtoint ptr %add.ptr to i32
+ %3 = load ptr, ptr %s, align 4
+ %add.ptr1 = getelementptr inbounds i8, ptr %3, i32 4
+ %4 = ptrtoint ptr %add.ptr1 to i32
+ %rem = urem i32 %4, 2
+ %cmp2 = icmp eq i32 %rem, 0
+ br i1 %cmp2, label %cond.true, label %cond.false
+
+cond.true: ; preds = %for.body
+ br label %cond.end
+
+cond.false: ; preds = %for.body
+ %5 = load ptr, ptr %s, align 4
+ %add.ptr3 = getelementptr inbounds i8, ptr %5, i32 4
+ %6 = ptrtoint ptr %add.ptr3 to i32
+ %rem4 = urem i32 %6, 2
+ br label %cond.end
+
+cond.end: ; preds = %cond.false, %cond.true
+ %cond = phi i32 [ 0, %cond.true ], [ %rem4, %cond.false ]
+ %add = add i32 %2, %cond
+ %7 = inttoptr i32 %add to ptr
+ %8 = load ptr, ptr %s, align 4
+ %next = getelementptr inbounds %struct.ST, ptr %8, i32 0, i32 0
+ store ptr %7, ptr %next, align 4
+ %9 = load ptr, ptr %s, align 4
+ %next5 = getelementptr inbounds %struct.ST, ptr %9, i32 0, i32 0
+ %10 = load ptr, ptr %next5, align 4
+ store ptr %10, ptr %s, align 4
+ br label %for.inc
+
+for.inc: ; preds = %cond.end
+ %11 = load i32, ptr %j, align 4
+ %inc = add nsw i32 %11, 1
+ store i32 %inc, ptr %j, align 4
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ %12 = load ptr, ptr %s, align 4
+ %next6 = getelementptr inbounds %struct.ST, ptr %12, i32 0, i32 0
+ store ptr null, ptr %next6, align 4
+ ret void
+}
+
diff --git a/llvm/test/Transforms/LoopStrengthReduce/pr51329.ll b/llvm/test/Transforms/LoopStrengthReduce/pr51329.ll
index 52a8f1921dae..e4edab1346d3 100644
--- a/llvm/test/Transforms/LoopStrengthReduce/pr51329.ll
+++ b/llvm/test/Transforms/LoopStrengthReduce/pr51329.ll
@@ -1,55 +1,55 @@
-; RUN: opt -S -loop-reduce %s | FileCheck %s
-; RUN: opt --try-experimental-debuginfo-iterators -S -loop-reduce %s | FileCheck %s
-;
-; Test that LSR SCEV-based salvaging does not crash when translating SCEVs
-; that contain integers with binary representations greater than 64-bits.
-; Also show that no salvaging attempt is made for dbg.value that are undef
-; pre-LSR.
-;
-; CHECK: call void @llvm.dbg.value(metadata i64 undef, metadata !{{[0-9]+}}, metadata !DIExpression(DW_OP_plus_uconst, 228, DW_OP_stack_value))
-; CHECK: call void @llvm.dbg.value(metadata i64 %var2, metadata !{{[0-9]+}}, metadata !DIExpression(DW_OP_plus_uconst, 228, DW_OP_stack_value))
-
-
-target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
-declare void @llvm.dbg.value(metadata, metadata, metadata)
-
-; Function Attrs: nounwind
-define hidden void @reproducer() local_unnamed_addr !dbg !5 {
-init:
- %0 = lshr i128 undef, 64
- %var1 = trunc i128 %0 to i64
- %1 = add nuw i64 undef, %var1
- %var2 = lshr i64 %1, 12
- br label %Label_d0
-
-Label_d0: ; preds = %Label_d0, %init
- %var3 = phi i64 [ %var2, %init ], [ %var4, %Label_d0 ]
- call void @llvm.dbg.value(metadata i64 undef, metadata !11, metadata !DIExpression(DW_OP_plus_uconst, 228, DW_OP_stack_value)), !dbg !12
- call void @llvm.dbg.value(metadata i64 %var2, metadata !11, metadata !DIExpression(DW_OP_plus_uconst, 228, DW_OP_stack_value)), !dbg !12
- %var4 = add i64 %var3, -1
- %var5 = icmp eq i64 %var4, 0
- br i1 %var5, label %Label_1bc, label %Label_d0
-
-Label_1bc: ; preds = %Label_d0
- ret void
-}
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "frontend", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
-!1 = !DIFile(filename: "source", directory: "")
-!2 = !{}
-!3 = !{i32 2, !"Debug Info Version", i32 3}
-!4 = !{i32 1, !"wchar_size", i32 4}
-!5 = distinct !DISubprogram(name: "reproducer", scope: !1, file: !1, line: 904320, type: !6, scopeLine: 904320, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !10)
-!6 = !DISubroutineType(types: !7)
-!7 = !{null, !8, !9, !9, !9, !9, !9, !9}
-!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
-!9 = !DIBasicType(name: "my_type", size: 64, encoding: DW_ATE_unsigned)
-!10 = !{!11}
-!11 = !DILocalVariable(name: "my_var", arg: 1, scope: !5, file: !1, line: 904320, type: !8)
+; RUN: opt -S -loop-reduce %s | FileCheck %s
+; RUN: opt --try-experimental-debuginfo-iterators -S -loop-reduce %s | FileCheck %s
+;
+; Test that LSR SCEV-based salvaging does not crash when translating SCEVs
+; that contain integers with binary representations greater than 64-bits.
+; Also show that no salvaging attempt is made for dbg.value that are undef
+; pre-LSR.
+;
+; CHECK: call void @llvm.dbg.value(metadata i64 undef, metadata !{{[0-9]+}}, metadata !DIExpression(DW_OP_plus_uconst, 228, DW_OP_stack_value))
+; CHECK: call void @llvm.dbg.value(metadata i64 %var2, metadata !{{[0-9]+}}, metadata !DIExpression(DW_OP_plus_uconst, 228, DW_OP_stack_value))
+
+
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
+declare void @llvm.dbg.value(metadata, metadata, metadata)
+
+; Function Attrs: nounwind
+define hidden void @reproducer() local_unnamed_addr !dbg !5 {
+init:
+ %0 = lshr i128 undef, 64
+ %var1 = trunc i128 %0 to i64
+ %1 = add nuw i64 undef, %var1
+ %var2 = lshr i64 %1, 12
+ br label %Label_d0
+
+Label_d0: ; preds = %Label_d0, %init
+ %var3 = phi i64 [ %var2, %init ], [ %var4, %Label_d0 ]
+ call void @llvm.dbg.value(metadata i64 undef, metadata !11, metadata !DIExpression(DW_OP_plus_uconst, 228, DW_OP_stack_value)), !dbg !12
+ call void @llvm.dbg.value(metadata i64 %var2, metadata !11, metadata !DIExpression(DW_OP_plus_uconst, 228, DW_OP_stack_value)), !dbg !12
+ %var4 = add i64 %var3, -1
+ %var5 = icmp eq i64 %var4, 0
+ br i1 %var5, label %Label_1bc, label %Label_d0
+
+Label_1bc: ; preds = %Label_d0
+ ret void
+}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "frontend", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
+!1 = !DIFile(filename: "source", directory: "")
+!2 = !{}
+!3 = !{i32 2, !"Debug Info Version", i32 3}
+!4 = !{i32 1, !"wchar_size", i32 4}
+!5 = distinct !DISubprogram(name: "reproducer", scope: !1, file: !1, line: 904320, type: !6, scopeLine: 904320, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !10)
+!6 = !DISubroutineType(types: !7)
+!7 = !{null, !8, !9, !9, !9, !9, !9, !9}
+!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
+!9 = !DIBasicType(name: "my_type", size: 64, encoding: DW_ATE_unsigned)
+!10 = !{!11}
+!11 = !DILocalVariable(name: "my_var", arg: 1, scope: !5, file: !1, line: 904320, type: !8)
!12 = !DILocation(line: 904544, scope: !5) \ No newline at end of file
diff --git a/llvm/test/Transforms/PhaseOrdering/pr32544.ll b/llvm/test/Transforms/PhaseOrdering/pr32544.ll
index 186954fd22aa..421260b10231 100644
--- a/llvm/test/Transforms/PhaseOrdering/pr32544.ll
+++ b/llvm/test/Transforms/PhaseOrdering/pr32544.ll
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -O3 -S < %s | FileCheck %s
-; RUN: opt -passes='default<O3>' -S < %s | FileCheck %s
+; RUN: opt -passes='default<O3>' -S < %s | FileCheck %s
define void @foo(i1 %which, i32 %a, i32 %b, ptr %result) {
; CHECK-LABEL: @foo(
diff --git a/llvm/test/Transforms/Reassociate/undef_intrinsics_when_deleting_instructions.ll b/llvm/test/Transforms/Reassociate/undef_intrinsics_when_deleting_instructions.ll
index ef9b86db52f2..a98bdb5a88e4 100644
--- a/llvm/test/Transforms/Reassociate/undef_intrinsics_when_deleting_instructions.ll
+++ b/llvm/test/Transforms/Reassociate/undef_intrinsics_when_deleting_instructions.ll
@@ -1,74 +1,74 @@
-; RUN: opt < %s -passes=reassociate -S | FileCheck %s
-; RUN: opt < %s -passes=reassociate -S --try-experimental-debuginfo-iterators | FileCheck %s
-
-; Check that reassociate pass now undefs debug intrinsics that reference a value
-; that gets dropped and cannot be salvaged.
-
-; CHECK-NOT: %add = fadd fast float %a, %b
-; CHECK: call void @llvm.dbg.value(metadata float poison, metadata [[VAR_X:![0-9]+]], metadata !DIExpression())
-
-; CHECK-LABEL: if.then:
-; CHECK-NOT: %add1 = fadd fast float %add, %c
-; CHECK: call void @llvm.dbg.value(metadata float poison, metadata [[VAR_Y:![0-9]+]], metadata !DIExpression())
-; CHECK-LABEL: !0 =
-; CHECK-DAG: [[VAR_Y]] = !DILocalVariable(name: "y"
-; CHECK-DAG: [[VAR_X]] = !DILocalVariable(name: "x"
-
-define float @"?foo@@YAMMMMM@Z"(float %a, float %b, float %c, float %d) !dbg !8 {
-entry:
- call void @llvm.dbg.value(metadata float %d, metadata !12, metadata !DIExpression()), !dbg !13
- call void @llvm.dbg.value(metadata float %c, metadata !14, metadata !DIExpression()), !dbg !13
- call void @llvm.dbg.value(metadata float %b, metadata !15, metadata !DIExpression()), !dbg !13
- call void @llvm.dbg.value(metadata float %a, metadata !16, metadata !DIExpression()), !dbg !13
- %add = fadd fast float %a, %b, !dbg !17
- call void @llvm.dbg.value(metadata float %add, metadata !18, metadata !DIExpression()), !dbg !13
- %cmp = fcmp fast oeq float %d, 4.000000e+00, !dbg !19
- br i1 %cmp, label %if.then, label %return, !dbg !19
+; RUN: opt < %s -passes=reassociate -S | FileCheck %s
+; RUN: opt < %s -passes=reassociate -S --try-experimental-debuginfo-iterators | FileCheck %s
-if.then: ; preds = %entry
- %add1 = fadd fast float %add, %c, !dbg !20
- call void @llvm.dbg.value(metadata float %add1, metadata !23, metadata !DIExpression()), !dbg !24
- %sub = fsub fast float %add, 1.200000e+01, !dbg !25
- %sub2 = fsub fast float %add1, %sub, !dbg !25
- %mul = fmul fast float %sub2, 2.000000e+01, !dbg !25
- %div = fdiv fast float %mul, 3.000000e+00, !dbg !25
- br label %return, !dbg !25
+; Check that reassociate pass now undefs debug intrinsics that reference a value
+; that gets dropped and cannot be salvaged.
-return: ; preds = %entry, %if.then
- %retval.0 = phi float [ %div, %if.then ], [ 0.000000e+00, %entry ], !dbg !13
- ret float %retval.0, !dbg !26
+; CHECK-NOT: %add = fadd fast float %a, %b
+; CHECK: call void @llvm.dbg.value(metadata float poison, metadata [[VAR_X:![0-9]+]], metadata !DIExpression())
+
+; CHECK-LABEL: if.then:
+; CHECK-NOT: %add1 = fadd fast float %add, %c
+; CHECK: call void @llvm.dbg.value(metadata float poison, metadata [[VAR_Y:![0-9]+]], metadata !DIExpression())
+; CHECK-LABEL: !0 =
+; CHECK-DAG: [[VAR_Y]] = !DILocalVariable(name: "y"
+; CHECK-DAG: [[VAR_X]] = !DILocalVariable(name: "x"
+
+define float @"?foo@@YAMMMMM@Z"(float %a, float %b, float %c, float %d) !dbg !8 {
+entry:
+ call void @llvm.dbg.value(metadata float %d, metadata !12, metadata !DIExpression()), !dbg !13
+ call void @llvm.dbg.value(metadata float %c, metadata !14, metadata !DIExpression()), !dbg !13
+ call void @llvm.dbg.value(metadata float %b, metadata !15, metadata !DIExpression()), !dbg !13
+ call void @llvm.dbg.value(metadata float %a, metadata !16, metadata !DIExpression()), !dbg !13
+ %add = fadd fast float %a, %b, !dbg !17
+ call void @llvm.dbg.value(metadata float %add, metadata !18, metadata !DIExpression()), !dbg !13
+ %cmp = fcmp fast oeq float %d, 4.000000e+00, !dbg !19
+ br i1 %cmp, label %if.then, label %return, !dbg !19
+
+if.then: ; preds = %entry
+ %add1 = fadd fast float %add, %c, !dbg !20
+ call void @llvm.dbg.value(metadata float %add1, metadata !23, metadata !DIExpression()), !dbg !24
+ %sub = fsub fast float %add, 1.200000e+01, !dbg !25
+ %sub2 = fsub fast float %add1, %sub, !dbg !25
+ %mul = fmul fast float %sub2, 2.000000e+01, !dbg !25
+ %div = fdiv fast float %mul, 3.000000e+00, !dbg !25
+ br label %return, !dbg !25
+
+return: ; preds = %entry, %if.then
+ %retval.0 = phi float [ %div, %if.then ], [ 0.000000e+00, %entry ], !dbg !13
+ ret float %retval.0, !dbg !26
}
-declare void @llvm.dbg.value(metadata, metadata, metadata)
+declare void @llvm.dbg.value(metadata, metadata, metadata)
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5, !6}
!llvm.ident = !{!7}
-!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
-!1 = !DIFile(filename: "undef_intrinsics_when_deleting_instructions.cpp", directory: "/")
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
+!1 = !DIFile(filename: "undef_intrinsics_when_deleting_instructions.cpp", directory: "/")
!2 = !{}
-!3 = !{i32 2, !"CodeView", i32 1}
+!3 = !{i32 2, !"CodeView", i32 1}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 2}
!6 = !{i32 7, !"PIC Level", i32 2}
-!7 = !{!"clang version 11.0.0"}
-!8 = distinct !DISubprogram(name: "foo", linkageName: "?foo@@YAMMMMM@Z", scope: !1, file: !1, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
-!9 = !DISubroutineType(types: !10)
-!10 = !{!11, !11, !11, !11, !11}
-!11 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
-!12 = !DILocalVariable(name: "d", arg: 4, scope: !8, file: !1, line: 1, type: !11)
-!13 = !DILocation(line: 0, scope: !8)
-!14 = !DILocalVariable(name: "c", arg: 3, scope: !8, file: !1, line: 1, type: !11)
-!15 = !DILocalVariable(name: "b", arg: 2, scope: !8, file: !1, line: 1, type: !11)
-!16 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !1, line: 1, type: !11)
-!17 = !DILocation(line: 2, scope: !8)
-!18 = !DILocalVariable(name: "x", scope: !8, file: !1, line: 2, type: !11)
-!19 = !DILocation(line: 3, scope: !8)
-!20 = !DILocation(line: 4, scope: !21)
-!21 = distinct !DILexicalBlock(scope: !22, file: !1, line: 3)
-!22 = distinct !DILexicalBlock(scope: !8, file: !1, line: 3)
-!23 = !DILocalVariable(name: "y", scope: !21, file: !1, line: 4, type: !11)
-!24 = !DILocation(line: 0, scope: !21)
-!25 = !DILocation(line: 5, scope: !21)
-!26 = !DILocation(line: 8, scope: !8)
+!7 = !{!"clang version 11.0.0"}
+!8 = distinct !DISubprogram(name: "foo", linkageName: "?foo@@YAMMMMM@Z", scope: !1, file: !1, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
+!9 = !DISubroutineType(types: !10)
+!10 = !{!11, !11, !11, !11, !11}
+!11 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
+!12 = !DILocalVariable(name: "d", arg: 4, scope: !8, file: !1, line: 1, type: !11)
+!13 = !DILocation(line: 0, scope: !8)
+!14 = !DILocalVariable(name: "c", arg: 3, scope: !8, file: !1, line: 1, type: !11)
+!15 = !DILocalVariable(name: "b", arg: 2, scope: !8, file: !1, line: 1, type: !11)
+!16 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !1, line: 1, type: !11)
+!17 = !DILocation(line: 2, scope: !8)
+!18 = !DILocalVariable(name: "x", scope: !8, file: !1, line: 2, type: !11)
+!19 = !DILocation(line: 3, scope: !8)
+!20 = !DILocation(line: 4, scope: !21)
+!21 = distinct !DILexicalBlock(scope: !22, file: !1, line: 3)
+!22 = distinct !DILexicalBlock(scope: !8, file: !1, line: 3)
+!23 = !DILocalVariable(name: "y", scope: !21, file: !1, line: 4, type: !11)
+!24 = !DILocation(line: 0, scope: !21)
+!25 = !DILocation(line: 5, scope: !21)
+!26 = !DILocation(line: 8, scope: !8)
diff --git a/llvm/test/Transforms/ThinLTOBitcodeWriter/split-typed-decl.ll b/llvm/test/Transforms/ThinLTOBitcodeWriter/split-typed-decl.ll
index ec96c1632586..ddc8604fe41c 100644
--- a/llvm/test/Transforms/ThinLTOBitcodeWriter/split-typed-decl.ll
+++ b/llvm/test/Transforms/ThinLTOBitcodeWriter/split-typed-decl.ll
@@ -1,12 +1,12 @@
-;; Generating bitcode files with split LTO modules should not crash if there are
-;; typed declarations in sources.
-
-; RUN: opt --thinlto-bc --thinlto-split-lto-unit -o - %s
-
-@_ZTV3Foo = external constant { [3 x ptr] }, !type !0
-
-define void @Bar() {
- ret void
-}
-
-!0 = !{i64 16, !"_ZTS3Foo"}
+;; Generating bitcode files with split LTO modules should not crash if there are
+;; typed declarations in sources.
+
+; RUN: opt --thinlto-bc --thinlto-split-lto-unit -o - %s
+
+@_ZTV3Foo = external constant { [3 x ptr] }, !type !0
+
+define void @Bar() {
+ ret void
+}
+
+!0 = !{i64 16, !"_ZTS3Foo"}