From 30815c536baacc07e925f0aef23a5395883173dc Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 20 Oct 2011 21:10:27 +0000 Subject: Vendor import of llvm release_30 branch r142614: http://llvm.org/svn/llvm-project/llvm/branches/release_30@142614 --- test/Transforms/ADCE/2003-09-10-UnwindInstFail.ll | 5 +- .../Transforms/ADCE/2004-05-04-UnreachableBlock.ll | 2 +- .../Transforms/ADCE/2005-02-17-PHI-Invoke-Crash.ll | 9 +- test/Transforms/ADCE/dce_pure_invoke.ll | 4 + .../CodeExtractor/2004-03-18-InvokeHandling.ll | 4 + .../CodeExtractor/2004-11-12-InvokeExtract.ll | 5 +- test/Transforms/ConstantMerge/merge-both.ll | 17 +- .../DeadArgElim/2009-03-17-MRE-Invoke.ll | 6 + test/Transforms/DeadArgElim/deadexternal.ll | 2 +- .../2011-09-06-EndOfFunction.ll | 27 + .../DeadStoreElimination/2011-09-06-MemCpy.ll | 85 ++ test/Transforms/DeadStoreElimination/atomic.ll | 107 +++ test/Transforms/DeadStoreElimination/simple.ll | 8 +- test/Transforms/EarlyCSE/basic.ll | 10 +- .../FunctionAttrs/2008-12-31-NoCapture.ll | 4 + test/Transforms/FunctionAttrs/atomic.ll | 21 + test/Transforms/GVN/2010-05-08-OneBit.ll | 4 + test/Transforms/GVN/2011-09-07-TypeIdFor.ll | 81 ++ test/Transforms/GVN/atomic.ll | 80 ++ test/Transforms/GVN/condprop.ll | 83 +- test/Transforms/GVN/phi-translate.ll | 2 +- test/Transforms/GVN/pr10820.ll | 18 + .../GlobalOpt/2008-01-29-VolatileGlobal.ll | 2 +- test/Transforms/IPConstantProp/global.ll | 26 + test/Transforms/IPConstantProp/return-argument.ll | 10 +- test/Transforms/IPConstantProp/return-constant.ll | 4 + .../IndVarSimplify/2003-09-12-MultiplePred.ll | 15 - .../IndVarSimplify/2003-12-21-IndVarSize.ll | 15 - .../IndVarSimplify/2004-04-05-InvokeCastCrash.ll | 8 + .../IndVarSimplify/2005-02-11-InvokeCrash.ll | 10 +- .../IndVarSimplify/2005-02-17-TruncateExprCrash.ll | 6 + .../IndVarSimplify/2009-04-14-shorten_iv_vars.ll | 2 +- .../IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll | 2 +- .../IndVarSimplify/2011-09-10-widen-nsw.ll | 30 + .../IndVarSimplify/2011-09-19-vectoriv.ll | 16 + .../IndVarSimplify/2011-09-27-hoistsext.ll | 28 + test/Transforms/IndVarSimplify/ada-loops.ll | 9 +- test/Transforms/IndVarSimplify/addrec-gep.ll | 12 +- test/Transforms/IndVarSimplify/ashr-tripcount.ll | 2 +- test/Transforms/IndVarSimplify/complex-scev.ll | 4 +- test/Transforms/IndVarSimplify/crash.ll | 34 + test/Transforms/IndVarSimplify/elim-extend.ll | 2 +- .../Transforms/IndVarSimplify/floating-point-iv.ll | 8 +- .../Transforms/IndVarSimplify/gep-with-mul-base.ll | 17 +- .../IndVarSimplify/interesting-invoke-use.ll | 4 + test/Transforms/IndVarSimplify/iv-fold.ll | 56 ++ test/Transforms/IndVarSimplify/iv-sext.ll | 2 +- test/Transforms/IndVarSimplify/iv-zext.ll | 4 +- test/Transforms/IndVarSimplify/lftr-reuse.ll | 230 ++++++ test/Transforms/IndVarSimplify/max-pointer.ll | 39 - test/Transforms/IndVarSimplify/no-iv-rewrite.ll | 84 +- test/Transforms/IndVarSimplify/pointer-indvars.ll | 15 - test/Transforms/IndVarSimplify/pointer.ll | 38 - .../IndVarSimplify/preserve-gep-loop-variant.ll | 10 +- .../IndVarSimplify/preserve-gep-nested.ll | 23 +- .../IndVarSimplify/preserve-gep-remainder.ll | 6 +- test/Transforms/IndVarSimplify/preserve-gep.ll | 10 +- .../IndVarSimplify/preserve-signed-wrap.ll | 2 +- test/Transforms/IndVarSimplify/subtract.ll | 15 - .../IndVarSimplify/variable-stride-ivs-0.ll | 2 +- test/Transforms/Inline/2003-09-14-InlineValue.ll | 4 + .../Inline/2003-09-22-PHINodesInExceptionDest.ll | 9 +- .../2003-10-26-InlineInvokeExceptionDestPhi.ll | 20 - .../Inline/2004-04-15-InlineDeletesCall.ll | 2 +- .../2004-10-17-InlineFunctionWithoutReturn.ll | 2 +- .../Inline/2006-11-09-InlineCGUpdate-2.ll | 20 +- .../Transforms/Inline/2006-11-09-InlineCGUpdate.ll | 12 +- test/Transforms/Inline/2007-04-15-InlineEH.ll | 6 +- .../Transforms/Inline/2007-12-19-InlineNoUnwind.ll | 2 +- test/Transforms/Inline/callgraph-update.ll | 3 + test/Transforms/Inline/crash.ll | 10 +- test/Transforms/Inline/inline_invoke.ll | 122 +-- test/Transforms/Inline/invoke_test-1.ll | 4 + test/Transforms/Inline/invoke_test-2.ll | 6 + test/Transforms/Inline/invoke_test-3.ll | 8 +- .../InstCombine/2003-10-29-CallSiteResolve.ll | 3 + .../InstCombine/2004-01-13-InstCombineInvokePHI.ll | 3 + .../InstCombine/2008-01-14-VarArgTrampoline.ll | 6 +- .../InstCombine/2008-04-28-VolatileStore.ll | 2 +- .../2008-04-29-VolatileLoadDontMerge.ll | 2 +- .../InstCombine/2008-04-29-VolatileLoadMerge.ll | 2 +- .../InstCombine/2008-05-09-SinkOfInvoke.ll | 4 + .../InstCombine/2008-07-08-VolatileLoadMerge.ll | 2 +- .../InstCombine/2011-09-03-Trampoline.ll | 87 ++ .../InstCombine/2011-10-07-AlignPromotion.ll | 20 + test/Transforms/InstCombine/LandingPadClauses.ll | 181 +++++ test/Transforms/InstCombine/and2.ll | 7 + test/Transforms/InstCombine/atomic.ll | 24 + test/Transforms/InstCombine/bitcast.ll | 34 + test/Transforms/InstCombine/call.ll | 20 +- test/Transforms/InstCombine/canonicalize_branch.ll | 31 +- test/Transforms/InstCombine/cast.ll | 47 ++ test/Transforms/InstCombine/crash.ll | 4 + test/Transforms/InstCombine/deadcode.ll | 11 +- test/Transforms/InstCombine/devirt.ll | 39 + test/Transforms/InstCombine/extractvalue.ll | 2 +- test/Transforms/InstCombine/fcmp.ll | 11 + test/Transforms/InstCombine/getelementptr.ll | 20 + test/Transforms/InstCombine/intrinsics.ll | 12 +- test/Transforms/InstCombine/malloc-free-delete.ll | 25 +- test/Transforms/InstCombine/nsw.ll | 44 + test/Transforms/InstCombine/ptr-int-cast.ll | 14 +- test/Transforms/InstCombine/select.ll | 10 + test/Transforms/InstCombine/shift.ll | 19 +- test/Transforms/InstCombine/vec_demanded_elts.ll | 11 + test/Transforms/InstCombine/vector-casts.ll | 2 +- test/Transforms/InstCombine/volatile_store.ll | 4 +- .../InstSimplify/2011-09-05-InsertExtractValue.ll | 29 + test/Transforms/InstSimplify/compare.ll | 11 - .../JumpThreading/no-irreducible-loops.ll | 2 +- test/Transforms/LCSSA/invoke-dest.ll | 8 + test/Transforms/LICM/2007-05-22-VolatileSink.ll | 2 +- .../LICM/2011-04-06-HoistMissedASTUpdate.ll | 2 +- test/Transforms/LICM/atomics.ll | 79 ++ test/Transforms/LICM/scalar-promote-memmodel.ll | 37 + test/Transforms/LICM/scalar_promote.ll | 2 +- test/Transforms/LoopDeletion/2008-05-06-Phi.ll | 2 +- test/Transforms/LoopIdiom/basic.ll | 4 +- .../LoopSimplify/2003-08-15-PreheadersFail.ll | 2 +- .../LoopSimplify/2007-10-28-InvokeCrash.ll | 887 +-------------------- test/Transforms/LoopSimplify/merge-exits.ll | 2 +- test/Transforms/LoopSimplify/preserve-scev.ll | 88 ++ test/Transforms/LoopSimplify/single-backedge.ll | 9 +- .../2011-07-19-CritEdgeBreakCrash.ll | 52 ++ .../LoopStrengthReduce/2011-07-20-DoubleIV.ll | 43 + .../LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll | 43 + .../LoopStrengthReduce/2011-10-06-ReusePhi.ll | 53 ++ .../LoopStrengthReduce/2011-10-13-SCEVChain.ll | 111 +++ .../LoopStrengthReduce/2011-10-14-IntPtr.ll | 27 + .../LoopStrengthReduce/invariant_value_first.ll | 2 +- .../invariant_value_first_arg.ll | 2 +- .../LoopStrengthReduce/ops_after_indvar.ll | 2 +- .../LoopStrengthReduce/post-inc-icmpzero.ll | 14 +- .../var_stride_used_by_compare.ll | 2 +- test/Transforms/LoopUnroll/2011-08-08-PhiUpdate.ll | 103 +++ .../Transforms/LoopUnroll/2011-08-09-IVSimplify.ll | 41 + test/Transforms/LoopUnroll/2011-08-09-PhiUpdate.ll | 62 ++ test/Transforms/LoopUnroll/2011-10-01-NoopTrunc.ll | 36 + test/Transforms/LoopUnroll/pr10813.ll | 29 + test/Transforms/LoopUnroll/scevunroll.ll | 172 ++++ test/Transforms/LoopUnroll/unloop.ll | 429 ++++++++++ test/Transforms/LoopUnswitch/2011-09-26-EHCrash.ll | 67 ++ test/Transforms/LowerAtomic/atomic-load.ll | 10 +- test/Transforms/LowerAtomic/atomic-swap.ll | 7 +- test/Transforms/LowerAtomic/barrier.ll | 4 +- .../LowerSetJmp/2003-11-05-DominanceProperties.ll | 16 - test/Transforms/LowerSetJmp/dg.exp | 3 - test/Transforms/LowerSetJmp/simpletest.ll | 31 - .../Mem2Reg/2007-08-27-VolatileLoadsStores.ll | 2 +- test/Transforms/Mem2Reg/atomic.ll | 12 + test/Transforms/Mem2Reg/crash.ll | 3 + test/Transforms/MemCpyOpt/atomic.ll | 41 + test/Transforms/ObjCARC/basic.ll | 110 ++- test/Transforms/ObjCARC/cfg-hazards.ll | 329 +++++++- test/Transforms/ObjCARC/contract-storestrong.ll | 4 +- test/Transforms/ObjCARC/empty-block.ll | 59 ++ test/Transforms/ObjCARC/invoke.ll | 6 + test/Transforms/ObjCARC/nested.ll | 620 ++++++++++++++ test/Transforms/ObjCARC/retain-block-alloca.ll | 54 ++ .../ObjCARC/retain-block-side-effects.ll | 39 + test/Transforms/ObjCARC/retain-not-declared.ll | 54 +- test/Transforms/ObjCARC/rv.ll | 11 + .../PhaseOrdering/2010-03-22-empty-baseclass.ll | 162 ++++ test/Transforms/PruneEH/2003-09-14-ExternalCall.ll | 3 + test/Transforms/SCCP/2003-08-26-InvokeHandling.ll | 9 +- test/Transforms/SCCP/2004-11-16-DeadInvoke.ll | 9 +- test/Transforms/SCCP/2007-05-16-InvokeCrash.ll | 6 +- test/Transforms/SCCP/2009-01-14-IPSCCP-Invoke.ll | 2 + test/Transforms/SCCP/atomic-load-store.ll | 30 + test/Transforms/SCCP/ipsccp-basic.ll | 23 + test/Transforms/SCCP/switch.ll | 13 + test/Transforms/SCCP/undef-resolve.ll | 66 ++ .../ScalarRepl/2003-10-29-ArrayProblem.ll | 2 +- .../ScalarRepl/2011-09-22-PHISpeculateInvoke.ll | 40 + .../ScalarRepl/2011-10-11-VectorMemset.ll | 22 + test/Transforms/ScalarRepl/lifetime.ll | 139 ++++ test/Transforms/ScalarRepl/vector_promote.ll | 170 +--- .../ScalarRepl/vectors-with-mismatched-elements.ll | 27 + test/Transforms/ScalarRepl/volatile.ll | 4 +- .../SimplifyCFG/2003-08-05-InvokeCrash.ll | 3 + .../SimplifyCFG/2003-08-05-MishandleInvoke.ll | 3 + .../SimplifyCFG/2005-10-02-InvokeSimplify.ll | 3 + .../SimplifyCFG/2006-10-29-InvokeCrash.ll | 14 +- ...2009-01-19-UnconditionalTrappingConstantExpr.ll | 4 +- .../SimplifyCFG/2009-06-15-InvokeCrash.ll | 14 +- .../SimplifyCFG/2010-03-30-InvokeCrash.ll | 6 +- .../SimplifyCFG/2011-09-05-TrivialLPad.ll | 22 + test/Transforms/SimplifyCFG/BrUnwind.ll | 2 +- test/Transforms/SimplifyCFG/invoke_unwind.ll | 20 +- test/Transforms/SimplifyCFG/phi-undef-loadstore.ll | 87 ++ .../SimplifyCFG/trapping-load-unreachable.ll | 51 +- test/Transforms/SimplifyLibCalls/StrCmp.ll | 73 +- test/Transforms/SimplifyLibCalls/StrNCmp.ll | 95 ++- test/Transforms/SimplifyLibCalls/memcmp.ll | 22 +- test/Transforms/SimplifyLibCalls/pow-to-sqrt.ll | 12 +- test/Transforms/Sink/basic.ll | 16 + test/Transforms/StripSymbols/block-address.ll | 23 + test/Transforms/TailCallElim/dont_reorder_load.ll | 2 +- test/Transforms/TailCallElim/reorder_load.ll | 4 +- test/Transforms/TailCallElim/setjmp.ll | 19 +- test/Transforms/TailDup/2003-06-24-Simpleloop.ll | 15 - test/Transforms/TailDup/2003-07-22-InfiniteLoop.ll | 11 - .../TailDup/2003-08-23-InvalidatedPointers.ll | 29 - .../TailDup/2003-08-31-UnreachableBlocks.ll | 17 - .../TailDup/2004-04-01-DemoteRegToStack.ll | 20 - test/Transforms/TailDup/2008-05-13-InfiniteLoop.ll | 26 - test/Transforms/TailDup/2009-07-31-phicrash.ll | 14 - test/Transforms/TailDup/MergeTest.ll | 27 - test/Transforms/TailDup/PHIUpdateTest.ll | 16 - test/Transforms/TailDup/X86/if-tail-dup.ll | 49 -- test/Transforms/TailDup/basictest.ll | 20 - test/Transforms/TailDup/basictest2.ll | 15 - 212 files changed, 5802 insertions(+), 1869 deletions(-) create mode 100644 test/Transforms/DeadStoreElimination/2011-09-06-EndOfFunction.ll create mode 100644 test/Transforms/DeadStoreElimination/2011-09-06-MemCpy.ll create mode 100644 test/Transforms/DeadStoreElimination/atomic.ll create mode 100644 test/Transforms/FunctionAttrs/atomic.ll create mode 100644 test/Transforms/GVN/2011-09-07-TypeIdFor.ll create mode 100644 test/Transforms/GVN/atomic.ll create mode 100644 test/Transforms/GVN/pr10820.ll create mode 100644 test/Transforms/IPConstantProp/global.ll delete mode 100644 test/Transforms/IndVarSimplify/2003-09-12-MultiplePred.ll delete mode 100644 test/Transforms/IndVarSimplify/2003-12-21-IndVarSize.ll create mode 100644 test/Transforms/IndVarSimplify/2011-09-10-widen-nsw.ll create mode 100644 test/Transforms/IndVarSimplify/2011-09-19-vectoriv.ll create mode 100644 test/Transforms/IndVarSimplify/2011-09-27-hoistsext.ll create mode 100644 test/Transforms/IndVarSimplify/iv-fold.ll create mode 100644 test/Transforms/IndVarSimplify/lftr-reuse.ll delete mode 100644 test/Transforms/IndVarSimplify/max-pointer.ll delete mode 100644 test/Transforms/IndVarSimplify/pointer-indvars.ll delete mode 100644 test/Transforms/IndVarSimplify/pointer.ll delete mode 100644 test/Transforms/IndVarSimplify/subtract.ll delete mode 100644 test/Transforms/Inline/2003-10-26-InlineInvokeExceptionDestPhi.ll create mode 100644 test/Transforms/InstCombine/2011-09-03-Trampoline.ll create mode 100644 test/Transforms/InstCombine/2011-10-07-AlignPromotion.ll create mode 100644 test/Transforms/InstCombine/LandingPadClauses.ll create mode 100644 test/Transforms/InstCombine/atomic.ll create mode 100644 test/Transforms/InstCombine/devirt.ll create mode 100644 test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll create mode 100644 test/Transforms/LICM/atomics.ll create mode 100644 test/Transforms/LICM/scalar-promote-memmodel.ll create mode 100644 test/Transforms/LoopStrengthReduce/2011-07-19-CritEdgeBreakCrash.ll create mode 100644 test/Transforms/LoopStrengthReduce/2011-07-20-DoubleIV.ll create mode 100644 test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll create mode 100644 test/Transforms/LoopStrengthReduce/2011-10-06-ReusePhi.ll create mode 100644 test/Transforms/LoopStrengthReduce/2011-10-13-SCEVChain.ll create mode 100644 test/Transforms/LoopStrengthReduce/2011-10-14-IntPtr.ll create mode 100644 test/Transforms/LoopUnroll/2011-08-08-PhiUpdate.ll create mode 100644 test/Transforms/LoopUnroll/2011-08-09-IVSimplify.ll create mode 100644 test/Transforms/LoopUnroll/2011-08-09-PhiUpdate.ll create mode 100644 test/Transforms/LoopUnroll/2011-10-01-NoopTrunc.ll create mode 100644 test/Transforms/LoopUnroll/pr10813.ll create mode 100644 test/Transforms/LoopUnroll/scevunroll.ll create mode 100644 test/Transforms/LoopUnroll/unloop.ll create mode 100644 test/Transforms/LoopUnswitch/2011-09-26-EHCrash.ll delete mode 100644 test/Transforms/LowerSetJmp/2003-11-05-DominanceProperties.ll delete mode 100644 test/Transforms/LowerSetJmp/dg.exp delete mode 100644 test/Transforms/LowerSetJmp/simpletest.ll create mode 100644 test/Transforms/Mem2Reg/atomic.ll create mode 100644 test/Transforms/MemCpyOpt/atomic.ll create mode 100644 test/Transforms/ObjCARC/empty-block.ll create mode 100644 test/Transforms/ObjCARC/nested.ll create mode 100644 test/Transforms/ObjCARC/retain-block-alloca.ll create mode 100644 test/Transforms/ObjCARC/retain-block-side-effects.ll create mode 100644 test/Transforms/PhaseOrdering/2010-03-22-empty-baseclass.ll create mode 100644 test/Transforms/SCCP/atomic-load-store.ll create mode 100644 test/Transforms/SCCP/switch.ll create mode 100644 test/Transforms/ScalarRepl/2011-09-22-PHISpeculateInvoke.ll create mode 100644 test/Transforms/ScalarRepl/2011-10-11-VectorMemset.ll create mode 100644 test/Transforms/ScalarRepl/lifetime.ll create mode 100644 test/Transforms/ScalarRepl/vectors-with-mismatched-elements.ll create mode 100644 test/Transforms/SimplifyCFG/2011-09-05-TrivialLPad.ll create mode 100644 test/Transforms/SimplifyCFG/phi-undef-loadstore.ll create mode 100644 test/Transforms/StripSymbols/block-address.ll delete mode 100644 test/Transforms/TailDup/2003-06-24-Simpleloop.ll delete mode 100644 test/Transforms/TailDup/2003-07-22-InfiniteLoop.ll delete mode 100644 test/Transforms/TailDup/2003-08-23-InvalidatedPointers.ll delete mode 100644 test/Transforms/TailDup/2003-08-31-UnreachableBlocks.ll delete mode 100644 test/Transforms/TailDup/2004-04-01-DemoteRegToStack.ll delete mode 100644 test/Transforms/TailDup/2008-05-13-InfiniteLoop.ll delete mode 100644 test/Transforms/TailDup/2009-07-31-phicrash.ll delete mode 100644 test/Transforms/TailDup/MergeTest.ll delete mode 100644 test/Transforms/TailDup/PHIUpdateTest.ll delete mode 100644 test/Transforms/TailDup/X86/if-tail-dup.ll delete mode 100644 test/Transforms/TailDup/basictest.ll delete mode 100644 test/Transforms/TailDup/basictest2.ll (limited to 'test/Transforms') diff --git a/test/Transforms/ADCE/2003-09-10-UnwindInstFail.ll b/test/Transforms/ADCE/2003-09-10-UnwindInstFail.ll index 444ca8ec904b..6bbcfdb67ec5 100644 --- a/test/Transforms/ADCE/2003-09-10-UnwindInstFail.ll +++ b/test/Transforms/ADCE/2003-09-10-UnwindInstFail.ll @@ -8,7 +8,9 @@ then: ; preds = %0 to label %invoke_cont unwind label %invoke_catch invoke_catch: ; preds = %then - unwind + %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + cleanup + resume { i8*, i32 } %exn invoke_cont: ; preds = %then ret void @@ -17,3 +19,4 @@ endif: ; preds = %0 ret void } +declare i32 @__gxx_personality_v0(...) diff --git a/test/Transforms/ADCE/2004-05-04-UnreachableBlock.ll b/test/Transforms/ADCE/2004-05-04-UnreachableBlock.ll index a6a41fd69eff..7ee0f468af0b 100644 --- a/test/Transforms/ADCE/2004-05-04-UnreachableBlock.ll +++ b/test/Transforms/ADCE/2004-05-04-UnreachableBlock.ll @@ -11,6 +11,6 @@ invoke_catch.0: ; No predecessors! br i1 false, label %UnifiedUnwindBlock, label %UnifiedReturnBlock UnifiedUnwindBlock: ; preds = %invoke_catch.0 - unwind + unreachable } 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 991e876a25b7..4ddc2f180a2d 100644 --- a/test/Transforms/ADCE/2005-02-17-PHI-Invoke-Crash.ll +++ b/test/Transforms/ADCE/2005-02-17-PHI-Invoke-Crash.ll @@ -15,17 +15,21 @@ 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 + cleanup invoke void @q_atomic_decrement( ) to label %tmp.1.i.i183.noexc unwind label %terminate tmp.1.i.i183.noexc: ; preds = %invoke_catch.0 - unwind + ret void then.0: ; preds = %tmp.3.i.noexc invoke void @_ZN10QByteArray6resizeEi( ) 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 + cleanup invoke void @q_atomic_decrement( ) to label %tmp.1.i.i162.noexc unwind label %terminate @@ -40,6 +44,9 @@ 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 + cleanup unreachable } +declare i32 @__gxx_personality_v0(...) diff --git a/test/Transforms/ADCE/dce_pure_invoke.ll b/test/Transforms/ADCE/dce_pure_invoke.ll index c16d45cc2393..8e7851804575 100644 --- a/test/Transforms/ADCE/dce_pure_invoke.ll +++ b/test/Transforms/ADCE/dce_pure_invoke.ll @@ -11,5 +11,9 @@ Cont: ; preds = %0 ret i32 0 Other: ; preds = %0 + %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + cleanup ret i32 1 } + +declare i32 @__gxx_personality_v0(...) diff --git a/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll b/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll index 91e9799ad9ca..ff5de6b73e21 100644 --- a/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll +++ b/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll @@ -190,5 +190,9 @@ return: ; preds = %entry ret void LongJmpBlkPre: ; preds = %endif.52, %then.40 + %exn = landingpad { i8*, i32 } personality i32 (...)* @__gcc_personality_v0 + catch i8* null ret void } + +declare i32 @__gcc_personality_v0(...) diff --git a/test/Transforms/CodeExtractor/2004-11-12-InvokeExtract.ll b/test/Transforms/CodeExtractor/2004-11-12-InvokeExtract.ll index fc58577f67ab..92603d9e634e 100644 --- a/test/Transforms/CodeExtractor/2004-11-12-InvokeExtract.ll +++ b/test/Transforms/CodeExtractor/2004-11-12-InvokeExtract.ll @@ -10,6 +10,9 @@ Cont: ; preds = %EB ret i32 %V Unw: ; preds = %EB - unwind + %exn = landingpad { i8*, i32 } personality i32 (...)* @__gcc_personality_v0 + catch i8* null + resume { i8*, i32 } %exn } +declare i32 @__gcc_personality_v0(...) diff --git a/test/Transforms/ConstantMerge/merge-both.ll b/test/Transforms/ConstantMerge/merge-both.ll index 0282f464aeee..b71eb437dbc3 100644 --- a/test/Transforms/ConstantMerge/merge-both.ll +++ b/test/Transforms/ConstantMerge/merge-both.ll @@ -1,5 +1,7 @@ ; RUN: opt -constmerge %s -S -o - | FileCheck %s ; Test that in one run var3 is merged into var2 and var1 into var4. +; Test that we merge @var5 and @var6 into one with the higher alignment, and +; don't merge var7/var8 into var5/var6. declare void @zed(%struct.foobar*, %struct.foobar*) @@ -14,13 +16,24 @@ declare void @zed(%struct.foobar*, %struct.foobar*) ; CHECK-NOT: @ ; CHECK: @var2 = constant %struct.foobar { i32 2 } ; CHECK-NEXT: @var4 = constant %struct.foobar { i32 2 } -; CHECK-NOT: @ -; CHECK: declare void @zed(%struct.foobar*, %struct.foobar*) + +declare void @helper([16 x i8]*) +@var5 = internal constant [16 x i8] c"foo1bar2foo3bar\00", align 16 +@var6 = private unnamed_addr constant [16 x i8] c"foo1bar2foo3bar\00", align 1 +@var7 = internal constant [16 x i8] c"foo1bar2foo3bar\00" +@var8 = private unnamed_addr constant [16 x i8] c"foo1bar2foo3bar\00" + +; CHECK-NEXT: @var6 = private constant [16 x i8] c"foo1bar2foo3bar\00", align 16 +; CHECK-NEXT: @var8 = private constant [16 x i8] c"foo1bar2foo3bar\00" define i32 @main() { entry: call void @zed(%struct.foobar* @var1, %struct.foobar* @var2) call void @zed(%struct.foobar* @var3, %struct.foobar* @var4) + call void @helper([16 x i8]* @var5) + call void @helper([16 x i8]* @var6) + call void @helper([16 x i8]* @var7) + call void @helper([16 x i8]* @var8) ret i32 0 } diff --git a/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll b/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll index 161821f3f8f7..fc25daca1c2e 100644 --- a/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll +++ b/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll @@ -11,6 +11,8 @@ T: %y = extractvalue {i32,i32} %x, 1 ret i32 %y T2: + %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + cleanup unreachable } @@ -22,5 +24,9 @@ T: %y = extractvalue {i32,i32} %x, 1 ret i32 %y T2: + %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + cleanup unreachable } + +declare i32 @__gxx_personality_v0(...) diff --git a/test/Transforms/DeadArgElim/deadexternal.ll b/test/Transforms/DeadArgElim/deadexternal.ll index 84092613130b..b2d63ec77209 100644 --- a/test/Transforms/DeadArgElim/deadexternal.ll +++ b/test/Transforms/DeadArgElim/deadexternal.ll @@ -31,7 +31,7 @@ define void @h() { entry: %i = alloca i32, align 4 volatile store i32 10, i32* %i, align 4 -; CHECK: %tmp = volatile load i32* %i, align 4 +; CHECK: %tmp = load volatile i32* %i, align 4 ; CHECK-next: call void @f(i32 undef) %tmp = volatile load i32* %i, align 4 call void @f(i32 %tmp) diff --git a/test/Transforms/DeadStoreElimination/2011-09-06-EndOfFunction.ll b/test/Transforms/DeadStoreElimination/2011-09-06-EndOfFunction.ll new file mode 100644 index 000000000000..c5cc101a5f7b --- /dev/null +++ b/test/Transforms/DeadStoreElimination/2011-09-06-EndOfFunction.ll @@ -0,0 +1,27 @@ +; RUN: opt -dse -S < %s | FileCheck %s + +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-apple-darwin" + +%"class.std::auto_ptr" = type { i32* } + +; CHECK: @_Z3foov +define void @_Z3foov(%"class.std::auto_ptr"* noalias nocapture sret %agg.result) uwtable ssp { +_ZNSt8auto_ptrIiED1Ev.exit: + %temp.lvalue = alloca %"class.std::auto_ptr", align 8 + call void @_Z3barv(%"class.std::auto_ptr"* sret %temp.lvalue) + %_M_ptr.i.i = getelementptr inbounds %"class.std::auto_ptr"* %temp.lvalue, i64 0, i32 0 + %tmp.i.i = load i32** %_M_ptr.i.i, align 8, !tbaa !0 +; CHECK-NOT: store i32* null + store i32* null, i32** %_M_ptr.i.i, align 8, !tbaa !0 + %_M_ptr.i.i4 = getelementptr inbounds %"class.std::auto_ptr"* %agg.result, i64 0, i32 0 + store i32* %tmp.i.i, i32** %_M_ptr.i.i4, align 8, !tbaa !0 +; CHECK: ret void + ret void +} + +declare void @_Z3barv(%"class.std::auto_ptr"* sret) + +!0 = metadata !{metadata !"any pointer", metadata !1} +!1 = metadata !{metadata !"omnipotent char", metadata !2} +!2 = metadata !{metadata !"Simple C/C++ TBAA", null} diff --git a/test/Transforms/DeadStoreElimination/2011-09-06-MemCpy.ll b/test/Transforms/DeadStoreElimination/2011-09-06-MemCpy.ll new file mode 100644 index 000000000000..22b87864c063 --- /dev/null +++ b/test/Transforms/DeadStoreElimination/2011-09-06-MemCpy.ll @@ -0,0 +1,85 @@ +; RUN: opt -dse -S < %s | FileCheck %s +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-f128:128:128-n8:16:32:64" +target triple = "x86_64-unknown-linux-gnu" + +%struct.pair.162 = type { %struct.BasicBlock*, i32, [4 x i8] } +%struct.BasicBlock = type { %struct.Value, %struct.ilist_node.24, %struct.iplist.22, %struct.Function* } +%struct.Value = type { i32 (...)**, i8, i8, i16, %struct.Type*, %struct.Use*, %struct.StringMapEntry* } +%struct.Type = type { %struct.LLVMContext*, i8, [3 x i8], i32, {}* } +%struct.LLVMContext = type { %struct.LLVMContextImpl* } +%struct.LLVMContextImpl = type opaque +%struct.Use = type { %struct.Value*, %struct.Use*, %struct.PointerIntPair } +%struct.PointerIntPair = type { i64 } +%struct.StringMapEntry = type opaque +%struct.ilist_node.24 = type { %struct.ilist_half_node.23, %struct.BasicBlock* } +%struct.ilist_half_node.23 = type { %struct.BasicBlock* } +%struct.iplist.22 = type { %struct.ilist_traits.21, %struct.Instruction* } +%struct.ilist_traits.21 = type { %struct.ilist_half_node.25 } +%struct.ilist_half_node.25 = type { %struct.Instruction* } +%struct.Instruction = type { [52 x i8], %struct.ilist_node.26, %struct.BasicBlock*, %struct.DebugLoc } +%struct.ilist_node.26 = type { %struct.ilist_half_node.25, %struct.Instruction* } +%struct.DebugLoc = type { i32, i32 } +%struct.Function = type { %struct.GlobalValue, %struct.ilist_node.14, %struct.iplist.4, %struct.iplist, %struct.ValueSymbolTable*, %struct.AttrListPtr } +%struct.GlobalValue = type <{ [52 x i8], [4 x i8], %struct.Module*, i8, i16, [5 x i8], %struct.basic_string }> +%struct.Module = type { %struct.LLVMContext*, %struct.iplist.20, %struct.iplist.16, %struct.iplist.12, %struct.vector.2, %struct.ilist, %struct.basic_string, %struct.ValueSymbolTable*, %struct.OwningPtr, %struct.basic_string, %struct.basic_string, %struct.basic_string, i8* } +%struct.iplist.20 = type { %struct.ilist_traits.19, %struct.GlobalVariable* } +%struct.ilist_traits.19 = type { %struct.ilist_node.18 } +%struct.ilist_node.18 = type { %struct.ilist_half_node.17, %struct.GlobalVariable* } +%struct.ilist_half_node.17 = type { %struct.GlobalVariable* } +%struct.GlobalVariable = type { %struct.GlobalValue, %struct.ilist_node.18, i8, [7 x i8] } +%struct.iplist.16 = type { %struct.ilist_traits.15, %struct.Function* } +%struct.ilist_traits.15 = type { %struct.ilist_node.14 } +%struct.ilist_node.14 = type { %struct.ilist_half_node.13, %struct.Function* } +%struct.ilist_half_node.13 = type { %struct.Function* } +%struct.iplist.12 = type { %struct.ilist_traits.11, %struct.GlobalAlias* } +%struct.ilist_traits.11 = type { %struct.ilist_node.10 } +%struct.ilist_node.10 = type { %struct.ilist_half_node.9, %struct.GlobalAlias* } +%struct.ilist_half_node.9 = type { %struct.GlobalAlias* } +%struct.GlobalAlias = type { %struct.GlobalValue, %struct.ilist_node.10 } +%struct.vector.2 = type { %struct._Vector_base.1 } +%struct._Vector_base.1 = type { %struct._Vector_impl.0 } +%struct._Vector_impl.0 = type { %struct.basic_string*, %struct.basic_string*, %struct.basic_string* } +%struct.basic_string = type { %struct._Alloc_hider } +%struct._Alloc_hider = type { i8* } +%struct.ilist = type { %struct.iplist.8 } +%struct.iplist.8 = type { %struct.ilist_traits.7, %struct.NamedMDNode* } +%struct.ilist_traits.7 = type { %struct.ilist_node.6 } +%struct.ilist_node.6 = type { %struct.ilist_half_node.5, %struct.NamedMDNode* } +%struct.ilist_half_node.5 = type { %struct.NamedMDNode* } +%struct.NamedMDNode = type { %struct.ilist_node.6, %struct.basic_string, %struct.Module*, i8* } +%struct.ValueSymbolTable = type opaque +%struct.OwningPtr = type { %struct.GVMaterializer* } +%struct.GVMaterializer = type opaque +%struct.iplist.4 = type { %struct.ilist_traits.3, %struct.BasicBlock* } +%struct.ilist_traits.3 = type { %struct.ilist_half_node.23 } +%struct.iplist = type { %struct.ilist_traits, %struct.Argument* } +%struct.ilist_traits = type { %struct.ilist_half_node } +%struct.ilist_half_node = type { %struct.Argument* } +%struct.Argument = type { %struct.Value, %struct.ilist_node, %struct.Function* } +%struct.ilist_node = type { %struct.ilist_half_node, %struct.Argument* } +%struct.AttrListPtr = type { %struct.AttributeListImpl* } +%struct.AttributeListImpl = type opaque + +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind + +; CHECK: _ZSt9iter_swapIPSt4pairIPN4llvm10BasicBlockEjES5_EvT_T0_ +; CHECK: store +; CHECK: ret void +define void @_ZSt9iter_swapIPSt4pairIPN4llvm10BasicBlockEjES5_EvT_T0_(%struct.pair.162* %__a, %struct.pair.162* %__b) nounwind uwtable inlinehint { +entry: + %memtmp = alloca %struct.pair.162, align 8 + %0 = getelementptr inbounds %struct.pair.162* %memtmp, i64 0, i32 0 + %1 = getelementptr inbounds %struct.pair.162* %__a, i64 0, i32 0 + %2 = load %struct.BasicBlock** %1, align 8 + store %struct.BasicBlock* %2, %struct.BasicBlock** %0, align 8 + %3 = getelementptr inbounds %struct.pair.162* %memtmp, i64 0, i32 1 + %4 = getelementptr inbounds %struct.pair.162* %__a, i64 0, i32 1 + %5 = load i32* %4, align 4 + store i32 %5, i32* %3, align 8 + %6 = bitcast %struct.pair.162* %__a to i8* + %7 = bitcast %struct.pair.162* %__b to i8* + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %6, i8* %7, i64 12, i32 1, i1 false) + %8 = bitcast %struct.pair.162* %memtmp to i8* + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %7, i8* %8, i64 12, i32 1, i1 false) + ret void +} diff --git a/test/Transforms/DeadStoreElimination/atomic.ll b/test/Transforms/DeadStoreElimination/atomic.ll new file mode 100644 index 000000000000..2e84298ad400 --- /dev/null +++ b/test/Transforms/DeadStoreElimination/atomic.ll @@ -0,0 +1,107 @@ +; RUN: opt -basicaa -dse -S < %s | FileCheck %s + +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-apple-macosx10.7.0" + +; Sanity tests for atomic stores. +; Note that it turns out essentially every transformation DSE does is legal on +; atomic ops, just some transformations are not allowed across them. + +@x = common global i32 0, align 4 +@y = common global i32 0, align 4 + +declare void @randomop(i32*) + +; DSE across unordered store (allowed) +define void @test1() nounwind uwtable ssp { +; CHECK: test1 +; CHECK-NOT: store i32 0 +; CHECK: store i32 1 +entry: + store i32 0, i32* @x + store atomic i32 0, i32* @y unordered, align 4 + store i32 1, i32* @x + ret void +} + +; DSE across seq_cst load (allowed in theory; not implemented ATM) +define i32 @test2() nounwind uwtable ssp { +; CHECK: test2 +; CHECK: store i32 0 +; CHECK: store i32 1 +entry: + store i32 0, i32* @x + %x = load atomic i32* @y seq_cst, align 4 + store i32 1, i32* @x + ret i32 %x +} + +; DSE across seq_cst store (store before atomic store must not be removed) +define void @test3() nounwind uwtable ssp { +; CHECK: test3 +; CHECK: store i32 +; CHECK: store atomic i32 2 +entry: + store i32 0, i32* @x + store atomic i32 2, i32* @y seq_cst, align 4 + store i32 1, i32* @x + ret void +} + +; DSE remove unordered store (allowed) +define void @test4() nounwind uwtable ssp { +; CHECK: test4 +; CHECK-NOT: store atomic +; CHECK: store i32 1 +entry: + store atomic i32 0, i32* @x unordered, align 4 + store i32 1, i32* @x + ret void +} + +; DSE unordered store overwriting non-atomic store (allowed) +define void @test5() nounwind uwtable ssp { +; CHECK: test5 +; CHECK: store atomic i32 1 +entry: + store i32 0, i32* @x + store atomic i32 1, i32* @x unordered, align 4 + ret void +} + +; DSE no-op unordered atomic store (allowed) +define void @test6() nounwind uwtable ssp { +; CHECK: test6 +; CHECK-NOT: store +; CHECK: ret void +entry: + %x = load atomic i32* @x unordered, align 4 + store atomic i32 %x, i32* @x unordered, align 4 + ret void +} + +; DSE seq_cst store (be conservative; DSE doesn't have infrastructure +; to reason about atomic operations). +define void @test7() nounwind uwtable ssp { +; CHECK: test7 +; CHECK: store atomic +entry: + %a = alloca i32 + store atomic i32 0, i32* %a seq_cst, align 4 + ret void +} + +; DSE and seq_cst load (be conservative; DSE doesn't have infrastructure +; to reason about atomic operations). +define i32 @test8() nounwind uwtable ssp { +; CHECK: test8 +; CHECK: store +; CHECK: load atomic +entry: + %a = alloca i32 + call void @randomop(i32* %a) + store i32 0, i32* %a, align 4 + %x = load atomic i32* @x seq_cst, align 4 + ret i32 %x +} + diff --git a/test/Transforms/DeadStoreElimination/simple.ll b/test/Transforms/DeadStoreElimination/simple.ll index 5f143fcd1ede..ec2f15737a37 100644 --- a/test/Transforms/DeadStoreElimination/simple.ll +++ b/test/Transforms/DeadStoreElimination/simple.ll @@ -42,20 +42,20 @@ define i32 @test3(i32* %g_addr) nounwind { define void @test4(i32* %Q) { %a = load i32* %Q - volatile store i32 %a, i32* %Q + store volatile i32 %a, i32* %Q ret void ; CHECK: @test4 ; CHECK-NEXT: load i32 -; CHECK-NEXT: volatile store +; CHECK-NEXT: store volatile ; CHECK-NEXT: ret void } define void @test5(i32* %Q) { - %a = volatile load i32* %Q + %a = load volatile i32* %Q store i32 %a, i32* %Q ret void ; CHECK: @test5 -; CHECK-NEXT: volatile load +; CHECK-NEXT: load volatile ; CHECK-NEXT: ret void } diff --git a/test/Transforms/EarlyCSE/basic.ll b/test/Transforms/EarlyCSE/basic.ll index e3c75f97dcfc..57b1697ff4de 100644 --- a/test/Transforms/EarlyCSE/basic.ll +++ b/test/Transforms/EarlyCSE/basic.ll @@ -13,21 +13,21 @@ define void @test1(i8 %V, i32 *%P) { volatile store i32 %C, i32* %P volatile store i32 %D, i32* %P ; CHECK-NEXT: %C = zext i8 %V to i32 - ; CHECK-NEXT: volatile store i32 %C - ; CHECK-NEXT: volatile store i32 %C + ; CHECK-NEXT: store volatile i32 %C + ; CHECK-NEXT: store volatile i32 %C %E = add i32 %C, %C %F = add i32 %C, %C volatile store i32 %E, i32* %P volatile store i32 %F, i32* %P ; CHECK-NEXT: %E = add i32 %C, %C - ; CHECK-NEXT: volatile store i32 %E - ; CHECK-NEXT: volatile store i32 %E + ; CHECK-NEXT: store volatile i32 %E + ; CHECK-NEXT: store volatile i32 %E %G = add nuw i32 %C, %C ;; not a CSE with E volatile store i32 %G, i32* %P ; CHECK-NEXT: %G = add nuw i32 %C, %C - ; CHECK-NEXT: volatile store i32 %G + ; CHECK-NEXT: store volatile i32 %G ret void } diff --git a/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll b/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll index 53857f61ce58..e2bab19e7efd 100644 --- a/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll +++ b/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll @@ -46,9 +46,13 @@ define i1 @c6(i8* %q, i8 %bit) { ret0: ret i1 0 ret1: + %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + cleanup ret i1 1 } +declare i32 @__gxx_personality_v0(...) + define i1* @lookup_bit(i32* %q, i32 %bitno) readnone nounwind { %tmp = ptrtoint i32* %q to i32 %tmp2 = lshr i32 %tmp, %bitno diff --git a/test/Transforms/FunctionAttrs/atomic.ll b/test/Transforms/FunctionAttrs/atomic.ll new file mode 100644 index 000000000000..7c2bff7a05f7 --- /dev/null +++ b/test/Transforms/FunctionAttrs/atomic.ll @@ -0,0 +1,21 @@ +; RUN: opt -basicaa -functionattrs -S < %s | FileCheck %s + +; Atomic load/store to local doesn't affect whether a function is +; readnone/readonly. +define i32 @test1(i32 %x) uwtable ssp { +; CHECK: define i32 @test1(i32 %x) uwtable readnone ssp { +entry: + %x.addr = alloca i32, align 4 + store atomic i32 %x, i32* %x.addr seq_cst, align 4 + %r = load atomic i32* %x.addr seq_cst, align 4 + ret i32 %r +} + +; A function with an Acquire load is not readonly. +define i32 @test2(i32* %x) uwtable ssp { +; CHECK: define i32 @test2(i32* nocapture %x) uwtable ssp { +entry: + %r = load atomic i32* %x seq_cst, align 4 + ret i32 %r +} + diff --git a/test/Transforms/GVN/2010-05-08-OneBit.ll b/test/Transforms/GVN/2010-05-08-OneBit.ll index 1809cf03f900..480ce8ba0ae1 100644 --- a/test/Transforms/GVN/2010-05-08-OneBit.ll +++ b/test/Transforms/GVN/2010-05-08-OneBit.ll @@ -45,6 +45,8 @@ 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 + cleanup switch i32 undef, label %fin [ i32 1, label %catch1 i32 2, label %catch @@ -61,3 +63,5 @@ catch1: ; preds = %landing_pad } declare fastcc void @foo() + +declare i32 @__gxx_personality_v0(...) diff --git a/test/Transforms/GVN/2011-09-07-TypeIdFor.ll b/test/Transforms/GVN/2011-09-07-TypeIdFor.ll new file mode 100644 index 000000000000..314b5bb113a6 --- /dev/null +++ b/test/Transforms/GVN/2011-09-07-TypeIdFor.ll @@ -0,0 +1,81 @@ +; RUN: opt < %s -basicaa -gvn -S | FileCheck %s +%struct.__fundamental_type_info_pseudo = type { %struct.__type_info_pseudo } +%struct.__type_info_pseudo = type { i8*, i8* } + +@_ZTIi = external constant %struct.__fundamental_type_info_pseudo +@_ZTIb = external constant %struct.__fundamental_type_info_pseudo + +declare void @_Z4barv() + +declare void @_Z7cleanupv() + +declare i32 @llvm.eh.typeid.for(i8*) nounwind readonly + +declare i8* @__cxa_begin_catch(i8*) nounwind + +declare void @__cxa_end_catch() + +declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*) + +define void @_Z3foov() uwtable { +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 + catch %struct.__fundamental_type_info_pseudo* @_ZTIi + catch %struct.__fundamental_type_info_pseudo* @_ZTIb + catch %struct.__fundamental_type_info_pseudo* @_ZTIi + catch %struct.__fundamental_type_info_pseudo* @_ZTIb + %exc_ptr2.i = extractvalue { i8*, i32 } %0, 0 + %filter3.i = extractvalue { i8*, i32 } %0, 1 + %typeid.i = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIi to i8*)) +; CHECK: call i32 @llvm.eh.typeid.for + %1 = icmp eq i32 %filter3.i, %typeid.i + br i1 %1, label %ppad, label %next + +next: ; preds = %lpad + %typeid1.i = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIb to i8*)) +; CHECK: call i32 @llvm.eh.typeid.for + %2 = icmp eq i32 %filter3.i, %typeid1.i + br i1 %2, label %ppad2, label %next2 + +ppad: ; preds = %lpad + %3 = tail call i8* @__cxa_begin_catch(i8* %exc_ptr2.i) nounwind + tail call void @__cxa_end_catch() nounwind + br label %return + +ppad2: ; preds = %next + %D.2073_5.i = tail call i8* @__cxa_begin_catch(i8* %exc_ptr2.i) nounwind + tail call void @__cxa_end_catch() nounwind + br label %return + +next2: ; preds = %next + call void @_Z7cleanupv() + %typeid = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIi to i8*)) +; CHECK-NOT: call i32 @llvm.eh.typeid.for + %4 = icmp eq i32 %filter3.i, %typeid + br i1 %4, label %ppad3, label %next3 + +next3: ; preds = %next2 + %typeid1 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIb to i8*)) + %5 = icmp eq i32 %filter3.i, %typeid1 + br i1 %5, label %ppad4, label %unwind + +unwind: ; preds = %next3 + resume { i8*, i32 } %0 + +ppad3: ; preds = %next2 + %6 = tail call i8* @__cxa_begin_catch(i8* %exc_ptr2.i) nounwind + tail call void @__cxa_end_catch() nounwind + br label %return + +ppad4: ; preds = %next3 + %D.2080_5 = tail call i8* @__cxa_begin_catch(i8* %exc_ptr2.i) nounwind + tail call void @__cxa_end_catch() nounwind + br label %return + +return: ; preds = %ppad4, %ppad3, %ppad2, %ppad, %entry + ret void +} diff --git a/test/Transforms/GVN/atomic.ll b/test/Transforms/GVN/atomic.ll new file mode 100644 index 000000000000..094e22bd07e1 --- /dev/null +++ b/test/Transforms/GVN/atomic.ll @@ -0,0 +1,80 @@ +; RUN: opt -basicaa -gvn -S < %s | FileCheck %s + +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-apple-macosx10.7.0" + +@x = common global i32 0, align 4 +@y = common global i32 0, align 4 + +; GVN across unordered store (allowed) +define i32 @test1() nounwind uwtable ssp { +; CHECK: test1 +; CHECK: add i32 %x, %x +entry: + %x = load i32* @y + store atomic i32 %x, i32* @x unordered, align 4 + %y = load i32* @y + %z = add i32 %x, %y + ret i32 %z +} + +; GVN across seq_cst store (allowed in theory; not implemented ATM) +define i32 @test2() nounwind uwtable ssp { +; CHECK: test2 +; CHECK: add i32 %x, %y +entry: + %x = load i32* @y + store atomic i32 %x, i32* @x seq_cst, align 4 + %y = load i32* @y + %z = add i32 %x, %y + ret i32 %z +} + +; GVN across unordered load (allowed) +define i32 @test3() nounwind uwtable ssp { +; CHECK: test3 +; CHECK: add i32 %x, %x +entry: + %x = load i32* @y + %y = load atomic i32* @x unordered, align 4 + %z = load i32* @y + %a = add i32 %x, %z + %b = add i32 %y, %a + ret i32 %b +} + +; GVN across acquire load (load after atomic load must not be removed) +define i32 @test4() nounwind uwtable ssp { +; CHECK: test4 +; CHECK: load atomic i32* @x +; CHECK: load i32* @y +entry: + %x = load i32* @y + %y = load atomic i32* @x seq_cst, align 4 + %x2 = load i32* @y + %x3 = add i32 %x, %x2 + %y2 = add i32 %y, %x3 + ret i32 %y2 +} + +; GVN load to unordered load (allowed) +define i32 @test5() nounwind uwtable ssp { +; CHECK: test5 +; CHECK: add i32 %x, %x +entry: + %x = load atomic i32* @x unordered, align 4 + %y = load i32* @x + %z = add i32 %x, %y + ret i32 %z +} + +; GVN unordered load to load (unordered load must not be removed) +define i32 @test6() nounwind uwtable ssp { +; CHECK: test6 +; CHECK: load atomic i32* @x unordered +entry: + %x = load i32* @x + %x2 = load atomic i32* @x unordered, align 4 + %x3 = add i32 %x, %x2 + ret i32 %x3 +} diff --git a/test/Transforms/GVN/condprop.ll b/test/Transforms/GVN/condprop.ll index be6c3498fe40..0b31b01b7b14 100644 --- a/test/Transforms/GVN/condprop.ll +++ b/test/Transforms/GVN/condprop.ll @@ -2,8 +2,8 @@ @a = external global i32 ; [#uses=7] -; CHECK: @foo -define i32 @foo() nounwind { +; CHECK: @test1 +define i32 @test1() nounwind { entry: %0 = load i32* @a, align 4 %1 = icmp eq i32 %0, 4 @@ -52,4 +52,81 @@ bb8: ; preds = %bb7, %bb6, %bb4, %bb2, %bb return: ; preds = %bb8 ret i32 %.0 -} \ No newline at end of file +} + +declare void @foo(i1) + +; CHECK: @test2 +define void @test2(i1 %x, i1 %y) { + %z = or i1 %x, %y + br i1 %z, label %true, label %false +true: +; CHECK: true: + %z2 = or i1 %x, %y + call void @foo(i1 %z2) +; CHECK: call void @foo(i1 true) + br label %true +false: +; CHECK: false: + %z3 = or i1 %x, %y + call void @foo(i1 %z3) +; CHECK: call void @foo(i1 false) + br label %false +} + +declare void @bar(i32) + +; CHECK: @test3 +define void @test3(i32 %x, i32 %y) { + %xz = icmp eq i32 %x, 0 + %yz = icmp eq i32 %y, 0 + %z = and i1 %xz, %yz + br i1 %z, label %both_zero, label %nope +both_zero: + call void @foo(i1 %xz) +; CHECK: call void @foo(i1 true) + call void @foo(i1 %yz) +; CHECK: call void @foo(i1 true) + call void @bar(i32 %x) +; CHECK: call void @bar(i32 0) + call void @bar(i32 %y) +; CHECK: call void @bar(i32 0) + ret void +nope: + call void @foo(i1 %z) +; CHECK: call void @foo(i1 false) + ret void +} + +; CHECK: @test4 +define void @test4(i1 %b, i32 %x) { + br i1 %b, label %sw, label %case3 +sw: + switch i32 %x, label %default [ + i32 0, label %case0 + i32 1, label %case1 + i32 2, label %case0 + i32 3, label %case3 + i32 4, label %default + ] +default: +; CHECK: default: + call void @bar(i32 %x) +; CHECK: call void @bar(i32 %x) + ret void +case0: +; CHECK: case0: + call void @bar(i32 %x) +; CHECK: call void @bar(i32 %x) + ret void +case1: +; CHECK: case1: + call void @bar(i32 %x) +; CHECK: call void @bar(i32 1) + ret void +case3: +; CHECK: case3: + call void @bar(i32 %x) +; CHECK: call void @bar(i32 %x) + ret void +} diff --git a/test/Transforms/GVN/phi-translate.ll b/test/Transforms/GVN/phi-translate.ll index f10537e0c930..fa91d2919eb2 100644 --- a/test/Transforms/GVN/phi-translate.ll +++ b/test/Transforms/GVN/phi-translate.ll @@ -14,7 +14,7 @@ target datalayout = "e-p:64:64:64" @G = external global [100 x i32] define i32 @foo(i32 %x, i32 %z) { entry: - %tobool = icmp eq i32 %x, 0 + %tobool = icmp eq i32 %z, 0 br i1 %tobool, label %end, label %then then: diff --git a/test/Transforms/GVN/pr10820.ll b/test/Transforms/GVN/pr10820.ll new file mode 100644 index 000000000000..12c1e70fc387 --- /dev/null +++ b/test/Transforms/GVN/pr10820.ll @@ -0,0 +1,18 @@ +; RUN: opt < %s -basicaa -gvn -S | FileCheck %s + +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-f128:128:128-n8:16:32:64" +target triple = "x86_64-unknown-linux-gnu" + +@g = external global i31 + +define void @main() nounwind uwtable { +entry: +; CHECK: store i32 + store i32 402662078, i32* bitcast (i31* @g to i32*), align 8 +; CHECK-NOT: load i31 + %0 = load i31* @g, align 8 +; CHECK: store i31 + store i31 %0, i31* undef, align 1 + unreachable +} diff --git a/test/Transforms/GlobalOpt/2008-01-29-VolatileGlobal.ll b/test/Transforms/GlobalOpt/2008-01-29-VolatileGlobal.ll index 0c817005c273..a6803abc5d36 100644 --- a/test/Transforms/GlobalOpt/2008-01-29-VolatileGlobal.ll +++ b/test/Transforms/GlobalOpt/2008-01-29-VolatileGlobal.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -globalopt -S | grep {volatile load} +; RUN: opt < %s -globalopt -S | grep {load volatile} @t0.1441 = internal global double 0x3FD5555555555555, align 8 ; [#uses=1] define double @foo() nounwind { diff --git a/test/Transforms/IPConstantProp/global.ll b/test/Transforms/IPConstantProp/global.ll new file mode 100644 index 000000000000..67152937beec --- /dev/null +++ b/test/Transforms/IPConstantProp/global.ll @@ -0,0 +1,26 @@ +; RUN: opt < %s -S -ipsccp | FileCheck %s + +@_ZL6test1g = internal global i32 42, align 4 + +define void @_Z7test1f1v() nounwind { +entry: + %tmp = load i32* @_ZL6test1g, align 4 + %cmp = icmp eq i32 %tmp, 0 + br i1 %cmp, label %if.then, label %if.end + +if.then: ; preds = %entry + store i32 0, i32* @_ZL6test1g, align 4 + br label %if.end + +if.end: ; preds = %if.then, %entry + ret void +} + +; CHECK: @_Z7test1f2v() +; CHECK: entry: +; CHECK-NEXT: ret i32 42 +define i32 @_Z7test1f2v() nounwind { +entry: + %tmp = load i32* @_ZL6test1g, align 4 + ret i32 %tmp +} diff --git a/test/Transforms/IPConstantProp/return-argument.ll b/test/Transforms/IPConstantProp/return-argument.ll index 6d6eb24cf542..f4b7018222e9 100644 --- a/test/Transforms/IPConstantProp/return-argument.ll +++ b/test/Transforms/IPConstantProp/return-argument.ll @@ -36,14 +36,22 @@ define void @caller(i1 %C) { ;; propagated per-caller). %S1 = call { i32, i32 } @foo(i32 1, i32 2) %X1 = extractvalue { i32, i32 } %S1, 0 - %S2 = invoke { i32, i32 } @foo(i32 3, i32 4) to label %OK unwind label %RET + %S2 = invoke { i32, i32 } @foo(i32 3, i32 4) to label %OK unwind label %LPAD + OK: %X2 = extractvalue { i32, i32 } %S2, 0 ;; Do some stuff with the returned values which we can grep for %Z = add i32 %X1, %X2 store i32 %Z, i32* %W br label %RET + +LPAD: + %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + cleanup + br label %RET + RET: ret void } +declare i32 @__gxx_personality_v0(...) diff --git a/test/Transforms/IPConstantProp/return-constant.ll b/test/Transforms/IPConstantProp/return-constant.ll index b25585952873..ff15df738816 100644 --- a/test/Transforms/IPConstantProp/return-constant.ll +++ b/test/Transforms/IPConstantProp/return-constant.ll @@ -22,5 +22,9 @@ OK: %Y = icmp ne i32 %X, 0 ; [#uses=1] ret i1 %Y FAIL: + %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 + cleanup ret i1 false } + +declare i32 @__gxx_personality_v0(...) diff --git a/test/Transforms/IndVarSimplify/2003-09-12-MultiplePred.ll b/test/Transforms/IndVarSimplify/2003-09-12-MultiplePred.ll deleted file mode 100644 index ecd5086f7308..000000000000 --- a/test/Transforms/IndVarSimplify/2003-09-12-MultiplePred.ll +++ /dev/null @@ -1,15 +0,0 @@ -; RUN: opt < %s -indvars -S | grep indvar - -define i32 @test() { -;