diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-06-21 13:59:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-06-21 13:59:01 +0000 |
commit | 3a0822f094b578157263e04114075ad7df81db41 (patch) | |
tree | bc48361fe2cd1ca5f93ac01b38b183774468fc79 /test/Transforms | |
parent | 85d8b2bbe386bcfe669575d05b61482d7be07e5d (diff) | |
download | src-3a0822f094b578157263e04114075ad7df81db41.tar.gz src-3a0822f094b578157263e04114075ad7df81db41.zip |
Vendor import of llvm trunk r240225:vendor/llvm/llvm-trunk-r240225
Notes
Notes:
svn path=/vendor/llvm/dist/; revision=284677
svn path=/vendor/llvm/llvm-trunk-r240225/; revision=284678; tag=vendor/llvm/llvm-trunk-r240225
Diffstat (limited to 'test/Transforms')
163 files changed, 1721 insertions, 524 deletions
diff --git a/test/Transforms/ADCE/2003-09-10-UnwindInstFail.ll b/test/Transforms/ADCE/2003-09-10-UnwindInstFail.ll index 6bbcfdb67ec5..607bf2e58095 100644 --- a/test/Transforms/ADCE/2003-09-10-UnwindInstFail.ll +++ b/test/Transforms/ADCE/2003-09-10-UnwindInstFail.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -adce -disable-output -define void @test() { +define void @test() personality i32 (...)* @__gxx_personality_v0 { br i1 false, label %then, label %endif then: ; preds = %0 @@ -8,7 +8,7 @@ then: ; preds = %0 to label %invoke_cont unwind label %invoke_catch invoke_catch: ; preds = %then - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup resume { i8*, i32 } %exn diff --git a/test/Transforms/ADCE/2005-02-17-PHI-Invoke-Crash.ll b/test/Transforms/ADCE/2005-02-17-PHI-Invoke-Crash.ll index 4ddc2f180a2d..068ad2bc1d86 100644 --- a/test/Transforms/ADCE/2005-02-17-PHI-Invoke-Crash.ll +++ b/test/Transforms/ADCE/2005-02-17-PHI-Invoke-Crash.ll @@ -6,7 +6,7 @@ declare void @_ZN10QByteArray6resizeEi() declare void @q_atomic_decrement() -define void @_ZNK10QByteArray13leftJustifiedEicb() { +define void @_ZNK10QByteArray13leftJustifiedEicb() personality i32 (...)* @__gxx_personality_v0 { entry: invoke void @strlen( ) to label %tmp.3.i.noexc unwind label %invoke_catch.0 @@ -15,7 +15,7 @@ tmp.3.i.noexc: ; preds = %entry br i1 false, label %then.0, label %else.0 invoke_catch.0: ; preds = %entry - %exn.0 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn.0 = landingpad {i8*, i32} cleanup invoke void @q_atomic_decrement( ) to label %tmp.1.i.i183.noexc unwind label %terminate @@ -28,7 +28,7 @@ then.0: ; preds = %tmp.3.i.noexc to label %invoke_cont.1 unwind label %invoke_catch.1 invoke_catch.1: ; preds = %then.0 - %exn.1 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn.1 = landingpad {i8*, i32} cleanup invoke void @q_atomic_decrement( ) to label %tmp.1.i.i162.noexc unwind label %terminate @@ -44,7 +44,7 @@ else.0: ; preds = %tmp.3.i.noexc terminate: ; preds = %invoke_catch.1, %invoke_catch.0 %dbg.0.1 = phi { }* [ null, %invoke_catch.1 ], [ null, %invoke_catch.0 ] ; <{ }*> [#uses=0] - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup unreachable } diff --git a/test/Transforms/ADCE/dce_pure_invoke.ll b/test/Transforms/ADCE/dce_pure_invoke.ll index 8e7851804575..e01c9feaeb06 100644 --- a/test/Transforms/ADCE/dce_pure_invoke.ll +++ b/test/Transforms/ADCE/dce_pure_invoke.ll @@ -2,7 +2,7 @@ declare i32 @strlen(i8*) readnone -define i32 @test() { +define i32 @test() personality i32 (...)* @__gxx_personality_v0 { ; invoke of pure function should not be deleted! invoke i32 @strlen( i8* null ) readnone to label %Cont unwind label %Other ; <i32>:1 [#uses=0] @@ -11,7 +11,7 @@ Cont: ; preds = %0 ret i32 0 Other: ; preds = %0 - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup ret i32 1 } diff --git a/test/Transforms/ArgumentPromotion/crash.ll b/test/Transforms/ArgumentPromotion/crash.ll index dbd343ae920e..d3f412da14d9 100644 --- a/test/Transforms/ArgumentPromotion/crash.ll +++ b/test/Transforms/ArgumentPromotion/crash.ll @@ -1,7 +1,7 @@ ; RUN: opt -inline -argpromotion < %s ; rdar://7879828 -define void @foo() { +define void @foo() personality i32 (...)* @__gxx_personality_v0 { invoke void @foo2() to label %if.end432 unwind label %for.end520 @@ -9,7 +9,7 @@ if.end432: unreachable for.end520: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup unreachable } diff --git a/test/Transforms/ArgumentPromotion/sret.ll b/test/Transforms/ArgumentPromotion/sret.ll new file mode 100644 index 000000000000..8e5521f48d10 --- /dev/null +++ b/test/Transforms/ArgumentPromotion/sret.ll @@ -0,0 +1,28 @@ +; RUN: opt < %s -argpromotion -S | FileCheck %s + +target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-pc-windows-msvc" + +; CHECK: define internal void @add(i32 %[[THIS1:.*]], i32 %[[THIS2:.*]], i32* noalias %[[SR:.*]]) +define internal void @add({i32, i32}* %this, i32* sret %r) { + %ap = getelementptr {i32, i32}, {i32, i32}* %this, i32 0, i32 0 + %bp = getelementptr {i32, i32}, {i32, i32}* %this, i32 0, i32 1 + %a = load i32, i32* %ap + %b = load i32, i32* %bp + ; CHECK: %[[AB:.*]] = add i32 %[[THIS1]], %[[THIS2]] + %ab = add i32 %a, %b + ; CHECK: store i32 %[[AB]], i32* %[[SR]] + store i32 %ab, i32* %r + ret void +} + +; CHECK: define void @f() +define void @f() { + ; CHECK: %[[R:.*]] = alloca i32 + %r = alloca i32 + %pair = alloca {i32, i32} + + ; CHECK: call void @add(i32 %{{.*}}, i32 %{{.*}}, i32* noalias %[[R]]) + call void @add({i32, i32}* %pair, i32* sret %r) + ret void +} diff --git a/test/Transforms/BDCE/dce-pure.ll b/test/Transforms/BDCE/dce-pure.ll index 6a432fcc42d7..a379fa4a0039 100644 --- a/test/Transforms/BDCE/dce-pure.ll +++ b/test/Transforms/BDCE/dce-pure.ll @@ -11,7 +11,7 @@ define void @test1() { ; CHECK: ret void } -define i32 @test2() { +define i32 @test2() personality i32 (...)* @__gxx_personality_v0 { ; invoke of pure function should not be deleted! invoke i32 @strlen( i8* null ) readnone to label %Cont unwind label %Other @@ -20,7 +20,7 @@ Cont: ; preds = %0 ret i32 0 Other: ; preds = %0 - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup ret i32 1 diff --git a/test/Transforms/BDCE/order.ll b/test/Transforms/BDCE/order.ll index 301f4476ab5b..728624a5f230 100644 --- a/test/Transforms/BDCE/order.ll +++ b/test/Transforms/BDCE/order.ll @@ -4,7 +4,7 @@ target triple = "x86_64-unknown-linux-gnu" declare i32 @__gxx_personality_v0(...) -define fastcc void @_ZN11__sanitizerL12TestRegistryEPNS_14ThreadRegistryEb() #0 { +define fastcc void @_ZN11__sanitizerL12TestRegistryEPNS_14ThreadRegistryEb() #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: br i1 undef, label %if.else, label %entry.if.end_crit_edge @@ -22,7 +22,7 @@ lpad65.loopexit.split-lp.loopexit.split-lp: br label %if.else lpad65.loopexit.split-lp.loopexit.split-lp.loopexit: - %lpad.loopexit1121 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %lpad.loopexit1121 = landingpad { i8*, i32 } cleanup br label %lpad65.loopexit.split-lp.loopexit.split-lp diff --git a/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll b/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll index ff5de6b73e21..fd9814c545fc 100644 --- a/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll +++ b/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll @@ -4,7 +4,7 @@ declare i32 @_IO_getc() declare void @__errno_location() -define void @yylex() { +define void @yylex() personality i32 (...)* @__gcc_personality_v0 { entry: switch i32 0, label %label.126 [ i32 0, label %return @@ -190,7 +190,7 @@ return: ; preds = %entry ret void LongJmpBlkPre: ; preds = %endif.52, %then.40 - %exn = landingpad { i8*, i32 } personality i32 (...)* @__gcc_personality_v0 + %exn = landingpad { i8*, i32 } catch i8* null ret void } diff --git a/test/Transforms/CodeExtractor/2004-11-12-InvokeExtract.ll b/test/Transforms/CodeExtractor/2004-11-12-InvokeExtract.ll index 92603d9e634e..0a83681a0717 100644 --- a/test/Transforms/CodeExtractor/2004-11-12-InvokeExtract.ll +++ b/test/Transforms/CodeExtractor/2004-11-12-InvokeExtract.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -extract-blocks -disable-output -define i32 @foo() { +define i32 @foo() personality i32 (...)* @__gcc_personality_v0 { br label %EB EB: ; preds = %0 @@ -10,7 +10,7 @@ Cont: ; preds = %EB ret i32 %V Unw: ; preds = %EB - %exn = landingpad { i8*, i32 } personality i32 (...)* @__gcc_personality_v0 + %exn = landingpad { i8*, i32 } catch i8* null resume { i8*, i32 } %exn } diff --git a/test/Transforms/CodeGenPrepare/AMDGPU/lit.local.cfg b/test/Transforms/CodeGenPrepare/AMDGPU/lit.local.cfg new file mode 100644 index 000000000000..6baccf05fff0 --- /dev/null +++ b/test/Transforms/CodeGenPrepare/AMDGPU/lit.local.cfg @@ -0,0 +1,3 @@ +if not 'AMDGPU' in config.root.targets: + config.unsupported = True + diff --git a/test/Transforms/CodeGenPrepare/R600/no-sink-addrspacecast.ll b/test/Transforms/CodeGenPrepare/AMDGPU/no-sink-addrspacecast.ll index f6f898fae21b..f6f898fae21b 100644 --- a/test/Transforms/CodeGenPrepare/R600/no-sink-addrspacecast.ll +++ b/test/Transforms/CodeGenPrepare/AMDGPU/no-sink-addrspacecast.ll diff --git a/test/Transforms/CodeGenPrepare/R600/lit.local.cfg b/test/Transforms/CodeGenPrepare/R600/lit.local.cfg deleted file mode 100644 index 4086e8d681c3..000000000000 --- a/test/Transforms/CodeGenPrepare/R600/lit.local.cfg +++ /dev/null @@ -1,3 +0,0 @@ -if not 'R600' in config.root.targets: - config.unsupported = True - diff --git a/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll b/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll index fc25daca1c2e..4adae850e78b 100644 --- a/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll +++ b/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll @@ -5,18 +5,18 @@ define internal { i32, i32 } @foo() { ret {i32,i32} {i32 42, i32 4} } -define i32 @bar() { +define i32 @bar() personality i32 (...)* @__gxx_personality_v0 { %x = invoke {i32,i32} @foo() to label %T unwind label %T2 T: %y = extractvalue {i32,i32} %x, 1 ret i32 %y T2: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup unreachable } -define i32 @bar2() { +define i32 @bar2() personality i32 (...)* @__gxx_personality_v0 { entry: %x = invoke {i32,i32} @foo() to label %T unwind label %T2 T: @@ -24,7 +24,7 @@ T: %y = extractvalue {i32,i32} %x, 1 ret i32 %y T2: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup unreachable } diff --git a/test/Transforms/FunctionAttrs/nocapture.ll b/test/Transforms/FunctionAttrs/nocapture.ll index 55a3dc4aa35b..4057b2a86e3b 100644 --- a/test/Transforms/FunctionAttrs/nocapture.ll +++ b/test/Transforms/FunctionAttrs/nocapture.ll @@ -47,13 +47,13 @@ define i1 @c5(i32* %q, i32 %bitno) { declare void @throw_if_bit_set(i8*, i8) readonly ; CHECK: define i1 @c6(i8* readonly %q, i8 %bit) -define i1 @c6(i8* %q, i8 %bit) { +define i1 @c6(i8* %q, i8 %bit) personality i32 (...)* @__gxx_personality_v0 { invoke void @throw_if_bit_set(i8* %q, i8 %bit) to label %ret0 unwind label %ret1 ret0: ret i1 0 ret1: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup ret i1 1 } diff --git a/test/Transforms/GVN/2010-05-08-OneBit.ll b/test/Transforms/GVN/2010-05-08-OneBit.ll index 0e3fa4b8a490..562b3d820d02 100644 --- a/test/Transforms/GVN/2010-05-08-OneBit.ll +++ b/test/Transforms/GVN/2010-05-08-OneBit.ll @@ -4,7 +4,7 @@ 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-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target triple = "x86_64-unknown-linux-gnu" -define i32 @main(i32 %argc, i8** nocapture %argv) { +define i32 @main(i32 %argc, i8** nocapture %argv) personality i32 (...)* @__gxx_personality_v0 { entry: %0 = getelementptr inbounds i8, i8* undef, i64 5 ; <i8*> [#uses=1] %1 = bitcast i8* %0 to i32* ; <i32*> [#uses=1] @@ -45,7 +45,7 @@ k151.i.i: ; preds = %k133.i.i ret i32 0 landing_pad: ; preds = %l147.i.i, %l129.i.i, %l117.i.i - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup switch i32 undef, label %fin [ i32 1, label %catch1 diff --git a/test/Transforms/GVN/2011-09-07-TypeIdFor.ll b/test/Transforms/GVN/2011-09-07-TypeIdFor.ll index 314b5bb113a6..d6b69d3eb4e8 100644 --- a/test/Transforms/GVN/2011-09-07-TypeIdFor.ll +++ b/test/Transforms/GVN/2011-09-07-TypeIdFor.ll @@ -17,13 +17,13 @@ declare void @__cxa_end_catch() declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*) -define void @_Z3foov() uwtable { +define void @_Z3foov() uwtable personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 { entry: invoke void @_Z4barv() to label %return unwind label %lpad lpad: ; preds = %entry - %0 = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 + %0 = landingpad { i8*, i32 } catch %struct.__fundamental_type_info_pseudo* @_ZTIi catch %struct.__fundamental_type_info_pseudo* @_ZTIb catch %struct.__fundamental_type_info_pseudo* @_ZTIi diff --git a/test/Transforms/GVN/cond_br2.ll b/test/Transforms/GVN/cond_br2.ll index 02154a783912..baa282ec200c 100644 --- a/test/Transforms/GVN/cond_br2.ll +++ b/test/Transforms/GVN/cond_br2.ll @@ -9,7 +9,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 %"union.llvm::SmallVectorBase::U" = type { x86_fp80 } ; Function Attrs: ssp uwtable -define void @_Z4testv() #0 { +define void @_Z4testv() #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { ; CHECK: @_Z4testv() ; CHECK: invoke.cont: ; CHECK: br i1 true, label %new.notnull.i11, label %if.end.i14 @@ -98,7 +98,7 @@ _ZN4llvm11SmallVectorIiLj8EED1Ev.exit21: ; preds = %invoke.cont3, %if.t ret void lpad: ; preds = %if.end.i14, %if.end.i, %invoke.cont2 - %12 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %12 = landingpad { i8*, i32 } cleanup %13 = load i8*, i8** %BeginX.i.i.i.i.i.i, align 16, !tbaa !4 %cmp.i.i.i.i = icmp eq i8* %13, %1 diff --git a/test/Transforms/GVN/load-pre-nonlocal.ll b/test/Transforms/GVN/load-pre-nonlocal.ll index c75e54db6287..e9827a158ade 100644 --- a/test/Transforms/GVN/load-pre-nonlocal.ll +++ b/test/Transforms/GVN/load-pre-nonlocal.ll @@ -53,30 +53,35 @@ for.end: ; %1 is partially redundant if %0 can be widened to a 64-bit load. ; CHECK-LABEL: define i32 @overaligned_load +; CHECK: if.then: +; CHECK: %0 = load i64 +; CHECK: [[LSHR:%[0-9]+]] = lshr i64 %0, 32, !dbg [[LSHR_LOC:![0-9]+]] +; CHECK: trunc i64 [[LSHR]] to i32 ; CHECK: if.end: ; CHECK-NOT: %1 = load i32, i32* +; CHECK: [[LSHR_LOC]] = !DILocation(line: 101, column: 1, scope: !{{.*}}) define i32 @overaligned_load(i32 %a, i32* nocapture %b) { entry: - %cmp = icmp sgt i32 %a, 0 - br i1 %cmp, label %if.then, label %if.else + %cmp = icmp sgt i32 %a, 0, !dbg !14 + br i1 %cmp, label %if.then, label %if.else, !dbg !14 if.then: - %0 = load i32, i32* getelementptr inbounds (%struct.S1, %struct.S1* @s1, i64 0, i32 0), align 8, !tbaa !5 - br label %if.end + %0 = load i32, i32* getelementptr inbounds (%struct.S1, %struct.S1* @s1, i64 0, i32 0), align 8, !tbaa !5, !dbg !15 + br label %if.end, !dbg !15 if.else: - %arrayidx = getelementptr inbounds i32, i32* %b, i64 2 - store i32 10, i32* %arrayidx, align 4, !tbaa !5 - br label %if.end + %arrayidx = getelementptr inbounds i32, i32* %b, i64 2, !dbg !16 + store i32 10, i32* %arrayidx, align 4, !tbaa !5, !dbg !16 + br label %if.end, !dbg !16 if.end: %i.0 = phi i32 [ %0, %if.then ], [ 0, %if.else ] %p.0 = phi i32* [ getelementptr inbounds (%struct.S1, %struct.S1* @s1, i64 0, i32 0), %if.then ], [ %b, %if.else ] - %add.ptr = getelementptr inbounds i32, i32* %p.0, i64 1 - %1 = load i32, i32* %add.ptr, align 4, !tbaa !5 - %add1 = add nsw i32 %1, %i.0 - ret i32 %add1 + %add.ptr = getelementptr inbounds i32, i32* %p.0, i64 1, !dbg !17 + %1 = load i32, i32* %add.ptr, align 4, !tbaa !5, !dbg !17 + %add1 = add nsw i32 %1, %i.0, !dbg !17 + ret i32 %add1, !dbg !17 } !1 = !{!2, !2, i64 0} @@ -85,3 +90,18 @@ if.end: !4 = !{!"Simple C/C++ TBAA"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !3, i64 0} + +!llvm.module.flags = !{!7, !8, !9} +!7 = !{i32 2, !"Dwarf Version", i32 4} +!8 = !{i32 2, !"Debug Info Version", i32 3} +!9 = !{i32 1, !"PIC Level", i32 2} + +!10 = !{} +!11 = !DISubroutineType(types: !10) +!12 = !DIFile(filename: "test.cpp", directory: "/tmp") +!13 = !DISubprogram(name: "test", scope: !12, file: !12, line: 99, type: !11, isLocal: false, isDefinition: true, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, function: i32 (i32, i32*)* @overaligned_load, variables: !10) +!14 = !DILocation(line: 100, column: 1, scope: !13) +!15 = !DILocation(line: 101, column: 1, scope: !13) +!16 = !DILocation(line: 102, column: 1, scope: !13) +!17 = !DILocation(line: 103, column: 1, scope: !13) + diff --git a/test/Transforms/GVN/phi-translate.ll b/test/Transforms/GVN/phi-translate.ll index 6068b05aadf5..9e37b882f222 100644 --- a/test/Transforms/GVN/phi-translate.ll +++ b/test/Transforms/GVN/phi-translate.ll @@ -4,28 +4,49 @@ target datalayout = "e-p:64:64:64" ; CHECK-LABEL: @foo( ; CHECK: entry.end_crit_edge: -; CHECK: %n.pre = load i32, i32* %q.phi.trans.insert +; CHECK: %j.phi.trans.insert = sext i32 %x to i64, !dbg [[J_LOC:![0-9]+]] +; CHECK: %q.phi.trans.insert = getelementptr {{.*}}, !dbg [[Q_LOC:![0-9]+]] +; CHECK: %n.pre = load i32, i32* %q.phi.trans.insert, !dbg [[N_LOC:![0-9]+]] ; CHECK: then: ; CHECK: store i32 %z ; CHECK: end: -; CHECK: %n = phi i32 [ %n.pre, %entry.end_crit_edge ], [ %z, %then ] +; CHECK: %n = phi i32 [ %n.pre, %entry.end_crit_edge ], [ %z, %then ], !dbg [[N_LOC]] ; CHECK: ret i32 %n +; CHECK-DAG: [[J_LOC]] = !DILocation(line: 45, column: 1, scope: !{{.*}}) +; CHECK-DAG: [[Q_LOC]] = !DILocation(line: 46, column: 1, scope: !{{.*}}) +; CHECK-DAG: [[N_LOC]] = !DILocation(line: 47, column: 1, scope: !{{.*}}) + @G = external global [100 x i32] define i32 @foo(i32 %x, i32 %z) { entry: - %tobool = icmp eq i32 %z, 0 - br i1 %tobool, label %end, label %then + %tobool = icmp eq i32 %z, 0, !dbg !7 + br i1 %tobool, label %end, label %then, !dbg !7 then: - %i = sext i32 %x to i64 - %p = getelementptr [100 x i32], [100 x i32]* @G, i64 0, i64 %i - store i32 %z, i32* %p - br label %end + %i = sext i32 %x to i64, !dbg !8 + %p = getelementptr [100 x i32], [100 x i32]* @G, i64 0, i64 %i, !dbg !8 + store i32 %z, i32* %p, !dbg !8 + br label %end, !dbg !8 end: - %j = sext i32 %x to i64 - %q = getelementptr [100 x i32], [100 x i32]* @G, i64 0, i64 %j - %n = load i32, i32* %q - ret i32 %n + %j = sext i32 %x to i64, !dbg !9 + %q = getelementptr [100 x i32], [100 x i32]* @G, i64 0, i64 %j, !dbg !10 + %n = load i32, i32* %q, !dbg !11 + ret i32 %n, !dbg !11 } + +!llvm.module.flags = !{!0, !1, !2} +!0 = !{i32 2, !"Dwarf Version", i32 4} +!1 = !{i32 2, !"Debug Info Version", i32 3} +!2 = !{i32 1, !"PIC Level", i32 2} + +!3 = !{} +!4 = !DISubroutineType(types: !3) +!5 = !DIFile(filename: "a.cc", directory: "/tmp") +!6 = !DISubprogram(name: "foo", scope: !5, file: !5, line: 42, type: !4, isLocal: false, isDefinition: true, scopeLine: 43, flags: DIFlagPrototyped, isOptimized: false, function: i32 (i32, i32)* @foo, variables: !3) +!7 = !DILocation(line: 43, column: 1, scope: !6) +!8 = !DILocation(line: 44, column: 1, scope: !6) +!9 = !DILocation(line: 45, column: 1, scope: !6) +!10 = !DILocation(line: 46, column: 1, scope: !6) +!11 = !DILocation(line: 47, column: 1, scope: !6) diff --git a/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll b/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll index b6dfdea0610d..16da5315db0c 100644 --- a/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll +++ b/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll @@ -30,7 +30,7 @@ define void @test2() { declare i8* @strdup(i8*) declare void @foo2(i8*) -define void @test3() uwtable { +define void @test3() uwtable personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 { ; CHECK-LABEL: @test3( ; CHECK-NOT: bb1: ; CHECK-NOT: bb2: @@ -41,7 +41,7 @@ bb1: store i8* %ptr, i8** @glbl unreachable bb2: - %tmp1 = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 + %tmp1 = landingpad { i8*, i32 } cleanup resume { i8*, i32 } %tmp1 } diff --git a/test/Transforms/GlobalOpt/invoke.ll b/test/Transforms/GlobalOpt/invoke.ll index c1f499c38a3c..a0f7890a985b 100644 --- a/test/Transforms/GlobalOpt/invoke.ll +++ b/test/Transforms/GlobalOpt/invoke.ll @@ -11,7 +11,7 @@ define i32 @one() { ret i32 1 } -define void @_GLOBAL__I_a() { +define void @_GLOBAL__I_a() personality i8* undef { bb: %tmp1 = invoke i32 @one() to label %bb2 unwind label %bb4 @@ -21,7 +21,7 @@ bb2: ; preds = %bb ret void bb4: ; preds = %bb - %tmp5 = landingpad { i8*, i32 } personality i8* undef + %tmp5 = landingpad { i8*, i32 } filter [0 x i8*] zeroinitializer unreachable } diff --git a/test/Transforms/IPConstantProp/return-argument.ll b/test/Transforms/IPConstantProp/return-argument.ll index 927531b996ea..0290adc4b78d 100644 --- a/test/Transforms/IPConstantProp/return-argument.ll +++ b/test/Transforms/IPConstantProp/return-argument.ll @@ -27,7 +27,7 @@ define internal { i32, i32 } @foo(i32 %A, i32 %B) { ret { i32, i32 } %Z } -define void @caller(i1 %C) { +define void @caller(i1 %C) personality i32 (...)* @__gxx_personality_v0 { %Q = alloca i32 ;; Call incdec to see if %W is properly replaced by %Q %W = call i32* @incdec(i1 %C, i32* %Q ) ; <i32> [#uses=1] @@ -46,7 +46,7 @@ OK: br label %RET LPAD: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup br label %RET diff --git a/test/Transforms/IPConstantProp/return-constant.ll b/test/Transforms/IPConstantProp/return-constant.ll index d89579532e71..195420d6aad7 100644 --- a/test/Transforms/IPConstantProp/return-constant.ll +++ b/test/Transforms/IPConstantProp/return-constant.ll @@ -15,13 +15,13 @@ define i1 @caller(i1 %C) { ret i1 %Y } -define i1 @invokecaller(i1 %C) { +define i1 @invokecaller(i1 %C) personality i32 (...)* @__gxx_personality_v0 { %X = invoke i32 @foo( i1 %C ) to label %OK unwind label %FAIL ; <i32> [#uses=1] OK: %Y = icmp ne i32 %X, 0 ; <i1> [#uses=1] ret i1 %Y FAIL: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup ret i1 false } diff --git a/test/Transforms/IndVarSimplify/2004-04-05-InvokeCastCrash.ll b/test/Transforms/IndVarSimplify/2004-04-05-InvokeCastCrash.ll index 0c88e83975c1..06eec7dfe28c 100644 --- a/test/Transforms/IndVarSimplify/2004-04-05-InvokeCastCrash.ll +++ b/test/Transforms/IndVarSimplify/2004-04-05-InvokeCastCrash.ll @@ -112,13 +112,13 @@ declare void @_ZNK4llvm19MachineInstrBuilder7addSImmEi() declare i32 @__gxx_personality_v0(...) -define void @_ZN4llvm11_GLOBAL__N_22InsertPrologEpilogCode20runOnMachineFunctionERNS_15MachineFunctionE(%"struct.llvm::MachineFunction"* %F) { +define void @_ZN4llvm11_GLOBAL__N_22InsertPrologEpilogCode20runOnMachineFunctionERNS_15MachineFunctionE(%"struct.llvm::MachineFunction"* %F) personality i32 (...)* @__gxx_personality_v0 { entry: %tmp.8.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null ) to label %invoke_cont.0.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=0] invoke_catch.0.i: ; preds = %invoke_cont.49.i, %invoke_cont.48.i, %invoke_cont.47.i, %invoke_cont.i53.i, %no_exit.i, %invoke_cont.44.i, %invoke_cont.43.i, %invoke_cont.42.i, %invoke_cont.41.i, %invoke_cont.40.i, %invoke_cont.39.i, %invoke_cont.38.i, %invoke_cont.37.i, %then.2.i, %invoke_cont.35.i, %invoke_cont.34.i, %then.1.i, %endif.0.i, %invoke_cont.9.i, %invoke_cont.8.i, %invoke_cont.7.i, %invoke_cont.i.i, %then.0.i, %invoke_cont.4.i, %invoke_cont.3.i, %invoke_cont.2.i, %invoke_cont.1.i, %endif.0.i.i, %tmp.7.i.noexc.i, %invoke_cont.0.i, %entry - %exn0.i = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn0.i = landingpad {i8*, i32} cleanup ret void @@ -168,7 +168,7 @@ tmp.0.i.noexc.i: ; preds = %then.0.i to label %invoke_cont.i.i unwind label %cond_true.i.i cond_true.i.i: ; preds = %tmp.0.i.noexc.i - %exn.i.i = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn.i.i = landingpad {i8*, i32} cleanup ret void @@ -262,7 +262,7 @@ tmp.0.i.noexc55.i: ; preds = %no_exit.i to label %invoke_cont.i53.i unwind label %cond_true.i52.i cond_true.i52.i: ; preds = %tmp.0.i.noexc55.i - %exn.i52.i = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn.i52.i = landingpad {i8*, i32} cleanup ret void diff --git a/test/Transforms/IndVarSimplify/2005-02-11-InvokeCrash.ll b/test/Transforms/IndVarSimplify/2005-02-11-InvokeCrash.ll index a5706ca6198e..926b82fdf147 100644 --- a/test/Transforms/IndVarSimplify/2005-02-11-InvokeCrash.ll +++ b/test/Transforms/IndVarSimplify/2005-02-11-InvokeCrash.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -indvars -disable-output -define void @_ZN5ArrayISt7complexIdEEC2ERK10dim_vector() { +define void @_ZN5ArrayISt7complexIdEEC2ERK10dim_vector() personality i32 (...)* @__gxx_personality_v0 { entry: %tmp.7 = invoke i32 @_ZN5ArrayISt7complexIdEE8get_sizeERK10dim_vector( ) to label %invoke_cont.0 unwind label %cond_true.1 ; <i32> [#uses=2] @@ -16,7 +16,7 @@ no_exit.i: ; preds = %no_exit.i, %invoke_cont.0 br label %no_exit.i cond_true.1: ; preds = %entry - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup resume { i8*, i32 } %exn } diff --git a/test/Transforms/IndVarSimplify/2005-02-17-TruncateExprCrash.ll b/test/Transforms/IndVarSimplify/2005-02-17-TruncateExprCrash.ll index 16ad635a9205..a0dac7a29cc8 100644 --- a/test/Transforms/IndVarSimplify/2005-02-17-TruncateExprCrash.ll +++ b/test/Transforms/IndVarSimplify/2005-02-17-TruncateExprCrash.ll @@ -4,13 +4,13 @@ declare void @q_atomic_increment() declare void @_Z9qt_assertPKcS0_i() -define void @_ZN13QMetaResourceC1EPKh() { +define void @_ZN13QMetaResourceC1EPKh() personality i32 (...)* @__gxx_personality_v0 { entry: invoke void @_Z9qt_assertPKcS0_i( ) to label %endif.1 unwind label %then.i.i551 then.i.i551: ; preds = %entry - %exn551 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn551 = landingpad {i8*, i32} cleanup ret void @@ -22,7 +22,7 @@ then.2: ; preds = %endif.1 to label %loopentry.0 unwind label %invoke_catch.6 invoke_catch.6: ; preds = %then.2 - %exn6 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn6 = landingpad {i8*, i32} cleanup ret void diff --git a/test/Transforms/IndVarSimplify/crash.ll b/test/Transforms/IndVarSimplify/crash.ll index aa6a2ee16521..63683ff56117 100644 --- a/test/Transforms/IndVarSimplify/crash.ll +++ b/test/Transforms/IndVarSimplify/crash.ll @@ -62,7 +62,7 @@ declare void @__go_undefer() declare i32 @__gccgo_personality_v0(i32, i64, i8*, i8*) -define void @main.main() uwtable { +define void @main.main() uwtable personality i32 (i32, i64, i8*, i8*)* @__gccgo_personality_v0 { entry: invoke void @__go_panic() noreturn to label %0 unwind label %"5.i" @@ -75,12 +75,12 @@ entry: to label %main.f.exit unwind label %"7.i" "5.i": ; preds = %entry - %1 = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gccgo_personality_v0 + %1 = landingpad { i8*, i32 } catch i8* null br label %"3.i" "7.i": ; preds = %"3.i" - %2 = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gccgo_personality_v0 + %2 = landingpad { i8*, i32 } catch i8* null br label %"3.i" diff --git a/test/Transforms/IndVarSimplify/interesting-invoke-use.ll b/test/Transforms/IndVarSimplify/interesting-invoke-use.ll index 69bea6eaaed4..131b02c3aaed 100644 --- a/test/Transforms/IndVarSimplify/interesting-invoke-use.ll +++ b/test/Transforms/IndVarSimplify/interesting-invoke-use.ll @@ -11,7 +11,7 @@ target triple = "i386-pc-linux-gnu" @.str7 = external constant [24 x i8] ; <[24 x i8]*> [#uses=1] @C.17.316 = external constant %struct.string___XUB ; <%struct.string___XUB*> [#uses=1] -define void @_ada_c35503g() { +define void @_ada_c35503g() personality i32 (...)* @__gxx_personality_v0 { entry: br label %bb @@ -47,7 +47,7 @@ bb178: ; preds = %invcont127 br label %bb123 lpad266: ; preds = %invcont129, %bb128, %bb123 - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup unreachable } diff --git a/test/Transforms/Inline/2003-09-14-InlineValue.ll b/test/Transforms/Inline/2003-09-14-InlineValue.ll index 98bc08b378e0..4f1f61b4c073 100644 --- a/test/Transforms/Inline/2003-09-14-InlineValue.ll +++ b/test/Transforms/Inline/2003-09-14-InlineValue.ll @@ -8,7 +8,7 @@ define internal i32 @Callee() { ret i32 %J } -define i32 @Caller() { +define i32 @Caller() personality i32 (...)* @__gxx_personality_v0 { %V = invoke i32 @Callee( ) to label %Ok unwind label %Bad ; <i32> [#uses=1] @@ -16,7 +16,7 @@ Ok: ; preds = %0 ret i32 %V Bad: ; preds = %0 - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup ret i32 0 } diff --git a/test/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll b/test/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll index df0b472bb2a5..9a5fcaeea7dc 100644 --- a/test/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll +++ b/test/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -inline -disable-output -define i32 @main() { +define i32 @main() personality i32 (...)* @__gxx_personality_v0 { entry: invoke void @__main( ) to label %LongJmpBlkPost unwind label %LongJmpBlkPre @@ -10,7 +10,7 @@ LongJmpBlkPost: LongJmpBlkPre: %i.3 = phi i32 [ 0, %entry ] - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup ret i32 0 } diff --git a/test/Transforms/Inline/2003-09-22-PHINodesInExceptionDest.ll b/test/Transforms/Inline/2003-09-22-PHINodesInExceptionDest.ll index d5416a205979..2311cdab5183 100644 --- a/test/Transforms/Inline/2003-09-22-PHINodesInExceptionDest.ll +++ b/test/Transforms/Inline/2003-09-22-PHINodesInExceptionDest.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -inline -disable-output -define i32 @main() { +define i32 @main() personality i32 (...)* @__gxx_personality_v0 { entry: invoke void @__main( ) to label %Call2Invoke unwind label %LongJmpBlkPre @@ -10,7 +10,7 @@ Call2Invoke: ; preds = %entry LongJmpBlkPre: ; preds = %Call2Invoke, %entry %i.3 = phi i32 [ 0, %entry ] - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup br label %exit diff --git a/test/Transforms/Inline/2003-09-22-PHINodesInNormalInvokeDest.ll b/test/Transforms/Inline/2003-09-22-PHINodesInNormalInvokeDest.ll index 43bdd309c987..ce7d1fb3276a 100644 --- a/test/Transforms/Inline/2003-09-22-PHINodesInNormalInvokeDest.ll +++ b/test/Transforms/Inline/2003-09-22-PHINodesInNormalInvokeDest.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -inline -disable-output -define i32 @main() { +define i32 @main() personality i32 (...)* @__gxx_personality_v0 { entry: invoke void @__main( ) to label %else unwind label %RethrowExcept @@ -13,7 +13,7 @@ LJDecisionBB: ; preds = %else br label %else RethrowExcept: ; preds = %entry - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup ret i32 0 } diff --git a/test/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll b/test/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll index ee5a378b1876..b4d630d8e386 100644 --- a/test/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll +++ b/test/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll @@ -126,13 +126,13 @@ entry: unreachable } -define fastcc void @_ZSt19__throw_logic_errorPKc() { +define fastcc void @_ZSt19__throw_logic_errorPKc() personality i32 (...)* @__gxx_personality_v0 { entry: invoke fastcc void @_ZNSt11logic_errorC1ERKSs( ) to label %try_exit.0 unwind label %try_catch.0 try_catch.0: ; preds = %entry - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} catch i8* null resume { i8*, i32 } %exn @@ -157,13 +157,13 @@ entry: unreachable } -define fastcc void @_ZNSt12length_errorC1ERKSs() { +define fastcc void @_ZNSt12length_errorC1ERKSs() personality i32 (...)* @__gxx_personality_v0 { entry: invoke fastcc void @_ZNSsC1ERKSs( ) to label %_ZNSt11logic_errorC2ERKSs.exit unwind label %invoke_catch.i invoke_catch.i: ; preds = %entry - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} catch i8* null resume { i8*, i32 } %exn @@ -195,14 +195,14 @@ endif.1.i: ; preds = %then.1.i, %entry unreachable } -define fastcc void @_ZNSsC1ERKSs() { +define fastcc void @_ZNSsC1ERKSs() personality i32 (...)* @__gxx_personality_v0 { entry: call fastcc void @_ZNSs4_Rep7_M_grabERKSaIcES2_( ) invoke fastcc void @_ZNSaIcEC1ERKS_( ) to label %invoke_cont.1 unwind label %invoke_catch.1 invoke_catch.1: ; preds = %entry - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} catch i8* null call fastcc void @_ZNSaIcED1Ev( ) resume { i8*, i32 } %exn diff --git a/test/Transforms/Inline/2006-11-09-InlineCGUpdate.ll b/test/Transforms/Inline/2006-11-09-InlineCGUpdate.ll index fb5a4b512b9c..8a613e534c7c 100644 --- a/test/Transforms/Inline/2006-11-09-InlineCGUpdate.ll +++ b/test/Transforms/Inline/2006-11-09-InlineCGUpdate.ll @@ -170,14 +170,14 @@ endif.1.i: ; preds = %entry unreachable } -define fastcc void @_ZNSsC1ERKSs() { +define fastcc void @_ZNSsC1ERKSs() personality i32 (...)* @__gxx_personality_v0 { entry: call fastcc void @_ZNSs4_Rep7_M_grabERKSaIcES2_( ) invoke fastcc void @_ZNSaIcEC1ERKS_( ) to label %invoke_cont.1 unwind label %invoke_catch.1 invoke_catch.1: ; preds = %entry - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} catch i8* null call fastcc void @_ZNSaIcED1Ev( ) resume { i8*, i32 } %exn @@ -301,13 +301,13 @@ entry: unreachable } -define fastcc void @_ZNSt12length_errorC1ERKSs() { +define fastcc void @_ZNSt12length_errorC1ERKSs() personality i32 (...)* @__gxx_personality_v0 { entry: invoke fastcc void @_ZNSsC1ERKSs( ) to label %_ZNSt11logic_errorC2ERKSs.exit unwind label %invoke_catch.i invoke_catch.i: ; preds = %entry - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} catch i8* null resume { i8*, i32 } %exn diff --git a/test/Transforms/Inline/2007-04-15-InlineEH.ll b/test/Transforms/Inline/2007-04-15-InlineEH.ll index b114537490c8..d8f94c8f0054 100644 --- a/test/Transforms/Inline/2007-04-15-InlineEH.ll +++ b/test/Transforms/Inline/2007-04-15-InlineEH.ll @@ -12,7 +12,7 @@ entry: unreachable } -define fastcc void @bc__support__high_resolution_time__initialize_clock_rate() { +define fastcc void @bc__support__high_resolution_time__initialize_clock_rate() personality i32 (...)* @__gxx_personality_v0 { entry: invoke void @gnat__os_lib__getenv( %struct.gnat__strings__string_access* null ) to label %invcont unwind label %cleanup144 @@ -33,7 +33,7 @@ invcont67: ; preds = %invcont65 ret void cleanup144: ; preds = %invcont65, %invcont64, %invcont, %entry - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup resume { i8*, i32 } %exn } diff --git a/test/Transforms/Inline/byval-tail-call.ll b/test/Transforms/Inline/byval-tail-call.ll index 1e50463ed80c..7553b76cf15f 100644 --- a/test/Transforms/Inline/byval-tail-call.ll +++ b/test/Transforms/Inline/byval-tail-call.ll @@ -33,7 +33,7 @@ define void @frob(i32* %x) { ; CHECK: %[[POS:.*]] = alloca i32 ; CHECK: %[[VAL:.*]] = load i32, i32* %x ; CHECK: store i32 %[[VAL]], i32* %[[POS]] -; CHECK: {{^ *}}call void @ext(i32* %[[POS]] +; CHECK: {{^ *}}call void @ext(i32* nonnull %[[POS]] ; CHECK: tail call void @ext(i32* null) ; CHECK: ret void tail call void @qux(i32* byval %x) diff --git a/test/Transforms/Inline/callgraph-update.ll b/test/Transforms/Inline/callgraph-update.ll index b96fbc39c2ff..1a1799e5cfb4 100644 --- a/test/Transforms/Inline/callgraph-update.ll +++ b/test/Transforms/Inline/callgraph-update.ll @@ -21,7 +21,7 @@ define internal fastcc void @parse() { ret void } -define void @main() { +define void @main() personality i32 (...)* @__gxx_personality_v0 { invoke fastcc void @parse() to label %invcont unwind label %lpad @@ -29,7 +29,7 @@ invcont: unreachable lpad: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup unreachable } diff --git a/test/Transforms/Inline/crash.ll b/test/Transforms/Inline/crash.ll index e2cd49c2516c..ec1c867bd056 100644 --- a/test/Transforms/Inline/crash.ll +++ b/test/Transforms/Inline/crash.ll @@ -59,7 +59,7 @@ declare fastcc void @list_Rplacd1284() nounwind ssp ;============================ ; PR5208 -define void @AAA() { +define void @AAA() personality i32 (...)* @__gxx_personality_v0 { entry: %A = alloca i8, i32 undef, align 1 invoke fastcc void @XXX() @@ -69,7 +69,7 @@ invcont98: unreachable lpad156: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup unreachable } @@ -78,7 +78,7 @@ declare i32 @__gxx_personality_v0(...) declare fastcc void @YYY() -define internal fastcc void @XXX() { +define internal fastcc void @XXX() personality i32 (...)* @__gxx_personality_v0 { entry: %B = alloca i8, i32 undef, align 1 invoke fastcc void @YYY() @@ -88,7 +88,7 @@ bb260: ret void lpad: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup resume { i8*, i32 } %exn } @@ -102,7 +102,7 @@ entry: ret void } -define void @f4(i32 %size) ssp { +define void @f4(i32 %size) ssp personality i32 (...)* @__gxx_personality_v0 { entry: invoke void @f1(void ()* @f3) to label %invcont3 unwind label %lpad18 @@ -111,7 +111,7 @@ invcont3: ; preds = %bb1 ret void lpad18: ; preds = %invcont3, %bb1 - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup unreachable } diff --git a/test/Transforms/Inline/debug-invoke.ll b/test/Transforms/Inline/debug-invoke.ll index bb40091014cf..ca407acdd659 100644 --- a/test/Transforms/Inline/debug-invoke.ll +++ b/test/Transforms/Inline/debug-invoke.ll @@ -17,7 +17,7 @@ define void @inl() #0 { ret void } -define void @caller() { +define void @caller() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { invoke void @inl() to label %cont unwind label %lpad, !dbg !4 @@ -25,7 +25,7 @@ cont: ret void lpad: - landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + landingpad { i8*, i32 } cleanup ret void } diff --git a/test/Transforms/Inline/inline-invoke-tail.ll b/test/Transforms/Inline/inline-invoke-tail.ll index 5fef4baee9e6..f4b80653d014 100644 --- a/test/Transforms/Inline/inline-invoke-tail.ll +++ b/test/Transforms/Inline/inline-invoke-tail.ll @@ -10,7 +10,7 @@ define internal void @foo(i32* %p, i32* %q) { declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind -define i32 @main() { +define i32 @main() personality i32 (...)* @__gxx_personality_v0 { %a = alloca i32 ; <i32*> [#uses=3] %b = alloca i32 ; <i32*> [#uses=2] store i32 1, i32* %a, align 4 @@ -23,7 +23,7 @@ invcont: ret i32 %retval lpad: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} catch i8* null unreachable } diff --git a/test/Transforms/Inline/inline-invoke-with-asm-call.ll b/test/Transforms/Inline/inline-invoke-with-asm-call.ll index 876f8d7455bf..93bb0358055e 100644 --- a/test/Transforms/Inline/inline-invoke-with-asm-call.ll +++ b/test/Transforms/Inline/inline-invoke-with-asm-call.ll @@ -8,7 +8,7 @@ target triple = "x86_64-apple-darwin" ; Make sure we are generating "call asm" instead of "invoke asm". ; CHECK: call void asm ; CHECK-LABEL: @callee_with_asm -define void @caller() { +define void @caller() personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) { br i1 undef, label %1, label %4 ; <label>:1 @@ -16,7 +16,7 @@ define void @caller() { to label %4 unwind label %2 ; <label>:2 - %3 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) + %3 = landingpad { i8*, i32 } cleanup resume { i8*, i32 } undef diff --git a/test/Transforms/Inline/inline_invoke.ll b/test/Transforms/Inline/inline_invoke.ll index c53bb5aa17be..2ef216e2d38a 100644 --- a/test/Transforms/Inline/inline_invoke.ll +++ b/test/Transforms/Inline/inline_invoke.ll @@ -28,7 +28,7 @@ declare void @__cxa_end_catch() declare void @_ZSt9terminatev() -define internal void @test0_in() alwaysinline uwtable ssp { +define internal void @test0_in() alwaysinline uwtable ssp personality i32 (...)* @__gxx_personality_v0 { entry: %a = alloca %struct.A, align 1 %b = alloca %struct.A, align 1 @@ -45,7 +45,7 @@ invoke.cont1: ret void lpad: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup invoke void @_ZN1AD1Ev(%struct.A* %a) to label %invoke.cont2 unwind label %terminate.lpad @@ -54,13 +54,13 @@ invoke.cont2: resume { i8*, i32 } %exn terminate.lpad: - %exn1 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn1 = landingpad {i8*, i32} catch i8* null call void @_ZSt9terminatev() noreturn nounwind unreachable } -define void @test0_out() uwtable ssp { +define void @test0_out() uwtable ssp personality i32 (...)* @__gxx_personality_v0 { entry: invoke void @test0_in() to label %ret unwind label %lpad @@ -69,7 +69,7 @@ ret: ret void lpad: ; preds = %entry - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} catch i8* bitcast (i8** @_ZTIi to i8*) %eh.exc = extractvalue { i8*, i32 } %exn, 0 %eh.selector = extractvalue { i8*, i32 } %exn, 1 @@ -93,7 +93,7 @@ eh.resume: ; CHECK: invoke void @_ZN1AC1Ev(%struct.A* [[B]]) ; CHECK: invoke void @_ZN1AD1Ev(%struct.A* [[B]]) ; CHECK: invoke void @_ZN1AD1Ev(%struct.A* [[A]]) -; CHECK: landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 +; CHECK: landingpad { i8*, i32 } ; CHECK-NEXT: cleanup ; CHECK-NEXT: catch i8* bitcast (i8** @_ZTIi to i8*) ; CHECK-NEXT: invoke void @_ZN1AD1Ev(%struct.A* [[A]]) @@ -101,7 +101,7 @@ eh.resume: ; CHECK: [[LBL]]: ; CHECK-NEXT: br label %[[LPAD:[^\s]+]] ; CHECK: ret void -; CHECK: landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 +; CHECK: landingpad { i8*, i32 } ; CHECK-NEXT: catch i8* bitcast (i8** @_ZTIi to i8*) ; CHECK-NEXT: br label %[[LPAD]] ; CHECK: [[LPAD]]: @@ -113,7 +113,7 @@ eh.resume: ;; Test 1 - Correctly handle phis in outer landing pads. -define void @test1_out() uwtable ssp { +define void @test1_out() uwtable ssp personality i32 (...)* @__gxx_personality_v0 { entry: invoke void @test0_in() to label %cont unwind label %lpad @@ -128,7 +128,7 @@ ret: lpad: %x = phi i32 [ 0, %entry ], [ 1, %cont ] %y = phi i32 [ 1, %entry ], [ 4, %cont ] - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} catch i8* bitcast (i8** @_ZTIi to i8*) %eh.exc = extractvalue { i8*, i32 } %exn, 0 %eh.selector = extractvalue { i8*, i32 } %exn, 1 @@ -163,7 +163,7 @@ eh.resume: ; Inner landing pad from first inlining. ; CHECK: [[LPAD1]]: -; CHECK-NEXT: [[LPADVAL1:%.*]] = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 +; CHECK-NEXT: [[LPADVAL1:%.*]] = landingpad { i8*, i32 } ; CHECK-NEXT: cleanup ; CHECK-NEXT: catch i8* bitcast (i8** @_ZTIi to i8*) ; CHECK-NEXT: invoke void @_ZN1AD1Ev(%struct.A* [[A1]]) @@ -182,7 +182,7 @@ eh.resume: ; Inner landing pad from second inlining. ; CHECK: [[LPAD2]]: -; CHECK-NEXT: [[LPADVAL2:%.*]] = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 +; CHECK-NEXT: [[LPADVAL2:%.*]] = landingpad { i8*, i32 } ; CHECK-NEXT: cleanup ; CHECK-NEXT: catch i8* bitcast (i8** @_ZTIi to i8*) ; CHECK-NEXT: invoke void @_ZN1AD1Ev(%struct.A* [[A2]]) @@ -195,7 +195,7 @@ eh.resume: ; CHECK: [[LPAD]]: ; CHECK-NEXT: [[X:%.*]] = phi i32 [ 0, %entry ], [ 0, {{%.*}} ], [ 1, %cont ], [ 1, {{%.*}} ] ; CHECK-NEXT: [[Y:%.*]] = phi i32 [ 1, %entry ], [ 1, {{%.*}} ], [ 4, %cont ], [ 4, {{%.*}} ] -; CHECK-NEXT: [[LPADVAL:%.*]] = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 +; CHECK-NEXT: [[LPADVAL:%.*]] = landingpad { i8*, i32 } ; CHECK-NEXT: catch i8* bitcast (i8** @_ZTIi to i8*) ; CHECK-NEXT: br label %[[LPAD_JOIN2]] @@ -221,7 +221,7 @@ eh.resume: ;; Test 2 - Don't make invalid IR for inlines into landing pads without eh.exception calls -define void @test2_out() uwtable ssp { +define void @test2_out() uwtable ssp personality i32 (...)* @__gxx_personality_v0 { entry: invoke void @test0_in() to label %ret unwind label %lpad @@ -230,7 +230,7 @@ ret: ret void lpad: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup call void @_ZSt9terminatev() unreachable @@ -250,7 +250,7 @@ lpad: ;; Test 3 - Deal correctly with split unwind edges. -define void @test3_out() uwtable ssp { +define void @test3_out() uwtable ssp personality i32 (...)* @__gxx_personality_v0 { entry: invoke void @test0_in() to label %ret unwind label %lpad @@ -259,7 +259,7 @@ ret: ret void lpad: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} catch i8* bitcast (i8** @_ZTIi to i8*) br label %lpad.cont @@ -269,7 +269,7 @@ lpad.cont: } ; CHECK: define void @test3_out() -; CHECK: landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 +; CHECK: landingpad { i8*, i32 } ; CHECK-NEXT: cleanup ; CHECK-NEXT: catch i8* bitcast (i8** @_ZTIi to i8*) ; CHECK-NEXT: invoke void @_ZN1AD1Ev( @@ -284,7 +284,7 @@ lpad.cont: ;; Test 4 - Split unwind edges with a dominance problem -define void @test4_out() uwtable ssp { +define void @test4_out() uwtable ssp personality i32 (...)* @__gxx_personality_v0 { entry: invoke void @test0_in() to label %cont unwind label %lpad.crit @@ -297,13 +297,13 @@ ret: ret void lpad.crit: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} catch i8* bitcast (i8** @_ZTIi to i8*) call void @opaque() nounwind br label %terminate lpad: - %exn2 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn2 = landingpad {i8*, i32} catch i8* bitcast (i8** @_ZTIi to i8*) br label %terminate @@ -315,7 +315,7 @@ terminate: } ; CHECK: define void @test4_out() -; CHECK: landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 +; CHECK: landingpad { i8*, i32 } ; CHECK-NEXT: cleanup ; CHECK-NEXT: catch i8* bitcast (i8** @_ZTIi to i8*) ; CHECK-NEXT: invoke void @_ZN1AD1Ev( @@ -325,7 +325,7 @@ terminate: ; CHECK: invoke void @opaque() ; CHECK-NEXT: unwind label %lpad ; CHECK: lpad.crit: -; CHECK-NEXT: landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 +; CHECK-NEXT: landingpad { i8*, i32 } ; CHECK-NEXT: catch i8* bitcast (i8** @_ZTIi to i8*) ; CHECK-NEXT: br label %[[JOIN]] ; CHECK: [[JOIN]]: @@ -333,7 +333,7 @@ terminate: ; CHECK-NEXT: call void @opaque() [[NUW:#[0-9]+]] ; CHECK-NEXT: br label %[[FIX:[^\s]+]] ; CHECK: lpad: -; CHECK-NEXT: landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 +; CHECK-NEXT: landingpad { i8*, i32 } ; CHECK-NEXT: catch i8* bitcast (i8** @_ZTIi to i8*) ; CHECK-NEXT: br label %[[FIX]] ; CHECK: [[FIX]]: diff --git a/test/Transforms/Inline/inline_returns_twice.ll b/test/Transforms/Inline/inline_returns_twice.ll index 36042640cc00..8a131bca749d 100644 --- a/test/Transforms/Inline/inline_returns_twice.ll +++ b/test/Transforms/Inline/inline_returns_twice.ll @@ -37,7 +37,7 @@ entry: ret i32 %add } -define i32 @inner3() { +define i32 @inner3() personality i8* null { entry: %invoke = invoke i32 @a() returns_twice to label %cont unwind label %lpad @@ -47,7 +47,7 @@ cont: ret i32 %add lpad: - %lp = landingpad i32 personality i8* null cleanup + %lp = landingpad i32 cleanup resume i32 %lp } @@ -60,7 +60,7 @@ entry: ret i32 %add } -define i32 @inner4() returns_twice { +define i32 @inner4() returns_twice personality i8* null { entry: %invoke = invoke i32 @a() returns_twice to label %cont unwind label %lpad @@ -70,7 +70,7 @@ cont: ret i32 %add lpad: - %lp = landingpad i32 personality i8* null cleanup + %lp = landingpad i32 cleanup resume i32 %lp } diff --git a/test/Transforms/Inline/invoke-cleanup.ll b/test/Transforms/Inline/invoke-cleanup.ll index 457ae2addeb3..2750b79fbe11 100644 --- a/test/Transforms/Inline/invoke-cleanup.ll +++ b/test/Transforms/Inline/invoke-cleanup.ll @@ -6,13 +6,13 @@ declare void @external_func() @exception_type2 = external global i8 -define internal void @inner() { +define internal void @inner() personality i8* null { invoke void @external_func() to label %cont unwind label %lpad cont: ret void lpad: - %lp = landingpad i32 personality i8* null + %lp = landingpad i32 catch i8* @exception_type1 resume i32 %lp } @@ -21,13 +21,13 @@ lpad: ; this call site (PR17872), otherwise C++ destructors will not be ; called when they should be. -define void @outer() { +define void @outer() personality i8* null { invoke void @inner() to label %cont unwind label %lpad cont: ret void lpad: - %lp = landingpad i32 personality i8* null + %lp = landingpad i32 cleanup catch i8* @exception_type2 resume i32 %lp diff --git a/test/Transforms/Inline/invoke-combine-clauses.ll b/test/Transforms/Inline/invoke-combine-clauses.ll index 89a4cc951c7a..e3788d6d6432 100644 --- a/test/Transforms/Inline/invoke-combine-clauses.ll +++ b/test/Transforms/Inline/invoke-combine-clauses.ll @@ -12,13 +12,13 @@ declare void @abort() ; inlined function caused "catch i8* @exception_outer" to appear ; multiple times in the resulting landingpad. -define internal void @inner_multiple_resume() { +define internal void @inner_multiple_resume() personality i8* null { invoke void @external_func() to label %cont unwind label %lpad cont: ret void lpad: - %lp = landingpad i32 personality i8* null + %lp = landingpad i32 catch i8* @exception_inner %cond = load i1, i1* @condition br i1 %cond, label %resume1, label %resume2 @@ -28,13 +28,13 @@ resume2: resume i32 2 } -define void @outer_multiple_resume() { +define void @outer_multiple_resume() personality i8* null { invoke void @inner_multiple_resume() to label %cont unwind label %lpad cont: ret void lpad: - %lp = landingpad i32 personality i8* null + %lp = landingpad i32 catch i8* @exception_outer resume i32 %lp } @@ -50,25 +50,25 @@ lpad: ; inlined function caused "catch i8* @exception_outer" to appear ; multiple times in the resulting landingpad. -define internal void @inner_resume_and_call() { +define internal void @inner_resume_and_call() personality i8* null { call void @external_func() invoke void @external_func() to label %cont unwind label %lpad cont: ret void lpad: - %lp = landingpad i32 personality i8* null + %lp = landingpad i32 catch i8* @exception_inner resume i32 %lp } -define void @outer_resume_and_call() { +define void @outer_resume_and_call() personality i8* null { invoke void @inner_resume_and_call() to label %cont unwind label %lpad cont: ret void lpad: - %lp = landingpad i32 personality i8* null + %lp = landingpad i32 catch i8* @exception_outer resume i32 %lp } @@ -86,26 +86,26 @@ lpad: ; function (since the outer function's landingpad will not be ; reachable), but it's OK to include this clause. -define internal void @inner_no_resume_or_call() { +define internal void @inner_no_resume_or_call() personality i8* null { invoke void @external_func() to label %cont unwind label %lpad cont: ret void lpad: - %lp = landingpad i32 personality i8* null + %lp = landingpad i32 catch i8* @exception_inner ; A landingpad might have no "resume" if a C++ destructor aborts. call void @abort() noreturn nounwind unreachable } -define void @outer_no_resume_or_call() { +define void @outer_no_resume_or_call() personality i8* null { invoke void @inner_no_resume_or_call() to label %cont unwind label %lpad cont: ret void lpad: - %lp = landingpad i32 personality i8* null + %lp = landingpad i32 catch i8* @exception_outer resume i32 %lp } diff --git a/test/Transforms/Inline/invoke-cost.ll b/test/Transforms/Inline/invoke-cost.ll index 84d33ad55120..24f2893e90f7 100644 --- a/test/Transforms/Inline/invoke-cost.ll +++ b/test/Transforms/Inline/invoke-cost.ll @@ -10,7 +10,7 @@ declare i8* @__cxa_begin_catch(i8*) declare void @__cxa_end_catch() declare void @_ZSt9terminatev() -define void @inner1() { +define void @inner1() personality i32 (...)* @__gxx_personality_v0 { entry: invoke void @f() to label %cont1 unwind label %terminate.lpad @@ -27,7 +27,7 @@ cont4: ret void terminate.lpad: - landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + landingpad {i8*, i32} catch i8* null call void @_ZSt9terminatev() noreturn nounwind unreachable diff --git a/test/Transforms/Inline/invoke_test-1.ll b/test/Transforms/Inline/invoke_test-1.ll index 922351fd461c..8cb6362f3499 100644 --- a/test/Transforms/Inline/invoke_test-1.ll +++ b/test/Transforms/Inline/invoke_test-1.ll @@ -12,7 +12,7 @@ define internal void @callee() { } ; caller returns true if might_throw throws an exception... -define i32 @caller() { +define i32 @caller() personality i32 (...)* @__gxx_personality_v0 { invoke void @callee( ) to label %cont unwind label %exc @@ -20,7 +20,7 @@ cont: ; preds = %0 ret i32 0 exc: ; preds = %0 - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup ret i32 1 } diff --git a/test/Transforms/Inline/invoke_test-2.ll b/test/Transforms/Inline/invoke_test-2.ll index 680a5ca2542a..b3119b99337b 100644 --- a/test/Transforms/Inline/invoke_test-2.ll +++ b/test/Transforms/Inline/invoke_test-2.ll @@ -6,7 +6,7 @@ declare void @might_throw() -define internal i32 @callee() { +define internal i32 @callee() personality i32 (...)* @__gxx_personality_v0 { invoke void @might_throw( ) to label %cont unwind label %exc @@ -14,13 +14,13 @@ cont: ; preds = %0 ret i32 0 exc: ; preds = %0 - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup ret i32 1 } ; caller returns true if might_throw throws an exception... callee cannot throw. -define i32 @caller() { +define i32 @caller() personality i32 (...)* @__gxx_personality_v0 { %X = invoke i32 @callee( ) to label %cont unwind label %UnreachableExceptionHandler ; <i32> [#uses=1] @@ -28,7 +28,7 @@ cont: ; preds = %0 ret i32 %X UnreachableExceptionHandler: ; preds = %0 - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup ret i32 -1 } diff --git a/test/Transforms/Inline/invoke_test-3.ll b/test/Transforms/Inline/invoke_test-3.ll index f5ce95aa516c..5eabfdd417d9 100644 --- a/test/Transforms/Inline/invoke_test-3.ll +++ b/test/Transforms/Inline/invoke_test-3.ll @@ -5,7 +5,7 @@ declare void @might_throw() -define internal i32 @callee() { +define internal i32 @callee() personality i32 (...)* @__gxx_personality_v0 { invoke void @might_throw( ) to label %cont unwind label %exc @@ -14,14 +14,14 @@ cont: ; preds = %0 exc: ; preds = %0a ; This just rethrows the exception! - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup resume { i8*, i32 } %exn } ; caller returns true if might_throw throws an exception... which gets ; propagated by callee. -define i32 @caller() { +define i32 @caller() personality i32 (...)* @__gxx_personality_v0 { %X = invoke i32 @callee( ) to label %cont unwind label %Handler ; <i32> [#uses=1] @@ -30,7 +30,7 @@ cont: ; preds = %0 Handler: ; preds = %0 ; This consumes an exception thrown by might_throw - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup ret i32 1 } diff --git a/test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll b/test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll index 56493e2e5e32..1fc8aa7c2784 100644 --- a/test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll +++ b/test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll @@ -2,7 +2,7 @@ declare i32* @bar() -define float* @foo() { +define float* @foo() personality i32 (...)* @__gxx_personality_v0 { %tmp.11 = invoke float* bitcast (i32* ()* @bar to float* ()*)( ) to label %invoke_cont unwind label %X ; <float*> [#uses=1] @@ -10,7 +10,7 @@ invoke_cont: ; preds = %0 ret float* %tmp.11 X: ; preds = %0 - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup ret float* null } diff --git a/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll b/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll index a086c0156504..7471d8b34620 100644 --- a/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll +++ b/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll @@ -9,7 +9,7 @@ declare i8* @test() -define i32 @foo() { +define i32 @foo() personality i32 (...)* @__gxx_personality_v0 { entry: br i1 true, label %cont, label %call @@ -23,7 +23,7 @@ cont: ; preds = %call, %entry ret i32 %V N: ; preds = %call - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup ret i32 0 } diff --git a/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll b/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll index 722f8f0fabbd..4d9c19ff583b 100644 --- a/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll +++ b/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll @@ -9,7 +9,7 @@ declare i32** @__ctype_toupper_loc() readnone declare i32** @__ctype_tolower_loc() readnone -define void @_ZNSt5ctypeIcEC2EPiPKtbm(%"struct.std::ctype<char>"* %this, i32* %unnamed_arg, i16* %__table, i8 zeroext %__del, i64 %__refs) { +define void @_ZNSt5ctypeIcEC2EPiPKtbm(%"struct.std::ctype<char>"* %this, i32* %unnamed_arg, i16* %__table, i8 zeroext %__del, i64 %__refs) personality i32 (...)* @__gxx_personality_v0 { entry: %tmp8 = invoke i32* @_ZNSt6locale5facet15_S_get_c_localeEv( ) to label %invcont unwind label %lpad ; <i32*> [#uses=0] @@ -29,7 +29,7 @@ invcont37: ; preds = %invcont31 ret void lpad: ; preds = %invcont31, %invcont, %entry - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup unreachable } diff --git a/test/Transforms/InstCombine/AddOverFlow.ll b/test/Transforms/InstCombine/AddOverFlow.ll index bebfd6293f9b..a341cb042ccf 100644 --- a/test/Transforms/InstCombine/AddOverFlow.ll +++ b/test/Transforms/InstCombine/AddOverFlow.ll @@ -39,7 +39,7 @@ declare i32 @__gxx_personality_v0(...); !0 = !{i16 0, i16 32768} ; [0, 32767] !1 = !{i16 0, i16 32769} ; [0, 32768] -define i16 @add_bounded_values(i16 %a, i16 %b) { +define i16 @add_bounded_values(i16 %a, i16 %b) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { ; CHECK-LABEL: @add_bounded_values( entry: %c = call i16 @bounded(i16 %a), !range !0 @@ -50,12 +50,12 @@ cont: ; CHECK: add nuw i16 %c, %d ret i16 %e lpad: - %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %0 = landingpad { i8*, i32 } filter [0 x i8*] zeroinitializer ret i16 42 } -define i16 @add_bounded_values_2(i16 %a, i16 %b) { +define i16 @add_bounded_values_2(i16 %a, i16 %b) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { ; CHECK-LABEL: @add_bounded_values_2( entry: %c = call i16 @bounded(i16 %a), !range !1 @@ -67,7 +67,7 @@ cont: ; CHECK: add i16 %c, %d ret i16 %e lpad: - %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %0 = landingpad { i8*, i32 } filter [0 x i8*] zeroinitializer ret i16 42 } diff --git a/test/Transforms/InstCombine/LandingPadClauses.ll b/test/Transforms/InstCombine/LandingPadClauses.ll index 0d42f7c737f3..a4d77cbe8efb 100644 --- a/test/Transforms/InstCombine/LandingPadClauses.ll +++ b/test/Transforms/InstCombine/LandingPadClauses.ll @@ -11,7 +11,7 @@ declare i32 @__C_specific_handler(...) declare void @bar() -define void @foo_generic() { +define void @foo_generic() personality i32 (i32, i64, i8*, i8*)* @generic_personality { ; CHECK-LABEL: @foo_generic( invoke void @bar() to label %cont.a unwind label %lpad.a @@ -43,7 +43,7 @@ cont.i: ret void lpad.a: - %a = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @generic_personality + %a = landingpad { i8*, i32 } catch i32* @T1 catch i32* @T2 catch i32* @T1 @@ -55,7 +55,7 @@ lpad.a: ; CHECK-NEXT: unreachable lpad.b: - %b = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @generic_personality + %b = landingpad { i8*, i32 } filter [0 x i32*] zeroinitializer catch i32* @T1 unreachable @@ -64,7 +64,7 @@ lpad.b: ; CHECK-NEXT: unreachable lpad.c: - %c = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @generic_personality + %c = landingpad { i8*, i32 } catch i32* @T1 filter [1 x i32*] [i32* @T1] catch i32* @T2 @@ -75,7 +75,7 @@ lpad.c: ; CHECK-NEXT: unreachable lpad.d: - %d = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @generic_personality + %d = landingpad { i8*, i32 } filter [3 x i32*] zeroinitializer unreachable ; CHECK: %d = landingpad @@ -83,7 +83,7 @@ lpad.d: ; CHECK-NEXT: unreachable lpad.e: - %e = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @generic_personality + %e = landingpad { i8*, i32 } catch i32* @T1 filter [3 x i32*] [i32* @T1, i32* @T2, i32* @T2] unreachable @@ -93,7 +93,7 @@ lpad.e: ; CHECK-NEXT: unreachable lpad.f: - %f = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @generic_personality + %f = landingpad { i8*, i32 } filter [2 x i32*] [i32* @T2, i32* @T1] filter [1 x i32*] [i32* @T1] unreachable @@ -102,7 +102,7 @@ lpad.f: ; CHECK-NEXT: unreachable lpad.g: - %g = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @generic_personality + %g = landingpad { i8*, i32 } filter [1 x i32*] [i32* @T1] catch i32* @T3 filter [2 x i32*] [i32* @T2, i32* @T1] @@ -113,7 +113,7 @@ lpad.g: ; CHECK-NEXT: unreachable lpad.h: - %h = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @generic_personality + %h = landingpad { i8*, i32 } filter [2 x i32*] [i32* @T1, i32* null] filter [1 x i32*] zeroinitializer unreachable @@ -122,7 +122,7 @@ lpad.h: ; CHECK-NEXT: unreachable lpad.i: - %i = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @generic_personality + %i = landingpad { i8*, i32 } cleanup filter [0 x i32*] zeroinitializer unreachable @@ -131,7 +131,7 @@ lpad.i: ; CHECK-NEXT: unreachable } -define void @foo_cxx() { +define void @foo_cxx() personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 { ; CHECK-LABEL: @foo_cxx( invoke void @bar() to label %cont.a unwind label %lpad.a @@ -148,7 +148,7 @@ cont.d: ret void lpad.a: - %a = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 + %a = landingpad { i8*, i32 } catch i32* null catch i32* @T1 unreachable @@ -157,7 +157,7 @@ lpad.a: ; CHECK-NEXT: unreachable lpad.b: - %b = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 + %b = landingpad { i8*, i32 } filter [1 x i32*] zeroinitializer unreachable ; CHECK: %b = landingpad @@ -165,7 +165,7 @@ lpad.b: ; CHECK-NEXT: unreachable lpad.c: - %c = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 + %c = landingpad { i8*, i32 } filter [2 x i32*] [i32* @T1, i32* null] unreachable ; CHECK: %c = landingpad @@ -173,7 +173,7 @@ lpad.c: ; CHECK-NEXT: unreachable lpad.d: - %d = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 + %d = landingpad { i8*, i32 } cleanup catch i32* null unreachable @@ -182,7 +182,7 @@ lpad.d: ; CHECK-NEXT: unreachable } -define void @foo_objc() { +define void @foo_objc() personality i32 (i32, i64, i8*, i8*)* @__objc_personality_v0 { ; CHECK-LABEL: @foo_objc( invoke void @bar() to label %cont.a unwind label %lpad.a @@ -199,7 +199,7 @@ cont.d: ret void lpad.a: - %a = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__objc_personality_v0 + %a = landingpad { i8*, i32 } catch i32* null catch i32* @T1 unreachable @@ -208,7 +208,7 @@ lpad.a: ; CHECK-NEXT: unreachable lpad.b: - %b = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__objc_personality_v0 + %b = landingpad { i8*, i32 } filter [1 x i32*] zeroinitializer unreachable ; CHECK: %b = landingpad @@ -216,7 +216,7 @@ lpad.b: ; CHECK-NEXT: unreachable lpad.c: - %c = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__objc_personality_v0 + %c = landingpad { i8*, i32 } filter [2 x i32*] [i32* @T1, i32* null] unreachable ; CHECK: %c = landingpad @@ -224,7 +224,7 @@ lpad.c: ; CHECK-NEXT: unreachable lpad.d: - %d = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__objc_personality_v0 + %d = landingpad { i8*, i32 } cleanup catch i32* null unreachable @@ -233,7 +233,7 @@ lpad.d: ; CHECK-NEXT: unreachable } -define void @foo_seh() { +define void @foo_seh() personality i32 (...)* @__C_specific_handler { ; CHECK-LABEL: @foo_seh( invoke void @bar() to label %cont.a unwind label %lpad.a @@ -250,7 +250,7 @@ cont.d: ret void lpad.a: - %a = landingpad { i8*, i32 } personality i32 (...)* @__C_specific_handler + %a = landingpad { i8*, i32 } catch i32* null catch i32* @T1 unreachable @@ -259,7 +259,7 @@ lpad.a: ; CHECK-NEXT: unreachable lpad.b: - %b = landingpad { i8*, i32 } personality i32 (...)* @__C_specific_handler + %b = landingpad { i8*, i32 } filter [1 x i32*] zeroinitializer unreachable ; CHECK: %b = landingpad @@ -267,7 +267,7 @@ lpad.b: ; CHECK-NEXT: unreachable lpad.c: - %c = landingpad { i8*, i32 } personality i32 (...)* @__C_specific_handler + %c = landingpad { i8*, i32 } filter [2 x i32*] [i32* @T1, i32* null] unreachable ; CHECK: %c = landingpad @@ -275,7 +275,7 @@ lpad.c: ; CHECK-NEXT: unreachable lpad.d: - %d = landingpad { i8*, i32 } personality i32 (...)* @__C_specific_handler + %d = landingpad { i8*, i32 } cleanup catch i32* null unreachable diff --git a/test/Transforms/InstCombine/call.ll b/test/Transforms/InstCombine/call.ll index 47ae71f37fb2..ea338f0bf581 100644 --- a/test/Transforms/InstCombine/call.ll +++ b/test/Transforms/InstCombine/call.ll @@ -123,7 +123,7 @@ define void @test7() { ; rdar://7590304 declare void @test8a() -define i8* @test8() { +define i8* @test8() personality i32 (...)* @__gxx_personality_v0 { ; CHECK-LABEL: @test8( ; CHECK-NEXT: invoke void @test8a() ; Don't turn this into "unreachable": the callee and caller don't agree in @@ -136,7 +136,7 @@ invoke.cont: ; preds = %entry unreachable try.handler: ; preds = %entry - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup ret i8* null } diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll index 68f86336580b..7fe54ef8469b 100644 --- a/test/Transforms/InstCombine/cast.ll +++ b/test/Transforms/InstCombine/cast.ll @@ -100,7 +100,7 @@ define void @test11(i32* %P) { } declare i32 @__gxx_personality_v0(...) -define void @test_invoke_vararg_cast(i32* %a, i32* %b) { +define void @test_invoke_vararg_cast(i32* %a, i32* %b) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: %0 = bitcast i32* %b to i8* %1 = bitcast i32* %a to i64* @@ -111,7 +111,7 @@ invoke.cont: ; preds = %entry ret void lpad: ; preds = %entry - %2 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %2 = landingpad { i8*, i32 } cleanup ret void ; CHECK-LABEL: test_invoke_vararg_cast diff --git a/test/Transforms/InstCombine/crash.ll b/test/Transforms/InstCombine/crash.ll index 2d93ecd59bf5..fbb9675c0f11 100644 --- a/test/Transforms/InstCombine/crash.ll +++ b/test/Transforms/InstCombine/crash.ll @@ -131,11 +131,11 @@ define i32 @test5a() { ret i32 0 } -define void @test5() { +define void @test5() personality i32 (...)* @__gxx_personality_v0 { store i1 true, i1* undef %r = invoke i32 @test5a() to label %exit unwind label %unwind unwind: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup br label %exit exit: @@ -159,7 +159,7 @@ entry: %class.RuleBasedBreakIterator = type { i64 ()* } %class.UStack = type { i8** } -define i32 @_ZN22RuleBasedBreakIterator15checkDictionaryEi(%class.RuleBasedBreakIterator* %this, i32 %x) align 2 { +define i32 @_ZN22RuleBasedBreakIterator15checkDictionaryEi(%class.RuleBasedBreakIterator* %this, i32 %x) align 2 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: %breaks = alloca %class.UStack, align 4 ; <%class.UStack*> [#uses=3] call void @_ZN6UStackC1Ei(%class.UStack* %breaks, i32 0) @@ -167,13 +167,13 @@ entry: br i1 %tobool, label %cond.end, label %cond.false terminate.handler: ; preds = %ehcleanup - %exc = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %exc = landingpad { i8*, i32 } cleanup call void @_ZSt9terminatev() noreturn nounwind unreachable ehcleanup: ; preds = %cond.false - %exc1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %exc1 = landingpad { i8*, i32 } catch i8* null invoke void @_ZN6UStackD1Ev(%class.UStack* %breaks) to label %cont unwind label %terminate.handler @@ -207,7 +207,7 @@ declare void @_Unwind_Resume_or_Rethrow(i8*) ; rdar://7590304 -define i8* @test10(i8* %self, i8* %tmp3) { +define i8* @test10(i8* %self, i8* %tmp3) personality i32 (...)* @__gxx_personality_v0 { entry: store i1 true, i1* undef store i1 true, i1* undef @@ -218,7 +218,7 @@ invoke.cont: ; preds = %entry unreachable try.handler: ; preds = %entry - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} catch i8* null ret i8* %self } @@ -376,7 +376,7 @@ return: ; No predecessors! declare void @test18b() noreturn declare void @test18foo(double**) declare void @test18a() noreturn -define fastcc void @test18x(i8* %t0, i1 %b) uwtable align 2 { +define fastcc void @test18x(i8* %t0, i1 %b) uwtable align 2 personality i32 (...)* @__gxx_personality_v0 { entry: br i1 %b, label %e1, label %e2 e1: @@ -389,7 +389,7 @@ e2: to label %u unwind label %lpad lpad: %t5 = phi double** [ %t2, %e1 ], [ %t4, %e2 ] - %lpad.nonloopexit262 = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 + %lpad.nonloopexit262 = landingpad { i8*, i32 } cleanup call void @test18foo(double** %t5) unreachable diff --git a/test/Transforms/InstCombine/gepphigep.ll b/test/Transforms/InstCombine/gepphigep.ll index 5ae3171b39f6..b98ea4cd1159 100644 --- a/test/Transforms/InstCombine/gepphigep.ll +++ b/test/Transforms/InstCombine/gepphigep.ll @@ -59,7 +59,7 @@ bb: ; Check that instcombine doesn't insert GEPs before landingpad. -define i32 @test3(%struct3* %dm, i1 %tmp4, i64 %tmp9, i64 %tmp19, i64 %tmp20, i64 %tmp21) { +define i32 @test3(%struct3* %dm, i1 %tmp4, i64 %tmp9, i64 %tmp19, i64 %tmp20, i64 %tmp21) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { bb: %tmp = getelementptr inbounds %struct3, %struct3* %dm, i64 0 br i1 %tmp4, label %bb1, label %bb2 @@ -84,7 +84,7 @@ bb4: ret i32 0 bb5: - %tmp27 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) catch i8* bitcast (i8** @_ZTIi to i8*) + %tmp27 = landingpad { i8*, i32 } catch i8* bitcast (i8** @_ZTIi to i8*) %tmp34 = getelementptr inbounds %struct4, %struct4* %phi, i64 %tmp21, i32 1 %tmp35 = getelementptr inbounds %struct2, %struct2* %tmp34, i64 0, i32 1 %tmp25 = load i32, i32* %tmp35, align 4 @@ -92,7 +92,7 @@ bb5: ; CHECK-LABEL: @test3( ; CHECK: bb5: -; CHECK-NEXT: {{.*}}landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) +; CHECK-NEXT: {{.*}}landingpad { i8*, i32 } } @_ZTIi = external constant i8* diff --git a/test/Transforms/InstCombine/invoke.ll b/test/Transforms/InstCombine/invoke.ll index c4b58de61946..ee08ae148875 100644 --- a/test/Transforms/InstCombine/invoke.ll +++ b/test/Transforms/InstCombine/invoke.ll @@ -8,7 +8,7 @@ declare i8* @_Znwm(i64) ; CHECK-LABEL: @f1( -define i64 @f1() nounwind uwtable ssp { +define i64 @f1() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: ; CHECK: nvoke noalias i8* undef() %call = invoke noalias i8* undef() @@ -20,7 +20,7 @@ invoke.cont: ret i64 %0 lpad: - %1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %1 = landingpad { i8*, i32 } filter [0 x i8*] zeroinitializer %2 = extractvalue { i8*, i32 } %1, 0 tail call void @__cxa_call_unexpected(i8* %2) noreturn nounwind @@ -28,7 +28,7 @@ lpad: } ; CHECK-LABEL: @f2( -define i64 @f2() nounwind uwtable ssp { +define i64 @f2() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: ; CHECK: nvoke noalias i8* null() %call = invoke noalias i8* null() @@ -40,7 +40,7 @@ invoke.cont: ret i64 %0 lpad: - %1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %1 = landingpad { i8*, i32 } filter [0 x i8*] zeroinitializer %2 = extractvalue { i8*, i32 } %1, 0 tail call void @__cxa_call_unexpected(i8* %2) noreturn nounwind @@ -48,7 +48,7 @@ lpad: } ; CHECK-LABEL: @f3( -define void @f3() nounwind uwtable ssp { +define void @f3() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { ; CHECK: invoke void @llvm.donothing() %call = invoke noalias i8* @_Znwm(i64 13) to label %invoke.cont unwind label %lpad @@ -57,7 +57,7 @@ invoke.cont: ret void lpad: - %1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %1 = landingpad { i8*, i32 } filter [0 x i8*] zeroinitializer %2 = extractvalue { i8*, i32 } %1, 0 tail call void @__cxa_call_unexpected(i8* %2) noreturn nounwind diff --git a/test/Transforms/InstCombine/malloc-free-delete.ll b/test/Transforms/InstCombine/malloc-free-delete.ll index dc04adb06966..138001ace951 100644 --- a/test/Transforms/InstCombine/malloc-free-delete.ll +++ b/test/Transforms/InstCombine/malloc-free-delete.ll @@ -127,7 +127,7 @@ declare i32 @__gxx_personality_v0(...) declare void @_ZN1AC2Ev(i8* %this) ; CHECK-LABEL: @test7( -define void @test7() { +define void @test7() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: %nt = alloca i8 ; CHECK-NOT: call {{.*}}@_ZnwmRKSt9nothrow_t( @@ -139,7 +139,7 @@ entry: unreachable lpad.i: ; preds = %entry - %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) cleanup + %0 = landingpad { i8*, i32 } cleanup ; CHECK-NOT: call {{.*}}@_ZdlPvRKSt9nothrow_t( call void @_ZdlPvRKSt9nothrow_t(i8* %call.i, i8* %nt) builtin nounwind resume { i8*, i32 } %0 diff --git a/test/Transforms/InstCombine/objsize-64.ll b/test/Transforms/InstCombine/objsize-64.ll index 5046724038a3..866bc4f937b3 100644 --- a/test/Transforms/InstCombine/objsize-64.ll +++ b/test/Transforms/InstCombine/objsize-64.ll @@ -18,7 +18,7 @@ define i64 @f1(i8 **%esc) { ; CHECK-LABEL: @f2( -define i64 @f2(i8** %esc) nounwind uwtable ssp { +define i64 @f2(i8** %esc) nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: ; CHECK: invoke noalias i8* @_Znwm(i64 13) %call = invoke noalias i8* @_Znwm(i64 13) @@ -31,7 +31,7 @@ invoke.cont: ret i64 %0 lpad: - %1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %1 = landingpad { i8*, i32 } filter [0 x i8*] zeroinitializer %2 = extractvalue { i8*, i32 } %1, 0 tail call void @__cxa_call_unexpected(i8* %2) noreturn nounwind diff --git a/test/Transforms/InstCombine/select.ll b/test/Transforms/InstCombine/select.ll index 27e487b4815e..8be247228b8e 100644 --- a/test/Transforms/InstCombine/select.ll +++ b/test/Transforms/InstCombine/select.ll @@ -1265,7 +1265,7 @@ define i32 @test77(i1 %flag, i32* %x) { ; load does. ; CHECK-LABEL: @test77( ; CHECK: %[[A:.*]] = alloca i32, align 1 -; CHECK: call void @scribble_on_i32(i32* %[[A]]) +; CHECK: call void @scribble_on_i32(i32* nonnull %[[A]]) ; CHECK: store i32 0, i32* %x ; CHECK: %[[P:.*]] = select i1 %flag, i32* %[[A]], i32* %x ; CHECK: load i32, i32* %[[P]] diff --git a/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll b/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll index 3514b3479374..885cb70007e6 100644 --- a/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll +++ b/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll @@ -2,13 +2,13 @@ declare void @bar() -define void @test1() { +define void @test1() personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 { entry: invoke void @bar() to label %cont unwind label %lpad cont: ret void lpad: - %ex = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 cleanup + %ex = landingpad { i8*, i32 } cleanup %exc_ptr = extractvalue { i8*, i32 } %ex, 0 %filter = extractvalue { i8*, i32 } %ex, 1 %exc_ptr2 = insertvalue { i8*, i32 } undef, i8* %exc_ptr, 0 diff --git a/test/Transforms/InstSimplify/fast-math.ll b/test/Transforms/InstSimplify/fast-math.ll index e7fb14d7e786..90532fa5db84 100644 --- a/test/Transforms/InstSimplify/fast-math.ll +++ b/test/Transforms/InstSimplify/fast-math.ll @@ -70,17 +70,17 @@ define float @fadd_fsub_0(float %a) { ret float %ret } -; fsub nnan ninf x, x ==> 0.0 +; fsub nnan x, x ==> 0.0 ; CHECK-LABEL: @fsub_x_x( define float @fsub_x_x(float %a) { ; X - X ==> 0 - %zero1 = fsub nnan ninf float %a, %a + %zero1 = fsub nnan float %a, %a ; Dont fold ; CHECK: %no_zero1 = fsub %no_zero1 = fsub ninf float %a, %a ; CHECK: %no_zero2 = fsub - %no_zero2 = fsub nnan float %a, %a + %no_zero2 = fsub float %a, %a ; CHECK: %no_zero = fadd %no_zero = fadd float %no_zero1, %no_zero2 @@ -114,3 +114,60 @@ define double @fdiv_zero_by_x(double %X) { ret double %r ; CHECK: ret double 0 } + +define float @fdiv_self(float %f) { + %div = fdiv nnan float %f, %f + ret float %div +; CHECK-LABEL: fdiv_self +; CHECK: ret float 1.000000e+00 +} + +define float @fdiv_self_invalid(float %f) { + %div = fdiv float %f, %f + ret float %div +; CHECK-LABEL: fdiv_self_invalid +; CHECK: %div = fdiv float %f, %f +; CHECK-NEXT: ret float %div +} + +define float @fdiv_neg1(float %f) { + %neg = fsub fast float -0.000000e+00, %f + %div = fdiv nnan float %neg, %f + ret float %div +; CHECK-LABEL: fdiv_neg1 +; CHECK: ret float -1.000000e+00 +} + +define float @fdiv_neg2(float %f) { + %neg = fsub fast float 0.000000e+00, %f + %div = fdiv nnan float %neg, %f + ret float %div +; CHECK-LABEL: fdiv_neg2 +; CHECK: ret float -1.000000e+00 +} + +define float @fdiv_neg_invalid(float %f) { + %neg = fsub fast float -0.000000e+00, %f + %div = fdiv float %neg, %f + ret float %div +; CHECK-LABEL: fdiv_neg_invalid +; CHECK: %neg = fsub fast float -0.000000e+00, %f +; CHECK-NEXT: %div = fdiv float %neg, %f +; CHECK-NEXT: ret float %div +} + +define float @fdiv_neg_swapped1(float %f) { + %neg = fsub float -0.000000e+00, %f + %div = fdiv nnan float %f, %neg + ret float %div +; CHECK-LABEL: fdiv_neg_swapped1 +; CHECK: ret float -1.000000e+00 +} + +define float @fdiv_neg_swapped2(float %f) { + %neg = fsub float 0.000000e+00, %f + %div = fdiv nnan float %f, %neg + ret float %div +; CHECK-LABEL: fdiv_neg_swapped2 +; CHECK: ret float -1.000000e+00 +} diff --git a/test/Transforms/JumpThreading/landing-pad.ll b/test/Transforms/JumpThreading/landing-pad.ll index 4d49db04f6ab..5dcc5aa17e60 100644 --- a/test/Transforms/JumpThreading/landing-pad.ll +++ b/test/Transforms/JumpThreading/landing-pad.ll @@ -42,7 +42,7 @@ entry: ret void } -define void @_Z3fn1v() uwtable { +define void @_Z3fn1v() uwtable personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: %call = call noalias i8* @_Znwm() #8 invoke void @_ZN24CompositeEditCommandImplC2Ev() @@ -68,13 +68,13 @@ invoke.cont7: ; preds = %_ZN15EditCommandImp ret void lpad: ; preds = %entry - %4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %4 = landingpad { i8*, i32 } cleanup call void @_ZdlPv() #9 unreachable lpad1: ; preds = %_ZN1DC1Ev.exit, %_ZN15EditCommandImpl5applyEv.exit - %5 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %5 = landingpad { i8*, i32 } cleanup %6 = load i32, i32* %1, align 4 %tobool.i.i.i = icmp eq i32 %6, 0 @@ -91,7 +91,7 @@ _ZN1BI1DED1Ev.exit: ; preds = %lpad1, %if.then.i.i resume { i8*, i32 } undef terminate.lpad: ; No predecessors! - %7 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %7 = landingpad { i8*, i32 } catch i8* null unreachable } diff --git a/test/Transforms/LCSSA/invoke-dest.ll b/test/Transforms/LCSSA/invoke-dest.ll index 1e3f178c7e6c..1523d4ff1f64 100644 --- a/test/Transforms/LCSSA/invoke-dest.ll +++ b/test/Transforms/LCSSA/invoke-dest.ll @@ -9,7 +9,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3 @.str32190 = external constant [92 x i8], align 1 ; <[92 x i8]*> [#uses=1] @.str41 = external constant [25 x i8], align 1 ; <[25 x i8]*> [#uses=1] -define void @_ZN8EtherBus10initializeEv() { +define void @_ZN8EtherBus10initializeEv() personality i32 (...)* @__gxx_personality_v0 { entry: br i1 undef, label %_ZN7cObjectnwEj.exit, label %bb.i @@ -110,17 +110,17 @@ bb106: ; preds = %invcont105, %bb61 to label %.noexc unwind label %lpad119 ; <i8*> [#uses=1] lpad: ; preds = %_ZN7cObjectnwEj.exit - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup br label %Unwind lpad119: ; preds = %bb106, %invcont104, %invcont103, %bb102, %bb49, %bb34, %bb12, %invcont10, %invcont9, %bb8 - %exn119 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn119 = landingpad {i8*, i32} cleanup unreachable lpad123: ; preds = %.noexc - %exn123 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn123 = landingpad {i8*, i32} cleanup %tmp5 = icmp eq i8* %tmp4, null ; <i1> [#uses=1] br i1 %tmp5, label %Unwind, label %bb.i2 diff --git a/test/Transforms/LoopIdiom/AMDGPU/lit.local.cfg b/test/Transforms/LoopIdiom/AMDGPU/lit.local.cfg new file mode 100644 index 000000000000..6baccf05fff0 --- /dev/null +++ b/test/Transforms/LoopIdiom/AMDGPU/lit.local.cfg @@ -0,0 +1,3 @@ +if not 'AMDGPU' in config.root.targets: + config.unsupported = True + diff --git a/test/Transforms/LoopIdiom/R600/popcnt.ll b/test/Transforms/LoopIdiom/AMDGPU/popcnt.ll index e4301bbb06d3..e4301bbb06d3 100644 --- a/test/Transforms/LoopIdiom/R600/popcnt.ll +++ b/test/Transforms/LoopIdiom/AMDGPU/popcnt.ll diff --git a/test/Transforms/LoopIdiom/R600/lit.local.cfg b/test/Transforms/LoopIdiom/R600/lit.local.cfg deleted file mode 100644 index 4086e8d681c3..000000000000 --- a/test/Transforms/LoopIdiom/R600/lit.local.cfg +++ /dev/null @@ -1,3 +0,0 @@ -if not 'R600' in config.root.targets: - config.unsupported = True - diff --git a/test/Transforms/LoopRotate/multiple-exits.ll b/test/Transforms/LoopRotate/multiple-exits.ll index f31ed7f1c5b5..f38c855b9c8c 100644 --- a/test/Transforms/LoopRotate/multiple-exits.ll +++ b/test/Transforms/LoopRotate/multiple-exits.ll @@ -87,7 +87,7 @@ declare i32 @bar(i32) @_ZTIi = external constant i8* ; Verify dominators. -define void @test3(i32 %x) { +define void @test3(i32 %x) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: %cmp2 = icmp eq i32 0, %x br i1 %cmp2, label %try.cont.loopexit, label %for.body.lr.ph @@ -106,7 +106,7 @@ for.inc: ; preds = %for.body br i1 %cmp, label %for.cond.try.cont.loopexit_crit_edge, label %for.body lpad: ; preds = %for.body - %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %0 = landingpad { i8*, i32 } catch i8* bitcast (i8** @_ZTIi to i8*) %1 = extractvalue { i8*, i32 } %0, 0 %2 = extractvalue { i8*, i32 } %0, 1 @@ -132,7 +132,7 @@ for.inc.i: ; preds = %for.body.i br i1 %cmp.i, label %for.cond.i.invoke.cont2.loopexit_crit_edge, label %for.body.i lpad.i: ; preds = %for.body.i - %5 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %5 = landingpad { i8*, i32 } catch i8* bitcast (i8** @_ZTIi to i8*) %6 = extractvalue { i8*, i32 } %5, 0 %7 = extractvalue { i8*, i32 } %5, 1 @@ -149,7 +149,7 @@ invoke.cont2.i: ; preds = %catch.i br label %invoke.cont2 lpad1.i: ; preds = %catch.i - %9 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %9 = landingpad { i8*, i32 } cleanup %10 = extractvalue { i8*, i32 } %9, 0 %11 = extractvalue { i8*, i32 } %9, 1 diff --git a/test/Transforms/LoopSimplify/2007-10-28-InvokeCrash.ll b/test/Transforms/LoopSimplify/2007-10-28-InvokeCrash.ll index 0534a0bf7d06..9f65d68202f3 100644 --- a/test/Transforms/LoopSimplify/2007-10-28-InvokeCrash.ll +++ b/test/Transforms/LoopSimplify/2007-10-28-InvokeCrash.ll @@ -3,7 +3,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-s0:0:64-f80:32:32" target triple = "i686-pc-mingw32" -define void @func() { +define void @func() personality i32 (...)* @__gxx_personality_v0 { bb_init: br label %bb_main @@ -18,7 +18,7 @@ invcont17.normaldest: ; preds = %invcont17.normaldest917, %bb_main br label %bb_main invcont17.normaldest.normaldest: ; No predecessors! - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} catch i8* null store i32 %tmp23, i32* undef br label %bb_main diff --git a/test/Transforms/LoopSimplify/2011-12-14-LandingpadHeader.ll b/test/Transforms/LoopSimplify/2011-12-14-LandingpadHeader.ll index 39471eb0d11a..cb9dd4124e2d 100644 --- a/test/Transforms/LoopSimplify/2011-12-14-LandingpadHeader.ll +++ b/test/Transforms/LoopSimplify/2011-12-14-LandingpadHeader.ll @@ -3,7 +3,7 @@ @catchtypeinfo = external unnamed_addr constant { i8*, i8*, i8* } -define void @main() uwtable ssp { +define void @main() uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: invoke void @f1() to label %try.cont19 unwind label %catch @@ -17,7 +17,7 @@ entry: ; CHECK: br label %catch catch: ; preds = %if.else, %entry - %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %0 = landingpad { i8*, i32 } catch i8* bitcast ({ i8*, i8*, i8* }* @catchtypeinfo to i8*) invoke void @f3() to label %if.else unwind label %eh.resume @@ -30,7 +30,7 @@ try.cont19: ; preds = %if.else, %entry ret void eh.resume: ; preds = %catch - %1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %1 = landingpad { i8*, i32 } cleanup catch i8* bitcast ({ i8*, i8*, i8* }* @catchtypeinfo to i8*) resume { i8*, i32 } undef diff --git a/test/Transforms/LoopSimplify/dbg-loc.ll b/test/Transforms/LoopSimplify/dbg-loc.ll new file mode 100644 index 000000000000..073319bdac3c --- /dev/null +++ b/test/Transforms/LoopSimplify/dbg-loc.ll @@ -0,0 +1,90 @@ +; Check that LoopSimplify creates debug locations in synthesized basic blocks. +; RUN: opt -loop-simplify %s -S -o - | FileCheck %s + +%union.anon = type { i32 } +%"Length" = type <{ %union.anon, i8, i8, i8, i8 }> +declare void @bar(%"Length"*) #3 +@catchtypeinfo = external unnamed_addr constant { i8*, i8*, i8* } +declare i32 @__gxx_personality_v0(...) +declare void @f1() +declare void @f2() +declare void @f3() + +; CHECK-LABEL: @foo +; CHECK: for.body.preheader: +; CHECK-NEXT: br label %for.body, !dbg [[PREHEADER_LOC:![0-9]+]] +; CHECK: for.end.loopexit: +; CHECK-NEXT: br label %for.end, !dbg [[LOOPEXIT_LOC:![0-9]+]] + +define linkonce_odr hidden void @foo(%"Length"* %begin, %"Length"* %end) nounwind ssp uwtable align 2 { +entry: + %cmp.4 = icmp eq %"Length"* %begin, %end, !dbg !7 + br i1 %cmp.4, label %for.end, label %for.body, !dbg !8 + +for.body: ; preds = %entry, %length.exit + %begin.sink5 = phi %"Length"* [ %incdec.ptr, %length.exit ], [ %begin, %entry ] + %m_type.i.i.i = getelementptr inbounds %"Length", %"Length"* %begin.sink5, i64 0, i32 2, !dbg !9 + %0 = load i8, i8* %m_type.i.i.i, align 1, !dbg !9 + %cmp.i.i = icmp eq i8 %0, 9, !dbg !7 + br i1 %cmp.i.i, label %if.then.i, label %length.exit, !dbg !8 + +if.then.i: ; preds = %for.body + tail call void @bar(%"Length"* %begin.sink5) #7, !dbg !10 + br label %length.exit, !dbg !10 + +length.exit: ; preds = %for.body, %if.then.i + %incdec.ptr = getelementptr inbounds %"Length", %"Length"* %begin.sink5, i64 1, !dbg !11 + %cmp = icmp eq %"Length"* %incdec.ptr, %end, !dbg !7 + br i1 %cmp, label %for.end, label %for.body, !dbg !8 + +for.end: ; preds = %length.exit, %entry + ret void, !dbg !12 +} + +; CHECK-LABEL: @with_landingpad +; CHECK: catch.preheader: +; CHECK: br label %catch, !dbg [[LPAD_PREHEADER_LOC:![0-9]+]] +; CHECK: catch.preheader.split-lp: +; CHECK: br label %catch, !dbg [[LPAD_PREHEADER_LOC]] + +define void @with_landingpad() uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { +entry: + invoke void @f1() to label %try.cont19 unwind label %catch, !dbg !13 + +catch: ; preds = %if.else, %entry + %0 = landingpad { i8*, i32 } + catch i8* bitcast ({ i8*, i8*, i8* }* @catchtypeinfo to i8*), !dbg !13 + invoke void @f3() to label %if.else unwind label %eh.resume, !dbg !13 + +if.else: ; preds = %catch + invoke void @f2() to label %try.cont19 unwind label %catch, !dbg !13 + +try.cont19: ; preds = %if.else, %entry + ret void, !dbg !13 + +eh.resume: ; preds = %catch + %1 = landingpad { i8*, i32 } + cleanup catch i8* bitcast ({ i8*, i8*, i8* }* @catchtypeinfo to i8*), !dbg !13 + resume { i8*, i32 } undef, !dbg !13 +} + +; CHECK-DAG: [[PREHEADER_LOC]] = !DILocation(line: 73, column: 27, scope: !{{[0-9]+}}) +; CHECK-DAG: [[LOOPEXIT_LOC]] = !DILocation(line: 75, column: 9, scope: !{{[0-9]+}}) +; CHECK-DAG: [[LPAD_PREHEADER_LOC]] = !DILocation(line: 85, column: 1, scope: !{{[0-9]+}}) + +!llvm.module.flags = !{!0, !1, !2} +!0 = !{i32 2, !"Dwarf Version", i32 4} +!1 = !{i32 2, !"Debug Info Version", i32 3} +!2 = !{i32 1, !"PIC Level", i32 2} + +!3 = !{} +!4 = !DISubroutineType(types: !3) +!5 = !DIFile(filename: "Vector.h", directory: "/tmp") +!6 = !DISubprogram(name: "destruct", scope: !5, file: !5, line: 71, type: !4, isLocal: false, isDefinition: true, scopeLine: 72, flags: DIFlagPrototyped, isOptimized: false, function: void (%"Length"*, %"Length"*)* @foo, variables: !3) +!7 = !DILocation(line: 73, column: 38, scope: !6) +!8 = !DILocation(line: 73, column: 13, scope: !6) +!9 = !DILocation(line: 73, column: 27, scope: !6) +!10 = !DILocation(line: 74, column: 17, scope: !6) +!11 = !DILocation(line: 73, column: 46, scope: !6) +!12 = !DILocation(line: 75, column: 9, scope: !6) +!13 = !DILocation(line: 85, column: 1, scope: !6) diff --git a/test/Transforms/LoopStrengthReduce/dominate-assert.ll b/test/Transforms/LoopStrengthReduce/dominate-assert.ll index bca234c6f3c4..ff26c76b3c11 100644 --- a/test/Transforms/LoopStrengthReduce/dominate-assert.ll +++ b/test/Transforms/LoopStrengthReduce/dominate-assert.ll @@ -4,7 +4,7 @@ declare i8* @_Znwm() declare i32 @__gxx_personality_v0(...) declare void @g() -define void @f() { +define void @f() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { bb0: br label %bb1 bb1: @@ -18,7 +18,7 @@ bb3: %v3 = invoke noalias i8* @_Znwm() to label %bb5 unwind label %bb4 bb4: - %v4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %v4 = landingpad { i8*, i32 } cleanup br label %bb9 bb5: @@ -32,7 +32,7 @@ bb6: bb7: unreachable bb8: - %v7 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %v7 = landingpad { i8*, i32 } cleanup br label %bb9 bb9: @@ -40,7 +40,7 @@ bb9: } -define void @h() { +define void @h() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { bb1: invoke void @g() optsize to label %bb2 unwind label %bb5 @@ -54,17 +54,17 @@ bb3: bb4: ret void bb5: - %tmp = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %tmp = landingpad { i8*, i32 } cleanup invoke void @g() optsize to label %bb4 unwind label %bb7 bb6: - %tmp1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %tmp1 = landingpad { i8*, i32 } cleanup %arraydestroy.isempty = icmp eq i8* undef, %arrayctor.cur ret void bb7: - %lpad.nonloopexit = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %lpad.nonloopexit = landingpad { i8*, i32 } catch i8* null ret void } diff --git a/test/Transforms/LoopUnroll/runtime-loop1.ll b/test/Transforms/LoopUnroll/runtime-loop1.ll index 7684e394290b..de61e847a5a7 100644 --- a/test/Transforms/LoopUnroll/runtime-loop1.ll +++ b/test/Transforms/LoopUnroll/runtime-loop1.ll @@ -2,29 +2,50 @@ ; This tests that setting the unroll count works +; CHECK: for.body.preheader: +; CHECK: br {{.*}} label %for.body.prol, label %for.body.preheader.split, !dbg [[PH_LOC:![0-9]+]] ; CHECK: for.body.prol: -; CHECK: br label %for.body.preheader.split +; CHECK: br label %for.body.preheader.split, !dbg [[BODY_LOC:![0-9]+]] +; CHECK: for.body.preheader.split: +; CHECK: br {{.*}} label %for.end.loopexit, label %for.body.preheader.split.split, !dbg [[PH_LOC]] ; CHECK: for.body: -; CHECK: br i1 %exitcond.1, label %for.end.loopexit.unr-lcssa, label %for.body +; CHECK: br i1 %exitcond.1, label %for.end.loopexit.unr-lcssa, label %for.body, !dbg [[BODY_LOC]] ; CHECK-NOT: br i1 %exitcond.4, label %for.end.loopexit{{.*}}, label %for.body +; CHECK-DAG: [[PH_LOC]] = !DILocation(line: 101, column: 1, scope: !{{.*}}) +; CHECK-DAG: [[BODY_LOC]] = !DILocation(line: 102, column: 1, scope: !{{.*}}) + define i32 @test(i32* nocapture %a, i32 %n) nounwind uwtable readonly { entry: - %cmp1 = icmp eq i32 %n, 0 - br i1 %cmp1, label %for.end, label %for.body + %cmp1 = icmp eq i32 %n, 0, !dbg !7 + br i1 %cmp1, label %for.end, label %for.body, !dbg !7 for.body: ; preds = %for.body, %entry %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ] - %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv - %0 = load i32, i32* %arrayidx, align 4 - %add = add nsw i32 %0, %sum.02 - %indvars.iv.next = add i64 %indvars.iv, 1 - %lftr.wideiv = trunc i64 %indvars.iv.next to i32 - %exitcond = icmp eq i32 %lftr.wideiv, %n - br i1 %exitcond, label %for.end, label %for.body + %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv, !dbg !8 + %0 = load i32, i32* %arrayidx, align 4, !dbg !8 + %add = add nsw i32 %0, %sum.02, !dbg !8 + %indvars.iv.next = add i64 %indvars.iv, 1, !dbg !9 + %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !9 + %exitcond = icmp eq i32 %lftr.wideiv, %n, !dbg !9 + br i1 %exitcond, label %for.end, label %for.body, !dbg !9 for.end: ; preds = %for.body, %entry %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ] - ret i32 %sum.0.lcssa + ret i32 %sum.0.lcssa, !dbg !10 } + +!llvm.module.flags = !{!0, !1, !2} +!0 = !{i32 2, !"Dwarf Version", i32 4} +!1 = !{i32 2, !"Debug Info Version", i32 3} +!2 = !{i32 1, !"PIC Level", i32 2} + +!3 = !{} +!4 = !DISubroutineType(types: !3) +!5 = !DIFile(filename: "test.cpp", directory: "/tmp") +!6 = !DISubprogram(name: "test", scope: !5, file: !5, line: 99, type: !4, isLocal: false, isDefinition: true, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, function: i32 (i32*, i32)* @test, variables: !3) +!7 = !DILocation(line: 100, column: 1, scope: !6) +!8 = !DILocation(line: 101, column: 1, scope: !6) +!9 = !DILocation(line: 102, column: 1, scope: !6) +!10 = !DILocation(line: 103, column: 1, scope: !6) diff --git a/test/Transforms/LoopUnswitch/2011-09-26-EHCrash.ll b/test/Transforms/LoopUnswitch/2011-09-26-EHCrash.ll index 0b7f91fee150..1a929d68573a 100644 --- a/test/Transforms/LoopUnswitch/2011-09-26-EHCrash.ll +++ b/test/Transforms/LoopUnswitch/2011-09-26-EHCrash.ll @@ -6,7 +6,7 @@ target triple = "x86_64-apple-macosx10.7.2" %class.MyContainer.1.3.19.29 = type { [6 x %class.MyMemVarClass.0.2.18.28*] } %class.MyMemVarClass.0.2.18.28 = type { i32 } -define void @_ZN11MyContainer1fEi(%class.MyContainer.1.3.19.29* %this, i32 %doit) uwtable ssp align 2 { +define void @_ZN11MyContainer1fEi(%class.MyContainer.1.3.19.29* %this, i32 %doit) uwtable ssp align 2 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: br label %for.cond @@ -38,7 +38,7 @@ invoke.cont: ; preds = %delete.notnull br label %for.inc lpad: ; preds = %delete.notnull - %1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %1 = landingpad { i8*, i32 } cleanup %2 = extractvalue { i8*, i32 } %1, 0 %3 = extractvalue { i8*, i32 } %1, 1 diff --git a/test/Transforms/LoopUnswitch/2012-04-30-LoopUnswitch-LPad-Crash.ll b/test/Transforms/LoopUnswitch/2012-04-30-LoopUnswitch-LPad-Crash.ll index 223fbf18bf53..2c1847a545b2 100644 --- a/test/Transforms/LoopUnswitch/2012-04-30-LoopUnswitch-LPad-Crash.ll +++ b/test/Transforms/LoopUnswitch/2012-04-30-LoopUnswitch-LPad-Crash.ll @@ -8,7 +8,7 @@ target triple = "x86_64-apple-macosx10.7.0" %class.B.21.41.65.101.137.157.177.197.237.241.245.249.261.293.301.337.345.378 = type { %class.A.20.40.64.100.136.156.176.196.236.240.244.248.260.292.300.336.344.377* } %class.A.20.40.64.100.136.156.176.196.236.240.244.248.260.292.300.336.344.377 = type { i8 } -define void @_Z23get_reconstruction_pathv() uwtable ssp { +define void @_Z23get_reconstruction_pathv() uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: %c = alloca %class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379, align 8 br label %for.cond @@ -33,7 +33,7 @@ invoke.cont6: ; preds = %invoke.cont4 br i1 undef, label %for.cond3, label %for.end lpad: ; preds = %for.end, %invoke.cont4, %for.cond3, %invoke.cont, %for.cond - %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %0 = landingpad { i8*, i32 } cleanup resume { i8*, i32 } undef diff --git a/test/Transforms/LowerBitSets/unnamed.ll b/test/Transforms/LowerBitSets/unnamed.ll new file mode 100644 index 000000000000..6f108e22d02d --- /dev/null +++ b/test/Transforms/LowerBitSets/unnamed.ll @@ -0,0 +1,20 @@ +; RUN: opt -S -lowerbitsets < %s | FileCheck %s + +target datalayout = "e-p:32:32" + +; CHECK: @{{[0-9]+}} = alias +; CHECK: @{{[0-9]+}} = alias +@0 = constant i32 1 +@1 = constant [2 x i32] [i32 2, i32 3] + +!0 = !{!"bitset1", i32* @0, i32 0} +!1 = !{!"bitset1", [2 x i32]* @1, i32 4} + +!llvm.bitsets = !{ !0, !1 } + +declare i1 @llvm.bitset.test(i8* %ptr, metadata %bitset) nounwind readnone + +define i1 @foo(i8* %p) { + %x = call i1 @llvm.bitset.test(i8* %p, metadata !"bitset1") + ret i1 %x +} diff --git a/test/Transforms/LowerInvoke/2003-12-10-Crash.ll b/test/Transforms/LowerInvoke/2003-12-10-Crash.ll index fca8e868018a..559f629ff9e0 100644 --- a/test/Transforms/LowerInvoke/2003-12-10-Crash.ll +++ b/test/Transforms/LowerInvoke/2003-12-10-Crash.ll @@ -6,7 +6,7 @@ declare void @baz() declare void @bar() -define void @foo() { +define void @foo() personality i32 (...)* @__gxx_personality_v0 { then: invoke void @baz( ) to label %invoke_cont.0 unwind label %try_catch @@ -15,7 +15,7 @@ invoke_cont.0: ; preds = %then to label %try_exit unwind label %try_catch try_catch: ; preds = %invoke_cont.0, %then %__tmp.0 = phi i32* [ null, %invoke_cont.0 ], [ null, %then ] ; <i32*> [#uses=0] - %res = landingpad { i8* } personality i32 (...)* @__gxx_personality_v0 + %res = landingpad { i8* } cleanup ret void try_exit: ; preds = %invoke_cont.0 diff --git a/test/Transforms/LowerInvoke/lowerinvoke.ll b/test/Transforms/LowerInvoke/lowerinvoke.ll index 05c19be7a9ac..ad78df3e2217 100644 --- a/test/Transforms/LowerInvoke/lowerinvoke.ll +++ b/test/Transforms/LowerInvoke/lowerinvoke.ll @@ -2,7 +2,7 @@ declare i32 @external_func(i64 %arg) -define i32 @invoke_test(i64 %arg) { +define i32 @invoke_test(i64 %arg) personality i8* null { entry: %result = invoke fastcc i32 @external_func(i64 inreg %arg) to label %cont unwind label %lpad @@ -10,7 +10,7 @@ cont: ret i32 %result lpad: %phi = phi i32 [ 99, %entry ] - %lp = landingpad { i8*, i32 } personality i8* null cleanup + %lp = landingpad { i8*, i32 } cleanup ret i32 %phi } diff --git a/test/Transforms/Mem2Reg/crash.ll b/test/Transforms/Mem2Reg/crash.ll index a4a31b112ee8..d7ed1dd13e81 100644 --- a/test/Transforms/Mem2Reg/crash.ll +++ b/test/Transforms/Mem2Reg/crash.ll @@ -3,7 +3,7 @@ declare i32 @test1f() -define i32 @test1() { +define i32 @test1() personality i32 (...)* @__gxx_personality_v0 { entry: %whichFlag = alloca i32 %A = invoke i32 @test1f() @@ -18,7 +18,7 @@ bb15: ret i32 %B lpad86: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup br label %bb15 diff --git a/test/Transforms/MergeFunc/2011-02-08-RemoveEqual.ll b/test/Transforms/MergeFunc/2011-02-08-RemoveEqual.ll index 4735ea5e61d2..97e8ed5a6eda 100644 --- a/test/Transforms/MergeFunc/2011-02-08-RemoveEqual.ll +++ b/test/Transforms/MergeFunc/2011-02-08-RemoveEqual.ll @@ -22,7 +22,7 @@ target triple = "i386-pc-linux-gnu" @.str = external constant [1 x i8], align 1 @_ZTVN2kc22impl_fileline_FileLineE = external constant [13 x i32 (...)*], align 32 -define void @_ZN2kc22impl_fileline_FileLineC2EPNS_20impl_casestring__StrEi(%"struct.kc::impl_fileline_FileLine"* %this, %"struct.kc::impl_casestring__Str"* %_file, i32 %_line) align 2 { +define void @_ZN2kc22impl_fileline_FileLineC2EPNS_20impl_casestring__StrEi(%"struct.kc::impl_fileline_FileLine"* %this, %"struct.kc::impl_casestring__Str"* %_file, i32 %_line) align 2 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: %this_addr = alloca %"struct.kc::impl_fileline_FileLine"*, align 4 %_file_addr = alloca %"struct.kc::impl_casestring__Str"*, align 4 @@ -75,7 +75,7 @@ bb2: ; preds = %bb1, %invcont ret void lpad: ; preds = %bb - %eh_ptr = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %eh_ptr = landingpad { i8*, i32 } cleanup %exn = extractvalue { i8*, i32 } %eh_ptr, 0 store i8* %exn, i8** %eh_exception @@ -148,7 +148,7 @@ return: ; preds = %bb1, %entry ret void } -define void @_ZN2kc22impl_fileline_FileLineC1EPNS_20impl_casestring__StrEi(%"struct.kc::impl_fileline_FileLine"* %this, %"struct.kc::impl_casestring__Str"* %_file, i32 %_line) align 2 { +define void @_ZN2kc22impl_fileline_FileLineC1EPNS_20impl_casestring__StrEi(%"struct.kc::impl_fileline_FileLine"* %this, %"struct.kc::impl_casestring__Str"* %_file, i32 %_line) align 2 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: %this_addr = alloca %"struct.kc::impl_fileline_FileLine"*, align 4 %_file_addr = alloca %"struct.kc::impl_casestring__Str"*, align 4 @@ -201,7 +201,7 @@ bb2: ; preds = %bb1, %invcont ret void lpad: ; preds = %bb - %eh_ptr = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %eh_ptr = landingpad { i8*, i32 } cleanup %exn = extractvalue { i8*, i32 } %eh_ptr, 0 store i8* %exn, i8** %eh_exception diff --git a/test/Transforms/MergeFunc/call-and-invoke-with-ranges.ll b/test/Transforms/MergeFunc/call-and-invoke-with-ranges.ll index 99eba5e28094..b955e3c9582e 100644 --- a/test/Transforms/MergeFunc/call-and-invoke-with-ranges.ll +++ b/test/Transforms/MergeFunc/call-and-invoke-with-ranges.ll @@ -26,18 +26,18 @@ define i8 @call_different_range() { ret i8 %out } -define i8 @invoke_with_range() { +define i8 @invoke_with_range() personality i8* undef { %out = invoke i8 @dummy() to label %next unwind label %lpad, !range !0 next: ret i8 %out lpad: - %pad = landingpad { i8*, i32 } personality i8* undef cleanup + %pad = landingpad { i8*, i32 } cleanup resume { i8*, i32 } zeroinitializer } -define i8 @invoke_no_range() { +define i8 @invoke_no_range() personality i8* undef { ; CHECK-LABEL: @invoke_no_range() ; CHECK-NEXT: invoke i8 @dummy %out = invoke i8 @dummy() to label %next unwind label %lpad @@ -46,11 +46,11 @@ next: ret i8 %out lpad: - %pad = landingpad { i8*, i32 } personality i8* undef cleanup + %pad = landingpad { i8*, i32 } cleanup resume { i8*, i32 } zeroinitializer } -define i8 @invoke_different_range() { +define i8 @invoke_different_range() personality i8* undef { ; CHECK-LABEL: @invoke_different_range() ; CHECK-NEXT: invoke i8 @dummy %out = invoke i8 @dummy() to label %next unwind label %lpad, !range !1 @@ -59,7 +59,7 @@ next: ret i8 %out lpad: - %pad = landingpad { i8*, i32 } personality i8* undef cleanup + %pad = landingpad { i8*, i32 } cleanup resume { i8*, i32 } zeroinitializer } @@ -71,7 +71,7 @@ define i8 @call_with_same_range() { ret i8 %out } -define i8 @invoke_with_same_range() { +define i8 @invoke_with_same_range() personality i8* undef { ; CHECK-LABEL: @invoke_with_same_range() ; CHECK: tail call i8 @invoke_with_range() %out = invoke i8 @dummy() to label %next unwind label %lpad, !range !0 @@ -80,7 +80,7 @@ next: ret i8 %out lpad: - %pad = landingpad { i8*, i32 } personality i8* undef cleanup + %pad = landingpad { i8*, i32 } cleanup resume { i8*, i32 } zeroinitializer } diff --git a/test/Transforms/MergeFunc/fold-weak.ll b/test/Transforms/MergeFunc/fold-weak.ll index 4df6e39c1256..f8a188878905 100644 --- a/test/Transforms/MergeFunc/fold-weak.ll +++ b/test/Transforms/MergeFunc/fold-weak.ll @@ -1,17 +1,47 @@ -; RUN: opt < %s -mergefunc -S > %t -; RUN: grep "define weak" %t | count 2 -; RUN: grep "call" %t | count 2 -; XFAIL: * - -; This test is off for a bit as we change this particular sort of folding to -; only apply on ELF systems and not Mach-O systems. +; RUN: opt -S -mergefunc < %s | FileCheck %s define weak i32 @sum(i32 %x, i32 %y) { %sum = add i32 %x, %y - ret i32 %sum + %sum2 = add i32 %sum, %y + %sum3 = add i32 %sum2, %y + ret i32 %sum3 } define weak i32 @add(i32 %x, i32 %y) { %sum = add i32 %x, %y - ret i32 %sum + %sum2 = add i32 %sum, %y + %sum3 = add i32 %sum2, %y + ret i32 %sum3 +} + +; Don't replace a weak function use by another equivalent function. We don't +; know whether the symbol that will ulitmately be linked is equivalent - we +; don't know that the weak definition is the definitive definition or whether it +; will be overriden by a stronger definition). + +; CHECK-LABEL: define private i32 @0 +; CHECK: add i32 +; CHECK: add i32 +; CHECK: add i32 +; CHECK: ret + +; CHECK-LABEL: define i32 @use_weak +; CHECK: call i32 @add +; CHECK: call i32 @sum +; CHECK: ret + +; CHECK-LABEL: define weak i32 @sum +; CHECK: tail call i32 @0 +; CHECK: ret + +; CHECK-LABEL: define weak i32 @add +; CHECK: tail call i32 @0 +; CHECK: ret + + +define i32 @use_weak(i32 %a, i32 %b) { + %res = call i32 @add(i32 %a, i32 %b) + %res2 = call i32 @sum(i32 %a, i32 %b) + %res3 = add i32 %res, %res2 + ret i32 %res3 } diff --git a/test/Transforms/ObjCARC/basic.ll b/test/Transforms/ObjCARC/basic.ll index ff6c69cd9ed0..9fc5ad1f1008 100644 --- a/test/Transforms/ObjCARC/basic.ll +++ b/test/Transforms/ObjCARC/basic.ll @@ -1289,7 +1289,7 @@ entry: ; CHECK: %tmp1 = tail call i8* @objc_retain(i8* %tmp) [[NUW]] ; CHECK-NEXT: invoke ; CHECK: } -define void @test20(double* %self) { +define void @test20(double* %self) personality i32 (...)* @__gxx_personality_v0 { if.then12: %tmp = bitcast double* %self to i8* %tmp1 = call i8* @objc_retain(i8* %tmp) nounwind @@ -1302,7 +1302,7 @@ invoke.cont23: ; preds = %if.then12 lpad20: ; preds = %invoke.cont23, %if.then12 %tmp502 = phi double* [ undef, %invoke.cont23 ], [ %self, %if.then12 ] - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup unreachable diff --git a/test/Transforms/ObjCARC/contract-testcases.ll b/test/Transforms/ObjCARC/contract-testcases.ll index 74a4a7f989cb..e6d34a9426f4 100644 --- a/test/Transforms/ObjCARC/contract-testcases.ll +++ b/test/Transforms/ObjCARC/contract-testcases.ll @@ -67,12 +67,12 @@ bb7: ; preds = %bb6, %bb6, %bb5 ; call, handle the case where it's an invoke in a different basic block. ; rdar://11714057 -; CHECK: define void @_Z6doTestP8NSString() { +; CHECK: define void @_Z6doTestP8NSString() personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) { ; CHECK: invoke.cont: ; preds = %entry ; CHECK-NEXT: call void asm sideeffect "mov\09r7, r7\09\09@ marker for objc_retainAutoreleaseReturnValue", ""() ; CHECK-NEXT: %tmp = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %call) [[NUW:#[0-9]+]] ; CHECK: } -define void @_Z6doTestP8NSString() { +define void @_Z6doTestP8NSString() personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) { entry: %call = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* ()*)() to label %invoke.cont unwind label %lpad @@ -82,7 +82,7 @@ invoke.cont: ; preds = %entry unreachable lpad: ; preds = %entry - %tmp1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1 = landingpad { i8*, i32 } cleanup resume { i8*, i32 } undef } diff --git a/test/Transforms/ObjCARC/ensure-that-exception-unwind-path-is-visited.ll b/test/Transforms/ObjCARC/ensure-that-exception-unwind-path-is-visited.ll index b875c3f039e6..db3a780f91b0 100644 --- a/test/Transforms/ObjCARC/ensure-that-exception-unwind-path-is-visited.ll +++ b/test/Transforms/ObjCARC/ensure-that-exception-unwind-path-is-visited.ll @@ -34,7 +34,7 @@ target triple = "x86_64-apple-macosx10.9.0" @"\01L_OBJC_SELECTOR_REFERENCES_5" = internal global i8* getelementptr inbounds ([14 x i8], [14 x i8]* @"\01L_OBJC_METH_VAR_NAME_4", i64 0, i64 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" @llvm.used = appending global [6 x i8*] [i8* bitcast (%struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_" to i8*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @"\01L_OBJC_METH_VAR_NAME_", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_" to i8*), i8* bitcast (%struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_1" to i8*), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @"\01L_OBJC_METH_VAR_NAME_4", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_5" to i8*)], section "llvm.metadata" -define i32 @main() uwtable ssp { +define i32 @main() uwtable ssp personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) { entry: %tmp = load %struct._class_t*, %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_", align 8, !dbg !37 %tmp1 = load i8*, i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8, !dbg !37, !invariant.load !38 @@ -54,7 +54,7 @@ eh.cont: ; preds = %entry br label %if.end, !dbg !43 lpad: ; preds = %entry - %tmp4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) + %tmp4 = landingpad { i8*, i32 } catch i8* null, !dbg !40 %tmp5 = extractvalue { i8*, i32 } %tmp4, 0, !dbg !40 %exn.adjusted = call i8* @objc_begin_catch(i8* %tmp5) nounwind, !dbg !44 diff --git a/test/Transforms/ObjCARC/invoke.ll b/test/Transforms/ObjCARC/invoke.ll index 5ef5184154b7..06105c17397f 100644 --- a/test/Transforms/ObjCARC/invoke.ll +++ b/test/Transforms/ObjCARC/invoke.ll @@ -18,7 +18,7 @@ declare i8* @returner() ; CHECK: call void @objc_release(i8* %zipFile) [[NUW]], !clang.imprecise_release !0 ; CHECK: ret void ; CHECK-NEXT: } -define void @test0(i8* %zipFile) { +define void @test0(i8* %zipFile) personality i32 (...)* @__gxx_personality_v0 { entry: call i8* @objc_retain(i8* %zipFile) nounwind call void @use_pointer(i8* %zipFile) @@ -30,7 +30,7 @@ invoke.cont: ; preds = %entry ret void lpad: ; preds = %entry - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0 ret void @@ -50,7 +50,7 @@ lpad: ; preds = %entry ; CHECK: done: ; CHECK-NEXT: ret void ; CHECK-NEXT: } -define void @test1(i8* %zipFile) { +define void @test1(i8* %zipFile) personality i32 (...)* @__gxx_personality_v0 { entry: call i8* @objc_retain(i8* %zipFile) nounwind call void @use_pointer(i8* %zipFile) @@ -62,7 +62,7 @@ invoke.cont: ; preds = %entry br label %done lpad: ; preds = %entry - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup call void @callee() br label %done @@ -75,7 +75,7 @@ done: ; The optimizer should ignore invoke unwind paths consistently. ; PR12265 -; CHECK: define void @test2() { +; CHECK: define void @test2() personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) { ; CHECK: invoke.cont: ; CHECK-NEXT: call i8* @objc_retain ; CHECK-NOT: @objc_r @@ -85,7 +85,7 @@ done: ; CHECK: finally.rethrow: ; CHECK-NOT: @objc ; CHECK: } -define void @test2() { +define void @test2() personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) { entry: %call = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* ()*)() to label %invoke.cont unwind label %finally.rethrow, !clang.arc.no_objc_arc_exceptions !0 @@ -101,7 +101,7 @@ finally.cont: ; preds = %invoke.cont ret void finally.rethrow: ; preds = %invoke.cont, %entry - %tmp2 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) + %tmp2 = landingpad { i8*, i32 } catch i8* null unreachable } @@ -113,7 +113,7 @@ finally.rethrow: ; preds = %invoke.cont, %entry ; CHECK-NEXT: call void @objc_release(i8* %p) [[NUW]] ; CHECK-NEXT: ret void ; CHECK-NEXT: } -define void @test3(i8* %p, i1 %b) { +define void @test3(i8* %p, i1 %b) personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) { entry: %0 = call i8* @objc_retain(i8* %p) call void @callee() @@ -128,7 +128,7 @@ if.else: to label %if.end unwind label %lpad, !clang.arc.no_objc_arc_exceptions !0 lpad: - %r = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) + %r = landingpad { i8*, i32 } cleanup ret void @@ -141,7 +141,7 @@ if.end: ; CHECK-LABEL: define void @test4( ; CHECK: lpad: -; CHECK-NEXT: %r = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) +; CHECK-NEXT: %r = landingpad { i8*, i32 } ; CHECK-NEXT: cleanup ; CHECK-NEXT: call void @objc_release(i8* %p) [[NUW]] ; CHECK-NEXT: ret void @@ -149,7 +149,7 @@ if.end: ; CHECK-NEXT: call void @objc_release(i8* %p) [[NUW]] ; CHECK-NEXT: ret void ; CHECK-NEXT: } -define void @test4(i8* %p, i1 %b) { +define void @test4(i8* %p, i1 %b) personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) { entry: %0 = call i8* @objc_retain(i8* %p) call void @callee() @@ -164,7 +164,7 @@ if.else: to label %if.end unwind label %lpad lpad: - %r = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) + %r = landingpad { i8*, i32 } cleanup call void @objc_release(i8* %p) ret void @@ -180,13 +180,13 @@ if.end: ; CHECK-LABEL: define void @test5( ; CHECK: call i8* @objc_retainAutoreleasedReturnValue(i8* %z) ; CHECK: } -define void @test5() { +define void @test5() personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) { entry: %z = invoke i8* @returner() to label %if.end unwind label %lpad, !clang.arc.no_objc_arc_exceptions !0 lpad: - %r13 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) + %r13 = landingpad { i8*, i32 } cleanup ret void @@ -200,13 +200,13 @@ if.end: ; CHECK-LABEL: define void @test6( ; CHECK: call i8* @objc_retain(i8* %z) ; CHECK: } -define void @test6() { +define void @test6() personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) { entry: %z = invoke i8* @returner() to label %if.end unwind label %lpad, !clang.arc.no_objc_arc_exceptions !0 lpad: - %r13 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) + %r13 = landingpad { i8*, i32 } cleanup ret void diff --git a/test/Transforms/ObjCARC/path-overflow.ll b/test/Transforms/ObjCARC/path-overflow.ll index 31f0e3b034b5..21fcc86f9463 100644 --- a/test/Transforms/ObjCARC/path-overflow.ll +++ b/test/Transforms/ObjCARC/path-overflow.ll @@ -29,7 +29,7 @@ declare i32 @__gxx_personality_sj0(...) declare i32 @__objc_personality_v0(...) -define hidden void @test1() { +define hidden void @test1() personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) { entry: br i1 undef, label %msgSend.nullinit, label %msgSend.call @@ -864,7 +864,7 @@ bb222: ; preds = %bb20, %bb19 } ; Function Attrs: ssp -define void @test3() #1 { +define void @test3() #1 personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) { entry: %call2 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*)) to label %invoke.cont unwind label %lpad @@ -891,7 +891,7 @@ if.then.i: ; preds = %invoke.cont.i br label %invoke.cont8 lpad.i: ; preds = %land.end - %tmp13 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp13 = landingpad { i8*, i32 } cleanup unreachable @@ -914,7 +914,7 @@ if.then.i1981: ; preds = %invoke.cont.i1980 br label %invoke.cont24 lpad.i1982: ; preds = %invoke.cont21 - %tmp28 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp28 = landingpad { i8*, i32 } cleanup unreachable @@ -940,7 +940,7 @@ if.then.i1987: ; preds = %invoke.cont.i1986 br label %invoke.cont44 lpad.i1988: ; preds = %land.end43 - %tmp42 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp42 = landingpad { i8*, i32 } cleanup unreachable @@ -980,7 +980,7 @@ if.then.i1999: ; preds = %invoke.cont.i1998 br label %invoke.cont91 lpad.i2000: ; preds = %invoke.cont71 - %tmp74 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp74 = landingpad { i8*, i32 } cleanup br label %ehcleanup102 @@ -1003,7 +1003,7 @@ if.then.i2005: ; preds = %invoke.cont.i2004 br label %invoke.cont100 lpad.i2006: ; preds = %invoke.cont97 - %tmp82 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp82 = landingpad { i8*, i32 } cleanup unreachable @@ -1022,7 +1022,7 @@ if.then.i2011: ; preds = %invoke.cont.i2010 br label %invoke.cont117 lpad.i2012: ; preds = %invoke.cont110 - %tmp98 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp98 = landingpad { i8*, i32 } cleanup unreachable @@ -1031,12 +1031,12 @@ invoke.cont117: ; preds = %if.then.i2011, %inv to label %invoke.cont.i2022 unwind label %lpad156.body lpad: ; preds = %entry - %tmp118 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp118 = landingpad { i8*, i32 } cleanup br label %ehcleanup lpad3: ; preds = %land.rhs, %invoke.cont - %tmp119 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp119 = landingpad { i8*, i32 } cleanup br label %ehcleanup @@ -1044,12 +1044,12 @@ ehcleanup: ; preds = %lpad3, %lpad unreachable lpad16: ; preds = %invoke.cont8 - %tmp121 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp121 = landingpad { i8*, i32 } cleanup br label %ehcleanup26 lpad20: ; preds = %invoke.cont17 - %tmp122 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp122 = landingpad { i8*, i32 } cleanup br label %ehcleanup26 @@ -1057,32 +1057,32 @@ ehcleanup26: ; preds = %lpad20, %lpad16 unreachable lpad35: ; preds = %land.rhs39, %invoke.cont24 - %tmp124 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp124 = landingpad { i8*, i32 } cleanup unreachable lpad51: ; preds = %invoke.cont44 - %tmp125 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp125 = landingpad { i8*, i32 } cleanup unreachable lpad61: ; preds = %land.rhs58 - %tmp127 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp127 = landingpad { i8*, i32 } cleanup unreachable lpad66.body.thread: ; preds = %invoke.cont62 - %tmp128 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp128 = landingpad { i8*, i32 } cleanup unreachable lpad66.body: ; preds = %land.end70 - %tmp129 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp129 = landingpad { i8*, i32 } cleanup unreachable lpad94: ; preds = %invoke.cont95, %invoke.cont91 - %tmp133 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp133 = landingpad { i8*, i32 } cleanup br label %ehcleanup102 @@ -1090,7 +1090,7 @@ ehcleanup102: ; preds = %lpad94, %lpad.i2000 unreachable lpad109: ; preds = %invoke.cont100 - %tmp134 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp134 = landingpad { i8*, i32 } cleanup unreachable @@ -1129,7 +1129,7 @@ if.then.i2035: ; preds = %invoke.cont.i2034 br label %invoke.cont190 lpad.i2036: ; preds = %invoke.cont185 - %tmp168 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp168 = landingpad { i8*, i32 } cleanup br label %lpad183.body @@ -1156,7 +1156,7 @@ if.then.i2041: ; preds = %invoke.cont.i2040 br label %invoke.cont207 lpad.i2042: ; preds = %invoke.cont204 - %tmp181 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp181 = landingpad { i8*, i32 } cleanup unreachable @@ -1193,7 +1193,7 @@ if.then.i2053: ; preds = %invoke.cont.i2052 br label %invoke.cont231 lpad.i2054: ; preds = %invoke.cont228 - %tmp198 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp198 = landingpad { i8*, i32 } cleanup unreachable @@ -1258,7 +1258,7 @@ if.then.i2065: ; preds = %invoke.cont.i2064 br label %invoke.cont281 lpad.i2066: ; preds = %invoke.cont278 - %tmp253 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp253 = landingpad { i8*, i32 } cleanup unreachable @@ -1326,7 +1326,7 @@ if.then.i2077: ; preds = %invoke.cont.i2076 br label %invoke.cont373 lpad.i2078: ; preds = %invoke.cont370 - %tmp340 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp340 = landingpad { i8*, i32 } cleanup unreachable @@ -1353,7 +1353,7 @@ if.then.i2083: ; preds = %invoke.cont.i2082 br label %invoke.cont392 lpad.i2084: ; preds = %invoke.cont383 - %tmp360 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp360 = landingpad { i8*, i32 } cleanup unreachable @@ -1384,7 +1384,7 @@ if.then.i2089: ; preds = %invoke.cont.i2088 br label %invoke.cont405 lpad.i2090: ; preds = %invoke.cont402 - %tmp370 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp370 = landingpad { i8*, i32 } cleanup unreachable @@ -1411,7 +1411,7 @@ if.then.i2095: ; preds = %invoke.cont.i2094 br label %invoke.cont418 lpad.i2096: ; preds = %invoke.cont412 - %tmp380 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp380 = landingpad { i8*, i32 } cleanup unreachable @@ -1442,7 +1442,7 @@ if.then.i2101: ; preds = %invoke.cont.i2100 br label %invoke.cont432 lpad.i2102: ; preds = %invoke.cont429 - %tmp390 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp390 = landingpad { i8*, i32 } cleanup unreachable @@ -1459,7 +1459,7 @@ invoke.cont.i2106: ; preds = %invoke.cont435 to label %invoke.cont443 unwind label %lpad381 lpad.i2108: ; preds = %invoke.cont435 - %tmp396 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp396 = landingpad { i8*, i32 } cleanup unreachable @@ -1474,7 +1474,7 @@ if.then.i2113: ; preds = %invoke.cont.i2112 br label %invoke.cont449 lpad.i2114: ; preds = %invoke.cont443 - %tmp402 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp402 = landingpad { i8*, i32 } cleanup unreachable @@ -1497,7 +1497,7 @@ if.then.i2119: ; preds = %invoke.cont.i2118 br label %invoke.cont458 lpad.i2120: ; preds = %invoke.cont455 - %tmp408 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp408 = landingpad { i8*, i32 } cleanup unreachable @@ -1516,7 +1516,7 @@ if.then.i2125: ; preds = %invoke.cont.i2124 br label %invoke.cont466 lpad.i2126: ; preds = %invoke.cont460 - %tmp414 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp414 = landingpad { i8*, i32 } cleanup br label %ehcleanup477 @@ -1535,7 +1535,7 @@ if.then.i2131: ; preds = %invoke.cont.i2130 br label %invoke.cont475 lpad.i2132: ; preds = %invoke.cont469 - %tmp420 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp420 = landingpad { i8*, i32 } cleanup br label %ehcleanup477 @@ -1584,7 +1584,7 @@ if.then.i2137: ; preds = %invoke.cont.i2136 br label %invoke.cont521 lpad.i2138: ; preds = %msgSend.cont - %tmp468 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp468 = landingpad { i8*, i32 } cleanup unreachable @@ -1611,7 +1611,7 @@ if.then.i2143: ; preds = %invoke.cont.i2142 br label %invoke.cont540 lpad.i2144: ; preds = %invoke.cont534 - %tmp486 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp486 = landingpad { i8*, i32 } cleanup unreachable @@ -1642,7 +1642,7 @@ invoke.cont.i2148: ; preds = %invoke.cont554 to label %invoke.cont566 unwind label %lpad565 lpad.i2150: ; preds = %invoke.cont554 - %tmp500 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp500 = landingpad { i8*, i32 } cleanup call void @objc_release(i8* %tmp499) #3, !clang.imprecise_release !0 unreachable @@ -1659,17 +1659,17 @@ invoke.cont581: ; preds = %invoke.cont572 unreachable lpad156.body: ; preds = %invoke.cont117 - %tmp1157 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1157 = landingpad { i8*, i32 } cleanup unreachable lpad164.body: ; preds = %invoke.cont157 - %tmp1158 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1158 = landingpad { i8*, i32 } cleanup unreachable lpad183: ; preds = %invoke.cont184, %invoke.cont165 - %tmp1159 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1159 = landingpad { i8*, i32 } cleanup br label %lpad183.body @@ -1677,37 +1677,37 @@ lpad183.body: ; preds = %lpad183, %lpad.i203 unreachable lpad196: ; preds = %invoke.cont190 - %tmp1160 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1160 = landingpad { i8*, i32 } cleanup unreachable lpad200: ; preds = %invoke.cont197 - %tmp1161 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1161 = landingpad { i8*, i32 } cleanup unreachable lpad203: ; preds = %invoke.cont207, %invoke.cont201 - %tmp1162 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1162 = landingpad { i8*, i32 } cleanup unreachable lpad212.body: ; preds = %invoke.cont208 - %tmp1163 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1163 = landingpad { i8*, i32 } cleanup unreachable lpad220: ; preds = %invoke.cont213 - %tmp1164 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1164 = landingpad { i8*, i32 } cleanup br label %eh.resume lpad227: ; preds = %invoke.cont231, %invoke.cont221 - %tmp1166 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1166 = landingpad { i8*, i32 } cleanup br label %ehcleanup239 lpad236.body: ; preds = %invoke.cont232 - %tmp1167 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1167 = landingpad { i8*, i32 } cleanup br label %ehcleanup239 @@ -1715,27 +1715,27 @@ ehcleanup239: ; preds = %lpad236.body, %lpad unreachable lpad244: ; preds = %invoke.cont245, %invoke.cont237 - %tmp1168 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1168 = landingpad { i8*, i32 } cleanup unreachable lpad249: ; preds = %invoke.cont247 - %tmp1169 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1169 = landingpad { i8*, i32 } cleanup unreachable lpad252: ; preds = %invoke.cont250 - %tmp1170 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1170 = landingpad { i8*, i32 } cleanup br label %ehcleanup263 lpad255: ; preds = %invoke.cont253 - %tmp1171 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1171 = landingpad { i8*, i32 } cleanup br label %ehcleanup263 lpad258: ; preds = %invoke.cont256 - %tmp1172 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1172 = landingpad { i8*, i32 } cleanup unreachable @@ -1743,107 +1743,107 @@ ehcleanup263: ; preds = %lpad255, %lpad252 unreachable lpad265: ; preds = %invoke.cont259 - %tmp1173 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1173 = landingpad { i8*, i32 } cleanup unreachable lpad273: ; preds = %invoke.cont266 - %tmp1175 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1175 = landingpad { i8*, i32 } cleanup unreachable lpad277: ; preds = %invoke.cont274 - %tmp1176 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1176 = landingpad { i8*, i32 } cleanup unreachable lpad289: ; preds = %invoke.cont281 - %tmp1177 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1177 = landingpad { i8*, i32 } cleanup unreachable lpad301: ; preds = %invoke.cont290 - %tmp1180 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1180 = landingpad { i8*, i32 } cleanup unreachable lpad308: ; preds = %invoke.cont302 - %tmp1182 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1182 = landingpad { i8*, i32 } cleanup unreachable lpad311: ; preds = %invoke.cont309 - %tmp1183 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1183 = landingpad { i8*, i32 } cleanup unreachable lpad314: ; preds = %invoke.cont312 - %tmp1184 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1184 = landingpad { i8*, i32 } cleanup unreachable lpad320: ; preds = %invoke.cont315 - %tmp1186 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1186 = landingpad { i8*, i32 } cleanup unreachable lpad340.body.thread: ; preds = %land.rhs335 - %tmp1188 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1188 = landingpad { i8*, i32 } cleanup unreachable lpad340.body: ; preds = %land.end344 - %tmp1189 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1189 = landingpad { i8*, i32 } cleanup unreachable lpad360: ; preds = %invoke.cont345 - %tmp1191 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1191 = landingpad { i8*, i32 } cleanup br label %eh.resume lpad363: ; preds = %invoke.cont373, %invoke.cont361 - %tmp1192 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1192 = landingpad { i8*, i32 } cleanup unreachable lpad369: ; preds = %invoke.cont364 - %tmp1194 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1194 = landingpad { i8*, i32 } cleanup unreachable lpad381: ; preds = %invoke.cont466, %invoke.cont458, %invoke.cont449, %invoke.cont.i2106, %invoke.cont432, %invoke.cont422, %invoke.cont418, %invoke.cont408, %invoke.cont405, %invoke.cont395, %invoke.cont392, %invoke.cont382, %invoke.cont376 - %tmp1196 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1196 = landingpad { i8*, i32 } cleanup br label %ehcleanup477 lpad398: ; preds = %invoke.cont396 - %tmp1199 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1199 = landingpad { i8*, i32 } cleanup unreachable lpad401: ; preds = %invoke.cont399 - %tmp1200 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1200 = landingpad { i8*, i32 } cleanup unreachable lpad411: ; preds = %invoke.cont409 - %tmp1201 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1201 = landingpad { i8*, i32 } cleanup unreachable lpad425: ; preds = %invoke.cont423 - %tmp1203 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1203 = landingpad { i8*, i32 } cleanup br label %ehcleanup477 lpad428: ; preds = %invoke.cont426 - %tmp1204 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1204 = landingpad { i8*, i32 } cleanup unreachable lpad454: ; preds = %invoke.cont452 - %tmp1207 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1207 = landingpad { i8*, i32 } cleanup unreachable @@ -1851,47 +1851,47 @@ ehcleanup477: ; preds = %lpad425, %lpad381, unreachable lpad489: ; preds = %invoke.cont546, %invoke.cont540, %invoke.cont528, %invoke.cont509, %invoke.cont499, %invoke.cont475 - %tmp1211 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1211 = landingpad { i8*, i32 } cleanup br label %ehcleanup560 lpad498: ; preds = %invoke.cont490 - %tmp1214 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1214 = landingpad { i8*, i32 } cleanup unreachable lpad505: ; preds = %invoke.cont503 - %tmp1215 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1215 = landingpad { i8*, i32 } cleanup unreachable lpad508: ; preds = %invoke.cont506 - %tmp1216 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1216 = landingpad { i8*, i32 } cleanup unreachable lpad514: ; preds = %msgSend.call - %tmp1217 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1217 = landingpad { i8*, i32 } cleanup unreachable lpad527: ; preds = %invoke.cont521 - %tmp1219 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1219 = landingpad { i8*, i32 } cleanup br label %ehcleanup560 lpad533: ; preds = %invoke.cont531 - %tmp1220 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1220 = landingpad { i8*, i32 } cleanup unreachable lpad545: ; preds = %invoke.cont543 - %tmp1222 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1222 = landingpad { i8*, i32 } cleanup unreachable lpad553: ; preds = %invoke.cont548 - %tmp1224 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1224 = landingpad { i8*, i32 } cleanup unreachable @@ -1899,17 +1899,17 @@ ehcleanup560: ; preds = %lpad527, %lpad489 br label %eh.resume lpad565: ; preds = %invoke.cont.i2148 - %tmp1225 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1225 = landingpad { i8*, i32 } cleanup unreachable lpad571: ; preds = %invoke.cont566 - %tmp1227 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1227 = landingpad { i8*, i32 } cleanup unreachable lpad580: ; preds = %invoke.cont572 - %tmp1228 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp1228 = landingpad { i8*, i32 } cleanup br label %eh.resume @@ -1919,7 +1919,7 @@ eh.resume: ; preds = %lpad580, %ehcleanup @"OBJC_EHTYPE_$_NSException" = external global i8 -define void @test4() { +define void @test4() personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) { entry: br i1 undef, label %if.end13, label %if.then10 @@ -2173,7 +2173,7 @@ if.then430: ; preds = %eh.cont br label %if.end439 lpad: ; preds = %if.end399 - %2 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) + %2 = landingpad { i8*, i32 } catch i8* @"OBJC_EHTYPE_$_NSException" unreachable diff --git a/test/Transforms/ObjCARC/retain-not-declared.ll b/test/Transforms/ObjCARC/retain-not-declared.ll index 416202222aa8..f7ac908a76e5 100644 --- a/test/Transforms/ObjCARC/retain-not-declared.ll +++ b/test/Transforms/ObjCARC/retain-not-declared.ll @@ -34,7 +34,7 @@ entry: ; CHECK: @objc_release( ; CHECK: @objc_release( ; CHECK: } -define void @test1(i8* %call88) nounwind { +define void @test1(i8* %call88) nounwind personality i32 (...)* @__gxx_personality_v0 { entry: %tmp1 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call88) nounwind %call94 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*)*)(i8* %tmp1) @@ -51,12 +51,12 @@ invoke.cont102: ; preds = %invoke.cont93 unreachable lpad91: ; preds = %entry - %exn91 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn91 = landingpad {i8*, i32} cleanup unreachable lpad100: ; preds = %invoke.cont93 - %exn100 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn100 = landingpad {i8*, i32} cleanup call void @objc_release(i8* %tmp2) nounwind, !clang.imprecise_release !0 unreachable diff --git a/test/Transforms/ObjCARC/split-backedge.ll b/test/Transforms/ObjCARC/split-backedge.ll index 2507173f4b7e..6851487ed505 100644 --- a/test/Transforms/ObjCARC/split-backedge.ll +++ b/test/Transforms/ObjCARC/split-backedge.ll @@ -10,7 +10,7 @@ ; CHECK: call void @objc_release(i8* %call) [[NUW]] ; CHECK: call void @objc_release(i8* %call) [[NUW]] ; CHECK: call void @objc_release(i8* %cond) [[NUW]] -define void @test0() { +define void @test0() personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) { entry: br label %while.body @@ -34,7 +34,7 @@ invoke.cont1: ; preds = %invoke.cont br label %while.body lpad: ; preds = %invoke.cont, %while.body - %t4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) + %t4 = landingpad { i8*, i32 } catch i8* null ret void } diff --git a/test/Transforms/PhaseOrdering/gdce.ll b/test/Transforms/PhaseOrdering/gdce.ll index 6f79eb815832..fa62f92500bd 100644 --- a/test/Transforms/PhaseOrdering/gdce.ll +++ b/test/Transforms/PhaseOrdering/gdce.ll @@ -67,7 +67,7 @@ entry: ret void } -define linkonce_odr void @_ZN4BaseD0Ev(%class.Base* %this) unnamed_addr uwtable ssp align 2 { +define linkonce_odr void @_ZN4BaseD0Ev(%class.Base* %this) unnamed_addr uwtable ssp align 2 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: %this.addr = alloca %class.Base*, align 8 %exn.slot = alloca i8* @@ -83,7 +83,7 @@ invoke.cont: ; preds = %entry ret void lpad: ; preds = %entry - %1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %1 = landingpad { i8*, i32 } cleanup %2 = extractvalue { i8*, i32 } %1, 0 store i8* %2, i8** %exn.slot diff --git a/test/Transforms/PlaceSafepoints/invokes.ll b/test/Transforms/PlaceSafepoints/invokes.ll index 913e148d9bcc..a93e4545bc97 100644 --- a/test/Transforms/PlaceSafepoints/invokes.ll +++ b/test/Transforms/PlaceSafepoints/invokes.ll @@ -3,7 +3,7 @@ declare i64 addrspace(1)* @"some_call"(i64 addrspace(1)*) declare i32 @"personality_function"() -define i64 addrspace(1)* @test_basic(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" { +define i64 addrspace(1)* @test_basic(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" personality i32 ()* @"personality_function" { ; CHECK-LABEL: entry: entry: ; CHECK: invoke @@ -24,12 +24,12 @@ normal_return: ; CHECK: ret i64 exceptional_return: - %landing_pad4 = landingpad {i8*, i32} personality i32 ()* @"personality_function" + %landing_pad4 = landingpad {i8*, i32} cleanup ret i64 addrspace(1)* %obj1 } -define i64 addrspace(1)* @test_two_invokes(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" { +define i64 addrspace(1)* @test_two_invokes(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" personality i32 ()* @"personality_function" { ; CHECK-LABEL: entry: entry: ; CHECK: invoke @@ -56,12 +56,12 @@ normal_return: ; CHECK: ret i64 exceptional_return: - %landing_pad4 = landingpad {i8*, i32} personality i32 ()* @"personality_function" + %landing_pad4 = landingpad {i8*, i32} cleanup ret i64 addrspace(1)* %obj1 } -define i64 addrspace(1)* @test_phi_node(i1 %cond, i64 addrspace(1)* %obj) gc "statepoint-example" { +define i64 addrspace(1)* @test_phi_node(i1 %cond, i64 addrspace(1)* %obj) gc "statepoint-example" personality i32 ()* @"personality_function" { ; CHECK-LABEL: @test_phi_node ; CHECK-LABEL: entry: entry: @@ -94,7 +94,7 @@ merge: ; CHECK: ret i64 addrspace(1)* exceptional_return: - %landing_pad4 = landingpad {i8*, i32} personality i32 ()* @"personality_function" + %landing_pad4 = landingpad {i8*, i32} cleanup ret i64 addrspace(1)* %obj } @@ -108,4 +108,4 @@ define void @gc.safepoint_poll() { entry: call void @do_safepoint() ret void -}
\ No newline at end of file +} diff --git a/test/Transforms/PlaceSafepoints/patchable-statepoints.ll b/test/Transforms/PlaceSafepoints/patchable-statepoints.ll index ac0aa29e5049..9387f42bf0ab 100644 --- a/test/Transforms/PlaceSafepoints/patchable-statepoints.ll +++ b/test/Transforms/PlaceSafepoints/patchable-statepoints.ll @@ -3,7 +3,7 @@ declare void @f() declare i32 @personality_function() -define void @test_id() gc "statepoint-example" { +define void @test_id() gc "statepoint-example" personality i32 ()* @personality_function { ; CHECK-LABEL: @test_id( entry: ; CHECK-LABEL: entry: @@ -14,11 +14,11 @@ normal_return: ret void exceptional_return: - %landing_pad4 = landingpad {i8*, i32} personality i32 ()* @personality_function cleanup + %landing_pad4 = landingpad {i8*, i32} cleanup ret void } -define void @test_num_patch_bytes() gc "statepoint-example" { +define void @test_num_patch_bytes() gc "statepoint-example" personality i32 ()* @personality_function { ; CHECK-LABEL: @test_num_patch_bytes( entry: ; CHECK-LABEL: entry: @@ -29,7 +29,7 @@ normal_return: ret void exceptional_return: - %landing_pad4 = landingpad {i8*, i32} personality i32 ()* @personality_function cleanup + %landing_pad4 = landingpad {i8*, i32} cleanup ret void } diff --git a/test/Transforms/PlaceSafepoints/statepoint-calling-conventions.ll b/test/Transforms/PlaceSafepoints/statepoint-calling-conventions.ll index e31c2aa5166a..6048f63c7f7b 100644 --- a/test/Transforms/PlaceSafepoints/statepoint-calling-conventions.ll +++ b/test/Transforms/PlaceSafepoints/statepoint-calling-conventions.ll @@ -3,7 +3,7 @@ ; Ensure that the gc.statepoint calls / invokes we generate carry over ; the right calling conventions. -define i64 addrspace(1)* @test_invoke_format(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" { +define i64 addrspace(1)* @test_invoke_format(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" personality i32 ()* @personality { ; CHECK-LABEL: @test_invoke_format( ; CHECK-LABEL: entry: ; CHECK: invoke coldcc i32 (i64, i32, i64 addrspace(1)* (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p1i64p1i64f(i64 2882400000, i32 0, i64 addrspace(1)* (i64 addrspace(1)*)* @callee, i32 1, i32 0, i64 addrspace(1)* %obj, i32 0, i32 0) @@ -15,7 +15,7 @@ normal_return: ret i64 addrspace(1)* %ret_val exceptional_return: - %landing_pad4 = landingpad {i8*, i32} personality i32 ()* @personality + %landing_pad4 = landingpad {i8*, i32} cleanup ret i64 addrspace(1)* %obj1 } diff --git a/test/Transforms/PlaceSafepoints/statepoint-format.ll b/test/Transforms/PlaceSafepoints/statepoint-format.ll index 328b670873eb..496091f552d1 100644 --- a/test/Transforms/PlaceSafepoints/statepoint-format.ll +++ b/test/Transforms/PlaceSafepoints/statepoint-format.ll @@ -3,7 +3,7 @@ ; Ensure that the gc.statepoint calls / invokes we generate have the ; set of arguments we expect it to have. -define i64 addrspace(1)* @test_invoke_format(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" { +define i64 addrspace(1)* @test_invoke_format(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" personality i32 ()* @personality { ; CHECK-LABEL: @test_invoke_format( ; CHECK-LABEL: entry: ; CHECK: invoke i32 (i64, i32, i64 addrspace(1)* (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p1i64p1i64f(i64 2882400000, i32 0, i64 addrspace(1)* (i64 addrspace(1)*)* @callee, i32 1, i32 0, i64 addrspace(1)* %obj, i32 0, i32 0) @@ -15,7 +15,7 @@ normal_return: ret i64 addrspace(1)* %ret_val exceptional_return: - %landing_pad4 = landingpad {i8*, i32} personality i32 ()* @personality + %landing_pad4 = landingpad {i8*, i32} cleanup ret i64 addrspace(1)* %obj1 } diff --git a/test/Transforms/PruneEH/recursivetest.ll b/test/Transforms/PruneEH/recursivetest.ll index bc002ae70d3b..0b2399a9a294 100644 --- a/test/Transforms/PruneEH/recursivetest.ll +++ b/test/Transforms/PruneEH/recursivetest.ll @@ -1,23 +1,23 @@ ; RUN: opt < %s -prune-eh -S | not grep invoke -define internal i32 @foo() { +define internal i32 @foo() personality i32 (...)* @__gxx_personality_v0 { invoke i32 @foo( ) to label %Normal unwind label %Except ; <i32>:1 [#uses=0] Normal: ; preds = %0 ret i32 12 Except: ; preds = %0 - landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 + landingpad { i8*, i32 } catch i8* null ret i32 123 } -define i32 @caller() { +define i32 @caller() personality i32 (...)* @__gxx_personality_v0 { invoke i32 @foo( ) to label %Normal unwind label %Except ; <i32>:1 [#uses=0] Normal: ; preds = %0 ret i32 0 Except: ; preds = %0 - landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 + landingpad { i8*, i32 } catch i8* null ret i32 1 } diff --git a/test/Transforms/PruneEH/seh-nounwind.ll b/test/Transforms/PruneEH/seh-nounwind.ll index 4b69ae4b28dd..043a792eb6dd 100644 --- a/test/Transforms/PruneEH/seh-nounwind.ll +++ b/test/Transforms/PruneEH/seh-nounwind.ll @@ -10,13 +10,13 @@ entry: ret i32 %div } -define i32 @main() nounwind { +define i32 @main() nounwind personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) { entry: %call = invoke i32 @div(i32 10, i32 0) to label %__try.cont unwind label %lpad lpad: - %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) + %0 = landingpad { i8*, i32 } catch i8* null br label %__try.cont diff --git a/test/Transforms/PruneEH/simpletest.ll b/test/Transforms/PruneEH/simpletest.ll index 6154a80b68a3..cbc5592cfb27 100644 --- a/test/Transforms/PruneEH/simpletest.ll +++ b/test/Transforms/PruneEH/simpletest.ll @@ -7,7 +7,7 @@ define internal void @foo() { ret void } -define i32 @caller() { +define i32 @caller() personality i32 (...)* @__gxx_personality_v0 { invoke void @foo( ) to label %Normal unwind label %Except @@ -15,7 +15,7 @@ Normal: ; preds = %0 ret i32 0 Except: ; preds = %0 - landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 + landingpad { i8*, i32 } catch i8* null ret i32 1 } diff --git a/test/Transforms/Reg2Mem/crash.ll b/test/Transforms/Reg2Mem/crash.ll index 02fed94b8527..52dfeaf02657 100644 --- a/test/Transforms/Reg2Mem/crash.ll +++ b/test/Transforms/Reg2Mem/crash.ll @@ -13,13 +13,13 @@ declare void @f4_() declare void @_Z12xxxdtsP10xxxpq() -define hidden void @_ZN12xxxyzIi9xxxwLi29ELi0EE4f3NewES0_i() ssp align 2 { +define hidden void @_ZN12xxxyzIi9xxxwLi29ELi0EE4f3NewES0_i() ssp align 2 personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) { bb: invoke void @f4_() to label %bb1 unwind label %.thread .thread: ; preds = %bb - %tmp = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp = landingpad { i8*, i32 } cleanup br label %bb13 @@ -32,13 +32,13 @@ bb1: ; preds = %bb to label %bb6 unwind label %bb2 bb2: ; preds = %.noexc - %tmp3 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp3 = landingpad { i8*, i32 } cleanup invoke void @f3() to label %.body unwind label %bb4 bb4: ; preds = %bb2 - %tmp5 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp5 = landingpad { i8*, i32 } catch i8* null unreachable @@ -54,13 +54,13 @@ bb7: ; preds = %_ZN6xxxdIN12xxxyzIi ret void bb8: ; preds = %_ZN6xxxdIN12xxxyzIi9xxxwLi29ELi0EE4fr1jS3_.exit - %tmp9 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp9 = landingpad { i8*, i32 } cleanup br label %_ZN10xxxpqdlev.exit bb10: ; preds = %bb6, %bb1 %.1 = phi i1 [ true, %bb1 ], [ false, %bb6 ] - %tmp11 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp11 = landingpad { i8*, i32 } cleanup br label %.body @@ -80,7 +80,7 @@ _ZN10xxxpqdlev.exit: ; preds = %bb13, %bb12, %bb8 resume { i8*, i32 } undef bb14: ; preds = %bb13, %.body - %tmp15 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) + %tmp15 = landingpad { i8*, i32 } catch i8* null unreachable } diff --git a/test/Transforms/RewriteStatepointsForGC/live-vector.ll b/test/Transforms/RewriteStatepointsForGC/live-vector.ll index c49e101abe14..0a4456a68353 100644 --- a/test/Transforms/RewriteStatepointsForGC/live-vector.ll +++ b/test/Transforms/RewriteStatepointsForGC/live-vector.ll @@ -55,7 +55,7 @@ entry: declare i32 @fake_personality_function() ; When a statepoint is an invoke rather than a call -define <2 x i64 addrspace(1)*> @test4(<2 x i64 addrspace(1)*>* %ptr) gc "statepoint-example" { +define <2 x i64 addrspace(1)*> @test4(<2 x i64 addrspace(1)*>* %ptr) gc "statepoint-example" personality i32 ()* @fake_personality_function { ; CHECK-LABEL: test4 ; CHECK: load ; CHECK-NEXT: extractelement @@ -86,7 +86,7 @@ normal_return: ; preds = %entry ; CHECK-NEXT: insertelement ; CHECK-NEXT: ret <2 x i64 addrspace(1)*> %14 exceptional_return: ; preds = %entry - %landing_pad4 = landingpad { i8*, i32 } personality i32 ()* @fake_personality_function + %landing_pad4 = landingpad { i8*, i32 } cleanup ret <2 x i64 addrspace(1)*> %obj } diff --git a/test/Transforms/RewriteStatepointsForGC/preprocess.ll b/test/Transforms/RewriteStatepointsForGC/preprocess.ll index 60215310af02..012fff5c9e19 100644 --- a/test/Transforms/RewriteStatepointsForGC/preprocess.ll +++ b/test/Transforms/RewriteStatepointsForGC/preprocess.ll @@ -40,7 +40,7 @@ unreached: ; Need to delete unreachable gc.statepoint invoke - tested seperately given ; a correct implementation could only remove the instructions, not the block -define void @test8() gc "statepoint-example" { +define void @test8() gc "statepoint-example" personality i32 ()* undef { ; CHECK-LABEL: test8 ; CHECK-NOT: gc.statepoint ret void @@ -53,7 +53,7 @@ normal_return: ; preds = %entry ret void exceptional_return: ; preds = %entry - %landing_pad4 = landingpad { i8*, i32 } personality i32 ()* undef + %landing_pad4 = landingpad { i8*, i32 } cleanup ret void } diff --git a/test/Transforms/RewriteStatepointsForGC/relocate_invoke_result.ll b/test/Transforms/RewriteStatepointsForGC/relocate_invoke_result.ll index 9c00b53dfbb5..1a5289b26656 100644 --- a/test/Transforms/RewriteStatepointsForGC/relocate_invoke_result.ll +++ b/test/Transforms/RewriteStatepointsForGC/relocate_invoke_result.ll @@ -10,13 +10,13 @@ declare void @gc_call() declare i32* @fake_personality_function() ; Function Attrs: nounwind -define i64* addrspace(1)* @test() gc "statepoint-example" { +define i64* addrspace(1)* @test() gc "statepoint-example" personality i32* ()* @fake_personality_function { entry: %obj = invoke i64* addrspace(1)* @non_gc_call() to label %normal_dest unwind label %unwind_dest unwind_dest: - %lpad = landingpad { i8*, i32 } personality i32* ()* @fake_personality_function + %lpad = landingpad { i8*, i32 } cleanup resume { i8*, i32 } undef diff --git a/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll b/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll index dc52bd88776b..f04e7c797cad 100644 --- a/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll +++ b/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll @@ -137,7 +137,7 @@ entry: declare i32 @fake_personality_function() -define void @"test_invoke"(i32 addrspace(1)* %base) gc "statepoint-example" { +define void @"test_invoke"(i32 addrspace(1)* %base) gc "statepoint-example" personality i32 ()* @fake_personality_function { ; CHECK-LABEL: test_invoke entry: %ptr.gep = getelementptr i32, i32 addrspace(1)* %base, i32 15 @@ -163,7 +163,7 @@ normal: exception: ; CHECK-LABEL: exception: - %landing_pad4 = landingpad { i8*, i32 } personality i32 ()* @fake_personality_function + %landing_pad4 = landingpad { i8*, i32 } cleanup ; CHECK: gc.relocate ; CHECK: bitcast diff --git a/test/Transforms/SCCP/2003-08-26-InvokeHandling.ll b/test/Transforms/SCCP/2003-08-26-InvokeHandling.ll index fb1926eca25b..eb308afc0e6d 100644 --- a/test/Transforms/SCCP/2003-08-26-InvokeHandling.ll +++ b/test/Transforms/SCCP/2003-08-26-InvokeHandling.ll @@ -3,7 +3,7 @@ declare void @foo() -define i32 @test(i1 %cond) { +define i32 @test(i1 %cond) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { Entry: br i1 %cond, label %Inv, label %Cont Inv: ; preds = %Entry @@ -12,7 +12,7 @@ Inv: ; preds = %Entry Ok: ; preds = %Inv br label %Cont LPad: - %val = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %val = landingpad { i8*, i32 } catch i8* null br label %Cont Cont: ; preds = %Ok, %Inv, %Entry diff --git a/test/Transforms/SCCP/2004-11-16-DeadInvoke.ll b/test/Transforms/SCCP/2004-11-16-DeadInvoke.ll index e7eb101c147a..47d9d835656e 100644 --- a/test/Transforms/SCCP/2004-11-16-DeadInvoke.ll +++ b/test/Transforms/SCCP/2004-11-16-DeadInvoke.ll @@ -2,13 +2,13 @@ declare i32 @foo() -define void @caller() { +define void @caller() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { br i1 true, label %T, label %F F: ; preds = %0 %X = invoke i32 @foo( ) to label %T unwind label %LP ; <i32> [#uses=0] LP: - %val = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %val = landingpad { i8*, i32 } catch i8* null br label %T T: diff --git a/test/Transforms/SCCP/2007-05-16-InvokeCrash.ll b/test/Transforms/SCCP/2007-05-16-InvokeCrash.ll index a5a42f1b4071..7d29f6cabcb3 100644 --- a/test/Transforms/SCCP/2007-05-16-InvokeCrash.ll +++ b/test/Transforms/SCCP/2007-05-16-InvokeCrash.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -sccp -disable-output ; PR1431 -define void @_ada_bench() { +define void @_ada_bench() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: br label %cond_next cond_next: ; preds = %cond_next, %entry @@ -31,7 +31,7 @@ bb149: ; preds = %bb114 bb177: ; preds = %bb149 unreachable cleanup: ; preds = %bb149, %bb114, %bb67 - %val = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %val = landingpad { i8*, i32 } cleanup resume { i8*, i32 } %val } diff --git a/test/Transforms/SCCP/2009-01-14-IPSCCP-Invoke.ll b/test/Transforms/SCCP/2009-01-14-IPSCCP-Invoke.ll index c05f897f1a37..f3e54804f306 100644 --- a/test/Transforms/SCCP/2009-01-14-IPSCCP-Invoke.ll +++ b/test/Transforms/SCCP/2009-01-14-IPSCCP-Invoke.ll @@ -2,12 +2,12 @@ ; RUN: opt < %s -ipsccp -S | grep "ret i32 undef" ; PR3325 -define i32 @main() { +define i32 @main() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { %tmp1 = invoke i32 @f() to label %UnifiedReturnBlock unwind label %lpad lpad: - %val = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %val = landingpad { i8*, i32 } cleanup unreachable diff --git a/test/Transforms/SCCP/ipsccp-basic.ll b/test/Transforms/SCCP/ipsccp-basic.ll index c74063f33009..bf37134545ed 100644 --- a/test/Transforms/SCCP/ipsccp-basic.ll +++ b/test/Transforms/SCCP/ipsccp-basic.ll @@ -82,7 +82,7 @@ define internal {i64,i64} @test4a() { ret {i64,i64} %b } -define i64 @test4b() { +define i64 @test4b() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { %a = invoke {i64,i64} @test4a() to label %A unwind label %B A: @@ -90,7 +90,7 @@ A: %c = call i64 @test4c(i64 %b) ret i64 %c B: - %val = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %val = landingpad { i8*, i32 } catch i8* null ret i64 0 } @@ -116,14 +116,14 @@ define internal {i64,i64} @test5a() { ret {i64,i64} %b } -define i64 @test5b() { +define i64 @test5b() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { %a = invoke {i64,i64} @test5a() to label %A unwind label %B A: %c = call i64 @test5c({i64,i64} %a) ret i64 %c B: - %val = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %val = landingpad { i8*, i32 } catch i8* null ret i64 0 } diff --git a/test/Transforms/SLPVectorizer/AMDGPU/lit.local.cfg b/test/Transforms/SLPVectorizer/AMDGPU/lit.local.cfg new file mode 100644 index 000000000000..6baccf05fff0 --- /dev/null +++ b/test/Transforms/SLPVectorizer/AMDGPU/lit.local.cfg @@ -0,0 +1,3 @@ +if not 'AMDGPU' in config.root.targets: + config.unsupported = True + diff --git a/test/Transforms/SLPVectorizer/R600/simplebb.ll b/test/Transforms/SLPVectorizer/AMDGPU/simplebb.ll index 9ed86f881473..9ed86f881473 100644 --- a/test/Transforms/SLPVectorizer/R600/simplebb.ll +++ b/test/Transforms/SLPVectorizer/AMDGPU/simplebb.ll diff --git a/test/Transforms/SLPVectorizer/R600/lit.local.cfg b/test/Transforms/SLPVectorizer/R600/lit.local.cfg deleted file mode 100644 index 4086e8d681c3..000000000000 --- a/test/Transforms/SLPVectorizer/R600/lit.local.cfg +++ /dev/null @@ -1,3 +0,0 @@ -if not 'R600' in config.root.targets: - config.unsupported = True - diff --git a/test/Transforms/SLPVectorizer/X86/ordering.ll b/test/Transforms/SLPVectorizer/X86/ordering.ll index 0fa72c94c272..dfe95ac824e3 100644 --- a/test/Transforms/SLPVectorizer/X86/ordering.ll +++ b/test/Transforms/SLPVectorizer/X86/ordering.ll @@ -21,7 +21,7 @@ entry: declare i8* @objc_msgSend(i8*, i8*, ...) declare i32 @personality_v0(...) -define void @invoketest() { +define void @invoketest() personality i8* bitcast (i32 (...)* @personality_v0 to i8*) { entry: br i1 undef, label %cond.true, label %cond.false @@ -67,7 +67,7 @@ if.then63: br label %if.end98 lpad: - %l = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @personality_v0 to i8*) + %l = landingpad { i8*, i32 } cleanup resume { i8*, i32 } %l diff --git a/test/Transforms/SLPVectorizer/X86/phi_landingpad.ll b/test/Transforms/SLPVectorizer/X86/phi_landingpad.ll index 6d2d5e3540c7..b47a6ce2a263 100644 --- a/test/Transforms/SLPVectorizer/X86/phi_landingpad.ll +++ b/test/Transforms/SLPVectorizer/X86/phi_landingpad.ll @@ -2,7 +2,8 @@ target datalayout = "f64:64:64-v64:64:64" -define void @test_phi_in_landingpad() { +define void @test_phi_in_landingpad() personality i8* + bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: invoke void @foo() to label %inner unwind label %lpad @@ -16,8 +17,7 @@ inner: lpad: %x1 = phi double [ undef, %entry ], [ undef, %inner ] %y1 = phi double [ undef, %entry ], [ undef, %inner ] - landingpad { i8*, i32 } personality i8* - bitcast (i32 (...)* @__gxx_personality_v0 to i8*) catch i8* null + landingpad { i8*, i32 } catch i8* null br label %done done: diff --git a/test/Transforms/SLPVectorizer/X86/tiny-tree.ll b/test/Transforms/SLPVectorizer/X86/tiny-tree.ll index 6c93222ef93a..26af8165bc37 100644 --- a/test/Transforms/SLPVectorizer/X86/tiny-tree.ll +++ b/test/Transforms/SLPVectorizer/X86/tiny-tree.ll @@ -153,3 +153,19 @@ define void @store_splat(float*, float) { store float %1, float* %6, align 4 ret void } + + +; CHECK-LABEL: store_const +; CHECK: store <4 x i32> +define void @store_const(i32* %a) { +entry: + %ptr0 = getelementptr inbounds i32, i32* %a, i64 0 + store i32 10, i32* %ptr0, align 4 + %ptr1 = getelementptr inbounds i32, i32* %a, i64 1 + store i32 30, i32* %ptr1, align 4 + %ptr2 = getelementptr inbounds i32, i32* %a, i64 2 + store i32 20, i32* %ptr2, align 4 + %ptr3 = getelementptr inbounds i32, i32* %a, i64 3 + store i32 40, i32* %ptr3, align 4 + ret void +} diff --git a/test/Transforms/SafeStack/addr-taken.ll b/test/Transforms/SafeStack/addr-taken.ll new file mode 100644 index 000000000000..0780a01fa896 --- /dev/null +++ b/test/Transforms/SafeStack/addr-taken.ll @@ -0,0 +1,22 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Address-of local taken (j = &a) +; Requires protector. + +define void @foo() nounwind uwtable safestack { +entry: + ; CHECK: __safestack_unsafe_stack_ptr + %retval = alloca i32, align 4 + %a = alloca i32, align 4 + %j = alloca i32*, align 8 + store i32 0, i32* %retval + %0 = load i32, i32* %a, align 4 + %add = add nsw i32 %0, 1 + store i32 %add, i32* %a, align 4 + store i32* %a, i32** %j, align 8 + ret void +} + diff --git a/test/Transforms/SafeStack/array-aligned.ll b/test/Transforms/SafeStack/array-aligned.ll new file mode 100644 index 000000000000..4676903ec772 --- /dev/null +++ b/test/Transforms/SafeStack/array-aligned.ll @@ -0,0 +1,39 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; array of [16 x i8] + +define void @foo(i8* %a) nounwind uwtable safestack { +entry: + ; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr + + ; CHECK: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16 + + ; CHECK: store i8* %[[USST]], i8** @__safestack_unsafe_stack_ptr + + ; CHECK: %[[AADDR:.*]] = alloca i8*, align 8 + %a.addr = alloca i8*, align 8 + + ; CHECK: %[[BUFPTR:.*]] = getelementptr i8, i8* %[[USP]], i32 -16 + ; CHECK: %[[BUFPTR2:.*]] = bitcast i8* %[[BUFPTR]] to [16 x i8]* + %buf = alloca [16 x i8], align 16 + + ; CHECK: store i8* {{.*}}, i8** %[[AADDR]], align 8 + store i8* %a, i8** %a.addr, align 8 + + ; CHECK: %[[GEP:.*]] = getelementptr inbounds [16 x i8], [16 x i8]* %[[BUFPTR2]], i32 0, i32 0 + %gep = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 + + ; CHECK: %[[A2:.*]] = load i8*, i8** %[[AADDR]], align 8 + %a2 = load i8*, i8** %a.addr, align 8 + + ; CHECK: call i8* @strcpy(i8* %[[GEP]], i8* %[[A2]]) + %call = call i8* @strcpy(i8* %gep, i8* %a2) + + ; CHECK: store i8* %[[USP]], i8** @__safestack_unsafe_stack_ptr + ret void +} + +declare i8* @strcpy(i8*, i8*) diff --git a/test/Transforms/SafeStack/array.ll b/test/Transforms/SafeStack/array.ll new file mode 100644 index 000000000000..6036bfc2c9c5 --- /dev/null +++ b/test/Transforms/SafeStack/array.ll @@ -0,0 +1,38 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +; array [4 x i8] +; Requires protector. + +define void @foo(i8* %a) nounwind uwtable safestack { +entry: + ; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr + + ; CHECK: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16 + + ; CHECK: store i8* %[[USST]], i8** @__safestack_unsafe_stack_ptr + + ; CHECK: %[[AADDR:.*]] = alloca i8*, align 8 + %a.addr = alloca i8*, align 8 + + ; CHECK: %[[BUFPTR:.*]] = getelementptr i8, i8* %[[USP]], i32 -4 + ; CHECK: %[[BUFPTR2:.*]] = bitcast i8* %[[BUFPTR]] to [4 x i8]* + %buf = alloca [4 x i8], align 1 + + ; CHECK: store i8* {{.*}}, i8** %[[AADDR]], align 8 + store i8* %a, i8** %a.addr, align 8 + + ; CHECK: %[[GEP:.*]] = getelementptr inbounds [4 x i8], [4 x i8]* %[[BUFPTR2]], i32 0, i32 0 + %gep = getelementptr inbounds [4 x i8], [4 x i8]* %buf, i32 0, i32 0 + + ; CHECK: %[[A2:.*]] = load i8*, i8** %[[AADDR]], align 8 + %a2 = load i8*, i8** %a.addr, align 8 + + ; CHECK: call i8* @strcpy(i8* %[[GEP]], i8* %[[A2]]) + %call = call i8* @strcpy(i8* %gep, i8* %a2) + + ; CHECK: store i8* %[[USP]], i8** @__safestack_unsafe_stack_ptr + ret void +} + +declare i8* @strcpy(i8*, i8*) diff --git a/test/Transforms/SafeStack/call.ll b/test/Transforms/SafeStack/call.ll new file mode 100644 index 000000000000..ac12ec02b0b1 --- /dev/null +++ b/test/Transforms/SafeStack/call.ll @@ -0,0 +1,20 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; no arrays / no nested arrays +; Requires no protector. + +; CHECK-LABEL: @foo( +define void @foo(i8* %a) nounwind uwtable safestack { +entry: + ; CHECK-NOT: __safestack_unsafe_stack_ptr + %a.addr = alloca i8*, align 8 + store i8* %a, i8** %a.addr, align 8 + %0 = load i8*, i8** %a.addr, align 8 + %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %0) + ret void +} + +declare i32 @printf(i8*, ...) diff --git a/test/Transforms/SafeStack/cast.ll b/test/Transforms/SafeStack/cast.ll new file mode 100644 index 000000000000..df6273a117c3 --- /dev/null +++ b/test/Transforms/SafeStack/cast.ll @@ -0,0 +1,17 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; PtrToInt/IntToPtr Cast +; Requires no protector. + +; CHECK-LABEL: @foo( +define void @foo() nounwind uwtable safestack { +entry: + ; CHECK-NOT: __safestack_unsafe_stack_ptr + %a = alloca i32, align 4 + %0 = ptrtoint i32* %a to i64 + %1 = inttoptr i64 %0 to i32* + ret void +} diff --git a/test/Transforms/SafeStack/constant-gep-call.ll b/test/Transforms/SafeStack/constant-gep-call.ll new file mode 100644 index 000000000000..456c1cb1596b --- /dev/null +++ b/test/Transforms/SafeStack/constant-gep-call.ll @@ -0,0 +1,26 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +%struct.nest = type { %struct.pair, %struct.pair } +%struct.pair = type { i32, i32 } + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Nested structure, no arrays, no address-of expressions. +; Verify that the resulting gep-of-gep does not incorrectly trigger +; a safe stack protector. +; safestack attribute +; Requires no protector. +; CHECK-LABEL: @foo( +define void @foo() nounwind uwtable safestack { +entry: + ; CHECK-NOT: __safestack_unsafe_stack_ptr + %c = alloca %struct.nest, align 4 + %b = getelementptr inbounds %struct.nest, %struct.nest* %c, i32 0, i32 1 + %_a = getelementptr inbounds %struct.pair, %struct.pair* %b, i32 0, i32 0 + %0 = load i32, i32* %_a, align 4 + %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32 %0) + ret void +} + +declare i32 @printf(i8*, ...) diff --git a/test/Transforms/SafeStack/constant-gep.ll b/test/Transforms/SafeStack/constant-gep.ll new file mode 100644 index 000000000000..6468a761dd57 --- /dev/null +++ b/test/Transforms/SafeStack/constant-gep.ll @@ -0,0 +1,20 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +%class.A = type { [2 x i8] } + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; [2 x i8] in a class +; safestack attribute +; Requires no protector. +; CHECK-LABEL: @foo( +define signext i8 @foo() nounwind uwtable safestack { +entry: + ; CHECK-NOT: __safestack_unsafe_stack_ptr + %a = alloca %class.A, align 1 + %array = getelementptr inbounds %class.A, %class.A* %a, i32 0, i32 0 + %arrayidx = getelementptr inbounds [2 x i8], [2 x i8]* %array, i32 0, i64 0 + %0 = load i8, i8* %arrayidx, align 1 + ret i8 %0 +} diff --git a/test/Transforms/SafeStack/constant-geps.ll b/test/Transforms/SafeStack/constant-geps.ll new file mode 100644 index 000000000000..8a6f7549bb4e --- /dev/null +++ b/test/Transforms/SafeStack/constant-geps.ll @@ -0,0 +1,28 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +%struct.deep = type { %union.anon } +%union.anon = type { %struct.anon } +%struct.anon = type { %struct.anon.0 } +%struct.anon.0 = type { %union.anon.1 } +%union.anon.1 = type { [2 x i8] } + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; [2 x i8] nested in several layers of structs and unions +; safestack attribute +; Requires no protector. +; CHECK-LABEL: @foo( +define signext i8 @foo() nounwind uwtable safestack { +entry: + ; CHECK-NOT: __safestack_unsafe_stack_ptr + %x = alloca %struct.deep, align 1 + %b = getelementptr inbounds %struct.deep, %struct.deep* %x, i32 0, i32 0 + %c = bitcast %union.anon* %b to %struct.anon* + %d = getelementptr inbounds %struct.anon, %struct.anon* %c, i32 0, i32 0 + %e = getelementptr inbounds %struct.anon.0, %struct.anon.0* %d, i32 0, i32 0 + %array = bitcast %union.anon.1* %e to [2 x i8]* + %arrayidx = getelementptr inbounds [2 x i8], [2 x i8]* %array, i32 0, i64 0 + %0 = load i8, i8* %arrayidx, align 1 + ret i8 %0 +} diff --git a/test/Transforms/SafeStack/dynamic-alloca.ll b/test/Transforms/SafeStack/dynamic-alloca.ll new file mode 100644 index 000000000000..bfec66f82a2f --- /dev/null +++ b/test/Transforms/SafeStack/dynamic-alloca.ll @@ -0,0 +1,21 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Variable sized alloca +; safestack attribute +; Requires protector. +define void @foo(i32 %n) nounwind uwtable safestack { +entry: + ; CHECK: __safestack_unsafe_stack_ptr + %n.addr = alloca i32, align 4 + %a = alloca i32*, align 8 + store i32 %n, i32* %n.addr, align 4 + %0 = load i32, i32* %n.addr, align 4 + %conv = sext i32 %0 to i64 + %1 = alloca i8, i64 %conv + %2 = bitcast i8* %1 to i32* + store i32* %2, i32** %a, align 8 + ret void +} diff --git a/test/Transforms/SafeStack/escape-addr-pointer.ll b/test/Transforms/SafeStack/escape-addr-pointer.ll new file mode 100644 index 000000000000..615d711f62c2 --- /dev/null +++ b/test/Transforms/SafeStack/escape-addr-pointer.ll @@ -0,0 +1,23 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Addr-of a pointer +; safestack attribute +; Requires protector. +define void @foo() nounwind uwtable safestack { +entry: + ; CHECK: __safestack_unsafe_stack_ptr + %a = alloca i32*, align 8 + %b = alloca i32**, align 8 + %call = call i32* @getp() + store i32* %call, i32** %a, align 8 + store i32** %a, i32*** %b, align 8 + %0 = load i32**, i32*** %b, align 8 + call void @funcall2(i32** %0) + ret void +} + +declare void @funcall2(i32**) +declare i32* @getp() diff --git a/test/Transforms/SafeStack/escape-bitcast-store.ll b/test/Transforms/SafeStack/escape-bitcast-store.ll new file mode 100644 index 000000000000..9d556a6782a1 --- /dev/null +++ b/test/Transforms/SafeStack/escape-bitcast-store.ll @@ -0,0 +1,23 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Addr-of a local cast to a ptr of a different type +; (e.g., int a; ... ; float *b = &a;) +; safestack attribute +; Requires protector. +define void @foo() nounwind uwtable safestack { +entry: + ; CHECK: __safestack_unsafe_stack_ptr + %a = alloca i32, align 4 + %b = alloca float*, align 8 + store i32 0, i32* %a, align 4 + %0 = bitcast i32* %a to float* + store float* %0, float** %b, align 8 + %1 = load float*, float** %b, align 8 + %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), float* %1) + ret void +} + +declare i32 @printf(i8*, ...) diff --git a/test/Transforms/SafeStack/escape-bitcast-store2.ll b/test/Transforms/SafeStack/escape-bitcast-store2.ll new file mode 100644 index 000000000000..5f1f873f4224 --- /dev/null +++ b/test/Transforms/SafeStack/escape-bitcast-store2.ll @@ -0,0 +1,20 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Addr-of a local cast to a ptr of a different type (optimized) +; (e.g., int a; ... ; float *b = &a;) +; safestack attribute +; Requires protector. +define void @foo() nounwind uwtable safestack { +entry: + ; CHECK: __safestack_unsafe_stack_ptr + %a = alloca i32, align 4 + store i32 0, i32* %a, align 4 + %0 = bitcast i32* %a to float* + call void @funfloat(float* %0) nounwind + ret void +} + +declare void @funfloat(float*) diff --git a/test/Transforms/SafeStack/escape-call.ll b/test/Transforms/SafeStack/escape-call.ll new file mode 100644 index 000000000000..ce09780d2eaf --- /dev/null +++ b/test/Transforms/SafeStack/escape-call.ll @@ -0,0 +1,16 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Passing addr-of to function call +; Requires protector. +define void @foo() nounwind uwtable safestack { +entry: + ; CHECK: __safestack_unsafe_stack_ptr + %b = alloca i32, align 4 + call void @funcall(i32* %b) nounwind + ret void +} + +declare void @funcall(i32*) diff --git a/test/Transforms/SafeStack/escape-casted-pointer.ll b/test/Transforms/SafeStack/escape-casted-pointer.ll new file mode 100644 index 000000000000..bf6ce1d6b2a3 --- /dev/null +++ b/test/Transforms/SafeStack/escape-casted-pointer.ll @@ -0,0 +1,24 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Addr-of a casted pointer +; safestack attribute +; Requires protector. +define void @foo() nounwind uwtable safestack { +entry: + ; CHECK: __safestack_unsafe_stack_ptr + %a = alloca i32*, align 8 + %b = alloca float**, align 8 + %call = call i32* @getp() + store i32* %call, i32** %a, align 8 + %0 = bitcast i32** %a to float** + store float** %0, float*** %b, align 8 + %1 = load float**, float*** %b, align 8 + call void @funfloat2(float** %1) + ret void +} + +declare void @funfloat2(float**) +declare i32* @getp() diff --git a/test/Transforms/SafeStack/escape-gep-call.ll b/test/Transforms/SafeStack/escape-gep-call.ll new file mode 100644 index 000000000000..42b5dd5c1e72 --- /dev/null +++ b/test/Transforms/SafeStack/escape-gep-call.ll @@ -0,0 +1,20 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +%struct.pair = type { i32, i32 } + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Addr-of struct element, GEP followed by callinst. +; safestack attribute +; Requires protector. +define void @foo() nounwind uwtable safestack { +entry: + ; CHECK: __safestack_unsafe_stack_ptr + %c = alloca %struct.pair, align 4 + %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i64 0, i32 1 + %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %y) nounwind + ret void +} + +declare i32 @printf(i8*, ...) diff --git a/test/Transforms/SafeStack/escape-gep-invoke.ll b/test/Transforms/SafeStack/escape-gep-invoke.ll new file mode 100644 index 000000000000..8495ff985f66 --- /dev/null +++ b/test/Transforms/SafeStack/escape-gep-invoke.ll @@ -0,0 +1,34 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +%struct.pair = type { i32, i32 } + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Addr-of a struct element passed into an invoke instruction. +; (GEP followed by an invoke) +; safestack attribute +; Requires protector. +define i32 @foo() uwtable safestack personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { +entry: + ; CHECK: __safestack_unsafe_stack_ptr + %c = alloca %struct.pair, align 4 + %exn.slot = alloca i8* + %ehselector.slot = alloca i32 + %a = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 0 + store i32 0, i32* %a, align 4 + %a1 = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 0 + invoke void @_Z3exceptPi(i32* %a1) + to label %invoke.cont unwind label %lpad + +invoke.cont: + ret i32 0 + +lpad: + %0 = landingpad { i8*, i32 } + catch i8* null + ret i32 0 +} + +declare void @_Z3exceptPi(i32*) +declare i32 @__gxx_personality_v0(...) diff --git a/test/Transforms/SafeStack/escape-gep-negative.ll b/test/Transforms/SafeStack/escape-gep-negative.ll new file mode 100644 index 000000000000..80d405de36d6 --- /dev/null +++ b/test/Transforms/SafeStack/escape-gep-negative.ll @@ -0,0 +1,18 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Addr-of a local, optimized into a GEP (e.g., &a - 12) +; safestack attribute +; Requires protector. +define void @foo() nounwind uwtable safestack { +entry: + ; CHECK: __safestack_unsafe_stack_ptr + %a = alloca i32, align 4 + %add.ptr5 = getelementptr inbounds i32, i32* %a, i64 -12 + %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) nounwind + ret void +} + +declare i32 @printf(i8*, ...) diff --git a/test/Transforms/SafeStack/escape-gep-ptrtoint.ll b/test/Transforms/SafeStack/escape-gep-ptrtoint.ll new file mode 100644 index 000000000000..73a8e58fb086 --- /dev/null +++ b/test/Transforms/SafeStack/escape-gep-ptrtoint.ll @@ -0,0 +1,22 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +%struct.pair = type { i32, i32 } + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Addr-of struct element, GEP followed by ptrtoint. +; safestack attribute +; Requires protector. +define void @foo() nounwind uwtable safestack { +entry: + ; CHECK: __safestack_unsafe_stack_ptr + %c = alloca %struct.pair, align 4 + %b = alloca i32*, align 8 + %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 1 + %0 = ptrtoint i32* %y to i64 + %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i64 %0) + ret void +} + +declare i32 @printf(i8*, ...) diff --git a/test/Transforms/SafeStack/escape-gep-store.ll b/test/Transforms/SafeStack/escape-gep-store.ll new file mode 100644 index 000000000000..7c6c0a318b17 --- /dev/null +++ b/test/Transforms/SafeStack/escape-gep-store.ll @@ -0,0 +1,23 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +%struct.pair = type { i32, i32 } + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Addr-of struct element. (GEP followed by store). +; safestack attribute +; Requires protector. +define void @foo() nounwind uwtable safestack { +entry: + ; CHECK: __safestack_unsafe_stack_ptr + %c = alloca %struct.pair, align 4 + %b = alloca i32*, align 8 + %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 1 + store i32* %y, i32** %b, align 8 + %0 = load i32*, i32** %b, align 8 + %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32* %0) + ret void +} + +declare i32 @printf(i8*, ...) diff --git a/test/Transforms/SafeStack/escape-phi-call.ll b/test/Transforms/SafeStack/escape-phi-call.ll new file mode 100644 index 000000000000..10b6c1fdce45 --- /dev/null +++ b/test/Transforms/SafeStack/escape-phi-call.ll @@ -0,0 +1,36 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Addr-of in phi instruction +; Requires protector. +define void @foo() nounwind uwtable safestack { +entry: + ; CHECK: __safestack_unsafe_stack_ptr + %x = alloca double, align 8 + %call = call double @testi_aux() nounwind + store double %call, double* %x, align 8 + %cmp = fcmp ogt double %call, 3.140000e+00 + br i1 %cmp, label %if.then, label %if.else + +if.then: ; preds = %entry + %call1 = call double @testi_aux() nounwind + store double %call1, double* %x, align 8 + br label %if.end4 + +if.else: ; preds = %entry + %cmp2 = fcmp ogt double %call, 1.000000e+00 + br i1 %cmp2, label %if.then3, label %if.end4 + +if.then3: ; preds = %if.else + br label %if.end4 + +if.end4: ; preds = %if.else, %if.then3, %if.then + %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ] + %call5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %y.0) nounwind + ret void +} + +declare double @testi_aux() +declare i32 @printf(i8*, ...) diff --git a/test/Transforms/SafeStack/escape-select-call.ll b/test/Transforms/SafeStack/escape-select-call.ll new file mode 100644 index 000000000000..9e54dd8e1401 --- /dev/null +++ b/test/Transforms/SafeStack/escape-select-call.ll @@ -0,0 +1,22 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Addr-of in select instruction +; safestack attribute +; Requires protector. +define void @foo() nounwind uwtable safestack { +entry: + ; CHECK: __safestack_unsafe_stack_ptr + %x = alloca double, align 8 + %call = call double @testi_aux() nounwind + store double %call, double* %x, align 8 + %cmp2 = fcmp ogt double %call, 0.000000e+00 + %y.1 = select i1 %cmp2, double* %x, double* null + %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), double* %y.1) + ret void +} + +declare double @testi_aux() +declare i32 @printf(i8*, ...) diff --git a/test/Transforms/SafeStack/escape-vector.ll b/test/Transforms/SafeStack/escape-vector.ll new file mode 100644 index 000000000000..76b01c7c430c --- /dev/null +++ b/test/Transforms/SafeStack/escape-vector.ll @@ -0,0 +1,21 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +%struct.vec = type { <4 x i32> } + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Addr-of a vector nested in a struct +; safestack attribute +; Requires protector. +define void @foo() nounwind uwtable safestack { +entry: + ; CHECK: __safestack_unsafe_stack_ptr + %c = alloca %struct.vec, align 16 + %y = getelementptr inbounds %struct.vec, %struct.vec* %c, i64 0, i32 0 + %add.ptr = getelementptr inbounds <4 x i32>, <4 x i32>* %y, i64 -12 + %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) nounwind + ret void +} + +declare i32 @printf(i8*, ...) diff --git a/test/Transforms/SafeStack/invoke.ll b/test/Transforms/SafeStack/invoke.ll new file mode 100644 index 000000000000..bfebc336cfd0 --- /dev/null +++ b/test/Transforms/SafeStack/invoke.ll @@ -0,0 +1,33 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Addr-of a variable passed into an invoke instruction. +; safestack attribute +; Requires protector and stack restore after landing pad. +define i32 @foo() uwtable safestack personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { +entry: + ; CHECK: %[[SP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr + ; CHECK: %[[STATICTOP:.*]] = getelementptr i8, i8* %[[SP]], i32 -16 + %a = alloca i32, align 4 + %exn.slot = alloca i8* + %ehselector.slot = alloca i32 + store i32 0, i32* %a, align 4 + invoke void @_Z3exceptPi(i32* %a) + to label %invoke.cont unwind label %lpad + +invoke.cont: + ret i32 0 + +lpad: + ; CHECK: landingpad + ; CHECK-NEXT: catch + %0 = landingpad { i8*, i32 } + catch i8* null + ; CHECK-NEXT: store i8* %[[STATICTOP]], i8** @__safestack_unsafe_stack_ptr + ret i32 0 +} + +declare void @_Z3exceptPi(i32*) +declare i32 @__gxx_personality_v0(...) diff --git a/test/Transforms/SafeStack/no-attr.ll b/test/Transforms/SafeStack/no-attr.ll new file mode 100644 index 000000000000..ca3c21ab01bb --- /dev/null +++ b/test/Transforms/SafeStack/no-attr.ll @@ -0,0 +1,25 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; no safestack attribute +; Requires no protector. + +; CHECK: @foo +define void @foo(i8* %a) nounwind uwtable { +entry: + ; CHECK-NOT: __safestack_unsafe_stack_ptr + %a.addr = alloca i8*, align 8 + %buf = alloca [16 x i8], align 16 + store i8* %a, i8** %a.addr, align 8 + %arraydecay = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 + %0 = load i8*, i8** %a.addr, align 8 + %call = call i8* @strcpy(i8* %arraydecay, i8* %0) + %arraydecay1 = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 + %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) + ret void +} + +declare i8* @strcpy(i8*, i8*) +declare i32 @printf(i8*, ...) diff --git a/test/Transforms/SafeStack/phi-cycle.ll b/test/Transforms/SafeStack/phi-cycle.ll new file mode 100644 index 000000000000..026e88785cb1 --- /dev/null +++ b/test/Transforms/SafeStack/phi-cycle.ll @@ -0,0 +1,50 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +%struct.small = type { i8 } + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; Address-of a structure taken in a function with a loop where +; the alloca is an incoming value to a PHI node and a use of that PHI +; node is also an incoming value. +; Verify that the address-of analysis does not get stuck in infinite +; recursion when chasing the alloca through the PHI nodes. +; Requires protector. +define i32 @foo(i32 %arg) nounwind uwtable safestack { +bb: + ; CHECK: __safestack_unsafe_stack_ptr + %tmp = alloca %struct.small*, align 8 + %tmp1 = call i32 (...) @dummy(%struct.small** %tmp) nounwind + %tmp2 = load %struct.small*, %struct.small** %tmp, align 8 + %tmp3 = ptrtoint %struct.small* %tmp2 to i64 + %tmp4 = trunc i64 %tmp3 to i32 + %tmp5 = icmp sgt i32 %tmp4, 0 + br i1 %tmp5, label %bb6, label %bb21 + +bb6: ; preds = %bb17, %bb + %tmp7 = phi %struct.small* [ %tmp19, %bb17 ], [ %tmp2, %bb ] + %tmp8 = phi i64 [ %tmp20, %bb17 ], [ 1, %bb ] + %tmp9 = phi i32 [ %tmp14, %bb17 ], [ %tmp1, %bb ] + %tmp10 = getelementptr inbounds %struct.small, %struct.small* %tmp7, i64 0, i32 0 + %tmp11 = load i8, i8* %tmp10, align 1 + %tmp12 = icmp eq i8 %tmp11, 1 + %tmp13 = add nsw i32 %tmp9, 8 + %tmp14 = select i1 %tmp12, i32 %tmp13, i32 %tmp9 + %tmp15 = trunc i64 %tmp8 to i32 + %tmp16 = icmp eq i32 %tmp15, %tmp4 + br i1 %tmp16, label %bb21, label %bb17 + +bb17: ; preds = %bb6 + %tmp18 = getelementptr inbounds %struct.small*, %struct.small** %tmp, i64 %tmp8 + %tmp19 = load %struct.small*, %struct.small** %tmp18, align 8 + %tmp20 = add i64 %tmp8, 1 + br label %bb6 + +bb21: ; preds = %bb6, %bb + %tmp22 = phi i32 [ %tmp1, %bb ], [ %tmp14, %bb6 ] + %tmp23 = call i32 (...) @dummy(i32 %tmp22) nounwind + ret i32 undef +} + +declare i32 @dummy(...) diff --git a/test/Transforms/SafeStack/setjmp.ll b/test/Transforms/SafeStack/setjmp.ll new file mode 100644 index 000000000000..e38bff68e94c --- /dev/null +++ b/test/Transforms/SafeStack/setjmp.ll @@ -0,0 +1,37 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t } +%struct.__sigset_t = type { [16 x i64] } + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@buf = internal global [1 x %struct.__jmp_buf_tag] zeroinitializer, align 16 + +; setjmp/longjmp test. +; Requires protector. +define i32 @foo() nounwind uwtable safestack { +entry: + ; CHECK: %[[SP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr + ; CHECK: %[[STATICTOP:.*]] = getelementptr i8, i8* %[[SP]], i32 -16 + %retval = alloca i32, align 4 + %x = alloca i32, align 4 + store i32 0, i32* %retval + store i32 42, i32* %x, align 4 + %call = call i32 @_setjmp(%struct.__jmp_buf_tag* getelementptr inbounds ([1 x %struct.__jmp_buf_tag], [1 x %struct.__jmp_buf_tag]* @buf, i32 0, i32 0)) returns_twice + ; CHECK: setjmp + ; CHECK-NEXT: store i8* %[[STATICTOP]], i8** @__safestack_unsafe_stack_ptr + %tobool = icmp ne i32 %call, 0 + br i1 %tobool, label %if.else, label %if.then +if.then: ; preds = %entry + call void @funcall(i32* %x) + br label %if.end +if.else: ; preds = %entry + call i32 (...) @dummy() + br label %if.end +if.end: ; preds = %if.else, %if.then + ret i32 0 +} + +declare i32 @_setjmp(%struct.__jmp_buf_tag*) +declare void @funcall(i32*) +declare i32 @dummy(...) diff --git a/test/Transforms/SafeStack/setjmp2.ll b/test/Transforms/SafeStack/setjmp2.ll new file mode 100644 index 000000000000..65fd920d63da --- /dev/null +++ b/test/Transforms/SafeStack/setjmp2.ll @@ -0,0 +1,42 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t } +%struct.__sigset_t = type { [16 x i64] } + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@buf = internal global [1 x %struct.__jmp_buf_tag] zeroinitializer, align 16 + +; setjmp/longjmp test with dynamically sized array. +; Requires protector. +; CHECK: @foo(i32 %[[ARG:.*]]) +define i32 @foo(i32 %size) nounwind uwtable safestack { +entry: + ; CHECK: %[[DYNPTR:.*]] = alloca i8* + ; CHECK-NEXT: %[[SP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr + ; CHECK-NEXT: store i8* %[[SP]], i8** %[[DYNPTR]] + + ; CHECK-NEXT: %[[ZEXT:.*]] = zext i32 %[[ARG]] to i64 + ; CHECK-NEXT: %[[MUL:.*]] = mul i64 %[[ZEXT]], 4 + ; CHECK-NEXT: %[[SP2:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr + ; CHECK-NEXT: %[[PTRTOINT:.*]] = ptrtoint i8* %[[SP2]] to i64 + ; CHECK-NEXT: %[[SUB:.*]] = sub i64 %[[PTRTOINT]], %[[MUL]] + ; CHECK-NEXT: %[[AND:.*]] = and i64 %[[SUB]], -16 + ; CHECK-NEXT: %[[INTTOPTR:.*]] = inttoptr i64 %[[AND]] to i8* + ; CHECK-NEXT: store i8* %[[INTTOPTR]], i8** @__safestack_unsafe_stack_ptr + ; CHECK-NEXT: store i8* %[[INTTOPTR]], i8** %unsafe_stack_dynamic_ptr + ; CHECK-NEXT: %[[ALLOCA:.*]] = inttoptr i64 %[[SUB]] to i32* + %a = alloca i32, i32 %size + + ; CHECK: setjmp + ; CHECK-NEXT: %[[LOAD:.*]] = load i8*, i8** %[[DYNPTR]] + ; CHECK-NEXT: store i8* %[[LOAD]], i8** @__safestack_unsafe_stack_ptr + %call = call i32 @_setjmp(%struct.__jmp_buf_tag* getelementptr inbounds ([1 x %struct.__jmp_buf_tag], [1 x %struct.__jmp_buf_tag]* @buf, i32 0, i32 0)) returns_twice + + ; CHECK: call void @funcall(i32* %[[ALLOCA]]) + call void @funcall(i32* %a) + ret i32 0 +} + +declare i32 @_setjmp(%struct.__jmp_buf_tag*) +declare void @funcall(i32*) diff --git a/test/Transforms/SafeStack/struct.ll b/test/Transforms/SafeStack/struct.ll new file mode 100644 index 000000000000..12a0085a2cc3 --- /dev/null +++ b/test/Transforms/SafeStack/struct.ll @@ -0,0 +1,41 @@ +; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s +; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s + +%struct.foo = type { [16 x i8] } + +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 + +; struct { [16 x i8] } + +define void @foo(i8* %a) nounwind uwtable safestack { +entry: + ; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr + + ; CHECK: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16 + + ; CHECK: store i8* %[[USST]], i8** @__safestack_unsafe_stack_ptr + + ; CHECK: %[[AADDR:.*]] = alloca i8*, align 8 + %a.addr = alloca i8*, align 8 + + ; CHECK: %[[BUFPTR:.*]] = getelementptr i8, i8* %[[USP]], i32 -16 + ; CHECK: %[[BUFPTR2:.*]] = bitcast i8* %[[BUFPTR]] to %struct.foo* + %buf = alloca %struct.foo, align 1 + + ; CHECK: store i8* {{.*}}, i8** %[[AADDR]], align 8 + store i8* %a, i8** %a.addr, align 8 + + ; CHECK: %[[GEP:.*]] = getelementptr inbounds %struct.foo, %struct.foo* %[[BUFPTR2]], i32 0, i32 0, i32 0 + %gep = getelementptr inbounds %struct.foo, %struct.foo* %buf, i32 0, i32 0, i32 0 + + ; CHECK: %[[A:.*]] = load i8*, i8** %[[AADDR]], align 8 + %a2 = load i8*, i8** %a.addr, align 8 + + ; CHECK: call i8* @strcpy(i8* %[[GEP]], i8* %[[A]]) + %call = call i8* @strcpy(i8* %gep, i8* %a2) + + ; CHECK: store i8* %[[USP]], i8** @__safestack_unsafe_stack_ptr + ret void +} + +declare i8* @strcpy(i8*, i8*) diff --git a/test/Transforms/ScalarRepl/2011-09-22-PHISpeculateInvoke.ll b/test/Transforms/ScalarRepl/2011-09-22-PHISpeculateInvoke.ll index 9a24662f4114..bff6566d1781 100644 --- a/test/Transforms/ScalarRepl/2011-09-22-PHISpeculateInvoke.ll +++ b/test/Transforms/ScalarRepl/2011-09-22-PHISpeculateInvoke.ll @@ -10,7 +10,7 @@ declare void @extern_fn(i32*) declare i32 @extern_fn2(i32) declare i32 @__gcc_personality_v0(i32, i64, i8*, i8*) -define void @odd_fn(i1) noinline { +define void @odd_fn(i1) noinline personality i32 (i32, i64, i8*, i8*)* @__gcc_personality_v0 { %retptr1 = alloca i32 %retptr2 = alloca i32 br i1 %0, label %then, label %else @@ -30,7 +30,7 @@ join: ; preds = %then, %else ret void unwind: ; preds = %then - %info = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gcc_personality_v0 + %info = landingpad { i8*, i32 } cleanup call void @extern_fn(i32* null) unreachable diff --git a/test/Transforms/SeparateConstOffsetFromGEP/AMDGPU/lit.local.cfg b/test/Transforms/SeparateConstOffsetFromGEP/AMDGPU/lit.local.cfg new file mode 100644 index 000000000000..6baccf05fff0 --- /dev/null +++ b/test/Transforms/SeparateConstOffsetFromGEP/AMDGPU/lit.local.cfg @@ -0,0 +1,3 @@ +if not 'AMDGPU' in config.root.targets: + config.unsupported = True + diff --git a/test/Transforms/SeparateConstOffsetFromGEP/R600/split-gep-and-gvn-addrspace-addressing-modes.ll b/test/Transforms/SeparateConstOffsetFromGEP/AMDGPU/split-gep-and-gvn-addrspace-addressing-modes.ll index 527634db0f5b..527634db0f5b 100644 --- a/test/Transforms/SeparateConstOffsetFromGEP/R600/split-gep-and-gvn-addrspace-addressing-modes.ll +++ b/test/Transforms/SeparateConstOffsetFromGEP/AMDGPU/split-gep-and-gvn-addrspace-addressing-modes.ll diff --git a/test/Transforms/SeparateConstOffsetFromGEP/R600/lit.local.cfg b/test/Transforms/SeparateConstOffsetFromGEP/R600/lit.local.cfg deleted file mode 100644 index 4086e8d681c3..000000000000 --- a/test/Transforms/SeparateConstOffsetFromGEP/R600/lit.local.cfg +++ /dev/null @@ -1,3 +0,0 @@ -if not 'R600' in config.root.targets: - config.unsupported = True - diff --git a/test/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll b/test/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll index 7551e8fb747c..fe3a603a0426 100644 --- a/test/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll +++ b/test/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll @@ -2,13 +2,13 @@ ; ; RUN: opt < %s -simplifycfg -disable-output -define i32 @test() { +define i32 @test() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { %A = invoke i32 @test( ) to label %Ret unwind label %Ret2 ; <i32> [#uses=1] Ret: ; preds = %0 ret i32 %A Ret2: ; preds = %0 - %val = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %val = landingpad { i8*, i32 } catch i8* null ret i32 undef } diff --git a/test/Transforms/SimplifyCFG/2005-10-02-InvokeSimplify.ll b/test/Transforms/SimplifyCFG/2005-10-02-InvokeSimplify.ll index 2ecdc95259cc..c71f05bf0a35 100644 --- a/test/Transforms/SimplifyCFG/2005-10-02-InvokeSimplify.ll +++ b/test/Transforms/SimplifyCFG/2005-10-02-InvokeSimplify.ll @@ -1,10 +1,10 @@ ; RUN: opt < %s -simplifycfg -disable-output -define i1 @foo() { +define i1 @foo() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { %X = invoke i1 @foo( ) to label %N unwind label %F ; <i1> [#uses=1] F: ; preds = %0 - %val = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %val = landingpad { i8*, i32 } catch i8* null ret i1 false N: ; preds = %0 diff --git a/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll b/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll index 76f41e8fc218..c38d71ccd284 100644 --- a/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll +++ b/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll @@ -4,7 +4,7 @@ declare i32 @func(i8*) nounwind -define i32 @test() { +define i32 @test() personality i32 (...)* @__gxx_personality_v0 { invoke i32 @func( i8* null ) to label %Cont unwind label %Other ; <i32>:1 [#uses=0] @@ -12,7 +12,7 @@ Cont: ; preds = %0 ret i32 0 Other: ; preds = %0 - landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 + landingpad { i8*, i32 } catch i8* null ret i32 1 } diff --git a/test/Transforms/SimplifyCFG/2010-03-30-InvokeCrash.ll b/test/Transforms/SimplifyCFG/2010-03-30-InvokeCrash.ll index 333336de7673..d545739bc745 100644 --- a/test/Transforms/SimplifyCFG/2010-03-30-InvokeCrash.ll +++ b/test/Transforms/SimplifyCFG/2010-03-30-InvokeCrash.ll @@ -5,7 +5,7 @@ target triple = "x86_64-unknown-linux-gnu" declare void @bar(i32) -define void @foo() { +define void @foo() personality i32 (...)* @__gxx_personality_v0 { entry: invoke void @bar(i32 undef) to label %r unwind label %u @@ -14,7 +14,7 @@ r: ; preds = %entry ret void u: ; preds = %entry - %val = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 + %val = landingpad { i8*, i32 } cleanup resume { i8*, i32 } %val } diff --git a/test/Transforms/SimplifyCFG/2011-09-05-TrivialLPad.ll b/test/Transforms/SimplifyCFG/2011-09-05-TrivialLPad.ll index 7558419a2ebd..111434b7fcdb 100644 --- a/test/Transforms/SimplifyCFG/2011-09-05-TrivialLPad.ll +++ b/test/Transforms/SimplifyCFG/2011-09-05-TrivialLPad.ll @@ -5,7 +5,7 @@ declare void @bar() -define i32 @foo() { +define i32 @foo() personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 { entry: invoke void @bar() to label %return unwind label %lpad @@ -14,7 +14,7 @@ return: ret i32 0 lpad: - %lp = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 + %lp = landingpad { i8*, i32 } cleanup resume { i8*, i32 } %lp } diff --git a/test/Transforms/SimplifyCFG/R600/cttz-ctlz.ll b/test/Transforms/SimplifyCFG/AMDGPU/cttz-ctlz.ll index 5b2799494647..5b2799494647 100644 --- a/test/Transforms/SimplifyCFG/R600/cttz-ctlz.ll +++ b/test/Transforms/SimplifyCFG/AMDGPU/cttz-ctlz.ll diff --git a/test/Transforms/SimplifyCFG/AMDGPU/lit.local.cfg b/test/Transforms/SimplifyCFG/AMDGPU/lit.local.cfg new file mode 100644 index 000000000000..2a665f06be72 --- /dev/null +++ b/test/Transforms/SimplifyCFG/AMDGPU/lit.local.cfg @@ -0,0 +1,2 @@ +if not 'AMDGPU' in config.root.targets: + config.unsupported = True diff --git a/test/Transforms/SimplifyCFG/R600/lit.local.cfg b/test/Transforms/SimplifyCFG/R600/lit.local.cfg deleted file mode 100644 index ad9ce2541ef7..000000000000 --- a/test/Transforms/SimplifyCFG/R600/lit.local.cfg +++ /dev/null @@ -1,2 +0,0 @@ -if not 'R600' in config.root.targets: - config.unsupported = True diff --git a/test/Transforms/SimplifyCFG/UnreachableEliminate.ll b/test/Transforms/SimplifyCFG/UnreachableEliminate.ll index 8718c552c693..87872a6a8a10 100644 --- a/test/Transforms/SimplifyCFG/UnreachableEliminate.ll +++ b/test/Transforms/SimplifyCFG/UnreachableEliminate.ll @@ -13,7 +13,7 @@ F: ret void } -define void @test2() { +define void @test2() personality i32 (...)* @__gxx_personality_v0 { ; CHECK-LABEL: @test2( ; CHECK: entry: ; CHECK-NEXT: call void @test2() @@ -22,7 +22,7 @@ entry: invoke void @test2( ) to label %N unwind label %U U: - %res = landingpad { i8* } personality i32 (...)* @__gxx_personality_v0 + %res = landingpad { i8* } cleanup unreachable N: diff --git a/test/Transforms/SimplifyCFG/duplicate-landingpad.ll b/test/Transforms/SimplifyCFG/duplicate-landingpad.ll index 54028774d20e..93c55f0064cc 100644 --- a/test/Transforms/SimplifyCFG/duplicate-landingpad.ll +++ b/test/Transforms/SimplifyCFG/duplicate-landingpad.ll @@ -6,7 +6,7 @@ declare void @fn() ; CHECK-LABEL: @test1 -define void @test1() { +define void @test1() personality i32 (...)* @__gxx_personality_v0 { entry: ; CHECK-LABEL: entry: ; CHECK: to label %invoke2 unwind label %lpad2 @@ -23,17 +23,17 @@ invoke.cont: ret void lpad1: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} cleanup br label %shared_resume lpad2: ; CHECK-LABEL: lpad2: -; CHECK: landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 +; CHECK: landingpad { i8*, i32 } ; CHECK-NEXT: cleanup ; CHECK-NEXT: call void @fn() ; CHECK-NEXT: ret void - %exn2 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn2 = landingpad {i8*, i32} cleanup br label %shared_resume @@ -43,7 +43,7 @@ shared_resume: } ; Don't trigger if blocks aren't the same/empty -define void @neg1() { +define void @neg1() personality i32 (...)* @__gxx_personality_v0 { ; CHECK-LABEL: @neg1 entry: ; CHECK-LABEL: entry: @@ -61,13 +61,13 @@ invoke.cont: ret void lpad1: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} filter [0 x i8*] zeroinitializer call void @fn() br label %shared_resume lpad2: - %exn2 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn2 = landingpad {i8*, i32} cleanup br label %shared_resume @@ -77,7 +77,7 @@ shared_resume: } ; Should not trigger when the landing pads are not the exact same -define void @neg2() { +define void @neg2() personality i32 (...)* @__gxx_personality_v0 { ; CHECK-LABEL: @neg2 entry: ; CHECK-LABEL: entry: @@ -95,12 +95,12 @@ invoke.cont: ret void lpad1: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} filter [0 x i8*] zeroinitializer br label %shared_resume lpad2: - %exn2 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn2 = landingpad {i8*, i32} cleanup br label %shared_resume diff --git a/test/Transforms/SimplifyCFG/invoke.ll b/test/Transforms/SimplifyCFG/invoke.ll index 5f513ac3e6de..b7fd7d62ccf0 100644 --- a/test/Transforms/SimplifyCFG/invoke.ll +++ b/test/Transforms/SimplifyCFG/invoke.ll @@ -10,7 +10,7 @@ declare i32 @fn() ; CHECK-LABEL: @f1( -define i8* @f1() nounwind uwtable ssp { +define i8* @f1() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: ; CHECK: call void @llvm.trap() ; CHECK: unreachable @@ -21,7 +21,7 @@ invoke.cont: ret i8* %call lpad: - %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %0 = landingpad { i8*, i32 } filter [0 x i8*] zeroinitializer %1 = extractvalue { i8*, i32 } %0, 0 tail call void @__cxa_call_unexpected(i8* %1) noreturn nounwind @@ -29,7 +29,7 @@ lpad: } ; CHECK-LABEL: @f2( -define i8* @f2() nounwind uwtable ssp { +define i8* @f2() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: ; CHECK: call void @llvm.trap() ; CHECK: unreachable @@ -40,7 +40,7 @@ invoke.cont: ret i8* %call lpad: - %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %0 = landingpad { i8*, i32 } filter [0 x i8*] zeroinitializer %1 = extractvalue { i8*, i32 } %0, 0 tail call void @__cxa_call_unexpected(i8* %1) noreturn nounwind @@ -48,7 +48,7 @@ lpad: } ; CHECK-LABEL: @f3( -define i32 @f3() nounwind uwtable ssp { +define i32 @f3() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { ; CHECK-NEXT: entry entry: ; CHECK-NEXT: ret i32 3 @@ -59,7 +59,7 @@ invoke.cont: ret i32 3 lpad: - %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %0 = landingpad { i8*, i32 } filter [0 x i8*] zeroinitializer %1 = extractvalue { i8*, i32 } %0, 0 tail call void @__cxa_call_unexpected(i8* %1) noreturn nounwind @@ -67,7 +67,7 @@ lpad: } ; CHECK-LABEL: @f4( -define i32 @f4() nounwind uwtable ssp { +define i32 @f4() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { ; CHECK-NEXT: entry entry: ; CHECK-NEXT: call i32 @read_only() @@ -79,7 +79,7 @@ invoke.cont: ret i32 %call lpad: - %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %0 = landingpad { i8*, i32 } filter [0 x i8*] zeroinitializer %1 = extractvalue { i8*, i32 } %0, 0 tail call void @__cxa_call_unexpected(i8* %1) noreturn nounwind @@ -87,7 +87,7 @@ lpad: } ; CHECK-LABEL: @f5( -define i32 @f5(i1 %cond, i8* %a, i8* %b) { +define i32 @f5(i1 %cond, i8* %a, i8* %b) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: br i1 %cond, label %x, label %y @@ -110,7 +110,7 @@ cont: lpad: ; CHECK-NOT: phi %phi2 = phi i8* [%a, %x], [%b, %y] - %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + %0 = landingpad { i8*, i32 } filter [0 x i8*] zeroinitializer ; CHECK: __cxa_call_unexpected(i8* %a) tail call void @__cxa_call_unexpected(i8* %phi2) noreturn nounwind @@ -118,7 +118,7 @@ lpad: } ; CHECK-LABEL: @f6( -define void @f6() { +define void @f6() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: invoke void @purefn() to label %invoke.cont1 unwind label %lpad @@ -133,7 +133,7 @@ invoke.cont2: lpad: ; CHECK-NOT: phi %tmp = phi i8* [ null, %invoke.cont1 ], [ null, %entry ] - landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + landingpad { i8*, i32 } cleanup ret void } diff --git a/test/Transforms/SimplifyCFG/invoke_unwind.ll b/test/Transforms/SimplifyCFG/invoke_unwind.ll index 435bed0c2957..3b4c09d96f77 100644 --- a/test/Transforms/SimplifyCFG/invoke_unwind.ll +++ b/test/Transforms/SimplifyCFG/invoke_unwind.ll @@ -4,7 +4,7 @@ declare void @bar() ; This testcase checks to see if the simplifycfg pass is converting invoke ; instructions to call instructions if the handler just rethrows the exception. -define i32 @test1() { +define i32 @test1() personality i32 (...)* @__gxx_personality_v0 { ; CHECK-LABEL: @test1( ; CHECK-NEXT: call void @bar() ; CHECK-NEXT: ret i32 0 @@ -12,7 +12,7 @@ define i32 @test1() { to label %1 unwind label %Rethrow ret i32 0 Rethrow: - %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + %exn = landingpad {i8*, i32} catch i8* null resume { i8*, i32 } %exn } diff --git a/test/Transforms/SimplifyCFG/seh-nounwind.ll b/test/Transforms/SimplifyCFG/seh-nounwind.ll index 3845e3198909..c380c6ce2ce9 100644 --- a/test/Transforms/SimplifyCFG/seh-nounwind.ll +++ b/test/Transforms/SimplifyCFG/seh-nounwind.ll @@ -10,13 +10,13 @@ entry: ret i32 %div } -define i32 @main() nounwind { +define i32 @main() nounwind personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) { entry: %call = invoke i32 @div(i32 10, i32 0) to label %__try.cont unwind label %lpad lpad: - %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) + %0 = landingpad { i8*, i32 } catch i8* null br label %__try.cont diff --git a/test/Transforms/SimplifyCFG/statepoint-invoke-unwind.ll b/test/Transforms/SimplifyCFG/statepoint-invoke-unwind.ll new file mode 100644 index 000000000000..994e47eb0d64 --- /dev/null +++ b/test/Transforms/SimplifyCFG/statepoint-invoke-unwind.ll @@ -0,0 +1,24 @@ +; RUN: opt < %s -simplifycfg -S | FileCheck %s +; Test that statepoint intrinsic is marked with Throwable attribute and it is +; not optimized into call + +declare i64 addrspace(1)* @gc_call() +declare i32 @llvm.experimental.gc.statepoint.p0f_p1i64f(i64, i32, i64 addrspace(1)* ()*, i32, i32, ...) +declare i32* @fake_personality_function() + +define i32 @test() gc "statepoint-example" personality i32* ()* @fake_personality_function { +; CHECK-LABEL: test +entry: + ; CHECK-LABEL: entry: + ; CHECK-NEXT: %sp = invoke i32 (i64, i32, i64 addrspace(1)* ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p1i64f + %sp = invoke i32 (i64, i32, i64 addrspace(1)* ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p1i64f(i64 0, i32 0, i64 addrspace(1)* ()* @gc_call, i32 0, i32 0, i32 0, i32 0) + to label %normal unwind label %exception + +exception: + %lpad = landingpad { i8*, i32 } + cleanup + ret i32 0 + +normal: + ret i32 1 +} diff --git a/test/Transforms/StraightLineStrengthReduce/AMDGPU/lit.local.cfg b/test/Transforms/StraightLineStrengthReduce/AMDGPU/lit.local.cfg new file mode 100644 index 000000000000..2a665f06be72 --- /dev/null +++ b/test/Transforms/StraightLineStrengthReduce/AMDGPU/lit.local.cfg @@ -0,0 +1,2 @@ +if not 'AMDGPU' in config.root.targets: + config.unsupported = True diff --git a/test/Transforms/StraightLineStrengthReduce/AMDGPU/reassociate-geps-and-slsr-addrspace.ll b/test/Transforms/StraightLineStrengthReduce/AMDGPU/reassociate-geps-and-slsr-addrspace.ll new file mode 100644 index 000000000000..278250a9c80e --- /dev/null +++ b/test/Transforms/StraightLineStrengthReduce/AMDGPU/reassociate-geps-and-slsr-addrspace.ll @@ -0,0 +1,107 @@ +; RUN: opt -S -mtriple=amdgcn-- -separate-const-offset-from-gep -slsr -gvn < %s | FileCheck %s + +target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-p24:64:64-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" + + +; CHECK-LABEL: @slsr_after_reassociate_global_geps_mubuf_max_offset( +; CHECK: [[b1:%[0-9]+]] = getelementptr float, float addrspace(1)* %arr, i64 [[bump:%[0-9]+]] +; CHECK: [[b2:%[0-9]+]] = getelementptr float, float addrspace(1)* [[b1]], i64 [[bump]] +define void @slsr_after_reassociate_global_geps_mubuf_max_offset(float addrspace(1)* %out, float addrspace(1)* noalias %arr, i32 %i) { +bb: + %i2 = shl nsw i32 %i, 1 + %j1 = add nsw i32 %i, 1023 + %tmp = sext i32 %j1 to i64 + %p1 = getelementptr inbounds float, float addrspace(1)* %arr, i64 %tmp + %tmp3 = bitcast float addrspace(1)* %p1 to i32 addrspace(1)* + %v11 = load i32, i32 addrspace(1)* %tmp3, align 4 + %tmp4 = bitcast float addrspace(1)* %out to i32 addrspace(1)* + store i32 %v11, i32 addrspace(1)* %tmp4, align 4 + + %j2 = add nsw i32 %i2, 1023 + %tmp5 = sext i32 %j2 to i64 + %p2 = getelementptr inbounds float, float addrspace(1)* %arr, i64 %tmp5 + %tmp6 = bitcast float addrspace(1)* %p2 to i32 addrspace(1)* + %v22 = load i32, i32 addrspace(1)* %tmp6, align 4 + %tmp7 = bitcast float addrspace(1)* %out to i32 addrspace(1)* + store i32 %v22, i32 addrspace(1)* %tmp7, align 4 + + ret void +} + +; CHECK-LABEL: @slsr_after_reassociate_global_geps_over_mubuf_max_offset( +; CHECK: %j1 = add nsw i32 %i, 1024 +; CHECK: %tmp = sext i32 %j1 to i64 +; CHECK: getelementptr inbounds float, float addrspace(1)* %arr, i64 %tmp +; CHECK: getelementptr inbounds float, float addrspace(1)* %arr, i64 %tmp5 +define void @slsr_after_reassociate_global_geps_over_mubuf_max_offset(float addrspace(1)* %out, float addrspace(1)* noalias %arr, i32 %i) { +bb: + %i2 = shl nsw i32 %i, 1 + %j1 = add nsw i32 %i, 1024 + %tmp = sext i32 %j1 to i64 + %p1 = getelementptr inbounds float, float addrspace(1)* %arr, i64 %tmp + %tmp3 = bitcast float addrspace(1)* %p1 to i32 addrspace(1)* + %v11 = load i32, i32 addrspace(1)* %tmp3, align 4 + %tmp4 = bitcast float addrspace(1)* %out to i32 addrspace(1)* + store i32 %v11, i32 addrspace(1)* %tmp4, align 4 + + %j2 = add nsw i32 %i2, 1024 + %tmp5 = sext i32 %j2 to i64 + %p2 = getelementptr inbounds float, float addrspace(1)* %arr, i64 %tmp5 + %tmp6 = bitcast float addrspace(1)* %p2 to i32 addrspace(1)* + %v22 = load i32, i32 addrspace(1)* %tmp6, align 4 + %tmp7 = bitcast float addrspace(1)* %out to i32 addrspace(1)* + store i32 %v22, i32 addrspace(1)* %tmp7, align 4 + + ret void +} + +; CHECK-LABEL: @slsr_after_reassociate_lds_geps_ds_max_offset( +; CHECK: [[B1:%[0-9]+]] = getelementptr float, float addrspace(3)* %arr, i32 %i +; CHECK: getelementptr float, float addrspace(3)* [[B1]], i32 16383 + +; CHECK: [[B2:%[0-9]+]] = getelementptr float, float addrspace(3)* [[B1]], i32 %i +; CHECK: getelementptr float, float addrspace(3)* [[B2]], i32 16383 +define void @slsr_after_reassociate_lds_geps_ds_max_offset(float addrspace(1)* %out, float addrspace(3)* noalias %arr, i32 %i) { +bb: + %i2 = shl nsw i32 %i, 1 + %j1 = add nsw i32 %i, 16383 + %p1 = getelementptr inbounds float, float addrspace(3)* %arr, i32 %j1 + %tmp3 = bitcast float addrspace(3)* %p1 to i32 addrspace(3)* + %v11 = load i32, i32 addrspace(3)* %tmp3, align 4 + %tmp4 = bitcast float addrspace(1)* %out to i32 addrspace(1)* + store i32 %v11, i32 addrspace(1)* %tmp4, align 4 + + %j2 = add nsw i32 %i2, 16383 + %p2 = getelementptr inbounds float, float addrspace(3)* %arr, i32 %j2 + %tmp6 = bitcast float addrspace(3)* %p2 to i32 addrspace(3)* + %v22 = load i32, i32 addrspace(3)* %tmp6, align 4 + %tmp7 = bitcast float addrspace(1)* %out to i32 addrspace(1)* + store i32 %v22, i32 addrspace(1)* %tmp7, align 4 + + ret void +} + +; CHECK-LABEL: @slsr_after_reassociate_lds_geps_over_ds_max_offset( +; CHECK: %j1 = add nsw i32 %i, 16384 +; CHECK: getelementptr inbounds float, float addrspace(3)* %arr, i32 %j1 +; CHECK: %j2 = add i32 %j1, %i +; CHECK: getelementptr inbounds float, float addrspace(3)* %arr, i32 %j2 +define void @slsr_after_reassociate_lds_geps_over_ds_max_offset(float addrspace(1)* %out, float addrspace(3)* noalias %arr, i32 %i) { +bb: + %i2 = shl nsw i32 %i, 1 + %j1 = add nsw i32 %i, 16384 + %p1 = getelementptr inbounds float, float addrspace(3)* %arr, i32 %j1 + %tmp3 = bitcast float addrspace(3)* %p1 to i32 addrspace(3)* + %v11 = load i32, i32 addrspace(3)* %tmp3, align 4 + %tmp4 = bitcast float addrspace(1)* %out to i32 addrspace(1)* + store i32 %v11, i32 addrspace(1)* %tmp4, align 4 + + %j2 = add nsw i32 %i2, 16384 + %p2 = getelementptr inbounds float, float addrspace(3)* %arr, i32 %j2 + %tmp6 = bitcast float addrspace(3)* %p2 to i32 addrspace(3)* + %v22 = load i32, i32 addrspace(3)* %tmp6, align 4 + %tmp7 = bitcast float addrspace(1)* %out to i32 addrspace(1)* + store i32 %v22, i32 addrspace(1)* %tmp7, align 4 + + ret void +} |