From 721c201bd55ffb73cb2ba8d39e0570fa38c44e15 Mon Sep 17 00:00:00 2001 From: dim Date: Wed, 15 Aug 2012 19:34:23 +0000 Subject: Vendor import of llvm trunk r161861: http://llvm.org/svn/llvm-project/llvm/trunk@161861 --- .../ArgumentPromotion/2008-07-02-array-indexing.ll | 2 +- test/Transforms/ArgumentPromotion/byval-2.ll | 2 +- test/Transforms/ArgumentPromotion/control-flow.ll | 2 +- test/Transforms/ArgumentPromotion/control-flow2.ll | 2 +- test/Transforms/BBVectorize/metadata.ll | 49 ++ test/Transforms/BBVectorize/simple-sel.ll | 29 ++ test/Transforms/BBVectorize/simple-tst.ll | 18 + test/Transforms/BBVectorize/simple.ll | 3 +- test/Transforms/BBVectorize/simple3.ll | 35 ++ test/Transforms/CodeGenPrepare/basic.ll | 6 +- .../Transforms/ConstProp/2002-05-03-NotOperator.ll | 2 +- test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll | 2 +- .../Transforms/ConstProp/2006-11-30-vector-cast.ll | 2 +- .../ConstProp/2006-12-01-TruncBoolBug.ll | 2 +- test/Transforms/ConstProp/2006-12-01-bool-casts.ll | 4 +- test/Transforms/ConstProp/2007-02-23-sdiv.ll | 2 +- test/Transforms/ConstProp/2007-11-23-cttz.ll | 2 +- test/Transforms/ConstProp/div-zero.ll | 2 +- .../Transforms/CorrelatedValuePropagation/range.ll | 124 +++++ .../DeadArgElim/2007-02-07-FuncRename.ll | 2 +- .../DeadArgElim/2007-10-18-VarargsReturn.ll | 2 +- test/Transforms/DeadArgElim/canon.ll | 4 +- test/Transforms/DeadArgElim/keepalive.ll | 4 +- test/Transforms/DeadStoreElimination/simple.ll | 54 +- .../FunctionAttrs/2009-01-02-LocalStores.ll | 4 +- test/Transforms/GVN/2007-07-25-InfiniteLoop.ll | 2 +- test/Transforms/GVN/2007-07-31-NoDomInherit.ll | 2 +- test/Transforms/GVN/2007-07-31-RedundantPhi.ll | 2 +- test/Transforms/GVN/2008-07-02-Unreachable.ll | 2 +- test/Transforms/GVN/2012-05-22-PreCrash.ll | 33 ++ test/Transforms/GVN/basic.ll | 2 +- test/Transforms/GVN/calls-readonly.ll | 2 +- test/Transforms/GVN/fpmath.ll | 45 ++ test/Transforms/GVN/load-constant-mem.ll | 2 +- test/Transforms/GVN/local-pre.ll | 2 +- test/Transforms/GVN/nonescaping-malloc.ll | 2 +- test/Transforms/GVN/pr12979.ll | 79 +++ test/Transforms/GVN/pre-basic-add.ll | 2 +- test/Transforms/GVN/range.ll | 101 ++++ test/Transforms/GVN/rle-must-alias.ll | 2 +- test/Transforms/GVN/rle-semidominated.ll | 2 +- test/Transforms/GVN/tbaa.ll | 81 +++ .../GlobalOpt/2008-01-13-OutOfRangeSROA.ll | 2 +- .../GlobalOpt/2008-01-29-VolatileGlobal.ll | 2 +- .../GlobalOpt/2008-04-26-SROA-Global-Align.ll | 6 +- test/Transforms/GlobalOpt/2009-01-13-phi-user.ll | 2 +- test/Transforms/GlobalOpt/2009-03-05-dbg.ll | 2 +- .../GlobalOpt/2009-03-07-PromotePtrToBool.ll | 2 +- .../2009-11-16-BrokenPerformHeapAllocSRoA.ll | 2 +- .../GlobalOpt/2012-05-11-blockaddress.ll | 16 + .../GlobalOpt/cleanup-pointer-root-users.ll | 49 ++ test/Transforms/GlobalOpt/constantexpr-dangle.ll | 2 +- test/Transforms/GlobalOpt/deadglobal.ll | 24 +- .../GlobalOpt/globalsra-unknown-index.ll | 4 +- test/Transforms/GlobalOpt/heap-sra-phi.ll | 4 +- test/Transforms/GlobalOpt/integer-bool.ll | 2 +- test/Transforms/GlobalOpt/memcpy.ll | 2 +- test/Transforms/GlobalOpt/storepointer-compare.ll | 2 +- test/Transforms/GlobalOpt/unnamed-addr.ll | 16 +- .../IPConstantProp/2008-06-09-WeakProp.ll | 2 +- test/Transforms/IPConstantProp/return-argument.ll | 4 +- test/Transforms/IPConstantProp/return-constant.ll | 2 +- test/Transforms/IPConstantProp/return-constants.ll | 4 +- .../IndVarSimplify/2005-02-26-ExitValueCompute.ll | 2 +- .../IndVarSimplify/2006-03-31-NegativeStride.ll | 2 +- .../IndVarSimplify/2007-01-06-TripCount.ll | 2 +- .../IndVarSimplify/2009-04-14-shorten_iv_vars.ll | 2 +- .../IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll | 2 +- .../IndVarSimplify/2012-07-17-lftr-undef.ll | 22 + test/Transforms/IndVarSimplify/eliminate-max.ll | 2 +- test/Transforms/IndVarSimplify/lftr-reuse.ll | 11 +- test/Transforms/IndVarSimplify/loop_evaluate10.ll | 2 +- test/Transforms/IndVarSimplify/loop_evaluate9.ll | 4 +- test/Transforms/IndVarSimplify/loop_evaluate_3.ll | 2 +- test/Transforms/IndVarSimplify/loop_evaluate_4.ll | 2 +- test/Transforms/IndVarSimplify/loop_evaluate_5.ll | 2 +- test/Transforms/IndVarSimplify/shrunk-constant.ll | 2 +- test/Transforms/IndVarSimplify/ult-sub-to-eq.ll | 42 ++ test/Transforms/Inline/2007-04-15-InlineEH.ll | 2 +- test/Transforms/Inline/casts.ll | 2 +- test/Transforms/Inline/delete-call.ll | 4 +- test/Transforms/Inline/externally_available.ll | 2 +- test/Transforms/Inline/inline-byval-bonus.ll | 193 +++++++ test/Transforms/Inline/inline-invoke-tail.ll | 2 +- test/Transforms/Inline/inline-optsize.ll | 33 ++ test/Transforms/Inline/inline_constprop.ll | 62 +++ test/Transforms/Inline/inline_prune.ll | 2 +- test/Transforms/Inline/invoke_test-1.ll | 2 +- .../Transforms/InstCombine/2004-08-10-BoolSetCC.ll | 2 +- .../InstCombine/2004-09-20-BadLoadCombine.ll | 2 +- .../InstCombine/2004-09-20-BadLoadCombine2.ll | 2 +- .../InstCombine/2005-03-04-ShiftOverflow.ll | 2 +- .../2005-06-16-SetCCOrSetCCMiscompile.ll | 2 +- .../InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll | 2 +- .../InstCombine/2006-12-15-Range-Test.ll | 2 +- .../InstCombine/2007-01-13-ExtCompareMiscompile.ll | 2 +- test/Transforms/InstCombine/2007-01-14-FcmpSelf.ll | 2 +- test/Transforms/InstCombine/2007-01-27-AndICmp.ll | 2 +- .../InstCombine/2007-02-01-LoadSinkAlloca.ll | 4 +- .../InstCombine/2007-03-13-CompareMerge.ll | 2 +- .../InstCombine/2007-03-21-SignedRangeTest.ll | 2 +- .../InstCombine/2007-03-25-BadShiftMask.ll | 2 +- .../InstCombine/2007-03-26-BadShiftMask.ll | 2 +- .../InstCombine/2007-05-18-CastFoldBug.ll | 2 +- .../InstCombine/2007-06-06-AshrSignBit.ll | 2 +- .../InstCombine/2007-06-21-DivCompareMiscomp.ll | 2 +- .../Transforms/InstCombine/2007-10-28-stacksave.ll | 2 +- .../InstCombine/2007-11-15-CompareMiscomp.ll | 2 +- .../InstCombine/2007-12-10-ConstFoldCompare.ll | 2 +- .../InstCombine/2007-12-18-AddSelCmpSub.ll | 2 +- test/Transforms/InstCombine/2008-01-29-AddICmp.ll | 2 +- .../InstCombine/2008-02-16-SDivOverflow.ll | 2 +- .../InstCombine/2008-02-16-SDivOverflow2.ll | 2 +- test/Transforms/InstCombine/2008-03-13-IntToPtr.ll | 2 +- .../InstCombine/2008-04-28-VolatileStore.ll | 2 +- .../2008-04-29-VolatileLoadDontMerge.ll | 2 +- .../InstCombine/2008-04-29-VolatileLoadMerge.ll | 2 +- .../InstCombine/2008-05-08-LiveStoreDelete.ll | 2 +- .../InstCombine/2008-05-18-FoldIntToPtr.ll | 2 +- .../InstCombine/2008-05-23-CompareFold.ll | 2 +- test/Transforms/InstCombine/2008-05-31-AddBool.ll | 2 +- test/Transforms/InstCombine/2008-05-31-Bools.ll | 6 +- test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll | 2 +- .../InstCombine/2008-06-13-InfiniteLoopStore.ll | 2 +- .../InstCombine/2008-06-13-ReadOnlyCallStore.ll | 2 +- .../InstCombine/2008-06-21-CompareMiscomp.ll | 2 +- .../InstCombine/2008-06-24-StackRestore.ll | 2 +- .../InstCombine/2008-07-08-ShiftOneAndOne.ll | 2 +- test/Transforms/InstCombine/2008-07-08-SubAnd.ll | 2 +- .../InstCombine/2008-07-08-VolatileLoadMerge.ll | 2 +- .../InstCombine/2008-07-09-SubAndError.ll | 2 +- .../InstCombine/2008-07-10-CastSextBool.ll | 4 +- test/Transforms/InstCombine/2008-07-13-DivZero.ll | 4 +- .../InstCombine/2008-07-16-sse2_storel_dq.ll | 2 +- .../Transforms/InstCombine/2008-09-29-FoldingOr.ll | 2 +- .../InstCombine/2008-10-11-DivCompareFold.ll | 2 +- .../InstCombine/2008-11-01-SRemDemandedBits.ll | 2 +- test/Transforms/InstCombine/2008-11-08-FCmp.ll | 9 + .../InstCombine/2008-12-17-SRemNegConstVec.ll | 2 +- .../InstCombine/2009-01-08-AlignAlloca.ll | 4 +- .../InstCombine/2009-01-16-PointerAddrSpace.ll | 2 +- .../2009-01-19-fmod-constant-float-specials.ll | 4 +- test/Transforms/InstCombine/2009-01-31-Pressure.ll | 2 +- .../InstCombine/2009-02-20-InstCombine-SROA.ll | 2 +- test/Transforms/InstCombine/2009-02-21-LoadCST.ll | 2 +- .../InstCombine/2009-03-20-AShrOverShift.ll | 2 +- .../InstCombine/2009-04-07-MulPromoteToI96.ll | 2 +- .../InstCombine/2009-06-11-StoreAddrSpace.ll | 2 +- .../Transforms/InstCombine/2010-11-01-lshr-mask.ll | 8 +- .../InstCombine/2011-06-13-nsw-alloca.ll | 7 +- .../InstCombine/2012-04-23-Neon-Intrinsics.ll | 68 +++ test/Transforms/InstCombine/2012-04-24-vselect.ll | 13 + .../InstCombine/2012-05-27-Negative-Shift-Crash.ll | 61 +++ .../InstCombine/2012-05-28-select-hang.ll | 39 ++ .../InstCombine/2012-06-06-LoadOfPHIs.ll | 162 ++++++ test/Transforms/InstCombine/2012-07-25-LoadPart.ll | 12 + .../InstCombine/2012-07-30-addrsp-bitcast.ll | 10 + .../InstCombine/2012-6-7-vselect-bitcast.ll | 11 + test/Transforms/InstCombine/CPP_min_max.ll | 2 +- test/Transforms/InstCombine/JavaCompare.ll | 2 +- test/Transforms/InstCombine/add-shrink.ll | 2 +- test/Transforms/InstCombine/add-sitofp.ll | 2 +- test/Transforms/InstCombine/addnegneg.ll | 2 +- test/Transforms/InstCombine/adjust-for-sminmax.ll | 2 +- test/Transforms/InstCombine/align-2d-gep.ll | 2 +- test/Transforms/InstCombine/alloca.ll | 8 +- test/Transforms/InstCombine/and-fcmp.ll | 49 +- test/Transforms/InstCombine/and-not-or.ll | 4 +- test/Transforms/InstCombine/and-or-and.ll | 2 +- test/Transforms/InstCombine/and-or-not.ll | 2 +- test/Transforms/InstCombine/and-or.ll | 4 +- test/Transforms/InstCombine/and-xor-or.ll | 24 + test/Transforms/InstCombine/apint-and-or-and.ll | 2 +- test/Transforms/InstCombine/apint-and1.ll | 2 +- test/Transforms/InstCombine/apint-and2.ll | 2 +- .../Transforms/InstCombine/apint-shift-simplify.ll | 2 +- test/Transforms/InstCombine/apint-shift.ll | 16 +- test/Transforms/InstCombine/apint-sub.ll | 2 +- test/Transforms/InstCombine/apint-xor1.ll | 2 +- test/Transforms/InstCombine/apint-xor2.ll | 2 +- test/Transforms/InstCombine/badmalloc.ll | 23 +- test/Transforms/InstCombine/bit-checks.ll | 2 +- test/Transforms/InstCombine/bitcount.ll | 2 +- test/Transforms/InstCombine/bittest.ll | 2 +- test/Transforms/InstCombine/bswap.ll | 2 +- test/Transforms/InstCombine/cast.ll | 23 +- test/Transforms/InstCombine/crash.ll | 12 +- test/Transforms/InstCombine/dce-iterate.ll | 2 +- test/Transforms/InstCombine/deadcode.ll | 2 +- test/Transforms/InstCombine/div-shift.ll | 23 + .../InstCombine/enforce-known-alignment.ll | 2 +- test/Transforms/InstCombine/fp-ret-bitcast.ll | 2 +- test/Transforms/InstCombine/icmp.ll | 22 + test/Transforms/InstCombine/invoke.ll | 65 +++ test/Transforms/InstCombine/known_align.ll | 2 +- test/Transforms/InstCombine/loadstore-alignment.ll | 2 +- test/Transforms/InstCombine/malloc-free-delete.ll | 53 +- test/Transforms/InstCombine/memcpy-to-load.ll | 2 +- test/Transforms/InstCombine/memmove.ll | 2 +- test/Transforms/InstCombine/memset.ll | 2 +- test/Transforms/InstCombine/mul.ll | 5 +- test/Transforms/InstCombine/multi-use-or.ll | 2 +- test/Transforms/InstCombine/narrow.ll | 2 +- test/Transforms/InstCombine/objsize-64.ll | 39 ++ test/Transforms/InstCombine/objsize.ll | 92 +++- test/Transforms/InstCombine/odr-linkage.ll | 2 +- test/Transforms/InstCombine/or-to-xor.ll | 4 +- test/Transforms/InstCombine/phi-merge-gep.ll | 4 +- test/Transforms/InstCombine/phi.ll | 10 + test/Transforms/InstCombine/pr12338.ll | 24 + test/Transforms/InstCombine/pr2645-0.ll | 2 +- test/Transforms/InstCombine/sdiv-shift.ll | 9 - test/Transforms/InstCombine/select-crash.ll | 17 + test/Transforms/InstCombine/select-load-call.ll | 2 +- .../InstCombine/setcc-strength-reduce.ll | 2 +- test/Transforms/InstCombine/shift.ll | 59 ++- test/Transforms/InstCombine/shufflemask-undef.ll | 2 +- test/Transforms/InstCombine/shufflevec-constant.ll | 2 +- test/Transforms/InstCombine/signed-comparison.ll | 2 +- test/Transforms/InstCombine/srem-simplify-bug.ll | 2 +- test/Transforms/InstCombine/stack-overalign.ll | 2 +- test/Transforms/InstCombine/stacksaverestore.ll | 2 +- test/Transforms/InstCombine/trunc.ll | 13 +- test/Transforms/InstCombine/udiv-simplify-bug-0.ll | 2 +- test/Transforms/InstCombine/urem-simplify-bug.ll | 2 +- test/Transforms/InstCombine/vec_demanded_elts.ll | 47 ++ test/Transforms/InstCombine/vec_insertelt.ll | 2 +- test/Transforms/InstCombine/vec_narrow.ll | 2 +- test/Transforms/InstCombine/vector-srem.ll | 2 +- test/Transforms/InstCombine/volatile_store.ll | 4 +- test/Transforms/InstCombine/xor.ll | 2 +- test/Transforms/InstCombine/zeroext-and-reduce.ll | 2 +- test/Transforms/InstCombine/zext-bool-add-sub.ll | 39 +- test/Transforms/InstCombine/zext-fold.ll | 2 +- .../JumpThreading/2008-11-27-EntryMunge.ll | 2 +- .../2012-07-19-NoSuccessorIndirectBr.ll | 8 + test/Transforms/JumpThreading/compare.ll | 2 +- .../JumpThreading/no-irreducible-loops.ll | 4 +- test/Transforms/JumpThreading/phi-eq.ll | 209 ++++++++ .../LCSSA/2006-06-03-IncorrectIDFPhis.ll | 2 +- .../LCSSA/2006-06-12-MultipleExitsSameBlock.ll | 4 +- test/Transforms/LCSSA/basictest.ll | 4 +- test/Transforms/LCSSA/unreachable-use.ll | 2 +- test/Transforms/LCSSA/unused-phis.ll | 4 +- .../Transforms/LICM/2003-02-27-PreheaderProblem.ll | 2 +- test/Transforms/LICM/2007-05-22-VolatileSink.ll | 2 +- test/Transforms/LICM/hoist-invariant-load.ll | 2 +- test/Transforms/LICM/promote-order.ll | 41 ++ test/Transforms/LICM/speculate.ll | 22 + test/Transforms/LoopRotate/PhiRename-1.ll | 5 +- test/Transforms/LoopSimplify/indirectbr.ll | 2 +- test/Transforms/LoopSimplify/merge-exits.ll | 2 +- test/Transforms/LoopSimplify/preserve-scev.ll | 2 +- .../LoopStrengthReduce/2012-07-13-ExpandUDiv.ll | 90 ++++ .../2012-07-18-LimitReassociate.ll | 517 +++++++++++++++++++ .../ARM/2012-06-15-lsr-noaddrmode.ll | 102 ++++ .../LoopStrengthReduce/X86/2012-01-13-phielim.ll | 56 ++ .../dont-hoist-simple-loop-constants.ll | 2 +- test/Transforms/LoopStrengthReduce/dont_reverse.ll | 2 +- .../LoopStrengthReduce/invariant_value_first.ll | 2 +- .../invariant_value_first_arg.ll | 2 +- test/Transforms/LoopStrengthReduce/pr2570.ll | 2 +- .../LoopStrengthReduce/quadradic-exit-value.ll | 2 +- .../use_postinc_value_outside_loop.ll | 2 +- .../var_stride_used_by_compare.ll | 4 +- .../LoopUnswitch/2008-11-03-Invariant.ll | 2 +- .../LoopUnswitch/2011-11-18-SimpleSwitch.ll | 8 +- .../2011-11-18-TwoSwitches-Threshold.ll | 10 +- .../LoopUnswitch/2011-11-18-TwoSwitches.ll | 34 +- test/Transforms/LoopUnswitch/2012-05-20-Phi.ll | 25 + test/Transforms/LowerSwitch/feature.ll | 97 +++- .../MemCpyOpt/2008-02-24-MultipleUseofSRet.ll | 2 +- .../MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll | 2 +- test/Transforms/MemCpyOpt/memcpy.ll | 22 + test/Transforms/MemCpyOpt/sret.ll | 2 +- test/Transforms/MergeFunc/fold-weak.ll | 4 +- test/Transforms/MergeFunc/phi-speculation1.ll | 2 +- test/Transforms/MergeFunc/phi-speculation2.ll | 2 +- test/Transforms/MergeFunc/vector.ll | 2 +- test/Transforms/ObjCARC/basic.ll | 24 + test/Transforms/ObjCARC/contract-storestrong.ll | 110 ++++ test/Transforms/ObjCARC/contract-testcases.ll | 35 +- test/Transforms/ObjCARC/split-backedge.ll | 48 ++ test/Transforms/ObjCARC/weak-dce.ll | 46 ++ test/Transforms/PhaseOrdering/PR6627.ll | 93 ++++ test/Transforms/PhaseOrdering/basic.ll | 111 +--- test/Transforms/PhaseOrdering/scev.ll | 64 +++ test/Transforms/PruneEH/2003-09-14-ExternalCall.ll | 14 - test/Transforms/PruneEH/simplenoreturntest.ll | 2 +- test/Transforms/Reassociate/2005-08-24-Crash.ll | 13 - .../Reassociate/2005-09-01-ArrayOutOfBounds.ll | 2 +- .../Transforms/Reassociate/2012-05-08-UndefLeak.ll | 85 +++ .../Reassociate/2012-06-08-InfiniteLoop.ll | 21 + test/Transforms/Reassociate/absorption.ll | 11 + test/Transforms/Reassociate/crash.ll | 77 +++ test/Transforms/Reassociate/fp-commute.ll | 18 + test/Transforms/Reassociate/mightymul.ll | 35 ++ test/Transforms/Reassociate/mulfactor.ll | 138 ++++- test/Transforms/Reassociate/mulfactor2.ll | 15 - test/Transforms/Reassociate/multistep.ll | 31 ++ test/Transforms/Reassociate/no-op.ll | 38 ++ test/Transforms/Reassociate/repeats.ll | 252 +++++++++ test/Transforms/Reassociate/shifttest.ll | 2 +- test/Transforms/SCCP/2004-12-10-UndefBranchBug.ll | 2 +- test/Transforms/SCCP/2006-12-19-UndefBug.ll | 2 +- .../SCCP/2008-04-22-multiple-ret-sccp.ll | 2 +- test/Transforms/SCCP/2008-05-23-UndefCallFold.ll | 2 +- test/Transforms/SCCP/2009-01-14-IPSCCP-Invoke.ll | 4 +- test/Transforms/SCCP/apint-array.ll | 2 +- test/Transforms/SCCP/apint-basictest4.ll | 2 +- test/Transforms/SCCP/apint-ipsccp1.ll | 4 +- test/Transforms/SCCP/apint-ipsccp2.ll | 4 +- test/Transforms/SCCP/logical-nuke.ll | 2 +- test/Transforms/SCCP/vector-bitcast.ll | 20 + .../ScalarRepl/2003-09-12-IncorrectPromote.ll | 2 +- .../ScalarRepl/2003-10-29-ArrayProblem.ll | 2 +- .../Transforms/ScalarRepl/2008-01-29-PromoteBug.ll | 2 +- .../Transforms/ScalarRepl/2008-06-22-LargeArray.ll | 2 +- .../2008-08-22-out-of-range-array-promote.ll | 2 +- .../2009-02-02-ScalarPromoteOutOfRange.ll | 2 +- test/Transforms/ScalarRepl/2009-02-05-LoadFCA.ll | 2 +- .../ScalarRepl/2009-03-04-MemCpyAlign.ll | 2 +- .../ScalarRepl/2011-06-08-VectorExtractValue.ll | 25 +- test/Transforms/ScalarRepl/crash.ll | 22 + test/Transforms/ScalarRepl/dynamic-vector-gep.ll | 167 ++++++ test/Transforms/ScalarRepl/memcpy-from-global.ll | 36 ++ .../ScalarRepl/memset-aggregate-byte-leader.ll | 2 +- test/Transforms/ScalarRepl/memset-aggregate.ll | 4 +- test/Transforms/ScalarRepl/not-a-vector.ll | 4 +- test/Transforms/ScalarRepl/union-fp-int.ll | 2 +- test/Transforms/ScalarRepl/union-pointer.ll | 2 +- test/Transforms/ScalarRepl/vector_memcpy.ll | 4 +- test/Transforms/ScalarRepl/volatile.ll | 4 +- .../SimplifyCFG/2002-05-05-EmptyBlockMerge.ll | 2 +- .../SimplifyCFG/2003-08-05-MishandleInvoke.ll | 15 - .../SimplifyCFG/2003-08-17-BranchFold.ll | 2 +- .../SimplifyCFG/2003-08-17-BranchFoldOrdering.ll | 2 +- .../SimplifyCFG/2006-10-29-InvokeCrash.ll | 567 -------------------- .../SimplifyCFG/2008-01-02-hoist-fp-add.ll | 2 +- .../SimplifyCFG/2008-05-16-PHIBlockMerge.ll | 4 +- .../SimplifyCFG/2008-07-13-InfLoopMiscompile.ll | 2 +- .../SimplifyCFG/2009-06-15-InvokeCrash.ll | 569 --------------------- test/Transforms/SimplifyCFG/BrUnwind.ll | 2 +- test/Transforms/SimplifyCFG/DeadSetCC.ll | 2 +- .../Transforms/SimplifyCFG/UncondBranchToReturn.ll | 2 +- test/Transforms/SimplifyCFG/branch-fold.ll | 51 ++ test/Transforms/SimplifyCFG/branch-phi-thread.ll | 2 +- test/Transforms/SimplifyCFG/duplicate-phis.ll | 2 +- test/Transforms/SimplifyCFG/invoke.ll | 139 +++++ test/Transforms/SimplifyCFG/switch_thread.ll | 2 +- .../2007-04-06-strchr-miscompile.ll | 6 +- .../SimplifyLibCalls/2009-02-12-StrTo.ll | 8 +- .../SimplifyLibCalls/2009-05-30-memcmp-byte.ll | 2 +- test/Transforms/SimplifyLibCalls/FFS.ll | 2 +- test/Transforms/SimplifyLibCalls/FPrintF.ll | 2 +- test/Transforms/SimplifyLibCalls/FPuts.ll | 2 +- test/Transforms/SimplifyLibCalls/MemCpy.ll | 2 +- test/Transforms/SimplifyLibCalls/SPrintF.ll | 2 +- test/Transforms/SimplifyLibCalls/StpCpy.ll | 43 ++ test/Transforms/SimplifyLibCalls/StrCat.ll | 4 +- test/Transforms/SimplifyLibCalls/StrLen.ll | 2 +- test/Transforms/SimplifyLibCalls/StrNCat.ll | 4 +- test/Transforms/SimplifyLibCalls/StrNCpy.ll | 2 +- test/Transforms/SimplifyLibCalls/ToAscii.ll | 2 +- test/Transforms/SimplifyLibCalls/abs.ll | 2 +- test/Transforms/SimplifyLibCalls/exp2.ll | 2 +- test/Transforms/SimplifyLibCalls/memmove.ll | 2 +- test/Transforms/SimplifyLibCalls/memset-64.ll | 2 +- test/Transforms/SimplifyLibCalls/memset.ll | 2 +- test/Transforms/SimplifyLibCalls/pow2.ll | 2 +- test/Transforms/Sink/basic.ll | 26 + test/Transforms/TailCallElim/ackermann.ll | 2 +- .../TailCallElim/dont-tce-tail-marked-call.ll | 2 +- test/Transforms/TailCallElim/dup_tail.ll | 2 +- .../TailCallElim/trivial_codegen_tailcall.ll | 2 +- .../TailDup/2008-06-11-AvoidDupLoopHeader.ll | 2 +- 376 files changed, 5289 insertions(+), 1747 deletions(-) create mode 100644 test/Transforms/BBVectorize/metadata.ll create mode 100644 test/Transforms/BBVectorize/simple-tst.ll create mode 100644 test/Transforms/BBVectorize/simple3.ll create mode 100644 test/Transforms/GVN/2012-05-22-PreCrash.ll create mode 100644 test/Transforms/GVN/fpmath.ll create mode 100644 test/Transforms/GVN/pr12979.ll create mode 100644 test/Transforms/GVN/range.ll create mode 100644 test/Transforms/GVN/tbaa.ll create mode 100644 test/Transforms/GlobalOpt/2012-05-11-blockaddress.ll create mode 100644 test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll create mode 100644 test/Transforms/IndVarSimplify/2012-07-17-lftr-undef.ll create mode 100644 test/Transforms/IndVarSimplify/ult-sub-to-eq.ll create mode 100644 test/Transforms/Inline/inline-byval-bonus.ll create mode 100644 test/Transforms/Inline/inline-optsize.ll create mode 100644 test/Transforms/InstCombine/2012-04-23-Neon-Intrinsics.ll create mode 100644 test/Transforms/InstCombine/2012-04-24-vselect.ll create mode 100644 test/Transforms/InstCombine/2012-05-27-Negative-Shift-Crash.ll create mode 100644 test/Transforms/InstCombine/2012-05-28-select-hang.ll create mode 100644 test/Transforms/InstCombine/2012-06-06-LoadOfPHIs.ll create mode 100644 test/Transforms/InstCombine/2012-07-25-LoadPart.ll create mode 100644 test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll create mode 100644 test/Transforms/InstCombine/2012-6-7-vselect-bitcast.ll create mode 100644 test/Transforms/InstCombine/and-xor-or.ll create mode 100644 test/Transforms/InstCombine/div-shift.ll create mode 100644 test/Transforms/InstCombine/invoke.ll create mode 100644 test/Transforms/InstCombine/objsize-64.ll create mode 100644 test/Transforms/InstCombine/pr12338.ll delete mode 100644 test/Transforms/InstCombine/sdiv-shift.ll create mode 100644 test/Transforms/JumpThreading/2012-07-19-NoSuccessorIndirectBr.ll create mode 100644 test/Transforms/JumpThreading/phi-eq.ll create mode 100644 test/Transforms/LICM/promote-order.ll create mode 100644 test/Transforms/LoopStrengthReduce/2012-07-13-ExpandUDiv.ll create mode 100644 test/Transforms/LoopStrengthReduce/2012-07-18-LimitReassociate.ll create mode 100644 test/Transforms/LoopStrengthReduce/ARM/2012-06-15-lsr-noaddrmode.ll create mode 100644 test/Transforms/LoopUnswitch/2012-05-20-Phi.ll create mode 100644 test/Transforms/ObjCARC/split-backedge.ll create mode 100644 test/Transforms/ObjCARC/weak-dce.ll create mode 100644 test/Transforms/PhaseOrdering/PR6627.ll create mode 100644 test/Transforms/PhaseOrdering/scev.ll delete mode 100644 test/Transforms/PruneEH/2003-09-14-ExternalCall.ll delete mode 100644 test/Transforms/Reassociate/2005-08-24-Crash.ll create mode 100644 test/Transforms/Reassociate/2012-05-08-UndefLeak.ll create mode 100644 test/Transforms/Reassociate/2012-06-08-InfiniteLoop.ll create mode 100644 test/Transforms/Reassociate/absorption.ll create mode 100644 test/Transforms/Reassociate/fp-commute.ll create mode 100644 test/Transforms/Reassociate/mightymul.ll delete mode 100644 test/Transforms/Reassociate/mulfactor2.ll create mode 100644 test/Transforms/Reassociate/multistep.ll create mode 100644 test/Transforms/Reassociate/no-op.ll create mode 100644 test/Transforms/Reassociate/repeats.ll create mode 100644 test/Transforms/SCCP/vector-bitcast.ll create mode 100644 test/Transforms/ScalarRepl/dynamic-vector-gep.ll delete mode 100644 test/Transforms/SimplifyCFG/2003-08-05-MishandleInvoke.ll delete mode 100644 test/Transforms/SimplifyCFG/2006-10-29-InvokeCrash.ll delete mode 100644 test/Transforms/SimplifyCFG/2009-06-15-InvokeCrash.ll create mode 100644 test/Transforms/SimplifyCFG/invoke.ll create mode 100644 test/Transforms/SimplifyLibCalls/StpCpy.ll (limited to 'test/Transforms') diff --git a/test/Transforms/ArgumentPromotion/2008-07-02-array-indexing.ll b/test/Transforms/ArgumentPromotion/2008-07-02-array-indexing.ll index d7d5eb5..210eb97 100644 --- a/test/Transforms/ArgumentPromotion/2008-07-02-array-indexing.ll +++ b/test/Transforms/ArgumentPromotion/2008-07-02-array-indexing.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -argpromotion -S > %t -; RUN: cat %t | grep {define.*@callee(.*i32\\*} +; RUN: cat %t | grep "define.*@callee(.*i32\*" ; PR2498 ; This test tries to convince argpromotion about promoting the load from %A + 2, diff --git a/test/Transforms/ArgumentPromotion/byval-2.ll b/test/Transforms/ArgumentPromotion/byval-2.ll index bd62c68..368c689 100644 --- a/test/Transforms/ArgumentPromotion/byval-2.ll +++ b/test/Transforms/ArgumentPromotion/byval-2.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -argpromotion -S | grep -F {i32* byval} | count 2 +; RUN: opt < %s -argpromotion -S | grep -F "i32* byval" | count 2 ; Argpromote + scalarrepl should change this to passing the two integers by value. %struct.ss = type { i32, i64 } diff --git a/test/Transforms/ArgumentPromotion/control-flow.ll b/test/Transforms/ArgumentPromotion/control-flow.ll index 08ca6bc..e4a61da 100644 --- a/test/Transforms/ArgumentPromotion/control-flow.ll +++ b/test/Transforms/ArgumentPromotion/control-flow.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -argpromotion -S | \ -; RUN: not grep {load i32\* null} +; RUN: not grep "load i32* null" define internal i32 @callee(i1 %C, i32* %P) { br i1 %C, label %T, label %F diff --git a/test/Transforms/ArgumentPromotion/control-flow2.ll b/test/Transforms/ArgumentPromotion/control-flow2.ll index 9a8afc3..2543218 100644 --- a/test/Transforms/ArgumentPromotion/control-flow2.ll +++ b/test/Transforms/ArgumentPromotion/control-flow2.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -argpromotion -S | \ -; RUN: grep {load i32\\* %A} +; RUN: grep "load i32\* %A" target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" define internal i32 @callee(i1 %C, i32* %P) { diff --git a/test/Transforms/BBVectorize/metadata.ll b/test/Transforms/BBVectorize/metadata.ll new file mode 100644 index 0000000..1e3aaa1 --- /dev/null +++ b/test/Transforms/BBVectorize/metadata.ll @@ -0,0 +1,49 @@ +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-S128" +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3 -S | FileCheck %s + +; Simple 3-pair chain with loads and stores (with fpmath) +define void @test1(double* %a, double* %b, double* %c) nounwind uwtable readonly { +entry: + %i0 = load double* %a, align 8 + %i1 = load double* %b, align 8 + %mul = fmul double %i0, %i1, !fpmath !2 + %arrayidx3 = getelementptr inbounds double* %a, i64 1 + %i3 = load double* %arrayidx3, align 8 + %arrayidx4 = getelementptr inbounds double* %b, i64 1 + %i4 = load double* %arrayidx4, align 8 + %mul5 = fmul double %i3, %i4, !fpmath !3 + store double %mul, double* %c, align 8 + %arrayidx5 = getelementptr inbounds double* %c, i64 1 + store double %mul5, double* %arrayidx5, align 8 + ret void +; CHECK: @test1 +; CHECK: !fpmath +; CHECK: ret void +} + +; Simple 3-pair chain with loads and stores (ints with range) +define void @test2(i64* %a, i64* %b, i64* %c) nounwind uwtable readonly { +entry: + %i0 = load i64* %a, align 8, !range !0 + %i1 = load i64* %b, align 8 + %mul = mul i64 %i0, %i1 + %arrayidx3 = getelementptr inbounds i64* %a, i64 1 + %i3 = load i64* %arrayidx3, align 8, !range !1 + %arrayidx4 = getelementptr inbounds i64* %b, i64 1 + %i4 = load i64* %arrayidx4, align 8 + %mul5 = mul i64 %i3, %i4 + store i64 %mul, i64* %c, align 8 + %arrayidx5 = getelementptr inbounds i64* %c, i64 1 + store i64 %mul5, i64* %arrayidx5, align 8 + ret void +; CHECK: @test2 +; CHECK-NOT: !range +; CHECK: ret void +} + +!0 = metadata !{i64 0, i64 2} +!1 = metadata !{i64 3, i64 5} + +!2 = metadata !{ float 5.0 } +!3 = metadata !{ float 2.5 } + diff --git a/test/Transforms/BBVectorize/simple-sel.ll b/test/Transforms/BBVectorize/simple-sel.ll index 4daa571..325792a 100644 --- a/test/Transforms/BBVectorize/simple-sel.ll +++ b/test/Transforms/BBVectorize/simple-sel.ll @@ -1,5 +1,6 @@ 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" ; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3 -instcombine -gvn -S | FileCheck %s +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3 -bb-vectorize-no-bools -instcombine -gvn -S | FileCheck %s -check-prefix=CHECK-NB ; Basic depth-3 chain with select define double @test1(double %A1, double %A2, double %B1, double %B2, i1 %C1, i1 %C2) { @@ -27,4 +28,32 @@ define double @test1(double %A1, double %A2, double %B1, double %B2, i1 %C1, i1 ; CHECK: ret double %R } +; Basic depth-3 chain with select (and vect. compare) +define double @test2(double %A1, double %A2, double %B1, double %B2) { +; CHECK: @test2 +; CHECK-NB: @test2 +; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0 +; CHECK: %X1.v.i0.1 = insertelement <2 x double> undef, double %A1, i32 0 +; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1 +; CHECK: %X1.v.i0.2 = insertelement <2 x double> %X1.v.i0.1, double %A2, i32 1 + %X1 = fsub double %A1, %B1 + %X2 = fsub double %A2, %B2 +; CHECK: %X1 = fsub <2 x double> %X1.v.i0.2, %X1.v.i1.2 + %Y1 = fmul double %X1, %A1 + %Y2 = fmul double %X2, %A2 +; CHECK: %Y1 = fmul <2 x double> %X1, %X1.v.i0.2 + %C1 = fcmp ogt double %X1, %A1 + %C2 = fcmp ogt double %X2, %A2 +; CHECK: %C1 = fcmp ogt <2 x double> %X1, %X1.v.i0.2 +; CHECK-NB: fcmp ogt double + %Z1 = select i1 %C1, double %Y1, double %B1 + %Z2 = select i1 %C2, double %Y2, double %B2 +; CHECK: %Z1 = select <2 x i1> %C1, <2 x double> %Y1, <2 x double> %X1.v.i1.2 + %R = fmul double %Z1, %Z2 +; CHECK: %Z1.v.r1 = extractelement <2 x double> %Z1, i32 0 +; CHECK: %Z1.v.r2 = extractelement <2 x double> %Z1, i32 1 +; CHECK: %R = fmul double %Z1.v.r1, %Z1.v.r2 + ret double %R +; CHECK: ret double %R +} diff --git a/test/Transforms/BBVectorize/simple-tst.ll b/test/Transforms/BBVectorize/simple-tst.ll new file mode 100644 index 0000000..42146c6 --- /dev/null +++ b/test/Transforms/BBVectorize/simple-tst.ll @@ -0,0 +1,18 @@ +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-v128:128:128-n32:64" +target triple = "powerpc64-unknown-linux" +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3 -bb-vectorize-vector-bits=256 -instcombine -gvn -S | FileCheck %s + +; Basic depth-3 chain (target-specific type should not vectorize) +define ppc_fp128 @test7(ppc_fp128 %A1, ppc_fp128 %A2, ppc_fp128 %B1, ppc_fp128 %B2) { +; CHECK: @test7 +; CHECK-NOT: <2 x ppc_fp128> + %X1 = fsub ppc_fp128 %A1, %B1 + %X2 = fsub ppc_fp128 %A2, %B2 + %Y1 = fmul ppc_fp128 %X1, %A1 + %Y2 = fmul ppc_fp128 %X2, %A2 + %Z1 = fadd ppc_fp128 %Y1, %B1 + %Z2 = fadd ppc_fp128 %Y2, %B2 + %R = fmul ppc_fp128 %Z1, %Z2 + ret ppc_fp128 %R +} + diff --git a/test/Transforms/BBVectorize/simple.ll b/test/Transforms/BBVectorize/simple.ll index 904d766..88eb9c9 100644 --- a/test/Transforms/BBVectorize/simple.ll +++ b/test/Transforms/BBVectorize/simple.ll @@ -138,8 +138,7 @@ define <8 x i8> @test6(<8 x i8> %A1, <8 x i8> %A2, <8 x i8> %B1, <8 x i8> %B2) { ; CHECK: %Z1 = add <16 x i8> %Y1, %X1.v.i1 %Q1 = shufflevector <8 x i8> %Z1, <8 x i8> %Z2, <8 x i32> %Q2 = shufflevector <8 x i8> %Z2, <8 x i8> %Z2, <8 x i32> -; CHECK: %Z1.v.r2 = shufflevector <16 x i8> %Z1, <16 x i8> undef, <8 x i32> -; CHECK: %Q1.v.i1 = shufflevector <8 x i8> %Z1.v.r2, <8 x i8> undef, <16 x i32> +; CHECK: %Q1.v.i1 = shufflevector <16 x i8> %Z1, <16 x i8> undef, <16 x i32> ; CHECK: %Q1 = shufflevector <16 x i8> %Z1, <16 x i8> %Q1.v.i1, <16 x i32> %R = mul <8 x i8> %Q1, %Q2 ; CHECK: %Q1.v.r1 = shufflevector <16 x i8> %Q1, <16 x i8> undef, <8 x i32> diff --git a/test/Transforms/BBVectorize/simple3.ll b/test/Transforms/BBVectorize/simple3.ll new file mode 100644 index 0000000..153be73 --- /dev/null +++ b/test/Transforms/BBVectorize/simple3.ll @@ -0,0 +1,35 @@ +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" +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3 -bb-vectorize-vector-bits=192 -instcombine -gvn -S | FileCheck %s + +; Basic depth-3 chain +define double @test1(double %A1, double %A2, double %A3, double %B1, double %B2, double %B3) { +; CHECK: @test1 +; CHECK: %X1.v.i1.11 = insertelement <3 x double> undef, double %B1, i32 0 +; CHECK: %X1.v.i1.22 = insertelement <3 x double> %X1.v.i1.11, double %B2, i32 1 +; CHECK: %X1.v.i1 = insertelement <3 x double> %X1.v.i1.22, double %B3, i32 2 +; CHECK: %X1.v.i0.13 = insertelement <3 x double> undef, double %A1, i32 0 +; CHECK: %X1.v.i0.24 = insertelement <3 x double> %X1.v.i0.13, double %A2, i32 1 +; CHECK: %X1.v.i0 = insertelement <3 x double> %X1.v.i0.24, double %A3, i32 2 + %X1 = fsub double %A1, %B1 + %X2 = fsub double %A2, %B2 + %X3 = fsub double %A3, %B3 +; CHECK: %X1 = fsub <3 x double> %X1.v.i0, %X1.v.i1 + %Y1 = fmul double %X1, %A1 + %Y2 = fmul double %X2, %A2 + %Y3 = fmul double %X3, %A3 +; CHECK: %Y1 = fmul <3 x double> %X1, %X1.v.i0 + %Z1 = fadd double %Y1, %B1 + %Z2 = fadd double %Y2, %B2 + %Z3 = fadd double %Y3, %B3 +; CHECK: %Z1 = fadd <3 x double> %Y1, %X1.v.i1 + %R1 = fmul double %Z1, %Z2 + %R = fmul double %R1, %Z3 +; CHECK: %Z1.v.r210 = extractelement <3 x double> %Z1, i32 2 +; CHECK: %Z1.v.r1 = extractelement <3 x double> %Z1, i32 0 +; CHECK: %Z1.v.r2 = extractelement <3 x double> %Z1, i32 1 +; CHECK: %R1 = fmul double %Z1.v.r1, %Z1.v.r2 +; CHECK: %R = fmul double %R1, %Z1.v.r210 + ret double %R +; CHECK: ret double %R +} + diff --git a/test/Transforms/CodeGenPrepare/basic.ll b/test/Transforms/CodeGenPrepare/basic.ll index ebf10f0..c68e77e 100644 --- a/test/Transforms/CodeGenPrepare/basic.ll +++ b/test/Transforms/CodeGenPrepare/basic.ll @@ -5,7 +5,7 @@ target triple = "x86_64-apple-darwin10.0.0" ; CHECK: @test1 ; objectsize should fold to a constant, which causes the branch to fold to an -; uncond branch. +; uncond branch. Next, we fold the control flow alltogether. ; rdar://8785296 define i32 @test1(i8* %ptr) nounwind ssp noredzone align 2 { entry: @@ -13,8 +13,8 @@ entry: %1 = icmp ugt i64 %0, 3 br i1 %1, label %T, label %trap -; CHECK: entry: -; CHECK-NEXT: br label %T +; CHECK: T: +; CHECK-NOT: br label % trap: ; preds = %0, %entry tail call void @llvm.trap() noreturn nounwind diff --git a/test/Transforms/ConstProp/2002-05-03-NotOperator.ll b/test/Transforms/ConstProp/2002-05-03-NotOperator.ll index b957220..ca1d618 100644 --- a/test/Transforms/ConstProp/2002-05-03-NotOperator.ll +++ b/test/Transforms/ConstProp/2002-05-03-NotOperator.ll @@ -5,7 +5,7 @@ ; Fix #2: The unary not instruction now no longer exists. Change to xor. ; RUN: opt < %s -constprop -S | \ -; RUN: not grep {i32 0} +; RUN: not grep "i32 0" define i32 @test1() { %R = xor i32 123, -1 ; [#uses=1] diff --git a/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll b/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll index 0b44b99..d68cb26 100644 --- a/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll +++ b/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -constprop -S | \ -; RUN: not grep {ret i1 false} +; RUN: not grep "ret i1 false" @b = external global [2 x { }] ; <[2 x { }]*> [#uses=2] diff --git a/test/Transforms/ConstProp/2006-11-30-vector-cast.ll b/test/Transforms/ConstProp/2006-11-30-vector-cast.ll index be76783..4a93144 100644 --- a/test/Transforms/ConstProp/2006-11-30-vector-cast.ll +++ b/test/Transforms/ConstProp/2006-11-30-vector-cast.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -constprop -S | \ -; RUN: grep {i32 -1} +; RUN: grep "i32 -1" ; RUN: opt < %s -constprop -S | \ ; RUN: not grep zeroinitializer diff --git a/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll b/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll index e46a875..ce66c70 100644 --- a/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll +++ b/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -instcombine -S | \ -; RUN: grep {ret i1 false} +; RUN: grep "ret i1 false" define i1 @test() { %X = trunc i32 320 to i1 ; [#uses=1] ret i1 %X diff --git a/test/Transforms/ConstProp/2006-12-01-bool-casts.ll b/test/Transforms/ConstProp/2006-12-01-bool-casts.ll index 3c06693..71db421 100644 --- a/test/Transforms/ConstProp/2006-12-01-bool-casts.ll +++ b/test/Transforms/ConstProp/2006-12-01-bool-casts.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -constprop -S | \ -; RUN: grep {ret i32 -1} +; RUN: grep "ret i32 -1" ; RUN: opt < %s -constprop -S | \ -; RUN: grep {ret i32 1} +; RUN: grep "ret i32 1" define i32 @test1() { %A = sext i1 true to i32 ; [#uses=1] diff --git a/test/Transforms/ConstProp/2007-02-23-sdiv.ll b/test/Transforms/ConstProp/2007-02-23-sdiv.ll index 721199f..75f58b5 100644 --- a/test/Transforms/ConstProp/2007-02-23-sdiv.ll +++ b/test/Transforms/ConstProp/2007-02-23-sdiv.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llvm-dis | grep {global i32 0} +; RUN: llvm-as < %s | llvm-dis | grep "global i32 0" ; PR1215 @G = global i32 sdiv (i32 0, i32 -1) diff --git a/test/Transforms/ConstProp/2007-11-23-cttz.ll b/test/Transforms/ConstProp/2007-11-23-cttz.ll index a28c9b0..6d34cb1 100644 --- a/test/Transforms/ConstProp/2007-11-23-cttz.ll +++ b/test/Transforms/ConstProp/2007-11-23-cttz.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -constprop -S | grep {ret i13 13} +; RUN: opt < %s -constprop -S | grep "ret i13 13" ; PR1816 declare i13 @llvm.cttz.i13(i13, i1) diff --git a/test/Transforms/ConstProp/div-zero.ll b/test/Transforms/ConstProp/div-zero.ll index f78a34f..a2c59d3 100644 --- a/test/Transforms/ConstProp/div-zero.ll +++ b/test/Transforms/ConstProp/div-zero.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -instcombine -S | grep {ret i32 0} +; RUN: opt < %s -instcombine -S | grep "ret i32 0" ; PR4424 declare void @ext() diff --git a/test/Transforms/CorrelatedValuePropagation/range.ll b/test/Transforms/CorrelatedValuePropagation/range.ll index 9b70ed2..6750546 100644 --- a/test/Transforms/CorrelatedValuePropagation/range.ll +++ b/test/Transforms/CorrelatedValuePropagation/range.ll @@ -41,3 +41,127 @@ end: ; CHECK: then: ; CHECK-NEXT: br i1 false, label %end, label %else } + +; CHECK: @test3 +define i32 @test3(i32 %c) nounwind { + %cmp = icmp slt i32 %c, 2 + br i1 %cmp, label %if.then, label %if.end + +if.then: + ret i32 1 + +if.end: + %cmp1 = icmp slt i32 %c, 3 + br i1 %cmp1, label %if.then2, label %if.end8 + +; CHECK: if.then2 +if.then2: + %cmp2 = icmp eq i32 %c, 2 +; CHECK: br i1 true + br i1 %cmp2, label %if.then4, label %if.end6 + +; CHECK: if.end6 +if.end6: + ret i32 2 + +if.then4: + ret i32 3 + +if.end8: + ret i32 4 +} + +; CHECK: @test4 +define i32 @test4(i32 %c) nounwind { + switch i32 %c, label %sw.default [ + i32 1, label %sw.bb + i32 2, label %sw.bb + i32 4, label %sw.bb + ] + +; CHECK: sw.bb +sw.bb: + %cmp = icmp sge i32 %c, 1 +; CHECK: br i1 true + br i1 %cmp, label %if.then, label %if.end + +if.then: + br label %return + +if.end: + br label %return + +sw.default: + br label %return + +return: + %retval.0 = phi i32 [ 42, %sw.default ], [ 4, %if.then ], [ 9, %if.end ] + ret i32 %retval.0 +} + +; CHECK: @test5 +define i1 @test5(i32 %c) nounwind { + %cmp = icmp slt i32 %c, 5 + br i1 %cmp, label %if.then, label %if.end + +if.then: + %cmp1 = icmp eq i32 %c, 4 + br i1 %cmp1, label %if.end, label %if.end8 + +if.end: + ret i1 true + +if.end8: + %cmp2 = icmp eq i32 %c, 3 + %cmp3 = icmp eq i32 %c, 4 + %cmp4 = icmp eq i32 %c, 6 +; CHECK: %or = or i1 false, false + %or = or i1 %cmp3, %cmp4 +; CHECK: ret i1 %cmp2 + ret i1 %cmp2 +} + +; CHECK: @test6 +define i1 @test6(i32 %c) nounwind { + %cmp = icmp ule i32 %c, 7 + br i1 %cmp, label %if.then, label %if.end + +if.then: +; CHECK: icmp eq i32 %c, 6 +; CHECK: br i1 + switch i32 %c, label %if.end [ + i32 6, label %sw.bb + i32 8, label %sw.bb + ] + +if.end: + ret i1 true + +sw.bb: + %cmp2 = icmp eq i32 %c, 6 +; CHECK: ret i1 true + ret i1 %cmp2 +} + +; CHECK: @test7 +define i1 @test7(i32 %c) nounwind { +entry: + switch i32 %c, label %sw.default [ + i32 6, label %sw.bb + i32 7, label %sw.bb + ] + +sw.bb: + ret i1 true + +sw.default: + %cmp5 = icmp eq i32 %c, 5 + %cmp6 = icmp eq i32 %c, 6 + %cmp7 = icmp eq i32 %c, 7 + %cmp8 = icmp eq i32 %c, 8 +; CHECK: %or = or i1 %cmp5, false + %or = or i1 %cmp5, %cmp6 +; CHECK: %or2 = or i1 false, %cmp8 + %or2 = or i1 %cmp7, %cmp8 + ret i1 false +} diff --git a/test/Transforms/DeadArgElim/2007-02-07-FuncRename.ll b/test/Transforms/DeadArgElim/2007-02-07-FuncRename.ll index d5bd6c4..e5419f7 100644 --- a/test/Transforms/DeadArgElim/2007-02-07-FuncRename.ll +++ b/test/Transforms/DeadArgElim/2007-02-07-FuncRename.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -deadargelim -S | grep {@test(} +; RUN: opt < %s -deadargelim -S | grep "@test(" ; RUN: opt < %s -deadargelim -S | not grep dead define internal i32 @test(i32 %X, i32 %dead) { diff --git a/test/Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll b/test/Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll index d4edce9..cdd893f 100644 --- a/test/Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll +++ b/test/Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -deadargelim -S | not grep {ret i32 0} +; RUN: opt < %s -deadargelim -S | not grep "ret i32 0" ; PR1735 define internal i32 @test(i32 %A, ...) { diff --git a/test/Transforms/DeadArgElim/canon.ll b/test/Transforms/DeadArgElim/canon.ll index 11cd482..79c15a0 100644 --- a/test/Transforms/DeadArgElim/canon.ll +++ b/test/Transforms/DeadArgElim/canon.ll @@ -1,9 +1,9 @@ ; This test shows a few canonicalizations made by deadargelim ; RUN: opt < %s -deadargelim -S > %t ; This test should remove {} and replace it with void -; RUN: cat %t | grep {define internal void @test} +; RUN: cat %t | grep "define internal void @test" ; This test shouls replace the {i32} return value with just i32 -; RUN: cat %t | grep {define internal i32 @test2} +; RUN: cat %t | grep "define internal i32 @test2" define internal {} @test() { ret {} undef diff --git a/test/Transforms/DeadArgElim/keepalive.ll b/test/Transforms/DeadArgElim/keepalive.ll index 4d6aae3..dc92dc9f 100644 --- a/test/Transforms/DeadArgElim/keepalive.ll +++ b/test/Transforms/DeadArgElim/keepalive.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -deadargelim -S > %t -; RUN: grep {define internal zeroext i32 @test1() nounwind} %t -; RUN: grep {define internal <{ i32, i32 }> @test2} %t +; RUN: grep "define internal zeroext i32 @test1() nounwind" %t +; RUN: grep "define internal <{ i32, i32 }> @test2" %t %Ty = type <{ i32, i32 }> diff --git a/test/Transforms/DeadStoreElimination/simple.ll b/test/Transforms/DeadStoreElimination/simple.ll index 81eb5a8..7a8cdd5 100644 --- a/test/Transforms/DeadStoreElimination/simple.ll +++ b/test/Transforms/DeadStoreElimination/simple.ll @@ -164,7 +164,7 @@ define i32* @test13() { } declare noalias i8* @malloc(i32) - +declare noalias i8* @calloc(i32, i32) define void @test14(i32* %Q) { @@ -258,3 +258,55 @@ define void @test20() { } ; CHECK: @test20 ; CHECK-NEXT: ret void + +; CHECK: @test21 +define void @test21() { + %m = call i8* @calloc(i32 9, i32 7) + store i8 0, i8* %m +; CHECK-NEXT: ret void + ret void +} + +; CHECK: @test22( +define void @test22(i1 %i, i32 %k, i32 %m) nounwind { + %k.addr = alloca i32 + %m.addr = alloca i32 + %k.addr.m.addr = select i1 %i, i32* %k.addr, i32* %m.addr + store i32 0, i32* %k.addr.m.addr, align 4 +; CHECK-NEXT: ret void + ret void +} + +; PR13547 +; CHECK: @test23 +; CHECK: store i8 97 +; CHECK: store i8 0 +declare noalias i8* @strdup(i8* nocapture) nounwind +define noalias i8* @test23() nounwind uwtable ssp { + %x = alloca [2 x i8], align 1 + %arrayidx = getelementptr inbounds [2 x i8]* %x, i64 0, i64 0 + store i8 97, i8* %arrayidx, align 1 + %arrayidx1 = getelementptr inbounds [2 x i8]* %x, i64 0, i64 1 + store i8 0, i8* %arrayidx1, align 1 + %call = call i8* @strdup(i8* %arrayidx) nounwind + ret i8* %call +} + +; Make sure same sized store to later element is deleted +; CHECK: @test24 +; CHECK-NOT: store i32 0 +; CHECK-NOT: store i32 0 +; CHECK: store i32 %b +; CHECK: store i32 %c +; CHECK: ret void +define void @test24([2 x i32]* %a, i32 %b, i32 %c) nounwind { + %1 = getelementptr inbounds [2 x i32]* %a, i64 0, i64 0 + store i32 0, i32* %1, align 4 + %2 = getelementptr inbounds [2 x i32]* %a, i64 0, i64 1 + store i32 0, i32* %2, align 4 + %3 = getelementptr inbounds [2 x i32]* %a, i64 0, i64 0 + store i32 %b, i32* %3, align 4 + %4 = getelementptr inbounds [2 x i32]* %a, i64 0, i64 1 + store i32 %c, i32* %4, align 4 + ret void +} diff --git a/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll b/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll index 7ef5f06..f38c03a 100644 --- a/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll +++ b/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -functionattrs -S | not grep {nocapture *%%q} -; RUN: opt < %s -functionattrs -S | grep {nocapture *%%p} +; RUN: opt < %s -functionattrs -S | not grep "nocapture *%%q" +; RUN: opt < %s -functionattrs -S | grep "nocapture *%%p" define i32* @a(i32** %p) { %tmp = load i32** %p diff --git a/test/Transforms/GVN/2007-07-25-InfiniteLoop.ll b/test/Transforms/GVN/2007-07-25-InfiniteLoop.ll index 9983374..7e9c982 100644 --- a/test/Transforms/GVN/2007-07-25-InfiniteLoop.ll +++ b/test/Transforms/GVN/2007-07-25-InfiniteLoop.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -basicaa -gvn -S | not grep {tmp10 =} +; RUN: opt < %s -basicaa -gvn -S | not grep "tmp10 =" %struct.INT2 = type { i32, i32 } @blkshifts = external global %struct.INT2* ; <%struct.INT2**> [#uses=2] diff --git a/test/Transforms/GVN/2007-07-31-NoDomInherit.ll b/test/Transforms/GVN/2007-07-31-NoDomInherit.ll index f2c0012..5018a07 100644 --- a/test/Transforms/GVN/2007-07-31-NoDomInherit.ll +++ b/test/Transforms/GVN/2007-07-31-NoDomInherit.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -basicaa -gvn -S | grep {tmp47 = phi i32 } +; RUN: opt < %s -basicaa -gvn -S | grep "tmp47 = phi i32 " %struct.anon = type { i32 (i32, i32, i32)*, i32, i32, [3 x i32], i8*, i8*, i8* } @debug = external constant i32 ; [#uses=0] diff --git a/test/Transforms/GVN/2007-07-31-RedundantPhi.ll b/test/Transforms/GVN/2007-07-31-RedundantPhi.ll index a570e35..13419d1 100644 --- a/test/Transforms/GVN/2007-07-31-RedundantPhi.ll +++ b/test/Transforms/GVN/2007-07-31-RedundantPhi.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -basicaa -gvn -S | not grep {tmp701 =} +; RUN: opt < %s -basicaa -gvn -S | not grep "tmp701 =" @img_width = external global i16 ; [#uses=2] diff --git a/test/Transforms/GVN/2008-07-02-Unreachable.ll b/test/Transforms/GVN/2008-07-02-Unreachable.ll index 407940b..4f07868 100644 --- a/test/Transforms/GVN/2008-07-02-Unreachable.ll +++ b/test/Transforms/GVN/2008-07-02-Unreachable.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -basicaa -gvn -S | grep {ret i8 \[%\]tmp3} +; RUN: opt < %s -basicaa -gvn -S | grep "ret i8 [%]tmp3" ; PR2503 @g_3 = external global i8 ; [#uses=2] diff --git a/test/Transforms/GVN/2012-05-22-PreCrash.ll b/test/Transforms/GVN/2012-05-22-PreCrash.ll new file mode 100644 index 0000000..b488dda --- /dev/null +++ b/test/Transforms/GVN/2012-05-22-PreCrash.ll @@ -0,0 +1,33 @@ +; RUN: opt < %s -gvn +; PR12858 + +define void @fn5(i16 signext %p1, i8 signext %p2) nounwind uwtable { +entry: + br i1 undef, label %if.else, label %if.then + +if.then: ; preds = %entry + br label %if.end + +if.else: ; preds = %entry + %conv = sext i16 %p1 to i32 + br label %if.end + +if.end: ; preds = %if.else, %if.then + %conv1 = sext i16 %p1 to i32 + br i1 undef, label %if.then3, label %if.else4 + +if.then3: ; preds = %if.end + br label %if.end12 + +if.else4: ; preds = %if.end + %conv7 = sext i8 %p2 to i32 + %cmp8 = icmp eq i32 %conv1, %conv7 + br i1 %cmp8, label %if.then10, label %if.end12 + +if.then10: ; preds = %if.else4 + br label %if.end12 + +if.end12: ; preds = %if.then10, %if.else4, %if.then3 + %conv13 = sext i8 %p2 to i32 + ret void +} diff --git a/test/Transforms/GVN/basic.ll b/test/Transforms/GVN/basic.ll index 1decafa..6f4aace 100644 --- a/test/Transforms/GVN/basic.ll +++ b/test/Transforms/GVN/basic.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -S | not grep {%z2 =} +; RUN: opt < %s -gvn -S | not grep "%z2 =" define i32 @main() { block1: diff --git a/test/Transforms/GVN/calls-readonly.ll b/test/Transforms/GVN/calls-readonly.ll index 97ec915..a477740 100644 --- a/test/Transforms/GVN/calls-readonly.ll +++ b/test/Transforms/GVN/calls-readonly.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -basicaa -gvn -S | grep {call.*strlen} | count 1 +; RUN: opt < %s -basicaa -gvn -S | grep "call.*strlen" | count 1 ; Should delete the second call to strlen even though the intervening strchr call exists. 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" diff --git a/test/Transforms/GVN/fpmath.ll b/test/Transforms/GVN/fpmath.ll new file mode 100644 index 0000000..8ab2854 --- /dev/null +++ b/test/Transforms/GVN/fpmath.ll @@ -0,0 +1,45 @@ +; RUN: opt %s -gvn -S -o - | FileCheck %s + +define double @test1(double %x, double %y) { +; CHECK: @test1(double %x, double %y) +; CHECK: %add1 = fadd double %x, %y +; CHECK-NOT: fpmath +; CHECK: %foo = fadd double %add1, %add1 + %add1 = fadd double %x, %y, !fpmath !0 + %add2 = fadd double %x, %y + %foo = fadd double %add1, %add2 + ret double %foo +} + +define double @test2(double %x, double %y) { +; CHECK: @test2(double %x, double %y) +; CHECK: %add1 = fadd double %x, %y, !fpmath !0 +; CHECK: %foo = fadd double %add1, %add1 + %add1 = fadd double %x, %y, !fpmath !0 + %add2 = fadd double %x, %y, !fpmath !0 + %foo = fadd double %add1, %add2 + ret double %foo +} + +define double @test3(double %x, double %y) { +; CHECK: @test3(double %x, double %y) +; CHECK: %add1 = fadd double %x, %y, !fpmath !1 +; CHECK: %foo = fadd double %add1, %add1 + %add1 = fadd double %x, %y, !fpmath !1 + %add2 = fadd double %x, %y, !fpmath !0 + %foo = fadd double %add1, %add2 + ret double %foo +} + +define double @test4(double %x, double %y) { +; CHECK: @test4(double %x, double %y) +; CHECK: %add1 = fadd double %x, %y, !fpmath !1 +; CHECK: %foo = fadd double %add1, %add1 + %add1 = fadd double %x, %y, !fpmath !0 + %add2 = fadd double %x, %y, !fpmath !1 + %foo = fadd double %add1, %add2 + ret double %foo +} + +!0 = metadata !{ float 5.0 } +!1 = metadata !{ float 2.5 } diff --git a/test/Transforms/GVN/load-constant-mem.ll b/test/Transforms/GVN/load-constant-mem.ll index 314c806..a7dacea 100644 --- a/test/Transforms/GVN/load-constant-mem.ll +++ b/test/Transforms/GVN/load-constant-mem.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -basicaa -gvn -instcombine -S | grep {ret i32 0} +; RUN: opt < %s -basicaa -gvn -instcombine -S | grep "ret i32 0" ; PR4189 @G = external constant [4 x i32] diff --git a/test/Transforms/GVN/local-pre.ll b/test/Transforms/GVN/local-pre.ll index 5f03984..1d0dadf 100644 --- a/test/Transforms/GVN/local-pre.ll +++ b/test/Transforms/GVN/local-pre.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -enable-pre -S | grep {b.pre} +; RUN: opt < %s -gvn -enable-pre -S | grep "b.pre" define i32 @main(i32 %p) { block1: diff --git a/test/Transforms/GVN/nonescaping-malloc.ll b/test/Transforms/GVN/nonescaping-malloc.ll index dba9d81..afcb7fe 100644 --- a/test/Transforms/GVN/nonescaping-malloc.ll +++ b/test/Transforms/GVN/nonescaping-malloc.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -basicaa -gvn -stats -disable-output |& grep {Number of loads deleted} +; RUN: opt < %s -basicaa -gvn -stats -disable-output 2>&1 | grep "Number of loads deleted" ; rdar://7363102 ; GVN should be able to eliminate load %tmp22.i, because it is redundant with diff --git a/test/Transforms/GVN/pr12979.ll b/test/Transforms/GVN/pr12979.ll new file mode 100644 index 0000000..669da91 --- /dev/null +++ b/test/Transforms/GVN/pr12979.ll @@ -0,0 +1,79 @@ +; RUN: opt %s -gvn -S -o - | FileCheck %s + +define i32 @test1(i32 %x, i32 %y) { +; CHECK: @test1(i32 %x, i32 %y) +; CHECK: %add1 = add i32 %x, %y +; CHECK: %foo = add i32 %add1, %add1 + + %add1 = add nsw i32 %x, %y + %add2 = add i32 %x, %y + %foo = add i32 %add1, %add2 + ret i32 %foo +} + +define i32 @test2(i32 %x, i32 %y) { +; CHECK: @test2(i32 %x, i32 %y) +; CHECK: %add1 = add i32 %x, %y +; CHECK: %foo = add i32 %add1, %add1 + + %add1 = add nuw i32 %x, %y + %add2 = add i32 %x, %y + %foo = add i32 %add1, %add2 + ret i32 %foo +} + +define i32 @test3(i32 %x, i32 %y) { +; CHECK: @test3(i32 %x, i32 %y) +; CHECK: %add1 = add i32 %x, %y +; CHECK: %foo = add i32 %add1, %add1 + + %add1 = add nuw nsw i32 %x, %y + %add2 = add i32 %x, %y + %foo = add i32 %add1, %add2 + ret i32 %foo +} + +define i32 @test4(i32 %x, i32 %y) { +; CHECK: @test4(i32 %x, i32 %y) +; CHECK: %add1 = add nsw i32 %x, %y +; CHECK: %foo = add i32 %add1, %add1 + + %add1 = add nsw i32 %x, %y + %add2 = add nsw i32 %x, %y + %foo = add i32 %add1, %add2 + ret i32 %foo +} + +define i32 @test5(i32 %x, i32 %y) { +; CHECK: @test5(i32 %x, i32 %y) +; CHECK: %add1 = add i32 %x, %y +; CHECK: %foo = add i32 %add1, %add1 + + %add1 = add nuw i32 %x, %y + %add2 = add nsw i32 %x, %y + %foo = add i32 %add1, %add2 + ret i32 %foo +} + +define i32 @test6(i32 %x, i32 %y) { +; CHECK: @test6(i32 %x, i32 %y) +; CHECK: %add1 = add nsw i32 %x, %y +; CHECK: %foo = add i32 %add1, %add1 + + %add1 = add nuw nsw i32 %x, %y + %add2 = add nsw i32 %x, %y + %foo = add i32 %add1, %add2 + ret i32 %foo +} + +define i32 @test7(i32 %x, i32 %y) { +; CHECK: @test7(i32 %x, i32 %y) +; CHECK: %add1 = add i32 %x, %y +; CHECK-NOT: what_is_this +; CHECK: %foo = add i32 %add1, %add1 + + %add1 = add i32 %x, %y, !what_is_this !{} + %add2 = add i32 %x, %y + %foo = add i32 %add1, %add2 + ret i32 %foo +} diff --git a/test/Transforms/GVN/pre-basic-add.ll b/test/Transforms/GVN/pre-basic-add.ll index c13099f..4bde05c 100644 --- a/test/Transforms/GVN/pre-basic-add.ll +++ b/test/Transforms/GVN/pre-basic-add.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -enable-pre -S | grep {.pre} +; RUN: opt < %s -gvn -enable-pre -S | grep ".pre" @H = common global i32 0 ; [#uses=2] @G = common global i32 0 ; [#uses=1] diff --git a/test/Transforms/GVN/range.ll b/test/Transforms/GVN/range.ll new file mode 100644 index 0000000..3759c41 --- /dev/null +++ b/test/Transforms/GVN/range.ll @@ -0,0 +1,101 @@ +; RUN: opt %s -basicaa -gvn -S -o - | FileCheck %s + +define i32 @test1(i32* %p) { +; CHECK: @test1(i32* %p) +; CHECK: %a = load i32* %p, !range !0 +; CHECK: %c = add i32 %a, %a + %a = load i32* %p, !range !0 + %b = load i32* %p, !range !0 + %c = add i32 %a, %b + ret i32 %c +} + +define i32 @test2(i32* %p) { +; CHECK: @test2(i32* %p) +; CHECK: %a = load i32* %p +; CHECK-NOT: range +; CHECK: %c = add i32 %a, %a + %a = load i32* %p, !range !0 + %b = load i32* %p + %c = add i32 %a, %b + ret i32 %c +} + +define i32 @test3(i32* %p) { +; CHECK: @test3(i32* %p) +; CHECK: %a = load i32* %p, !range ![[DISJOINT_RANGE:[0-9]+]] +; CHECK: %c = add i32 %a, %a + %a = load i32* %p, !range !0 + %b = load i32* %p, !range !1 + %c = add i32 %a, %b + ret i32 %c +} + +define i32 @test4(i32* %p) { +; CHECK: @test4(i32* %p) +; CHECK: %a = load i32* %p, !range ![[MERGED_RANGE:[0-9]+]] +; CHECK: %c = add i32 %a, %a + %a = load i32* %p, !range !0 + %b = load i32* %p, !range !2 + %c = add i32 %a, %b + ret i32 %c +} + +define i32 @test5(i32* %p) { +; CHECK: @test5(i32* %p) +; CHECK: %a = load i32* %p, !range ![[MERGED_SIGNED_RANGE:[0-9]+]] +; CHECK: %c = add i32 %a, %a + %a = load i32* %p, !range !3 + %b = load i32* %p, !range !4 + %c = add i32 %a, %b + ret i32 %c +} + +define i32 @test6(i32* %p) { +; CHECK: @test6(i32* %p) +; CHECK: %a = load i32* %p, !range ![[MERGED_TEST6:[0-9]+]] +; CHECK: %c = add i32 %a, %a + %a = load i32* %p, !range !5 + %b = load i32* %p, !range !6 + %c = add i32 %a, %b + ret i32 %c +} + +define i32 @test7(i32* %p) { +; CHECK: @test7(i32* %p) +; CHECK: %a = load i32* %p, !range ![[MERGED_TEST7:[0-9]+]] +; CHECK: %c = add i32 %a, %a + %a = load i32* %p, !range !7 + %b = load i32* %p, !range !8 + %c = add i32 %a, %b + ret i32 %c +} + +define i32 @test8(i32* %p) { +; CHECK: @test8(i32* %p) +; CHECK: %a = load i32* %p +; CHECK-NOT: range +; CHECK: %c = add i32 %a, %a + %a = load i32* %p, !range !9 + %b = load i32* %p, !range !10 + %c = add i32 %a, %b + ret i32 %c +} + +; CHECK: ![[DISJOINT_RANGE]] = metadata !{i32 0, i32 2, i32 3, i32 5} +; CHECK: ![[MERGED_RANGE]] = metadata !{i32 0, i32 5} +; CHECK: ![[MERGED_SIGNED_RANGE]] = metadata !{i32 -3, i32 -2, i32 1, i32 2} +; CHECK: ![[MERGED_TEST6]] = metadata !{i32 10, i32 1} +; CHECK: ![[MERGED_TEST7]] = metadata !{i32 3, i32 4, i32 5, i32 2} + +!0 = metadata !{i32 0, i32 2} +!1 = metadata !{i32 3, i32 5} +!2 = metadata !{i32 2, i32 5} +!3 = metadata !{i32 -3, i32 -2} +!4 = metadata !{i32 1, i32 2} +!5 = metadata !{i32 10, i32 1} +!6 = metadata !{i32 12, i32 13} +!7 = metadata !{i32 1, i32 2, i32 3, i32 4} +!8 = metadata !{i32 5, i32 1} +!9 = metadata !{i32 1, i32 5} +!10 = metadata !{i32 5, i32 1} diff --git a/test/Transforms/GVN/rle-must-alias.ll b/test/Transforms/GVN/rle-must-alias.ll index 4797240..e7dc9c4 100644 --- a/test/Transforms/GVN/rle-must-alias.ll +++ b/test/Transforms/GVN/rle-must-alias.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -basicaa -gvn -S | grep {DEAD = phi i32 } +; RUN: opt < %s -basicaa -gvn -S | grep "DEAD = phi i32 " ; GVN should eliminate the fully redundant %9 GEP which ; allows DEAD to be removed. This is PR3198. diff --git a/test/Transforms/GVN/rle-semidominated.ll b/test/Transforms/GVN/rle-semidominated.ll index c6cd1fd..71aa548 100644 --- a/test/Transforms/GVN/rle-semidominated.ll +++ b/test/Transforms/GVN/rle-semidominated.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -basicaa -gvn -S | grep {DEAD = phi i32 } +; RUN: opt < %s -basicaa -gvn -S | grep "DEAD = phi i32 " define i32 @main(i32* %p) { block1: diff --git a/test/Transforms/GVN/tbaa.ll b/test/Transforms/GVN/tbaa.ll new file mode 100644 index 0000000..90661c6 --- /dev/null +++ b/test/Transforms/GVN/tbaa.ll @@ -0,0 +1,81 @@ +; RUN: opt %s -basicaa -gvn -S -o - | FileCheck %s + +define i32 @test1(i8* %p, i8* %q) { +; CHECK: @test1(i8* %p, i8* %q) +; CHECK: call i32 @foo(i8* %p) +; CHECK-NOT: tbaa +; CHECK: %c = add i32 %a, %a + %a = call i32 @foo(i8* %p), !tbaa !0 + %b = call i32 @foo(i8* %p) + %c = add i32 %a, %b + ret i32 %c +} + +define i32 @test2(i8* %p, i8* %q) { +; CHECK: @test2(i8* %p, i8* %q) +; CHECK: call i32 @foo(i8* %p), !tbaa !0 +; CHECK: %c = add i32 %a, %a + %a = call i32 @foo(i8* %p), !tbaa !0 + %b = call i32 @foo(i8* %p), !tbaa !0 + %c = add i32 %a, %b + ret i32 %c +} + +define i32 @test3(i8* %p, i8* %q) { +; CHECK: @test3(i8* %p, i8* %q) +; CHECK: call i32 @foo(i8* %p), !tbaa !3 +; CHECK: %c = add i32 %a, %a + %a = call i32 @foo(i8* %p), !tbaa !3 + %b = call i32 @foo(i8* %p), !tbaa !3 + %c = add i32 %a, %b + ret i32 %c +} + +define i32 @test4(i8* %p, i8* %q) { +; CHECK: @test4(i8* %p, i8* %q) +; CHECK: call i32 @foo(i8* %p), !tbaa !1 +; CHECK: %c = add i32 %a, %a + %a = call i32 @foo(i8* %p), !tbaa !1 + %b = call i32 @foo(i8* %p), !tbaa !0 + %c = add i32 %a, %b + ret i32 %c +} + +define i32 @test5(i8* %p, i8* %q) { +; CHECK: @test5(i8* %p, i8* %q) +; CHECK: call i32 @foo(i8* %p), !tbaa !1 +; CHECK: %c = add i32 %a, %a + %a = call i32 @foo(i8* %p), !tbaa !0 + %b = call i32 @foo(i8* %p), !tbaa !1 + %c = add i32 %a, %b + ret i32 %c +} + +define i32 @test6(i8* %p, i8* %q) { +; CHECK: @test6(i8* %p, i8* %q) +; CHECK: call i32 @foo(i8* %p), !tbaa !1 +; CHECK: %c = add i32 %a, %a + %a = call i32 @foo(i8* %p), !tbaa !0 + %b = call i32 @foo(i8* %p), !tbaa !3 + %c = add i32 %a, %b + ret i32 %c +} + +define i32 @test7(i8* %p, i8* %q) { +; CHECK: @test7(i8* %p, i8* %q) +; CHECK: call i32 @foo(i8* %p) +; CHECK-NOT: tbaa +; CHECK: %c = add i32 %a, %a + %a = call i32 @foo(i8* %p), !tbaa !4 + %b = call i32 @foo(i8* %p), !tbaa !3 + %c = add i32 %a, %b + ret i32 %c +} + +declare i32 @foo(i8*) readonly + +!0 = metadata !{metadata !"C", metadata !1} +!1 = metadata !{metadata !"A", metadata !2} +!2 = metadata !{metadata !"tbaa root", null} +!3 = metadata !{metadata !"B", metadata !1} +!4 = metadata !{metadata !"another root", null} diff --git a/test/Transforms/GlobalOpt/2008-01-13-OutOfRangeSROA.ll b/test/Transforms/GlobalOpt/2008-01-13-OutOfRangeSROA.ll index 82abc8fe..7c07d5d 100644 --- a/test/Transforms/GlobalOpt/2008-01-13-OutOfRangeSROA.ll +++ b/test/Transforms/GlobalOpt/2008-01-13-OutOfRangeSROA.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -globalopt -S | grep {16 x .31 x double.. zeroinitializer} +; RUN: opt < %s -globalopt -S | grep "16 x .31 x double.. zeroinitializer" ; The 'X' indices could be larger than 31. Do not SROA the outer indices of this array. @mm = internal global [16 x [31 x double]] zeroinitializer, align 32 diff --git a/test/Transforms/GlobalOpt/2008-01-29-VolatileGlobal.ll b/test/Transforms/GlobalOpt/2008-01-29-VolatileGlobal.ll index 588d5c9..08b2cb1 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 {load volatile} +; 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/GlobalOpt/2008-04-26-SROA-Global-Align.ll b/test/Transforms/GlobalOpt/2008-04-26-SROA-Global-Align.ll index 5b06fea..d58becd 100644 --- a/test/Transforms/GlobalOpt/2008-04-26-SROA-Global-Align.ll +++ b/test/Transforms/GlobalOpt/2008-04-26-SROA-Global-Align.ll @@ -2,9 +2,9 @@ ; alignments. Elements 0 and 2 must be 16-byte aligned, and element ; 1 must be at least 8 byte aligned (but could be more). -; RUN: opt < %s -globalopt -S | grep {@G.0 = internal unnamed_addr global .*align 16} -; RUN: opt < %s -globalopt -S | grep {@G.1 = internal unnamed_addr global .*align 8} -; RUN: opt < %s -globalopt -S | grep {@G.2 = internal unnamed_addr global .*align 16} +; RUN: opt < %s -globalopt -S | grep "@G.0 = internal unnamed_addr global .*align 16" +; RUN: opt < %s -globalopt -S | grep "@G.1 = internal unnamed_addr global .*align 8" +; RUN: opt < %s -globalopt -S | grep "@G.2 = internal unnamed_addr global .*align 16" ; rdar://5891920 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:32:32-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" diff --git a/test/Transforms/GlobalOpt/2009-01-13-phi-user.ll b/test/Transforms/GlobalOpt/2009-01-13-phi-user.ll index c4b6e52..e76c44d 100644 --- a/test/Transforms/GlobalOpt/2009-01-13-phi-user.ll +++ b/test/Transforms/GlobalOpt/2009-01-13-phi-user.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -globalopt -S | grep {phi.*@head} +; RUN: opt < %s -globalopt -S | grep "phi.*@head" ; PR3321 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" target triple = "x86_64-unknown-linux-gnu" diff --git a/test/Transforms/GlobalOpt/2009-03-05-dbg.ll b/test/Transforms/GlobalOpt/2009-03-05-dbg.ll index 3154856..0f3efa0 100644 --- a/test/Transforms/GlobalOpt/2009-03-05-dbg.ll +++ b/test/Transforms/GlobalOpt/2009-03-05-dbg.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -globalopt -stats -disable-output |& grep "1 globalopt - Number of global vars shrunk to booleans" +; RUN: opt < %s -globalopt -stats -disable-output 2>&1 | grep "1 globalopt - Number of global vars shrunk to booleans" @Stop = internal global i32 0 ; [#uses=3] diff --git a/test/Transforms/GlobalOpt/2009-03-07-PromotePtrToBool.ll b/test/Transforms/GlobalOpt/2009-03-07-PromotePtrToBool.ll index d645ce4..059af1c 100644 --- a/test/Transforms/GlobalOpt/2009-03-07-PromotePtrToBool.ll +++ b/test/Transforms/GlobalOpt/2009-03-07-PromotePtrToBool.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -globalopt -S | grep {@X = internal unnamed_addr global i32} +; RUN: opt < %s -globalopt -S | grep "@X = internal unnamed_addr global i32" 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-darwin7" @X = internal global i32* null ; [#uses=2] diff --git a/test/Transforms/GlobalOpt/2009-11-16-BrokenPerformHeapAllocSRoA.ll b/test/Transforms/GlobalOpt/2009-11-16-BrokenPerformHeapAllocSRoA.ll index 54e8f90..40862bd 100644 --- a/test/Transforms/GlobalOpt/2009-11-16-BrokenPerformHeapAllocSRoA.ll +++ b/test/Transforms/GlobalOpt/2009-11-16-BrokenPerformHeapAllocSRoA.ll @@ -17,7 +17,7 @@ define void @test() nounwind ssp { %2 = sext i32 %1 to i64 ; [#uses=1] %3 = mul i64 %2, ptrtoint (%struct.strchartype* getelementptr (%struct.strchartype* null, i64 1) to i64) ; [#uses=1] %4 = tail call i8* @malloc(i64 %3) ; [#uses=1] -; CHECK: call i8* @malloc(i64 +; CHECK-NOT: call i8* @malloc(i64 %5 = bitcast i8* %4 to %struct.strchartype* ; <%struct.strchartype*> [#uses=1] store %struct.strchartype* %5, %struct.strchartype** @chartypes, align 8 ret void diff --git a/test/Transforms/GlobalOpt/2012-05-11-blockaddress.ll b/test/Transforms/GlobalOpt/2012-05-11-blockaddress.ll new file mode 100644 index 0000000..0c58c1a --- /dev/null +++ b/test/Transforms/GlobalOpt/2012-05-11-blockaddress.ll @@ -0,0 +1,16 @@ +; RUN: opt < %s -globalopt -S | FileCheck %s +; Check that the mere presence of a blockaddress doesn't prevent -globalopt +; from promoting @f to fastcc. + +; CHECK: define{{.*}}fastcc{{.*}}@f +define internal i8* @f() { + ret i8* blockaddress(@f, %L1) +L1: + ret i8* null +} + +define void @g() { + ; CHECK: call{{.*}}fastcc{{.*}}@f + %p = call i8* @f() + ret void +} diff --git a/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll b/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll new file mode 100644 index 0000000..a472f10 --- /dev/null +++ b/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll @@ -0,0 +1,49 @@ +; RUN: opt -globalopt -S -o - < %s | FileCheck %s + +@glbl = internal global i8* null + +define void @test1a() { +; CHECK: @test1a +; CHECK-NOT: store +; CHECK-NEXT: ret void + store i8* null, i8** @glbl + ret void +} + +define void @test1b(i8* %p) { +; CHECK: @test1b +; CHECK-NEXT: store +; CHECK-NEXT: ret void + store i8* %p, i8** @glbl + ret void +} + +define void @test2() { +; CHECK: @test2 +; CHECK: alloca i8 + %txt = alloca i8 + call void @foo2(i8* %txt) + %call2 = call i8* @strdup(i8* %txt) + store i8* %call2, i8** @glbl + ret void +} +declare i8* @strdup(i8*) +declare void @foo2(i8*) + +define void @test3() uwtable { +; CHECK: @test3 +; CHECK-NOT: bb1: +; CHECK-NOT: bb2: +; CHECK: invoke + %ptr = invoke i8* @_Znwm(i64 1) + to label %bb1 unwind label %bb2 +bb1: + store i8* %ptr, i8** @glbl + unreachable +bb2: + %tmp1 = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 + cleanup + resume { i8*, i32 } %tmp1 +} +declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*) +declare i8* @_Znwm(i64) diff --git a/test/Transforms/GlobalOpt/constantexpr-dangle.ll b/test/Transforms/GlobalOpt/constantexpr-dangle.ll index 099c607..be13a98 100644 --- a/test/Transforms/GlobalOpt/constantexpr-dangle.ll +++ b/test/Transforms/GlobalOpt/constantexpr-dangle.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -instcombine -globalopt -S | \ -; RUN: grep {internal fastcc float @foo} +; RUN: grep "internal fastcc float @foo" define internal float @foo() { ret float 0.000000e+00 diff --git a/test/Transforms/GlobalOpt/deadglobal.ll b/test/Transforms/GlobalOpt/deadglobal.ll index c8d8e76..cad5a91 100644 --- a/test/Transforms/GlobalOpt/deadglobal.ll +++ b/test/Transforms/GlobalOpt/deadglobal.ll @@ -1,9 +1,25 @@ -; RUN: opt < %s -globalopt -S | not grep internal +; RUN: opt < %s -globalopt -S | FileCheck %s -@G = internal global i32 123 ; [#uses=1] +@G1 = internal global i32 123 ; [#uses=1] -define void @foo() { - store i32 1, i32* @G +; CHECK-NOT: @G1 +; CHECK: @G2 +; CHECK-NOT: @G3 + +define void @foo1() { +; CHECK: define void @foo +; CHECK-NEXT: ret + store i32 1, i32* @G1 + ret void +} + +@G2 = linkonce_odr constant i32 42 + +define void @foo2() { +; CHECK: define void @foo2 +; CHECK-NEXT: store + store i32 1, i32* @G2 ret void } +@G3 = linkonce_odr constant i32 42 diff --git a/test/Transforms/GlobalOpt/globalsra-unknown-index.ll b/test/Transforms/GlobalOpt/globalsra-unknown-index.ll index 1e0db6a..cc655e9 100644 --- a/test/Transforms/GlobalOpt/globalsra-unknown-index.ll +++ b/test/Transforms/GlobalOpt/globalsra-unknown-index.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -globalopt -S > %t -; RUN: grep {@Y = internal unnamed_addr global \\\[3 x \[%\]struct.X\\\] zeroinitializer} %t +; RUN: grep "@Y = internal unnamed_addr global \[3 x [%]struct.X\] zeroinitializer" %t ; RUN: grep load %t | count 6 -; RUN: grep {add i32 \[%\]a, \[%\]b} %t | count 3 +; RUN: grep "add i32 [%]a, [%]b" %t | count 3 ; globalopt should not sra the global, because it can't see the index. diff --git a/test/Transforms/GlobalOpt/heap-sra-phi.ll b/test/Transforms/GlobalOpt/heap-sra-phi.ll index 6188e5a..123ad85 100644 --- a/test/Transforms/GlobalOpt/heap-sra-phi.ll +++ b/test/Transforms/GlobalOpt/heap-sra-phi.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -globalopt -S | grep {tmp.f1 = phi i32. } -; RUN: opt < %s -globalopt -S | grep {tmp.f0 = phi i32. } +; RUN: opt < %s -globalopt -S | grep "tmp.f1 = phi i32. " +; RUN: opt < %s -globalopt -S | grep "tmp.f0 = phi i32. " target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" %struct.foo = type { i32, i32 } diff --git a/test/Transforms/GlobalOpt/integer-bool.ll b/test/Transforms/GlobalOpt/integer-bool.ll index 59403b1..5a34a9c 100644 --- a/test/Transforms/GlobalOpt/integer-bool.ll +++ b/test/Transforms/GlobalOpt/integer-bool.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -globalopt -instcombine | \ -; RUN: llvm-dis | grep {ret i1 true} +; RUN: llvm-dis | grep "ret i1 true" ;; check that global opt turns integers that only hold 0 or 1 into bools. diff --git a/test/Transforms/GlobalOpt/memcpy.ll b/test/Transforms/GlobalOpt/memcpy.ll index 94e07a0..dcfe009 100644 --- a/test/Transforms/GlobalOpt/memcpy.ll +++ b/test/Transforms/GlobalOpt/memcpy.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -globalopt -S | \ -; RUN: grep {G1 = internal unnamed_addr constant} +; RUN: grep "G1 = internal unnamed_addr constant" @G1 = internal global [58 x i8] c"asdlfkajsdlfkajsd;lfkajds;lfkjasd;flkajsd;lkfja;sdlkfjasd\00" ; <[58 x i8]*> [#uses=1] diff --git a/test/Transforms/GlobalOpt/storepointer-compare.ll b/test/Transforms/GlobalOpt/storepointer-compare.ll index 2f5ae86..09e20a8 100644 --- a/test/Transforms/GlobalOpt/storepointer-compare.ll +++ b/test/Transforms/GlobalOpt/storepointer-compare.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -globalopt -S | \ -; RUN: grep {call void @Actual} +; RUN: grep "call void @Actual" ; Check that a comparison does not prevent an indirect call from being made ; direct. The global will still remain, but indirect call elim is still good. diff --git a/test/Transforms/GlobalOpt/unnamed-addr.ll b/test/Transforms/GlobalOpt/unnamed-addr.ll index be02821..ee75058 100644 --- a/test/Transforms/GlobalOpt/unnamed-addr.ll +++ b/test/Transforms/GlobalOpt/unnamed-addr.ll @@ -4,17 +4,31 @@ @b = internal global i32 0, align 4 @c = internal global i32 0, align 4 @d = internal constant [4 x i8] c"foo\00", align 1 +@e = linkonce_odr global i32 0 ; CHECK: @a = internal global i32 0, align 4 ; CHECK: @b = internal global i32 0, align 4 ; CHECK: @c = internal unnamed_addr global i32 0, align 4 ; CHECK: @d = internal unnamed_addr constant [4 x i8] c"foo\00", align 1 +; CHECK: @e = linkonce_odr global i32 0 + +define i32 @get_e() { + %t = load i32* @e + ret i32 %t +} + +define void @set_e(i32 %x) { + store i32 %x, i32* @e + ret void +} define i1 @bah(i64 %i) nounwind readonly optsize ssp { entry: %arrayidx4 = getelementptr inbounds [4 x i8]* @d, i64 0, i64 %i %tmp5 = load i8* %arrayidx4, align 1 - %cmp = icmp eq i8 %tmp5, 42 + %array0 = bitcast [4 x i8]* @d to i8* + %tmp6 = load i8* %array0, align 1 + %cmp = icmp eq i8 %tmp5, %tmp6 ret i1 %cmp } diff --git a/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll b/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll index 6640336..54a65d6 100644 --- a/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll +++ b/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -ipconstprop -S | grep {ret i32 %r} +; RUN: opt < %s -ipconstprop -S | grep "ret i32 %r" ; Should not propagate the result of a weak function. ; PR2411 diff --git a/test/Transforms/IPConstantProp/return-argument.ll b/test/Transforms/IPConstantProp/return-argument.ll index f4b7018..2a14f05 100644 --- a/test/Transforms/IPConstantProp/return-argument.ll +++ b/test/Transforms/IPConstantProp/return-argument.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -ipconstprop -S > %t -; RUN: cat %t | grep {store i32 %Z, i32\\* %Q} -; RUN: cat %t | grep {add i32 1, 3} +; RUN: cat %t | grep "store i32 %Z, i32\* %Q" +; RUN: cat %t | grep "add i32 1, 3" ;; This function returns its second argument on all return statements define internal i32* @incdec(i1 %C, i32* %V) { diff --git a/test/Transforms/IPConstantProp/return-constant.ll b/test/Transforms/IPConstantProp/return-constant.ll index ff15df7..499d383 100644 --- a/test/Transforms/IPConstantProp/return-constant.ll +++ b/test/Transforms/IPConstantProp/return-constant.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -ipconstprop -instcombine | \ -; RUN: llvm-dis | grep {ret i1 true} | count 2 +; RUN: llvm-dis | grep "ret i1 true" | count 2 define internal i32 @foo(i1 %C) { br i1 %C, label %T, label %F diff --git a/test/Transforms/IPConstantProp/return-constants.ll b/test/Transforms/IPConstantProp/return-constants.ll index 2cd99fe..be2ca71 100644 --- a/test/Transforms/IPConstantProp/return-constants.ll +++ b/test/Transforms/IPConstantProp/return-constants.ll @@ -1,8 +1,8 @@ ; RUN: opt < %s -ipconstprop -S > %t ;; Check that the 21 constants got propagated properly -; RUN: cat %t | grep {%M = add i32 21, 21} +; RUN: cat %t | grep "%M = add i32 21, 21" ;; Check that the second return values didn't get propagated -; RUN: cat %t | grep {%N = add i32 %B, %D} +; RUN: cat %t | grep "%N = add i32 %B, %D" %0 = type { i32, i32 } diff --git a/test/Transforms/IndVarSimplify/2005-02-26-ExitValueCompute.ll b/test/Transforms/IndVarSimplify/2005-02-26-ExitValueCompute.ll index 1ba6982..edeead1 100644 --- a/test/Transforms/IndVarSimplify/2005-02-26-ExitValueCompute.ll +++ b/test/Transforms/IndVarSimplify/2005-02-26-ExitValueCompute.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -indvars -S | \ -; RUN: grep {ret i32 152} +; RUN: grep "ret i32 152" define i32 @main() { entry: diff --git a/test/Transforms/IndVarSimplify/2006-03-31-NegativeStride.ll b/test/Transforms/IndVarSimplify/2006-03-31-NegativeStride.ll index 1bbc631..c4e6cd4 100644 --- a/test/Transforms/IndVarSimplify/2006-03-31-NegativeStride.ll +++ b/test/Transforms/IndVarSimplify/2006-03-31-NegativeStride.ll @@ -1,6 +1,6 @@ ; PR726 ; RUN: opt < %s -indvars -S | \ -; RUN: grep {ret i32 27} +; RUN: grep "ret i32 27" ; Make sure to compute the right exit value based on negative strides. diff --git a/test/Transforms/IndVarSimplify/2007-01-06-TripCount.ll b/test/Transforms/IndVarSimplify/2007-01-06-TripCount.ll index 268b8d1..6366c8c 100644 --- a/test/Transforms/IndVarSimplify/2007-01-06-TripCount.ll +++ b/test/Transforms/IndVarSimplify/2007-01-06-TripCount.ll @@ -1,5 +1,5 @@ ; PR1015 -; RUN: opt < %s -indvars -S | not grep {ret i32 0} +; RUN: opt < %s -indvars -S | not grep "ret i32 0" target datalayout = "e-p:32:32" target triple = "i686-apple-darwin8" diff --git a/test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll b/test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll index dd400be..b461566 100644 --- a/test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll +++ b/test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -indvars -S | not grep {sext} +; RUN: opt < %s -indvars -S | not grep "sext" ; ModuleID = '' 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-n32:64" target triple = "x86_64-apple-darwin9.6" diff --git a/test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll b/test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll index 55e8a50..0722d89 100644 --- a/test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll +++ b/test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -indvars -instcombine -S | not grep {\[sz\]ext} +; RUN: opt < %s -indvars -instcombine -S | not grep "[sz]ext" ; ModuleID = '' ;extern int *a, *b, *c, *d, *e, *f; /* 64 bit */ ;extern int K[256]; diff --git a/test/Transforms/IndVarSimplify/2012-07-17-lftr-undef.ll b/test/Transforms/IndVarSimplify/2012-07-17-lftr-undef.ll new file mode 100644 index 0000000..7c5f818 --- /dev/null +++ b/test/Transforms/IndVarSimplify/2012-07-17-lftr-undef.ll @@ -0,0 +1,22 @@ +; RUN: opt < %s -indvars -S | FileCheck %s +; PR13371: indvars pass incorrectly substitutes 'undef' values +; +; LFTR should not user %undef as the loop counter. +; CHECK: @test +; CHECK-NOT: icmp{{.*}}undef +@.str3 = private constant [6 x i8] c"%lld\0A\00", align 1 +declare i32 @printf(i8* noalias nocapture, ...) nounwind +define i64 @test() nounwind { +func_start: + br label %block9 +block9: ; preds = %block9,%func_start + %undef = phi i64 [ %next_undef, %block9 ], [ undef, %func_start ] + %iter = phi i64 [ %next_iter, %block9 ], [ 1, %func_start ] + %next_iter = add nsw i64 %iter, 1 + %0 = tail call i32 (i8*, ...)* @printf(i8* noalias nocapture getelementptr inbounds ([6 x i8]* @.str3, i64 0, i64 0), i64 %next_iter, i64 %undef) + %next_undef = add nsw i64 %undef, 1 + %_tmp_3 = icmp slt i64 %next_iter, 100 + br i1 %_tmp_3, label %block9, label %exit +exit: ; preds = %block9 + ret i64 0 +} diff --git a/test/Transforms/IndVarSimplify/eliminate-max.ll b/test/Transforms/IndVarSimplify/eliminate-max.ll index c25bd0e..98510ea 100644 --- a/test/Transforms/IndVarSimplify/eliminate-max.ll +++ b/test/Transforms/IndVarSimplify/eliminate-max.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -S -indvars | grep {= icmp} | count 3 +; RUN: opt < %s -S -indvars | grep "= icmp" | count 3 ; PR4914.ll ; Indvars should be able to do range analysis and eliminate icmps. diff --git a/test/Transforms/IndVarSimplify/lftr-reuse.ll b/test/Transforms/IndVarSimplify/lftr-reuse.ll index 9abfe13..7fb36e5 100644 --- a/test/Transforms/IndVarSimplify/lftr-reuse.ll +++ b/test/Transforms/IndVarSimplify/lftr-reuse.ll @@ -153,6 +153,9 @@ return: ; Remove %i which is only used by the exit test. ; Verify that SCEV can still compute a backedge count from the sign ; extended %n, used for pointer comparison by LFTR. +; +; TODO: Fix for PR13371 currently makes this impossible. See +; IndVarSimplify.cpp hasConcreteDef(). We may want to change to undef rules. define void @geplftr(i8* %base, i32 %x, i32 %y, i32 %n) nounwind { entry: %x.ext = sext i32 %x to i64 @@ -162,13 +165,13 @@ entry: %lim = add i32 %x, %n %cmp.ph = icmp ult i32 %x, %lim br i1 %cmp.ph, label %loop, label %exit - +; CHECK: @geplftr ; CHECK: loop: ; CHECK: phi i8* -; CHECK-NOT: phi +; DISABLE-NOT: phi // This check is currently disabled ; CHECK: getelementptr ; CHECK: store -; CHECK: icmp ne i8* +; DISABLE: icmp ne i8* // This check is currently disabled ; CHECK: br i1 loop: %i = phi i32 [ %x, %entry ], [ %inc, %loop ] @@ -187,7 +190,7 @@ exit: define void @nevertaken() nounwind uwtable ssp { entry: br label %loop - +; CHECK: @nevertaken ; CHECK: loop: ; CHECK-NOT: phi ; CHECK-NOT: add diff --git a/test/Transforms/IndVarSimplify/loop_evaluate10.ll b/test/Transforms/IndVarSimplify/loop_evaluate10.ll index c3619f6..e51a341 100644 --- a/test/Transforms/IndVarSimplify/loop_evaluate10.ll +++ b/test/Transforms/IndVarSimplify/loop_evaluate10.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -indvars -S \ -; RUN: | grep {%b.1 = phi i32 \\\[ 2, %bb \\\], \\\[ 1, %bb2 \\\]} +; RUN: | grep "%b.1 = phi i32 [ 2, %bb ], [ 1, %bb2 ]" ; ; This loop has multiple exits, and the value of %b1 depends on which ; exit is taken. Indvars should correctly compute the exit values. diff --git a/test/Transforms/IndVarSimplify/loop_evaluate9.ll b/test/Transforms/IndVarSimplify/loop_evaluate9.ll index 9f3bcaf..21fb7ef 100644 --- a/test/Transforms/IndVarSimplify/loop_evaluate9.ll +++ b/test/Transforms/IndVarSimplify/loop_evaluate9.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -indvars -S > %t -; RUN: grep {\[%\]tmp7 = icmp eq i8 -28, -28} %t -; RUN: grep {\[%\]tmp8 = icmp eq i8 63, 63} %t +; RUN: grep "[%]tmp7 = icmp eq i8 -28, -28" %t +; RUN: grep "[%]tmp8 = icmp eq i8 63, 63" %t ; PR4477 ; Indvars should compute the exit values in loop. ; diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_3.ll b/test/Transforms/IndVarSimplify/loop_evaluate_3.ll index 65c66f7..0c1b590 100644 --- a/test/Transforms/IndVarSimplify/loop_evaluate_3.ll +++ b/test/Transforms/IndVarSimplify/loop_evaluate_3.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -indvars -S | grep {ret i32 600000} +; RUN: opt < %s -indvars -S | grep "ret i32 600000" ; PR1179 define i32 @foo() { diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_4.ll b/test/Transforms/IndVarSimplify/loop_evaluate_4.ll index e4b642c..d7eb406 100644 --- a/test/Transforms/IndVarSimplify/loop_evaluate_4.ll +++ b/test/Transforms/IndVarSimplify/loop_evaluate_4.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -indvars -S | grep {ret i32 9900} +; RUN: opt < %s -indvars -S | grep "ret i32 9900" ; PR1179 define i32 @test4() { diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_5.ll b/test/Transforms/IndVarSimplify/loop_evaluate_5.ll index 80b961a..38f95bf 100644 --- a/test/Transforms/IndVarSimplify/loop_evaluate_5.ll +++ b/test/Transforms/IndVarSimplify/loop_evaluate_5.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -indvars -S | grep {120, %bb2.bb3_crit_edge} +; RUN: opt < %s -indvars -S | grep "120, %bb2.bb3_crit_edge" 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" target triple = "i686-pc-linux-gnu" diff --git a/test/Transforms/IndVarSimplify/shrunk-constant.ll b/test/Transforms/IndVarSimplify/shrunk-constant.ll index 271f8ed..45297d6 100644 --- a/test/Transforms/IndVarSimplify/shrunk-constant.ll +++ b/test/Transforms/IndVarSimplify/shrunk-constant.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -scalar-evolution -analyze \ -; RUN: | grep {\\--> (zext i4 {-7,+,-8}<%loop> to i32)} +; RUN: | grep "\--> (zext i4 {-7,+,-8}<%loop> to i32)" define fastcc void @foo() nounwind { entry: diff --git a/test/Transforms/IndVarSimplify/ult-sub-to-eq.ll b/test/Transforms/IndVarSimplify/ult-sub-to-eq.ll new file mode 100644 index 0000000..c58a3af --- /dev/null +++ b/test/Transforms/IndVarSimplify/ult-sub-to-eq.ll @@ -0,0 +1,42 @@ +; RUN: opt -S -indvars < %s | FileCheck %s + +define void @test1(float* nocapture %autoc, float* nocapture %data, float %d, i32 %data_len, i32 %sample) nounwind { +entry: + %sub = sub i32 %data_len, %sample + %cmp4 = icmp eq i32 %data_len, %sample + br i1 %cmp4, label %for.end, label %for.body + +for.body: ; preds = %entry, %for.body + %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] + %0 = trunc i64 %indvars.iv to i32 + %add = add i32 %0, %sample + %idxprom = zext i32 %add to i64 + %arrayidx = getelementptr inbounds float* %data, i64 %idxprom + %1 = load float* %arrayidx, align 4 + %mul = fmul float %1, %d + %arrayidx2 = getelementptr inbounds float* %autoc, i64 %indvars.iv + %2 = load float* %arrayidx2, align 4 + %add3 = fadd float %2, %mul + store float %add3, float* %arrayidx2, align 4 + %indvars.iv.next = add i64 %indvars.iv, 1 + %3 = trunc i64 %indvars.iv.next to i32 + %cmp = icmp ult i32 %3, %sub + br i1 %cmp, label %for.body, label %for.end + +for.end: ; preds = %for.body, %entry + ret void + +; CHECK: @test1 + +; First check that we move the sub into the preheader, it doesn't have to be +; executed if %cmp4 == false +; CHECK: for.body.preheader: +; CHECK: sub i32 %data_len, %sample +; CHECK: br label %for.body + +; Second, check that we turn the IV test into an eq. +; CHECK: %lftr.wideiv = trunc i64 %indvars.iv.next to i32 +; CHECK: %exitcond = icmp ne i32 %lftr.wideiv, %0 +; CHECK: br i1 %exitcond, label %for.body, label %for.end.loopexit +} + diff --git a/test/Transforms/Inline/2007-04-15-InlineEH.ll b/test/Transforms/Inline/2007-04-15-InlineEH.ll index 8fbcf92..b114537 100644 --- a/test/Transforms/Inline/2007-04-15-InlineEH.ll +++ b/test/Transforms/Inline/2007-04-15-InlineEH.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -inline -S | 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/casts.ll b/test/Transforms/Inline/casts.ll index 166185a..a7b051b 100644 --- a/test/Transforms/Inline/casts.ll +++ b/test/Transforms/Inline/casts.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -inline -S | 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/delete-call.ll b/test/Transforms/Inline/delete-call.ll index 3505608..7716d6a 100644 --- a/test/Transforms/Inline/delete-call.ll +++ b/test/Transforms/Inline/delete-call.ll @@ -1,5 +1,5 @@ -; RUN: opt %s -S -inline -functionattrs -stats |& grep {Number of call sites deleted, not inlined} -; RUN: opt %s -S -inline -stats |& grep {Number of functions inlined} +; RUN: opt %s -S -inline -functionattrs -stats 2>&1 | grep "Number of call sites deleted, not inlined" +; RUN: opt %s -S -inline -stats 2>&1 | grep "Number of functions inlined" 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-n8:16:32" target triple = "i386-apple-darwin9.8" diff --git a/test/Transforms/Inline/externally_available.ll b/test/Transforms/Inline/externally_available.ll index 08b5638..07274e7 100644 --- a/test/Transforms/Inline/externally_available.ll +++ b/test/Transforms/Inline/externally_available.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -inline -constprop -S > %t ; RUN: not grep test_function %t -; RUN: grep {ret i32 5} %t +; RUN: grep "ret i32 5" %t ; test_function should not be emitted to the .s file. diff --git a/test/Transforms/Inline/inline-byval-bonus.ll b/test/Transforms/Inline/inline-byval-bonus.ll new file mode 100644 index 0000000..f3ed819 --- /dev/null +++ b/test/Transforms/Inline/inline-byval-bonus.ll @@ -0,0 +1,193 @@ +; RUN: opt -S -inline -inline-threshold=275 < %s | FileCheck %s +; PR13095 + +; The performance of the c-ray benchmark largely depends on the inlining of a +; specific call to @ray_sphere. This test case is designed to verify that it's +; inlined at -O3. + +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-S128" +target triple = "x86_64-apple-macosx10.8.0" + +%struct.sphere = type { %struct.vec3, double, %struct.material, %struct.sphere* } +%struct.vec3 = type { double, double, double } +%struct.material = type { %struct.vec3, double, double } +%struct.ray = type { %struct.vec3, %struct.vec3 } +%struct.spoint = type { %struct.vec3, %struct.vec3, %struct.vec3, double } + +define i32 @caller(%struct.sphere* %i) { + %shadow_ray = alloca %struct.ray, align 8 + call void @fix(%struct.ray* %shadow_ray) + + %call = call i32 @ray_sphere(%struct.sphere* %i, %struct.ray* byval align 8 %shadow_ray, %struct.spoint* null) + ret i32 %call + +; CHECK: @caller +; CHECK-NOT: call i32 @ray_sphere +; CHECK: ret i32 +} + +declare void @fix(%struct.ray*) + +define i32 @ray_sphere(%struct.sphere* nocapture %sph, %struct.ray* nocapture byval align 8 %ray, %struct.spoint* %sp) nounwind uwtable ssp { + %1 = getelementptr inbounds %struct.ray* %ray, i64 0, i32 1, i32 0 + %2 = load double* %1, align 8 + %3 = fmul double %2, %2 + %4 = getelementptr inbounds %struct.ray* %ray, i64 0, i32 1, i32 1 + %5 = load double* %4, align 8 + %6 = fmul double %5, %5 + %7 = fadd double %3, %6 + %8 = getelementptr inbounds %struct.ray* %ray, i64 0, i32 1, i32 2 + %9 = load double* %8, align 8 + %10 = fmul double %9, %9 + %11 = fadd double %7, %10 + %12 = fmul double %2, 2.000000e+00 + %13 = getelementptr inbounds %struct.ray* %ray, i64 0, i32 0, i32 0 + %14 = load double* %13, align 8 + %15 = getelementptr inbounds %struct.sphere* %sph, i64 0, i32 0, i32 0 + %16 = load double* %15, align 8 + %17 = fsub double %14, %16 + %18 = fmul double %12, %17 + %19 = fmul double %5, 2.000000e+00 + %20 = getelementptr inbounds %struct.ray* %ray, i64 0, i32 0, i32 1 + %21 = load double* %20, align 8 + %22 = getelementptr inbounds %struct.sphere* %sph, i64 0, i32 0, i32 1 + %23 = load double* %22, align 8 + %24 = fsub double %21, %23 + %25 = fmul double %19, %24 + %26 = fadd double %18, %25 + %27 = fmul double %9, 2.000000e+00 + %28 = getelementptr inbounds %struct.ray* %ray, i64 0, i32 0, i32 2 + %29 = load double* %28, align 8 + %30 = getelementptr inbounds %struct.sphere* %sph, i64 0, i32 0, i32 2 + %31 = load double* %30, align 8 + %32 = fsub double %29, %31 + %33 = fmul double %27, %32 + %34 = fadd double %26, %33 + %35 = fmul double %16, %16 + %36 = fmul double %23, %23 + %37 = fadd double %35, %36 + %38 = fmul double %31, %31 + %39 = fadd double %37, %38 + %40 = fmul double %14, %14 + %41 = fadd double %40, %39 + %42 = fmul double %21, %21 + %43 = fadd double %42, %41 + %44 = fmul double %29, %29 + %45 = fadd double %44, %43 + %46 = fsub double -0.000000e+00, %16 + %47 = fmul double %14, %46 + %48 = fmul double %21, %23 + %49 = fsub double %47, %48 + %50 = fmul double %29, %31 + %51 = fsub double %49, %50 + %52 = fmul double %51, 2.000000e+00 + %53 = fadd double %52, %45 + %54 = getelementptr inbounds %struct.sphere* %sph, i64 0, i32 1 + %55 = load double* %54, align 8 + %56 = fmul double %55, %55 + %57 = fsub double %53, %56 + %58 = fmul double %34, %34 + %59 = fmul double %11, 4.000000e+00 + %60 = fmul double %59, %57 + %61 = fsub double %58, %60 + %62 = fcmp olt double %61, 0.000000e+00 + br i1 %62, label %130, label %63 + +;