diff options
Diffstat (limited to 'test/Transforms/Inline')
53 files changed, 343 insertions, 52 deletions
diff --git a/test/Transforms/Inline/2003-09-14-InlineValue.ll b/test/Transforms/Inline/2003-09-14-InlineValue.ll index edc9b47..49a27e1 100644 --- a/test/Transforms/Inline/2003-09-14-InlineValue.ll +++ b/test/Transforms/Inline/2003-09-14-InlineValue.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -disable-output +; RUN: opt < %s -inline -disable-output declare i32 @External() diff --git a/test/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll b/test/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll index d57aee0..5ced3b8 100644 --- a/test/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll +++ b/test/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -disable-output +; RUN: opt < %s -inline -disable-output define i32 @main() { entry: diff --git a/test/Transforms/Inline/2003-09-22-PHINodesInExceptionDest.ll b/test/Transforms/Inline/2003-09-22-PHINodesInExceptionDest.ll index d75999b..4418f77 100644 --- a/test/Transforms/Inline/2003-09-22-PHINodesInExceptionDest.ll +++ b/test/Transforms/Inline/2003-09-22-PHINodesInExceptionDest.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -disable-output +; RUN: opt < %s -inline -disable-output define i32 @main() { entry: diff --git a/test/Transforms/Inline/2003-09-22-PHINodesInNormalInvokeDest.ll b/test/Transforms/Inline/2003-09-22-PHINodesInNormalInvokeDest.ll index 09d516f..1bd5529 100644 --- a/test/Transforms/Inline/2003-09-22-PHINodesInNormalInvokeDest.ll +++ b/test/Transforms/Inline/2003-09-22-PHINodesInNormalInvokeDest.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -disable-output +; RUN: opt < %s -inline -disable-output define i32 @main() { entry: diff --git a/test/Transforms/Inline/2003-10-13-AllocaDominanceProblem.ll b/test/Transforms/Inline/2003-10-13-AllocaDominanceProblem.ll index 6b6cf06..4a80d37 100644 --- a/test/Transforms/Inline/2003-10-13-AllocaDominanceProblem.ll +++ b/test/Transforms/Inline/2003-10-13-AllocaDominanceProblem.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -disable-output +; RUN: opt < %s -inline -disable-output define i32 @reload() { reloadentry: diff --git a/test/Transforms/Inline/2003-10-26-InlineInvokeExceptionDestPhi.ll b/test/Transforms/Inline/2003-10-26-InlineInvokeExceptionDestPhi.ll index 675454e..9afd450 100644 --- a/test/Transforms/Inline/2003-10-26-InlineInvokeExceptionDestPhi.ll +++ b/test/Transforms/Inline/2003-10-26-InlineInvokeExceptionDestPhi.ll @@ -2,7 +2,7 @@ ; node in the exception destination, and the inlined function contains an ; unwind instruction. -; RUN: llvm-as < %s | opt -inline -disable-output +; RUN: opt < %s -inline -disable-output define linkonce void @foo() { unwind diff --git a/test/Transforms/Inline/2004-04-15-InlineDeletesCall.ll b/test/Transforms/Inline/2004-04-15-InlineDeletesCall.ll index 8a2f8e2..3899451 100644 --- a/test/Transforms/Inline/2004-04-15-InlineDeletesCall.ll +++ b/test/Transforms/Inline/2004-04-15-InlineDeletesCall.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -disable-output +; RUN: opt < %s -inline -disable-output ; Inlining the first call caused the inliner function to delete the second ; call. Then the inliner tries to inline the second call, which no longer diff --git a/test/Transforms/Inline/2004-04-20-InlineLinkOnce.ll b/test/Transforms/Inline/2004-04-20-InlineLinkOnce.ll index d9f09a0..fabad30 100644 --- a/test/Transforms/Inline/2004-04-20-InlineLinkOnce.ll +++ b/test/Transforms/Inline/2004-04-20-InlineLinkOnce.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -prune-eh -disable-output +; RUN: opt < %s -inline -prune-eh -disable-output define linkonce void @caller() { call void @callee( ) diff --git a/test/Transforms/Inline/2004-10-17-InlineFunctionWithoutReturn.ll b/test/Transforms/Inline/2004-10-17-InlineFunctionWithoutReturn.ll index 09666ec..733cbb9 100644 --- a/test/Transforms/Inline/2004-10-17-InlineFunctionWithoutReturn.ll +++ b/test/Transforms/Inline/2004-10-17-InlineFunctionWithoutReturn.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -disable-output +; RUN: opt < %s -inline -disable-output define i32 @test() { unwind diff --git a/test/Transforms/Inline/2006-01-14-CallGraphUpdate.ll b/test/Transforms/Inline/2006-01-14-CallGraphUpdate.ll index acdf6ab..415495e 100644 --- a/test/Transforms/Inline/2006-01-14-CallGraphUpdate.ll +++ b/test/Transforms/Inline/2006-01-14-CallGraphUpdate.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -prune-eh -disable-output +; RUN: opt < %s -inline -prune-eh -disable-output %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>" = type { %"struct.std::locale::facet" } %"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >" = type { i32 (...)**, i32*, i32*, i32*, i32*, i32*, i32*, %"struct.std::locale" } diff --git a/test/Transforms/Inline/2006-07-12-InlinePruneCGUpdate.ll b/test/Transforms/Inline/2006-07-12-InlinePruneCGUpdate.ll index 5215bec..6934562 100644 --- a/test/Transforms/Inline/2006-07-12-InlinePruneCGUpdate.ll +++ b/test/Transforms/Inline/2006-07-12-InlinePruneCGUpdate.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -prune-eh -disable-output +; RUN: opt < %s -inline -prune-eh -disable-output ; PR827 @_ZTV8CRjii = internal global [1 x i32 (...)*] [ i32 (...)* @_ZN8CRjii12NlFeeEPN5Jr7sE ] ; <[1 x i32 (...)*]*> [#uses=0] diff --git a/test/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll b/test/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll index bd2885d..37cba98 100644 --- a/test/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll +++ b/test/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -prune-eh -disable-output +; RUN: opt < %s -inline -prune-eh -disable-output ; PR993 target datalayout = "e-p:32:32" target triple = "i386-unknown-openbsd3.9" diff --git a/test/Transforms/Inline/2006-11-09-InlineCGUpdate.ll b/test/Transforms/Inline/2006-11-09-InlineCGUpdate.ll index 05096f4..279823a 100644 --- a/test/Transforms/Inline/2006-11-09-InlineCGUpdate.ll +++ b/test/Transforms/Inline/2006-11-09-InlineCGUpdate.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -prune-eh -disable-output +; RUN: opt < %s -inline -prune-eh -disable-output ; PR992 target datalayout = "e-p:32:32" target triple = "i686-pc-linux-gnu" diff --git a/test/Transforms/Inline/2007-04-15-InlineEH.ll b/test/Transforms/Inline/2007-04-15-InlineEH.ll index 083a328..635f93e 100644 --- a/test/Transforms/Inline/2007-04-15-InlineEH.ll +++ b/test/Transforms/Inline/2007-04-15-InlineEH.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep {invoke void asm} +; RUN: opt < %s -inline -S | not grep {invoke void asm} ; PR1335 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" diff --git a/test/Transforms/Inline/2007-06-06-NoInline.ll b/test/Transforms/Inline/2007-06-06-NoInline.ll index 51bba07..d5a7953 100644 --- a/test/Transforms/Inline/2007-06-06-NoInline.ll +++ b/test/Transforms/Inline/2007-06-06-NoInline.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -f - | llvm-dis | grep "define internal i32 @bar" +; RUN: opt < %s -inline -S | grep "define internal i32 @bar" @llvm.noinline = appending global [1 x i8*] [ i8* bitcast (i32 (i32, i32)* @bar to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] define internal i32 @bar(i32 %x, i32 %y) { diff --git a/test/Transforms/Inline/2007-06-25-WeakInline.ll b/test/Transforms/Inline/2007-06-25-WeakInline.ll index 3cf758c..929891a 100644 --- a/test/Transforms/Inline/2007-06-25-WeakInline.ll +++ b/test/Transforms/Inline/2007-06-25-WeakInline.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline | llvm-dis | grep call +; RUN: opt < %s -inline -S | grep call ; 'bar' can be overridden at link-time, don't inline it. diff --git a/test/Transforms/Inline/2007-12-19-InlineNoUnwind.ll b/test/Transforms/Inline/2007-12-19-InlineNoUnwind.ll index 5f7da15..08d4dc6 100644 --- a/test/Transforms/Inline/2007-12-19-InlineNoUnwind.ll +++ b/test/Transforms/Inline/2007-12-19-InlineNoUnwind.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as %s -o - | opt -inline | llvm-dis | grep nounwind -; RUN: llvm-as %s -o - | opt -inline | llvm-dis | grep unreachable +; RUN: opt < %s -inline -S | grep nounwind +; RUN: opt < %s -inline -S | grep unreachable declare i1 @extern() diff --git a/test/Transforms/Inline/2008-03-04-StructRet.ll b/test/Transforms/Inline/2008-03-04-StructRet.ll index fc7ebc4..3311d56 100644 --- a/test/Transforms/Inline/2008-03-04-StructRet.ll +++ b/test/Transforms/Inline/2008-03-04-StructRet.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -disable-output +; RUN: opt < %s -inline -disable-output %struct.Benchmark = type { i32 (...)** } %struct.Complex = type { double, double } %struct.ComplexBenchmark = type { %struct.Benchmark } diff --git a/test/Transforms/Inline/2008-03-07-Inline-2.ll b/test/Transforms/Inline/2008-03-07-Inline-2.ll index 0c25690..0c968e6 100644 --- a/test/Transforms/Inline/2008-03-07-Inline-2.ll +++ b/test/Transforms/Inline/2008-03-07-Inline-2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -disable-output +; RUN: opt < %s -inline -disable-output %struct.Demand = type { double, double } %struct.branch = type { %struct.Demand, double, double, double, double, %struct.branch*, [12 x %struct.leaf*] } %struct.leaf = type { %struct.Demand, double, double } diff --git a/test/Transforms/Inline/2008-03-07-Inline.ll b/test/Transforms/Inline/2008-03-07-Inline.ll index 09d14f0..86afb2d 100644 --- a/test/Transforms/Inline/2008-03-07-Inline.ll +++ b/test/Transforms/Inline/2008-03-07-Inline.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -disable-output +; RUN: opt < %s -inline -disable-output %struct.Demand = type { double, double } %struct.branch = type { %struct.Demand, double, double, double, double, %struct.branch*, [12 x %struct.leaf*] } %struct.leaf = type { %struct.Demand, double, double } diff --git a/test/Transforms/Inline/2008-09-02-AlwaysInline.ll b/test/Transforms/Inline/2008-09-02-AlwaysInline.ll index b42e559..39095c4 100644 --- a/test/Transforms/Inline/2008-09-02-AlwaysInline.ll +++ b/test/Transforms/Inline/2008-09-02-AlwaysInline.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline-threshold=0 -inline | llvm-dis | not grep call +; RUN: opt < %s -inline-threshold=0 -inline -S | not grep call define i32 @fn2() alwaysinline { ret i32 1 diff --git a/test/Transforms/Inline/2008-09-02-NoInline.ll b/test/Transforms/Inline/2008-09-02-NoInline.ll index 35b4b46..33c8949 100644 --- a/test/Transforms/Inline/2008-09-02-NoInline.ll +++ b/test/Transforms/Inline/2008-09-02-NoInline.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline | llvm-dis | grep call | count 1 +; RUN: opt < %s -inline -S | grep call | count 1 define i32 @fn2() noinline { ret i32 1 diff --git a/test/Transforms/Inline/2008-10-30-AlwaysInline.ll b/test/Transforms/Inline/2008-10-30-AlwaysInline.ll index 765fc75..11e5012 100644 --- a/test/Transforms/Inline/2008-10-30-AlwaysInline.ll +++ b/test/Transforms/Inline/2008-10-30-AlwaysInline.ll @@ -1,7 +1,7 @@ -; RUN: llvm-as < %s | opt -always-inline | llvm-dis | not grep call +; RUN: opt < %s -always-inline -S | not grep call ; Ensure that threshold doesn't disrupt always inline. -; RUN: llvm-as < %s | opt -inline-threshold=-2000000001 -always-inline | llvm-dis | not grep call +; RUN: opt < %s -inline-threshold=-2000000001 -always-inline -S | not grep call define internal i32 @if0() alwaysinline { diff --git a/test/Transforms/Inline/2008-11-04-AlwaysInline.ll b/test/Transforms/Inline/2008-11-04-AlwaysInline.ll index 7539852..bc9787b 100644 --- a/test/Transforms/Inline/2008-11-04-AlwaysInline.ll +++ b/test/Transforms/Inline/2008-11-04-AlwaysInline.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -always-inline | llvm-dis | grep {@foo} +; RUN: opt < %s -always-inline -S | grep {@foo} ; Ensure that foo is not removed by always inliner ; PR 2945 diff --git a/test/Transforms/Inline/2009-01-08-NoInlineDynamicAlloca.ll b/test/Transforms/Inline/2009-01-08-NoInlineDynamicAlloca.ll index 14840ba..db2a799 100644 --- a/test/Transforms/Inline/2009-01-08-NoInlineDynamicAlloca.ll +++ b/test/Transforms/Inline/2009-01-08-NoInlineDynamicAlloca.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline | llvm-dis | grep call +; RUN: opt < %s -inline -S | grep call ; Do not inline calls to variable-sized alloca. @q = common global i8* null ; <i8**> [#uses=1] diff --git a/test/Transforms/Inline/2009-01-12-RecursiveInline.ll b/test/Transforms/Inline/2009-01-12-RecursiveInline.ll index 8a4b2e0..1a3325a 100644 --- a/test/Transforms/Inline/2009-01-12-RecursiveInline.ll +++ b/test/Transforms/Inline/2009-01-12-RecursiveInline.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline | llvm-dis | grep {call.*fib} | count 4 +; RUN: opt < %s -inline -S | grep {call.*fib} | count 4 ; First call to fib from fib is inlined, producing 2 instead of 1, total 3. ; Second call to fib from fib is not inlined because new body of fib exceeds ; inlining limit of 200. Plus call in main = 4 total. diff --git a/test/Transforms/Inline/2009-01-13-RecursiveInlineCrash.ll b/test/Transforms/Inline/2009-01-13-RecursiveInlineCrash.ll index 3702afa..7d8d16b 100644 --- a/test/Transforms/Inline/2009-01-13-RecursiveInlineCrash.ll +++ b/test/Transforms/Inline/2009-01-13-RecursiveInlineCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -argpromotion -disable-output +; RUN: opt < %s -inline -argpromotion -disable-output ; ModuleID = '<stdin>' 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-f80:128:128" target triple = "i386-apple-darwin9.6" diff --git a/test/Transforms/Inline/2009-05-07-CallUsingSelfCrash.ll b/test/Transforms/Inline/2009-05-07-CallUsingSelfCrash.ll index 067fd72e..c8629ea 100644 --- a/test/Transforms/Inline/2009-05-07-CallUsingSelfCrash.ll +++ b/test/Transforms/Inline/2009-05-07-CallUsingSelfCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -disable-output +; RUN: opt < %s -inline -disable-output ; PR4123 %struct.S0 = type <{ i32 }> %struct.S1 = type <{ i8, i8, i8, i8, %struct.S0 }> diff --git a/test/Transforms/Inline/PR4909.ll b/test/Transforms/Inline/PR4909.ll new file mode 100644 index 0000000..24545f9 --- /dev/null +++ b/test/Transforms/Inline/PR4909.ll @@ -0,0 +1,15 @@ +; RUN: opt < %s -partial-inliner -disable-output + +define i32 @f() { +entry: + br label %return + +return: ; preds = %entry + ret i32 undef +} + +define i32 @g() { +entry: + %0 = call i32 @f() + ret i32 %0 +} diff --git a/test/Transforms/Inline/alloca-in-scc.ll b/test/Transforms/Inline/alloca-in-scc.ll new file mode 100644 index 0000000..d539255 --- /dev/null +++ b/test/Transforms/Inline/alloca-in-scc.ll @@ -0,0 +1,31 @@ +; RUN: opt < %s -inline | llvm-dis + +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-f80:128:128" +target triple = "i386-apple-darwin10.0" + +define i32 @main(i32 %argc, i8** %argv) nounwind ssp { +entry: + call fastcc void @c() nounwind + unreachable +} + +define internal fastcc void @a() nounwind ssp { +entry: + %al = alloca [3 x i32], align 4 + %0 = getelementptr inbounds [3 x i32]* %al, i32 0, i32 2 + + call fastcc void @c() nounwind + unreachable +} + +define internal fastcc void @b() nounwind ssp { +entry: + tail call fastcc void @a() nounwind ssp + unreachable +} + +define internal fastcc void @c() nounwind ssp { +entry: + call fastcc void @b() nounwind + unreachable +} diff --git a/test/Transforms/Inline/alloca_test.ll b/test/Transforms/Inline/alloca_test.ll index 1fbd095..e5791d5 100644 --- a/test/Transforms/Inline/alloca_test.ll +++ b/test/Transforms/Inline/alloca_test.ll @@ -1,7 +1,7 @@ ; This test ensures that alloca instructions in the entry block for an inlined ; function are moved to the top of the function they are inlined into. ; -; RUN: llvm-as < %s | opt -inline | llvm-dis | %prcontext alloca 1 | grep Entry: +; RUN: opt -S -inline %s | FileCheck %s define i32 @func(i32 %i) { %X = alloca i32 ; <i32*> [#uses=1] @@ -13,6 +13,8 @@ declare void @bar() define i32 @main(i32 %argc) { Entry: +; CHECK: Entry +; CHECK-NEXT: alloca call void @bar( ) %X = call i32 @func( i32 7 ) ; <i32> [#uses=1] %Y = add i32 %X, %argc ; <i32> [#uses=1] diff --git a/test/Transforms/Inline/always_inline_dyn_alloca.ll b/test/Transforms/Inline/always_inline_dyn_alloca.ll index 933925e..25cfc49 100644 --- a/test/Transforms/Inline/always_inline_dyn_alloca.ll +++ b/test/Transforms/Inline/always_inline_dyn_alloca.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep callee +; RUN: opt < %s -inline -S | not grep callee ; rdar://6655932 ; If callee is marked alwaysinline, inline it! Even if callee has dynamic diff --git a/test/Transforms/Inline/array_merge.ll b/test/Transforms/Inline/array_merge.ll new file mode 100644 index 0000000..0d176b8 --- /dev/null +++ b/test/Transforms/Inline/array_merge.ll @@ -0,0 +1,26 @@ +; RUN: opt < %s -inline -S | FileCheck %s +; rdar://7173846 +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-f80:128:128" +target triple = "i386-apple-darwin10.0" + +define internal void @foo() nounwind ssp { +entry: + %A = alloca [100 x i32] + %B = alloca [100 x i32] + call void @bar([100 x i32]* %A, [100 x i32]* %B) nounwind + ret void +} + +declare void @bar([100 x i32]*, [100 x i32]*) + +define void @test() nounwind ssp { +entry: +; CHECK: @test() +; CHECK-NEXT: entry: +; CHECK-NEXT: %A.i = alloca +; CHECK-NEXT: %B.i = alloca +; CHECK-NEXT: call void + call void @foo() nounwind + call void @foo() nounwind + ret void +} diff --git a/test/Transforms/Inline/basictest.ll b/test/Transforms/Inline/basictest.ll index d954238..71e00cb 100644 --- a/test/Transforms/Inline/basictest.ll +++ b/test/Transforms/Inline/basictest.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -disable-output -print-function 2> /dev/null +; RUN: opt < %s -inline -disable-output -print-function 2> /dev/null define i32 @func(i32 %i) { ret i32 %i diff --git a/test/Transforms/Inline/byval.ll b/test/Transforms/Inline/byval.ll index ea8c357..c3552f6 100644 --- a/test/Transforms/Inline/byval.ll +++ b/test/Transforms/Inline/byval.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline | llvm-dis | grep {llvm.memcpy} +; RUN: opt < %s -inline -S | grep {llvm.memcpy} ; Inlining a byval struct should cause an explicit copy into an alloca. diff --git a/test/Transforms/Inline/byval2.ll b/test/Transforms/Inline/byval2.ll index e949d01..a7ab77c 100644 --- a/test/Transforms/Inline/byval2.ll +++ b/test/Transforms/Inline/byval2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep {llvm.memcpy} +; RUN: opt < %s -inline -S | not grep {llvm.memcpy} ; Inlining a byval struct should NOT cause an explicit copy ; into an alloca if the function is readonly diff --git a/test/Transforms/Inline/callgraph-update.ll b/test/Transforms/Inline/callgraph-update.ll new file mode 100644 index 0000000..528e9af --- /dev/null +++ b/test/Transforms/Inline/callgraph-update.ll @@ -0,0 +1,33 @@ +; RUN: opt < %s -inline -loop-rotate | llvm-dis +; PR3601 +declare void @solve() + +define internal fastcc void @read() { + br label %bb4 + +bb3: + br label %bb4 + +bb4: + call void @solve() + br i1 false, label %bb5, label %bb3 + +bb5: + unreachable +} + +define internal fastcc void @parse() { + call fastcc void @read() + ret void +} + +define void @main() { + invoke fastcc void @parse() + to label %invcont unwind label %lpad + +invcont: + unreachable + +lpad: + unreachable +} diff --git a/test/Transforms/Inline/casts.ll b/test/Transforms/Inline/casts.ll index 029d309..166185a 100644 --- a/test/Transforms/Inline/casts.ll +++ b/test/Transforms/Inline/casts.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline | llvm-dis | grep {ret i32 1} +; RUN: opt < %s -inline -S | grep {ret i32 1} ; ModuleID = 'short.opt.bc' define i32 @testBool(i1 %X) { diff --git a/test/Transforms/Inline/cfg_preserve_test.ll b/test/Transforms/Inline/cfg_preserve_test.ll index 6b6ff18..9597109 100644 --- a/test/Transforms/Inline/cfg_preserve_test.ll +++ b/test/Transforms/Inline/cfg_preserve_test.ll @@ -1,6 +1,6 @@ ; This test ensures that inlining an "empty" function does not destroy the CFG ; -; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep br +; RUN: opt < %s -inline -S | not grep br define i32 @func(i32 %i) { ret i32 %i diff --git a/test/Transforms/Inline/crash.ll b/test/Transforms/Inline/crash.ll new file mode 100644 index 0000000..30eae7a --- /dev/null +++ b/test/Transforms/Inline/crash.ll @@ -0,0 +1,57 @@ +; RUN: opt < %s -inline -argpromotion -instcombine -disable-output + +; This test was failing because the inliner would inline @list_DeleteElement +; into @list_DeleteDuplicates and then into @inf_GetBackwardPartnerLits, +; turning the indirect call into a direct one. This allowed instcombine to see +; the bitcast and eliminate it, deleting the original call and introducing +; another one. This crashed the inliner because the new call was not in the +; callgraph. + +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-f80:128:128" +target triple = "i386-apple-darwin10.0" + + +define void @list_DeleteElement(i32 (i8*, i8*)* nocapture %Test) nounwind ssp { +entry: + %0 = call i32 %Test(i8* null, i8* undef) nounwind + ret void +} + + +define void @list_DeleteDuplicates(i32 (i8*, i8*)* nocapture %Test) nounwind ssp { +foo: + call void @list_DeleteElement(i32 (i8*, i8*)* %Test) nounwind ssp + call fastcc void @list_Rplacd1284() nounwind ssp + unreachable + +} + +define internal i32 @inf_LiteralsHaveSameSubtermAndAreFromSameClause(i32* nocapture %L1, i32* nocapture %L2) nounwind readonly ssp { +entry: + unreachable +} + + +define internal fastcc void @inf_GetBackwardPartnerLits(i32* nocapture %Flags) nounwind ssp { +test: + call void @list_DeleteDuplicates(i32 (i8*, i8*)* bitcast (i32 (i32*, i32*)* @inf_LiteralsHaveSameSubtermAndAreFromSameClause to i32 (i8*, i8*)*)) nounwind + ret void +} + + +define void @inf_BackwardEmptySortPlusPlus() nounwind ssp { +entry: + call fastcc void @inf_GetBackwardPartnerLits(i32* null) nounwind ssp + unreachable +} + +define void @inf_BackwardWeakening() nounwind ssp { +entry: + call fastcc void @inf_GetBackwardPartnerLits(i32* null) nounwind ssp + unreachable +} + + + + +declare fastcc void @list_Rplacd1284() nounwind ssp diff --git a/test/Transforms/Inline/dynamic_alloca_test.ll b/test/Transforms/Inline/dynamic_alloca_test.ll index b8ff7de..0286535 100644 --- a/test/Transforms/Inline/dynamic_alloca_test.ll +++ b/test/Transforms/Inline/dynamic_alloca_test.ll @@ -3,9 +3,9 @@ ; Functions with dynamic allocas can only be inlined into functions that ; already have dynamic allocas. -; RUN: llvm-as < %s | opt -inline | llvm-dis | \ +; RUN: opt < %s -inline -S | \ ; RUN: grep llvm.stacksave -; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep callee +; RUN: opt < %s -inline -S | not grep callee declare void @ext(i32*) diff --git a/test/Transforms/Inline/externally_available.ll b/test/Transforms/Inline/externally_available.ll index 68f7d65..43fe5d3 100644 --- a/test/Transforms/Inline/externally_available.ll +++ b/test/Transforms/Inline/externally_available.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -constprop | llvm-dis > %t +; RUN: opt < %s -inline -constprop -S > %t ; RUN: not grep test_function %t ; RUN: grep {ret i32 5} %t diff --git a/test/Transforms/Inline/indirect_resolve.ll b/test/Transforms/Inline/indirect_resolve.ll new file mode 100644 index 0000000..76182e2 --- /dev/null +++ b/test/Transforms/Inline/indirect_resolve.ll @@ -0,0 +1,16 @@ +; RUN: opt < %s -inline | llvm-dis +; PR4834 + +define i32 @main() { + %funcall1_ = call fastcc i32 ()* ()* @f1() + %executecommandptr1_ = call i32 %funcall1_() + ret i32 %executecommandptr1_ +} + +define internal fastcc i32 ()* @f1() nounwind readnone { + ret i32 ()* @f2 +} + +define internal i32 @f2() nounwind readnone { + ret i32 1 +} diff --git a/test/Transforms/Inline/inline-invoke-tail.ll b/test/Transforms/Inline/inline-invoke-tail.ll index 53f755e..961f678 100644 --- a/test/Transforms/Inline/inline-invoke-tail.ll +++ b/test/Transforms/Inline/inline-invoke-tail.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep {tail call void @llvm.memcpy.i32} +; RUN: opt < %s -inline -S | not grep {tail call void @llvm.memcpy.i32} ; PR3550 define internal void @foo(i32* %p, i32* %q) { diff --git a/test/Transforms/Inline/inline-tail.ll b/test/Transforms/Inline/inline-tail.ll index 5921655..8bb059d 100644 --- a/test/Transforms/Inline/inline-tail.ll +++ b/test/Transforms/Inline/inline-tail.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep tail +; RUN: opt < %s -inline -S | not grep tail declare void @bar(i32*) diff --git a/test/Transforms/Inline/inline_cleanup.ll b/test/Transforms/Inline/inline_cleanup.ll index 89b3a82..4c64721 100644 --- a/test/Transforms/Inline/inline_cleanup.ll +++ b/test/Transforms/Inline/inline_cleanup.ll @@ -1,9 +1,9 @@ ; Test that the inliner doesn't leave around dead allocas, and that it folds ; uncond branches away after it is done specializing. -; RUN: llvm-as < %s | opt -inline | llvm-dis | \ +; RUN: opt < %s -inline -S | \ ; RUN: not grep {alloca.*uses=0} -; RUN: llvm-as < %s | opt -inline | llvm-dis | \ +; RUN: opt < %s -inline -S | \ ; RUN: not grep {br label} @A = weak global i32 0 ; <i32*> [#uses=1] @B = weak global i32 0 ; <i32*> [#uses=1] diff --git a/test/Transforms/Inline/inline_constprop.ll b/test/Transforms/Inline/inline_constprop.ll index 4744c86..537c69b 100644 --- a/test/Transforms/Inline/inline_constprop.ll +++ b/test/Transforms/Inline/inline_constprop.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep callee -; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep div +; RUN: opt < %s -inline -S | not grep callee +; RUN: opt < %s -inline -S | not grep div define internal i32 @callee(i32 %A, i32 %B) { diff --git a/test/Transforms/Inline/inline_dce.ll b/test/Transforms/Inline/inline_dce.ll index dd971be..5143d02 100644 --- a/test/Transforms/Inline/inline_dce.ll +++ b/test/Transforms/Inline/inline_dce.ll @@ -1,7 +1,7 @@ ; This checks to ensure that the inline pass deletes functions if they get ; inlined into all of their callers. -; RUN: llvm-as < %s | opt -inline | llvm-dis | \ +; RUN: opt < %s -inline -S | \ ; RUN: not grep @reallysmall define internal i32 @reallysmall(i32 %A) { diff --git a/test/Transforms/Inline/inline_prune.ll b/test/Transforms/Inline/inline_prune.ll index fcd8321..658a422 100644 --- a/test/Transforms/Inline/inline_prune.ll +++ b/test/Transforms/Inline/inline_prune.ll @@ -1,6 +1,6 @@ -; RUN: llvm-as < %s | opt -inline | llvm-dis | \ +; RUN: opt < %s -inline -S | \ ; RUN: not grep {callee\[12\](} -; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep mul +; RUN: opt < %s -inline -S | not grep mul define internal i32 @callee1(i32 %A, i32 %B) { %cond = icmp eq i32 %A, 123 ; <i1> [#uses=1] diff --git a/test/Transforms/Inline/invoke_test-1.ll b/test/Transforms/Inline/invoke_test-1.ll index 1fd3317..0d27e2a 100644 --- a/test/Transforms/Inline/invoke_test-1.ll +++ b/test/Transforms/Inline/invoke_test-1.ll @@ -1,7 +1,7 @@ ; Test that we can inline a simple function, turning the calls in it into invoke ; instructions -; RUN: llvm-as < %s | opt -inline | llvm-dis | \ +; RUN: opt < %s -inline -S | \ ; RUN: not grep {call\[^e\]} declare void @might_throw() diff --git a/test/Transforms/Inline/invoke_test-2.ll b/test/Transforms/Inline/invoke_test-2.ll index 68b8bd8..bbb9ab0 100644 --- a/test/Transforms/Inline/invoke_test-2.ll +++ b/test/Transforms/Inline/invoke_test-2.ll @@ -1,7 +1,7 @@ ; Test that if an invoked function is inlined, and if that function cannot ; throw, that the dead handler is now unreachable. -; RUN: llvm-as < %s | opt -inline -simplifycfg | llvm-dis | \ +; RUN: opt < %s -inline -simplifycfg -S | \ ; RUN: not grep UnreachableExceptionHandler declare void @might_throw() diff --git a/test/Transforms/Inline/invoke_test-3.ll b/test/Transforms/Inline/invoke_test-3.ll index a5deec6..b360526 100644 --- a/test/Transforms/Inline/invoke_test-3.ll +++ b/test/Transforms/Inline/invoke_test-3.ll @@ -1,7 +1,7 @@ ; Test that any rethrown exceptions in an inlined function are automatically ; turned into branches to the invoke destination. -; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep unwind$ +; RUN: opt < %s -inline -S | not grep unwind$ declare void @might_throw() diff --git a/test/Transforms/Inline/nested-inline.ll b/test/Transforms/Inline/nested-inline.ll new file mode 100644 index 0000000..1292667 --- /dev/null +++ b/test/Transforms/Inline/nested-inline.ll @@ -0,0 +1,111 @@ +; RUN: opt < %s -inline -S | FileCheck %s +; Test that bar and bar2 are both inlined throughout and removed. +@A = weak global i32 0 ; <i32*> [#uses=1] +@B = weak global i32 0 ; <i32*> [#uses=1] +@C = weak global i32 0 ; <i32*> [#uses=1] + +define fastcc void @foo(i32 %X) { +entry: +; CHECK: @foo + %ALL = alloca i32, align 4 ; <i32*> [#uses=1] + %tmp1 = and i32 %X, 1 ; <i32> [#uses=1] + %tmp1.upgrd.1 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1] + br i1 %tmp1.upgrd.1, label %cond_next, label %cond_true + +cond_true: ; preds = %entry + store i32 1, i32* @A + br label %cond_next + +cond_next: ; preds = %cond_true, %entry + %tmp4 = and i32 %X, 2 ; <i32> [#uses=1] + %tmp4.upgrd.2 = icmp eq i32 %tmp4, 0 ; <i1> [#uses=1] + br i1 %tmp4.upgrd.2, label %cond_next7, label %cond_true5 + +cond_true5: ; preds = %cond_next + store i32 1, i32* @B + br label %cond_next7 + +cond_next7: ; preds = %cond_true5, %cond_next + %tmp10 = and i32 %X, 4 ; <i32> [#uses=1] + %tmp10.upgrd.3 = icmp eq i32 %tmp10, 0 ; <i1> [#uses=1] + br i1 %tmp10.upgrd.3, label %cond_next13, label %cond_true11 + +cond_true11: ; preds = %cond_next7 + store i32 1, i32* @C + br label %cond_next13 + +cond_next13: ; preds = %cond_true11, %cond_next7 + %tmp16 = and i32 %X, 8 ; <i32> [#uses=1] + %tmp16.upgrd.4 = icmp eq i32 %tmp16, 0 ; <i1> [#uses=1] + br i1 %tmp16.upgrd.4, label %UnifiedReturnBlock, label %cond_true17 + +cond_true17: ; preds = %cond_next13 + call void @ext( i32* %ALL ) + ret void + +UnifiedReturnBlock: ; preds = %cond_next13 + ret void +} + +; CHECK-NOT: @bar +define internal fastcc void @bar(i32 %X) { +entry: + %ALL = alloca i32, align 4 ; <i32*> [#uses=1] + %tmp1 = and i32 %X, 1 ; <i32> [#uses=1] + %tmp1.upgrd.1 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1] + br i1 %tmp1.upgrd.1, label %cond_next, label %cond_true + +cond_true: ; preds = %entry + store i32 1, i32* @A + br label %cond_next + +cond_next: ; preds = %cond_true, %entry + %tmp4 = and i32 %X, 2 ; <i32> [#uses=1] + %tmp4.upgrd.2 = icmp eq i32 %tmp4, 0 ; <i1> [#uses=1] + br i1 %tmp4.upgrd.2, label %cond_next7, label %cond_true5 + +cond_true5: ; preds = %cond_next + store i32 1, i32* @B + br label %cond_next7 + +cond_next7: ; preds = %cond_true5, %cond_next + %tmp10 = and i32 %X, 4 ; <i32> [#uses=1] + %tmp10.upgrd.3 = icmp eq i32 %tmp10, 0 ; <i1> [#uses=1] + br i1 %tmp10.upgrd.3, label %cond_next13, label %cond_true11 + +cond_true11: ; preds = %cond_next7 + store i32 1, i32* @C + br label %cond_next13 + +cond_next13: ; preds = %cond_true11, %cond_next7 + %tmp16 = and i32 %X, 8 ; <i32> [#uses=1] + %tmp16.upgrd.4 = icmp eq i32 %tmp16, 0 ; <i1> [#uses=1] + br i1 %tmp16.upgrd.4, label %UnifiedReturnBlock, label %cond_true17 + +cond_true17: ; preds = %cond_next13 + call void @foo( i32 %X ) + ret void + +UnifiedReturnBlock: ; preds = %cond_next13 + ret void +} + +define internal fastcc void @bar2(i32 %X) { +entry: + call void @foo( i32 %X ) + ret void +} + +declare void @ext(i32*) + +define void @test(i32 %X) { +entry: +; CHECK: test +; CHECK-NOT: @bar + tail call fastcc void @bar( i32 %X ) + tail call fastcc void @bar( i32 %X ) + tail call fastcc void @bar2( i32 %X ) + tail call fastcc void @bar2( i32 %X ) + ret void +; CHECK: ret +} |