aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2013-12-22 00:04:03 +0000
committerDimitry Andric <dim@FreeBSD.org>2013-12-22 00:04:03 +0000
commitf8af5cf600354830d4ccf59732403f0f073eccb9 (patch)
tree2ba0398b4c42ad4f55561327538044fd2c925a8b /test/Transforms
parent59d6cff90eecf31cb3dd860c4e786674cfdd42eb (diff)
downloadsrc-f8af5cf600354830d4ccf59732403f0f073eccb9.tar.gz
src-f8af5cf600354830d4ccf59732403f0f073eccb9.zip
Notes
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/ADCE/lit.local.cfg1
-rw-r--r--test/Transforms/ArgumentPromotion/lit.local.cfg1
-rw-r--r--test/Transforms/ArgumentPromotion/reserve-tbaa.ll52
-rw-r--r--test/Transforms/BBVectorize/X86/cmp-types.ll2
-rw-r--r--test/Transforms/BBVectorize/X86/loop1.ll4
-rw-r--r--test/Transforms/BBVectorize/X86/pr15289.ll23
-rw-r--r--test/Transforms/BBVectorize/X86/sh-rec.ll2
-rw-r--r--test/Transforms/BBVectorize/X86/sh-rec2.ll2
-rw-r--r--test/Transforms/BBVectorize/X86/sh-rec3.ll2
-rw-r--r--test/Transforms/BBVectorize/X86/sh-types.ll2
-rw-r--r--test/Transforms/BBVectorize/X86/simple-int.ll10
-rw-r--r--test/Transforms/BBVectorize/X86/simple-ldstr.ll2
-rw-r--r--test/Transforms/BBVectorize/X86/simple.ll10
-rw-r--r--test/Transforms/BBVectorize/X86/vs-cast.ll2
-rw-r--r--test/Transforms/BBVectorize/X86/wr-aliases.ll144
-rw-r--r--test/Transforms/BBVectorize/cycle.ll2
-rw-r--r--test/Transforms/BBVectorize/ld1.ll2
-rw-r--r--test/Transforms/BBVectorize/lit.local.cfg2
-rw-r--r--test/Transforms/BBVectorize/loop1.ll4
-rw-r--r--test/Transforms/BBVectorize/mem-op-depth.ll2
-rw-r--r--test/Transforms/BBVectorize/metadata.ll4
-rw-r--r--test/Transforms/BBVectorize/no-ldstr-conn.ll2
-rw-r--r--test/Transforms/BBVectorize/req-depth.ll4
-rw-r--r--test/Transforms/BBVectorize/search-limit.ll4
-rw-r--r--test/Transforms/BBVectorize/simple-int.ll10
-rw-r--r--test/Transforms/BBVectorize/simple-ldstr-ptrs.ll12
-rw-r--r--test/Transforms/BBVectorize/simple-ldstr.ll20
-rw-r--r--test/Transforms/BBVectorize/simple-sel.ll6
-rw-r--r--test/Transforms/BBVectorize/simple-tst.ll2
-rw-r--r--test/Transforms/BBVectorize/simple.ll16
-rw-r--r--test/Transforms/BBVectorize/simple3.ll2
-rw-r--r--test/Transforms/BBVectorize/xcore/no-vector-registers.ll18
-rw-r--r--test/Transforms/BlockPlacement/basictest.ll15
-rw-r--r--test/Transforms/BlockPlacement/lit.local.cfg1
-rw-r--r--test/Transforms/CodeExtractor/lit.local.cfg1
-rw-r--r--test/Transforms/CodeGenPrepare/basic.ll2
-rw-r--r--test/Transforms/CodeGenPrepare/lit.local.cfg1
-rw-r--r--test/Transforms/ConstProp/basictest.ll10
-rw-r--r--test/Transforms/ConstProp/bitcast.ll2
-rw-r--r--test/Transforms/ConstProp/bswap.ll8
-rw-r--r--test/Transforms/ConstProp/calls.ll24
-rw-r--r--test/Transforms/ConstProp/extractvalue.ll6
-rw-r--r--test/Transforms/ConstProp/insertvalue.ll6
-rw-r--r--test/Transforms/ConstProp/lit.local.cfg1
-rw-r--r--test/Transforms/ConstProp/loads.ll76
-rw-r--r--test/Transforms/ConstProp/overflow-ops.ll38
-rw-r--r--test/Transforms/ConstantMerge/align.ll28
-rw-r--r--test/Transforms/ConstantMerge/lit.local.cfg1
-rw-r--r--test/Transforms/CorrelatedValuePropagation/2010-09-02-Trunc.ll4
-rw-r--r--test/Transforms/CorrelatedValuePropagation/basic.ll18
-rw-r--r--test/Transforms/CorrelatedValuePropagation/lit.local.cfg1
-rw-r--r--test/Transforms/CorrelatedValuePropagation/range.ll14
-rw-r--r--test/Transforms/DeadArgElim/2010-04-30-DbgInfo.ll33
-rw-r--r--test/Transforms/DeadArgElim/2013-05-17-VarargsAndBlockAddress.ll25
-rw-r--r--test/Transforms/DeadArgElim/dbginfo.ll18
-rw-r--r--test/Transforms/DeadArgElim/deadexternal.ll2
-rw-r--r--test/Transforms/DeadArgElim/keepalive.ll2
-rw-r--r--test/Transforms/DeadArgElim/linkage.ll21
-rw-r--r--test/Transforms/DeadArgElim/lit.local.cfg1
-rw-r--r--test/Transforms/DeadArgElim/returned.ll55
-rw-r--r--test/Transforms/DeadArgElim/variadic_safety.ll38
-rw-r--r--test/Transforms/DeadStoreElimination/2011-09-06-EndOfFunction.ll2
-rw-r--r--test/Transforms/DeadStoreElimination/OverwriteStoreEnd.ll14
-rw-r--r--test/Transforms/DeadStoreElimination/PartialStore.ll10
-rw-r--r--test/Transforms/DeadStoreElimination/const-pointers.ll6
-rw-r--r--test/Transforms/DeadStoreElimination/free.ll10
-rw-r--r--test/Transforms/DeadStoreElimination/inst-limits.ll261
-rw-r--r--test/Transforms/DeadStoreElimination/libcalls.ll12
-rw-r--r--test/Transforms/DeadStoreElimination/lifetime.ll2
-rw-r--r--test/Transforms/DeadStoreElimination/lit.local.cfg1
-rw-r--r--test/Transforms/DeadStoreElimination/memintrinsics.ll6
-rw-r--r--test/Transforms/DeadStoreElimination/no-targetdata.ll2
-rw-r--r--test/Transforms/DeadStoreElimination/simple.ll50
-rw-r--r--test/Transforms/DebugIR/crash.ll42
-rw-r--r--test/Transforms/DebugIR/exception.ll127
-rw-r--r--test/Transforms/DebugIR/function.ll51
-rw-r--r--test/Transforms/DebugIR/simple-addrspace.ll13
-rw-r--r--test/Transforms/DebugIR/simple.ll25
-rw-r--r--test/Transforms/DebugIR/struct.ll24
-rw-r--r--test/Transforms/DebugIR/vector.ll93
-rw-r--r--test/Transforms/EarlyCSE/basic.ll16
-rw-r--r--test/Transforms/EarlyCSE/commute.ll10
-rw-r--r--test/Transforms/EarlyCSE/instsimplify-dom.ll2
-rw-r--r--test/Transforms/EarlyCSE/lit.local.cfg1
-rw-r--r--test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll13
-rw-r--r--test/Transforms/FunctionAttrs/2009-01-04-Annotate.ll2
-rw-r--r--test/Transforms/FunctionAttrs/annotate-1.ll7
-rw-r--r--test/Transforms/FunctionAttrs/atomic.ll2
-rw-r--r--test/Transforms/FunctionAttrs/lit.local.cfg1
-rw-r--r--test/Transforms/FunctionAttrs/nocapture.ll20
-rw-r--r--test/Transforms/FunctionAttrs/noreturn.ll2
-rw-r--r--test/Transforms/FunctionAttrs/readattrs.ll47
-rw-r--r--test/Transforms/GCOVProfiling/linkagename.ll6
-rw-r--r--test/Transforms/GCOVProfiling/lit.local.cfg1
-rw-r--r--test/Transforms/GCOVProfiling/version.ll15
-rw-r--r--test/Transforms/GVN/2007-07-26-InterlockingLoops.ll8
-rw-r--r--test/Transforms/GVN/2008-07-02-Unreachable.ll8
-rw-r--r--test/Transforms/GVN/2010-11-13-Simplify.ll2
-rw-r--r--test/Transforms/GVN/2011-06-01-NonLocalMemdepMiscompile.ll6
-rw-r--r--test/Transforms/GVN/2011-07-07-MatchIntrinsicExtract.ll12
-rw-r--r--test/Transforms/GVN/commute.ll4
-rw-r--r--test/Transforms/GVN/cond_br.ll55
-rw-r--r--test/Transforms/GVN/cond_br2.ll140
-rw-r--r--test/Transforms/GVN/condprop.ll22
-rw-r--r--test/Transforms/GVN/edge.ll8
-rw-r--r--test/Transforms/GVN/lit.local.cfg1
-rw-r--r--test/Transforms/GVN/load-pre-align.ll2
-rw-r--r--test/Transforms/GVN/local-pre.ll6
-rw-r--r--test/Transforms/GVN/malloc-load-removal.ll31
-rw-r--r--test/Transforms/GVN/non-local-offset.ll4
-rw-r--r--test/Transforms/GVN/phi-translate.ll2
-rw-r--r--test/Transforms/GVN/pr14166.ll2
-rw-r--r--test/Transforms/GVN/pr17732.ll30
-rw-r--r--test/Transforms/GVN/pr17852.ll66
-rw-r--r--test/Transforms/GVN/pre-load.ll16
-rw-r--r--test/Transforms/GVN/preserve-tbaa.ll5
-rw-r--r--test/Transforms/GVN/readattrs.ll17
-rw-r--r--test/Transforms/GVN/rle-nonlocal.ll5
-rw-r--r--test/Transforms/GVN/rle-phi-translate.ll10
-rw-r--r--test/Transforms/GVN/rle-semidominated.ll5
-rw-r--r--test/Transforms/GVN/rle.ll92
-rw-r--r--test/Transforms/GVN/tbaa.ll28
-rw-r--r--test/Transforms/GlobalDCE/lit.local.cfg1
-rw-r--r--test/Transforms/GlobalOpt/2008-07-17-addrspace.ll2
-rw-r--r--test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll2
-rw-r--r--test/Transforms/GlobalOpt/2009-03-05-dbg.ll18
-rw-r--r--test/Transforms/GlobalOpt/2012-05-11-blockaddress.ll2
-rw-r--r--test/Transforms/GlobalOpt/alias-resolve.ll35
-rw-r--r--test/Transforms/GlobalOpt/alias-used.ll13
-rw-r--r--test/Transforms/GlobalOpt/array-elem-refs.ll32
-rw-r--r--test/Transforms/GlobalOpt/atexit.ll6
-rw-r--r--test/Transforms/GlobalOpt/atomic.ll15
-rw-r--r--test/Transforms/GlobalOpt/blockaddress.ll4
-rw-r--r--test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll8
-rw-r--r--test/Transforms/GlobalOpt/compiler-used.ll16
-rw-r--r--test/Transforms/GlobalOpt/ctor-list-opt-constexpr.ll4
-rw-r--r--test/Transforms/GlobalOpt/deadglobal.ll2
-rw-r--r--test/Transforms/GlobalOpt/integer-bool.ll2
-rw-r--r--test/Transforms/GlobalOpt/invariant-nodatalayout.ll17
-rw-r--r--test/Transforms/GlobalOpt/lit.local.cfg1
-rw-r--r--test/Transforms/GlobalOpt/load-store-global.ll6
-rw-r--r--test/Transforms/GlobalOpt/malloc-promote-3.ll18
-rw-r--r--test/Transforms/GlobalOpt/metadata.ll2
-rw-r--r--test/Transforms/GlobalOpt/tls.ll4
-rw-r--r--test/Transforms/GlobalOpt/zeroinitializer-gep-load.ll2
-rw-r--r--test/Transforms/IPConstantProp/lit.local.cfg1
-rw-r--r--test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2011-11-01-lftrptr.ll8
-rw-r--r--test/Transforms/IndVarSimplify/2011-11-17-selfphi.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2012-07-17-lftr-undef.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2012-10-19-congruent-constant.ll2
-rw-r--r--test/Transforms/IndVarSimplify/dont-recompute.ll4
-rw-r--r--test/Transforms/IndVarSimplify/eliminate-comparison.ll10
-rw-r--r--test/Transforms/IndVarSimplify/eliminate-rem.ll4
-rw-r--r--test/Transforms/IndVarSimplify/floating-point-iv.ll10
-rw-r--r--test/Transforms/IndVarSimplify/iv-fold.ll4
-rw-r--r--test/Transforms/IndVarSimplify/lftr-address-space-pointers.ll69
-rw-r--r--test/Transforms/IndVarSimplify/lftr-extend-const.ll44
-rw-r--r--test/Transforms/IndVarSimplify/lftr-reuse.ll4
-rw-r--r--test/Transforms/IndVarSimplify/lftr-zext.ll26
-rw-r--r--test/Transforms/IndVarSimplify/lit.local.cfg1
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate_1.ll34
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate_6.ll5
-rw-r--r--test/Transforms/IndVarSimplify/no-iv-rewrite.ll9
-rw-r--r--test/Transforms/IndVarSimplify/tripcount_compute.ll14
-rw-r--r--test/Transforms/IndVarSimplify/udiv-invariant-but-traps.ll32
-rw-r--r--test/Transforms/IndVarSimplify/udiv.ll4
-rw-r--r--test/Transforms/IndVarSimplify/ult-sub-to-eq.ll2
-rw-r--r--test/Transforms/IndVarSimplify/widen-nsw.ll29
-rw-r--r--test/Transforms/Inline/2010-05-31-ByvalTailcall.ll2
-rw-r--r--test/Transforms/Inline/alloca-bonus.ll10
-rw-r--r--test/Transforms/Inline/alloca-merge-align-nodl.ll88
-rw-r--r--test/Transforms/Inline/alloca-merge-align.ll122
-rw-r--r--test/Transforms/Inline/always-inline.ll14
-rw-r--r--test/Transforms/Inline/attributes.ll112
-rw-r--r--test/Transforms/Inline/basictest.ll8
-rw-r--r--test/Transforms/Inline/byval.ll23
-rw-r--r--test/Transforms/Inline/delete-call.ll2
-rw-r--r--test/Transforms/Inline/devirtualize-2.ll2
-rw-r--r--test/Transforms/Inline/devirtualize.ll2
-rw-r--r--test/Transforms/Inline/dynamic_alloca_test.ll2
-rw-r--r--test/Transforms/Inline/gvn-inline-iteration.ll4
-rw-r--r--test/Transforms/Inline/inline-byval-bonus.ll2
-rw-r--r--test/Transforms/Inline/inline-invoke-with-asm-call.ll32
-rw-r--r--test/Transforms/Inline/inline-optnone.ll52
-rw-r--r--test/Transforms/Inline/inline_cleanup.ll8
-rw-r--r--test/Transforms/Inline/inline_constprop.ll41
-rw-r--r--test/Transforms/Inline/inline_minisize.ll4
-rw-r--r--test/Transforms/Inline/inline_returns_twice.ll71
-rw-r--r--test/Transforms/Inline/invoke-cost.ll45
-rw-r--r--test/Transforms/Inline/lifetime-no-datalayout.ll2
-rw-r--r--test/Transforms/Inline/lifetime.ll8
-rw-r--r--test/Transforms/Inline/lit.local.cfg1
-rw-r--r--test/Transforms/Inline/nested-inline.ll6
-rw-r--r--test/Transforms/Inline/noinline-recursive-fn.ll6
-rw-r--r--test/Transforms/Inline/ptr-diff.ll49
-rw-r--r--test/Transforms/Inline/recursive.ll4
-rw-r--r--test/Transforms/InstCombine/2002-05-14-SubFailure.ll5
-rw-r--r--test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll4
-rw-r--r--test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll5
-rw-r--r--test/Transforms/InstCombine/2006-10-20-mask.ll4
-rw-r--r--test/Transforms/InstCombine/2006-10-26-VectorReassoc.ll5
-rw-r--r--test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll3
-rw-r--r--test/Transforms/InstCombine/2007-01-27-AndICmp.ll4
-rw-r--r--test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll25
-rw-r--r--test/Transforms/InstCombine/2008-01-06-VoidCast.ll10
-rw-r--r--test/Transforms/InstCombine/2008-01-27-FloatSelect.ll3
-rw-r--r--test/Transforms/InstCombine/2008-02-13-MulURem.ll4
-rw-r--r--test/Transforms/InstCombine/2008-05-31-AddBool.ll4
-rw-r--r--test/Transforms/InstCombine/2008-11-20-DivMulRem.ll12
-rw-r--r--test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll2
-rw-r--r--test/Transforms/InstCombine/2010-03-03-ExtElim.ll20
-rw-r--r--test/Transforms/InstCombine/2010-11-01-lshr-mask.ll4
-rw-r--r--test/Transforms/InstCombine/2010-11-21-SizeZeroTypeGEP.ll4
-rw-r--r--test/Transforms/InstCombine/2010-11-23-Distributed.ll4
-rw-r--r--test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll4
-rw-r--r--test/Transforms/InstCombine/2012-03-10-InstCombine.ll2
-rw-r--r--test/Transforms/InstCombine/2012-04-24-vselect.ll2
-rw-r--r--test/Transforms/InstCombine/2012-05-28-select-hang.ll2
-rw-r--r--test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll4
-rw-r--r--test/Transforms/InstCombine/2012-08-28-udiv_ashl.ll8
-rw-r--r--test/Transforms/InstCombine/2012-09-17-ZeroSizedAlloca.ll2
-rw-r--r--test/Transforms/InstCombine/2012-09-24-MemcpyFromGlobalCrash.ll2
-rw-r--r--test/Transforms/InstCombine/2012-3-15-or-xor-constant.ll2
-rw-r--r--test/Transforms/InstCombine/2013-03-05-Combine-BitcastTy-Into-Alloca.ll2
-rw-r--r--test/Transforms/InstCombine/ExtractCast.ll4
-rw-r--r--test/Transforms/InstCombine/LandingPadClauses.ll6
-rw-r--r--test/Transforms/InstCombine/PR7357.ll (renamed from test/Transforms/SimplifyLibCalls/PR7357.ll)7
-rw-r--r--test/Transforms/InstCombine/abs-1.ll6
-rw-r--r--test/Transforms/InstCombine/add2.ll8
-rw-r--r--test/Transforms/InstCombine/add4.ll45
-rw-r--r--test/Transforms/InstCombine/addrspacecast.ll69
-rw-r--r--test/Transforms/InstCombine/align-addr.ll31
-rw-r--r--test/Transforms/InstCombine/align-external.ll2
-rw-r--r--test/Transforms/InstCombine/alloca.ll37
-rw-r--r--test/Transforms/InstCombine/and-xor-or.ll4
-rw-r--r--test/Transforms/InstCombine/and.ll6
-rw-r--r--test/Transforms/InstCombine/and2.ll18
-rw-r--r--test/Transforms/InstCombine/apint-call-cast-target.ll7
-rw-r--r--test/Transforms/InstCombine/apint-select.ll5
-rw-r--r--test/Transforms/InstCombine/apint-shift-simplify.ll6
-rw-r--r--test/Transforms/InstCombine/apint-shift.ll60
-rw-r--r--test/Transforms/InstCombine/apint-shl-trunc.ll4
-rw-r--r--test/Transforms/InstCombine/atomic.ll4
-rw-r--r--test/Transforms/InstCombine/badmalloc.ll4
-rw-r--r--test/Transforms/InstCombine/bitcast-alias-function.ll229
-rw-r--r--test/Transforms/InstCombine/bitcast-bigendian.ll45
-rw-r--r--test/Transforms/InstCombine/bitcast-vec-uniform.ll16
-rw-r--r--test/Transforms/InstCombine/bitcast-vector-fold.ll2
-rw-r--r--test/Transforms/InstCombine/bitcast.ll32
-rw-r--r--test/Transforms/InstCombine/call-cast-target.ll9
-rw-r--r--test/Transforms/InstCombine/call.ll222
-rw-r--r--test/Transforms/InstCombine/canonicalize_branch.ll8
-rw-r--r--test/Transforms/InstCombine/cast.ll147
-rw-r--r--test/Transforms/InstCombine/cast_ptr.ll55
-rw-r--r--test/Transforms/InstCombine/compare-signs.ll12
-rw-r--r--test/Transforms/InstCombine/constant-fold-address-space-pointer.ll232
-rw-r--r--test/Transforms/InstCombine/constant-fold-gep.ll22
-rw-r--r--test/Transforms/InstCombine/cos-1.ll6
-rw-r--r--test/Transforms/InstCombine/cos-2.ll2
-rw-r--r--test/Transforms/InstCombine/debug-line.ll16
-rw-r--r--test/Transforms/InstCombine/debuginfo.ll27
-rw-r--r--test/Transforms/InstCombine/disable-simplify-libcalls.ll74
-rw-r--r--test/Transforms/InstCombine/div-shift-crash.ll101
-rw-r--r--test/Transforms/InstCombine/div-shift.ll38
-rw-r--r--test/Transforms/InstCombine/div.ll30
-rw-r--r--test/Transforms/InstCombine/double-float-shrink-1.ll13
-rw-r--r--test/Transforms/InstCombine/enforce-known-alignment.ll26
-rw-r--r--test/Transforms/InstCombine/err-rep-cold.ll77
-rw-r--r--test/Transforms/InstCombine/exact.ll36
-rw-r--r--test/Transforms/InstCombine/exp2-1.ll16
-rw-r--r--test/Transforms/InstCombine/exp2-2.ll2
-rw-r--r--test/Transforms/InstCombine/extractvalue.ll6
-rw-r--r--test/Transforms/InstCombine/fast-math.ll84
-rw-r--r--test/Transforms/InstCombine/fcmp.ll32
-rw-r--r--test/Transforms/InstCombine/fdiv.ll6
-rw-r--r--test/Transforms/InstCombine/ffs-1.ll32
-rw-r--r--test/Transforms/InstCombine/float-shrink-compare.ll (renamed from test/Transforms/SimplifyLibCalls/float-shrink-compare.ll)30
-rw-r--r--test/Transforms/InstCombine/fmul.ll37
-rw-r--r--test/Transforms/InstCombine/fneg-ext.ll23
-rw-r--r--test/Transforms/InstCombine/fold-bin-operand.ll4
-rw-r--r--test/Transforms/InstCombine/fold-calls.ll4
-rw-r--r--test/Transforms/InstCombine/fold-fops-into-selects.ll71
-rw-r--r--test/Transforms/InstCombine/fold-vector-select.ll4
-rw-r--r--test/Transforms/InstCombine/fpcast.ll12
-rw-r--r--test/Transforms/InstCombine/fprintf-1.ll16
-rw-r--r--test/Transforms/InstCombine/fputs-1.ll6
-rw-r--r--test/Transforms/InstCombine/fwrite-1.ll10
-rw-r--r--test/Transforms/InstCombine/gep-addrspace.ll2
-rw-r--r--test/Transforms/InstCombine/getelementptr.ll438
-rw-r--r--test/Transforms/InstCombine/icmp-logical.ll152
-rw-r--r--test/Transforms/InstCombine/icmp.ll604
-rw-r--r--test/Transforms/InstCombine/idioms.ll2
-rw-r--r--test/Transforms/InstCombine/intrinsics.ll40
-rw-r--r--test/Transforms/InstCombine/invoke.ll6
-rw-r--r--test/Transforms/InstCombine/isascii-1.ll6
-rw-r--r--test/Transforms/InstCombine/isdigit-1.ll10
-rw-r--r--test/Transforms/InstCombine/lit.local.cfg1
-rw-r--r--test/Transforms/InstCombine/load-cmp.ll334
-rw-r--r--test/Transforms/InstCombine/load-select.ll2
-rw-r--r--test/Transforms/InstCombine/load3.ll6
-rw-r--r--test/Transforms/InstCombine/malloc-free-delete.ll36
-rw-r--r--test/Transforms/InstCombine/memcmp-1.ll12
-rw-r--r--test/Transforms/InstCombine/memcmp-2.ll2
-rw-r--r--test/Transforms/InstCombine/memcpy-1.ll2
-rw-r--r--test/Transforms/InstCombine/memcpy-2.ll2
-rw-r--r--test/Transforms/InstCombine/memcpy-from-global.ll18
-rw-r--r--test/Transforms/InstCombine/memcpy.ll6
-rw-r--r--test/Transforms/InstCombine/memcpy_chk-1.ll8
-rw-r--r--test/Transforms/InstCombine/memcpy_chk-2.ll2
-rw-r--r--test/Transforms/InstCombine/memmove-1.ll2
-rw-r--r--test/Transforms/InstCombine/memmove-2.ll2
-rw-r--r--test/Transforms/InstCombine/memmove_chk-1.ll8
-rw-r--r--test/Transforms/InstCombine/memmove_chk-2.ll2
-rw-r--r--test/Transforms/InstCombine/memset-1.ll2
-rw-r--r--test/Transforms/InstCombine/memset-2.ll2
-rw-r--r--test/Transforms/InstCombine/memset_chk-1.ll10
-rw-r--r--test/Transforms/InstCombine/memset_chk-2.ll2
-rw-r--r--test/Transforms/InstCombine/merge-icmp.ll4
-rw-r--r--test/Transforms/InstCombine/mul.ll38
-rw-r--r--test/Transforms/InstCombine/multi-size-address-space-pointer.ll112
-rw-r--r--test/Transforms/InstCombine/no-negzero.ll2
-rw-r--r--test/Transforms/InstCombine/nsw.ll18
-rw-r--r--test/Transforms/InstCombine/objsize-64.ll4
-rw-r--r--test/Transforms/InstCombine/objsize-address-space.ll80
-rw-r--r--test/Transforms/InstCombine/objsize.ll92
-rw-r--r--test/Transforms/InstCombine/onehot_merge.ll35
-rw-r--r--test/Transforms/InstCombine/or-fcmp.ll10
-rw-r--r--test/Transforms/InstCombine/or-xor.ll18
-rw-r--r--test/Transforms/InstCombine/or.ll78
-rw-r--r--test/Transforms/InstCombine/osx-names.ll4
-rw-r--r--test/Transforms/InstCombine/overflow.ll14
-rw-r--r--test/Transforms/InstCombine/phi-select-constexpr.ll19
-rw-r--r--test/Transforms/InstCombine/phi.ll54
-rw-r--r--test/Transforms/InstCombine/pow-1.ll45
-rw-r--r--test/Transforms/InstCombine/pow-2.ll2
-rw-r--r--test/Transforms/InstCombine/pow-3.ll12
-rw-r--r--test/Transforms/InstCombine/pr17827.ll74
-rw-r--r--test/Transforms/InstCombine/pr8547.ll2
-rw-r--r--test/Transforms/InstCombine/printf-1.ll22
-rw-r--r--test/Transforms/InstCombine/printf-2.ll6
-rw-r--r--test/Transforms/InstCombine/ptr-int-cast.ll8
-rw-r--r--test/Transforms/InstCombine/puts-1.ll4
-rw-r--r--test/Transforms/InstCombine/rem.ll122
-rw-r--r--test/Transforms/InstCombine/select-2.ll5
-rw-r--r--test/Transforms/InstCombine/select-crash.ll4
-rw-r--r--test/Transforms/InstCombine/select-extractelement.ll102
-rw-r--r--test/Transforms/InstCombine/select.ll220
-rw-r--r--test/Transforms/InstCombine/sext.ll34
-rw-r--r--test/Transforms/InstCombine/shift-sra.ll10
-rw-r--r--test/Transforms/InstCombine/shift.ll187
-rw-r--r--test/Transforms/InstCombine/sign-test-and-or.ll18
-rw-r--r--test/Transforms/InstCombine/signext.ll16
-rw-r--r--test/Transforms/InstCombine/simplify-libcalls.ll144
-rw-r--r--test/Transforms/InstCombine/sincospi.ll91
-rw-r--r--test/Transforms/InstCombine/sink_instruction.ll4
-rw-r--r--test/Transforms/InstCombine/sprintf-1.ll18
-rw-r--r--test/Transforms/InstCombine/sqrt.ll6
-rw-r--r--test/Transforms/InstCombine/store.ll15
-rw-r--r--test/Transforms/InstCombine/stpcpy-1.ll6
-rw-r--r--test/Transforms/InstCombine/stpcpy-2.ll2
-rw-r--r--test/Transforms/InstCombine/stpcpy_chk-1.ll20
-rw-r--r--test/Transforms/InstCombine/stpcpy_chk-2.ll2
-rw-r--r--test/Transforms/InstCombine/strcat-1.ll2
-rw-r--r--test/Transforms/InstCombine/strcat-2.ll4
-rw-r--r--test/Transforms/InstCombine/strcat-3.ll2
-rw-r--r--test/Transforms/InstCombine/strchr-1.ll11
-rw-r--r--test/Transforms/InstCombine/strcmp-1.ll12
-rw-r--r--test/Transforms/InstCombine/strcmp-2.ll2
-rw-r--r--test/Transforms/InstCombine/strcpy-1.ll6
-rw-r--r--test/Transforms/InstCombine/strcpy-2.ll2
-rw-r--r--test/Transforms/InstCombine/strcpy_chk-1.ll20
-rw-r--r--test/Transforms/InstCombine/strcpy_chk-2.ll2
-rw-r--r--test/Transforms/InstCombine/strcpy_chk-64.ll2
-rw-r--r--test/Transforms/InstCombine/strcspn-1.ll8
-rw-r--r--test/Transforms/InstCombine/strcspn-2.ll2
-rw-r--r--test/Transforms/InstCombine/strlen-1.ll18
-rw-r--r--test/Transforms/InstCombine/strlen-2.ll2
-rw-r--r--test/Transforms/InstCombine/strncat-1.ll2
-rw-r--r--test/Transforms/InstCombine/strncat-2.ll8
-rw-r--r--test/Transforms/InstCombine/strncat-3.ll2
-rw-r--r--test/Transforms/InstCombine/strncmp-1.ll16
-rw-r--r--test/Transforms/InstCombine/strncmp-2.ll2
-rw-r--r--test/Transforms/InstCombine/strncpy-1.ll12
-rw-r--r--test/Transforms/InstCombine/strncpy-2.ll2
-rw-r--r--test/Transforms/InstCombine/strncpy_chk-1.ll10
-rw-r--r--test/Transforms/InstCombine/strncpy_chk-2.ll2
-rw-r--r--test/Transforms/InstCombine/strpbrk-1.ll10
-rw-r--r--test/Transforms/InstCombine/strpbrk-2.ll2
-rw-r--r--test/Transforms/InstCombine/strrchr-1.ll13
-rw-r--r--test/Transforms/InstCombine/strspn-1.ll8
-rw-r--r--test/Transforms/InstCombine/strstr-1.ll10
-rw-r--r--test/Transforms/InstCombine/strstr-2.ll2
-rw-r--r--test/Transforms/InstCombine/strto-1.ll30
-rw-r--r--test/Transforms/InstCombine/struct-assign-tbaa.ll8
-rw-r--r--test/Transforms/InstCombine/sub-xor.ll8
-rw-r--r--test/Transforms/InstCombine/sub.ll237
-rw-r--r--test/Transforms/InstCombine/toascii-1.ll14
-rw-r--r--test/Transforms/InstCombine/trunc.ll20
-rw-r--r--test/Transforms/InstCombine/udivrem-change-width.ll12
-rw-r--r--test/Transforms/InstCombine/vec_demanded_elts.ll18
-rw-r--r--test/Transforms/InstCombine/vec_extract_elt.ll3
-rw-r--r--test/Transforms/InstCombine/vec_insertelt.ll3
-rw-r--r--test/Transforms/InstCombine/vec_phi_extract.ll25
-rw-r--r--test/Transforms/InstCombine/vec_shuffle.ll105
-rw-r--r--test/Transforms/InstCombine/vector-casts.ll12
-rw-r--r--test/Transforms/InstCombine/vector-mul.ll408
-rw-r--r--test/Transforms/InstCombine/vector_gep2.ll2
-rw-r--r--test/Transforms/InstCombine/weak-symbols.ll4
-rw-r--r--test/Transforms/InstCombine/win-math.ll (renamed from test/Transforms/SimplifyLibCalls/win-math.ll)86
-rw-r--r--test/Transforms/InstCombine/xor2.ll14
-rw-r--r--test/Transforms/InstCombine/zext-bool-add-sub.ll2
-rw-r--r--test/Transforms/InstSimplify/2010-12-20-Boolean.ll8
-rw-r--r--test/Transforms/InstSimplify/2010-12-20-Distribute.ll12
-rw-r--r--test/Transforms/InstSimplify/2011-01-14-Thread.ll2
-rw-r--r--test/Transforms/InstSimplify/2011-02-01-Vector.ll2
-rw-r--r--test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll4
-rw-r--r--test/Transforms/InstSimplify/AndOrXor.ll4
-rw-r--r--test/Transforms/InstSimplify/call.ll75
-rw-r--r--test/Transforms/InstSimplify/compare.ll180
-rw-r--r--test/Transforms/InstSimplify/exact-nsw-nuw.ll10
-rw-r--r--test/Transforms/InstSimplify/fast-math.ll4
-rw-r--r--test/Transforms/InstSimplify/fdiv.ll4
-rw-r--r--test/Transforms/InstSimplify/floating-point-arithmetic.ll8
-rw-r--r--test/Transforms/InstSimplify/lit.local.cfg1
-rw-r--r--test/Transforms/InstSimplify/maxmin.ll56
-rw-r--r--test/Transforms/InstSimplify/phi.ll2
-rw-r--r--test/Transforms/InstSimplify/ptr_diff.ll10
-rw-r--r--test/Transforms/InstSimplify/reassociate.ll42
-rw-r--r--test/Transforms/InstSimplify/rem.ll4
-rw-r--r--test/Transforms/Internalize/2008-05-09-AllButMain.ll55
-rw-r--r--test/Transforms/Internalize/apifile (renamed from test/Transforms/Internalize/2008-05-09-AllButMain.ll.apifile)0
-rw-r--r--test/Transforms/Internalize/available_externally.ll16
-rw-r--r--test/Transforms/Internalize/lists.ll50
-rw-r--r--test/Transforms/Internalize/lit.local.cfg1
-rw-r--r--test/Transforms/Internalize/used.ll20
-rw-r--r--test/Transforms/JumpThreading/basic.ll30
-rw-r--r--test/Transforms/JumpThreading/indirectbr.ll2
-rw-r--r--test/Transforms/JumpThreading/landing-pad.ll203
-rw-r--r--test/Transforms/JumpThreading/lit.local.cfg1
-rw-r--r--test/Transforms/JumpThreading/select.ll71
-rw-r--r--test/Transforms/JumpThreading/thread-loads.ll8
-rw-r--r--test/Transforms/LCSSA/lit.local.cfg1
-rw-r--r--test/Transforms/LICM/2011-04-06-PromoteResultOfPromotion.ll6
-rw-r--r--test/Transforms/LICM/atomics.ll8
-rw-r--r--test/Transforms/LICM/debug-value.ll33
-rw-r--r--test/Transforms/LICM/hoisting.ll10
-rw-r--r--test/Transforms/LICM/lit.local.cfg1
-rw-r--r--test/Transforms/LICM/promote-order.ll6
-rw-r--r--test/Transforms/LICM/scalar_promote.ll16
-rw-r--r--test/Transforms/LICM/sinking.ll22
-rw-r--r--test/Transforms/LICM/speculate.ll10
-rw-r--r--test/Transforms/LICM/volatile-alias.ll54
-rw-r--r--test/Transforms/LoopDeletion/lit.local.cfg1
-rw-r--r--test/Transforms/LoopIdiom/X86/lit.local.cfg2
-rw-r--r--test/Transforms/LoopIdiom/basic-address-space.ll91
-rw-r--r--test/Transforms/LoopIdiom/basic.ll32
-rw-r--r--test/Transforms/LoopIdiom/debug-line.ll21
-rw-r--r--test/Transforms/LoopIdiom/lit.local.cfg1
-rw-r--r--test/Transforms/LoopIdiom/memset_noidiom.ll2
-rw-r--r--test/Transforms/LoopReroll/basic.ll327
-rw-r--r--test/Transforms/LoopReroll/reduction.ll96
-rw-r--r--test/Transforms/LoopRotate/basic.ll4
-rw-r--r--test/Transforms/LoopRotate/dbgvalue.ll24
-rw-r--r--test/Transforms/LoopRotate/lit.local.cfg1
-rw-r--r--test/Transforms/LoopRotate/multiple-exits.ll4
-rw-r--r--test/Transforms/LoopRotate/phi-duplicate.ll2
-rw-r--r--test/Transforms/LoopRotate/simplifylatch.ll2
-rw-r--r--test/Transforms/LoopSimplify/dup-preds.ll46
-rw-r--r--test/Transforms/LoopSimplify/lit.local.cfg1
-rw-r--r--test/Transforms/LoopSimplify/preserve-scev.ll2
-rw-r--r--test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll4
-rw-r--r--test/Transforms/LoopStrengthReduce/2011-10-06-ReusePhi.ll2
-rw-r--r--test/Transforms/LoopStrengthReduce/2011-10-13-SCEVChain.ll2
-rw-r--r--test/Transforms/LoopStrengthReduce/2011-10-14-IntPtr.ll2
-rw-r--r--test/Transforms/LoopStrengthReduce/2011-12-19-PostincQuadratic.ll2
-rw-r--r--test/Transforms/LoopStrengthReduce/2012-01-02-nopreheader.ll4
-rw-r--r--test/Transforms/LoopStrengthReduce/2012-01-16-nopreheader.ll2
-rw-r--r--test/Transforms/LoopStrengthReduce/2012-03-15-nopreheader.ll2
-rw-r--r--test/Transforms/LoopStrengthReduce/2012-07-13-ExpandUDiv.ll2
-rw-r--r--test/Transforms/LoopStrengthReduce/2013-01-05-IndBr.ll2
-rw-r--r--test/Transforms/LoopStrengthReduce/2013-01-14-ReuseCast.ll12
-rw-r--r--test/Transforms/LoopStrengthReduce/ARM/ivchain-ARM.ll2
-rw-r--r--test/Transforms/LoopStrengthReduce/ARM/lit.local.cfg2
-rw-r--r--test/Transforms/LoopStrengthReduce/X86/2011-07-20-DoubleIV.ll4
-rw-r--r--test/Transforms/LoopStrengthReduce/X86/2011-11-29-postincphi.ll4
-rw-r--r--test/Transforms/LoopStrengthReduce/X86/2011-12-04-loserreg.ll4
-rw-r--r--test/Transforms/LoopStrengthReduce/X86/lit.local.cfg2
-rw-r--r--test/Transforms/LoopStrengthReduce/addrec-gep-address-space.ll88
-rw-r--r--test/Transforms/LoopStrengthReduce/address-space-loop.ll56
-rw-r--r--test/Transforms/LoopStrengthReduce/dominate-assert.ll43
-rw-r--r--test/Transforms/LoopStrengthReduce/ivchain.ll2
-rw-r--r--test/Transforms/LoopStrengthReduce/lit.local.cfg1
-rw-r--r--test/Transforms/LoopStrengthReduce/lsr-expand-quadratic.ll42
-rw-r--r--test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll44
-rw-r--r--test/Transforms/LoopStrengthReduce/scaling_factor_cost_crash.ll68
-rw-r--r--test/Transforms/LoopStrengthReduce/uglygep-address-space.ll56
-rw-r--r--test/Transforms/LoopStrengthReduce/uglygep.ll58
-rw-r--r--test/Transforms/LoopUnroll/2011-08-08-PhiUpdate.ll4
-rw-r--r--test/Transforms/LoopUnroll/2011-08-09-PhiUpdate.ll4
-rw-r--r--test/Transforms/LoopUnroll/2011-10-01-NoopTrunc.ll2
-rw-r--r--test/Transforms/LoopUnroll/PowerPC/a2-unrolling.ll48
-rw-r--r--test/Transforms/LoopUnroll/PowerPC/lit.local.cfg4
-rw-r--r--test/Transforms/LoopUnroll/basic.ll4
-rw-r--r--test/Transforms/LoopUnroll/lit.local.cfg1
-rw-r--r--test/Transforms/LoopUnroll/pr14167.ll2
-rw-r--r--test/Transforms/LoopUnroll/scevunroll.ll12
-rw-r--r--test/Transforms/LoopUnroll/unloop.ll12
-rw-r--r--test/Transforms/LoopUnswitch/basictest.ll2
-rw-r--r--test/Transforms/LoopUnswitch/infinite-loop.ll2
-rw-r--r--test/Transforms/LoopUnswitch/lit.local.cfg1
-rw-r--r--test/Transforms/LoopVectorize/12-12-11-if-conv.ll4
-rw-r--r--test/Transforms/LoopVectorize/ARM/arm-unroll.ll4
-rw-r--r--test/Transforms/LoopVectorize/ARM/gather-cost.ll88
-rw-r--r--test/Transforms/LoopVectorize/ARM/gcc-examples.ll4
-rw-r--r--test/Transforms/LoopVectorize/ARM/lit.local.cfg2
-rw-r--r--test/Transforms/LoopVectorize/ARM/width-detect.ll18
-rw-r--r--test/Transforms/LoopVectorize/X86/already-vectorized.ll46
-rw-r--r--test/Transforms/LoopVectorize/X86/avx1.ll4
-rw-r--r--test/Transforms/LoopVectorize/X86/conversion-cost.ll4
-rw-r--r--test/Transforms/LoopVectorize/X86/cost-model.ll2
-rw-r--r--test/Transforms/LoopVectorize/X86/gather-cost.ll86
-rw-r--r--test/Transforms/LoopVectorize/X86/gcc-examples.ll8
-rw-r--r--test/Transforms/LoopVectorize/X86/illegal-parallel-loop-uniform-write.ll6
-rw-r--r--test/Transforms/LoopVectorize/X86/lit.local.cfg2
-rw-r--r--test/Transforms/LoopVectorize/X86/parallel-loops-after-reg2mem.ll2
-rw-r--r--test/Transforms/LoopVectorize/X86/parallel-loops.ll10
-rw-r--r--test/Transforms/LoopVectorize/X86/rauw-bug.ll33
-rw-r--r--test/Transforms/LoopVectorize/X86/reduction-crash.ll2
-rw-r--r--test/Transforms/LoopVectorize/X86/small-size.ll10
-rw-r--r--test/Transforms/LoopVectorize/X86/tripcount.ll39
-rw-r--r--test/Transforms/LoopVectorize/X86/unroll-pm.ll31
-rw-r--r--test/Transforms/LoopVectorize/X86/unroll-small-loops.ll4
-rw-r--r--test/Transforms/LoopVectorize/X86/x86_fp80-vector-store.ll2
-rw-r--r--test/Transforms/LoopVectorize/XCore/lit.local.cfg3
-rw-r--r--test/Transforms/LoopVectorize/XCore/no-vector-registers.ll23
-rw-r--r--test/Transforms/LoopVectorize/align.ll33
-rw-r--r--test/Transforms/LoopVectorize/bsd_regex.ll2
-rw-r--r--test/Transforms/LoopVectorize/cast-induction.ll2
-rw-r--r--test/Transforms/LoopVectorize/cpp-new-array.ll2
-rw-r--r--test/Transforms/LoopVectorize/dbg.value.ll23
-rw-r--r--test/Transforms/LoopVectorize/debugloc.ll90
-rw-r--r--test/Transforms/LoopVectorize/ee-crash.ll35
-rw-r--r--test/Transforms/LoopVectorize/flags.ll4
-rw-r--r--test/Transforms/LoopVectorize/float-reduction.ll2
-rw-r--r--test/Transforms/LoopVectorize/funcall.ll32
-rw-r--r--test/Transforms/LoopVectorize/gcc-examples.ll42
-rw-r--r--test/Transforms/LoopVectorize/global_alias.ll49
-rw-r--r--test/Transforms/LoopVectorize/hoist-loads.ll69
-rw-r--r--test/Transforms/LoopVectorize/if-conv-crash.ll22
-rw-r--r--test/Transforms/LoopVectorize/if-conversion-edgemasks.ll243
-rw-r--r--test/Transforms/LoopVectorize/if-conversion-nest.ll2
-rw-r--r--test/Transforms/LoopVectorize/if-conversion-reduction.ll2
-rw-r--r--test/Transforms/LoopVectorize/if-conversion.ll67
-rw-r--r--test/Transforms/LoopVectorize/increment.ll4
-rw-r--r--test/Transforms/LoopVectorize/induction.ll110
-rw-r--r--test/Transforms/LoopVectorize/induction_plus.ll4
-rw-r--r--test/Transforms/LoopVectorize/infiniteloop.ll34
-rw-r--r--test/Transforms/LoopVectorize/intrinsic.ll229
-rw-r--r--test/Transforms/LoopVectorize/lifetime.ll96
-rw-r--r--test/Transforms/LoopVectorize/lit.local.cfg1
-rw-r--r--test/Transforms/LoopVectorize/memdep.ll222
-rw-r--r--test/Transforms/LoopVectorize/metadata-unroll.ll41
-rw-r--r--test/Transforms/LoopVectorize/metadata-width.ll31
-rw-r--r--test/Transforms/LoopVectorize/minmax_reduction.ll124
-rw-r--r--test/Transforms/LoopVectorize/multiple-address-spaces.ll44
-rw-r--r--test/Transforms/LoopVectorize/no_idiv_reduction.ll2
-rw-r--r--test/Transforms/LoopVectorize/no_int_induction.ll33
-rw-r--r--test/Transforms/LoopVectorize/no_outside_user.ll30
-rw-r--r--test/Transforms/LoopVectorize/nofloat.ll2
-rw-r--r--test/Transforms/LoopVectorize/non-const-n.ll2
-rw-r--r--test/Transforms/LoopVectorize/opt.ll28
-rw-r--r--test/Transforms/LoopVectorize/ptr_loops.ll4
-rw-r--r--test/Transforms/LoopVectorize/read-only.ll2
-rw-r--r--test/Transforms/LoopVectorize/reduction.ll191
-rw-r--r--test/Transforms/LoopVectorize/reverse_induction.ll75
-rw-r--r--test/Transforms/LoopVectorize/reverse_iter.ll45
-rw-r--r--test/Transforms/LoopVectorize/runtime-check-address-space.ll235
-rw-r--r--test/Transforms/LoopVectorize/runtime-check-readonly-address-space.ll142
-rw-r--r--test/Transforms/LoopVectorize/runtime-check-readonly.ll2
-rw-r--r--test/Transforms/LoopVectorize/runtime-check.ll30
-rw-r--r--test/Transforms/LoopVectorize/runtime-limit.ll4
-rw-r--r--test/Transforms/LoopVectorize/safegep.ll61
-rw-r--r--test/Transforms/LoopVectorize/same-base-access.ll4
-rw-r--r--test/Transforms/LoopVectorize/scalar-select.ll2
-rw-r--r--test/Transforms/LoopVectorize/scev-exitlim-crash.ll114
-rw-r--r--test/Transforms/LoopVectorize/simple-unroll.ll2
-rw-r--r--test/Transforms/LoopVectorize/small-loop.ll2
-rw-r--r--test/Transforms/LoopVectorize/start-non-zero.ll2
-rw-r--r--test/Transforms/LoopVectorize/store-shuffle-bug.ll55
-rw-r--r--test/Transforms/LoopVectorize/struct_access.ll44
-rw-r--r--test/Transforms/LoopVectorize/undef-inst-bug.ll36
-rw-r--r--test/Transforms/LoopVectorize/unroll_novec.ll39
-rw-r--r--test/Transforms/LoopVectorize/value-ptr-bug.ll2
-rw-r--r--test/Transforms/LoopVectorize/vectorize-once.ll19
-rw-r--r--test/Transforms/LoopVectorize/write-only.ll2
-rw-r--r--test/Transforms/LowerAtomic/atomic-load.ll6
-rw-r--r--test/Transforms/LowerAtomic/atomic-swap.ll4
-rw-r--r--test/Transforms/LowerAtomic/barrier.ll2
-rw-r--r--test/Transforms/LowerAtomic/lit.local.cfg1
-rw-r--r--test/Transforms/LowerExpectIntrinsic/basic.ll16
-rw-r--r--test/Transforms/LowerExpectIntrinsic/lit.local.cfg1
-rw-r--r--test/Transforms/LowerInvoke/lit.local.cfg1
-rw-r--r--test/Transforms/LowerSwitch/feature.ll64
-rw-r--r--test/Transforms/LowerSwitch/lit.local.cfg1
-rw-r--r--test/Transforms/Mem2Reg/ConvertDebugInfo.ll15
-rw-r--r--test/Transforms/Mem2Reg/ConvertDebugInfo2.ll20
-rw-r--r--test/Transforms/Mem2Reg/atomic.ll2
-rw-r--r--test/Transforms/Mem2Reg/lit.local.cfg1
-rw-r--r--test/Transforms/MemCpyOpt/align.ll4
-rw-r--r--test/Transforms/MemCpyOpt/form-memset.ll18
-rw-r--r--test/Transforms/MemCpyOpt/lit.local.cfg1
-rw-r--r--test/Transforms/MemCpyOpt/loadstore-sret.ll2
-rw-r--r--test/Transforms/MemCpyOpt/memcpy-to-memset.ll2
-rw-r--r--test/Transforms/MemCpyOpt/memcpy.ll31
-rw-r--r--test/Transforms/MemCpyOpt/memmove.ll6
-rw-r--r--test/Transforms/MergeFunc/address-spaces.ll35
-rw-r--r--test/Transforms/MergeFunc/inttoptr-address-space.ll29
-rw-r--r--test/Transforms/MergeFunc/inttoptr.ll1
-rw-r--r--test/Transforms/MergeFunc/lit.local.cfg1
-rw-r--r--test/Transforms/MergeFunc/merge-ptr-and-int.ll27
-rw-r--r--test/Transforms/MergeFunc/ptr-int-transitivity-1.ll21
-rw-r--r--test/Transforms/MergeFunc/ptr-int-transitivity-2.ll25
-rw-r--r--test/Transforms/MergeFunc/ptr-int-transitivity-3.ll21
-rw-r--r--test/Transforms/MergeFunc/too-small.ll14
-rw-r--r--test/Transforms/MetaRenamer/lit.local.cfg1
-rw-r--r--test/Transforms/ObjCARC/allocas.ll500
-rw-r--r--test/Transforms/ObjCARC/arc-annotations.ll2
-rw-r--r--test/Transforms/ObjCARC/basic.ll294
-rw-r--r--test/Transforms/ObjCARC/cfg-hazards.ll6
-rw-r--r--test/Transforms/ObjCARC/contract-storestrong.ll6
-rw-r--r--test/Transforms/ObjCARC/contract-testcases.ll4
-rw-r--r--test/Transforms/ObjCARC/contract.ll26
-rw-r--r--test/Transforms/ObjCARC/empty-block.ll4
-rw-r--r--test/Transforms/ObjCARC/ensure-that-exception-unwind-path-is-visited.ll58
-rw-r--r--test/Transforms/ObjCARC/escape.ll4
-rw-r--r--test/Transforms/ObjCARC/gvn.ll25
-rw-r--r--test/Transforms/ObjCARC/intrinsic-use-isolated.ll2
-rw-r--r--test/Transforms/ObjCARC/intrinsic-use.ll4
-rw-r--r--test/Transforms/ObjCARC/invoke.ll12
-rw-r--r--test/Transforms/ObjCARC/lit.local.cfg1
-rw-r--r--test/Transforms/ObjCARC/nested.ll24
-rw-r--r--test/Transforms/ObjCARC/no-objc-arc-exceptions.ll123
-rw-r--r--test/Transforms/ObjCARC/path-overflow.ll1876
-rw-r--r--test/Transforms/ObjCARC/pointer-types.ll2
-rw-r--r--test/Transforms/ObjCARC/post-inlining.ll6
-rw-r--r--test/Transforms/ObjCARC/retain-block-alloca.ll94
-rw-r--r--test/Transforms/ObjCARC/retain-block-escape-analysis.ll215
-rw-r--r--test/Transforms/ObjCARC/retain-block-load.ll51
-rw-r--r--test/Transforms/ObjCARC/retain-block.ll140
-rw-r--r--test/Transforms/ObjCARC/retain-not-declared.ll2
-rw-r--r--test/Transforms/ObjCARC/rv.ll22
-rw-r--r--test/Transforms/ObjCARC/split-backedge.ll2
-rw-r--r--test/Transforms/ObjCARC/weak.ll2
-rw-r--r--test/Transforms/PhaseOrdering/PR6627.ll4
-rw-r--r--test/Transforms/PhaseOrdering/basic.ll4
-rw-r--r--test/Transforms/PhaseOrdering/lit.local.cfg1
-rw-r--r--test/Transforms/PruneEH/lit.local.cfg1
-rw-r--r--test/Transforms/Reassociate/2012-05-08-UndefLeak.ll2
-rw-r--r--test/Transforms/Reassociate/absorption.ll2
-rw-r--r--test/Transforms/Reassociate/basictest.ll30
-rw-r--r--test/Transforms/Reassociate/inverses.ll6
-rw-r--r--test/Transforms/Reassociate/lit.local.cfg1
-rw-r--r--test/Transforms/Reassociate/mulfactor.ll14
-rw-r--r--test/Transforms/Reassociate/multistep.ll4
-rw-r--r--test/Transforms/Reassociate/no-op.ll4
-rw-r--r--test/Transforms/Reassociate/optional-flags.ll4
-rw-r--r--test/Transforms/Reassociate/repeats.ll32
-rw-r--r--test/Transforms/Reassociate/xor_reassoc.ll22
-rw-r--r--test/Transforms/Reg2Mem/lit.local.cfg1
-rw-r--r--test/Transforms/SCCP/atomic-load-store.ll4
-rw-r--r--test/Transforms/SCCP/ipsccp-addr-taken.ll2
-rw-r--r--test/Transforms/SCCP/ipsccp-basic.ll28
-rw-r--r--test/Transforms/SCCP/lit.local.cfg1
-rw-r--r--test/Transforms/SCCP/sccptest.ll4
-rw-r--r--test/Transforms/SCCP/switch.ll2
-rw-r--r--test/Transforms/SCCP/undef-resolve.ll20
-rw-r--r--test/Transforms/SLPVectorizer/ARM/lit.local.cfg3
-rw-r--r--test/Transforms/SLPVectorizer/ARM/memory.ll20
-rw-r--r--test/Transforms/SLPVectorizer/ARM/sroa.ll52
-rw-r--r--test/Transforms/SLPVectorizer/R600/lit.local.cfg4
-rw-r--r--test/Transforms/SLPVectorizer/R600/simplebb.ll65
-rw-r--r--test/Transforms/SLPVectorizer/X86/barriercall.ll2
-rw-r--r--test/Transforms/SLPVectorizer/X86/cast.ll2
-rw-r--r--test/Transforms/SLPVectorizer/X86/cmp_sel.ll32
-rw-r--r--test/Transforms/SLPVectorizer/X86/compare-reduce.ll2
-rw-r--r--test/Transforms/SLPVectorizer/X86/crash_7zip.ll38
-rw-r--r--test/Transforms/SLPVectorizer/X86/crash_bullet.ll128
-rw-r--r--test/Transforms/SLPVectorizer/X86/crash_bullet3.ll84
-rw-r--r--test/Transforms/SLPVectorizer/X86/crash_dequeue.ll40
-rw-r--r--test/Transforms/SLPVectorizer/X86/crash_flop7.ll46
-rw-r--r--test/Transforms/SLPVectorizer/X86/crash_lencod.ll91
-rw-r--r--test/Transforms/SLPVectorizer/X86/crash_mandeltext.ll107
-rw-r--r--test/Transforms/SLPVectorizer/X86/crash_netbsd_decompress.ll41
-rw-r--r--test/Transforms/SLPVectorizer/X86/crash_sim4b1.ll113
-rw-r--r--test/Transforms/SLPVectorizer/X86/crash_smallpt.ll105
-rw-r--r--test/Transforms/SLPVectorizer/X86/cross_block_slp.ll54
-rw-r--r--test/Transforms/SLPVectorizer/X86/cse.ll219
-rw-r--r--test/Transforms/SLPVectorizer/X86/cycle_dup.ll64
-rw-r--r--test/Transforms/SLPVectorizer/X86/debug_info.ll89
-rw-r--r--test/Transforms/SLPVectorizer/X86/diamond.ll47
-rw-r--r--test/Transforms/SLPVectorizer/X86/external_user.ll96
-rw-r--r--test/Transforms/SLPVectorizer/X86/extract.ll59
-rw-r--r--test/Transforms/SLPVectorizer/X86/horizontal.ll417
-rw-r--r--test/Transforms/SLPVectorizer/X86/implicitfloat.ll25
-rw-r--r--test/Transforms/SLPVectorizer/X86/in-tree-user.ll50
-rw-r--r--test/Transforms/SLPVectorizer/X86/insert-element-build-vector.ll197
-rw-r--r--test/Transforms/SLPVectorizer/X86/lit.local.cfg2
-rw-r--r--test/Transforms/SLPVectorizer/X86/long_chains.ll47
-rw-r--r--test/Transforms/SLPVectorizer/X86/loopinvariant.ll2
-rw-r--r--test/Transforms/SLPVectorizer/X86/multi_block.ll55
-rw-r--r--test/Transforms/SLPVectorizer/X86/multi_user.ll2
-rw-r--r--test/Transforms/SLPVectorizer/X86/odd_store.ll46
-rw-r--r--test/Transforms/SLPVectorizer/X86/operandorder.ll234
-rw-r--r--test/Transforms/SLPVectorizer/X86/opt.ll30
-rw-r--r--test/Transforms/SLPVectorizer/X86/ordering.ll81
-rw-r--r--test/Transforms/SLPVectorizer/X86/phi.ll248
-rw-r--r--test/Transforms/SLPVectorizer/X86/phi3.ll35
-rw-r--r--test/Transforms/SLPVectorizer/X86/phi_landingpad.ll31
-rw-r--r--test/Transforms/SLPVectorizer/X86/phi_overalignedtype.ll45
-rw-r--r--test/Transforms/SLPVectorizer/X86/pr16571.ll22
-rw-r--r--test/Transforms/SLPVectorizer/X86/pr16628.ll27
-rw-r--r--test/Transforms/SLPVectorizer/X86/pr16899.ll31
-rw-r--r--test/Transforms/SLPVectorizer/X86/pr18060.ll47
-rw-r--r--test/Transforms/SLPVectorizer/X86/reduction2.ll6
-rw-r--r--test/Transforms/SLPVectorizer/X86/rgb_phi.ll76
-rw-r--r--test/Transforms/SLPVectorizer/X86/saxpy.ll16
-rw-r--r--test/Transforms/SLPVectorizer/X86/simplebb.ll64
-rw-r--r--test/Transforms/SLPVectorizer/X86/tiny-tree.ll140
-rw-r--r--test/Transforms/SLPVectorizer/XCore/lit.local.cfg3
-rw-r--r--test/Transforms/SLPVectorizer/XCore/no-vector-registers.ll24
-rw-r--r--test/Transforms/SLPVectorizer/lit.local.cfg1
-rw-r--r--test/Transforms/SROA/alignment.ll14
-rw-r--r--test/Transforms/SROA/basictest.ll107
-rw-r--r--test/Transforms/SROA/big-endian.ll4
-rw-r--r--test/Transforms/SROA/fca.ll4
-rw-r--r--test/Transforms/SROA/lit.local.cfg1
-rw-r--r--test/Transforms/SROA/phi-and-select.ll106
-rw-r--r--test/Transforms/SROA/vector-conversion.ll53
-rw-r--r--test/Transforms/SROA/vector-promotion.ll22
-rw-r--r--test/Transforms/SampleProfile/Inputs/branch.prof11
-rw-r--r--test/Transforms/SampleProfile/branch.ll143
-rw-r--r--test/Transforms/ScalarRepl/2008-09-22-vector-gep.ll2
-rw-r--r--test/Transforms/ScalarRepl/2009-12-11-NeonTypes.ll4
-rw-r--r--test/Transforms/ScalarRepl/2010-01-18-SelfCopy.ll2
-rw-r--r--test/Transforms/ScalarRepl/2011-09-22-PHISpeculateInvoke.ll2
-rw-r--r--test/Transforms/ScalarRepl/2011-10-22-VectorCrash.ll2
-rw-r--r--test/Transforms/ScalarRepl/address-space.ll2
-rw-r--r--test/Transforms/ScalarRepl/badarray.ll6
-rw-r--r--test/Transforms/ScalarRepl/basictest.ll4
-rw-r--r--test/Transforms/ScalarRepl/debuginfo-preserved.ll13
-rw-r--r--test/Transforms/ScalarRepl/inline-vector.ll2
-rw-r--r--test/Transforms/ScalarRepl/lifetime.ll12
-rw-r--r--test/Transforms/ScalarRepl/lit.local.cfg1
-rw-r--r--test/Transforms/ScalarRepl/memset-aggregate.ll2
-rw-r--r--test/Transforms/ScalarRepl/nonzero-first-index.ll8
-rw-r--r--test/Transforms/ScalarRepl/only-memcpy-uses.ll2
-rw-r--r--test/Transforms/ScalarRepl/phi-select.ll16
-rw-r--r--test/Transforms/ScalarRepl/union-pointer.ll43
-rw-r--r--test/Transforms/ScalarRepl/vector_promote.ll38
-rw-r--r--test/Transforms/SimplifyCFG/2009-01-19-UnconditionalTrappingConstantExpr.ll4
-rw-r--r--test/Transforms/SimplifyCFG/CoveredLookupTable.ll48
-rw-r--r--test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll240
-rw-r--r--test/Transforms/SimplifyCFG/MagicPointer.ll94
-rw-r--r--test/Transforms/SimplifyCFG/PR16069.ll28
-rw-r--r--test/Transforms/SimplifyCFG/SPARC/lit.local.cfg2
-rw-r--r--test/Transforms/SimplifyCFG/SPARC/switch_to_lookup_table.ll2
-rw-r--r--test/Transforms/SimplifyCFG/SpeculativeExec.ll6
-rw-r--r--test/Transforms/SimplifyCFG/UnreachableEliminate.ll6
-rw-r--r--test/Transforms/SimplifyCFG/X86/lit.local.cfg2
-rw-r--r--test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll29
-rw-r--r--test/Transforms/SimplifyCFG/attr-noduplicate.ll37
-rw-r--r--test/Transforms/SimplifyCFG/basictest.ll8
-rw-r--r--test/Transforms/SimplifyCFG/branch-fold-dbg.ll17
-rw-r--r--test/Transforms/SimplifyCFG/common-dest-folding.ll57
-rw-r--r--test/Transforms/SimplifyCFG/dce-cond-after-folding-terminator.ll6
-rw-r--r--test/Transforms/SimplifyCFG/hoist-dbgvalue.ll19
-rw-r--r--test/Transforms/SimplifyCFG/indirectbr.ll8
-rw-r--r--test/Transforms/SimplifyCFG/invoke.ll12
-rw-r--r--test/Transforms/SimplifyCFG/invoke_unwind.ll2
-rw-r--r--test/Transforms/SimplifyCFG/lit.local.cfg1
-rw-r--r--test/Transforms/SimplifyCFG/phi-undef-loadstore.ll8
-rw-r--r--test/Transforms/SimplifyCFG/preserve-branchweights-partial.ll2
-rw-r--r--test/Transforms/SimplifyCFG/preserve-branchweights.ll16
-rw-r--r--test/Transforms/SimplifyCFG/select-gep.ll4
-rw-r--r--test/Transforms/SimplifyCFG/speculate-store.ll8
-rw-r--r--test/Transforms/SimplifyCFG/speculate-with-offset.ll8
-rw-r--r--test/Transforms/SimplifyCFG/switch-masked-bits.ll4
-rw-r--r--test/Transforms/SimplifyCFG/switch-on-const-select.ll10
-rw-r--r--test/Transforms/SimplifyCFG/switch-to-icmp.ll6
-rw-r--r--test/Transforms/SimplifyCFG/switch_create.ll121
-rw-r--r--test/Transforms/SimplifyCFG/trap-debugloc.ll15
-rw-r--r--test/Transforms/SimplifyCFG/trapping-load-unreachable.ll12
-rw-r--r--test/Transforms/SimplifyCFG/volatile-phioper.ll6
-rw-r--r--test/Transforms/SimplifyLibCalls/2005-05-20-sprintf-crash.ll11
-rw-r--r--test/Transforms/SimplifyLibCalls/2007-04-06-strchr-miscompile.ll29
-rw-r--r--test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll14
-rw-r--r--test/Transforms/SimplifyLibCalls/2009-05-30-memcmp-byte.ll14
-rw-r--r--test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll22
-rw-r--r--test/Transforms/SimplifyLibCalls/2009-07-29-Exit2.ll24
-rw-r--r--test/Transforms/SimplifyLibCalls/MemCpy.ll19
-rw-r--r--test/Transforms/SimplifyLibCalls/lit.local.cfg1
-rw-r--r--test/Transforms/Sink/basic.ll6
-rw-r--r--test/Transforms/Sink/lit.local.cfg1
-rw-r--r--test/Transforms/StripSymbols/2007-01-15-llvm.used.ll9
-rw-r--r--test/Transforms/StripSymbols/2010-06-30-StripDebug.ll20
-rw-r--r--test/Transforms/StripSymbols/2010-07-01-DeadDbgInfo.ll47
-rw-r--r--test/Transforms/StripSymbols/2010-08-25-crash.ll25
-rw-r--r--test/Transforms/StripSymbols/lit.local.cfg1
-rw-r--r--test/Transforms/StripSymbols/strip-dead-debug-info.ll58
-rw-r--r--test/Transforms/StructurizeCFG/branch-on-argument.ll47
-rw-r--r--test/Transforms/StructurizeCFG/loop-multiple-exits.ll50
-rw-r--r--test/Transforms/StructurizeCFG/no-branch-to-entry.ll31
-rw-r--r--test/Transforms/StructurizeCFG/switch.ll23
-rw-r--r--test/Transforms/TailCallElim/2010-06-26-MultipleReturnValues.ll2
-rw-r--r--test/Transforms/TailCallElim/accum_recursion.ll6
-rw-r--r--test/Transforms/TailCallElim/basic.ll145
-rw-r--r--test/Transforms/TailCallElim/dont-tce-tail-marked-call.ll13
-rw-r--r--test/Transforms/TailCallElim/inf-recursion.ll4
-rw-r--r--test/Transforms/TailCallElim/intervening-inst.ll18
-rw-r--r--test/Transforms/TailCallElim/lit.local.cfg1
-rw-r--r--test/Transforms/TailCallElim/move_alloca_for_tail_call.ll15
-rw-r--r--test/Transforms/TailCallElim/nocapture.ll25
-rw-r--r--test/Transforms/TailCallElim/return_constant.ll18
-rw-r--r--test/Transforms/TailCallElim/trivial_codegen_tailcall.ll11
-rw-r--r--test/Transforms/TailDup/X86/lit.local.cfg2
-rw-r--r--test/Transforms/TailDup/lit.local.cfg2
827 files changed, 21611 insertions, 4517 deletions
diff --git a/test/Transforms/ADCE/lit.local.cfg b/test/Transforms/ADCE/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/ADCE/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/ArgumentPromotion/lit.local.cfg b/test/Transforms/ArgumentPromotion/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/ArgumentPromotion/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/ArgumentPromotion/reserve-tbaa.ll b/test/Transforms/ArgumentPromotion/reserve-tbaa.ll
new file mode 100644
index 000000000000..4688a83f2425
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/reserve-tbaa.ll
@@ -0,0 +1,52 @@
+; RUN: opt < %s -argpromotion -S
+
+; PR17906
+; When we promote two arguments in a single function with different types,
+; before the fix, we used the same tag for the newly-created two loads.
+; This testing case makes sure that we correctly transfer the tbaa tags from the
+; original loads to the newly-created loads when promoting pointer arguments.
+
+@a = global i32* null, align 8
+@e = global i32** @a, align 8
+@g = global i32 0, align 4
+@c = global i64 0, align 8
+@d = global i8 0, align 1
+
+define internal fastcc void @fn(i32* nocapture readonly %p1, i64* nocapture readonly %p2) {
+entry:
+ %0 = load i64* %p2, align 8, !tbaa !1
+ %conv = trunc i64 %0 to i32
+ %1 = load i32* %p1, align 4, !tbaa !5
+ %conv1 = trunc i32 %1 to i8
+ store i8 %conv1, i8* @d, align 1, !tbaa !7
+ ret void
+}
+
+define i32 @main() {
+entry:
+; CHECK-LABEL: main
+; CHECK: store i32 1, i32* %{{.*}}, align 4, !tbaa ![[I32:[0-9]+]]
+; CHECK: %g.val = load i32* @g, align 4, !tbaa ![[I32]]
+; CHECK: %c.val = load i64* @c, align 8, !tbaa ![[LONG:[0-9]+]]
+ %0 = load i32*** @e, align 8, !tbaa !8
+ store i32* @g, i32** %0, align 8, !tbaa !8
+ %1 = load i32** @a, align 8, !tbaa !8
+ store i32 1, i32* %1, align 4, !tbaa !5
+ call fastcc void @fn(i32* @g, i64* @c)
+
+ ret i32 0
+}
+
+!1 = metadata !{metadata !2, metadata !2, i64 0}
+!2 = metadata !{metadata !"long", metadata !3, i64 0}
+!3 = metadata !{metadata !"omnipotent char", metadata !4, i64 0}
+!4 = metadata !{metadata !"Simple C/C++ TBAA"}
+!5 = metadata !{metadata !6, metadata !6, i64 0}
+!6 = metadata !{metadata !"int", metadata !3, i64 0}
+!7 = metadata !{metadata !3, metadata !3, i64 0}
+!8 = metadata !{metadata !9, metadata !9, i64 0}
+!9 = metadata !{metadata !"any pointer", metadata !3, i64 0}
+; CHECK: ![[I32]] = metadata !{metadata ![[I32_TYPE:[0-9]+]], metadata ![[I32_TYPE]], i64 0}
+; CHECK: ![[I32_TYPE]] = metadata !{metadata !"int", metadata !{{.*}}, i64 0}
+; CHECK: ![[LONG]] = metadata !{metadata ![[LONG_TYPE:[0-9]+]], metadata ![[LONG_TYPE]], i64 0}
+; CHECK: ![[LONG_TYPE]] = metadata !{metadata !"long", metadata !{{.*}}, i64 0}
diff --git a/test/Transforms/BBVectorize/X86/cmp-types.ll b/test/Transforms/BBVectorize/X86/cmp-types.ll
index a4fcbb6048f5..fc1da1b0c609 100644
--- a/test/Transforms/BBVectorize/X86/cmp-types.ll
+++ b/test/Transforms/BBVectorize/X86/cmp-types.ll
@@ -11,6 +11,6 @@ entry:
%tobool21 = icmp ne %"struct.btSoftBody"* %n2, null
%cond22 = zext i1 %tobool21 to i32
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
}
diff --git a/test/Transforms/BBVectorize/X86/loop1.ll b/test/Transforms/BBVectorize/X86/loop1.ll
index bbf565d1cc7f..401808441c26 100644
--- a/test/Transforms/BBVectorize/X86/loop1.ll
+++ b/test/Transforms/BBVectorize/X86/loop1.ll
@@ -7,8 +7,8 @@ target triple = "x86_64-unknown-linux-gnu"
define void @test1(double* noalias %out, double* noalias %in1, double* noalias %in2) nounwind uwtable {
entry:
br label %for.body
-; CHECK: @test1
-; CHECK-UNRL: @test1
+; CHECK-LABEL: @test1(
+; CHECK-UNRL-LABEL: @test1(
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
diff --git a/test/Transforms/BBVectorize/X86/pr15289.ll b/test/Transforms/BBVectorize/X86/pr15289.ll
index 07cc5d8b96b7..42bd0ff14032 100644
--- a/test/Transforms/BBVectorize/X86/pr15289.ll
+++ b/test/Transforms/BBVectorize/X86/pr15289.ll
@@ -45,7 +45,7 @@ entry:
%13 = fmul double %3, %12
%14 = fmul double %3, undef
%15 = getelementptr inbounds [5 x { double, double }]* %c2ten, i64 0, i64 0, i32 0
- store double %13, double* %15, align 8, !tbaa !0
+ store double %13, double* %15, align 8
%16 = getelementptr inbounds [5 x { double, double }]* %c2ten, i64 0, i64 0, i32 1
%17 = fmul double undef, %8
%18 = fmul double %17, undef
@@ -54,7 +54,7 @@ entry:
%21 = fmul double %3, %19
%22 = fsub double -0.000000e+00, %21
%23 = getelementptr inbounds [5 x { double, double }]* %c2ten, i64 0, i64 1, i32 0
- store double %22, double* %23, align 8, !tbaa !0
+ store double %22, double* %23, align 8
%24 = getelementptr inbounds [5 x { double, double }]* %c2ten, i64 0, i64 1, i32 1
%25 = fmul double undef, 0x3FE42F601A8C6794
%26 = fmul double undef, 2.000000e+00
@@ -62,7 +62,7 @@ entry:
%28 = fmul double %6, undef
%29 = fsub double undef, %28
%30 = getelementptr inbounds [5 x { double, double }]* %c2ten, i64 0, i64 2, i32 0
- store double undef, double* %30, align 8, !tbaa !0
+ store double undef, double* %30, align 8
%31 = getelementptr inbounds [5 x { double, double }]* %c2ten, i64 0, i64 2, i32 1
%32 = fmul double undef, %17
%33 = fmul double undef, %17
@@ -71,7 +71,7 @@ entry:
%36 = fsub double undef, %35
%37 = fmul double %3, %34
%38 = getelementptr inbounds [5 x { double, double }]* %c2ten, i64 0, i64 3, i32 0
- store double %37, double* %38, align 8, !tbaa !0
+ store double %37, double* %38, align 8
%39 = getelementptr inbounds [5 x { double, double }]* %c2ten, i64 0, i64 3, i32 1
%40 = fmul double undef, %8
%41 = fmul double undef, %40
@@ -79,20 +79,17 @@ entry:
%43 = fsub double undef, %42
%44 = fmul double %3, %43
%45 = getelementptr inbounds [5 x { double, double }]* %c2ten, i64 0, i64 4, i32 0
- store double %13, double* %45, align 8, !tbaa !0
+ store double %13, double* %45, align 8
%46 = getelementptr inbounds [5 x { double, double }]* %c2ten, i64 0, i64 4, i32 1
%47 = fsub double -0.000000e+00, %14
- store double %47, double* %16, align 8, !tbaa !0
- store double undef, double* %24, align 8, !tbaa !0
- store double -0.000000e+00, double* %31, align 8, !tbaa !0
- store double undef, double* %39, align 8, !tbaa !0
- store double undef, double* %46, align 8, !tbaa !0
+ store double %47, double* %16, align 8
+ store double undef, double* %24, align 8
+ store double -0.000000e+00, double* %31, align 8
+ store double undef, double* %39, align 8
+ store double undef, double* %46, align 8
ret void
}
attributes #0 = { nounwind uwtable }
attributes #1 = { nounwind readnone }
attributes #2 = { nounwind }
-
-!0 = metadata !{metadata !"alias set 17: real(kind=8)", metadata !1}
-!1 = metadata !{metadata !1}
diff --git a/test/Transforms/BBVectorize/X86/sh-rec.ll b/test/Transforms/BBVectorize/X86/sh-rec.ll
index 1e0492c2a8c2..ad75fc96d9f2 100644
--- a/test/Transforms/BBVectorize/X86/sh-rec.ll
+++ b/test/Transforms/BBVectorize/X86/sh-rec.ll
@@ -46,7 +46,7 @@ if.end10: ; preds = %entry
return: ; preds = %entry
ret void
-; CHECK: @ptoa
+; CHECK-LABEL: @ptoa(
}
declare noalias i8* @malloc() nounwind
diff --git a/test/Transforms/BBVectorize/X86/sh-rec2.ll b/test/Transforms/BBVectorize/X86/sh-rec2.ll
index ef2239932fa1..d65ac1cc12f1 100644
--- a/test/Transforms/BBVectorize/X86/sh-rec2.ll
+++ b/test/Transforms/BBVectorize/X86/sh-rec2.ll
@@ -77,7 +77,7 @@ entry:
%and390 = shl i8 %conv3898, 6
store i8 %and390, i8* %incdec.ptr387, align 1
unreachable
-; CHECK: @gsm_encode
+; CHECK-LABEL: @gsm_encode(
}
declare void @Gsm_Coder(%struct.gsm_state.2.8.14.15.16.17.19.22.23.25.26.28.29.31.32.33.35.36.37.38.40.41.42.44.45.47.48.50.52.53.54.56.57.58.59.60.61.62.63.66.73.83.84.89.90.91.92.93.94.95.96.99.100.101.102.103.104.106.107.114.116.121.122.129.130.135.136.137.138.139.140.141.142.143.144.147.148.149.158.159.160.161.164.165.166.167.168.169.172.179.181.182.183.188.195.200.201.202.203.204.205.208.209.210.212.213.214.215.222.223.225.226.230.231.232.233.234.235.236.237.238.239.240.241.242.243.244.352*, i16*, i16*, i16*, i16*, i16*, i16*, i16*)
diff --git a/test/Transforms/BBVectorize/X86/sh-rec3.ll b/test/Transforms/BBVectorize/X86/sh-rec3.ll
index fd2cc8bdd91c..ad880ed8895a 100644
--- a/test/Transforms/BBVectorize/X86/sh-rec3.ll
+++ b/test/Transforms/BBVectorize/X86/sh-rec3.ll
@@ -162,7 +162,7 @@ entry:
%conv365 = trunc i32 %or364 to i8
store i8 %conv365, i8* %incdec.ptr350, align 1
unreachable
-; CHECK: @gsm_encode
+; CHECK-LABEL: @gsm_encode(
}
declare void @Gsm_Coder(%struct.gsm_state.2.8.39.44.45.55.56.57.58.59.62.63.64.65.74.75.76.77.80.87.92.93.94.95.96.97.110.111.112.113.114.128.130.135.136.137.138.139.140.141.142.143.144.145.148.149.150.151.152.169.170.177.178.179.184.185.186.187.188.201.208.209.219.220.221.223.224.225.230.231.232.233.235.236.237.238.245.246.248.249.272.274.279.280.281.282.283.286.293.298.299.314.315.316.317.318.319.320.321.322.323.324.325.326.327.328.329.330.331.332.333.334.335.336.337.338.339.340.341.342.343.344.345.346.347.348.349.350.351.352.353.565*, i16*, i16*, i16*, i16*, i16*, i16*, i16*)
diff --git a/test/Transforms/BBVectorize/X86/sh-types.ll b/test/Transforms/BBVectorize/X86/sh-types.ll
index 0bcb714d5e65..fbff2fb86eb0 100644
--- a/test/Transforms/BBVectorize/X86/sh-types.ll
+++ b/test/Transforms/BBVectorize/X86/sh-types.ll
@@ -18,7 +18,7 @@ define <4 x float> @test7(<4 x float> %A1, <4 x float> %B1, double %C1, double %
%R = fmul <4 x float> %Y1, %Y2
ret <4 x float> %R
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NOT: <8 x float>
; CHECK: ret <4 x float>
}
diff --git a/test/Transforms/BBVectorize/X86/simple-int.ll b/test/Transforms/BBVectorize/X86/simple-int.ll
index f5dbe46b1480..7842ec85b6c8 100644
--- a/test/Transforms/BBVectorize/X86/simple-int.ll
+++ b/test/Transforms/BBVectorize/X86/simple-int.ll
@@ -16,7 +16,7 @@ define double @test1(double %A1, double %A2, double %B1, double %B2, double %C1,
%Z2 = fadd double %Y2, %B2
%R = fmul double %Z1, %Z2
ret double %R
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret double %R
}
@@ -30,7 +30,7 @@ define double @test1a(double %A1, double %A2, double %B1, double %B2, double %C1
%Z2 = fadd double %Y2, %B2
%R = fmul double %Z1, %Z2
ret double %R
-; CHECK: @test1a
+; CHECK-LABEL: @test1a(
; CHECK: ret double %R
}
@@ -44,7 +44,7 @@ define double @test2(double %A1, double %A2, double %B1, double %B2) {
%Z2 = fadd double %Y2, %B2
%R = fmul double %Z1, %Z2
ret double %R
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: ret double %R
}
@@ -58,7 +58,7 @@ define double @test3(double %A1, double %A2, double %B1, double %B2, i32 %P) {
%Z2 = fadd double %Y2, %B2
%R = fmul double %Z1, %Z2
ret double %R
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: ret double %R
}
@@ -73,7 +73,7 @@ define double @test4(double %A1, double %A2, double %B1, double %B2, i32 %P) {
%Z2 = fadd double %Y2, %B2
%R = fmul double %Z1, %Z2
ret double %R
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: ret double %R
}
diff --git a/test/Transforms/BBVectorize/X86/simple-ldstr.ll b/test/Transforms/BBVectorize/X86/simple-ldstr.ll
index 0124399bad9d..1abbc34b68ec 100644
--- a/test/Transforms/BBVectorize/X86/simple-ldstr.ll
+++ b/test/Transforms/BBVectorize/X86/simple-ldstr.ll
@@ -16,7 +16,7 @@ entry:
%arrayidx5 = getelementptr inbounds double* %c, i64 1
store double %mul5, double* %arrayidx5, align 8
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %i0.v.i0 = bitcast double* %a to <2 x double>*
; CHECK: %i1.v.i0 = bitcast double* %b to <2 x double>*
; CHECK: %i0 = load <2 x double>* %i0.v.i0, align 8
diff --git a/test/Transforms/BBVectorize/X86/simple.ll b/test/Transforms/BBVectorize/X86/simple.ll
index 8abfa5f8bd29..a11e3090f205 100644
--- a/test/Transforms/BBVectorize/X86/simple.ll
+++ b/test/Transforms/BBVectorize/X86/simple.ll
@@ -11,7 +11,7 @@ define double @test1(double %A1, double %A2, double %B1, double %B2) {
%Z2 = fadd double %Y2, %B2
%R = fmul double %Z1, %Z2
ret double %R
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: fsub <2 x double>
; CHECK: fmul <2 x double>
; CHECK: fadd <2 x double>
@@ -38,7 +38,7 @@ define double @test1a(double %A1, double %A2, double %B1, double %B2) {
%S2 = fadd double %W2, %Q2
%R = fmul double %S1, %S2
ret double %R
-; CHECK: @test1a
+; CHECK-LABEL: @test1a(
; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0
; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1
; CHECK: %X1.v.i0.1 = insertelement <2 x double> undef, double %A1, i32 0
@@ -66,7 +66,7 @@ define double @test2(double %A1, double %A2, double %B1, double %B2) {
%Z2 = fadd double %Y1, %B2
%R = fmul double %Z1, %Z2
ret double %R
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: insertelement
; CHECK: insertelement
; CHECK: insertelement
@@ -88,7 +88,7 @@ define double @test4(double %A1, double %A2, double %B1, double %B2) {
%W2 = fadd double %Y1, %Z2
%R = fmul double %Z1, %Z2
ret double %R
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: insertelement
; CHECK: insertelement
; CHECK: insertelement
@@ -113,7 +113,7 @@ define <8 x i8> @test6(<8 x i8> %A1, <8 x i8> %A2, <8 x i8> %B1, <8 x i8> %B2) {
%Q2 = shufflevector <8 x i8> %Z2, <8 x i8> %Z2, <8 x i32> <i32 6, i32 7, i32 0, i32 1, i32 2, i32 4, i32 4, i32 1>
%R = mul <8 x i8> %Q1, %Q2
ret <8 x i8> %R
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NOT: sub <16 x i8>
; CHECK: ret <8 x i8>
}
diff --git a/test/Transforms/BBVectorize/X86/vs-cast.ll b/test/Transforms/BBVectorize/X86/vs-cast.ll
index be3efca925b8..0c666b11976c 100644
--- a/test/Transforms/BBVectorize/X86/vs-cast.ll
+++ b/test/Transforms/BBVectorize/X86/vs-cast.ll
@@ -7,6 +7,6 @@ entry:
%0 = bitcast <2 x i64> undef to i128
%1 = bitcast <2 x i64> undef to i128
ret void
-; CHECK: @main
+; CHECK-LABEL: @main(
}
diff --git a/test/Transforms/BBVectorize/X86/wr-aliases.ll b/test/Transforms/BBVectorize/X86/wr-aliases.ll
new file mode 100644
index 000000000000..34b1d4e9cae3
--- /dev/null
+++ b/test/Transforms/BBVectorize/X86/wr-aliases.ll
@@ -0,0 +1,144 @@
+; RUN: opt -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7-avx -bb-vectorize -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-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+%class.QBezier.15 = type { double, double, double, double, double, double, double, double }
+
+; Function Attrs: nounwind
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #0
+
+; Function Attrs: uwtable
+declare fastcc void @_ZL12printQBezier7QBezier(%class.QBezier.15* byval nocapture readonly align 8) #1
+
+; Function Attrs: nounwind
+declare void @llvm.lifetime.start(i64, i8* nocapture) #0
+
+; Function Attrs: nounwind
+declare void @llvm.lifetime.end(i64, i8* nocapture) #0
+
+define void @main_arrayctor.cont([10 x %class.QBezier.15]* %beziers, %class.QBezier.15* %agg.tmp.i, %class.QBezier.15* %agg.tmp55.i, %class.QBezier.15* %agg.tmp56.i) {
+newFuncRoot:
+ br label %arrayctor.cont
+
+arrayctor.cont.ret.exitStub: ; preds = %arrayctor.cont
+ ret void
+
+; CHECK-LABEL: @main_arrayctor.cont
+; CHECK: <2 x double>
+; CHECK: @_ZL12printQBezier7QBezier
+; CHECK: store double %mul8.i, double* %x3.i, align 16
+; CHECK: load double* %x3.i, align 16
+; CHECK: ret
+
+arrayctor.cont: ; preds = %newFuncRoot
+ %ref.tmp.sroa.0.0.idx = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 0
+ store double 1.000000e+01, double* %ref.tmp.sroa.0.0.idx, align 16
+ %ref.tmp.sroa.2.0.idx1 = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 1
+ store double 2.000000e+01, double* %ref.tmp.sroa.2.0.idx1, align 8
+ %ref.tmp.sroa.3.0.idx2 = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 2
+ store double 3.000000e+01, double* %ref.tmp.sroa.3.0.idx2, align 16
+ %ref.tmp.sroa.4.0.idx3 = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 3
+ store double 4.000000e+01, double* %ref.tmp.sroa.4.0.idx3, align 8
+ %ref.tmp.sroa.5.0.idx4 = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 4
+ store double 5.000000e+01, double* %ref.tmp.sroa.5.0.idx4, align 16
+ %ref.tmp.sroa.6.0.idx5 = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 5
+ store double 6.000000e+01, double* %ref.tmp.sroa.6.0.idx5, align 8
+ %ref.tmp.sroa.7.0.idx6 = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 6
+ store double 7.000000e+01, double* %ref.tmp.sroa.7.0.idx6, align 16
+ %ref.tmp.sroa.8.0.idx7 = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 7
+ store double 8.000000e+01, double* %ref.tmp.sroa.8.0.idx7, align 8
+ %add.ptr = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 1
+ %v0 = bitcast %class.QBezier.15* %agg.tmp.i to i8*
+ call void @llvm.lifetime.start(i64 64, i8* %v0)
+ %v1 = bitcast %class.QBezier.15* %agg.tmp55.i to i8*
+ call void @llvm.lifetime.start(i64 64, i8* %v1)
+ %v2 = bitcast %class.QBezier.15* %agg.tmp56.i to i8*
+ call void @llvm.lifetime.start(i64 64, i8* %v2)
+ %v3 = bitcast [10 x %class.QBezier.15]* %beziers to i8*
+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* %v0, i8* %v3, i64 64, i32 8, i1 false)
+ call fastcc void @_ZL12printQBezier7QBezier(%class.QBezier.15* byval align 8 %agg.tmp.i)
+ %x2.i = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 2
+ %v4 = load double* %x2.i, align 16
+ %x3.i = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 4
+ %v5 = load double* %x3.i, align 16
+ %add.i = fadd double %v4, %v5
+ %mul.i = fmul double 5.000000e-01, %add.i
+ %x1.i = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 0
+ %v6 = load double* %x1.i, align 16
+ %add3.i = fadd double %v4, %v6
+ %mul4.i = fmul double 5.000000e-01, %add3.i
+ %x25.i = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 1, i32 2
+ store double %mul4.i, double* %x25.i, align 16
+ %v7 = load double* %x3.i, align 16
+ %x4.i = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 6
+ %v8 = load double* %x4.i, align 16
+ %add7.i = fadd double %v7, %v8
+ %mul8.i = fmul double 5.000000e-01, %add7.i
+ store double %mul8.i, double* %x3.i, align 16
+ %v9 = load double* %x1.i, align 16
+ %x111.i = getelementptr inbounds %class.QBezier.15* %add.ptr, i64 0, i32 0
+ store double %v9, double* %x111.i, align 16
+ %v10 = load double* %x25.i, align 16
+ %add15.i = fadd double %mul.i, %v10
+ %mul16.i = fmul double 5.000000e-01, %add15.i
+ %x317.i = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 1, i32 4
+ store double %mul16.i, double* %x317.i, align 16
+ %v11 = load double* %x3.i, align 16
+ %add19.i = fadd double %mul.i, %v11
+ %mul20.i = fmul double 5.000000e-01, %add19.i
+ store double %mul20.i, double* %x2.i, align 16
+ %v12 = load double* %x317.i, align 16
+ %add24.i = fadd double %v12, %mul20.i
+ %mul25.i = fmul double 5.000000e-01, %add24.i
+ store double %mul25.i, double* %x1.i, align 16
+ %x427.i = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 1, i32 6
+ store double %mul25.i, double* %x427.i, align 16
+ %y2.i = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 3
+ %v13 = load double* %y2.i, align 8
+ %y3.i = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 5
+ %v14 = load double* %y3.i, align 8
+ %add28.i = fadd double %v13, %v14
+ %div.i = fmul double 5.000000e-01, %add28.i
+ %y1.i = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 1
+ %v15 = load double* %y1.i, align 8
+ %add30.i = fadd double %v13, %v15
+ %mul31.i = fmul double 5.000000e-01, %add30.i
+ %y232.i = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 1, i32 3
+ store double %mul31.i, double* %y232.i, align 8
+ %v16 = load double* %y3.i, align 8
+ %y4.i = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 0, i32 7
+ %v17 = load double* %y4.i, align 8
+ %add34.i = fadd double %v16, %v17
+ %mul35.i = fmul double 5.000000e-01, %add34.i
+ store double %mul35.i, double* %y3.i, align 8
+ %v18 = load double* %y1.i, align 8
+ %y138.i = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 1, i32 1
+ store double %v18, double* %y138.i, align 8
+ %v19 = load double* %y232.i, align 8
+ %add42.i = fadd double %div.i, %v19
+ %mul43.i = fmul double 5.000000e-01, %add42.i
+ %y344.i = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 1, i32 5
+ store double %mul43.i, double* %y344.i, align 8
+ %v20 = load double* %y3.i, align 8
+ %add46.i = fadd double %div.i, %v20
+ %mul47.i = fmul double 5.000000e-01, %add46.i
+ store double %mul47.i, double* %y2.i, align 8
+ %v21 = load double* %y344.i, align 8
+ %add51.i = fadd double %v21, %mul47.i
+ %mul52.i = fmul double 5.000000e-01, %add51.i
+ store double %mul52.i, double* %y1.i, align 8
+ %y454.i = getelementptr inbounds [10 x %class.QBezier.15]* %beziers, i64 0, i64 1, i32 7
+ store double %mul52.i, double* %y454.i, align 8
+ %v22 = bitcast %class.QBezier.15* %add.ptr to i8*
+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* %v1, i8* %v22, i64 64, i32 8, i1 false)
+ call fastcc void @_ZL12printQBezier7QBezier(%class.QBezier.15* byval align 8 %agg.tmp55.i)
+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* %v2, i8* %v3, i64 64, i32 8, i1 false)
+ call fastcc void @_ZL12printQBezier7QBezier(%class.QBezier.15* byval align 8 %agg.tmp56.i)
+ call void @llvm.lifetime.end(i64 64, i8* %v0)
+ call void @llvm.lifetime.end(i64 64, i8* %v1)
+ call void @llvm.lifetime.end(i64 64, i8* %v2)
+ br label %arrayctor.cont.ret.exitStub
+}
+
+attributes #0 = { nounwind }
+attributes #1 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/test/Transforms/BBVectorize/cycle.ll b/test/Transforms/BBVectorize/cycle.ll
index bdcb30da887f..6bfa625ea5f0 100644
--- a/test/Transforms/BBVectorize/cycle.ll
+++ b/test/Transforms/BBVectorize/cycle.ll
@@ -105,7 +105,7 @@ go:
br i1 %or.cond, label %done, label %go
done:
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: go:
; CHECK: %conv.v.i0.1 = insertelement <2 x i32> undef, i32 %n.0, i32 0
; FIXME: When tree pruning is deterministic, include the entire output.
diff --git a/test/Transforms/BBVectorize/ld1.ll b/test/Transforms/BBVectorize/ld1.ll
index ea5cb5dd93f7..9c79eef05f7b 100644
--- a/test/Transforms/BBVectorize/ld1.ll
+++ b/test/Transforms/BBVectorize/ld1.ll
@@ -22,7 +22,7 @@ entry:
%add15 = fadd double %mul13, %i5
%mul16 = fmul double %add11, %add15
ret double %mul16
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %i0.v.i0 = bitcast double* %a to <2 x double>*
; CHECK: %i1.v.i0 = bitcast double* %b to <2 x double>*
; CHECK: %i2.v.i0 = bitcast double* %c to <2 x double>*
diff --git a/test/Transforms/BBVectorize/lit.local.cfg b/test/Transforms/BBVectorize/lit.local.cfg
index a8ad0f1a28b2..ba763cf03ffc 100644
--- a/test/Transforms/BBVectorize/lit.local.cfg
+++ b/test/Transforms/BBVectorize/lit.local.cfg
@@ -1,5 +1,3 @@
-config.suffixes = ['.ll', '.c', '.cpp']
-
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True
diff --git a/test/Transforms/BBVectorize/loop1.ll b/test/Transforms/BBVectorize/loop1.ll
index e592edb44a02..ed7be15f7adf 100644
--- a/test/Transforms/BBVectorize/loop1.ll
+++ b/test/Transforms/BBVectorize/loop1.ll
@@ -7,8 +7,8 @@ target triple = "x86_64-unknown-linux-gnu"
define void @test1(double* noalias %out, double* noalias %in1, double* noalias %in2) nounwind uwtable {
entry:
br label %for.body
-; CHECK: @test1
-; CHECK-UNRL: @test1
+; CHECK-LABEL: @test1(
+; CHECK-UNRL-LABEL: @test1(
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
diff --git a/test/Transforms/BBVectorize/mem-op-depth.ll b/test/Transforms/BBVectorize/mem-op-depth.ll
index 84f16bd2f47d..c31d4521183f 100644
--- a/test/Transforms/BBVectorize/mem-op-depth.ll
+++ b/test/Transforms/BBVectorize/mem-op-depth.ll
@@ -6,7 +6,7 @@ target triple = "x86_64-unknown-linux-gnu"
@B = common global [1024 x float] zeroinitializer, align 16
define i32 @test1() nounwind {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
%V1 = load float* getelementptr inbounds ([1024 x float]* @A, i64 0, i64 0), align 16
%V2 = load float* getelementptr inbounds ([1024 x float]* @A, i64 0, i64 1), align 4
%V3= load float* getelementptr inbounds ([1024 x float]* @A, i64 0, i64 2), align 8
diff --git a/test/Transforms/BBVectorize/metadata.ll b/test/Transforms/BBVectorize/metadata.ll
index 1e3aaa127a0e..ac7297dd5417 100644
--- a/test/Transforms/BBVectorize/metadata.ll
+++ b/test/Transforms/BBVectorize/metadata.ll
@@ -16,7 +16,7 @@ entry:
%arrayidx5 = getelementptr inbounds double* %c, i64 1
store double %mul5, double* %arrayidx5, align 8
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: !fpmath
; CHECK: ret void
}
@@ -36,7 +36,7 @@ entry:
%arrayidx5 = getelementptr inbounds i64* %c, i64 1
store i64 %mul5, i64* %arrayidx5, align 8
ret void
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NOT: !range
; CHECK: ret void
}
diff --git a/test/Transforms/BBVectorize/no-ldstr-conn.ll b/test/Transforms/BBVectorize/no-ldstr-conn.ll
index ada2a71e36ec..bcc5ce7531bd 100644
--- a/test/Transforms/BBVectorize/no-ldstr-conn.ll
+++ b/test/Transforms/BBVectorize/no-ldstr-conn.ll
@@ -17,7 +17,7 @@ entry:
store i64 %v3a, i64* %a3, align 8
%r = add i64 %v2, %v3
ret i64 %r
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NOT: getelementptr <2 x i64*>
}
diff --git a/test/Transforms/BBVectorize/req-depth.ll b/test/Transforms/BBVectorize/req-depth.ll
index e0120059b952..2675354183a6 100644
--- a/test/Transforms/BBVectorize/req-depth.ll
+++ b/test/Transforms/BBVectorize/req-depth.ll
@@ -9,8 +9,8 @@ define double @test1(double %A1, double %A2, double %B1, double %B2) {
%Y2 = fmul double %X2, %A2
%R = fmul double %Y1, %Y2
ret double %R
-; CHECK-RD3: @test1
-; CHECK-RD2: @test1
+; CHECK-RD3-LABEL: @test1(
+; CHECK-RD2-LABEL: @test1(
; CHECK-RD3-NOT: <2 x double>
; CHECK-RD2: <2 x double>
}
diff --git a/test/Transforms/BBVectorize/search-limit.ll b/test/Transforms/BBVectorize/search-limit.ll
index a694e45bc181..be38d3402603 100644
--- a/test/Transforms/BBVectorize/search-limit.ll
+++ b/test/Transforms/BBVectorize/search-limit.ll
@@ -3,8 +3,8 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3 -bb-vectorize-search-limit=4 -bb-vectorize-ignore-target-info -instcombine -gvn -S | FileCheck %s -check-prefix=CHECK-SL4
define double @test1(double %A1, double %A2, double %B1, double %B2) {
-; CHECK: @test1
-; CHECK-SL4: @test1
+; CHECK-LABEL: @test1(
+; CHECK-SL4-LABEL: @test1(
; CHECK-SL4-NOT: <2 x double>
; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0
; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1
diff --git a/test/Transforms/BBVectorize/simple-int.ll b/test/Transforms/BBVectorize/simple-int.ll
index e4d51526ca11..e33ac612edc2 100644
--- a/test/Transforms/BBVectorize/simple-int.ll
+++ b/test/Transforms/BBVectorize/simple-int.ll
@@ -16,7 +16,7 @@ define double @test1(double %A1, double %A2, double %B1, double %B2, double %C1,
%Z2 = fadd double %Y2, %B2
%R = fmul double %Z1, %Z2
ret double %R
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0
; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1
; CHECK: %X1.v.i0.1 = insertelement <2 x double> undef, double %A1, i32 0
@@ -42,7 +42,7 @@ define double @test1a(double %A1, double %A2, double %B1, double %B2, double %C1
%Z2 = fadd double %Y2, %B2
%R = fmul double %Z1, %Z2
ret double %R
-; CHECK: @test1a
+; CHECK-LABEL: @test1a(
; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0
; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1
; CHECK: %X1.v.i0.1 = insertelement <2 x double> undef, double %A1, i32 0
@@ -68,7 +68,7 @@ define double @test2(double %A1, double %A2, double %B1, double %B2) {
%Z2 = fadd double %Y2, %B2
%R = fmul double %Z1, %Z2
ret double %R
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0
; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1
; CHECK: %X1.v.i0.1 = insertelement <2 x double> undef, double %A1, i32 0
@@ -93,7 +93,7 @@ define double @test3(double %A1, double %A2, double %B1, double %B2, i32 %P) {
%Z2 = fadd double %Y2, %B2
%R = fmul double %Z1, %Z2
ret double %R
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0
; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1
; CHECK: %X1.v.i0.1 = insertelement <2 x double> undef, double %A1, i32 0
@@ -119,7 +119,7 @@ define double @test4(double %A1, double %A2, double %B1, double %B2, i32 %P) {
%Z2 = fadd double %Y2, %B2
%R = fmul double %Z1, %Z2
ret double %R
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NOT: <2 x double>
; CHECK: ret double %R
}
diff --git a/test/Transforms/BBVectorize/simple-ldstr-ptrs.ll b/test/Transforms/BBVectorize/simple-ldstr-ptrs.ll
index d46f7692b6d3..4d2298c1a11d 100644
--- a/test/Transforms/BBVectorize/simple-ldstr-ptrs.ll
+++ b/test/Transforms/BBVectorize/simple-ldstr-ptrs.ll
@@ -27,7 +27,7 @@ entry:
%arrayidx5 = getelementptr inbounds i64* %c, i64 1
store i64 %mul5, i64* %arrayidx5, align 8
ret double %r
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %i0.v.i0 = bitcast i64* %a to <2 x i64>*
; CHECK: %i1.v.i0 = bitcast i64* %b to <2 x i64>*
; CHECK: %i0 = load <2 x i64>* %i0.v.i0, align 8
@@ -43,7 +43,7 @@ entry:
; CHECK: %0 = bitcast i64* %c to <2 x i64>*
; CHECK: store <2 x i64> %mul, <2 x i64>* %0, align 8
; CHECK: ret double %r
-; CHECK-AO: @test1
+; CHECK-AO-LABEL: @test1(
; CHECK-AO-NOT: load <2 x
}
@@ -64,7 +64,7 @@ entry:
%arrayidx5 = getelementptr inbounds i64** %c, i64 1
store i64* %ptr3, i64** %arrayidx5, align 8
ret void
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: %i0.v.i0 = bitcast i64** %a to <2 x i64*>*
; CHECK: %i1 = load i64** %b, align 8
; CHECK: %i0 = load <2 x i64*>* %i0.v.i0, align 8
@@ -78,7 +78,7 @@ entry:
; CHECK: %0 = bitcast i64** %c to <2 x i64*>*
; CHECK: store <2 x i64*> %ptr0, <2 x i64*>* %0, align 8
; CHECK: ret void
-; CHECK-AO: @test2
+; CHECK-AO-LABEL: @test2(
; CHECK-AO-NOT: <2 x
}
@@ -108,7 +108,7 @@ entry:
%arrayidx5 = getelementptr inbounds <2 x i64*>* %c, i64 1
store <2 x i64*> %rtr3, <2 x i64*>* %arrayidx5, align 8
ret void
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: %i0.v.i0 = bitcast <2 x i64*>* %a to <4 x i64*>*
; CHECK: %i1 = load <2 x i64*>* %b, align 8
; CHECK: %i0 = load <4 x i64*>* %i0.v.i0, align 8
@@ -128,7 +128,7 @@ entry:
; CHECK: %1 = shufflevector <2 x i64*> %rtr0, <2 x i64*> %rtr3, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
; CHECK: store <4 x i64*> %1, <4 x i64*>* %0, align 8
; CHECK: ret void
-; CHECK-AO: @test3
+; CHECK-AO-LABEL: @test3(
; CHECK-AO-NOT: <4 x
}
diff --git a/test/Transforms/BBVectorize/simple-ldstr.ll b/test/Transforms/BBVectorize/simple-ldstr.ll
index 8e51d297e8ec..558f8b38d794 100644
--- a/test/Transforms/BBVectorize/simple-ldstr.ll
+++ b/test/Transforms/BBVectorize/simple-ldstr.ll
@@ -17,7 +17,7 @@ entry:
%arrayidx5 = getelementptr inbounds double* %c, i64 1
store double %mul5, double* %arrayidx5, align 8
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %i0.v.i0 = bitcast double* %a to <2 x double>*
; CHECK: %i1.v.i0 = bitcast double* %b to <2 x double>*
; CHECK: %i0 = load <2 x double>* %i0.v.i0, align 8
@@ -26,7 +26,7 @@ entry:
; CHECK: %0 = bitcast double* %c to <2 x double>*
; CHECK: store <2 x double> %mul, <2 x double>* %0, align 8
; CHECK: ret void
-; CHECK-AO: @test1
+; CHECK-AO-LABEL: @test1(
; CHECK-AO-NOT: <2 x double>
}
@@ -49,7 +49,7 @@ entry:
%arrayidx5 = getelementptr inbounds double* %c, i64 1
store double %mul5, double* %arrayidx5, align 8
ret void
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: %i0f.v.i0 = bitcast float* %a to <2 x float>*
; CHECK: %i1f.v.i0 = bitcast float* %b to <2 x float>*
; CHECK: %i0f = load <2 x float>* %i0f.v.i0, align 4
@@ -60,7 +60,7 @@ entry:
; CHECK: %0 = bitcast double* %c to <2 x double>*
; CHECK: store <2 x double> %mul, <2 x double>* %0, align 8
; CHECK: ret void
-; CHECK-AO: @test2
+; CHECK-AO-LABEL: @test2(
; CHECK-AO-NOT: <2 x double>
}
@@ -81,7 +81,7 @@ entry:
%arrayidx5 = getelementptr inbounds float* %c, i64 1
store float %mul5f, float* %arrayidx5, align 4
ret void
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: %i0.v.i0 = bitcast double* %a to <2 x double>*
; CHECK: %i1.v.i0 = bitcast double* %b to <2 x double>*
; CHECK: %i0 = load <2 x double>* %i0.v.i0, align 8
@@ -91,7 +91,7 @@ entry:
; CHECK: %0 = bitcast float* %c to <2 x float>*
; CHECK: store <2 x float> %mulf, <2 x float>* %0, align 8
; CHECK: ret void
-; CHECK-AO: @test3
+; CHECK-AO-LABEL: @test3(
; CHECK-AO: %i0 = load double* %a, align 8
; CHECK-AO: %i1 = load double* %b, align 8
; CHECK-AO: %arrayidx3 = getelementptr inbounds double* %a, i64 1
@@ -134,9 +134,9 @@ if.then:
if.end:
ret void
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NOT: <2 x double>
-; CHECK-AO: @test4
+; CHECK-AO-LABEL: @test4(
; CHECK-AO-NOT: <2 x double>
}
@@ -155,7 +155,7 @@ entry:
store double %mul5, double* %arrayidx5, align 8
store double %mul, double* %c, align 4
ret void
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: %i0.v.i0 = bitcast double* %a to <2 x double>*
; CHECK: %i1.v.i0 = bitcast double* %b to <2 x double>*
; CHECK: %i0 = load <2 x double>* %i0.v.i0, align 8
@@ -164,7 +164,7 @@ entry:
; CHECK: %0 = bitcast double* %c to <2 x double>*
; CHECK: store <2 x double> %mul, <2 x double>* %0, align 4
; CHECK: ret void
-; CHECK-AO: @test5
+; CHECK-AO-LABEL: @test5(
; CHECK-AO-NOT: <2 x double>
}
diff --git a/test/Transforms/BBVectorize/simple-sel.ll b/test/Transforms/BBVectorize/simple-sel.ll
index 8caccfd32c34..269b07f82d19 100644
--- a/test/Transforms/BBVectorize/simple-sel.ll
+++ b/test/Transforms/BBVectorize/simple-sel.ll
@@ -4,7 +4,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; Basic depth-3 chain with select
define double @test1(double %A1, double %A2, double %B1, double %B2, i1 %C1, i1 %C2) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0
; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1
; CHECK: %X1.v.i0.1 = insertelement <2 x double> undef, double %A1, i32 0
@@ -30,8 +30,8 @@ define double @test1(double %A1, double %A2, double %B1, double %B2, i1 %C1, i1
; 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-LABEL: @test2(
+; CHECK-NB-LABEL: @test2(
; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0
; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1
; CHECK: %X1.v.i0.1 = insertelement <2 x double> undef, double %A1, i32 0
diff --git a/test/Transforms/BBVectorize/simple-tst.ll b/test/Transforms/BBVectorize/simple-tst.ll
index 42146c6d14a2..6a88e1b09c1b 100644
--- a/test/Transforms/BBVectorize/simple-tst.ll
+++ b/test/Transforms/BBVectorize/simple-tst.ll
@@ -4,7 +4,7 @@ target triple = "powerpc64-unknown-linux"
; 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-LABEL: @test7(
; CHECK-NOT: <2 x ppc_fp128>
%X1 = fsub ppc_fp128 %A1, %B1
%X2 = fsub ppc_fp128 %A2, %B2
diff --git a/test/Transforms/BBVectorize/simple.ll b/test/Transforms/BBVectorize/simple.ll
index a447908d16cc..0fe33f17a646 100644
--- a/test/Transforms/BBVectorize/simple.ll
+++ b/test/Transforms/BBVectorize/simple.ll
@@ -3,7 +3,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; Basic depth-3 chain
define double @test1(double %A1, double %A2, double %B1, double %B2) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0
; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1
; CHECK: %X1.v.i0.1 = insertelement <2 x double> undef, double %A1, i32 0
@@ -27,7 +27,7 @@ define double @test1(double %A1, double %A2, double %B1, double %B2) {
; Basic depth-3 chain (last pair permuted)
define double @test2(double %A1, double %A2, double %B1, double %B2) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0
; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1
; CHECK: %X1.v.i0.1 = insertelement <2 x double> undef, double %A1, i32 0
@@ -53,7 +53,7 @@ define double @test2(double %A1, double %A2, double %B1, double %B2) {
; Basic depth-3 chain (last pair first splat)
define double @test3(double %A1, double %A2, double %B1, double %B2) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0
; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1
; CHECK: %X1.v.i0.1 = insertelement <2 x double> undef, double %A1, i32 0
@@ -78,7 +78,7 @@ define double @test3(double %A1, double %A2, double %B1, double %B2) {
; Basic depth-3 chain (last pair second splat)
define double @test4(double %A1, double %A2, double %B1, double %B2) {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0
; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1
; CHECK: %X1.v.i0.1 = insertelement <2 x double> undef, double %A1, i32 0
@@ -103,7 +103,7 @@ define double @test4(double %A1, double %A2, double %B1, double %B2) {
; Basic depth-3 chain
define <2 x float> @test5(<2 x float> %A1, <2 x float> %A2, <2 x float> %B1, <2 x float> %B2) {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: %X1.v.i1 = shufflevector <2 x float> %B1, <2 x float> %B2, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
; CHECK: %X1.v.i0 = shufflevector <2 x float> %A1, <2 x float> %A2, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
%X1 = fsub <2 x float> %A1, %B1
@@ -125,7 +125,7 @@ define <2 x float> @test5(<2 x float> %A1, <2 x float> %A2, <2 x float> %B1, <2
; Basic chain with shuffles
define <8 x i8> @test6(<8 x i8> %A1, <8 x i8> %A2, <8 x i8> %B1, <8 x i8> %B2) {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: %X1.v.i1 = shufflevector <8 x i8> %B1, <8 x i8> %B2, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
; CHECK: %X1.v.i0 = shufflevector <8 x i8> %A1, <8 x i8> %A2, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
%X1 = sub <8 x i8> %A1, %B1
@@ -151,7 +151,7 @@ define <8 x i8> @test6(<8 x i8> %A1, <8 x i8> %A2, <8 x i8> %B1, <8 x i8> %B2) {
; Basic depth-3 chain (flipped order)
define double @test7(double %A1, double %A2, double %B1, double %B2) {
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0
; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1
; CHECK: %X1.v.i0.1 = insertelement <2 x double> undef, double %A1, i32 0
@@ -175,7 +175,7 @@ define double @test7(double %A1, double %A2, double %B1, double %B2) {
; Basic depth-3 chain (subclass data)
define i64 @test8(i64 %A1, i64 %A2, i64 %B1, i64 %B2) {
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: %X1.v.i1.1 = insertelement <2 x i64> undef, i64 %B1, i32 0
; CHECK: %X1.v.i1.2 = insertelement <2 x i64> %X1.v.i1.1, i64 %B2, i32 1
; CHECK: %X1.v.i0.1 = insertelement <2 x i64> undef, i64 %A1, i32 0
diff --git a/test/Transforms/BBVectorize/simple3.ll b/test/Transforms/BBVectorize/simple3.ll
index 78bcc9f83080..6edf7f07ac1d 100644
--- a/test/Transforms/BBVectorize/simple3.ll
+++ b/test/Transforms/BBVectorize/simple3.ll
@@ -3,7 +3,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; Basic depth-3 chain
define double @test1(double %A1, double %A2, double %A3, double %B1, double %B2, double %B3) {
-; CHECK: @test1
+; CHECK-LABEL: @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
diff --git a/test/Transforms/BBVectorize/xcore/no-vector-registers.ll b/test/Transforms/BBVectorize/xcore/no-vector-registers.ll
new file mode 100644
index 000000000000..9ebdb7368a35
--- /dev/null
+++ b/test/Transforms/BBVectorize/xcore/no-vector-registers.ll
@@ -0,0 +1,18 @@
+; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3 -instcombine -gvn -S -mtriple=xcore | FileCheck %s
+
+target datalayout = "e-p:32:32:32-a0:0:32-n32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f16:16:32-f32:32:32-f64:32:32"
+target triple = "xcore"
+
+; Basic depth-3 chain
+define double @test1(double %A1, double %A2, double %B1, double %B2) {
+; CHECK-LABEL: @test1(
+; CHECK-NOT: <2 x double>
+ %X1 = fsub double %A1, %B1
+ %X2 = fsub double %A2, %B2
+ %Y1 = fmul double %X1, %A1
+ %Y2 = fmul double %X2, %A2
+ %Z1 = fadd double %Y1, %B1
+ %Z2 = fadd double %Y2, %B2
+ %R = fmul double %Z1, %Z2
+ ret double %R
+}
diff --git a/test/Transforms/BlockPlacement/basictest.ll b/test/Transforms/BlockPlacement/basictest.ll
deleted file mode 100644
index 47b507903bce..000000000000
--- a/test/Transforms/BlockPlacement/basictest.ll
+++ /dev/null
@@ -1,15 +0,0 @@
-; RUN: opt < %s -block-placement -disable-output -print-function 2> /dev/null
-
-define i32 @test() {
- br i1 true, label %X, label %Y
-
-A: ; preds = %Y, %X
- ret i32 0
-
-X: ; preds = %0
- br label %A
-
-Y: ; preds = %0
- br label %A
-}
-
diff --git a/test/Transforms/BlockPlacement/lit.local.cfg b/test/Transforms/BlockPlacement/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/BlockPlacement/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/CodeExtractor/lit.local.cfg b/test/Transforms/CodeExtractor/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/CodeExtractor/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/CodeGenPrepare/basic.ll b/test/Transforms/CodeGenPrepare/basic.ll
index d617e43be865..495d910b5cd6 100644
--- a/test/Transforms/CodeGenPrepare/basic.ll
+++ b/test/Transforms/CodeGenPrepare/basic.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-darwin10.0.0"
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; objectsize should fold to a constant, which causes the branch to fold to an
; uncond branch. Next, we fold the control flow alltogether.
; rdar://8785296
diff --git a/test/Transforms/CodeGenPrepare/lit.local.cfg b/test/Transforms/CodeGenPrepare/lit.local.cfg
deleted file mode 100644
index c6106e4746f2..000000000000
--- a/test/Transforms/CodeGenPrepare/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll']
diff --git a/test/Transforms/ConstProp/basictest.ll b/test/Transforms/ConstProp/basictest.ll
index 09e6e7db437a..afe6ef91240d 100644
--- a/test/Transforms/ConstProp/basictest.ll
+++ b/test/Transforms/ConstProp/basictest.ll
@@ -16,7 +16,7 @@ BB2:
br label %BB3
BB3:
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %Ret = phi i32 [ 0, %BB1 ], [ 1, %BB2 ]
%Ret = phi i32 [ %Val, %BB1 ], [ 1, %BB2 ]
ret i32 %Ret
@@ -31,12 +31,12 @@ entry:
bb:
ret i1 %V
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: ret i1 true
}
define i1 @TNAN() {
-; CHECK: @TNAN
+; CHECK-LABEL: @TNAN(
; CHECK: ret i1 true
%A = fcmp uno double 0x7FF8000000000000, 1.000000e+00
%B = fcmp uno double 1.230000e+02, 1.000000e+00
@@ -47,7 +47,7 @@ define i1 @TNAN() {
define i128 @vector_to_int_cast() {
%A = bitcast <4 x i32> <i32 1073741824, i32 1073741824, i32 1073741824, i32 1073741824> to i128
ret i128 %A
-; CHECK: @vector_to_int_cast
+; CHECK-LABEL: @vector_to_int_cast(
; CHECK: ret i128 85070591750041656499021422275829170176
}
- \ No newline at end of file
+
diff --git a/test/Transforms/ConstProp/bitcast.ll b/test/Transforms/ConstProp/bitcast.ll
index 53239c7e4fe0..5e1581d801c7 100644
--- a/test/Transforms/ConstProp/bitcast.ll
+++ b/test/Transforms/ConstProp/bitcast.ll
@@ -4,7 +4,7 @@
define <1 x i64> @test1() {
%A = bitcast i64 63 to <1 x i64>
ret <1 x i64> %A
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret <1 x i64> <i64 63>
}
diff --git a/test/Transforms/ConstProp/bswap.ll b/test/Transforms/ConstProp/bswap.ll
index a68fdcd4581e..f601deb73db2 100644
--- a/test/Transforms/ConstProp/bswap.ll
+++ b/test/Transforms/ConstProp/bswap.ll
@@ -10,28 +10,28 @@ declare i64 @llvm.bswap.i64(i64)
declare i80 @llvm.bswap.i80(i80)
-; CHECK: define i16 @W
+; CHECK-LABEL: define i16 @W(
define i16 @W() {
; CHECK: ret i16 256
%Z = call i16 @llvm.bswap.i16( i16 1 ) ; <i16> [#uses=1]
ret i16 %Z
}
-; CHECK: define i32 @X
+; CHECK-LABEL: define i32 @X(
define i32 @X() {
; CHECK: ret i32 16777216
%Z = call i32 @llvm.bswap.i32( i32 1 ) ; <i32> [#uses=1]
ret i32 %Z
}
-; CHECK: define i64 @Y
+; CHECK-LABEL: define i64 @Y(
define i64 @Y() {
; CHECK: ret i64 72057594037927936
%Z = call i64 @llvm.bswap.i64( i64 1 ) ; <i64> [#uses=1]
ret i64 %Z
}
-; CHECK: define i80 @Z
+; CHECK-LABEL: define i80 @Z(
define i80 @Z() {
; CHECK: ret i80 -450681596205739728166896
; 0xA0908070605040302010
diff --git a/test/Transforms/ConstProp/calls.ll b/test/Transforms/ConstProp/calls.ll
index 7a405a539c51..7541418b06ec 100644
--- a/test/Transforms/ConstProp/calls.ll
+++ b/test/Transforms/ConstProp/calls.ll
@@ -11,7 +11,7 @@ declare double @sqrt(double)
declare double @exp2(double)
define double @T() {
-; CHECK: @T
+; CHECK-LABEL: @T(
; CHECK-NOT: call
; CHECK: ret
%A = call double @cos(double 0.000000e+00)
@@ -29,7 +29,7 @@ define double @T() {
}
define i1 @test_sse_cvt() nounwind readnone {
-; CHECK: @test_sse_cvt
+; CHECK-LABEL: @test_sse_cvt(
; CHECK-NOT: call
; CHECK: ret i1 true
entry:
@@ -63,7 +63,7 @@ declare i64 @llvm.x86.sse2.cvttsd2si64(<2 x double>) nounwind readnone
define double @test_intrinsic_pow() nounwind uwtable ssp {
entry:
-; CHECK: @test_intrinsic_pow
+; CHECK-LABEL: @test_intrinsic_pow(
; CHECK-NOT: call
%0 = call double @llvm.pow.f64(double 1.500000e+00, double 3.000000e+00)
ret double %0
@@ -72,7 +72,7 @@ declare double @llvm.pow.f64(double, double) nounwind readonly
; Shouldn't fold because of -fno-builtin
define double @sin_() nounwind uwtable ssp {
-; FNOBUILTIN: @sin_
+; FNOBUILTIN-LABEL: @sin_(
; FNOBUILTIN: %1 = call double @sin(double 3.000000e+00)
%1 = call double @sin(double 3.000000e+00)
ret double %1
@@ -80,7 +80,7 @@ define double @sin_() nounwind uwtable ssp {
; Shouldn't fold because of -fno-builtin
define double @sqrt_() nounwind uwtable ssp {
-; FNOBUILTIN: @sqrt_
+; FNOBUILTIN-LABEL: @sqrt_(
; FNOBUILTIN: %1 = call double @sqrt(double 3.000000e+00)
%1 = call double @sqrt(double 3.000000e+00)
ret double %1
@@ -88,7 +88,7 @@ define double @sqrt_() nounwind uwtable ssp {
; Shouldn't fold because of -fno-builtin
define float @sqrtf_() nounwind uwtable ssp {
-; FNOBUILTIN: @sqrtf_
+; FNOBUILTIN-LABEL: @sqrtf_(
; FNOBUILTIN: %1 = call float @sqrtf(float 3.000000e+00)
%1 = call float @sqrtf(float 3.000000e+00)
ret float %1
@@ -97,7 +97,7 @@ declare float @sqrtf(float)
; Shouldn't fold because of -fno-builtin
define float @sinf_() nounwind uwtable ssp {
-; FNOBUILTIN: @sinf_
+; FNOBUILTIN-LABEL: @sinf_(
; FNOBUILTIN: %1 = call float @sinf(float 3.000000e+00)
%1 = call float @sinf(float 3.000000e+00)
ret float %1
@@ -106,7 +106,7 @@ declare float @sinf(float)
; Shouldn't fold because of -fno-builtin
define double @tan_() nounwind uwtable ssp {
-; FNOBUILTIN: @tan_
+; FNOBUILTIN-LABEL: @tan_(
; FNOBUILTIN: %1 = call double @tan(double 3.000000e+00)
%1 = call double @tan(double 3.000000e+00)
ret double %1
@@ -114,7 +114,7 @@ define double @tan_() nounwind uwtable ssp {
; Shouldn't fold because of -fno-builtin
define double @tanh_() nounwind uwtable ssp {
-; FNOBUILTIN: @tanh_
+; FNOBUILTIN-LABEL: @tanh_(
; FNOBUILTIN: %1 = call double @tanh(double 3.000000e+00)
%1 = call double @tanh(double 3.000000e+00)
ret double %1
@@ -123,7 +123,7 @@ declare double @tanh(double)
; Shouldn't fold because of -fno-builtin
define double @pow_() nounwind uwtable ssp {
-; FNOBUILTIN: @pow_
+; FNOBUILTIN-LABEL: @pow_(
; FNOBUILTIN: %1 = call double @pow(double 3.000000e+00, double 3.000000e+00)
%1 = call double @pow(double 3.000000e+00, double 3.000000e+00)
ret double %1
@@ -132,7 +132,7 @@ declare double @pow(double, double)
; Shouldn't fold because of -fno-builtin
define double @fmod_() nounwind uwtable ssp {
-; FNOBUILTIN: @fmod_
+; FNOBUILTIN-LABEL: @fmod_(
; FNOBUILTIN: %1 = call double @fmod(double 3.000000e+00, double 3.000000e+00)
%1 = call double @fmod(double 3.000000e+00, double 3.000000e+00)
ret double %1
@@ -141,7 +141,7 @@ declare double @fmod(double, double)
; Shouldn't fold because of -fno-builtin
define double @atan2_() nounwind uwtable ssp {
-; FNOBUILTIN: @atan2_
+; FNOBUILTIN-LABEL: @atan2_(
; FNOBUILTIN: %1 = call double @atan2(double 3.000000e+00, double 3.000000e+00)
%1 = call double @atan2(double 3.000000e+00, double 3.000000e+00)
ret double %1
diff --git a/test/Transforms/ConstProp/extractvalue.ll b/test/Transforms/ConstProp/extractvalue.ll
index f947b22f23ae..72d6cb714a54 100644
--- a/test/Transforms/ConstProp/extractvalue.ll
+++ b/test/Transforms/ConstProp/extractvalue.ll
@@ -5,21 +5,21 @@
define i32 @test1() {
%A = extractvalue %struct { i32 2, [4 x i8] c"foo\00" }, 0
ret i32 %A
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret i32 2
}
define i8 @test2() {
%A = extractvalue %struct { i32 2, [4 x i8] c"foo\00" }, 1, 2
ret i8 %A
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: ret i8 111
}
define i32 @test3() {
%A = extractvalue [3 x %struct] [ %struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" } ], 1, 0
ret i32 %A
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: ret i32 1
}
diff --git a/test/Transforms/ConstProp/insertvalue.ll b/test/Transforms/ConstProp/insertvalue.ll
index a4b7bb1019c2..0d288b3841df 100644
--- a/test/Transforms/ConstProp/insertvalue.ll
+++ b/test/Transforms/ConstProp/insertvalue.ll
@@ -5,21 +5,21 @@
define %struct @test1() {
%A = insertvalue %struct { i32 2, [4 x i8] c"foo\00" }, i32 1, 0
ret %struct %A
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret %struct { i32 1, [4 x i8] c"foo\00" }
}
define %struct @test2() {
%A = insertvalue %struct { i32 2, [4 x i8] c"foo\00" }, i8 1, 1, 2
ret %struct %A
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: ret %struct { i32 2, [4 x i8] c"fo\01\00" }
}
define [3 x %struct] @test3() {
%A = insertvalue [3 x %struct] [ %struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" } ], i32 -1, 1, 0
ret [3 x %struct] %A
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK:ret [3 x %struct] [%struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 -1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" }]
}
diff --git a/test/Transforms/ConstProp/lit.local.cfg b/test/Transforms/ConstProp/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/ConstProp/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/ConstProp/loads.ll b/test/Transforms/ConstProp/loads.ll
index 6794288a0ef2..d05db47dcaaa 100644
--- a/test/Transforms/ConstProp/loads.ll
+++ b/test/Transforms/ConstProp/loads.ll
@@ -1,5 +1,5 @@
-; RUN: opt < %s -default-data-layout="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" -instcombine -S | FileCheck %s --check-prefix=LE
-; RUN: opt < %s -default-data-layout="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" -instcombine -S | FileCheck %s --check-prefix=BE
+; RUN: opt < %s -default-data-layout="e-p:64:64:64-p1:16:16:16-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" -instcombine -S | FileCheck %s --check-prefix=LE
+; RUN: opt < %s -default-data-layout="E-p:64:64:64-p1:16:16:16-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" -instcombine -S | FileCheck %s --check-prefix=BE
; {{ 0xDEADBEEF, 0xBA }, 0xCAFEBABE}
@g1 = constant {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }
@@ -13,11 +13,11 @@ define i32 @test1() {
ret i32 %r
; 0xDEADBEEF
-; LE: @test1
+; LE-LABEL: @test1(
; LE: ret i32 -559038737
; 0xDEADBEEF
-; BE: @test1
+; BE-LABEL: @test1(
; BE: ret i32 -559038737
}
@@ -28,11 +28,11 @@ define i16 @test2() {
ret i16 %r
; 0xBEEF
-; LE: @test2
+; LE-LABEL: @test2(
; LE: ret i16 -16657
; 0xDEAD
-; BE: @test2
+; BE-LABEL: @test2(
; BE: ret i16 -8531
}
@@ -42,11 +42,11 @@ define i16 @test3() {
ret i16 %r
; 0xDEAD
-; LE: @test3
+; LE-LABEL: @test3(
; LE: ret i16 -8531
; 0xBEEF
-; BE: @test3
+; BE-LABEL: @test3(
; BE: ret i16 -16657
}
@@ -56,11 +56,11 @@ define i16 @test4() {
ret i16 %r
; 0x00BA
-; LE: @test4
+; LE-LABEL: @test4(
; LE: ret i16 186
; 0xBA00
-; BE: @test4
+; BE-LABEL: @test4(
; BE: ret i16 -17920
}
@@ -70,11 +70,11 @@ define i64 @test6() {
ret i64 %r
; 0x3FF_0000000000000
-; LE: @test6
+; LE-LABEL: @test6(
; LE: ret i64 4607182418800017408
; 0x3FF_0000000000000
-; BE: @test6
+; BE-LABEL: @test6(
; BE: ret i64 4607182418800017408
}
@@ -84,11 +84,11 @@ define i16 @test7() {
ret i16 %r
; 0x0000
-; LE: @test7
+; LE-LABEL: @test7(
; LE: ret i16 0
; 0x3FF0
-; BE: @test7
+; BE-LABEL: @test7(
; BE: ret i16 16368
}
@@ -97,10 +97,10 @@ define double @test8() {
%r = load double* bitcast({{i32,i8},i32}* @g1 to double*)
ret double %r
-; LE: @test8
+; LE-LABEL: @test8(
; LE: ret double 0xBADEADBEEF
-; BE: @test8
+; BE-LABEL: @test8(
; BE: ret double 0xDEADBEEFBA000000
}
@@ -111,11 +111,11 @@ define i128 @test9() {
ret i128 %r
; 0x00000000_06B1BFF8_00000000_0000007B
-; LE: @test9
+; LE-LABEL: @test9(
; LE: ret i128 2071796475790618158476296315
; 0x00000000_0000007B_00000000_06B1BFF8
-; BE: @test9
+; BE-LABEL: @test9(
; BE: ret i128 2268949521066387161080
}
@@ -124,10 +124,10 @@ define <2 x i64> @test10() {
%r = load <2 x i64>* bitcast({i64, i64}* @g3 to <2 x i64>*)
ret <2 x i64> %r
-; LE: @test10
+; LE-LABEL: @test10(
; LE: ret <2 x i64> <i64 123, i64 112312312>
-; BE: @test10
+; BE-LABEL: @test10(
; BE: ret <2 x i64> <i64 123, i64 112312312>
}
@@ -142,11 +142,11 @@ entry:
ret i16 %a
; 0x08A1
-; LE: @test11
+; LE-LABEL: @test11(
; LE: ret i16 2209
; 0xA108
-; BE: @test11
+; BE-LABEL: @test11(
; BE: ret i16 -24312
}
@@ -155,15 +155,15 @@ entry:
@test12g = private constant [6 x i8] c"a\00b\00\00\00"
define i16 @test12() {
- %a = load i16* getelementptr inbounds ([3 x i16]* bitcast ([6 x i8]* @test12g to [3 x i16]*), i32 0, i64 1)
+ %a = load i16* getelementptr inbounds ([3 x i16]* bitcast ([6 x i8]* @test12g to [3 x i16]*), i32 0, i64 1)
ret i16 %a
; 0x0062
-; LE: @test12
+; LE-LABEL: @test12(
; LE: ret i16 98
; 0x6200
-; BE: @test12
+; BE-LABEL: @test12(
; BE: ret i16 25088
}
@@ -174,10 +174,10 @@ define i1 @test13() {
%A = load i1* bitcast (i8* @g5 to i1*)
ret i1 %A
-; LE: @test13
+; LE-LABEL: @test13(
; LE: ret i1 false
-; BE: @test13
+; BE-LABEL: @test13(
; BE: ret i1 false
}
@@ -187,21 +187,35 @@ entry:
%tmp = load i64* bitcast ([2 x i8*]* @g6 to i64*)
ret i64 %tmp
-; LE: @test14
+; LE-LABEL: @test14(
; LE: ret i64 1
-; BE: @test14
+; BE-LABEL: @test14(
; BE: ret i64 1
}
+; Check with address space pointers
+@g6_as1 = constant [2 x i8 addrspace(1)*] [i8 addrspace(1)* inttoptr (i16 1 to i8 addrspace(1)*), i8 addrspace(1)* inttoptr (i16 2 to i8 addrspace(1)*)]
+define i16 @test14_as1() nounwind {
+entry:
+ %tmp = load i16* bitcast ([2 x i8 addrspace(1)*]* @g6_as1 to i16*)
+ ret i16 %tmp
+
+; LE: @test14_as1
+; LE: ret i16 1
+
+; BE: @test14_as1
+; BE: ret i16 1
+}
+
define i64 @test15() nounwind {
entry:
%tmp = load i64* bitcast (i8** getelementptr inbounds ([2 x i8*]* @g6, i32 0, i64 1) to i64*)
ret i64 %tmp
-; LE: @test15
+; LE-LABEL: @test15(
; LE: ret i64 2
-; BE: @test15
+; BE-LABEL: @test15(
; BE: ret i64 2
}
diff --git a/test/Transforms/ConstProp/overflow-ops.ll b/test/Transforms/ConstProp/overflow-ops.ll
index 849bf9ef75b2..1ae3e562e7e9 100644
--- a/test/Transforms/ConstProp/overflow-ops.ll
+++ b/test/Transforms/ConstProp/overflow-ops.ll
@@ -18,7 +18,7 @@ entry:
%t = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 42, i8 100)
ret {i8, i1} %t
-; CHECK: @uadd_1
+; CHECK-LABEL: @uadd_1(
; CHECK: ret { i8, i1 } { i8 -114, i1 false }
}
@@ -27,7 +27,7 @@ entry:
%t = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 142, i8 120)
ret {i8, i1} %t
-; CHECK: @uadd_2
+; CHECK-LABEL: @uadd_2(
; CHECK: ret { i8, i1 } { i8 6, i1 true }
}
@@ -40,7 +40,7 @@ entry:
%t = call {i8, i1} @llvm.usub.with.overflow.i8(i8 4, i8 2)
ret {i8, i1} %t
-; CHECK: @usub_1
+; CHECK-LABEL: @usub_1(
; CHECK: ret { i8, i1 } { i8 2, i1 false }
}
@@ -49,7 +49,7 @@ entry:
%t = call {i8, i1} @llvm.usub.with.overflow.i8(i8 4, i8 6)
ret {i8, i1} %t
-; CHECK: @usub_2
+; CHECK-LABEL: @usub_2(
; CHECK: ret { i8, i1 } { i8 -2, i1 true }
}
@@ -62,7 +62,7 @@ entry:
%t = call {i8, i1} @llvm.umul.with.overflow.i8(i8 100, i8 3)
ret {i8, i1} %t
-; CHECK: @umul_1
+; CHECK-LABEL: @umul_1(
; CHECK: ret { i8, i1 } { i8 44, i1 true }
}
@@ -71,7 +71,7 @@ entry:
%t = call {i8, i1} @llvm.umul.with.overflow.i8(i8 100, i8 2)
ret {i8, i1} %t
-; CHECK: @umul_2
+; CHECK-LABEL: @umul_2(
; CHECK: ret { i8, i1 } { i8 -56, i1 false }
}
@@ -84,7 +84,7 @@ entry:
%t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 42, i8 2)
ret {i8, i1} %t
-; CHECK: @sadd_1
+; CHECK-LABEL: @sadd_1(
; CHECK: ret { i8, i1 } { i8 44, i1 false }
}
@@ -93,7 +93,7 @@ entry:
%t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 120, i8 10)
ret {i8, i1} %t
-; CHECK: @sadd_2
+; CHECK-LABEL: @sadd_2(
; CHECK: ret { i8, i1 } { i8 -126, i1 true }
}
@@ -102,7 +102,7 @@ entry:
%t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 -120, i8 10)
ret {i8, i1} %t
-; CHECK: @sadd_3
+; CHECK-LABEL: @sadd_3(
; CHECK: ret { i8, i1 } { i8 -110, i1 false }
}
@@ -111,7 +111,7 @@ entry:
%t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 -120, i8 -10)
ret {i8, i1} %t
-; CHECK: @sadd_4
+; CHECK-LABEL: @sadd_4(
; CHECK: ret { i8, i1 } { i8 126, i1 true }
}
@@ -120,7 +120,7 @@ entry:
%t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 2, i8 -10)
ret {i8, i1} %t
-; CHECK: @sadd_5
+; CHECK-LABEL: @sadd_5(
; CHECK: ret { i8, i1 } { i8 -8, i1 false }
}
@@ -134,7 +134,7 @@ entry:
%t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 4, i8 2)
ret {i8, i1} %t
-; CHECK: @ssub_1
+; CHECK-LABEL: @ssub_1(
; CHECK: ret { i8, i1 } { i8 2, i1 false }
}
@@ -143,7 +143,7 @@ entry:
%t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 4, i8 6)
ret {i8, i1} %t
-; CHECK: @ssub_2
+; CHECK-LABEL: @ssub_2(
; CHECK: ret { i8, i1 } { i8 -2, i1 false }
}
@@ -152,7 +152,7 @@ entry:
%t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 -10, i8 120)
ret {i8, i1} %t
-; CHECK: @ssub_3
+; CHECK-LABEL: @ssub_3(
; CHECK: ret { i8, i1 } { i8 126, i1 true }
}
@@ -161,7 +161,7 @@ entry:
%t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 -10, i8 10)
ret {i8, i1} %t
-; CHECK: @ssub_3b
+; CHECK-LABEL: @ssub_3b(
; CHECK: ret { i8, i1 } { i8 -20, i1 false }
}
@@ -170,7 +170,7 @@ entry:
%t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 120, i8 -10)
ret {i8, i1} %t
-; CHECK: @ssub_4
+; CHECK-LABEL: @ssub_4(
; CHECK: ret { i8, i1 } { i8 -126, i1 true }
}
@@ -179,7 +179,7 @@ entry:
%t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 20, i8 -10)
ret {i8, i1} %t
-; CHECK: @ssub_4b
+; CHECK-LABEL: @ssub_4b(
; CHECK: ret { i8, i1 } { i8 30, i1 false }
}
@@ -188,7 +188,7 @@ entry:
%t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 -20, i8 -10)
ret {i8, i1} %t
-; CHECK: @ssub_5
+; CHECK-LABEL: @ssub_5(
; CHECK: ret { i8, i1 } { i8 -10, i1 false }
}
@@ -202,6 +202,6 @@ entry:
%t = call {i8, i1} @llvm.smul.with.overflow.i8(i8 -20, i8 -10)
ret {i8, i1} %t
-; CHECK: @smul_1
+; CHECK-LABEL: @smul_1(
; CHECK: ret { i8, i1 } { i8 -56, i1 true }
}
diff --git a/test/Transforms/ConstantMerge/align.ll b/test/Transforms/ConstantMerge/align.ll
new file mode 100644
index 000000000000..c1cbcb3c652d
--- /dev/null
+++ b/test/Transforms/ConstantMerge/align.ll
@@ -0,0 +1,28 @@
+; RUN: opt -constmerge -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-S128"
+
+
+; Test that with a TD we do merge and mark the alignment as 4
+@T1A = internal unnamed_addr constant i32 1
+@T1B = internal unnamed_addr constant i32 1, align 2
+; CHECK: @T1B = internal unnamed_addr constant i32 1, align 4
+
+define void @test1(i32** %P1, i32** %P2) {
+ store i32* @T1A, i32** %P1
+ store i32* @T1B, i32** %P2
+ ret void
+}
+
+
+; Test that even with a TD we set the alignment to the maximum if both constants
+; have explicit alignments.
+@T2A = internal unnamed_addr constant i32 2, align 1
+@T2B = internal unnamed_addr constant i32 2, align 2
+; CHECK: @T2B = internal unnamed_addr constant i32 2, align 2
+
+define void @test2(i32** %P1, i32** %P2) {
+ store i32* @T2A, i32** %P1
+ store i32* @T2B, i32** %P2
+ ret void
+}
diff --git a/test/Transforms/ConstantMerge/lit.local.cfg b/test/Transforms/ConstantMerge/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/ConstantMerge/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/CorrelatedValuePropagation/2010-09-02-Trunc.ll b/test/Transforms/CorrelatedValuePropagation/2010-09-02-Trunc.ll
index fef5b8579eb5..0754f868d249 100644
--- a/test/Transforms/CorrelatedValuePropagation/2010-09-02-Trunc.ll
+++ b/test/Transforms/CorrelatedValuePropagation/2010-09-02-Trunc.ll
@@ -1,6 +1,6 @@
; RUN: opt -S < %s -correlated-propagation | FileCheck %s
-; CHECK: @test
+; CHECK-LABEL: @test(
define i16 @test(i32 %a, i1 %b) {
entry:
%c = icmp eq i32 %a, 0
@@ -22,4 +22,4 @@ merge:
%h = select i1 %f, i16 1, i16 0
; CHECK: ret i16 %h
ret i16 %h
-} \ No newline at end of file
+}
diff --git a/test/Transforms/CorrelatedValuePropagation/basic.ll b/test/Transforms/CorrelatedValuePropagation/basic.ll
index 39c437ccfae9..9a2264793c50 100644
--- a/test/Transforms/CorrelatedValuePropagation/basic.ll
+++ b/test/Transforms/CorrelatedValuePropagation/basic.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -correlated-propagation -S | FileCheck %s
; PR2581
-; CHECK: @test1
+; CHECK-LABEL: @test1(
define i32 @test1(i1 %C) nounwind {
br i1 %C, label %exit, label %body
@@ -18,7 +18,7 @@ exit: ; preds = %0
; PR4420
declare i1 @ext()
-; CHECK: @test2
+; CHECK-LABEL: @test2(
define i1 @test2() {
entry:
%cond = tail call i1 @ext() ; <i1> [#uses=2]
@@ -42,7 +42,7 @@ bb3: ; preds = %bb1
; PR4855
@gv = internal constant i8 7
-; CHECK: @test3
+; CHECK-LABEL: @test3(
define i8 @test3(i8* %a) nounwind {
entry:
%cond = icmp eq i8* %a, @gv
@@ -58,7 +58,7 @@ bb2: ; preds = %entry
}
; PR1757
-; CHECK: @test4
+; CHECK-LABEL: @test4(
define i32 @test4(i32) {
EntryBlock:
; CHECK: icmp sgt i32 %0, 2
@@ -83,7 +83,7 @@ LessThanOrEqualToTwo:
declare i32* @f(i32*)
define void @test5(i32* %x, i32* %y) {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
entry:
%pre = icmp eq i32* %x, null
br i1 %pre, label %return, label %loop
@@ -102,7 +102,7 @@ return:
}
define i32 @switch1(i32 %s) {
-; CHECK: @switch1
+; CHECK-LABEL: @switch1(
entry:
%cmp = icmp slt i32 %s, 0
br i1 %cmp, label %negative, label %out
@@ -134,7 +134,7 @@ next:
}
define i32 @switch2(i32 %s) {
-; CHECK: @switch2
+; CHECK-LABEL: @switch2(
entry:
%cmp = icmp sgt i32 %s, 0
br i1 %cmp, label %positive, label %out
@@ -157,7 +157,7 @@ next:
}
define i32 @switch3(i32 %s) {
-; CHECK: @switch3
+; CHECK-LABEL: @switch3(
entry:
%cmp = icmp sgt i32 %s, 0
br i1 %cmp, label %positive, label %out
@@ -180,7 +180,7 @@ next:
}
define void @switch4(i32 %s) {
-; CHECK: @switch4
+; CHECK-LABEL: @switch4(
entry:
%cmp = icmp eq i32 %s, 0
br i1 %cmp, label %zero, label %out
diff --git a/test/Transforms/CorrelatedValuePropagation/lit.local.cfg b/test/Transforms/CorrelatedValuePropagation/lit.local.cfg
deleted file mode 100644
index c6106e4746f2..000000000000
--- a/test/Transforms/CorrelatedValuePropagation/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll']
diff --git a/test/Transforms/CorrelatedValuePropagation/range.ll b/test/Transforms/CorrelatedValuePropagation/range.ll
index 6750546ba187..e40c63919078 100644
--- a/test/Transforms/CorrelatedValuePropagation/range.ll
+++ b/test/Transforms/CorrelatedValuePropagation/range.ll
@@ -17,7 +17,7 @@ else:
end:
ret i32 2
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: then:
; CHECK-NEXT: br i1 false, label %end, label %else
}
@@ -37,12 +37,12 @@ else:
end:
ret i32 2
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: then:
; CHECK-NEXT: br i1 false, label %end, label %else
}
-; CHECK: @test3
+; CHECK-LABEL: @test3(
define i32 @test3(i32 %c) nounwind {
%cmp = icmp slt i32 %c, 2
br i1 %cmp, label %if.then, label %if.end
@@ -71,7 +71,7 @@ if.end8:
ret i32 4
}
-; CHECK: @test4
+; CHECK-LABEL: @test4(
define i32 @test4(i32 %c) nounwind {
switch i32 %c, label %sw.default [
i32 1, label %sw.bb
@@ -99,7 +99,7 @@ return:
ret i32 %retval.0
}
-; CHECK: @test5
+; CHECK-LABEL: @test5(
define i1 @test5(i32 %c) nounwind {
%cmp = icmp slt i32 %c, 5
br i1 %cmp, label %if.then, label %if.end
@@ -121,7 +121,7 @@ if.end8:
ret i1 %cmp2
}
-; CHECK: @test6
+; CHECK-LABEL: @test6(
define i1 @test6(i32 %c) nounwind {
%cmp = icmp ule i32 %c, 7
br i1 %cmp, label %if.then, label %if.end
@@ -143,7 +143,7 @@ sw.bb:
ret i1 %cmp2
}
-; CHECK: @test7
+; CHECK-LABEL: @test7(
define i1 @test7(i32 %c) nounwind {
entry:
switch i32 %c, label %sw.default [
diff --git a/test/Transforms/DeadArgElim/2010-04-30-DbgInfo.ll b/test/Transforms/DeadArgElim/2010-04-30-DbgInfo.ll
index f5d2588dd059..26982db8322d 100644
--- a/test/Transforms/DeadArgElim/2010-04-30-DbgInfo.ll
+++ b/test/Transforms/DeadArgElim/2010-04-30-DbgInfo.ll
@@ -8,7 +8,7 @@ entry:
call void @llvm.dbg.value(metadata !{i32 %len}, i64 0, metadata !10)
call void @llvm.dbg.value(metadata !{i32 %hash}, i64 0, metadata !11)
call void @llvm.dbg.value(metadata !{i32 %flags}, i64 0, metadata !12)
-; CHECK: call fastcc i8* @add_name_internal(i8* %name, i32 %hash) [[NUW:#[0-9]+]], !dbg !13
+; CHECK: call fastcc i8* @add_name_internal(i8* %name, i32 %hash) [[NUW:#[0-9]+]], !dbg !{{[0-9]+}}
%0 = call fastcc i8* @add_name_internal(i8* %name, i32 %len, i32 %hash, i8 zeroext 0, i32 %flags) nounwind, !dbg !13 ; <i8*> [#uses=1]
ret i8* %0, !dbg !13
}
@@ -43,31 +43,36 @@ declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
; CHECK: attributes #2 = { noinline nounwind ssp }
; CHECK: attributes [[NUW]] = { nounwind }
+!llvm.dbg.cu = !{!3}
+!llvm.module.flags = !{!30}
!0 = metadata !{i32 524545, metadata !1, metadata !"name", metadata !2, i32 8, metadata !6} ; [ DW_TAG_arg_variable ]
-!1 = metadata !{i32 524334, i32 0, metadata !2, metadata !"vfs_addname", metadata !"vfs_addname", metadata !"vfs_addname", metadata !2, i32 12, metadata !4, i1 false, i1 true, i32 0, i32 0, null, i1 false} ; [ DW_TAG_subprogram ]
-!2 = metadata !{i32 524329, metadata !"tail.c", metadata !"/Users/echeng/LLVM/radars/r7927803/", metadata !3} ; [ DW_TAG_file_type ]
-!3 = metadata !{i32 524305, i32 0, i32 1, metadata !"tail.c", metadata !"/Users/echeng/LLVM/radars/r7927803/", metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build 9999)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
-!4 = metadata !{i32 524309, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !5, i32 0, null} ; [ DW_TAG_subroutine_type ]
+!1 = metadata !{i32 524334, metadata !28, metadata !2, metadata !"vfs_addname", metadata !"vfs_addname", metadata !"vfs_addname", i32 12, metadata !4, i1 false, i1 true, i32 0, i32 0, null, i1 false, i32 0, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
+!2 = metadata !{i32 524329, metadata !28} ; [ DW_TAG_file_type ]
+!3 = metadata !{i32 524305, metadata !28, i32 1, metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build 9999)", i1 true, metadata !"", i32 0, metadata !29, metadata !29, null, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
+!4 = metadata !{i32 524309, metadata !28, metadata !2, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !5, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!5 = metadata !{metadata !6, metadata !6, metadata !9, metadata !9, metadata !9}
-!6 = metadata !{i32 524303, metadata !2, metadata !"", metadata !2, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !7} ; [ DW_TAG_pointer_type ]
-!7 = metadata !{i32 524326, metadata !2, metadata !"", metadata !2, i32 0, i64 8, i64 8, i64 0, i32 0, metadata !8} ; [ DW_TAG_const_type ]
-!8 = metadata !{i32 524324, metadata !2, metadata !"char", metadata !2, i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ]
-!9 = metadata !{i32 524324, metadata !2, metadata !"unsigned int", metadata !2, i32 0, i64 32, i64 32, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ]
+!6 = metadata !{i32 524303, metadata !28, metadata !2, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !7} ; [ DW_TAG_pointer_type ]
+!7 = metadata !{i32 524326, metadata !28, metadata !2, metadata !"", i32 0, i64 8, i64 8, i64 0, i32 0, metadata !8} ; [ DW_TAG_const_type ]
+!8 = metadata !{i32 524324, metadata !28, metadata !2, metadata !"char", i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ]
+!9 = metadata !{i32 524324, metadata !28, metadata !2, metadata !"unsigned int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ]
!10 = metadata !{i32 524545, metadata !1, metadata !"len", metadata !2, i32 9, metadata !9} ; [ DW_TAG_arg_variable ]
!11 = metadata !{i32 524545, metadata !1, metadata !"hash", metadata !2, i32 10, metadata !9} ; [ DW_TAG_arg_variable ]
!12 = metadata !{i32 524545, metadata !1, metadata !"flags", metadata !2, i32 11, metadata !9} ; [ DW_TAG_arg_variable ]
!13 = metadata !{i32 13, i32 0, metadata !14, null}
-!14 = metadata !{i32 524299, metadata !1, i32 12, i32 0} ; [ DW_TAG_lexical_block ]
+!14 = metadata !{i32 524299, metadata !28, metadata !1, i32 12, i32 0, i32 0} ; [ DW_TAG_lexical_block ]
!15 = metadata !{i32 524545, metadata !16, metadata !"name", metadata !2, i32 17, metadata !6} ; [ DW_TAG_arg_variable ]
-!16 = metadata !{i32 524334, i32 0, metadata !2, metadata !"add_name_internal", metadata !"add_name_internal", metadata !"add_name_internal", metadata !2, i32 22, metadata !17, i1 true, i1 true, i32 0, i32 0, null, i1 false} ; [ DW_TAG_subprogram ]
-!17 = metadata !{i32 524309, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !18, i32 0, null} ; [ DW_TAG_subroutine_type ]
+!16 = metadata !{i32 524334, metadata !28, metadata !2, metadata !"add_name_internal", metadata !"add_name_internal", metadata !"add_name_internal", i32 22, metadata !17, i1 true, i1 true, i32 0, i32 0, null, i1 false, i32 0, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
+!17 = metadata !{i32 524309, metadata !28, metadata !2, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !18, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!18 = metadata !{metadata !6, metadata !6, metadata !9, metadata !9, metadata !19, metadata !9}
-!19 = metadata !{i32 524324, metadata !2, metadata !"unsigned char", metadata !2, i32 0, i64 8, i64 8, i64 0, i32 0, i32 8} ; [ DW_TAG_base_type ]
+!19 = metadata !{i32 524324, metadata !28, metadata !2, metadata !"unsigned char", i32 0, i64 8, i64 8, i64 0, i32 0, i32 8} ; [ DW_TAG_base_type ]
!20 = metadata !{i32 524545, metadata !16, metadata !"len", metadata !2, i32 18, metadata !9} ; [ DW_TAG_arg_variable ]
!21 = metadata !{i32 524545, metadata !16, metadata !"hash", metadata !2, i32 19, metadata !9} ; [ DW_TAG_arg_variable ]
!22 = metadata !{i32 524545, metadata !16, metadata !"extra", metadata !2, i32 20, metadata !19} ; [ DW_TAG_arg_variable ]
!23 = metadata !{i32 524545, metadata !16, metadata !"flags", metadata !2, i32 21, metadata !9} ; [ DW_TAG_arg_variable ]
!24 = metadata !{i32 23, i32 0, metadata !25, null}
-!25 = metadata !{i32 524299, metadata !16, i32 22, i32 0} ; [ DW_TAG_lexical_block ]
+!25 = metadata !{i32 524299, metadata !28, metadata !16, i32 22, i32 0, i32 0} ; [ DW_TAG_lexical_block ]
!26 = metadata !{i32 24, i32 0, metadata !25, null}
!27 = metadata !{i32 26, i32 0, metadata !25, null}
+!28 = metadata !{metadata !"tail.c", metadata !"/Users/echeng/LLVM/radars/r7927803/"}
+!29 = metadata !{i32 0}
+!30 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/DeadArgElim/2013-05-17-VarargsAndBlockAddress.ll b/test/Transforms/DeadArgElim/2013-05-17-VarargsAndBlockAddress.ll
new file mode 100644
index 000000000000..23216031b58a
--- /dev/null
+++ b/test/Transforms/DeadArgElim/2013-05-17-VarargsAndBlockAddress.ll
@@ -0,0 +1,25 @@
+; RUN: opt %s -deadargelim -S | FileCheck %s
+
+
+@block_addr = global i8* blockaddress(@varargs_func, %l1)
+; CHECK: @block_addr = global i8* blockaddress(@varargs_func, %l1)
+
+
+; This function is referenced by a "blockaddress" constant but it is
+; not address-taken, so the pass should be able to remove its unused
+; varargs.
+
+define internal i32 @varargs_func(i8* %addr, ...) {
+ indirectbr i8* %addr, [ label %l1, label %l2 ]
+l1:
+ ret i32 1
+l2:
+ ret i32 2
+}
+; CHECK: define internal i32 @varargs_func(i8* %addr) {
+
+define i32 @caller(i8* %addr) {
+ %r = call i32 (i8*, ...)* @varargs_func(i8* %addr)
+ ret i32 %r
+}
+; CHECK: %r = call i32 @varargs_func(i8* %addr)
diff --git a/test/Transforms/DeadArgElim/dbginfo.ll b/test/Transforms/DeadArgElim/dbginfo.ll
index d53c19c8ef58..7bdcbf5c0623 100644
--- a/test/Transforms/DeadArgElim/dbginfo.ll
+++ b/test/Transforms/DeadArgElim/dbginfo.ll
@@ -35,29 +35,31 @@ entry:
}
!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!21}
-!0 = metadata !{i32 786449, i32 4, metadata !6, metadata !"clang version 3.2 (trunk 165305)", i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !3, metadata !1, metadata !1, metadata !""} ; [ DW_TAG_compile_unit ] [/home/samsonov/tmp/clang-di/test.cc] [DW_LANG_C_plus_plus]
+!0 = metadata !{i32 786449, metadata !20, i32 4, metadata !"clang version 3.2 (trunk 165305)", i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !3, metadata !1, metadata !1, metadata !""} ; [ DW_TAG_compile_unit ] [/home/samsonov/tmp/clang-di/test.cc] [DW_LANG_C_plus_plus]
!1 = metadata !{i32 0}
!3 = metadata !{metadata !5, metadata !8, metadata !9}
-!5 = metadata !{i32 786478, metadata !6, metadata !"run", metadata !"run", metadata !"", metadata !6, i32 8, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @_Z3runv, null, null, metadata !1, i32 8} ; [ DW_TAG_subprogram ] [line 8] [def] [run]
+!5 = metadata !{i32 786478, metadata !20, metadata !6, metadata !"run", metadata !"run", metadata !"", i32 8, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @_Z3runv, null, null, metadata !1, i32 8} ; [ DW_TAG_subprogram ] [line 8] [def] [run]
!6 = metadata !{i32 786473, metadata !20} ; [ DW_TAG_file_type ]
-!7 = metadata !{i32 786453, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !1, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
-!8 = metadata !{i32 786478, metadata !6, metadata !"dead_vararg", metadata !"dead_vararg", metadata !"", metadata !6, i32 5, metadata !7, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (...)* @_ZN12_GLOBAL__N_111dead_varargEz, null, null, metadata !1, i32 5} ; [ DW_TAG_subprogram ] [line 5] [local] [def] [dead_vararg]
+!7 = metadata !{i32 786453, i32 0, null, i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !1, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
+!8 = metadata !{i32 786478, metadata !20, metadata !6, metadata !"dead_vararg", metadata !"dead_vararg", metadata !"", i32 5, metadata !7, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (...)* @_ZN12_GLOBAL__N_111dead_varargEz, null, null, metadata !1, i32 5} ; [ DW_TAG_subprogram ] [line 5] [local] [def] [dead_vararg]
; CHECK: metadata !"dead_vararg"{{.*}}void ()* @_ZN12_GLOBAL__N_111dead_varargEz
-!9 = metadata !{i32 786478, metadata !6, metadata !"dead_arg", metadata !"dead_arg", metadata !"", metadata !6, i32 4, metadata !7, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (i8*)* @_ZN12_GLOBAL__N_18dead_argEPv, null, null, metadata !1, i32 4} ; [ DW_TAG_subprogram ] [line 4] [local] [def] [dead_arg]
+!9 = metadata !{i32 786478, metadata !20, metadata !6, metadata !"dead_arg", metadata !"dead_arg", metadata !"", i32 4, metadata !7, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (i8*)* @_ZN12_GLOBAL__N_18dead_argEPv, null, null, metadata !1, i32 4} ; [ DW_TAG_subprogram ] [line 4] [local] [def] [dead_arg]
; CHECK: metadata !"dead_arg"{{.*}}void ()* @_ZN12_GLOBAL__N_18dead_argEPv
!10 = metadata !{i32 8, i32 14, metadata !11, null}
-!11 = metadata !{i32 786443, metadata !5, i32 8, i32 12, metadata !6, i32 0} ; [ DW_TAG_lexical_block ] [/home/samsonov/tmp/clang-di/test.cc]
+!11 = metadata !{i32 786443, metadata !20, metadata !5, i32 8, i32 12, i32 0} ; [ DW_TAG_lexical_block ] [/home/samsonov/tmp/clang-di/test.cc]
!12 = metadata !{i32 8, i32 27, metadata !11, null}
!13 = metadata !{i32 8, i32 42, metadata !11, null}
!14 = metadata !{i32 4, i32 28, metadata !15, null}
-!15 = metadata !{i32 786443, metadata !9, i32 4, i32 26, metadata !6, i32 2} ; [ DW_TAG_lexical_block ] [/home/samsonov/tmp/clang-di/test.cc]
+!15 = metadata !{i32 786443, metadata !20, metadata !9, i32 4, i32 26, i32 2} ; [ DW_TAG_lexical_block ] [/home/samsonov/tmp/clang-di/test.cc]
!16 = metadata !{i32 4, i32 33, metadata !15, null}
!17 = metadata !{i32 5, i32 25, metadata !18, null}
-!18 = metadata !{i32 786443, metadata !8, i32 5, i32 23, metadata !6, i32 1} ; [ DW_TAG_lexical_block ] [/home/samsonov/tmp/clang-di/test.cc]
+!18 = metadata !{i32 786443, metadata !20, metadata !8, i32 5, i32 23, i32 1} ; [ DW_TAG_lexical_block ] [/home/samsonov/tmp/clang-di/test.cc]
!19 = metadata !{i32 5, i32 30, metadata !18, null}
!20 = metadata !{metadata !"test.cc", metadata !"/home/samsonov/tmp/clang-di"}
+!21 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/DeadArgElim/deadexternal.ll b/test/Transforms/DeadArgElim/deadexternal.ll
index cca58721e532..acbcf75ee495 100644
--- a/test/Transforms/DeadArgElim/deadexternal.ll
+++ b/test/Transforms/DeadArgElim/deadexternal.ll
@@ -7,7 +7,7 @@ define void @test(i32) {
define void @foo() {
call void @test(i32 0)
ret void
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK: i32 undef
}
diff --git a/test/Transforms/DeadArgElim/keepalive.ll b/test/Transforms/DeadArgElim/keepalive.ll
index e41110c96ef4..82e01f225843 100644
--- a/test/Transforms/DeadArgElim/keepalive.ll
+++ b/test/Transforms/DeadArgElim/keepalive.ll
@@ -13,7 +13,7 @@ define internal zeroext i32 @test1(i32 %DEADARG1) nounwind {
}
; This checks if the struct doesn't get non-packed
-; CHECK: define internal <{ i32, i32 }> @test2
+; CHECK-LABEL: define internal <{ i32, i32 }> @test2(
define internal <{ i32, i32 }> @test2(i32 %DEADARG1) {
ret <{ i32, i32 }> <{ i32 1, i32 2 }>
}
diff --git a/test/Transforms/DeadArgElim/linkage.ll b/test/Transforms/DeadArgElim/linkage.ll
new file mode 100644
index 000000000000..f47548489eef
--- /dev/null
+++ b/test/Transforms/DeadArgElim/linkage.ll
@@ -0,0 +1,21 @@
+; RUN: opt < %s -deadargelim -S | FileCheck %s
+
+; rdar://11546243
+%struct.A = type { i8 }
+
+define available_externally void @_Z17externallyDefinedP1A(%struct.A* %a) {
+entry:
+ call void @_Z3foov()
+ ret void
+}
+
+declare void @_Z3foov()
+
+define void @_Z4testP1A(%struct.A* %a) {
+; CHECK: @_Z4testP1A
+; CHECK: @_Z17externallyDefinedP1A(%struct.A* %a)
+
+entry:
+ call void @_Z17externallyDefinedP1A(%struct.A* %a)
+ ret void
+}
diff --git a/test/Transforms/DeadArgElim/lit.local.cfg b/test/Transforms/DeadArgElim/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/DeadArgElim/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/DeadArgElim/returned.ll b/test/Transforms/DeadArgElim/returned.ll
new file mode 100644
index 000000000000..cbee026f9a37
--- /dev/null
+++ b/test/Transforms/DeadArgElim/returned.ll
@@ -0,0 +1,55 @@
+; RUN: opt < %s -deadargelim -S | FileCheck %s
+
+%Ty = type { i32, i32 }
+
+; sanity check that the argument and return value are both dead
+; CHECK-LABEL: define internal void @test1()
+
+define internal %Ty* @test1(%Ty* %this) {
+ ret %Ty* %this
+}
+
+; do not keep alive the return value of a function with a dead 'returned' argument
+; CHECK-LABEL: define internal void @test2()
+
+define internal %Ty* @test2(%Ty* returned %this) {
+ ret %Ty* %this
+}
+
+; dummy to keep 'this' alive
+@dummy = global %Ty* null
+
+; sanity check that return value is dead
+; CHECK-LABEL: define internal void @test3(%Ty* %this)
+
+define internal %Ty* @test3(%Ty* %this) {
+ store volatile %Ty* %this, %Ty** @dummy
+ ret %Ty* %this
+}
+
+; keep alive return value of a function if the 'returned' argument is live
+; CHECK-LABEL: define internal %Ty* @test4(%Ty* returned %this)
+
+define internal %Ty* @test4(%Ty* returned %this) {
+ store volatile %Ty* %this, %Ty** @dummy
+ ret %Ty* %this
+}
+
+; don't do this if 'returned' is on the call site...
+; CHECK-LABEL: define internal void @test5(%Ty* %this)
+
+define internal %Ty* @test5(%Ty* %this) {
+ store volatile %Ty* %this, %Ty** @dummy
+ ret %Ty* %this
+}
+
+define %Ty* @caller(%Ty* %this) {
+ %1 = call %Ty* @test1(%Ty* %this)
+ %2 = call %Ty* @test2(%Ty* %this)
+ %3 = call %Ty* @test3(%Ty* %this)
+ %4 = call %Ty* @test4(%Ty* %this)
+; ...instead, drop 'returned' form the call site
+; CHECK: call void @test5(%Ty* %this)
+ %5 = call %Ty* @test5(%Ty* returned %this)
+ ret %Ty* %this
+}
diff --git a/test/Transforms/DeadArgElim/variadic_safety.ll b/test/Transforms/DeadArgElim/variadic_safety.ll
new file mode 100644
index 000000000000..15f57bcfdcb8
--- /dev/null
+++ b/test/Transforms/DeadArgElim/variadic_safety.ll
@@ -0,0 +1,38 @@
+; RUN: opt < %s -deadargelim -S | FileCheck %s
+
+declare void @llvm.va_start(i8*)
+
+define internal i32 @va_func(i32 %a, i32 %b, ...) {
+ %valist = alloca i8
+ call void @llvm.va_start(i8* %valist)
+
+ ret i32 %b
+}
+
+; Function derived from AArch64 ABI, where 8 integer arguments go in
+; registers but the 9th goes on the stack. We really don't want to put
+; just 7 args in registers and then start on the stack since any
+; va_arg implementation already present in va_func won't be expecting
+; it.
+define i32 @call_va(i32 %in) {
+ %stacked = alloca i32
+ store i32 42, i32* %stacked
+ %res = call i32(i32, i32, ...)* @va_func(i32 %in, i32 %in, [6 x i32] undef, i32* byval %stacked)
+ ret i32 %res
+; CHECK: call i32 (i32, i32, ...)* @va_func(i32 undef, i32 %in, [6 x i32] undef, i32* byval %stacked)
+}
+
+define internal i32 @va_deadret_func(i32 %a, i32 %b, ...) {
+ %valist = alloca i8
+ call void @llvm.va_start(i8* %valist)
+
+ ret i32 %a
+}
+
+define void @call_deadret(i32 %in) {
+ %stacked = alloca i32
+ store i32 42, i32* %stacked
+ call i32 (i32, i32, ...)* @va_deadret_func(i32 undef, i32 %in, [6 x i32] undef, i32* byval %stacked)
+ ret void
+; CHECK: call void (i32, i32, ...)* @va_deadret_func(i32 undef, i32 undef, [6 x i32] undef, i32* byval %stacked)
+}
diff --git a/test/Transforms/DeadStoreElimination/2011-09-06-EndOfFunction.ll b/test/Transforms/DeadStoreElimination/2011-09-06-EndOfFunction.ll
index d114e513ed2b..95253f6570b5 100644
--- a/test/Transforms/DeadStoreElimination/2011-09-06-EndOfFunction.ll
+++ b/test/Transforms/DeadStoreElimination/2011-09-06-EndOfFunction.ll
@@ -5,7 +5,7 @@ target triple = "x86_64-apple-darwin"
%"class.std::auto_ptr" = type { i32* }
-; CHECK: @_Z3foov
+; CHECK-LABEL: @_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
diff --git a/test/Transforms/DeadStoreElimination/OverwriteStoreEnd.ll b/test/Transforms/DeadStoreElimination/OverwriteStoreEnd.ll
index ed53eb524c20..968d608c67ed 100644
--- a/test/Transforms/DeadStoreElimination/OverwriteStoreEnd.ll
+++ b/test/Transforms/DeadStoreElimination/OverwriteStoreEnd.ll
@@ -8,7 +8,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
@glob2 = global %struct.vec2plusi zeroinitializer, align 16
define void @write24to28(i32* nocapture %p) nounwind uwtable ssp {
-; CHECK: @write24to28
+; CHECK-LABEL: @write24to28(
entry:
%arrayidx0 = getelementptr inbounds i32* %p, i64 1
%p3 = bitcast i32* %arrayidx0 to i8*
@@ -20,7 +20,7 @@ entry:
}
define void @write28to32(i32* nocapture %p) nounwind uwtable ssp {
-; CHECK: @write28to32
+; CHECK-LABEL: @write28to32(
entry:
%p3 = bitcast i32* %p to i8*
; CHECK: call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 28, i32 4, i1 false)
@@ -31,7 +31,7 @@ entry:
}
define void @dontwrite28to32memset(i32* nocapture %p) nounwind uwtable ssp {
-; CHECK: @dontwrite28to32memset
+; CHECK-LABEL: @dontwrite28to32memset(
entry:
%p3 = bitcast i32* %p to i8*
; CHECK: call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 32, i32 16, i1 false)
@@ -42,7 +42,7 @@ entry:
}
define void @write32to36(%struct.vec2plusi* nocapture %p) nounwind uwtable ssp {
-; CHECK: @write32to36
+; CHECK-LABEL: @write32to36(
entry:
%0 = bitcast %struct.vec2plusi* %p to i8*
; CHECK: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast (%struct.vec2plusi* @glob2 to i8*), i64 32, i32 16, i1 false)
@@ -53,7 +53,7 @@ entry:
}
define void @write16to32(%struct.vec2* nocapture %p) nounwind uwtable ssp {
-; CHECK: @write16to32
+; CHECK-LABEL: @write16to32(
entry:
%0 = bitcast %struct.vec2* %p to i8*
; CHECK: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast (%struct.vec2* @glob1 to i8*), i64 16, i32 16, i1 false)
@@ -64,7 +64,7 @@ entry:
}
define void @dontwrite28to32memcpy(%struct.vec2* nocapture %p) nounwind uwtable ssp {
-; CHECK: @dontwrite28to32memcpy
+; CHECK-LABEL: @dontwrite28to32memcpy(
entry:
%0 = bitcast %struct.vec2* %p to i8*
; CHECK: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast (%struct.vec2* @glob1 to i8*), i64 32, i32 16, i1 false)
@@ -80,7 +80,7 @@ declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind
%struct.trapframe = type { i64, i64, i64 }
; bugzilla 11455 - make sure negative GEP's don't break this optimisation
-; CHECK: @cpu_lwp_fork
+; CHECK-LABEL: @cpu_lwp_fork(
define void @cpu_lwp_fork(%struct.trapframe* %md_regs, i64 %pcb_rsp0) nounwind uwtable noinline ssp {
entry:
%0 = inttoptr i64 %pcb_rsp0 to %struct.trapframe*
diff --git a/test/Transforms/DeadStoreElimination/PartialStore.ll b/test/Transforms/DeadStoreElimination/PartialStore.ll
index 7ac1e0844ed4..4799ef3383bc 100644
--- a/test/Transforms/DeadStoreElimination/PartialStore.ll
+++ b/test/Transforms/DeadStoreElimination/PartialStore.ll
@@ -8,13 +8,13 @@ define void @test1(i32 *%V) {
store i8 0, i8* %V2
store i32 1234567, i32* %V
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: store i32 1234567
}
; Note that we could do better by merging the two stores into one.
define void @test2(i32* %P) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
store i32 0, i32* %P
; CHECK: store i32
%Q = bitcast i32* %P to i16*
@@ -25,7 +25,7 @@ define void @test2(i32* %P) {
define i32 @test3(double %__x) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: store double
%__u = alloca { [3 x i32] }
%tmp.1 = bitcast { [3 x i32] }* %__u to double*
@@ -39,7 +39,7 @@ define i32 @test3(double %__x) {
; PR6043
define void @test4(i8* %P) {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NEXT: bitcast
; CHECK-NEXT: store double
@@ -64,7 +64,7 @@ define void @test5(i32 %i) nounwind ssp {
call void @test5a(i32* %A)
ret void
-; CHECK: @test5(
+; CHECK-LABEL: @test5(
; CHECK-NEXT: alloca
; CHECK-NEXT: store i32 20
; CHECK-NEXT: call void @test5a
diff --git a/test/Transforms/DeadStoreElimination/const-pointers.ll b/test/Transforms/DeadStoreElimination/const-pointers.ll
index 15976f9f10d4..c90d824b34c1 100644
--- a/test/Transforms/DeadStoreElimination/const-pointers.ll
+++ b/test/Transforms/DeadStoreElimination/const-pointers.ll
@@ -11,7 +11,7 @@ define void @test1(%t* noalias %pp) {
%x = load i32* inttoptr (i32 12345 to i32*)
store i32 %x, i32* %p
ret void
-; CHECK: define void @test1
+; CHECK-LABEL: define void @test1(
; CHECK: store
; CHECK-NOT: store
; CHECK: ret void
@@ -21,7 +21,7 @@ define void @test3() {
store i32 1, i32* @g; <-- This is dead.
store i32 42, i32* @g
ret void
-; CHECK: define void @test3
+; CHECK-LABEL: define void @test3(
; CHECK: store
; CHECK-NOT: store
; CHECK: ret void
@@ -32,7 +32,7 @@ define void @test4(i32* %p) {
%x = load i32* @g; <-- %p and @g could alias
store i32 %x, i32* %p
ret void
-; CHECK: define void @test4
+; CHECK-LABEL: define void @test4(
; CHECK: store
; CHECK: store
; CHECK: ret void
diff --git a/test/Transforms/DeadStoreElimination/free.ll b/test/Transforms/DeadStoreElimination/free.ll
index a5fbdc76387e..1d273d67a501 100644
--- a/test/Transforms/DeadStoreElimination/free.ll
+++ b/test/Transforms/DeadStoreElimination/free.ll
@@ -5,7 +5,7 @@ target datalayout = "e-p:64:64:64"
declare void @free(i8* nocapture)
declare noalias i8* @malloc(i64)
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK-NEXT: bitcast
; CHECK-NEXT: @free
; CHECK-NEXT: ret void
@@ -17,7 +17,7 @@ define void @test(i32* %Q, i32* %P) {
ret void
}
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: bitcast
; CHECK-NEXT: @free
; CHECK-NEXT: ret void
@@ -29,7 +29,7 @@ define void @test2({i32, i32}* %P) {
ret void
}
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NOT: store
; CHECK: ret void
define void @test3() {
@@ -42,7 +42,7 @@ define void @test3() {
}
; PR11240
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NOT: store
; CHECK: ret void
define void @test4(i1 %x) nounwind {
@@ -59,7 +59,7 @@ skipinit1:
ret void
}
-; CHECK: @test5
+; CHECK-LABEL: @test5(
define void @test5() {
br label %bb
diff --git a/test/Transforms/DeadStoreElimination/inst-limits.ll b/test/Transforms/DeadStoreElimination/inst-limits.ll
new file mode 100644
index 000000000000..9df88014e5c6
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/inst-limits.ll
@@ -0,0 +1,261 @@
+; RUN: opt -S -dse < %s | FileCheck %s
+
+; If there are two stores to the same location, DSE should be able to remove
+; the first store if the two stores are separated by no more than 98
+; instructions. The existence of debug intrinsics between the stores should
+; not affect this instruction limit.
+
+@x = global i32 0, align 4
+
+; Function Attrs: nounwind
+define i32 @test_within_limit() {
+entry:
+ ; The first store; later there is a second store to the same location,
+ ; so this store should be optimized away by DSE.
+ ; CHECK-NOT: store i32 1, i32* @x, align 4
+ store i32 1, i32* @x, align 4
+
+ ; Insert 98 dummy instructions between the two stores
+ %0 = bitcast i32 0 to i32
+ %1 = bitcast i32 0 to i32
+ %2 = bitcast i32 0 to i32
+ %3 = bitcast i32 0 to i32
+ %4 = bitcast i32 0 to i32
+ %5 = bitcast i32 0 to i32
+ %6 = bitcast i32 0 to i32
+ %7 = bitcast i32 0 to i32
+ %8 = bitcast i32 0 to i32
+ %9 = bitcast i32 0 to i32
+ %10 = bitcast i32 0 to i32
+ %11 = bitcast i32 0 to i32
+ %12 = bitcast i32 0 to i32
+ %13 = bitcast i32 0 to i32
+ %14 = bitcast i32 0 to i32
+ %15 = bitcast i32 0 to i32
+ %16 = bitcast i32 0 to i32
+ %17 = bitcast i32 0 to i32
+ %18 = bitcast i32 0 to i32
+ %19 = bitcast i32 0 to i32
+ %20 = bitcast i32 0 to i32
+ %21 = bitcast i32 0 to i32
+ %22 = bitcast i32 0 to i32
+ %23 = bitcast i32 0 to i32
+ %24 = bitcast i32 0 to i32
+ %25 = bitcast i32 0 to i32
+ %26 = bitcast i32 0 to i32
+ %27 = bitcast i32 0 to i32
+ %28 = bitcast i32 0 to i32
+ %29 = bitcast i32 0 to i32
+ %30 = bitcast i32 0 to i32
+ %31 = bitcast i32 0 to i32
+ %32 = bitcast i32 0 to i32
+ %33 = bitcast i32 0 to i32
+ %34 = bitcast i32 0 to i32
+ %35 = bitcast i32 0 to i32
+ %36 = bitcast i32 0 to i32
+ %37 = bitcast i32 0 to i32
+ %38 = bitcast i32 0 to i32
+ %39 = bitcast i32 0 to i32
+ %40 = bitcast i32 0 to i32
+ %41 = bitcast i32 0 to i32
+ %42 = bitcast i32 0 to i32
+ %43 = bitcast i32 0 to i32
+ %44 = bitcast i32 0 to i32
+ %45 = bitcast i32 0 to i32
+ %46 = bitcast i32 0 to i32
+ %47 = bitcast i32 0 to i32
+ %48 = bitcast i32 0 to i32
+ %49 = bitcast i32 0 to i32
+ %50 = bitcast i32 0 to i32
+ %51 = bitcast i32 0 to i32
+ %52 = bitcast i32 0 to i32
+ %53 = bitcast i32 0 to i32
+ %54 = bitcast i32 0 to i32
+ %55 = bitcast i32 0 to i32
+ %56 = bitcast i32 0 to i32
+ %57 = bitcast i32 0 to i32
+ %58 = bitcast i32 0 to i32
+ %59 = bitcast i32 0 to i32
+ %60 = bitcast i32 0 to i32
+ %61 = bitcast i32 0 to i32
+ %62 = bitcast i32 0 to i32
+ %63 = bitcast i32 0 to i32
+ %64 = bitcast i32 0 to i32
+ %65 = bitcast i32 0 to i32
+ %66 = bitcast i32 0 to i32
+ %67 = bitcast i32 0 to i32
+ %68 = bitcast i32 0 to i32
+ %69 = bitcast i32 0 to i32
+ %70 = bitcast i32 0 to i32
+ %71 = bitcast i32 0 to i32
+ %72 = bitcast i32 0 to i32
+ %73 = bitcast i32 0 to i32
+ %74 = bitcast i32 0 to i32
+ %75 = bitcast i32 0 to i32
+ %76 = bitcast i32 0 to i32
+ %77 = bitcast i32 0 to i32
+ %78 = bitcast i32 0 to i32
+ %79 = bitcast i32 0 to i32
+ %80 = bitcast i32 0 to i32
+ %81 = bitcast i32 0 to i32
+ %82 = bitcast i32 0 to i32
+ %83 = bitcast i32 0 to i32
+ %84 = bitcast i32 0 to i32
+ %85 = bitcast i32 0 to i32
+ %86 = bitcast i32 0 to i32
+ %87 = bitcast i32 0 to i32
+ %88 = bitcast i32 0 to i32
+ %89 = bitcast i32 0 to i32
+ %90 = bitcast i32 0 to i32
+ %91 = bitcast i32 0 to i32
+ %92 = bitcast i32 0 to i32
+ %93 = bitcast i32 0 to i32
+ %94 = bitcast i32 0 to i32
+ %95 = bitcast i32 0 to i32
+ %96 = bitcast i32 0 to i32
+ %97 = bitcast i32 0 to i32
+
+ ; Insert a meaningless dbg.value intrinsic; it should have no
+ ; effect on the working of DSE in any way.
+ call void @llvm.dbg.value(metadata !12, i64 0, metadata !10)
+
+ ; CHECK: store i32 -1, i32* @x, align 4
+ store i32 -1, i32* @x, align 4
+ ret i32 0
+}
+
+; Function Attrs: nounwind
+define i32 @test_outside_limit() {
+entry:
+ ; The first store; later there is a second store to the same location
+ ; CHECK: store i32 1, i32* @x, align 4
+ store i32 1, i32* @x, align 4
+
+ ; Insert 99 dummy instructions between the two stores; this is
+ ; one too many instruction for the DSE to take place.
+ %0 = bitcast i32 0 to i32
+ %1 = bitcast i32 0 to i32
+ %2 = bitcast i32 0 to i32
+ %3 = bitcast i32 0 to i32
+ %4 = bitcast i32 0 to i32
+ %5 = bitcast i32 0 to i32
+ %6 = bitcast i32 0 to i32
+ %7 = bitcast i32 0 to i32
+ %8 = bitcast i32 0 to i32
+ %9 = bitcast i32 0 to i32
+ %10 = bitcast i32 0 to i32
+ %11 = bitcast i32 0 to i32
+ %12 = bitcast i32 0 to i32
+ %13 = bitcast i32 0 to i32
+ %14 = bitcast i32 0 to i32
+ %15 = bitcast i32 0 to i32
+ %16 = bitcast i32 0 to i32
+ %17 = bitcast i32 0 to i32
+ %18 = bitcast i32 0 to i32
+ %19 = bitcast i32 0 to i32
+ %20 = bitcast i32 0 to i32
+ %21 = bitcast i32 0 to i32
+ %22 = bitcast i32 0 to i32
+ %23 = bitcast i32 0 to i32
+ %24 = bitcast i32 0 to i32
+ %25 = bitcast i32 0 to i32
+ %26 = bitcast i32 0 to i32
+ %27 = bitcast i32 0 to i32
+ %28 = bitcast i32 0 to i32
+ %29 = bitcast i32 0 to i32
+ %30 = bitcast i32 0 to i32
+ %31 = bitcast i32 0 to i32
+ %32 = bitcast i32 0 to i32
+ %33 = bitcast i32 0 to i32
+ %34 = bitcast i32 0 to i32
+ %35 = bitcast i32 0 to i32
+ %36 = bitcast i32 0 to i32
+ %37 = bitcast i32 0 to i32
+ %38 = bitcast i32 0 to i32
+ %39 = bitcast i32 0 to i32
+ %40 = bitcast i32 0 to i32
+ %41 = bitcast i32 0 to i32
+ %42 = bitcast i32 0 to i32
+ %43 = bitcast i32 0 to i32
+ %44 = bitcast i32 0 to i32
+ %45 = bitcast i32 0 to i32
+ %46 = bitcast i32 0 to i32
+ %47 = bitcast i32 0 to i32
+ %48 = bitcast i32 0 to i32
+ %49 = bitcast i32 0 to i32
+ %50 = bitcast i32 0 to i32
+ %51 = bitcast i32 0 to i32
+ %52 = bitcast i32 0 to i32
+ %53 = bitcast i32 0 to i32
+ %54 = bitcast i32 0 to i32
+ %55 = bitcast i32 0 to i32
+ %56 = bitcast i32 0 to i32
+ %57 = bitcast i32 0 to i32
+ %58 = bitcast i32 0 to i32
+ %59 = bitcast i32 0 to i32
+ %60 = bitcast i32 0 to i32
+ %61 = bitcast i32 0 to i32
+ %62 = bitcast i32 0 to i32
+ %63 = bitcast i32 0 to i32
+ %64 = bitcast i32 0 to i32
+ %65 = bitcast i32 0 to i32
+ %66 = bitcast i32 0 to i32
+ %67 = bitcast i32 0 to i32
+ %68 = bitcast i32 0 to i32
+ %69 = bitcast i32 0 to i32
+ %70 = bitcast i32 0 to i32
+ %71 = bitcast i32 0 to i32
+ %72 = bitcast i32 0 to i32
+ %73 = bitcast i32 0 to i32
+ %74 = bitcast i32 0 to i32
+ %75 = bitcast i32 0 to i32
+ %76 = bitcast i32 0 to i32
+ %77 = bitcast i32 0 to i32
+ %78 = bitcast i32 0 to i32
+ %79 = bitcast i32 0 to i32
+ %80 = bitcast i32 0 to i32
+ %81 = bitcast i32 0 to i32
+ %82 = bitcast i32 0 to i32
+ %83 = bitcast i32 0 to i32
+ %84 = bitcast i32 0 to i32
+ %85 = bitcast i32 0 to i32
+ %86 = bitcast i32 0 to i32
+ %87 = bitcast i32 0 to i32
+ %88 = bitcast i32 0 to i32
+ %89 = bitcast i32 0 to i32
+ %90 = bitcast i32 0 to i32
+ %91 = bitcast i32 0 to i32
+ %92 = bitcast i32 0 to i32
+ %93 = bitcast i32 0 to i32
+ %94 = bitcast i32 0 to i32
+ %95 = bitcast i32 0 to i32
+ %96 = bitcast i32 0 to i32
+ %97 = bitcast i32 0 to i32
+ %98 = bitcast i32 0 to i32
+
+ ; CHECK: store i32 -1, i32* @x, align 4
+ store i32 -1, i32* @x, align 4
+ ret i32 0
+}
+
+; Function Attrs: nounwind readnone
+declare void @llvm.dbg.value(metadata, i64, metadata)
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!11, !13}
+
+!0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.4", i1 true, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !9, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [/home/tmp/test.c] [DW_LANG_C99]
+!1 = metadata !{metadata !"test.c", metadata !"/home/tmp"}
+!2 = metadata !{i32 0}
+!3 = metadata !{metadata !4}
+!4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"test_within_limit", metadata !"test_within_limit", metadata !"", i32 3, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @test_within_limit, null, null, metadata !2, i32 4} ; [ DW_TAG_subprogram ] [line 3] [def] [scope 4] [test]
+!5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/home/tmp/test.c]
+!6 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
+!7 = metadata !{metadata !8}
+!8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
+!9 = metadata !{metadata !10}
+!10 = metadata !{i32 786484, i32 0, null, metadata !"x", metadata !"x", metadata !"", metadata !5, i32 1, metadata !8, i32 0, i32 1, i32* @x, null} ; [ DW_TAG_variable ] [x] [line 1] [def]
+!11 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
+!12 = metadata !{i32* undef}
+
+!13 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/DeadStoreElimination/libcalls.ll b/test/Transforms/DeadStoreElimination/libcalls.ll
index 4639c0bc9628..65396945bf65 100644
--- a/test/Transforms/DeadStoreElimination/libcalls.ll
+++ b/test/Transforms/DeadStoreElimination/libcalls.ll
@@ -2,7 +2,7 @@
declare i8* @strcpy(i8* %dest, i8* %src) nounwind
define void @test1(i8* %src) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
%B = alloca [16 x i8]
%dest = getelementptr inbounds [16 x i8]* %B, i64 0, i64 0
; CHECK-NOT: @strcpy
@@ -13,7 +13,7 @@ define void @test1(i8* %src) {
declare i8* @strncpy(i8* %dest, i8* %src, i32 %n) nounwind
define void @test2(i8* %src) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
%B = alloca [16 x i8]
%dest = getelementptr inbounds [16 x i8]* %B, i64 0, i64 0
; CHECK-NOT: @strncpy
@@ -24,7 +24,7 @@ define void @test2(i8* %src) {
declare i8* @strcat(i8* %dest, i8* %src) nounwind
define void @test3(i8* %src) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
%B = alloca [16 x i8]
%dest = getelementptr inbounds [16 x i8]* %B, i64 0, i64 0
; CHECK-NOT: @strcat
@@ -35,7 +35,7 @@ define void @test3(i8* %src) {
declare i8* @strncat(i8* %dest, i8* %src, i32 %n) nounwind
define void @test4(i8* %src) {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
%B = alloca [16 x i8]
%dest = getelementptr inbounds [16 x i8]* %B, i64 0, i64 0
; CHECK-NOT: @strncat
@@ -45,7 +45,7 @@ define void @test4(i8* %src) {
}
define void @test5(i8* nocapture %src) {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
%dest = alloca [100 x i8], align 16
%arraydecay = getelementptr inbounds [100 x i8]* %dest, i64 0, i64 0
%call = call i8* @strcpy(i8* %arraydecay, i8* %src)
@@ -57,7 +57,7 @@ define void @test5(i8* nocapture %src) {
declare void @user(i8* %p)
define void @test6(i8* %src) {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
%B = alloca [16 x i8]
%dest = getelementptr inbounds [16 x i8]* %B, i64 0, i64 0
; CHECK: @strcpy
diff --git a/test/Transforms/DeadStoreElimination/lifetime.ll b/test/Transforms/DeadStoreElimination/lifetime.ll
index 678565315e37..7fe7fbfa7478 100644
--- a/test/Transforms/DeadStoreElimination/lifetime.ll
+++ b/test/Transforms/DeadStoreElimination/lifetime.ll
@@ -7,7 +7,7 @@ declare void @llvm.lifetime.end(i64, i8* nocapture) nounwind
declare void @llvm.memset.p0i8.i8(i8* nocapture, i8, i8, i32, i1) nounwind
define void @test1() {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
%A = alloca i8
store i8 0, i8* %A ;; Written to by memset
diff --git a/test/Transforms/DeadStoreElimination/lit.local.cfg b/test/Transforms/DeadStoreElimination/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/DeadStoreElimination/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/DeadStoreElimination/memintrinsics.ll b/test/Transforms/DeadStoreElimination/memintrinsics.ll
index d5c5365771d5..5bbb8e099c41 100644
--- a/test/Transforms/DeadStoreElimination/memintrinsics.ll
+++ b/test/Transforms/DeadStoreElimination/memintrinsics.ll
@@ -5,7 +5,7 @@ declare void @llvm.memmove.p0i8.p0i8.i8(i8* nocapture, i8* nocapture, i8, i32, i
declare void @llvm.memset.p0i8.i8(i8* nocapture, i8, i8, i32, i1) nounwind
define void @test1() {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
%A = alloca i8
%B = alloca i8
@@ -19,7 +19,7 @@ define void @test1() {
}
define void @test2() {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
%A = alloca i8
%B = alloca i8
@@ -33,7 +33,7 @@ define void @test2() {
}
define void @test3() {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
%A = alloca i8
%B = alloca i8
diff --git a/test/Transforms/DeadStoreElimination/no-targetdata.ll b/test/Transforms/DeadStoreElimination/no-targetdata.ll
index 4022d76dcb52..c0c7c58d4ead 100644
--- a/test/Transforms/DeadStoreElimination/no-targetdata.ll
+++ b/test/Transforms/DeadStoreElimination/no-targetdata.ll
@@ -7,7 +7,7 @@ define void @test1(i32* noalias %p) {
call void @test1f()
store i32 2, i32 *%p
ret void
-; CHECK: define void @test1
+; CHECK-LABEL: define void @test1(
; CHECK-NOT: store
; CHECK-NEXT: call void
; CHECK-NEXT: store i32 2
diff --git a/test/Transforms/DeadStoreElimination/simple.ll b/test/Transforms/DeadStoreElimination/simple.ll
index e0eb90af9437..ec98466d33b9 100644
--- a/test/Transforms/DeadStoreElimination/simple.ll
+++ b/test/Transforms/DeadStoreElimination/simple.ll
@@ -10,7 +10,7 @@ define void @test1(i32* %Q, i32* %P) {
store i32 %DEAD, i32* %P
store i32 0, i32* %P
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: store i32 0, i32* %P
; CHECK-NEXT: ret void
}
@@ -21,7 +21,7 @@ define void @test2(i32 *%p, i32 *%q) {
store i32 20, i32* %q, align 4
store i32 30, i32* %p, align 4
ret void
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: store i32 20
}
@@ -30,7 +30,7 @@ define void @test2(i32 *%p, i32 *%q) {
@g = global i32 1
define i32 @test3(i32* %g_addr) nounwind {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: load i32* %g_addr
%g_value = load i32* %g_addr, align 4
store i32 -1, i32* @g, align 4
@@ -44,7 +44,7 @@ define void @test4(i32* %Q) {
%a = load i32* %Q
store volatile i32 %a, i32* %Q
ret void
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NEXT: load i32
; CHECK-NEXT: store volatile
; CHECK-NEXT: ret void
@@ -54,7 +54,7 @@ define void @test5(i32* %Q) {
%a = load volatile i32* %Q
store i32 %a, i32* %Q
ret void
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NEXT: load volatile
; CHECK-NEXT: ret void
}
@@ -66,7 +66,7 @@ define void @test6(i32 *%p, i8 *%q) {
call void @llvm.memset.p0i8.i64(i8* %q, i8 42, i64 900, i32 1, i1 false)
store i32 30, i32* %p, align 4
ret void
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NEXT: call void @llvm.memset
}
@@ -77,7 +77,7 @@ define void @test7(i32 *%p, i8 *%q, i8* noalias %r) {
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %q, i8* %r, i64 900, i32 1, i1 false)
store i32 30, i32* %p, align 4
ret void
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NEXT: call void @llvm.memcpy
}
@@ -90,7 +90,7 @@ define i32 @test8() {
%X = load i32* %V
ret i32 %X
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: store i32 1234567
}
@@ -101,7 +101,7 @@ define void @test9(%struct.x* byval %a) nounwind {
%tmp2 = getelementptr %struct.x* %a, i32 0, i32 0
store i32 1, i32* %tmp2, align 4
ret void
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK-NEXT: ret void
}
@@ -111,7 +111,7 @@ define double @test10(i8* %X) {
store i8* %X, i8** %X_addr
%tmp.0 = va_arg i8** %X_addr, double
ret double %tmp.0
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK: store
}
@@ -119,7 +119,7 @@ define double @test10(i8* %X) {
; DSE should delete the dead trampoline.
declare void @test11f()
define void @test11() {
-; CHECK: @test11
+; CHECK-LABEL: @test11(
%storage = alloca [10 x i8], align 16 ; <[10 x i8]*> [#uses=1]
; CHECK-NOT: alloca
%cast = getelementptr [10 x i8]* %storage, i32 0, i32 0 ; <i8*> [#uses=1]
@@ -140,7 +140,7 @@ define void @test12({ i32, i32 }* %x) nounwind {
store i32 %tmp5, i32* %tmp4, align 4
store i32 %tmp17, i32* %tmp7, align 4
ret void
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK-NOT: tmp5
; CHECK: ret void
}
@@ -173,7 +173,7 @@ define void @test14(i32* %Q) {
store i32 %DEAD, i32* %P
ret void
-; CHECK: @test14
+; CHECK-LABEL: @test14(
; CHECK-NEXT: ret void
}
@@ -185,7 +185,7 @@ define void @test15(i8* %P, i8* %Q) nounwind ssp {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false)
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false)
ret void
-; CHECK: @test15
+; CHECK-LABEL: @test15(
; CHECK-NEXT: call void @llvm.memcpy
; CHECK-NEXT: ret
}
@@ -195,7 +195,7 @@ define void @test16(i8* %P, i8* %Q) nounwind ssp {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 8, i32 1, i1 false)
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false)
ret void
-; CHECK: @test16
+; CHECK-LABEL: @test16(
; CHECK-NEXT: call void @llvm.memcpy
; CHECK-NEXT: ret
}
@@ -205,7 +205,7 @@ define void @test17(i8* %P, i8* noalias %Q) nounwind ssp {
tail call void @llvm.memset.p0i8.i64(i8* %P, i8 42, i64 8, i32 1, i1 false)
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false)
ret void
-; CHECK: @test17
+; CHECK-LABEL: @test17(
; CHECK-NEXT: call void @llvm.memcpy
; CHECK-NEXT: ret
}
@@ -215,7 +215,7 @@ define void @test17v(i8* %P, i8* %Q) nounwind ssp {
tail call void @llvm.memset.p0i8.i64(i8* %P, i8 42, i64 8, i32 1, i1 true)
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false)
ret void
-; CHECK: @test17v
+; CHECK-LABEL: @test17v(
; CHECK-NEXT: call void @llvm.memset
; CHECK-NEXT: call void @llvm.memcpy
; CHECK-NEXT: ret
@@ -229,7 +229,7 @@ define void @test18(i8* %P, i8* %Q, i8* %R) nounwind ssp {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false)
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %R, i64 12, i32 1, i1 false)
ret void
-; CHECK: @test18
+; CHECK-LABEL: @test18(
; CHECK-NEXT: call void @llvm.memcpy
; CHECK-NEXT: call void @llvm.memcpy
; CHECK-NEXT: ret
@@ -246,7 +246,7 @@ bb:
call void @test19f({i32}* byval align 4 %arg5)
ret void
-; CHECK: @test19(
+; CHECK-LABEL: @test19(
; CHECK: store i32 912
; CHECK: call void @test19f
}
@@ -256,10 +256,10 @@ define void @test20() {
store i8 0, i8* %m
ret void
}
-; CHECK: @test20
+; CHECK-LABEL: @test20(
; CHECK-NEXT: ret void
-; CHECK: @test21
+; CHECK-LABEL: @test21(
define void @test21() {
%m = call i8* @calloc(i32 9, i32 7)
store i8 0, i8* %m
@@ -267,7 +267,7 @@ define void @test21() {
ret void
}
-; CHECK: @test22(
+; CHECK-LABEL: @test22(
define void @test22(i1 %i, i32 %k, i32 %m) nounwind {
%k.addr = alloca i32
%m.addr = alloca i32
@@ -278,7 +278,7 @@ define void @test22(i1 %i, i32 %k, i32 %m) nounwind {
}
; PR13547
-; CHECK: @test23
+; CHECK-LABEL: @test23(
; CHECK: store i8 97
; CHECK: store i8 0
declare noalias i8* @strdup(i8* nocapture) nounwind
@@ -293,7 +293,7 @@ define noalias i8* @test23() nounwind uwtable ssp {
}
; Make sure same sized store to later element is deleted
-; CHECK: @test24
+; CHECK-LABEL: @test24(
; CHECK-NOT: store i32 0
; CHECK-NOT: store i32 0
; CHECK: store i32 %b
@@ -312,7 +312,7 @@ define void @test24([2 x i32]* %a, i32 %b, i32 %c) nounwind {
}
; Check another case like PR13547 where strdup is not like malloc.
-; CHECK: @test25
+; CHECK-LABEL: @test25(
; CHECK: load i8
; CHECK: store i8 0
; CHECK: store i8 %tmp
diff --git a/test/Transforms/DebugIR/crash.ll b/test/Transforms/DebugIR/crash.ll
new file mode 100644
index 000000000000..f4a88d7234cb
--- /dev/null
+++ b/test/Transforms/DebugIR/crash.ll
@@ -0,0 +1,42 @@
+; ModuleID = 'crash.c'
+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-pc-linux-gnu"
+
+@.str = private unnamed_addr constant [18 x i8] c"Hello, segfault!\0A\00", align 1
+@.str1 = private unnamed_addr constant [14 x i8] c"Now crash %d\0A\00", align 1
+
+; Function Attrs: nounwind uwtable
+define i32 @main(i32 %argc, i8** %argv) #0 {
+ %1 = alloca i32, align 4 ;CHECK: !dbg
+ %2 = alloca i32, align 4 ;CHECK-NEXT: !dbg
+ %3 = alloca i8**, align 8 ;CHECK-NEXT: !dbg
+ %null_ptr = alloca i32*, align 8 ;CHECK-NEXT: !dbg
+ store i32 0, i32* %1 ;CHECK-NEXT: !dbg
+ store i32 %argc, i32* %2, align 4 ;CHECK-NEXT: !dbg
+ store i8** %argv, i8*** %3, align 8 ;CHECK-NEXT: !dbg
+ store i32* null, i32** %null_ptr, align 8 ;CHECK-NEXT: !dbg
+ %4 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0)) ;CHECK-NEXT: !dbg
+ %5 = load i32** %null_ptr, align 8 ;CHECK-NEXT: !dbg
+ %6 = load i32* %5, align 4 ;CHECK-NEXT: !dbg
+ %7 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x i8]* @.str1, i32 0, i32 0), i32 %6) ;CHECK-NEXT: !dbg
+ %8 = load i32* %2, align 4 ;CHECK-NEXT: !dbg
+ ret i32 %8 ;CHECK-NEXT: !dbg
+}
+
+declare i32 @printf(i8*, ...) #1
+
+attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
+
+; CHECK: = metadata !{i32 14,
+; CHECK-NEXT: = metadata !{i32 15,
+; CHECK-NEXT: = metadata !{i32 16,
+; CHECK-NEXT: = metadata !{i32 17,
+; CHECK-NEXT: = metadata !{i32 18,
+; CHECK-NEXT: = metadata !{i32 19,
+; CHECK-NEXT: = metadata !{i32 20,
+; CHECK-NEXT: = metadata !{i32 21,
+; CHECK-NEXT: = metadata !{i32 22,
+; CHECK-NEXT: = metadata !{i32 23,
+
+; RUN: opt %s -debug-ir -S | FileCheck %s
diff --git a/test/Transforms/DebugIR/exception.ll b/test/Transforms/DebugIR/exception.ll
new file mode 100644
index 000000000000..2436d38968c9
--- /dev/null
+++ b/test/Transforms/DebugIR/exception.ll
@@ -0,0 +1,127 @@
+; ModuleID = 'exception.cpp'
+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-pc-linux-gnu"
+
+@_ZTIi = external constant i8*
+
+; Function Attrs: uwtable
+define i32 @main(i32 %argc, i8** %argv) #0 {
+ %1 = alloca i32, align 4 ; CHECK: !dbg
+ %2 = alloca i32, align 4 ; CHECK-NEXT: !dbg
+ %3 = alloca i8**, align 8 ; CHECK-NEXT: !dbg
+ %4 = alloca i8* ; CHECK-NEXT: !dbg
+ %5 = alloca i32 ; CHECK-NEXT: !dbg
+ %e = alloca i32, align 4 ; CHECK-NEXT: !dbg
+ %6 = alloca i32 ; CHECK-NEXT: !dbg
+ store i32 0, i32* %1 ; CHECK-NEXT: !dbg
+ store i32 %argc, i32* %2, align 4 ; CHECK-NEXT: !dbg
+ store i8** %argv, i8*** %3, align 8 ; CHECK-NEXT: !dbg
+ %7 = call i8* @__cxa_allocate_exception(i64 4) #2 ; CHECK-NEXT: !dbg
+ %8 = bitcast i8* %7 to i32* ; CHECK-NEXT: !dbg
+ %9 = load i32* %2, align 4 ; CHECK-NEXT: !dbg
+ store i32 %9, i32* %8 ; CHECK-NEXT: !dbg
+ invoke void @__cxa_throw(i8* %7, i8* bitcast (i8** @_ZTIi to i8*), i8* null) #3
+ to label %31 unwind label %10 ; CHECK: !dbg
+
+; <label>:10 ; preds = %0
+ %11 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ catch i8* bitcast (i8** @_ZTIi to i8*) ; CHECK: !dbg
+ %12 = extractvalue { i8*, i32 } %11, 0 ; CHECK-NEXT: !dbg
+ store i8* %12, i8** %4 ; CHECK-NEXT: !dbg
+ %13 = extractvalue { i8*, i32 } %11, 1 ; CHECK-NEXT: !dbg
+ store i32 %13, i32* %5 ; CHECK-NEXT: !dbg
+ br label %14 ; CHECK-NEXT: !dbg
+
+; <label>:14 ; preds = %10
+ %15 = load i32* %5 ; CHECK: !dbg
+ %16 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) #2 ; CHECK-NEXT: !dbg
+ %17 = icmp eq i32 %15, %16 ; CHECK-NEXT: !dbg
+ br i1 %17, label %18, label %26 ; CHECK-NEXT: !dbg
+
+; <label>:18 ; preds = %14
+ %19 = load i8** %4 ; CHECK: !dbg
+ %20 = call i8* @__cxa_begin_catch(i8* %19) #2 ; CHECK-NEXT: !dbg
+ %21 = bitcast i8* %20 to i32* ; CHECK-NEXT: !dbg
+ %22 = load i32* %21, align 4 ; CHECK-NEXT: !dbg
+ store i32 %22, i32* %e, align 4 ; CHECK-NEXT: !dbg
+ %23 = load i32* %e, align 4 ; CHECK-NEXT: !dbg
+ store i32 %23, i32* %1 ; CHECK-NEXT: !dbg
+ store i32 1, i32* %6 ; CHECK-NEXT: !dbg
+ call void @__cxa_end_catch() #2 ; CHECK-NEXT: !dbg
+ br label %24 ; CHECK-NEXT: !dbg
+
+; <label>:24 ; preds = %18
+ %25 = load i32* %1 ; CHECK: !dbg
+ ret i32 %25 ; CHECK-NEXT: !dbg
+
+; <label>:26 ; preds = %14
+ %27 = load i8** %4 ; CHECK: !dbg
+ %28 = load i32* %5 ; CHECK-NEXT: !dbg
+ %29 = insertvalue { i8*, i32 } undef, i8* %27, 0 ; CHECK-NEXT: !dbg
+ %30 = insertvalue { i8*, i32 } %29, i32 %28, 1 ; CHECK-NEXT: !dbg
+ resume { i8*, i32 } %30 ; CHECK-NEXT: !dbg
+
+; <label>:31 ; preds = %0
+ unreachable ; CHECK: !dbg
+}
+
+declare i8* @__cxa_allocate_exception(i64)
+
+declare void @__cxa_throw(i8*, i8*, i8*)
+
+declare i32 @__gxx_personality_v0(...)
+
+; Function Attrs: nounwind readnone
+declare i32 @llvm.eh.typeid.for(i8*) #1
+
+declare i8* @__cxa_begin_catch(i8*)
+
+declare void @__cxa_end_catch()
+
+attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nounwind readnone }
+attributes #2 = { nounwind }
+attributes #3 = { noreturn }
+; CHECK: = metadata !{i32 16,
+; CHECK-NEXT: = metadata !{i32 17,
+; CHECK-NEXT: = metadata !{i32 18,
+; CHECK-NEXT: = metadata !{i32 19,
+; CHECK-NEXT: = metadata !{i32 20,
+; CHECK-NEXT: = metadata !{i32 21,
+; CHECK-NEXT: = metadata !{i32 22,
+; CHECK-NEXT: = metadata !{i32 24,
+
+; CHECK-NEXT: = metadata !{i32 28,
+; CHECK-NEXT: = metadata !{i32 29,
+; CHECK-NEXT: = metadata !{i32 30,
+; CHECK-NEXT: = metadata !{i32 31,
+; CHECK-NEXT: = metadata !{i32 32,
+; CHECK-NEXT: = metadata !{i32 33,
+
+; CHECK-NEXT: = metadata !{i32 36,
+; CHECK-NEXT: = metadata !{i32 37,
+; CHECK-NEXT: = metadata !{i32 38,
+; CHECK-NEXT: = metadata !{i32 39,
+
+; CHECK-NEXT: = metadata !{i32 42,
+; CHECK-NEXT: = metadata !{i32 43,
+; CHECK-NEXT: = metadata !{i32 44,
+; CHECK-NEXT: = metadata !{i32 45,
+; CHECK-NEXT: = metadata !{i32 46,
+; CHECK-NEXT: = metadata !{i32 47,
+; CHECK-NEXT: = metadata !{i32 48,
+; CHECK-NEXT: = metadata !{i32 49,
+; CHECK-NEXT: = metadata !{i32 50,
+; CHECK-NEXT: = metadata !{i32 51,
+
+; CHECK-NEXT: = metadata !{i32 54,
+; CHECK-NEXT: = metadata !{i32 55,
+
+; CHECK-NEXT: = metadata !{i32 58,
+; CHECK-NEXT: = metadata !{i32 59,
+; CHECK-NEXT: = metadata !{i32 60,
+; CHECK-NEXT: = metadata !{i32 61,
+; CHECK-NEXT: = metadata !{i32 62,
+; CHECK-NEXT: = metadata !{i32 65,
+
+; RUN: opt %s -debug-ir -S | FileCheck %s
diff --git a/test/Transforms/DebugIR/function.ll b/test/Transforms/DebugIR/function.ll
new file mode 100644
index 000000000000..dba073de37e9
--- /dev/null
+++ b/test/Transforms/DebugIR/function.ll
@@ -0,0 +1,51 @@
+; ModuleID = 'function.c'
+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-pc-linux-gnu"
+
+; Function Attrs: nounwind uwtable
+define void @blah(i32* %i) #0 {
+ %1 = alloca i32*, align 8 ; CHECK: !dbg
+ store i32* %i, i32** %1, align 8 ; CHECK-NEXT: !dbg
+ %2 = load i32** %1, align 8 ; CHECK-NEXT: !dbg
+ %3 = load i32* %2, align 4 ; CHECK-NEXT: !dbg
+ %4 = add nsw i32 %3, 1 ; CHECK-NEXT: !dbg
+ store i32 %4, i32* %2, align 4 ; CHECK-NEXT: !dbg
+ ret void ; CHECK-NEXT: !dbg
+}
+
+; Function Attrs: nounwind uwtable
+define i32 @main(i32 %argc, i8** %argv) #0 {
+ %1 = alloca i32, align 4 ; CHECK: !dbg
+ %2 = alloca i32, align 4 ; CHECK-NEXT: !dbg
+ %3 = alloca i8**, align 8 ; CHECK-NEXT: !dbg
+ %i = alloca i32, align 4 ; CHECK-NEXT: !dbg
+ store i32 0, i32* %1 ; CHECK-NEXT: !dbg
+ store i32 %argc, i32* %2, align 4 ; CHECK-NEXT: !dbg
+ store i8** %argv, i8*** %3, align 8 ; CHECK-NEXT: !dbg
+ store i32 7, i32* %i, align 4 ; CHECK-NEXT: !dbg
+ call void @blah(i32* %i) ; CHECK-NEXT: !dbg
+ %4 = load i32* %i, align 4 ; CHECK-NEXT: !dbg
+ ret i32 %4 ; CHECK-NEXT: !dbg
+}
+
+attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
+; CHECK: = metadata !{i32 8,
+; CHECK-NEXT: = metadata !{i32 9,
+; CHECK-NEXT: = metadata !{i32 10,
+; CHECK-NEXT: = metadata !{i32 11,
+; CHECK-NEXT: = metadata !{i32 12,
+; CHECK-NEXT: = metadata !{i32 13,
+
+; CHECK-NEXT: = metadata !{i32 18,
+; CHECK-NEXT: = metadata !{i32 19,
+; CHECK-NEXT: = metadata !{i32 20,
+; CHECK-NEXT: = metadata !{i32 21,
+; CHECK-NEXT: = metadata !{i32 22,
+; CHECK-NEXT: = metadata !{i32 23,
+; CHECK-NEXT: = metadata !{i32 24,
+; CHECK-NEXT: = metadata !{i32 25,
+; CHECK-NEXT: = metadata !{i32 26,
+; CHECK-NEXT: = metadata !{i32 27,
+; CHECK-NEXT: = metadata !{i32 28,
+
+; RUN: opt %s -debug-ir -S | FileCheck %s
diff --git a/test/Transforms/DebugIR/simple-addrspace.ll b/test/Transforms/DebugIR/simple-addrspace.ll
new file mode 100644
index 000000000000..6bea9b269f57
--- /dev/null
+++ b/test/Transforms/DebugIR/simple-addrspace.ll
@@ -0,0 +1,13 @@
+; RUN: opt -debug-ir -S %s -o - | FileCheck %s
+
+target datalayout = "e-p:64:64:64-p1:16:16:16"
+
+define void @foo(i32 addrspace(1)*) nounwind {
+ ret void
+}
+
+; Make sure the pointer size is 16
+
+; CHECK: metadata !"i32 addrspace(1)*", i32 0, i64 16, i64 2, i64 0, i32 0
+
+
diff --git a/test/Transforms/DebugIR/simple.ll b/test/Transforms/DebugIR/simple.ll
new file mode 100644
index 000000000000..3b188958261f
--- /dev/null
+++ b/test/Transforms/DebugIR/simple.ll
@@ -0,0 +1,25 @@
+; ModuleID = 'simple.c'
+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-pc-linux-gnu"
+
+; Function Attrs: nounwind uwtable
+define i32 @main(i32 %argc, i8** %argv) #0 {
+ %1 = alloca i32, align 4 ; CHECK: !dbg
+ %2 = alloca i32, align 4 ; CHECK-NEXT: !dbg
+ %3 = alloca i8**, align 8 ; CHECK-NEXT: !dbg
+ store i32 0, i32* %1 ; CHECK-NEXT: !dbg
+ store i32 %argc, i32* %2, align 4 ; CHECK-NEXT: !dbg
+ store i8** %argv, i8*** %3, align 8 ; CHECK-NEXT: !dbg
+ %4 = load i32* %2, align 4 ; CHECK-NEXT: !dbg
+ ret i32 %4 ; CHECK-NEXT: !dbg
+}
+
+attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
+
+; CHECK: = metadata !{i32 10,
+; CHECK-NEXT: = metadata !{i32 11,
+; CHECK-NEXT: = metadata !{i32 12,
+; CHECK-NEXT: = metadata !{i32 13,
+; CHECK-NEXT: = metadata !{i32 14,
+
+; RUN: opt %s -debug-ir -S | FileCheck %s
diff --git a/test/Transforms/DebugIR/struct.ll b/test/Transforms/DebugIR/struct.ll
new file mode 100644
index 000000000000..8db3dbebe90b
--- /dev/null
+++ b/test/Transforms/DebugIR/struct.ll
@@ -0,0 +1,24 @@
+; ModuleID = 'struct.cpp'
+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-pc-linux-gnu"
+
+%struct.blah = type { i32, float, i8 }
+
+; Function Attrs: nounwind uwtable
+define i32 @main() #0 {
+ %1 = alloca i32, align 4 ; CHECK: !dbg
+ %b = alloca %struct.blah, align 4 ; CHECK-NEXT: !dbg
+ store i32 0, i32* %1 ; CHECK-NEXT: !dbg
+ %2 = getelementptr inbounds %struct.blah* %b, i32 0, i32 0 ; CHECK-NEXT: !dbg
+ %3 = load i32* %2, align 4 ; CHECK-NEXT: !dbg
+ ret i32 %3 ; CHECK-NEXT: !dbg
+}
+
+attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
+
+; CHECK: = metadata !{i32 11,
+; CHECK-NEXT: = metadata !{i32 12,
+; CHECK-NEXT: = metadata !{i32 13,
+; CHECK-NEXT: = metadata !{i32 14,
+
+; RUN: opt %s -debug-ir -S | FileCheck %s
diff --git a/test/Transforms/DebugIR/vector.ll b/test/Transforms/DebugIR/vector.ll
new file mode 100644
index 000000000000..50d99ac2254f
--- /dev/null
+++ b/test/Transforms/DebugIR/vector.ll
@@ -0,0 +1,93 @@
+; ModuleID = 'vector.cpp'
+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-pc-linux-gnu"
+
+; Function Attrs: noinline nounwind uwtable
+define <4 x float> @_Z3fooDv2_fS_(double %a.coerce, double %b.coerce) #0 {
+ %1 = alloca <2 x float>, align 8 ; CHECK: !dbg
+ %2 = alloca <2 x float>, align 8 ; CHECK-NEXT: !dbg
+ %3 = alloca <2 x float>, align 8 ; CHECK-NEXT: !dbg
+ %4 = alloca <2 x float>, align 8 ; CHECK-NEXT: !dbg
+ %c = alloca <4 x float>, align 16 ; CHECK-NEXT: !dbg
+ %5 = bitcast <2 x float>* %1 to double* ; CHECK-NEXT: !dbg
+ store double %a.coerce, double* %5, align 1 ; CHECK-NEXT: !dbg
+ %a = load <2 x float>* %1, align 8 ; CHECK-NEXT: !dbg
+ store <2 x float> %a, <2 x float>* %2, align 8 ; CHECK-NEXT: !dbg
+ %6 = bitcast <2 x float>* %3 to double* ; CHECK-NEXT: !dbg
+ store double %b.coerce, double* %6, align 1 ; CHECK-NEXT: !dbg
+ %b = load <2 x float>* %3, align 8 ; CHECK-NEXT: !dbg
+ store <2 x float> %b, <2 x float>* %4, align 8 ; CHECK-NEXT: !dbg
+ %7 = load <2 x float>* %2, align 8 ; CHECK-NEXT: !dbg
+ %8 = load <4 x float>* %c, align 16 ; CHECK-NEXT: !dbg
+ %9 = shufflevector <2 x float> %7, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef> ; CHECK-NEXT: !dbg
+ %10 = shufflevector <4 x float> %8, <4 x float> %9, <4 x i32> <i32 4, i32 1, i32 5, i32 3> ; CHECK-NEXT: !dbg
+ store <4 x float> %10, <4 x float>* %c, align 16 ; CHECK-NEXT: !dbg
+ %11 = load <2 x float>* %4, align 8 ; CHECK-NEXT: !dbg
+ %12 = load <4 x float>* %c, align 16 ; CHECK-NEXT: !dbg
+ %13 = shufflevector <2 x float> %11, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef> ; CHECK-NEXT: !dbg
+ %14 = shufflevector <4 x float> %12, <4 x float> %13, <4 x i32> <i32 0, i32 4, i32 2, i32 5> ; CHECK-NEXT: !dbg
+ store <4 x float> %14, <4 x float>* %c, align 16 ; CHECK-NEXT: !dbg
+ %15 = load <4 x float>* %c, align 16 ; CHECK-NEXT: !dbg
+ ret <4 x float> %15 ; CHECK-NEXT: !dbg
+}
+
+; Function Attrs: nounwind uwtable
+define i32 @main() #1 {
+ %1 = alloca i32, align 4 ; CHECK: !dbg
+ %a = alloca <2 x float>, align 8 ; CHECK-NEXT: !dbg
+ %b = alloca <2 x float>, align 8 ; CHECK-NEXT: !dbg
+ %x = alloca <4 x float>, align 16 ; CHECK-NEXT: !dbg
+ %2 = alloca <2 x float>, align 8 ; CHECK-NEXT: !dbg
+ %3 = alloca <2 x float>, align 8 ; CHECK-NEXT: !dbg
+ store i32 0, i32* %1 ; CHECK-NEXT: !dbg
+ store <2 x float> <float 1.000000e+00, float 2.000000e+00>, <2 x float>* %a, align 8 ; CHECK-NEXT: !dbg
+ store <2 x float> <float 1.000000e+00, float 2.000000e+00>, <2 x float>* %b, align 8 ; CHECK-NEXT: !dbg
+ %4 = load <2 x float>* %a, align 8 ; CHECK-NEXT: !dbg
+ %5 = load <2 x float>* %b, align 8 ; CHECK-NEXT: !dbg
+ store <2 x float> %4, <2 x float>* %2, align 8 ; CHECK-NEXT: !dbg
+ %6 = bitcast <2 x float>* %2 to double* ; CHECK-NEXT: !dbg
+ %7 = load double* %6, align 1 ; CHECK-NEXT: !dbg
+ store <2 x float> %5, <2 x float>* %3, align 8 ; CHECK-NEXT: !dbg
+ %8 = bitcast <2 x float>* %3 to double* ; CHECK-NEXT: !dbg
+ %9 = load double* %8, align 1 ; CHECK-NEXT: !dbg
+ %10 = call <4 x float> @_Z3fooDv2_fS_(double %7, double %9) ; CHECK-NEXT: !dbg
+ store <4 x float> %10, <4 x float>* %x, align 16 ; CHECK-NEXT: !dbg
+ %11 = load <4 x float>* %x, align 16 ; CHECK-NEXT: !dbg
+ %12 = extractelement <4 x float> %11, i32 0 ; CHECK-NEXT: !dbg
+ %13 = load <4 x float>* %x, align 16 ; CHECK-NEXT: !dbg
+ %14 = extractelement <4 x float> %13, i32 1 ; CHECK-NEXT: !dbg
+ %15 = fadd float %12, %14 ; CHECK-NEXT: !dbg
+ %16 = load <4 x float>* %x, align 16 ; CHECK-NEXT: !dbg
+ %17 = extractelement <4 x float> %16, i32 2 ; CHECK-NEXT: !dbg
+ %18 = fadd float %15, %17 ; CHECK-NEXT: !dbg
+ %19 = load <4 x float>* %x, align 16 ; CHECK-NEXT: !dbg
+ %20 = extractelement <4 x float> %19, i32 3 ; CHECK-NEXT: !dbg
+ %21 = fadd float %18, %20 ; CHECK-NEXT: !dbg
+ %22 = fptosi float %21 to i32 ; CHECK-NEXT: !dbg
+ ret i32 %22 ; CHECK-NEXT: !dbg
+}
+
+attributes #0 = { noinline nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
+
+; CHECK: = metadata !{i32 13,
+; CHECK-NEXT: = metadata !{i32 14,
+; CHECK-NEXT: = metadata !{i32 15,
+; CHECK-NEXT: = metadata !{i32 16,
+; CHECK-NEXT: = metadata !{i32 17,
+; CHECK-NEXT: = metadata !{i32 18,
+; CHECK-NEXT: = metadata !{i32 19,
+; CHECK-NEXT: = metadata !{i32 20,
+; CHECK-NEXT: = metadata !{i32 21,
+; CHECK-NEXT: = metadata !{i32 22,
+; CHECK-NEXT: = metadata !{i32 23,
+; CHECK-NEXT: = metadata !{i32 24,
+; CHECK-NEXT: = metadata !{i32 25,
+; CHECK-NEXT: = metadata !{i32 26,
+; CHECK-NEXT: = metadata !{i32 27,
+; CHECK-NEXT: = metadata !{i32 28,
+; CHECK-NEXT: = metadata !{i32 29,
+; CHECK-NEXT: = metadata !{i32 30,
+; CHECK-NEXT: = metadata !{i32 31,
+
+; RUN: opt %s -debug-ir -S | FileCheck %s
diff --git a/test/Transforms/EarlyCSE/basic.ll b/test/Transforms/EarlyCSE/basic.ll
index 32c302c9205b..80704df9852e 100644
--- a/test/Transforms/EarlyCSE/basic.ll
+++ b/test/Transforms/EarlyCSE/basic.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -S -early-cse | FileCheck %s
-; CHECK: @test1
+; CHECK-LABEL: @test1(
define void @test1(i8 %V, i32 *%P) {
%A = bitcast i64 42 to double ;; dead
%B = add i32 4, 19 ;; constant folds
@@ -33,7 +33,7 @@ define void @test1(i8 %V, i32 *%P) {
;; Simple load value numbering.
-; CHECK: @test2
+; CHECK-LABEL: @test2(
define i32 @test2(i32 *%P) {
%V1 = load i32* %P
%V2 = load i32* %P
@@ -43,7 +43,7 @@ define i32 @test2(i32 *%P) {
}
;; Cross block load value numbering.
-; CHECK: @test3
+; CHECK-LABEL: @test3(
define i32 @test3(i32 *%P, i1 %Cond) {
%V1 = load i32* %P
br i1 %Cond, label %T, label %F
@@ -59,7 +59,7 @@ F:
}
;; Cross block load value numbering stops when stores happen.
-; CHECK: @test4
+; CHECK-LABEL: @test4(
define i32 @test4(i32 *%P, i1 %Cond) {
%V1 = load i32* %P
br i1 %Cond, label %T, label %F
@@ -79,7 +79,7 @@ F:
declare i32 @func(i32 *%P) readonly
;; Simple call CSE'ing.
-; CHECK: @test5
+; CHECK-LABEL: @test5(
define i32 @test5(i32 *%P) {
%V1 = call i32 @func(i32* %P)
%V2 = call i32 @func(i32* %P)
@@ -89,7 +89,7 @@ define i32 @test5(i32 *%P) {
}
;; Trivial Store->load forwarding
-; CHECK: @test6
+; CHECK-LABEL: @test6(
define i32 @test6(i32 *%P) {
store i32 42, i32* %P
%V1 = load i32* %P
@@ -98,7 +98,7 @@ define i32 @test6(i32 *%P) {
}
;; Trivial dead store elimination.
-; CHECK: @test7
+; CHECK-LABEL: @test7(
define void @test7(i32 *%P) {
store i32 42, i32* %P
store i32 45, i32* %P
@@ -108,7 +108,7 @@ define void @test7(i32 *%P) {
}
;; Readnone functions aren't invalidated by stores.
-; CHECK: @test8
+; CHECK-LABEL: @test8(
define i32 @test8(i32 *%P) {
%V1 = call i32 @func(i32* %P) readnone
store i32 4, i32* %P
diff --git a/test/Transforms/EarlyCSE/commute.ll b/test/Transforms/EarlyCSE/commute.ll
index 8cf04d1765b9..985fe04ab3cf 100644
--- a/test/Transforms/EarlyCSE/commute.ll
+++ b/test/Transforms/EarlyCSE/commute.ll
@@ -1,6 +1,6 @@
; RUN: opt < %s -S -early-cse | FileCheck %s
-; CHECK: @test1
+; CHECK-LABEL: @test1(
define void @test1(float %A, float %B, float* %PA, float* %PB) {
; CHECK-NEXT: fadd
; CHECK-NEXT: store
@@ -13,7 +13,7 @@ define void @test1(float %A, float %B, float* %PA, float* %PB) {
ret void
}
-; CHECK: @test2
+; CHECK-LABEL: @test2(
define void @test2(float %A, float %B, i1* %PA, i1* %PB) {
; CHECK-NEXT: fcmp
; CHECK-NEXT: store
@@ -26,7 +26,7 @@ define void @test2(float %A, float %B, i1* %PA, i1* %PB) {
ret void
}
-; CHECK: @test3
+; CHECK-LABEL: @test3(
define void @test3(float %A, float %B, i1* %PA, i1* %PB) {
; CHECK-NEXT: fcmp
; CHECK-NEXT: store
@@ -39,7 +39,7 @@ define void @test3(float %A, float %B, i1* %PA, i1* %PB) {
ret void
}
-; CHECK: @test4
+; CHECK-LABEL: @test4(
define void @test4(i32 %A, i32 %B, i1* %PA, i1* %PB) {
; CHECK-NEXT: icmp
; CHECK-NEXT: store
@@ -52,7 +52,7 @@ define void @test4(i32 %A, i32 %B, i1* %PA, i1* %PB) {
ret void
}
-; CHECK: @test5
+; CHECK-LABEL: @test5(
define void @test5(i32 %A, i32 %B, i1* %PA, i1* %PB) {
; CHECK-NEXT: icmp
; CHECK-NEXT: store
diff --git a/test/Transforms/EarlyCSE/instsimplify-dom.ll b/test/Transforms/EarlyCSE/instsimplify-dom.ll
index 36dffec1c63c..ebdd7f9b419f 100644
--- a/test/Transforms/EarlyCSE/instsimplify-dom.ll
+++ b/test/Transforms/EarlyCSE/instsimplify-dom.ll
@@ -16,4 +16,4 @@ xxx:
br label %lbl_1215
}
-; CHECK: define i32 @fn
+; CHECK-LABEL: define i32 @fn(
diff --git a/test/Transforms/EarlyCSE/lit.local.cfg b/test/Transforms/EarlyCSE/lit.local.cfg
deleted file mode 100644
index c6106e4746f2..000000000000
--- a/test/Transforms/EarlyCSE/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll']
diff --git a/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll b/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
index f38c03acca34..0cf1cb7c638d 100644
--- a/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
+++ b/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
@@ -1,14 +1,23 @@
-; RUN: opt < %s -functionattrs -S | not grep "nocapture *%%q"
-; RUN: opt < %s -functionattrs -S | grep "nocapture *%%p"
+; RUN: opt < %s -functionattrs -S | FileCheck %s
+; CHECK: define i32* @a(i32** nocapture readonly %p)
define i32* @a(i32** %p) {
%tmp = load i32** %p
ret i32* %tmp
}
+; CHECK: define i32* @b(i32* %q)
define i32* @b(i32 *%q) {
%mem = alloca i32*
store i32* %q, i32** %mem
%tmp = call i32* @a(i32** %mem)
ret i32* %tmp
}
+
+; CHECK: define i32* @c(i32* readnone %r)
+@g = global i32 0
+define i32* @c(i32 *%r) {
+ %a = icmp eq i32* %r, null
+ store i32 1, i32* @g
+ ret i32* %r
+}
diff --git a/test/Transforms/FunctionAttrs/2009-01-04-Annotate.ll b/test/Transforms/FunctionAttrs/2009-01-04-Annotate.ll
index d414b73524fd..fa06cc718a93 100644
--- a/test/Transforms/FunctionAttrs/2009-01-04-Annotate.ll
+++ b/test/Transforms/FunctionAttrs/2009-01-04-Annotate.ll
@@ -1,6 +1,6 @@
; RUN: opt < %s -functionattrs -S | FileCheck %s
-; CHECK: declare noalias i8* @fopen(i8* nocapture, i8* nocapture) #0
+; CHECK: declare noalias i8* @fopen(i8* nocapture readonly, i8* nocapture readonly) #0
declare i8* @fopen(i8*, i8*)
; CHECK: declare i8 @strlen(i8* nocapture) #1
diff --git a/test/Transforms/FunctionAttrs/annotate-1.ll b/test/Transforms/FunctionAttrs/annotate-1.ll
index ae77380acc4a..9fba7a9f2882 100644
--- a/test/Transforms/FunctionAttrs/annotate-1.ll
+++ b/test/Transforms/FunctionAttrs/annotate-1.ll
@@ -1,7 +1,8 @@
; RUN: opt < %s -functionattrs -S | FileCheck %s
+; RUN: opt < %s -mtriple=x86_64-apple-macosx10.8.0 -functionattrs -S | FileCheck -check-prefix=CHECK-POSIX %s
declare i8* @fopen(i8*, i8*)
-; CHECK: declare noalias i8* @fopen(i8* nocapture, i8* nocapture) [[G0:#[0-9]]]
+; CHECK: declare noalias i8* @fopen(i8* nocapture readonly, i8* nocapture readonly) [[G0:#[0-9]]]
declare i8 @strlen(i8*)
; CHECK: declare i8 @strlen(i8* nocapture) [[G1:#[0-9]]]
@@ -14,5 +15,9 @@ declare i32* @realloc(i32*, i32)
declare i32 @strcpy(...)
; CHECK: declare i32 @strcpy(...)
+declare i32 @gettimeofday(i8*, i8*)
+; CHECK-POSIX: declare i32 @gettimeofday(i8* nocapture, i8* nocapture) [[G0:#[0-9]+]]
+
; CHECK: attributes [[G0]] = { nounwind }
; CHECK: attributes [[G1]] = { nounwind readonly }
+; CHECK-POSIX: attributes [[G0]] = { nounwind }
diff --git a/test/Transforms/FunctionAttrs/atomic.ll b/test/Transforms/FunctionAttrs/atomic.ll
index 027ee0fd06a2..d5a8db7d53b9 100644
--- a/test/Transforms/FunctionAttrs/atomic.ll
+++ b/test/Transforms/FunctionAttrs/atomic.ll
@@ -13,7 +13,7 @@ entry:
; A function with an Acquire load is not readonly.
define i32 @test2(i32* %x) uwtable ssp {
-; CHECK: define i32 @test2(i32* nocapture %x) #1 {
+; CHECK: define i32 @test2(i32* nocapture readonly %x) #1 {
entry:
%r = load atomic i32* %x seq_cst, align 4
ret i32 %r
diff --git a/test/Transforms/FunctionAttrs/lit.local.cfg b/test/Transforms/FunctionAttrs/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/FunctionAttrs/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/FunctionAttrs/nocapture.ll b/test/Transforms/FunctionAttrs/nocapture.ll
index 3027acd35c7d..110bd03dac73 100644
--- a/test/Transforms/FunctionAttrs/nocapture.ll
+++ b/test/Transforms/FunctionAttrs/nocapture.ll
@@ -1,12 +1,13 @@
; RUN: opt < %s -functionattrs -S | FileCheck %s
@g = global i32* null ; <i32**> [#uses=1]
-; CHECK: define i32* @c1(i32* %q)
+; CHECK: define i32* @c1(i32* readnone %q)
define i32* @c1(i32* %q) {
ret i32* %q
}
; CHECK: define void @c2(i32* %q)
+; It would also be acceptable to mark %q as readnone. Update @c3 too.
define void @c2(i32* %q) {
store i32* %q, i32** @g
ret void
@@ -45,7 +46,7 @@ define i1 @c5(i32* %q, i32 %bitno) {
declare void @throw_if_bit_set(i8*, i8) readonly
-; CHECK: define i1 @c6(i8* %q, i8 %bit)
+; CHECK: define i1 @c6(i8* readonly %q, i8 %bit)
define i1 @c6(i8* %q, i8 %bit) {
invoke void @throw_if_bit_set(i8* %q, i8 %bit)
to label %ret0 unwind label %ret1
@@ -67,7 +68,7 @@ define i1* @lookup_bit(i32* %q, i32 %bitno) readnone nounwind {
ret i1* %lookup
}
-; CHECK: define i1 @c7(i32* %q, i32 %bitno)
+; CHECK: define i1 @c7(i32* readnone %q, i32 %bitno)
define i1 @c7(i32* %q, i32 %bitno) {
%ptr = call i1* @lookup_bit(i32* %q, i32 %bitno)
%val = load i1* %ptr
@@ -103,7 +104,7 @@ define void @nc3(void ()* %p) {
}
declare void @external(i8*) readonly nounwind
-; CHECK: define void @nc4(i8* nocapture %p)
+; CHECK: define void @nc4(i8* nocapture readonly %p)
define void @nc4(i8* %p) {
call void @external(i8* %p)
ret void
@@ -116,28 +117,29 @@ define void @nc5(void (i8*)* %f, i8* %p) {
ret void
}
-; CHECK: define void @test1_1(i8* nocapture %x1_1, i8* %y1_1)
+; CHECK: define void @test1_1(i8* nocapture readnone %x1_1, i8* %y1_1)
+; It would be acceptable to add readnone to %y1_1 and %y1_2.
define void @test1_1(i8* %x1_1, i8* %y1_1) {
call i8* @test1_2(i8* %x1_1, i8* %y1_1)
store i32* null, i32** @g
ret void
}
-; CHECK: define i8* @test1_2(i8* nocapture %x1_2, i8* %y1_2)
+; CHECK: define i8* @test1_2(i8* nocapture readnone %x1_2, i8* %y1_2)
define i8* @test1_2(i8* %x1_2, i8* %y1_2) {
call void @test1_1(i8* %x1_2, i8* %y1_2)
store i32* null, i32** @g
ret i8* %y1_2
}
-; CHECK: define void @test2(i8* nocapture %x2)
+; CHECK: define void @test2(i8* nocapture readnone %x2)
define void @test2(i8* %x2) {
call void @test2(i8* %x2)
store i32* null, i32** @g
ret void
}
-; CHECK: define void @test3(i8* nocapture %x3, i8* nocapture %y3, i8* nocapture %z3)
+; CHECK: define void @test3(i8* nocapture readnone %x3, i8* nocapture readnone %y3, i8* nocapture readnone %z3)
define void @test3(i8* %x3, i8* %y3, i8* %z3) {
call void @test3(i8* %z3, i8* %y3, i8* %x3)
store i32* null, i32** @g
@@ -151,7 +153,7 @@ define void @test4_1(i8* %x4_1) {
ret void
}
-; CHECK: define i8* @test4_2(i8* nocapture %x4_2, i8* %y4_2, i8* nocapture %z4_2)
+; CHECK: define i8* @test4_2(i8* nocapture readnone %x4_2, i8* readnone %y4_2, i8* nocapture readnone %z4_2)
define i8* @test4_2(i8* %x4_2, i8* %y4_2, i8* %z4_2) {
call void @test4_1(i8* null)
store i32* null, i32** @g
diff --git a/test/Transforms/FunctionAttrs/noreturn.ll b/test/Transforms/FunctionAttrs/noreturn.ll
index 470ebcb1d3cd..990bea984dfe 100644
--- a/test/Transforms/FunctionAttrs/noreturn.ll
+++ b/test/Transforms/FunctionAttrs/noreturn.ll
@@ -7,7 +7,7 @@ entry:
while.body:
br label %while.body
}
-;CHECK: @main
+;CHECK-LABEL: @main(
;CHECK: endless_loop
;CHECK: ret
define i32 @main() noreturn nounwind ssp uwtable {
diff --git a/test/Transforms/FunctionAttrs/readattrs.ll b/test/Transforms/FunctionAttrs/readattrs.ll
new file mode 100644
index 000000000000..0842f566d124
--- /dev/null
+++ b/test/Transforms/FunctionAttrs/readattrs.ll
@@ -0,0 +1,47 @@
+; RUN: opt < %s -functionattrs -S | FileCheck %s
+@x = global i32 0
+
+declare void @test1_1(i8* %x1_1, i8* readonly %y1_1, ...)
+
+; CHECK: define void @test1_2(i8* %x1_2, i8* readonly %y1_2, i8* %z1_2)
+define void @test1_2(i8* %x1_2, i8* %y1_2, i8* %z1_2) {
+ call void (i8*, i8*, ...)* @test1_1(i8* %x1_2, i8* %y1_2, i8* %z1_2)
+ store i32 0, i32* @x
+ ret void
+}
+
+; CHECK: define i8* @test2(i8* readnone %p)
+define i8* @test2(i8* %p) {
+ store i32 0, i32* @x
+ ret i8* %p
+}
+
+; CHECK: define i1 @test3(i8* readnone %p, i8* readnone %q)
+define i1 @test3(i8* %p, i8* %q) {
+ %A = icmp ult i8* %p, %q
+ ret i1 %A
+}
+
+declare void @test4_1(i8* nocapture) readonly
+
+; CHECK: define void @test4_2(i8* nocapture readonly %p)
+define void @test4_2(i8* %p) {
+ call void @test4_1(i8* %p)
+ ret void
+}
+
+; CHECK: define void @test5(i8** nocapture %p, i8* %q)
+; Missed optz'n: we could make %q readnone, but don't break test6!
+define void @test5(i8** %p, i8* %q) {
+ store i8* %q, i8** %p
+ ret void
+}
+
+declare void @test6_1()
+; CHECK: define void @test6_2(i8** nocapture %p, i8* %q)
+; This is not a missed optz'n.
+define void @test6_2(i8** %p, i8* %q) {
+ store i8* %q, i8** %p
+ call void @test6_1()
+ ret void
+}
diff --git a/test/Transforms/GCOVProfiling/linkagename.ll b/test/Transforms/GCOVProfiling/linkagename.ll
index 7ce4d861f0e0..ed3a5bd93ada 100644
--- a/test/Transforms/GCOVProfiling/linkagename.ll
+++ b/test/Transforms/GCOVProfiling/linkagename.ll
@@ -12,16 +12,18 @@ entry:
}
!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!10}
!llvm.gcov = !{!9}
-!0 = metadata !{i32 786449, i32 4, metadata !1, metadata !"clang version 3.3 (trunk 177323)", i1 false, metadata !"", i32 0, metadata !3, metadata !3, metadata !4, metadata !3, metadata !3, metadata !""} ; [ DW_TAG_compile_unit ] [/home/nlewycky/hello.cc] [DW_LANG_C_plus_plus]
+!0 = metadata !{i32 786449, metadata !2, i32 4, metadata !"clang version 3.3 (trunk 177323)", i1 false, metadata !"", i32 0, metadata !3, metadata !3, metadata !4, metadata !3, metadata !3, metadata !""} ; [ DW_TAG_compile_unit ] [/home/nlewycky/hello.cc] [DW_LANG_C_plus_plus]
!1 = metadata !{i32 786473, metadata !2} ; [ DW_TAG_file_type ] [/home/nlewycky/hello.cc]
!2 = metadata !{metadata !"hello.cc", metadata !"/home/nlewycky"}
!3 = metadata !{i32 0}
!4 = metadata !{metadata !5}
!5 = metadata !{i32 786478, metadata !1, metadata !1, metadata !"foo", metadata !"foo", metadata !"_Z3foov", i32 1, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @_Z3foov, null, null, metadata !3, i32 1} ; [ DW_TAG_subprogram ] [line 1] [def] [foo]
-!6 = metadata !{i32 786453, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
+!6 = metadata !{i32 786453, i32 0, null, i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!7 = metadata !{null}
!8 = metadata !{i32 1, i32 0, metadata !5, null}
+!10 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/GCOVProfiling/lit.local.cfg b/test/Transforms/GCOVProfiling/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/GCOVProfiling/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/GCOVProfiling/version.ll b/test/Transforms/GCOVProfiling/version.ll
index d6d0f3314c26..2f1bd70f6df9 100644
--- a/test/Transforms/GCOVProfiling/version.ll
+++ b/test/Transforms/GCOVProfiling/version.ll
@@ -16,14 +16,17 @@ define void @test() {
!llvm.gcov = !{!9}
!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!12}
-!0 = metadata !{metadata !"./version", metadata !1}
-!1 = metadata !{i32 786449, i32 0, i32 4, metadata !2, metadata !"clang version 3.3 (trunk 176994)", i1 false, metadata !"", i32 0, metadata !3, metadata !3, metadata !4, metadata !3, metadata !""} ; [ DW_TAG_compile_unit ] [./version] [DW_LANG_C_plus_plus]
-!2 = metadata !{i32 786473, metadata !"version", metadata !"/usr/local/google/home/nlewycky"} ; [ DW_TAG_file_type ]
+!0 = metadata !{i32 786449, metadata !11, i32 4, metadata !"clang version 3.3 (trunk 176994)", i1 false, metadata !"", i32 0, metadata !3, metadata !3, metadata !4, metadata !3, null, metadata !""} ; [ DW_TAG_compile_unit ] [./version] [DW_LANG_C_plus_plus]
+!2 = metadata !{i32 786473, metadata !11} ; [ DW_TAG_file_type ]
!3 = metadata !{i32 0}
!4 = metadata !{metadata !5}
-!5 = metadata !{i32 786478, i32 0, metadata !6, metadata !"test", metadata !"test", metadata !"", metadata !6, i32 1, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @test, null, null, metadata !3, i32 1} ; [ DW_TAG_subprogram ] [line 1] [def] [test]
-!6 = metadata !{i32 786473, metadata !"<stdin>", metadata !"."} ; [ DW_TAG_file_type ]
-!7 = metadata !{i32 786453, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !3, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
+!5 = metadata !{i32 786478, metadata !10, metadata !6, metadata !"test", metadata !"test", metadata !"", i32 1, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @test, null, null, metadata !3, i32 1} ; [ DW_TAG_subprogram ] [line 1] [def] [test]
+!6 = metadata !{i32 786473, metadata !10} ; [ DW_TAG_file_type ]
+!7 = metadata !{i32 786453, i32 0, null, i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !3, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!8 = metadata !{i32 1, i32 0, metadata !5, null}
;; !9 is added through the echo line at the top.
+!10 = metadata !{metadata !"<stdin>", metadata !"."}
+!11 = metadata !{metadata !"version", metadata !"/usr/local/google/home/nlewycky"}
+!12 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll b/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll
index a1cc0083f1e6..5a15f0e43aaf 100644
--- a/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll
+++ b/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll
@@ -2,7 +2,7 @@
@last = external global [65 x i32*]
-define i32 @NextRootMove(i32 %wtm) {
+define i32 @NextRootMove(i32 %wtm, i32 %x, i32 %y, i32 %z) {
entry:
%A = alloca i32*
%tmp17618 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4
@@ -15,12 +15,14 @@ entry:
br label %cond_true116
cond_true116:
- br i1 false, label %cond_true128, label %cond_true145
+ %cmp = icmp eq i32 %x, %y
+ br i1 %cmp, label %cond_true128, label %cond_true145
cond_true128:
%tmp17625 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4
store i32* %tmp17625, i32** %A
- br i1 false, label %bb98.backedge, label %return.loopexit
+ %cmp1 = icmp eq i32 %x, %z
+ br i1 %cmp1 , label %bb98.backedge, label %return.loopexit
bb98.backedge:
br label %cond_true116
diff --git a/test/Transforms/GVN/2008-07-02-Unreachable.ll b/test/Transforms/GVN/2008-07-02-Unreachable.ll
index 4f07868a1ccb..ce83fa4e4be9 100644
--- a/test/Transforms/GVN/2008-07-02-Unreachable.ll
+++ b/test/Transforms/GVN/2008-07-02-Unreachable.ll
@@ -3,10 +3,11 @@
@g_3 = external global i8 ; <i8*> [#uses=2]
-define i8 @func_1() nounwind {
+define i8 @func_1(i32 %x, i32 %y) nounwind {
entry:
%A = alloca i8
- br i1 false, label %ifelse, label %ifthen
+ %cmp = icmp eq i32 %x, %y
+ br i1 %cmp, label %ifelse, label %ifthen
ifthen: ; preds = %entry
br label %ifend
@@ -14,9 +15,6 @@ ifthen: ; preds = %entry
ifelse: ; preds = %entry
%tmp3 = load i8* @g_3 ; <i8> [#uses=0]
store i8 %tmp3, i8* %A
- br label %forcond.thread
-
-forcond.thread: ; preds = %ifelse
br label %afterfor
forcond: ; preds = %forinc
diff --git a/test/Transforms/GVN/2010-11-13-Simplify.ll b/test/Transforms/GVN/2010-11-13-Simplify.ll
index 07585a20b6ca..9d0becc4d0ea 100644
--- a/test/Transforms/GVN/2010-11-13-Simplify.ll
+++ b/test/Transforms/GVN/2010-11-13-Simplify.ll
@@ -3,7 +3,7 @@
declare i32 @foo(i32) readnone
define i1 @bar() {
-; CHECK: @bar
+; CHECK-LABEL: @bar(
%a = call i32 @foo (i32 0) readnone
%b = call i32 @foo (i32 0) readnone
%c = and i32 %a, %b
diff --git a/test/Transforms/GVN/2011-06-01-NonLocalMemdepMiscompile.ll b/test/Transforms/GVN/2011-06-01-NonLocalMemdepMiscompile.ll
index f24e956a2b1f..298f27401aaf 100644
--- a/test/Transforms/GVN/2011-06-01-NonLocalMemdepMiscompile.ll
+++ b/test/Transforms/GVN/2011-06-01-NonLocalMemdepMiscompile.ll
@@ -7,7 +7,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-apple-macosx10.7.0"
define i1 @rb_intern() nounwind ssp {
-; CHECK: @rb_intern
+; CHECK-LABEL: @rb_intern(
bb:
%tmp = alloca i8*, align 8
@@ -19,10 +19,10 @@ bb1:
br i1 undef, label %bb3, label %bb15
; CHECK: bb1:
-; CHECK: %tmp16 = phi i8* [ getelementptr (i8* null, i64 undef), %bb10 ], [ null, %bb ]
+; CHECK: [[TMP:%.*]] = phi i8* [ getelementptr (i8* null, i64 undef), %bb10 ], [ null, %bb ]
; CHECK: bb1.bb15_crit_edge:
-; CHECK: %tmp17.pre = load i8* %tmp16, align 1
+; CHECK: %tmp17.pre = load i8* [[TMP]], align 1
bb3:
call void @isalnum()
diff --git a/test/Transforms/GVN/2011-07-07-MatchIntrinsicExtract.ll b/test/Transforms/GVN/2011-07-07-MatchIntrinsicExtract.ll
index 18178e45a22b..ce60ffe449a8 100644
--- a/test/Transforms/GVN/2011-07-07-MatchIntrinsicExtract.ll
+++ b/test/Transforms/GVN/2011-07-07-MatchIntrinsicExtract.ll
@@ -11,7 +11,7 @@ entry:
ret i64 %add1
}
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NOT: add1
; CHECK: ret
@@ -23,7 +23,7 @@ entry:
ret i64 %sub1
}
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NOT: sub1
; CHECK: ret
@@ -35,7 +35,7 @@ entry:
ret i64 %mul1
}
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NOT: mul1
; CHECK: ret
@@ -47,7 +47,7 @@ entry:
ret i64 %add1
}
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NOT: add1
; CHECK: ret
@@ -59,7 +59,7 @@ entry:
ret i64 %sub1
}
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NOT: sub1
; CHECK: ret
@@ -71,7 +71,7 @@ entry:
ret i64 %mul1
}
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NOT: mul1
; CHECK: ret
diff --git a/test/Transforms/GVN/commute.ll b/test/Transforms/GVN/commute.ll
index cf4fb7f17291..cdd6ecf2edea 100644
--- a/test/Transforms/GVN/commute.ll
+++ b/test/Transforms/GVN/commute.ll
@@ -3,7 +3,7 @@
declare void @use(i32, i32)
define void @foo(i32 %x, i32 %y) {
- ; CHECK: @foo
+ ; CHECK-LABEL: @foo(
%add1 = add i32 %x, %y
%add2 = add i32 %y, %x
call void @use(i32 %add1, i32 %add2)
@@ -14,7 +14,7 @@ define void @foo(i32 %x, i32 %y) {
declare void @vse(i1, i1)
define void @bar(i32 %x, i32 %y) {
- ; CHECK: @bar
+ ; CHECK-LABEL: @bar(
%cmp1 = icmp ult i32 %x, %y
%cmp2 = icmp ugt i32 %y, %x
call void @vse(i1 %cmp1, i1 %cmp2)
diff --git a/test/Transforms/GVN/cond_br.ll b/test/Transforms/GVN/cond_br.ll
new file mode 100644
index 000000000000..918e7d41f12c
--- /dev/null
+++ b/test/Transforms/GVN/cond_br.ll
@@ -0,0 +1,55 @@
+; RUN: opt -basicaa -gvn -S < %s | FileCheck %s
+@y = external global i32
+@z = external global i32
+
+; Function Attrs: nounwind ssp uwtable
+define void @foo(i32 %x) {
+; CHECK: @foo(i32 %x)
+; CHECK: %.pre = load i32* @y
+; CHECK: call void @bar(i32 %.pre)
+
+ %t = sub i32 %x, %x
+ %.pre = load i32* @y, align 4
+ %cmp = icmp sgt i32 %t, 2
+ br i1 %cmp, label %if.then, label %entry.if.end_crit_edge
+
+entry.if.end_crit_edge: ; preds = %entry
+ br label %if.end
+
+if.then: ; preds = %entry
+ %add = add nsw i32 %x, 3
+ store i32 %add, i32* @y, align 4
+ br label %if.end
+
+if.end: ; preds = %entry.if.end_crit_edge, %if.then
+ %1 = phi i32 [ %.pre, %entry.if.end_crit_edge ], [ %add, %if.then ]
+ tail call void @bar(i32 %1)
+ ret void
+}
+
+define void @foo2(i32 %x) {
+; CHECK: @foo2(i32 %x)
+; CHECK: %.pre = load i32* @y
+; CHECK: tail call void @bar(i32 %.pre)
+entry:
+ %t = sub i32 %x, %x
+ %.pre = load i32* @y, align 4
+ %cmp = icmp sgt i32 %t, 2
+ br i1 %cmp, label %if.then, label %if.else
+
+if.then: ; preds = %entry
+ %add = add nsw i32 %x, 3
+ store i32 %add, i32* @y, align 4
+ br label %if.end
+
+if.else: ; preds = %entry
+ store i32 1, i32* @z, align 4
+ br label %if.end
+
+if.end: ; preds = %if.else, %if.then
+ %0 = phi i32 [ %.pre, %if.else ], [ %add, %if.then ]
+ tail call void @bar(i32 %0)
+ ret void
+}
+
+declare void @bar(i32)
diff --git a/test/Transforms/GVN/cond_br2.ll b/test/Transforms/GVN/cond_br2.ll
new file mode 100644
index 000000000000..27e6f75de271
--- /dev/null
+++ b/test/Transforms/GVN/cond_br2.ll
@@ -0,0 +1,140 @@
+; 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-S128"
+
+%"class.llvm::SmallVector" = type { %"class.llvm::SmallVectorImpl", [1 x %"union.llvm::SmallVectorBase::U"] }
+%"class.llvm::SmallVectorImpl" = type { %"class.llvm::SmallVectorTemplateBase" }
+%"class.llvm::SmallVectorTemplateBase" = type { %"class.llvm::SmallVectorTemplateCommon" }
+%"class.llvm::SmallVectorTemplateCommon" = type { %"class.llvm::SmallVectorBase" }
+%"class.llvm::SmallVectorBase" = type { i8*, i8*, i8*, %"union.llvm::SmallVectorBase::U" }
+%"union.llvm::SmallVectorBase::U" = type { x86_fp80 }
+
+; Function Attrs: ssp uwtable
+define void @_Z4testv() #0 {
+; CHECK: @_Z4testv()
+; CHECK: invoke.cont:
+; CHECK: br i1 true, label %new.notnull.i11, label %if.end.i14
+; CHECK: Retry.i10:
+
+entry:
+ %sv = alloca %"class.llvm::SmallVector", align 16
+ %0 = bitcast %"class.llvm::SmallVector"* %sv to i8*
+ call void @llvm.lifetime.start(i64 64, i8* %0) #1
+ %BeginX.i.i.i.i.i.i = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 0
+ %FirstEl.i.i.i.i.i.i = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 3
+ %1 = bitcast %"union.llvm::SmallVectorBase::U"* %FirstEl.i.i.i.i.i.i to i8*
+ store i8* %1, i8** %BeginX.i.i.i.i.i.i, align 16, !tbaa !4
+ %EndX.i.i.i.i.i.i = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 1
+ store i8* %1, i8** %EndX.i.i.i.i.i.i, align 8, !tbaa !4
+ %CapacityX.i.i.i.i.i.i = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 2
+ %add.ptr.i.i.i.i2.i.i = getelementptr inbounds %"union.llvm::SmallVectorBase::U"* %FirstEl.i.i.i.i.i.i, i64 2
+ %add.ptr.i.i.i.i.i.i = bitcast %"union.llvm::SmallVectorBase::U"* %add.ptr.i.i.i.i2.i.i to i8*
+ store i8* %add.ptr.i.i.i.i.i.i, i8** %CapacityX.i.i.i.i.i.i, align 16, !tbaa !4
+ %EndX.i = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 1
+ %2 = load i8** %EndX.i, align 8, !tbaa !4
+ %CapacityX.i = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 2
+ %cmp.i = icmp ult i8* %2, %add.ptr.i.i.i.i.i.i
+ br i1 %cmp.i, label %Retry.i, label %if.end.i
+
+Retry.i: ; preds = %.noexc, %entry
+ %3 = phi i8* [ %2, %entry ], [ %.pre.i, %.noexc ]
+ %new.isnull.i = icmp eq i8* %3, null
+ br i1 %new.isnull.i, label %invoke.cont, label %new.notnull.i
+
+new.notnull.i: ; preds = %Retry.i
+ %4 = bitcast i8* %3 to i32*
+ store i32 1, i32* %4, align 4, !tbaa !5
+ br label %invoke.cont
+
+if.end.i: ; preds = %entry
+ %5 = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0
+ invoke void @_ZN4llvm15SmallVectorBase8grow_podEmm(%"class.llvm::SmallVectorBase"* %5, i64 0, i64 4)
+ to label %.noexc unwind label %lpad
+
+.noexc: ; preds = %if.end.i
+ %.pre.i = load i8** %EndX.i, align 8, !tbaa !4
+ br label %Retry.i
+
+invoke.cont: ; preds = %new.notnull.i, %Retry.i
+ %add.ptr.i = getelementptr inbounds i8* %3, i64 4
+ store i8* %add.ptr.i, i8** %EndX.i, align 8, !tbaa !4
+ %6 = load i8** %CapacityX.i, align 16, !tbaa !4
+ %cmp.i8 = icmp ult i8* %add.ptr.i, %6
+ br i1 %cmp.i8, label %new.notnull.i11, label %if.end.i14
+
+Retry.i10: ; preds = %if.end.i14
+ %.pre.i13 = load i8** %EndX.i, align 8, !tbaa !4
+ %new.isnull.i9 = icmp eq i8* %.pre.i13, null
+ br i1 %new.isnull.i9, label %invoke.cont2, label %new.notnull.i11
+
+new.notnull.i11: ; preds = %invoke.cont, %Retry.i10
+ %7 = phi i8* [ %.pre.i13, %Retry.i10 ], [ %add.ptr.i, %invoke.cont ]
+ %8 = bitcast i8* %7 to i32*
+ store i32 2, i32* %8, align 4, !tbaa !5
+ br label %invoke.cont2
+
+if.end.i14: ; preds = %invoke.cont
+ %9 = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0
+ invoke void @_ZN4llvm15SmallVectorBase8grow_podEmm(%"class.llvm::SmallVectorBase"* %9, i64 0, i64 4)
+ to label %Retry.i10 unwind label %lpad
+
+invoke.cont2: ; preds = %new.notnull.i11, %Retry.i10
+ %10 = phi i8* [ null, %Retry.i10 ], [ %7, %new.notnull.i11 ]
+ %add.ptr.i12 = getelementptr inbounds i8* %10, i64 4
+ store i8* %add.ptr.i12, i8** %EndX.i, align 8, !tbaa !4
+ invoke void @_Z1gRN4llvm11SmallVectorIiLj8EEE(%"class.llvm::SmallVector"* %sv)
+ to label %invoke.cont3 unwind label %lpad
+
+invoke.cont3: ; preds = %invoke.cont2
+ %11 = load i8** %BeginX.i.i.i.i.i.i, align 16, !tbaa !4
+ %cmp.i.i.i.i19 = icmp eq i8* %11, %1
+ br i1 %cmp.i.i.i.i19, label %_ZN4llvm11SmallVectorIiLj8EED1Ev.exit21, label %if.then.i.i.i20
+
+if.then.i.i.i20: ; preds = %invoke.cont3
+ call void @free(i8* %11) #1
+ br label %_ZN4llvm11SmallVectorIiLj8EED1Ev.exit21
+
+_ZN4llvm11SmallVectorIiLj8EED1Ev.exit21: ; preds = %invoke.cont3, %if.then.i.i.i20
+ call void @llvm.lifetime.end(i64 64, i8* %0) #1
+ ret void
+
+lpad: ; preds = %if.end.i14, %if.end.i, %invoke.cont2
+ %12 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ cleanup
+ %13 = load i8** %BeginX.i.i.i.i.i.i, align 16, !tbaa !4
+ %cmp.i.i.i.i = icmp eq i8* %13, %1
+ br i1 %cmp.i.i.i.i, label %eh.resume, label %if.then.i.i.i
+
+if.then.i.i.i: ; preds = %lpad
+ call void @free(i8* %13) #1
+ br label %eh.resume
+
+eh.resume: ; preds = %if.then.i.i.i, %lpad
+ resume { i8*, i32 } %12
+}
+
+; Function Attrs: nounwind
+declare void @llvm.lifetime.start(i64, i8* nocapture) #1
+
+declare i32 @__gxx_personality_v0(...)
+
+declare void @_Z1gRN4llvm11SmallVectorIiLj8EEE(%"class.llvm::SmallVector"*) #2
+
+; Function Attrs: nounwind
+declare void @llvm.lifetime.end(i64, i8* nocapture) #1
+
+declare void @_ZN4llvm15SmallVectorBase8grow_podEmm(%"class.llvm::SmallVectorBase"*, i64, i64) #2
+
+; Function Attrs: nounwind
+declare void @free(i8* nocapture) #3
+
+attributes #0 = { ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nounwind }
+attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #3 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+
+!0 = metadata !{metadata !"any pointer", metadata !1}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA"}
+!3 = metadata !{metadata !"int", metadata !1}
+!4 = metadata !{metadata !0, metadata !0, i64 0}
+!5 = metadata !{metadata !3, metadata !3, i64 0}
diff --git a/test/Transforms/GVN/condprop.ll b/test/Transforms/GVN/condprop.ll
index 9c28955801f7..708e4b23cb54 100644
--- a/test/Transforms/GVN/condprop.ll
+++ b/test/Transforms/GVN/condprop.ll
@@ -2,7 +2,7 @@
@a = external global i32 ; <i32*> [#uses=7]
-; CHECK: @test1
+; CHECK-LABEL: @test1(
define i32 @test1() nounwind {
entry:
%0 = load i32* @a, align 4
@@ -57,7 +57,7 @@ return: ; preds = %bb8
declare void @foo(i1)
declare void @bar(i32)
-; CHECK: @test3
+; CHECK-LABEL: @test3(
define void @test3(i32 %x, i32 %y) {
%xz = icmp eq i32 %x, 0
%yz = icmp eq i32 %y, 0
@@ -79,7 +79,7 @@ nope:
ret void
}
-; CHECK: @test4
+; CHECK-LABEL: @test4(
define void @test4(i1 %b, i32 %x) {
br i1 %b, label %sw, label %case3
sw:
@@ -112,7 +112,7 @@ case3:
ret void
}
-; CHECK: @test5
+; CHECK-LABEL: @test5(
define i1 @test5(i32 %x, i32 %y) {
%cmp = icmp eq i32 %x, %y
br i1 %cmp, label %same, label %different
@@ -128,7 +128,7 @@ different:
ret i1 %cmp3
}
-; CHECK: @test6
+; CHECK-LABEL: @test6(
define i1 @test6(i32 %x, i32 %y) {
%cmp2 = icmp ne i32 %x, %y
%cmp = icmp eq i32 %x, %y
@@ -144,7 +144,7 @@ different:
ret i1 %cmp3
}
-; CHECK: @test7
+; CHECK-LABEL: @test7(
define i1 @test7(i32 %x, i32 %y) {
%cmp = icmp sgt i32 %x, %y
br i1 %cmp, label %same, label %different
@@ -160,7 +160,7 @@ different:
ret i1 %cmp3
}
-; CHECK: @test8
+; CHECK-LABEL: @test8(
define i1 @test8(i32 %x, i32 %y) {
%cmp2 = icmp sle i32 %x, %y
%cmp = icmp sgt i32 %x, %y
@@ -177,7 +177,7 @@ different:
}
; PR1768
-; CHECK: @test9
+; CHECK-LABEL: @test9(
define i32 @test9(i32 %i, i32 %j) {
%cmp = icmp eq i32 %i, %j
br i1 %cmp, label %cond_true, label %ret
@@ -193,7 +193,7 @@ ret:
}
; PR1768
-; CHECK: @test10
+; CHECK-LABEL: @test10(
define i32 @test10(i32 %j, i32 %i) {
%cmp = icmp eq i32 %i, %j
br i1 %cmp, label %cond_true, label %ret
@@ -210,7 +210,7 @@ ret:
declare i32 @yogibar()
-; CHECK: @test11
+; CHECK-LABEL: @test11(
define i32 @test11(i32 %x) {
%v0 = call i32 @yogibar()
%v1 = call i32 @yogibar()
@@ -233,7 +233,7 @@ next2:
ret i32 0
}
-; CHECK: @test12
+; CHECK-LABEL: @test12(
define i32 @test12(i32 %x) {
%cmp = icmp eq i32 %x, 0
br i1 %cmp, label %cond_true, label %cond_false
diff --git a/test/Transforms/GVN/edge.ll b/test/Transforms/GVN/edge.ll
index 3a102b6c3539..646e10c0cdfb 100644
--- a/test/Transforms/GVN/edge.ll
+++ b/test/Transforms/GVN/edge.ll
@@ -1,7 +1,7 @@
; RUN: opt -gvn -S < %s | FileCheck %s
define i32 @f1(i32 %x) {
- ; CHECK: define i32 @f1(
+ ; CHECK-LABEL: define i32 @f1(
bb0:
%cmp = icmp eq i32 %x, 0
br i1 %cmp, label %bb2, label %bb1
@@ -16,7 +16,7 @@ bb2:
}
define i32 @f2(i32 %x) {
- ; CHECK: define i32 @f2(
+ ; CHECK-LABEL: define i32 @f2(
bb0:
%cmp = icmp ne i32 %x, 0
br i1 %cmp, label %bb1, label %bb2
@@ -31,7 +31,7 @@ bb2:
}
define i32 @f3(i32 %x) {
- ; CHECK: define i32 @f3(
+ ; CHECK-LABEL: define i32 @f3(
bb0:
switch i32 %x, label %bb1 [ i32 0, label %bb2]
bb1:
@@ -46,7 +46,7 @@ bb2:
declare void @g(i1)
define void @f4(i8 * %x) {
-; CHECK: define void @f4(
+; CHECK-LABEL: define void @f4(
bb0:
%y = icmp eq i8* null, %x
br i1 %y, label %bb2, label %bb1
diff --git a/test/Transforms/GVN/lit.local.cfg b/test/Transforms/GVN/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/GVN/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/GVN/load-pre-align.ll b/test/Transforms/GVN/load-pre-align.ll
index d8ad59f9df41..4816af2f441b 100644
--- a/test/Transforms/GVN/load-pre-align.ll
+++ b/test/Transforms/GVN/load-pre-align.ll
@@ -5,7 +5,7 @@ target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-
@p = external global i32
define i32 @test(i32 %n) nounwind {
-; CHECK: @test
+; CHECK-LABEL: @test(
entry:
br label %for.cond
diff --git a/test/Transforms/GVN/local-pre.ll b/test/Transforms/GVN/local-pre.ll
index 1d0dadfbe0fc..2c92699dca91 100644
--- a/test/Transforms/GVN/local-pre.ll
+++ b/test/Transforms/GVN/local-pre.ll
@@ -1,9 +1,9 @@
; RUN: opt < %s -gvn -enable-pre -S | grep "b.pre"
-define i32 @main(i32 %p) {
+define i32 @main(i32 %p, i32 %q) {
block1:
-
- br i1 true, label %block2, label %block3
+ %cmp = icmp eq i32 %p, %q
+ br i1 %cmp, label %block2, label %block3
block2:
%a = add i32 %p, 1
diff --git a/test/Transforms/GVN/malloc-load-removal.ll b/test/Transforms/GVN/malloc-load-removal.ll
index 66b6929d3038..d2d2fd77afec 100644
--- a/test/Transforms/GVN/malloc-load-removal.ll
+++ b/test/Transforms/GVN/malloc-load-removal.ll
@@ -7,7 +7,7 @@ target triple = "x86_64-apple-macosx10.8.0"
declare i8* @malloc(i64) nounwind
-define noalias i8* @test() nounwind uwtable ssp {
+define noalias i8* @test1() nounwind uwtable ssp {
entry:
%call = tail call i8* @malloc(i64 100) nounwind
%0 = load i8* %call, align 1
@@ -21,11 +21,36 @@ if.then: ; preds = %entry
if.end: ; preds = %if.then, %entry
ret i8* %call
-; CHECK: @test
+; CHECK-LABEL: @test1(
; CHECK-NOT: load
; CHECK-NOT: icmp
-; CHECK_NO_LIBCALLS: @test
+; CHECK_NO_LIBCALLS-LABEL: @test1(
+; CHECK_NO_LIBCALLS: load
+; CHECK_NO_LIBCALLS: icmp
+}
+
+declare i8* @_Znwm(i64) nounwind
+
+define noalias i8* @test2() nounwind uwtable ssp {
+entry:
+ %call = tail call i8* @_Znwm(i64 100) nounwind
+ %0 = load i8* %call, align 1
+ %tobool = icmp eq i8 %0, 0
+ br i1 %tobool, label %if.end, label %if.then
+
+if.then: ; preds = %entry
+ store i8 0, i8* %call, align 1
+ br label %if.end
+
+if.end: ; preds = %if.then, %entry
+ ret i8* %call
+
+; CHECK-LABEL: @test2(
+; CHECK-NOT: load
+; CHECK-NOT: icmp
+
+; CHECK_NO_LIBCALLS-LABEL: @test2(
; CHECK_NO_LIBCALLS: load
; CHECK_NO_LIBCALLS: icmp
}
diff --git a/test/Transforms/GVN/non-local-offset.ll b/test/Transforms/GVN/non-local-offset.ll
index 8eaa99933ab9..0b9edcb8e430 100644
--- a/test/Transforms/GVN/non-local-offset.ll
+++ b/test/Transforms/GVN/non-local-offset.ll
@@ -5,7 +5,7 @@ target datalayout = "e-p:64:64:64"
; GVN should ignore the store to p[1] to see that the load from p[0] is
; fully redundant.
-; CHECK: @yes
+; CHECK-LABEL: @yes(
; CHECK: if.then:
; CHECK-NEXT: store i32 0, i32* %q
; CHECK-NEXT: ret void
@@ -30,7 +30,7 @@ if.else:
; fully redundant. However, the second load is larger, so it's not a simple
; redundancy.
-; CHECK: @watch_out_for_size_change
+; CHECK-LABEL: @watch_out_for_size_change(
; CHECK: if.then:
; CHECK-NEXT: store i32 0, i32* %q
; CHECK-NEXT: ret void
diff --git a/test/Transforms/GVN/phi-translate.ll b/test/Transforms/GVN/phi-translate.ll
index fa91d2919eb2..50d6178c5cc2 100644
--- a/test/Transforms/GVN/phi-translate.ll
+++ b/test/Transforms/GVN/phi-translate.ll
@@ -2,7 +2,7 @@
target datalayout = "e-p:64:64:64"
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK: entry.end_crit_edge:
; CHECK: %n.pre = load i32* %q.phi.trans.insert
; CHECK: then:
diff --git a/test/Transforms/GVN/pr14166.ll b/test/Transforms/GVN/pr14166.ll
index 9f47e464265b..4d6820506879 100644
--- a/test/Transforms/GVN/pr14166.ll
+++ b/test/Transforms/GVN/pr14166.ll
@@ -10,7 +10,7 @@ define <2 x i32> @test1() {
store <2 x i8*> %v3, <2 x i8*>* %v4
%v5 = load <2 x i32>* %v1
ret <2 x i32> %v5
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %v1 = alloca <2 x i32>
; CHECK: call void @anything(<2 x i32>* %v1)
; CHECK: %v2 = load <2 x i32>* %v1
diff --git a/test/Transforms/GVN/pr17732.ll b/test/Transforms/GVN/pr17732.ll
new file mode 100644
index 000000000000..606a195b8538
--- /dev/null
+++ b/test/Transforms/GVN/pr17732.ll
@@ -0,0 +1,30 @@
+; RUN: opt -gvn -S -o - < %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-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+%struct.with_array = type { [2 x i8], i32, i8 }
+%struct.with_vector = type { <2 x i8>, i32, i8 }
+
+@main.obj_with_array = private unnamed_addr constant { [2 x i8], i32, i8, [3 x i8] } { [2 x i8] zeroinitializer, i32 0, i8 1, [3 x i8] undef }, align 4
+@array_with_zeroinit = common global %struct.with_array zeroinitializer, align 4
+
+@main.obj_with_vector = private unnamed_addr constant { <2 x i8>, i32, i8, [3 x i8] } { <2 x i8> zeroinitializer, i32 0, i8 1, [3 x i8] undef }, align 4
+@vector_with_zeroinit = common global %struct.with_vector zeroinitializer, align 4
+
+define i32 @main() {
+entry:
+ tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* getelementptr inbounds (%struct.with_array* @array_with_zeroinit, i64 0, i32 0, i64 0), i8* getelementptr inbounds ({ [2 x i8], i32, i8, [3 x i8] }* @main.obj_with_array, i64 0, i32 0, i64 0), i64 12, i32 4, i1 false)
+ %0 = load i8* getelementptr inbounds (%struct.with_array* @array_with_zeroinit, i64 0, i32 2), align 4
+
+ tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* getelementptr inbounds (%struct.with_vector* @vector_with_zeroinit, i64 0, i32 0, i64 0), i8* getelementptr inbounds ({ <2 x i8>, i32, i8, [3 x i8] }* @main.obj_with_vector, i64 0, i32 0, i64 0), i64 12, i32 4, i1 false)
+ %1 = load i8* getelementptr inbounds (%struct.with_vector* @vector_with_zeroinit, i64 0, i32 2), align 4
+ %conv0 = sext i8 %0 to i32
+ %conv1 = sext i8 %1 to i32
+ %and = and i32 %conv0, %conv1
+ ret i32 %and
+; CHECK-LABEL: define i32 @main(
+; CHECK: ret i32 1
+}
+
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1)
diff --git a/test/Transforms/GVN/pr17852.ll b/test/Transforms/GVN/pr17852.ll
new file mode 100644
index 000000000000..e95ff7f5c106
--- /dev/null
+++ b/test/Transforms/GVN/pr17852.ll
@@ -0,0 +1,66 @@
+; RUN: opt < %s -basicaa -gvn
+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"
+%struct.S0 = type { [2 x i8], [2 x i8], [4 x i8], [2 x i8], i32, i32, i32, i32 }
+define void @fn1(%struct.S0* byval align 8 %p1) {
+ br label %for.cond
+for.cond: ; preds = %1, %0
+ br label %for.end
+ %f2 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 2
+ %f9 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 7
+ br label %for.cond
+for.end: ; preds = %for.cond
+ br i1 true, label %if.else, label %if.then
+if.then: ; preds = %for.end
+ %f22 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 2
+ %f7 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 5
+ %tmp7 = load i32* %f7, align 8
+ br label %if.end40
+if.else: ; preds = %for.end
+ br i1 false, label %for.cond18, label %if.then6
+if.then6: ; preds = %if.else
+ %f3 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 2
+ %tmp10 = bitcast %struct.S0* %p1 to i16*
+ %f5 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 3
+ %tmp11 = bitcast [2 x i8]* %f5 to i16*
+ %bf.load13 = load i16* %tmp11, align 8
+ br label %if.end36
+for.cond18: ; preds = %if.else
+ call void @fn4()
+ br i1 true, label %if.end, label %if.end36
+if.end: ; preds = %for.cond18
+ %f321 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 2
+ %f925 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 7
+ %f526 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 3
+ %tmp15 = bitcast [2 x i8]* %f526 to i16*
+ %bf.load27 = load i16* %tmp15, align 8
+ %tmp16 = bitcast %struct.S0* %p1 to i16*
+ br label %if.end36
+if.end36: ; preds = %if.end, %for.cond18, %if.then6
+ %f537 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 3
+ %tmp17 = bitcast [2 x i8]* %f537 to i16*
+ %bf.load38 = load i16* %tmp17, align 8
+ %bf.clear39 = and i16 %bf.load38, -16384
+ br label %if.end40
+if.end40: ; preds = %if.end36, %if.then
+ %f6 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 4
+ %tmp18 = load i32* %f6, align 4
+ call void @fn2(i32 %tmp18)
+ %f8 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 6
+ %tmp19 = load i32* %f8, align 4
+ %tobool41 = icmp eq i32 %tmp19, 0
+ br i1 true, label %if.end50, label %if.then42
+if.then42: ; preds = %if.end40
+ %tmp20 = bitcast %struct.S0* %p1 to i16*
+ %f547 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 3
+ %tmp21 = bitcast [2 x i8]* %f547 to i16*
+ %bf.load48 = load i16* %tmp21, align 8
+ br label %if.end50
+if.end50: ; preds = %if.then42, %if.end40
+ %f551 = getelementptr inbounds %struct.S0* %p1, i64 0, i32 3
+ %tmp22 = bitcast [2 x i8]* %f551 to i16*
+ %bf.load52 = load i16* %tmp22, align 8
+ %bf.clear53 = and i16 %bf.load52, -16384
+ ret void
+}
+declare void @fn2(i32)
+declare void @fn4()
diff --git a/test/Transforms/GVN/pre-load.ll b/test/Transforms/GVN/pre-load.ll
index bf4add42e80b..9842886fe3ab 100644
--- a/test/Transforms/GVN/pre-load.ll
+++ b/test/Transforms/GVN/pre-load.ll
@@ -2,7 +2,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
define i32 @test1(i32* %p, i1 %C) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
block1:
br i1 %C, label %block2, label %block3
@@ -25,7 +25,7 @@ block4:
; This is a simple phi translation case.
define i32 @test2(i32* %p, i32* %q, i1 %C) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
block1:
br i1 %C, label %block2, label %block3
@@ -50,7 +50,7 @@ block4:
; This is a PRE case that requires phi translation through a GEP.
define i32 @test3(i32* %p, i32* %q, i32** %Hack, i1 %C) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
block1:
%B = getelementptr i32* %q, i32 1
store i32* %B, i32** %Hack
@@ -80,7 +80,7 @@ block4:
;; Here the loaded address is available, but the computation is in 'block3'
;; which does not dominate 'block2'.
define i32 @test4(i32* %p, i32* %q, i32** %Hack, i1 %C) {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
block1:
br i1 %C, label %block2, label %block3
@@ -116,7 +116,7 @@ block4:
;}
define void @test5(i32 %N, double* nocapture %G) nounwind ssp {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
entry:
%0 = add i32 %N, -1
%1 = icmp sgt i32 %0, 0
@@ -159,7 +159,7 @@ return:
;}
define void @test6(i32 %N, double* nocapture %G) nounwind ssp {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
entry:
%0 = add i32 %N, -1
%1 = icmp sgt i32 %0, 0
@@ -242,7 +242,7 @@ return:
;; Here the loaded address isn't available in 'block2' at all, requiring a new
;; GEP to be inserted into it.
define i32 @test8(i32* %p, i32* %q, i32** %Hack, i1 %C) {
-; CHECK: @test8
+; CHECK-LABEL: @test8(
block1:
br i1 %C, label %block2, label %block3
@@ -365,7 +365,7 @@ return:
; Test critical edge splitting.
define i32 @test11(i32* %p, i1 %C, i32 %N) {
-; CHECK: @test11
+; CHECK-LABEL: @test11(
block1:
br i1 %C, label %block2, label %block3
diff --git a/test/Transforms/GVN/preserve-tbaa.ll b/test/Transforms/GVN/preserve-tbaa.ll
index a93675556cde..c52ed96c23c1 100644
--- a/test/Transforms/GVN/preserve-tbaa.ll
+++ b/test/Transforms/GVN/preserve-tbaa.ll
@@ -4,7 +4,7 @@ target datalayout = "e-p:64:64:64"
; GVN should preserve the TBAA tag on loads when doing PRE.
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK: %tmp33.pre = load i16* %P, align 2, !tbaa !0
; CHECK: br label %for.body
define void @test(i16 *%P, i16* %Q) nounwind {
@@ -25,6 +25,7 @@ for.end: ; preds = %for.body, %entry
ret void
}
-!0 = metadata !{metadata !"short", metadata !1}
+!0 = metadata !{metadata !3, metadata !3, i64 0}
!1 = metadata !{metadata !"omnipotent char", metadata !2}
!2 = metadata !{metadata !"Simple C/C++ TBAA", null}
+!3 = metadata !{metadata !"short", metadata !1}
diff --git a/test/Transforms/GVN/readattrs.ll b/test/Transforms/GVN/readattrs.ll
new file mode 100644
index 000000000000..ba624a71f9b6
--- /dev/null
+++ b/test/Transforms/GVN/readattrs.ll
@@ -0,0 +1,17 @@
+; RUN: opt -gvn -S -o - < %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"
+target triple = "x86_64-unknown-linux-gnu"
+
+declare void @use(i8* readonly nocapture)
+
+define i8 @test() {
+ %a = alloca i8
+ store i8 1, i8* %a
+ call void @use(i8* %a)
+ %b = load i8* %a
+ ret i8 %b
+; CHECK-LABEL: define i8 @test(
+; CHECK: call void @use(i8* %a)
+; CHECK-NEXT: ret i8 1
+}
diff --git a/test/Transforms/GVN/rle-nonlocal.ll b/test/Transforms/GVN/rle-nonlocal.ll
index 6b74e9a946d1..8229aaa14247 100644
--- a/test/Transforms/GVN/rle-nonlocal.ll
+++ b/test/Transforms/GVN/rle-nonlocal.ll
@@ -1,8 +1,9 @@
; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
-define i32 @main(i32** %p) {
+define i32 @main(i32** %p, i32 %x, i32 %y) {
block1:
- br i1 true, label %block2, label %block3
+ %cmp = icmp eq i32 %x, %y
+ br i1 %cmp , label %block2, label %block3
block2:
%a = load i32** %p
diff --git a/test/Transforms/GVN/rle-phi-translate.ll b/test/Transforms/GVN/rle-phi-translate.ll
index 6731f43c0d2b..1ce7e0b93797 100644
--- a/test/Transforms/GVN/rle-phi-translate.ll
+++ b/test/Transforms/GVN/rle-phi-translate.ll
@@ -4,7 +4,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
target triple = "i386-apple-darwin7"
define i32 @test1(i32* %b, i32* %c) nounwind {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
entry:
%g = alloca i32
%t1 = icmp eq i32* %b, null
@@ -36,7 +36,7 @@ bb2: ; preds = %bb1, %bb
}
define i8 @test2(i1 %cond, i32* %b, i32* %c) nounwind {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
entry:
br i1 %cond, label %bb, label %bb1
@@ -61,7 +61,7 @@ bb2:
}
define i32 @test3(i1 %cond, i32* %b, i32* %c) nounwind {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
entry:
br i1 %cond, label %bb, label %bb1
@@ -88,7 +88,7 @@ bb2:
; PR5313
define i32 @test4(i1 %cond, i32* %b, i32* %c) nounwind {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
entry:
br i1 %cond, label %bb, label %bb1
@@ -121,7 +121,7 @@ bb2:
;
; Should compile into one load in the loop.
define void @test5(i32 %N, double* nocapture %G) nounwind ssp {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
bb.nph:
br label %for.body
diff --git a/test/Transforms/GVN/rle-semidominated.ll b/test/Transforms/GVN/rle-semidominated.ll
index 71aa548ab11e..923cd03ecdb7 100644
--- a/test/Transforms/GVN/rle-semidominated.ll
+++ b/test/Transforms/GVN/rle-semidominated.ll
@@ -1,9 +1,10 @@
; RUN: opt < %s -basicaa -gvn -S | grep "DEAD = phi i32 "
-define i32 @main(i32* %p) {
+define i32 @main(i32* %p, i32 %x, i32 %y) {
block1:
%z = load i32* %p
- br i1 true, label %block2, label %block3
+ %cmp = icmp eq i32 %x, %y
+ br i1 %cmp, label %block2, label %block3
block2:
br label %block4
diff --git a/test/Transforms/GVN/rle.ll b/test/Transforms/GVN/rle.ll
index f470ed88bb9c..8d289b06997c 100644
--- a/test/Transforms/GVN/rle.ll
+++ b/test/Transforms/GVN/rle.ll
@@ -1,5 +1,5 @@
-; RUN: opt < %s -default-data-layout="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-n8:16:32" -basicaa -gvn -S -die | FileCheck %s
-; RUN: opt < %s -default-data-layout="E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-n32" -basicaa -gvn -S -die | FileCheck %s
+; RUN: opt < %s -default-data-layout="e-p:32:32:32-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-n8:16:32" -basicaa -gvn -S -die | FileCheck %s
+; RUN: opt < %s -default-data-layout="E-p:32:32:32-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-n32" -basicaa -gvn -S -die | FileCheck %s
;; Trivial RLE test.
define i32 @test0(i32 %V, i32* %P) {
@@ -7,7 +7,7 @@ define i32 @test0(i32 %V, i32* %P) {
%A = load i32* %P
ret i32 %A
-; CHECK: @test0
+; CHECK-LABEL: @test0(
; CHECK: ret i32 %V
}
@@ -47,7 +47,7 @@ define float @coerce_mustalias1(i32 %V, i32* %P) {
%A = load float* %P2
ret float %A
-; CHECK: @coerce_mustalias1
+; CHECK-LABEL: @coerce_mustalias1(
; CHECK-NOT: load
; CHECK: ret float
}
@@ -60,7 +60,7 @@ define float @coerce_mustalias2(i32* %V, i32** %P) {
%A = load float* %P2
ret float %A
-; CHECK: @coerce_mustalias2
+; CHECK-LABEL: @coerce_mustalias2(
; CHECK-NOT: load
; CHECK: ret float
}
@@ -73,7 +73,7 @@ define i32* @coerce_mustalias3(float %V, float* %P) {
%A = load i32** %P2
ret i32* %A
-; CHECK: @coerce_mustalias3
+; CHECK-LABEL: @coerce_mustalias3(
; CHECK-NOT: load
; CHECK: ret i32*
}
@@ -92,7 +92,7 @@ F:
%X = bitcast i32 %A to float
ret float %X
-; CHECK: @coerce_mustalias4
+; CHECK-LABEL: @coerce_mustalias4(
; CHECK: %A = load i32* %P
; CHECK-NOT: load
; CHECK: ret float
@@ -107,7 +107,7 @@ define i8 @coerce_mustalias5(i32 %V, i32* %P) {
%A = load i8* %P2
ret i8 %A
-; CHECK: @coerce_mustalias5
+; CHECK-LABEL: @coerce_mustalias5(
; CHECK-NOT: load
; CHECK: ret i8
}
@@ -120,7 +120,7 @@ define float @coerce_mustalias6(i64 %V, i64* %P) {
%A = load float* %P2
ret float %A
-; CHECK: @coerce_mustalias6
+; CHECK-LABEL: @coerce_mustalias6(
; CHECK-NOT: load
; CHECK: ret float
}
@@ -133,7 +133,7 @@ define i8* @coerce_mustalias7(i64 %V, i64* %P) {
%A = load i8** %P2
ret i8* %A
-; CHECK: @coerce_mustalias7
+; CHECK-LABEL: @coerce_mustalias7(
; CHECK-NOT: load
; CHECK: ret i8*
}
@@ -146,7 +146,7 @@ entry:
%arrayidx = getelementptr inbounds i16* %A, i64 42
%tmp2 = load i16* %arrayidx
ret i16 %tmp2
-; CHECK: @memset_to_i16_local
+; CHECK-LABEL: @memset_to_i16_local(
; CHECK-NOT: load
; CHECK: ret i16 257
}
@@ -159,7 +159,7 @@ entry:
%arrayidx = getelementptr inbounds float* %A, i64 42 ; <float*> [#uses=1]
%tmp2 = load float* %arrayidx ; <float> [#uses=1]
ret float %tmp2
-; CHECK: @memset_to_float_local
+; CHECK-LABEL: @memset_to_float_local(
; CHECK-NOT: load
; CHECK: zext
; CHECK-NEXT: shl
@@ -187,7 +187,7 @@ Cont:
%A = load i16* %P2
ret i16 %A
-; CHECK: @memset_to_i16_nonlocal0
+; CHECK-LABEL: @memset_to_i16_nonlocal0(
; CHECK: Cont:
; CHECK-NEXT: %A = phi i16 [ 514, %F ], [ 257, %T ]
; CHECK-NOT: load
@@ -195,6 +195,7 @@ Cont:
}
@GCst = constant {i32, float, i32 } { i32 42, float 14., i32 97 }
+@GCst_as1 = addrspace(1) constant {i32, float, i32 } { i32 42, float 14., i32 97 }
; memset -> float forwarding.
define float @memcpy_to_float_local(float* %A) nounwind ssp {
@@ -204,12 +205,23 @@ entry:
%arrayidx = getelementptr inbounds float* %A, i64 1 ; <float*> [#uses=1]
%tmp2 = load float* %arrayidx ; <float> [#uses=1]
ret float %tmp2
-; CHECK: @memcpy_to_float_local
+; CHECK-LABEL: @memcpy_to_float_local(
; CHECK-NOT: load
; CHECK: ret float 1.400000e+01
}
-
+; memcpy from address space 1
+define float @memcpy_to_float_local_as1(float* %A) nounwind ssp {
+entry:
+ %conv = bitcast float* %A to i8* ; <i8*> [#uses=1]
+ tail call void @llvm.memcpy.p0i8.p1i8.i64(i8* %conv, i8 addrspace(1)* bitcast ({i32, float, i32 } addrspace(1)* @GCst_as1 to i8 addrspace(1)*), i64 12, i32 1, i1 false)
+ %arrayidx = getelementptr inbounds float* %A, i64 1 ; <float*> [#uses=1]
+ %tmp2 = load float* %arrayidx ; <float> [#uses=1]
+ ret float %tmp2
+; CHECK-LABEL: @memcpy_to_float_local_as1(
+; CHECK-NOT: load
+; CHECK: ret float 1.400000e+01
+}
;; non-local i32/float -> i8 load forwarding.
define i8 @coerce_mustalias_nonlocal0(i32* %P, i1 %cond) {
@@ -228,7 +240,7 @@ Cont:
%A = load i8* %P3
ret i8 %A
-; CHECK: @coerce_mustalias_nonlocal0
+; CHECK-LABEL: @coerce_mustalias_nonlocal0(
; CHECK: Cont:
; CHECK: %A = phi i8 [
; CHECK-NOT: load
@@ -254,7 +266,7 @@ Cont:
%A = load i8* %P3
ret i8 %A
-; CHECK: @coerce_mustalias_nonlocal1
+; CHECK-LABEL: @coerce_mustalias_nonlocal1(
; CHECK: Cont:
; CHECK: %A = phi i8 [
; CHECK-NOT: load
@@ -277,7 +289,7 @@ Cont:
%A = load i8* %P3
ret i8 %A
-; CHECK: @coerce_mustalias_pre0
+; CHECK-LABEL: @coerce_mustalias_pre0(
; CHECK: F:
; CHECK: load i8* %P3
; CHECK: Cont:
@@ -301,7 +313,7 @@ define i8 @coerce_offset0(i32 %V, i32* %P) {
%A = load i8* %P3
ret i8 %A
-; CHECK: @coerce_offset0
+; CHECK-LABEL: @coerce_offset0(
; CHECK-NOT: load
; CHECK: ret i8
}
@@ -324,7 +336,7 @@ Cont:
%A = load i8* %P4
ret i8 %A
-; CHECK: @coerce_offset_nonlocal0
+; CHECK-LABEL: @coerce_offset_nonlocal0(
; CHECK: Cont:
; CHECK: %A = phi i8 [
; CHECK-NOT: load
@@ -348,7 +360,7 @@ Cont:
%A = load i8* %P4
ret i8 %A
-; CHECK: @coerce_offset_pre0
+; CHECK-LABEL: @coerce_offset_pre0(
; CHECK: F:
; CHECK: load i8* %P4
; CHECK: Cont:
@@ -357,13 +369,14 @@ Cont:
; CHECK: ret i8 %A
}
-define i32 @chained_load(i32** %p) {
+define i32 @chained_load(i32** %p, i32 %x, i32 %y) {
block1:
%A = alloca i32*
%z = load i32** %p
store i32* %z, i32** %A
- br i1 true, label %block2, label %block3
+ %cmp = icmp eq i32 %x, %y
+ br i1 %cmp, label %block2, label %block3
block2:
%a = load i32** %p
@@ -378,7 +391,7 @@ block4:
%d = load i32* %c
ret i32 %d
-; CHECK: @chained_load
+; CHECK-LABEL: @chained_load(
; CHECK: %z = load i32** %p
; CHECK-NOT: load
; CHECK: %d = load i32* %z
@@ -390,7 +403,7 @@ declare i1 @cond() readonly
declare i1 @cond2() readonly
define i32 @phi_trans2() {
-; CHECK: @phi_trans2
+; CHECK-LABEL: @phi_trans2(
entry:
%P = alloca i32, i32 400
br label %F1
@@ -427,10 +440,11 @@ TY:
ret i32 0
}
-define i32 @phi_trans3(i32* %p) {
-; CHECK: @phi_trans3
+define i32 @phi_trans3(i32* %p, i32 %x, i32 %y, i32 %z) {
+; CHECK-LABEL: @phi_trans3(
block1:
- br i1 true, label %block2, label %block3
+ %cmpxy = icmp eq i32 %x, %y
+ br i1 %cmpxy, label %block2, label %block3
block2:
store i32 87, i32* %p
@@ -443,7 +457,7 @@ block3:
block4:
%A = phi i32 [-1, %block2], [42, %block3]
- br i1 true, label %block5, label %exit
+ br i1 %cmpxy, label %block5, label %exit
; CHECK: block4:
; CHECK-NEXT: %D = phi i32 [ 87, %block2 ], [ 97, %block3 ]
@@ -451,11 +465,11 @@ block4:
block5:
%B = add i32 %A, 1
- br i1 true, label %block6, label %exit
+ br i1 %cmpxy, label %block6, label %exit
block6:
%C = getelementptr i32* %p, i32 %B
- br i1 true, label %block7, label %exit
+ br i1 %cmpxy, label %block7, label %exit
block7:
%D = load i32* %C
@@ -469,7 +483,7 @@ exit:
}
define i8 @phi_trans4(i8* %p) {
-; CHECK: @phi_trans4
+; CHECK-LABEL: @phi_trans4(
entry:
%X3 = getelementptr i8* %p, i32 192
store i8 192, i8* %X3
@@ -499,7 +513,7 @@ out:
}
define i8 @phi_trans5(i8* %p) {
-; CHECK: @phi_trans5
+; CHECK-LABEL: @phi_trans5(
entry:
%X4 = getelementptr i8* %p, i32 2
@@ -542,7 +556,7 @@ entry:
%arraydecay = getelementptr inbounds [256 x i32]* %x, i32 0, i32 0 ; <i32*>
%tmp1 = load i32* %arraydecay ; <i32> [#uses=1]
ret i32 %tmp1
-; CHECK: @memset_to_load
+; CHECK-LABEL: @memset_to_load(
; CHECK: ret i32 0
}
@@ -561,7 +575,7 @@ entry:
%add = add nsw i32 %tmp2, %conv
ret i32 %add
-; TEMPORARILYDISABLED: @load_load_partial_alias
+; TEMPORARILYDISABLED-LABEL: @load_load_partial_alias(
; TEMPORARILYDISABLED: load i32*
; TEMPORARILYDISABLED-NOT: load
; TEMPORARILYDISABLED: lshr i32 {{.*}}, 8
@@ -588,7 +602,7 @@ land.lhs.true: ; preds = %entry
if.end:
ret i32 52
-; TEMPORARILY_DISABLED: @load_load_partial_alias_cross_block
+; TEMPORARILY_DISABLED-LABEL: @load_load_partial_alias_cross_block(
; TEMPORARILY_DISABLED: land.lhs.true:
; TEMPORARILY_DISABLED-NOT: load i8
; TEMPORARILY_DISABLED: ret i32 %conv6
@@ -611,7 +625,7 @@ entry:
%conv2 = zext i8 %tmp1 to i32
%add = add nsw i32 %conv, %conv2
ret i32 %add
-; CHECK: @test_widening1
+; CHECK-LABEL: @test_widening1(
; CHECK-NOT: load
; CHECK: load i16*
; CHECK-NOT: load
@@ -635,7 +649,7 @@ entry:
%add3 = add nsw i32 %add2, %conv3
ret i32 %add3
-; CHECK: @test_widening2
+; CHECK-LABEL: @test_widening2(
; CHECK-NOT: load
; CHECK: load i32*
; CHECK-NOT: load
@@ -645,6 +659,8 @@ entry:
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
+declare void @llvm.memcpy.p0i8.p1i8.i64(i8* nocapture, i8 addrspace(1)* nocapture, i64, i32, i1) nounwind
+
;;===----------------------------------------------------------------------===;;
;; Load -> Store dependency which isn't interfered with by a call that happens
diff --git a/test/Transforms/GVN/tbaa.ll b/test/Transforms/GVN/tbaa.ll
index 85fe39a93b01..d6412fce59b2 100644
--- a/test/Transforms/GVN/tbaa.ll
+++ b/test/Transforms/GVN/tbaa.ll
@@ -13,7 +13,7 @@ define i32 @test1(i8* %p, i8* %q) {
define i32 @test2(i8* %p, i8* %q) {
; CHECK: @test2(i8* %p, i8* %q)
-; CHECK: call i32 @foo(i8* %p), !tbaa !0
+; CHECK: call i32 @foo(i8* %p), !tbaa [[TAGC:!.*]]
; CHECK: %c = add i32 %a, %a
%a = call i32 @foo(i8* %p), !tbaa !0
%b = call i32 @foo(i8* %p), !tbaa !0
@@ -23,7 +23,7 @@ define i32 @test2(i8* %p, i8* %q) {
define i32 @test3(i8* %p, i8* %q) {
; CHECK: @test3(i8* %p, i8* %q)
-; CHECK: call i32 @foo(i8* %p), !tbaa !3
+; CHECK: call i32 @foo(i8* %p), !tbaa [[TAGB:!.*]]
; CHECK: %c = add i32 %a, %a
%a = call i32 @foo(i8* %p), !tbaa !3
%b = call i32 @foo(i8* %p), !tbaa !3
@@ -33,7 +33,7 @@ define i32 @test3(i8* %p, i8* %q) {
define i32 @test4(i8* %p, i8* %q) {
; CHECK: @test4(i8* %p, i8* %q)
-; CHECK: call i32 @foo(i8* %p), !tbaa !1
+; CHECK: call i32 @foo(i8* %p), !tbaa [[TAGA:!.*]]
; CHECK: %c = add i32 %a, %a
%a = call i32 @foo(i8* %p), !tbaa !1
%b = call i32 @foo(i8* %p), !tbaa !0
@@ -43,7 +43,7 @@ define i32 @test4(i8* %p, i8* %q) {
define i32 @test5(i8* %p, i8* %q) {
; CHECK: @test5(i8* %p, i8* %q)
-; CHECK: call i32 @foo(i8* %p), !tbaa !1
+; CHECK: call i32 @foo(i8* %p), !tbaa [[TAGA:!.*]]
; CHECK: %c = add i32 %a, %a
%a = call i32 @foo(i8* %p), !tbaa !0
%b = call i32 @foo(i8* %p), !tbaa !1
@@ -53,7 +53,7 @@ define i32 @test5(i8* %p, i8* %q) {
define i32 @test6(i8* %p, i8* %q) {
; CHECK: @test6(i8* %p, i8* %q)
-; CHECK: call i32 @foo(i8* %p), !tbaa !1
+; CHECK: call i32 @foo(i8* %p), !tbaa [[TAGA:!.*]]
; CHECK: %c = add i32 %a, %a
%a = call i32 @foo(i8* %p), !tbaa !0
%b = call i32 @foo(i8* %p), !tbaa !3
@@ -74,8 +74,18 @@ define i32 @test7(i8* %p, i8* %q) {
declare i32 @foo(i8*) readonly
-!0 = metadata !{metadata !"C", metadata !1}
-!1 = metadata !{metadata !"A", metadata !2}
+; CHECK: [[TAGC]] = metadata !{metadata [[TYPEC:!.*]], metadata [[TYPEC]], i64 0}
+; CHECK: [[TYPEC]] = metadata !{metadata !"C", metadata [[TYPEA:!.*]]}
+; CHECK: [[TYPEA]] = metadata !{metadata !"A", metadata !{{.*}}}
+; CHECK: [[TAGB]] = metadata !{metadata [[TYPEB:!.*]], metadata [[TYPEB]], i64 0}
+; CHECK: [[TYPEB]] = metadata !{metadata !"B", metadata [[TYPEA]]}
+; CHECK: [[TAGA]] = metadata !{metadata [[TYPEA]], metadata [[TYPEA]], i64 0}
+!0 = metadata !{metadata !5, metadata !5, i64 0}
+!1 = metadata !{metadata !6, metadata !6, i64 0}
!2 = metadata !{metadata !"tbaa root", null}
-!3 = metadata !{metadata !"B", metadata !1}
-!4 = metadata !{metadata !"another root", null}
+!3 = metadata !{metadata !7, metadata !7, i64 0}
+!4 = metadata !{metadata !8, metadata !8, i64 0}
+!5 = metadata !{metadata !"C", metadata !6}
+!6 = metadata !{metadata !"A", metadata !2}
+!7 = metadata !{metadata !"B", metadata !6}
+!8 = metadata !{metadata !"another root", null}
diff --git a/test/Transforms/GlobalDCE/lit.local.cfg b/test/Transforms/GlobalDCE/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/GlobalDCE/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/GlobalOpt/2008-07-17-addrspace.ll b/test/Transforms/GlobalOpt/2008-07-17-addrspace.ll
index 390e77a8cea8..0867ca9c5431 100644
--- a/test/Transforms/GlobalOpt/2008-07-17-addrspace.ll
+++ b/test/Transforms/GlobalOpt/2008-07-17-addrspace.ll
@@ -4,7 +4,7 @@
; RUN: opt < %s -globalopt -S > %t
; Check that the new global values still have their address space
-; RUN: cat %t | grep addrspace.*global
+; RUN: cat %t | grep 'addrspace.*global'
@struct = internal addrspace(1) global { i32, i32 } zeroinitializer
@array = internal addrspace(1) global [ 2 x i32 ] zeroinitializer
diff --git a/test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll b/test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll
index a5be2b17d4ad..b98facad3977 100644
--- a/test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll
+++ b/test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -globalopt -S | FileCheck %s
define internal void @f() {
-; CHECK-NOT: @f
+; CHECK-NOT: @f(
; CHECK: define void @a
ret void
}
diff --git a/test/Transforms/GlobalOpt/2009-03-05-dbg.ll b/test/Transforms/GlobalOpt/2009-03-05-dbg.ll
index e71aed9e05ff..01089600637b 100644
--- a/test/Transforms/GlobalOpt/2009-03-05-dbg.ll
+++ b/test/Transforms/GlobalOpt/2009-03-05-dbg.ll
@@ -56,22 +56,24 @@ declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
!llvm.dbg.gv = !{!0}
!0 = metadata !{i32 458804, i32 0, metadata !1, metadata !"Stop", metadata !"Stop", metadata !"", metadata !1, i32 2, metadata !2, i1 true, i1 true, i32* @Stop} ; [ DW_TAG_variable ]
-!1 = metadata !{i32 458769, i32 0, i32 1, metadata !"g.c", metadata !"/tmp", metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
-!2 = metadata !{i32 458788, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
+!1 = metadata !{i32 458769, metadata !20, i32 1, metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, metadata !"", i32 0, metadata !21, metadata !21, null, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
+!2 = metadata !{i32 458788, null, metadata !1, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!3 = metadata !{i32 459009, metadata !4, metadata !"i", metadata !1, i32 4, metadata !2} ; [ DW_TAG_arg_variable ]
-!4 = metadata !{i32 458798, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"foo", metadata !1, i32 4, metadata !5, i1 false, i1 true, i32 0, i32 0, null, i1 false} ; [ DW_TAG_subprogram ]
-!5 = metadata !{i32 458773, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !6, i32 0, null} ; [ DW_TAG_subroutine_type ]
+!4 = metadata !{i32 458798, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"foo", i32 4, metadata !5, i1 false, i1 true, i32 0, i32 0, null, i32 0, i32 0, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
+!5 = metadata !{i32 458773, metadata !1, null, metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !6, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!6 = metadata !{metadata !2, metadata !2}
!7 = metadata !{i32 5, i32 0, metadata !8, null}
-!8 = metadata !{i32 458763, metadata !4, i32 0, i32 0} ; [ DW_TAG_lexical_block ]
+!8 = metadata !{i32 458763, metadata !20, metadata !4, i32 0, i32 0, i32 0} ; [ DW_TAG_lexical_block ]
!9 = metadata !{i32 6, i32 0, metadata !8, null}
!10 = metadata !{i32 7, i32 0, metadata !8, null}
!11 = metadata !{i32 9, i32 0, metadata !8, null}
!12 = metadata !{i32 11, i32 0, metadata !8, null}
!13 = metadata !{i32 14, i32 0, metadata !14, null}
-!14 = metadata !{i32 458763, metadata !15, i32 0, i32 0} ; [ DW_TAG_lexical_block ]
-!15 = metadata !{i32 458798, i32 0, metadata !1, metadata !"bar", metadata !"bar", metadata !"bar", metadata !1, i32 13, metadata !16, i1 false, i1 true, i32 0, i32 0, null, i1 false} ; [ DW_TAG_subprogram ]
-!16 = metadata !{i32 458773, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !17, i32 0, null} ; [ DW_TAG_subroutine_type ]
+!14 = metadata !{i32 458763, metadata !20, metadata !15, i32 0, i32 0, i32 0} ; [ DW_TAG_lexical_block ]
+!15 = metadata !{i32 458798, i32 0, metadata !1, metadata !"bar", metadata !"bar", metadata !"bar", i32 13, metadata !16, i1 false, i1 true, i32 0, i32 0, null, i32 0, i32 0, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
+!16 = metadata !{i32 458773, metadata !1, null, metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !17, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!17 = metadata !{metadata !2}
!18 = metadata !{i32 15, i32 0, metadata !14, null}
!19 = metadata !{i32 16, i32 0, metadata !14, null}
+!20 = metadata !{metadata !"g.c", metadata !"/tmp"}
+!21 = metadata !{i32 0}
diff --git a/test/Transforms/GlobalOpt/2012-05-11-blockaddress.ll b/test/Transforms/GlobalOpt/2012-05-11-blockaddress.ll
index 0c58c1a9d9c7..24213af024f5 100644
--- a/test/Transforms/GlobalOpt/2012-05-11-blockaddress.ll
+++ b/test/Transforms/GlobalOpt/2012-05-11-blockaddress.ll
@@ -2,7 +2,7 @@
; Check that the mere presence of a blockaddress doesn't prevent -globalopt
; from promoting @f to fastcc.
-; CHECK: define{{.*}}fastcc{{.*}}@f
+; CHECK-LABEL: define{{.*}}fastcc{{.*}}@f(
define internal i8* @f() {
ret i8* blockaddress(@f, %L1)
L1:
diff --git a/test/Transforms/GlobalOpt/alias-resolve.ll b/test/Transforms/GlobalOpt/alias-resolve.ll
index 845117987391..32f4bf8ebe25 100644
--- a/test/Transforms/GlobalOpt/alias-resolve.ll
+++ b/test/Transforms/GlobalOpt/alias-resolve.ll
@@ -1,19 +1,38 @@
+; We use a temporary file so that the test fails when opt crashes.
+
; RUN: opt < %s -globalopt -S > %t
-; RUN: cat %t | grep foo1 | count 1
-; RUN: cat %t | grep foo2 | count 4
-; RUN: cat %t | grep bar1 | count 1
-; RUN: cat %t | grep bar2 | count 4
+; RUN: FileCheck %s < %t
@foo1 = alias void ()* @foo2
+; CHECK: @foo1 = alias void ()* @foo2
+
@foo2 = alias weak void()* @bar1
+; CHECK: @foo2 = alias weak void ()* @bar2
+
@bar1 = alias void ()* @bar2
+; CHECK: @bar1 = alias void ()* @bar2
declare void @bar2()
+; CHECK: declare void @bar2()
define void @baz() {
entry:
- call void @foo1()
- call void @foo2()
- call void @bar1()
- ret void
+ call void @foo1()
+; CHECK: call void @foo2()
+
+ call void @foo2()
+; CHECK: call void @foo2()
+
+ call void @bar1()
+; CHECK: call void @bar2()
+
+ ret void
+}
+
+@foo3 = alias void ()* @bar3
+; CHECK-NOT: bar3
+
+define internal void @bar3() {
+ ret void
}
+;CHECK: define void @foo3
diff --git a/test/Transforms/GlobalOpt/alias-used.ll b/test/Transforms/GlobalOpt/alias-used.ll
index f91579bf0507..05ac7f9bddb3 100644
--- a/test/Transforms/GlobalOpt/alias-used.ll
+++ b/test/Transforms/GlobalOpt/alias-used.ll
@@ -2,16 +2,21 @@
@c = global i8 42
+@i = internal global i8 42
+; CHECK: @ia = internal global i8 42
+@ia = alias internal i8* @i
+
@llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca], section "llvm.metadata"
-; CHECK: @llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca], section "llvm.metadata"
+; CHECK-DAG: @llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca], section "llvm.metadata"
-@llvm.compiler_used = appending global [2 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @fa3 to i8*)], section "llvm.metadata"
+@llvm.compiler.used = appending global [4 x i8*] [i8* bitcast (void ()* @fa3 to i8*), i8* bitcast (void ()* @fa to i8*), i8* @ia, i8* @i], section "llvm.metadata"
+; CHECK-DAG: @llvm.compiler.used = appending global [2 x i8*] [i8* bitcast (void ()* @fa3 to i8*), i8* @ia], section "llvm.metadata"
@sameAsUsed = global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca]
-; CHECK: @sameAsUsed = global [3 x i8*] [i8* bitcast (void ()* @f to i8*), i8* bitcast (void ()* @f to i8*), i8* @c]
+; CHECK-DAG: @sameAsUsed = global [3 x i8*] [i8* bitcast (void ()* @f to i8*), i8* bitcast (void ()* @f to i8*), i8* @c]
@other = global i32* bitcast (void ()* @fa to i32*)
-; CHECK: @other = global i32* bitcast (void ()* @f to i32*)
+; CHECK-DAG: @other = global i32* bitcast (void ()* @f to i32*)
@fa = alias internal void ()* @f
; CHECK: @fa = alias internal void ()* @f
diff --git a/test/Transforms/GlobalOpt/array-elem-refs.ll b/test/Transforms/GlobalOpt/array-elem-refs.ll
new file mode 100644
index 000000000000..ec472b0e99f2
--- /dev/null
+++ b/test/Transforms/GlobalOpt/array-elem-refs.ll
@@ -0,0 +1,32 @@
+; RUN: opt < %s -S -globalopt | 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-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+%struct.S = type { i8, i8 }
+
+@c = internal global i8** bitcast (i8* getelementptr (i8* bitcast ([8 x i8*]* @b to i8*), i64 48) to i8**), align 8
+@b = internal global [8 x i8*] [i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* getelementptr inbounds (%struct.S* @a, i32 0, i32 0), i8* getelementptr (i8* getelementptr inbounds (%struct.S* @a, i32 0, i32 0), i64 1)], align 16
+@a = internal global %struct.S zeroinitializer, align 1
+
+; Function Attrs: nounwind uwtable
+define signext i8 @foo() #0 {
+entry:
+ %0 = load i8*** @c, align 8
+ %1 = load i8** %0, align 8
+ %2 = load i8* %1, align 1
+ ret i8 %2
+
+; CHECK-LABEL: @foo
+; CHECK: ret i8 0
+}
+
+; Function Attrs: nounwind uwtable
+define i32 @main() #0 {
+entry:
+ %retval = alloca i32, align 4
+ store i32 0, i32* %retval
+ ret i32 0
+}
+
+attributes #0 = { nounwind uwtable }
+
diff --git a/test/Transforms/GlobalOpt/atexit.ll b/test/Transforms/GlobalOpt/atexit.ll
new file mode 100644
index 000000000000..dbcd0d7b00bd
--- /dev/null
+++ b/test/Transforms/GlobalOpt/atexit.ll
@@ -0,0 +1,6 @@
+; RUN: opt < %s -globalopt -S | FileCheck %s
+
+; CHECK: ModuleID
+define internal hidden i32 @__cxa_atexit(void (i8*)* nocapture %func, i8* nocapture %arg, i8* nocapture %dso_handle) nounwind readnone optsize noimplicitfloat {
+ unreachable
+}
diff --git a/test/Transforms/GlobalOpt/atomic.ll b/test/Transforms/GlobalOpt/atomic.ll
index 4c3f4395a0ea..ac05bfd68d9d 100644
--- a/test/Transforms/GlobalOpt/atomic.ll
+++ b/test/Transforms/GlobalOpt/atomic.ll
@@ -1,10 +1,25 @@
; RUN: opt -globalopt < %s -S -o - | FileCheck %s
@GV1 = internal global i64 1
+@GV2 = internal global i32 0
+
; CHECK: @GV1 = internal unnamed_addr constant i64 1
+; CHECK: @GV2 = internal unnamed_addr global i32 0
define void @test1() {
entry:
%0 = load atomic i8* bitcast (i64* @GV1 to i8*) acquire, align 8
ret void
}
+
+; PR17163
+define void @test2a() {
+entry:
+ store atomic i32 10, i32* @GV2 seq_cst, align 4
+ ret void
+}
+define i32 @test2b() {
+entry:
+ %atomic-load = load atomic i32* @GV2 seq_cst, align 4
+ ret i32 %atomic-load
+}
diff --git a/test/Transforms/GlobalOpt/blockaddress.ll b/test/Transforms/GlobalOpt/blockaddress.ll
index 13da76299d5d..f7f830869b84 100644
--- a/test/Transforms/GlobalOpt/blockaddress.ll
+++ b/test/Transforms/GlobalOpt/blockaddress.ll
@@ -3,7 +3,7 @@
@x = internal global i8* zeroinitializer
define void @f() {
-; CHECK: @f
+; CHECK-LABEL: @f(
; Check that we don't hit an assert in Constant::IsThreadDependent()
; when storing this blockaddress into a global.
@@ -13,7 +13,7 @@ define void @f() {
}
define void @g() {
-; CHECK: @g
+; CHECK-LABEL: @g(
here:
ret void
diff --git a/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll b/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll
index a472f1033ff9..b6dfdea0610d 100644
--- a/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll
+++ b/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll
@@ -3,7 +3,7 @@
@glbl = internal global i8* null
define void @test1a() {
-; CHECK: @test1a
+; CHECK-LABEL: @test1a(
; CHECK-NOT: store
; CHECK-NEXT: ret void
store i8* null, i8** @glbl
@@ -11,7 +11,7 @@ define void @test1a() {
}
define void @test1b(i8* %p) {
-; CHECK: @test1b
+; CHECK-LABEL: @test1b(
; CHECK-NEXT: store
; CHECK-NEXT: ret void
store i8* %p, i8** @glbl
@@ -19,7 +19,7 @@ define void @test1b(i8* %p) {
}
define void @test2() {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: alloca i8
%txt = alloca i8
call void @foo2(i8* %txt)
@@ -31,7 +31,7 @@ declare i8* @strdup(i8*)
declare void @foo2(i8*)
define void @test3() uwtable {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NOT: bb1:
; CHECK-NOT: bb2:
; CHECK: invoke
diff --git a/test/Transforms/GlobalOpt/compiler-used.ll b/test/Transforms/GlobalOpt/compiler-used.ll
new file mode 100644
index 000000000000..a710d272edc7
--- /dev/null
+++ b/test/Transforms/GlobalOpt/compiler-used.ll
@@ -0,0 +1,16 @@
+; RUN: opt < %s -globalopt -S | FileCheck %s
+
+; Test that when all members of llvm.compiler.used are found to be redundant
+; we delete it instead of crashing.
+
+define void @foo() {
+ ret void
+}
+
+@llvm.used = appending global [1 x i8*] [i8* bitcast (void ()* @foo to i8*)], section "llvm.metadata"
+
+@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @foo to i8*)], section "llvm.metadata"
+
+; CHECK-NOT: @llvm.compiler.used
+; CHECK: @llvm.used = appending global [1 x i8*] [i8* bitcast (void ()* @foo to i8*)], section "llvm.metadata"
+; CHECK-NOT: @llvm.compiler.used
diff --git a/test/Transforms/GlobalOpt/ctor-list-opt-constexpr.ll b/test/Transforms/GlobalOpt/ctor-list-opt-constexpr.ll
index c9076109443d..dd86f01924a5 100644
--- a/test/Transforms/GlobalOpt/ctor-list-opt-constexpr.ll
+++ b/test/Transforms/GlobalOpt/ctor-list-opt-constexpr.ll
@@ -20,7 +20,7 @@ entry:
store i32* inttoptr (i64 sdiv (i64 ptrtoint (i32* @G to i64), i64 ptrtoint (i32* @H to i64)) to i32*), i32** %tmp, align 8
ret void
}
-; CHECK: @init1
+; CHECK-LABEL: @init1(
; CHECK: store i32*
; PR11705 - ptrtoint isn't safe in general in global initializers.
@@ -30,5 +30,5 @@ entry:
store i128 ptrtoint (i32* @G to i128), i128* %tmp, align 16
ret void
}
-; CHECK: @init2
+; CHECK-LABEL: @init2(
; CHECK: store i128
diff --git a/test/Transforms/GlobalOpt/deadglobal.ll b/test/Transforms/GlobalOpt/deadglobal.ll
index cad5a91488ab..9563a23b2c29 100644
--- a/test/Transforms/GlobalOpt/deadglobal.ll
+++ b/test/Transforms/GlobalOpt/deadglobal.ll
@@ -16,7 +16,7 @@ define void @foo1() {
@G2 = linkonce_odr constant i32 42
define void @foo2() {
-; CHECK: define void @foo2
+; CHECK-LABEL: define void @foo2(
; CHECK-NEXT: store
store i32 1, i32* @G2
ret void
diff --git a/test/Transforms/GlobalOpt/integer-bool.ll b/test/Transforms/GlobalOpt/integer-bool.ll
index 51858069ac5b..abf5fdd2ef3c 100644
--- a/test/Transforms/GlobalOpt/integer-bool.ll
+++ b/test/Transforms/GlobalOpt/integer-bool.ll
@@ -19,7 +19,7 @@ define void @set2() {
}
define i1 @get() {
-; CHECK: @get
+; CHECK-LABEL: @get(
%A = load i32 addrspace(1) * @G
%C = icmp slt i32 %A, 2
ret i1 %C
diff --git a/test/Transforms/GlobalOpt/invariant-nodatalayout.ll b/test/Transforms/GlobalOpt/invariant-nodatalayout.ll
new file mode 100644
index 000000000000..a2abd52c4e80
--- /dev/null
+++ b/test/Transforms/GlobalOpt/invariant-nodatalayout.ll
@@ -0,0 +1,17 @@
+; RUN: opt -globalopt -S -o - < %s | FileCheck %s
+; The check here is that it doesn't crash.
+
+declare {}* @llvm.invariant.start(i64 %size, i8* nocapture %ptr)
+
+@object1 = global { i32, i32 } zeroinitializer
+; CHECK: @object1 = global { i32, i32 } zeroinitializer
+
+define void @ctor1() {
+ %ptr = bitcast {i32, i32}* @object1 to i8*
+ call {}* @llvm.invariant.start(i64 4, i8* %ptr)
+ ret void
+}
+
+@llvm.global_ctors = appending constant
+ [1 x { i32, void ()* }]
+ [ { i32, void ()* } { i32 65535, void ()* @ctor1 } ]
diff --git a/test/Transforms/GlobalOpt/lit.local.cfg b/test/Transforms/GlobalOpt/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/GlobalOpt/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/GlobalOpt/load-store-global.ll b/test/Transforms/GlobalOpt/load-store-global.ll
index 25a53370fa09..ad7326dc682c 100644
--- a/test/Transforms/GlobalOpt/load-store-global.ll
+++ b/test/Transforms/GlobalOpt/load-store-global.ll
@@ -7,14 +7,14 @@ define void @foo() {
%V = load i32* @G ; <i32> [#uses=1]
store i32 %V, i32* @G
ret void
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK-NEXT: ret void
}
define i32 @bar() {
%X = load i32* @G ; <i32> [#uses=1]
ret i32 %X
-; CHECK: @bar
+; CHECK-LABEL: @bar(
; CHECK-NEXT: ret i32 17
}
@@ -31,7 +31,7 @@ define void @qux() nounwind {
store i64* inttoptr (i64 1 to i64*), i64** @a, align 8
%l = load i64** @a, align 8
ret void
-; CHECK: @qux
+; CHECK-LABEL: @qux(
; CHECK-NOT: store
; CHECK-NOT: load
}
diff --git a/test/Transforms/GlobalOpt/malloc-promote-3.ll b/test/Transforms/GlobalOpt/malloc-promote-3.ll
new file mode 100644
index 000000000000..d44ee6460950
--- /dev/null
+++ b/test/Transforms/GlobalOpt/malloc-promote-3.ll
@@ -0,0 +1,18 @@
+; RUN: opt < %s -globalopt -S | FileCheck %s
+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"
+
+@G = internal global i32* null
+
+define void @t() {
+; CHECK: @t()
+; CHECK: call i8* @malloc
+ %malloccall = tail call i8* @malloc(i64 mul (i64 100, i64 4)) nobuiltin
+ %P = bitcast i8* %malloccall to i32*
+ store i32* %P, i32** @G
+ %GV = load i32** @G
+ %GVe = getelementptr i32* %GV, i32 40
+ store i32 20, i32* %GVe
+ ret void
+}
+
+declare noalias i8* @malloc(i64)
diff --git a/test/Transforms/GlobalOpt/metadata.ll b/test/Transforms/GlobalOpt/metadata.ll
index 730e2b080236..ecf3f94196be 100644
--- a/test/Transforms/GlobalOpt/metadata.ll
+++ b/test/Transforms/GlobalOpt/metadata.ll
@@ -6,7 +6,7 @@
@G = internal global i8** null
define i32 @main(i32 %argc, i8** %argv) {
-; CHECK: @main
+; CHECK-LABEL: @main(
; CHECK: %G = alloca
store i8** %argv, i8*** @G
ret i32 0
diff --git a/test/Transforms/GlobalOpt/tls.ll b/test/Transforms/GlobalOpt/tls.ll
index 7a410e5ed20b..59ae23a4f6a8 100644
--- a/test/Transforms/GlobalOpt/tls.ll
+++ b/test/Transforms/GlobalOpt/tls.ll
@@ -29,7 +29,7 @@ entry:
%1 = load i32* %0, align 4
ret i32 %1
-; CHECK: @f
+; CHECK-LABEL: @f(
; Make sure that the load from @ip hasn't been removed.
; CHECK: load i32** @ip
; CHECK: ret
@@ -46,7 +46,7 @@ entry:
tail call void @signal() nounwind
ret void
-; CHECK: @g
+; CHECK-LABEL: @g(
; Make sure that the store to @ip hasn't been removed.
; CHECK: store {{.*}} @ip
; CHECK: ret
diff --git a/test/Transforms/GlobalOpt/zeroinitializer-gep-load.ll b/test/Transforms/GlobalOpt/zeroinitializer-gep-load.ll
index d613601e8d78..d9787232d971 100644
--- a/test/Transforms/GlobalOpt/zeroinitializer-gep-load.ll
+++ b/test/Transforms/GlobalOpt/zeroinitializer-gep-load.ll
@@ -6,6 +6,6 @@ define i32 @test1(i64 %idx) nounwind {
%arrayidx = getelementptr inbounds [10 x i32]* @zero, i64 0, i64 %idx
%l = load i32* %arrayidx
ret i32 %l
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret i32 0
}
diff --git a/test/Transforms/IPConstantProp/lit.local.cfg b/test/Transforms/IPConstantProp/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/IPConstantProp/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll b/test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll
index 76c90e0cddd9..a8020e6014b0 100644
--- a/test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll
+++ b/test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll
@@ -4,7 +4,7 @@
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
target triple = "thumbv7-apple-darwin"
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK: if.end.i126:
; CHECK: %exitcond = icmp ne i8* %incdec.ptr.i, getelementptr (i8* null, i32 undef)
define void @test() nounwind {
diff --git a/test/Transforms/IndVarSimplify/2011-11-01-lftrptr.ll b/test/Transforms/IndVarSimplify/2011-11-01-lftrptr.ll
index c0c508f02ecd..8247886e66d9 100644
--- a/test/Transforms/IndVarSimplify/2011-11-01-lftrptr.ll
+++ b/test/Transforms/IndVarSimplify/2011-11-01-lftrptr.ll
@@ -9,7 +9,7 @@
; SCEV. Since it's an i8*, it has unit stride so we never adjust the
; SCEV expression in a way that would convert it to an integer type.
-; CHECK: @testnullptrptr
+; CHECK-LABEL: @testnullptrptr(
; CHECK: loop:
; CHECK: icmp ne
define i8 @testnullptrptr(i8* %buf, i8* %end) nounwind {
@@ -34,7 +34,7 @@ exit:
ret i8 %snext
}
-; CHECK: @testptrptr
+; CHECK-LABEL: @testptrptr(
; CHECK: loop:
; CHECK: icmp ne
define i8 @testptrptr(i8* %buf, i8* %end) nounwind {
@@ -59,7 +59,7 @@ exit:
ret i8 %snext
}
-; CHECK: @testnullptrint
+; CHECK-LABEL: @testnullptrint(
; CHECK: loop:
; CHECK: icmp ne
define i8 @testnullptrint(i8* %buf, i8* %end) nounwind {
@@ -89,7 +89,7 @@ exit:
ret i8 %snext
}
-; CHECK: @testptrint
+; CHECK-LABEL: @testptrint(
; CHECK: loop:
; CHECK: icmp ne
define i8 @testptrint(i8* %buf, i8* %end) nounwind {
diff --git a/test/Transforms/IndVarSimplify/2011-11-17-selfphi.ll b/test/Transforms/IndVarSimplify/2011-11-17-selfphi.ll
index ccf259597e30..8f0cb80a1070 100644
--- a/test/Transforms/IndVarSimplify/2011-11-17-selfphi.ll
+++ b/test/Transforms/IndVarSimplify/2011-11-17-selfphi.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -indvars -S | FileCheck %s
; PR11350: Check that SimplifyIndvar handles a cycle of useless self-phis.
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK-NOT: lcssa = phi
define void @test() nounwind {
entry:
diff --git a/test/Transforms/IndVarSimplify/2012-07-17-lftr-undef.ll b/test/Transforms/IndVarSimplify/2012-07-17-lftr-undef.ll
index 7c5f81896f16..643d3cb333ee 100644
--- a/test/Transforms/IndVarSimplify/2012-07-17-lftr-undef.ll
+++ b/test/Transforms/IndVarSimplify/2012-07-17-lftr-undef.ll
@@ -2,7 +2,7 @@
; PR13371: indvars pass incorrectly substitutes 'undef' values
;
; LFTR should not user %undef as the loop counter.
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK-NOT: icmp{{.*}}undef
@.str3 = private constant [6 x i8] c"%lld\0A\00", align 1
declare i32 @printf(i8* noalias nocapture, ...) nounwind
diff --git a/test/Transforms/IndVarSimplify/2012-10-19-congruent-constant.ll b/test/Transforms/IndVarSimplify/2012-10-19-congruent-constant.ll
index 5c478669d298..5f6ff36cf574 100644
--- a/test/Transforms/IndVarSimplify/2012-10-19-congruent-constant.ll
+++ b/test/Transforms/IndVarSimplify/2012-10-19-congruent-constant.ll
@@ -19,7 +19,7 @@ for.body: ; preds = %for.body, %entry
for.end: ; preds = %for.body
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NOT: phi i1
; CHECK: call void @aux(i1 false, i1 false)
}
diff --git a/test/Transforms/IndVarSimplify/dont-recompute.ll b/test/Transforms/IndVarSimplify/dont-recompute.ll
index d37b0e21f826..e5ced0f2e4bf 100644
--- a/test/Transforms/IndVarSimplify/dont-recompute.ll
+++ b/test/Transforms/IndVarSimplify/dont-recompute.ll
@@ -21,7 +21,7 @@
declare void @func(i32)
-; CHECK: @test
+; CHECK-LABEL: @test(
define void @test(i32 %m) nounwind uwtable {
entry:
br label %for.body
@@ -45,7 +45,7 @@ for.end: ; preds = %for.body
ret void
}
-; CHECK: @test2
+; CHECK-LABEL: @test2(
define i32 @test2(i32 %m) nounwind uwtable {
entry:
br label %for.body
diff --git a/test/Transforms/IndVarSimplify/eliminate-comparison.ll b/test/Transforms/IndVarSimplify/eliminate-comparison.ll
index 5dca71264665..b48403e9a23b 100644
--- a/test/Transforms/IndVarSimplify/eliminate-comparison.ll
+++ b/test/Transforms/IndVarSimplify/eliminate-comparison.ll
@@ -7,7 +7,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; Indvars should be able to simplify simple comparisons involving
; induction variables.
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK: %cond = and i1 %tobool.not, true
define void @foo(i64 %n, i32* nocapture %p) nounwind {
@@ -42,7 +42,7 @@ return:
; Don't eliminate an icmp that's contributing to the loop exit test though.
-; CHECK: @_ZNK4llvm5APInt3ultERKS0_
+; CHECK-LABEL: @_ZNK4llvm5APInt3ultERKS0_(
; CHECK: %tmp99 = icmp sgt i32 %i, -1
define i32 @_ZNK4llvm5APInt3ultERKS0_(i32 %tmp2.i1, i64** %tmp65, i64** %tmp73, i64** %tmp82, i64** %tmp90) {
@@ -85,7 +85,7 @@ bb20.loopexit:
; Indvars should eliminate the icmp here.
-; CHECK: @func_10
+; CHECK-LABEL: @func_10(
; CHECK-NOT: icmp
; CHECK: ret void
@@ -110,7 +110,7 @@ return:
; PR14432
; Indvars should not turn the second loop into an infinite one.
-; CHECK: @func_11
+; CHECK-LABEL: @func_11(
; CHECK: %tmp5 = icmp slt i32 %__key6.0, 10
; CHECK-NOT: br i1 true, label %noassert68, label %unrolledend
@@ -162,7 +162,7 @@ unrolledend: ; preds = %forcond38
declare void @llvm.trap() noreturn nounwind
; In this case the second loop only has a single iteration, fold the header away
-; CHECK: @func_12
+; CHECK-LABEL: @func_12(
; CHECK: %tmp5 = icmp slt i32 %__key6.0, 10
; CHECK: br i1 true, label %noassert68, label %unrolledend
define i32 @func_12() nounwind uwtable {
diff --git a/test/Transforms/IndVarSimplify/eliminate-rem.ll b/test/Transforms/IndVarSimplify/eliminate-rem.ll
index f756389398fb..64fe7107b633 100644
--- a/test/Transforms/IndVarSimplify/eliminate-rem.ll
+++ b/test/Transforms/IndVarSimplify/eliminate-rem.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
; Indvars should be able to eliminate this srem.
-; CHECK: @simple
+; CHECK-LABEL: @simple(
; CHECK-NOT: rem
; CHECK: ret
@@ -32,7 +32,7 @@ bb12: ; preds = %bb11, %bb
}
; Indvars should be able to eliminate the (i+1)%n.
-; CHECK: @f
+; CHECK-LABEL: @f(
; CHECK-NOT: rem
; CHECK: rem
; CHECK-NOT: rem
diff --git a/test/Transforms/IndVarSimplify/floating-point-iv.ll b/test/Transforms/IndVarSimplify/floating-point-iv.ll
index 266eebd5bb65..c5bf3860ab5d 100644
--- a/test/Transforms/IndVarSimplify/floating-point-iv.ll
+++ b/test/Transforms/IndVarSimplify/floating-point-iv.ll
@@ -12,7 +12,7 @@ bb: ; preds = %bb, %entry
return: ; preds = %bb
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: icmp
}
@@ -31,7 +31,7 @@ bb: ; preds = %bb, %entry
return: ; preds = %bb
ret void
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: icmp
}
@@ -49,7 +49,7 @@ bb: ; preds = %bb, %entry
return:
ret void
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: fcmp
}
@@ -66,7 +66,7 @@ bb: ; preds = %bb, %entry
return:
ret void
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NOT: cmp
; CHECK: br i1 false
}
@@ -86,7 +86,7 @@ define void @test5() nounwind {
exit:
ret void
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: icmp slt i32 {{.*}}, 0
; CHECK-NEXT: br i1
}
diff --git a/test/Transforms/IndVarSimplify/iv-fold.ll b/test/Transforms/IndVarSimplify/iv-fold.ll
index e0b05cdb31f5..41a1f5ff91a2 100644
--- a/test/Transforms/IndVarSimplify/iv-fold.ll
+++ b/test/Transforms/IndVarSimplify/iv-fold.ll
@@ -4,7 +4,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; Indvars should be able to fold IV increments into shr when low bits are zero.
;
-; CHECK: @foldIncShr
+; CHECK-LABEL: @foldIncShr(
; CHECK: shr.1 = lshr i32 %0, 5
define i32 @foldIncShr(i32* %bitmap, i32 %bit_addr, i32 %nbits) nounwind {
entry:
@@ -31,7 +31,7 @@ while.end:
; Invdars should not fold an increment into shr unless 2^shiftBits is
; a multiple of the recurrence step.
;
-; CHECK: @noFoldIncShr
+; CHECK-LABEL: @noFoldIncShr(
; CHECK: shr.1 = lshr i32 %inc.1, 5
define i32 @noFoldIncShr(i32* %bitmap, i32 %bit_addr, i32 %nbits) nounwind {
entry:
diff --git a/test/Transforms/IndVarSimplify/lftr-address-space-pointers.ll b/test/Transforms/IndVarSimplify/lftr-address-space-pointers.ll
new file mode 100644
index 000000000000..e4c31d125c60
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/lftr-address-space-pointers.ll
@@ -0,0 +1,69 @@
+; RUN: opt -S -indvars -o - %s | FileCheck %s
+target datalayout = "e-p:32:32:32-p1:64:64:64-p2:8:8:8-p3:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-n8:16:32:64"
+
+; Derived from ptriv in lftr-reuse.ll
+define void @ptriv_as2(i8 addrspace(2)* %base, i32 %n) nounwind {
+; CHECK-LABEL: @ptriv_as2(
+entry:
+ %idx.trunc = trunc i32 %n to i8
+ %add.ptr = getelementptr inbounds i8 addrspace(2)* %base, i8 %idx.trunc
+ %cmp1 = icmp ult i8 addrspace(2)* %base, %add.ptr
+ br i1 %cmp1, label %for.body, label %for.end
+
+; Make sure the added GEP has the right index type
+; CHECK: %lftr.limit = getelementptr i8 addrspace(2)* %base, i8 %0
+
+; CHECK: for.body:
+; CHECK: phi i8 addrspace(2)*
+; CHECK-NOT: phi
+; CHECK-NOT: add{{^rspace}}
+; CHECK: icmp ne i8 addrspace(2)*
+; CHECK: br i1
+for.body:
+ %p.02 = phi i8 addrspace(2)* [ %base, %entry ], [ %incdec.ptr, %for.body ]
+ ; cruft to make the IV useful
+ %sub.ptr.lhs.cast = ptrtoint i8 addrspace(2)* %p.02 to i8
+ %sub.ptr.rhs.cast = ptrtoint i8 addrspace(2)* %base to i8
+ %sub.ptr.sub = sub i8 %sub.ptr.lhs.cast, %sub.ptr.rhs.cast
+ store i8 %sub.ptr.sub, i8 addrspace(2)* %p.02
+ %incdec.ptr = getelementptr inbounds i8 addrspace(2)* %p.02, i32 1
+ %cmp = icmp ult i8 addrspace(2)* %incdec.ptr, %add.ptr
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
+
+define void @ptriv_as3(i8 addrspace(3)* %base, i32 %n) nounwind {
+; CHECK-LABEL: @ptriv_as3(
+entry:
+ %idx.trunc = trunc i32 %n to i16
+ %add.ptr = getelementptr inbounds i8 addrspace(3)* %base, i16 %idx.trunc
+ %cmp1 = icmp ult i8 addrspace(3)* %base, %add.ptr
+ br i1 %cmp1, label %for.body, label %for.end
+
+; Make sure the added GEP has the right index type
+; CHECK: %lftr.limit = getelementptr i8 addrspace(3)* %base, i16 %0
+
+; CHECK: for.body:
+; CHECK: phi i8 addrspace(3)*
+; CHECK-NOT: phi
+; CHECK-NOT: add{{^rspace}}
+; CHECK: icmp ne i8 addrspace(3)*
+; CHECK: br i1
+for.body:
+ %p.02 = phi i8 addrspace(3)* [ %base, %entry ], [ %incdec.ptr, %for.body ]
+ ; cruft to make the IV useful
+ %sub.ptr.lhs.cast = ptrtoint i8 addrspace(3)* %p.02 to i16
+ %sub.ptr.rhs.cast = ptrtoint i8 addrspace(3)* %base to i16
+ %sub.ptr.sub = sub i16 %sub.ptr.lhs.cast, %sub.ptr.rhs.cast
+ %conv = trunc i16 %sub.ptr.sub to i8
+ store i8 %conv, i8 addrspace(3)* %p.02
+ %incdec.ptr = getelementptr inbounds i8 addrspace(3)* %p.02, i32 1
+ %cmp = icmp ult i8 addrspace(3)* %incdec.ptr, %add.ptr
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
+
diff --git a/test/Transforms/IndVarSimplify/lftr-extend-const.ll b/test/Transforms/IndVarSimplify/lftr-extend-const.ll
new file mode 100644
index 000000000000..2fac4a797e29
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/lftr-extend-const.ll
@@ -0,0 +1,44 @@
+;RUN: opt -S %s -indvars | FileCheck %s
+
+; CHECK-LABEL-LABEL: @foo(
+; CHECK-NOT: %lftr.wideiv = trunc i32 %indvars.iv.next to i16
+; CHECK: %exitcond = icmp ne i32 %indvars.iv.next, 512
+define void @foo() #0 {
+entry:
+ br label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %i.01 = phi i16 [ 0, %entry ], [ %inc, %for.body ]
+ %conv2 = sext i16 %i.01 to i32
+ call void @bar(i32 %conv2) #1
+ %inc = add i16 %i.01, 1
+ %cmp = icmp slt i16 %inc, 512
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end: ; preds = %for.body
+ ret void
+}
+
+; Check that post-incrementing the backedge taken count does not overflow.
+; CHECK-LABEL-LABEL: @postinc(
+; CHECK: icmp eq i32 %indvars.iv.next, 256
+define i32 @postinc() #0 {
+entry:
+ br label %do.body
+
+do.body: ; preds = %do.body, %entry
+ %first.0 = phi i8 [ 0, %entry ], [ %inc, %do.body ]
+ %conv = zext i8 %first.0 to i32
+ call void @bar(i32 %conv) #1
+ %inc = add i8 %first.0, 1
+ %cmp = icmp eq i8 %first.0, -1
+ br i1 %cmp, label %do.end, label %do.body
+
+do.end: ; preds = %do.body
+ ret i32 0
+}
+
+declare void @bar(i32)
+
+attributes #0 = { nounwind uwtable }
+attributes #1 = { nounwind }
diff --git a/test/Transforms/IndVarSimplify/lftr-reuse.ll b/test/Transforms/IndVarSimplify/lftr-reuse.ll
index 7fb36e509aed..fe3df5cfa88c 100644
--- a/test/Transforms/IndVarSimplify/lftr-reuse.ll
+++ b/test/Transforms/IndVarSimplify/lftr-reuse.ll
@@ -165,7 +165,7 @@ entry:
%lim = add i32 %x, %n
%cmp.ph = icmp ult i32 %x, %lim
br i1 %cmp.ph, label %loop, label %exit
-; CHECK: @geplftr
+; CHECK-LABEL: @geplftr(
; CHECK: loop:
; CHECK: phi i8*
; DISABLE-NOT: phi // This check is currently disabled
@@ -190,7 +190,7 @@ exit:
define void @nevertaken() nounwind uwtable ssp {
entry:
br label %loop
-; CHECK: @nevertaken
+; CHECK-LABEL: @nevertaken(
; CHECK: loop:
; CHECK-NOT: phi
; CHECK-NOT: add
diff --git a/test/Transforms/IndVarSimplify/lftr-zext.ll b/test/Transforms/IndVarSimplify/lftr-zext.ll
new file mode 100644
index 000000000000..32fa61af1801
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/lftr-zext.ll
@@ -0,0 +1,26 @@
+; RUN: opt < %s -indvars -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-S128"
+target triple = "x86_64-apple-macosx10.9.0"
+
+@data = common global [240 x i8] zeroinitializer, align 16
+
+define void @foo(i8* %a) nounwind uwtable ssp {
+; CHECK: %exitcond
+; CHECK-NOT: ([240 x i8]* @data, i64 0, i64 -16)
+ br label %1
+
+; <label>:1 ; preds = %0, %1
+ %i.0 = phi i8 [ 0, %0 ], [ %5, %1 ]
+ %p.0 = phi i8* [ getelementptr inbounds ([240 x i8]* @data, i64 0, i64 0), %0 ], [ %4, %1 ]
+ %.0 = phi i8* [ %a, %0 ], [ %2, %1 ]
+ %2 = getelementptr inbounds i8* %.0, i64 1
+ %3 = load i8* %.0, align 1
+ %4 = getelementptr inbounds i8* %p.0, i64 1
+ store i8 %3, i8* %p.0, align 1
+ %5 = add i8 %i.0, 1
+ %6 = icmp ult i8 %5, -16
+ br i1 %6, label %1, label %7
+
+; <label>:7 ; preds = %1
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/lit.local.cfg b/test/Transforms/IndVarSimplify/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/IndVarSimplify/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_1.ll b/test/Transforms/IndVarSimplify/loop_evaluate_1.ll
index abf1bc3a9d09..5d2c8c7209f7 100644
--- a/test/Transforms/IndVarSimplify/loop_evaluate_1.ll
+++ b/test/Transforms/IndVarSimplify/loop_evaluate_1.ll
@@ -1,8 +1,9 @@
-; RUN: opt < %s -indvars -loop-deletion -simplifycfg -S | not grep br
-;
-; Testcase distilled from 256.bzip2
+; RUN: opt < %s -indvars -loop-deletion -simplifycfg -S | FileCheck %s
-define i32 @main() {
+; Testcase distilled from 256.bzip2
+; CHECK-LABEL: @test1
+; CHECK-NOT: br
+define i32 @test1() {
entry:
br label %loopentry
@@ -19,3 +20,28 @@ loopexit: ; preds = %loopentry
ret i32 %tmp.2
}
+
+; PR12377
+; CHECK-LABEL: @test2
+; CHECK: [[VAR1:%.+]] = add i32 %arg, -11
+; CHECK: [[VAR2:%.+]] = lshr i32 [[VAR1]], 1
+; CHECK: [[VAR3:%.+]] = add i32 [[VAR2]], 1
+; CHECK: [[VAR4:%.+]] = phi i32 [ 0, %bb ], [ [[VAR3]], %bb1.preheader ]
+; CHECK: ret i32 [[VAR4]]
+define i32 @test2(i32 %arg) {
+bb:
+ %tmp = icmp ugt i32 %arg, 10
+ br i1 %tmp, label %bb1, label %bb7
+
+bb1: ; preds = %bb1, %bb
+ %tmp2 = phi i32 [ %tmp5, %bb1 ], [ 0, %bb ]
+ %tmp3 = phi i32 [ %tmp4, %bb1 ], [ %arg, %bb ]
+ %tmp4 = add i32 %tmp3, -2
+ %tmp5 = add i32 %tmp2, 1
+ %tmp6 = icmp ugt i32 %tmp4, 10
+ br i1 %tmp6, label %bb1, label %bb7
+
+bb7: ; preds = %bb1, %bb
+ %tmp8 = phi i32 [ 0, %bb ], [ %tmp5, %bb1 ]
+ ret i32 %tmp8
+}
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_6.ll b/test/Transforms/IndVarSimplify/loop_evaluate_6.ll
index da38de538f7b..af01fe53864b 100644
--- a/test/Transforms/IndVarSimplify/loop_evaluate_6.ll
+++ b/test/Transforms/IndVarSimplify/loop_evaluate_6.ll
@@ -1,9 +1,4 @@
; RUN: opt < %s -indvars -loop-deletion -S | grep phi | count 1
-; XFAIL: *
-
-; Indvars can't evaluate this loop, because ScalarEvolution can't compute
-; an exact trip count, because it doesn't know if dividing by the stride will
-; have a remainder. It could be done with more aggressive VRP though.
define i32 @test(i32 %x_offs) nounwind readnone {
entry:
diff --git a/test/Transforms/IndVarSimplify/no-iv-rewrite.ll b/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
index 507f695e67c5..057669277cca 100644
--- a/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
+++ b/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
@@ -223,13 +223,18 @@ entry:
%halfLim = ashr i32 %limit, 2
br label %loop
-; Test cloning an or, which is not an OverflowBinaryOperator.
+; This test originally checked that the OR instruction was cloned. Now the
+; ScalarEvolution is able to understand the loop evolution and that '%iv' at the
+; end of the loop is an even value. Thus '%val' is computed at the end of the
+; loop and the OR instruction is replaced by an ADD keeping the result
+; equivalent.
;
; CHECK: loop:
; CHECK: phi i64
; CHECK-NOT: sext
-; CHECK: or i64
+; CHECK: icmp slt i32
; CHECK: exit:
+; CHECK: add i64
loop:
%iv = phi i32 [ 0, %entry], [ %iv.next, %loop ]
%t1 = sext i32 %iv to i64
diff --git a/test/Transforms/IndVarSimplify/tripcount_compute.ll b/test/Transforms/IndVarSimplify/tripcount_compute.ll
index 8835b9627fde..626a29b20b7e 100644
--- a/test/Transforms/IndVarSimplify/tripcount_compute.ll
+++ b/test/Transforms/IndVarSimplify/tripcount_compute.ll
@@ -5,7 +5,7 @@
; the exit value of the loop will be for some value, allowing us to substitute
; it directly into users outside of the loop, making the loop dead.
-; CHECK: @linear_setne
+; CHECK-LABEL: @linear_setne(
; CHECK: ret i32 100
define i32 @linear_setne() {
@@ -22,7 +22,7 @@ loopexit: ; preds = %loop
ret i32 %i
}
-; CHECK: @linear_setne_2
+; CHECK-LABEL: @linear_setne_2(
; CHECK: ret i32 100
define i32 @linear_setne_2() {
@@ -39,7 +39,7 @@ loopexit: ; preds = %loop
ret i32 %i
}
-; CHECK: @linear_setne_overflow
+; CHECK-LABEL: @linear_setne_overflow(
; CHECK: ret i32 0
define i32 @linear_setne_overflow() {
@@ -56,7 +56,7 @@ loopexit: ; preds = %loop
ret i32 %i
}
-; CHECK: @linear_setlt
+; CHECK-LABEL: @linear_setlt(
; CHECK: ret i32 100
define i32 @linear_setlt() {
@@ -73,7 +73,7 @@ loopexit: ; preds = %loop
ret i32 %i
}
-; CHECK: @quadratic_setlt
+; CHECK-LABEL: @quadratic_setlt(
; CHECK: ret i32 34
define i32 @quadratic_setlt() {
@@ -91,7 +91,7 @@ loopexit: ; preds = %loop
ret i32 %i
}
-; CHECK: @chained
+; CHECK-LABEL: @chained(
; CHECK: ret i32 200
define i32 @chained() {
@@ -117,7 +117,7 @@ loopexit2: ; preds = %loop2
ret i32 %j
}
-; CHECK: @chained4
+; CHECK-LABEL: @chained4(
; CHECK: ret i32 400
define i32 @chained4() {
diff --git a/test/Transforms/IndVarSimplify/udiv-invariant-but-traps.ll b/test/Transforms/IndVarSimplify/udiv-invariant-but-traps.ll
new file mode 100644
index 000000000000..ef38f5d6a916
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/udiv-invariant-but-traps.ll
@@ -0,0 +1,32 @@
+; RUN: opt -indvars -S < %s | FileCheck %s
+
+@b = common global i32 0, align 4
+
+define i32 @foo(i32 %x, i1 %y) {
+bb0:
+ br label %bb1
+
+bb1:
+ br i1 %y, label %bb14, label %bb8
+
+bb8:
+ %i = phi i64 [ %i.next, %bb8 ], [ 0, %bb1 ]
+ %i.next = add i64 %i, 1
+ %div = udiv i32 1, %x
+ %c = icmp eq i64 %i.next, 6
+ br i1 %c, label %bb11, label %bb8
+
+bb11:
+ br i1 %y, label %bb1, label %bb13
+
+bb13:
+ store i32 %div, i32* @b, align 4
+ br label %bb14
+
+bb14:
+ ret i32 0
+}
+
+; CHECK-LABEL: @foo(
+; CHECK: bb8:
+; CHECK: udiv
diff --git a/test/Transforms/IndVarSimplify/udiv.ll b/test/Transforms/IndVarSimplify/udiv.ll
index 8260093d1c37..aee455d08c80 100644
--- a/test/Transforms/IndVarSimplify/udiv.ll
+++ b/test/Transforms/IndVarSimplify/udiv.ll
@@ -8,7 +8,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; Indvars shouldn't emit a udiv here, because there's no udiv in the
; original code. This comes from SingleSource/Benchmarks/Shootout/sieve.c.
-; CHECK: @main
+; CHECK-LABEL: @main(
; CHECK-NOT: div
define i32 @main(i32 %argc, i8** nocapture %argv) nounwind {
@@ -130,7 +130,7 @@ declare i32 @printf(i8* nocapture, ...) nounwind
; IndVars shouldn't be afraid to emit a udiv here, since there's a udiv in
; the original code.
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK: for.body.preheader:
; CHECK-NEXT: udiv
diff --git a/test/Transforms/IndVarSimplify/ult-sub-to-eq.ll b/test/Transforms/IndVarSimplify/ult-sub-to-eq.ll
index c58a3af62fcc..a421003aa30d 100644
--- a/test/Transforms/IndVarSimplify/ult-sub-to-eq.ll
+++ b/test/Transforms/IndVarSimplify/ult-sub-to-eq.ll
@@ -26,7 +26,7 @@ for.body: ; preds = %entry, %for.body
for.end: ; preds = %for.body, %entry
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; First check that we move the sub into the preheader, it doesn't have to be
; executed if %cmp4 == false
diff --git a/test/Transforms/IndVarSimplify/widen-nsw.ll b/test/Transforms/IndVarSimplify/widen-nsw.ll
new file mode 100644
index 000000000000..56c3c0d9f128
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/widen-nsw.ll
@@ -0,0 +1,29 @@
+; RUN: opt < %s -indvars -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-S128"
+target triple = "x86_64-apple-macosx"
+
+; CHECK-LABEL: @test1
+; CHECK: %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+define i32 @test1(i32* %a) #0 {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %sum.0 = phi i32 [ 0, %entry ], [ %add, %for.body ]
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+ %cmp = icmp slt i32 %i.0, 1000
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %idxprom = sext i32 %i.0 to i64
+ %arrayidx = getelementptr inbounds i32* %a, i64 %idxprom
+ %0 = load i32* %arrayidx, align 4
+ %add = add nsw i32 %sum.0, %0
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret i32 %sum.0
+}
+
+attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/test/Transforms/Inline/2010-05-31-ByvalTailcall.ll b/test/Transforms/Inline/2010-05-31-ByvalTailcall.ll
index 1ce74e6e41b8..b37b9f2ffa28 100644
--- a/test/Transforms/Inline/2010-05-31-ByvalTailcall.ll
+++ b/test/Transforms/Inline/2010-05-31-ByvalTailcall.ll
@@ -17,7 +17,7 @@ define void @bar(i32* byval %x) {
}
define void @foo(i32* %x) {
-; CHECK: define void @foo
+; CHECK-LABEL: define void @foo(
; CHECK: store i32 %1, i32* %x
call void @bar(i32* byval %x)
ret void
diff --git a/test/Transforms/Inline/alloca-bonus.ll b/test/Transforms/Inline/alloca-bonus.ll
index d04d54e3a538..3c5052b883b2 100644
--- a/test/Transforms/Inline/alloca-bonus.ll
+++ b/test/Transforms/Inline/alloca-bonus.ll
@@ -7,7 +7,7 @@ declare void @llvm.lifetime.start(i64 %size, i8* nocapture %ptr)
@glbl = external global i32
define void @outer1() {
-; CHECK: @outer1
+; CHECK-LABEL: @outer1(
; CHECK-NOT: call void @inner1
%ptr = alloca i32
call void @inner1(i32* %ptr)
@@ -26,7 +26,7 @@ define void @inner1(i32 *%ptr) {
}
define void @outer2() {
-; CHECK: @outer2
+; CHECK-LABEL: @outer2(
; CHECK: call void @inner2
%ptr = alloca i32
call void @inner2(i32* %ptr)
@@ -46,7 +46,7 @@ define void @inner2(i32 *%ptr) {
}
define void @outer3() {
-; CHECK: @outer3
+; CHECK-LABEL: @outer3(
; CHECK-NOT: call void @inner3
%ptr = alloca i32
call void @inner3(i32* %ptr, i1 undef)
@@ -85,7 +85,7 @@ bb.false:
}
define void @outer4(i32 %A) {
-; CHECK: @outer4
+; CHECK-LABEL: @outer4(
; CHECK-NOT: call void @inner4
%ptr = alloca i32
call void @inner4(i32* %ptr, i32 %A)
@@ -126,7 +126,7 @@ bb.false:
}
define void @outer5() {
-; CHECK: @outer5
+; CHECK-LABEL: @outer5(
; CHECK-NOT: call void @inner5
%ptr = alloca i32
call void @inner5(i1 false, i32* %ptr)
diff --git a/test/Transforms/Inline/alloca-merge-align-nodl.ll b/test/Transforms/Inline/alloca-merge-align-nodl.ll
new file mode 100644
index 000000000000..301505ff7910
--- /dev/null
+++ b/test/Transforms/Inline/alloca-merge-align-nodl.ll
@@ -0,0 +1,88 @@
+; RUN: opt < %s -inline -S | FileCheck %s
+; This variant of the test has no data layout information.
+target triple = "powerpc64-unknown-linux-gnu"
+
+%struct.s = type { i32, i32 }
+
+define void @foo(%struct.s* byval nocapture readonly %a) {
+entry:
+ %x = alloca [2 x i32], align 4
+ %a1 = getelementptr inbounds %struct.s* %a, i64 0, i32 0
+ %0 = load i32* %a1, align 4
+ %arrayidx = getelementptr inbounds [2 x i32]* %x, i64 0, i64 0
+ store i32 %0, i32* %arrayidx, align 4
+ %b = getelementptr inbounds %struct.s* %a, i64 0, i32 1
+ %1 = load i32* %b, align 4
+ %arrayidx2 = getelementptr inbounds [2 x i32]* %x, i64 0, i64 1
+ store i32 %1, i32* %arrayidx2, align 4
+ call void @bar(i32* %arrayidx) #2
+ ret void
+}
+
+define void @foo0(%struct.s* byval nocapture readonly %a) {
+entry:
+ %x = alloca [2 x i32]
+ %a1 = getelementptr inbounds %struct.s* %a, i64 0, i32 0
+ %0 = load i32* %a1, align 4
+ %arrayidx = getelementptr inbounds [2 x i32]* %x, i64 0, i64 0
+ store i32 %0, i32* %arrayidx, align 4
+ %b = getelementptr inbounds %struct.s* %a, i64 0, i32 1
+ %1 = load i32* %b, align 4
+ %arrayidx2 = getelementptr inbounds [2 x i32]* %x, i64 0, i64 1
+ store i32 %1, i32* %arrayidx2, align 4
+ call void @bar(i32* %arrayidx) #2
+ ret void
+}
+
+declare void @bar(i32*) #1
+
+define void @goo(%struct.s* byval nocapture readonly %a) {
+entry:
+ %x = alloca [2 x i32], align 32
+ %a1 = getelementptr inbounds %struct.s* %a, i64 0, i32 0
+ %0 = load i32* %a1, align 4
+ %arrayidx = getelementptr inbounds [2 x i32]* %x, i64 0, i64 0
+ store i32 %0, i32* %arrayidx, align 32
+ %b = getelementptr inbounds %struct.s* %a, i64 0, i32 1
+ %1 = load i32* %b, align 4
+ %arrayidx2 = getelementptr inbounds [2 x i32]* %x, i64 0, i64 1
+ store i32 %1, i32* %arrayidx2, align 4
+ call void @bar(i32* %arrayidx) #2
+ ret void
+}
+
+; CHECK-LABEL: @main
+; CHECK: alloca [2 x i32], align 32
+; CHECK-NOT: alloca [2 x i32]
+; CHECK: ret i32 0
+
+define signext i32 @main() {
+entry:
+ %a = alloca i64, align 8
+ %tmpcast = bitcast i64* %a to %struct.s*
+ store i64 0, i64* %a, align 8
+ %a1 = bitcast i64* %a to i32*
+ store i32 1, i32* %a1, align 8
+ call void @foo(%struct.s* byval %tmpcast)
+ store i32 2, i32* %a1, align 8
+ call void @goo(%struct.s* byval %tmpcast)
+ ret i32 0
+}
+
+; CHECK-LABEL: @test0
+; CHECK: alloca [2 x i32], align 32
+; CHECK: alloca [2 x i32]
+; CHECK: ret i32 0
+
+define signext i32 @test0() {
+entry:
+ %a = alloca i64, align 8
+ %tmpcast = bitcast i64* %a to %struct.s*
+ store i64 0, i64* %a, align 8
+ %a1 = bitcast i64* %a to i32*
+ store i32 1, i32* %a1, align 8
+ call void @foo0(%struct.s* byval %tmpcast)
+ store i32 2, i32* %a1, align 8
+ call void @goo(%struct.s* byval %tmpcast)
+ ret i32 0
+}
diff --git a/test/Transforms/Inline/alloca-merge-align.ll b/test/Transforms/Inline/alloca-merge-align.ll
new file mode 100644
index 000000000000..d357b3cd61a4
--- /dev/null
+++ b/test/Transforms/Inline/alloca-merge-align.ll
@@ -0,0 +1,122 @@
+; RUN: opt < %s -inline -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-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+%struct.s = type { i32, i32 }
+
+define void @foo(%struct.s* byval nocapture readonly %a) {
+entry:
+ %x = alloca [2 x i32], align 4
+ %a1 = getelementptr inbounds %struct.s* %a, i64 0, i32 0
+ %0 = load i32* %a1, align 4
+ %arrayidx = getelementptr inbounds [2 x i32]* %x, i64 0, i64 0
+ store i32 %0, i32* %arrayidx, align 4
+ %b = getelementptr inbounds %struct.s* %a, i64 0, i32 1
+ %1 = load i32* %b, align 4
+ %arrayidx2 = getelementptr inbounds [2 x i32]* %x, i64 0, i64 1
+ store i32 %1, i32* %arrayidx2, align 4
+ call void @bar(i32* %arrayidx) #2
+ ret void
+}
+
+define void @foo0(%struct.s* byval nocapture readonly %a) {
+entry:
+ %x = alloca [2 x i32]
+ %a1 = getelementptr inbounds %struct.s* %a, i64 0, i32 0
+ %0 = load i32* %a1, align 4
+ %arrayidx = getelementptr inbounds [2 x i32]* %x, i64 0, i64 0
+ store i32 %0, i32* %arrayidx, align 4
+ %b = getelementptr inbounds %struct.s* %a, i64 0, i32 1
+ %1 = load i32* %b, align 4
+ %arrayidx2 = getelementptr inbounds [2 x i32]* %x, i64 0, i64 1
+ store i32 %1, i32* %arrayidx2, align 4
+ call void @bar(i32* %arrayidx) #2
+ ret void
+}
+
+define void @foo1(%struct.s* byval nocapture readonly %a) {
+entry:
+ %x = alloca [2 x i32], align 1
+ %a1 = getelementptr inbounds %struct.s* %a, i64 0, i32 0
+ %0 = load i32* %a1, align 4
+ %arrayidx = getelementptr inbounds [2 x i32]* %x, i64 0, i64 0
+ store i32 %0, i32* %arrayidx, align 4
+ %b = getelementptr inbounds %struct.s* %a, i64 0, i32 1
+ %1 = load i32* %b, align 4
+ %arrayidx2 = getelementptr inbounds [2 x i32]* %x, i64 0, i64 1
+ store i32 %1, i32* %arrayidx2, align 4
+ call void @bar(i32* %arrayidx) #2
+ ret void
+}
+
+declare void @bar(i32*) #1
+
+define void @goo(%struct.s* byval nocapture readonly %a) {
+entry:
+ %x = alloca [2 x i32], align 32
+ %a1 = getelementptr inbounds %struct.s* %a, i64 0, i32 0
+ %0 = load i32* %a1, align 4
+ %arrayidx = getelementptr inbounds [2 x i32]* %x, i64 0, i64 0
+ store i32 %0, i32* %arrayidx, align 32
+ %b = getelementptr inbounds %struct.s* %a, i64 0, i32 1
+ %1 = load i32* %b, align 4
+ %arrayidx2 = getelementptr inbounds [2 x i32]* %x, i64 0, i64 1
+ store i32 %1, i32* %arrayidx2, align 4
+ call void @bar(i32* %arrayidx) #2
+ ret void
+}
+
+; CHECK-LABEL: @main
+; CHECK: alloca [2 x i32], align 32
+; CHECK-NOT: alloca [2 x i32]
+; CHECK: ret i32 0
+
+define signext i32 @main() {
+entry:
+ %a = alloca i64, align 8
+ %tmpcast = bitcast i64* %a to %struct.s*
+ store i64 0, i64* %a, align 8
+ %a1 = bitcast i64* %a to i32*
+ store i32 1, i32* %a1, align 8
+ call void @foo(%struct.s* byval %tmpcast)
+ store i32 2, i32* %a1, align 8
+ call void @goo(%struct.s* byval %tmpcast)
+ ret i32 0
+}
+
+; CHECK-LABEL: @test0
+; CHECK: alloca [2 x i32], align 32
+; CHECK-NOT: alloca [2 x i32]
+; CHECK: ret i32 0
+
+define signext i32 @test0() {
+entry:
+ %a = alloca i64, align 8
+ %tmpcast = bitcast i64* %a to %struct.s*
+ store i64 0, i64* %a, align 8
+ %a1 = bitcast i64* %a to i32*
+ store i32 1, i32* %a1, align 8
+ call void @foo0(%struct.s* byval %tmpcast)
+ store i32 2, i32* %a1, align 8
+ call void @goo(%struct.s* byval %tmpcast)
+ ret i32 0
+}
+
+; CHECK-LABEL: @test1
+; CHECK: {{alloca \[2 x i32\]$}}
+; CHECK-NOT: alloca [2 x i32]
+; CHECK: ret i32 0
+
+define signext i32 @test1() {
+entry:
+ %a = alloca i64, align 8
+ %tmpcast = bitcast i64* %a to %struct.s*
+ store i64 0, i64* %a, align 8
+ %a1 = bitcast i64* %a to i32*
+ store i32 1, i32* %a1, align 8
+ call void @foo0(%struct.s* byval %tmpcast)
+ store i32 2, i32* %a1, align 8
+ call void @foo1(%struct.s* byval %tmpcast)
+ ret i32 0
+}
diff --git a/test/Transforms/Inline/always-inline.ll b/test/Transforms/Inline/always-inline.ll
index c918bc9d5dbb..a8703b898777 100644
--- a/test/Transforms/Inline/always-inline.ll
+++ b/test/Transforms/Inline/always-inline.ll
@@ -8,7 +8,7 @@ define i32 @inner1() alwaysinline {
ret i32 1
}
define i32 @outer1() {
-; CHECK: @outer1
+; CHECK-LABEL: @outer1(
; CHECK-NOT: call
; CHECK: ret
@@ -17,7 +17,7 @@ define i32 @outer1() {
}
; The always inliner can't DCE internal functions. PR2945
-; CHECK: @pr2945
+; CHECK-LABEL: @pr2945(
define internal i32 @pr2945() nounwind {
ret i32 0
}
@@ -31,7 +31,7 @@ define void @outer2(i32 %N) {
; a function with a dynamic alloca into one without a dynamic alloca.
; rdar://6655932
;
-; CHECK: @outer2
+; CHECK-LABEL: @outer2(
; CHECK-NOT: call void @inner2
; CHECK-NOT: call void @inner2
; CHECK: ret void
@@ -51,7 +51,7 @@ entry:
}
define i32 @outer3() {
entry:
-; CHECK: @outer3
+; CHECK-LABEL: @outer3(
; CHECK-NOT: call i32 @a
; CHECK: ret
@@ -69,7 +69,7 @@ entry:
define i32 @outer4() {
entry:
-; CHECK: @outer4
+; CHECK-LABEL: @outer4(
; CHECK: call i32 @b()
; CHECK: ret
@@ -89,7 +89,7 @@ two:
ret i32 44
}
define i32 @outer5(i32 %x) {
-; CHECK: @outer5
+; CHECK-LABEL: @outer5(
; CHECK: call i32 @inner5
; CHECK: ret
@@ -113,7 +113,7 @@ return:
ret void
}
define void @outer6() {
-; CHECK: @outer6
+; CHECK-LABEL: @outer6(
; CHECK: call void @inner6(i32 42)
; CHECK: ret
diff --git a/test/Transforms/Inline/attributes.ll b/test/Transforms/Inline/attributes.ll
new file mode 100644
index 000000000000..53fb13f2baf5
--- /dev/null
+++ b/test/Transforms/Inline/attributes.ll
@@ -0,0 +1,112 @@
+; RUN: opt < %s -inline -S | FileCheck %s
+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 i32 @noattr_callee(i32 %i) {
+ ret i32 %i
+}
+
+define i32 @sanitize_address_callee(i32 %i) sanitize_address {
+ ret i32 %i
+}
+
+define i32 @sanitize_thread_callee(i32 %i) sanitize_thread {
+ ret i32 %i
+}
+
+define i32 @sanitize_memory_callee(i32 %i) sanitize_memory {
+ ret i32 %i
+}
+
+define i32 @alwaysinline_callee(i32 %i) alwaysinline {
+ ret i32 %i
+}
+
+define i32 @alwaysinline_sanitize_address_callee(i32 %i) alwaysinline sanitize_address {
+ ret i32 %i
+}
+
+define i32 @alwaysinline_sanitize_thread_callee(i32 %i) alwaysinline sanitize_thread {
+ ret i32 %i
+}
+
+define i32 @alwaysinline_sanitize_memory_callee(i32 %i) alwaysinline sanitize_memory {
+ ret i32 %i
+}
+
+
+; Check that:
+; * noattr callee is inlined into noattr caller,
+; * sanitize_(address|memory|thread) callee is not inlined into noattr caller,
+; * alwaysinline callee is always inlined no matter what sanitize_* attributes are present.
+
+define i32 @test_no_sanitize_address(i32 %arg) {
+ %x1 = call i32 @noattr_callee(i32 %arg)
+ %x2 = call i32 @sanitize_address_callee(i32 %x1)
+ %x3 = call i32 @alwaysinline_callee(i32 %x2)
+ %x4 = call i32 @alwaysinline_sanitize_address_callee(i32 %x3)
+ ret i32 %x4
+; CHECK-LABEL: @test_no_sanitize_address(
+; CHECK-NEXT: @sanitize_address_callee
+; CHECK-NEXT: ret i32
+}
+
+define i32 @test_no_sanitize_memory(i32 %arg) {
+ %x1 = call i32 @noattr_callee(i32 %arg)
+ %x2 = call i32 @sanitize_memory_callee(i32 %x1)
+ %x3 = call i32 @alwaysinline_callee(i32 %x2)
+ %x4 = call i32 @alwaysinline_sanitize_memory_callee(i32 %x3)
+ ret i32 %x4
+; CHECK-LABEL: @test_no_sanitize_memory(
+; CHECK-NEXT: @sanitize_memory_callee
+; CHECK-NEXT: ret i32
+}
+
+define i32 @test_no_sanitize_thread(i32 %arg) {
+ %x1 = call i32 @noattr_callee(i32 %arg)
+ %x2 = call i32 @sanitize_thread_callee(i32 %x1)
+ %x3 = call i32 @alwaysinline_callee(i32 %x2)
+ %x4 = call i32 @alwaysinline_sanitize_thread_callee(i32 %x3)
+ ret i32 %x4
+; CHECK-LABEL: @test_no_sanitize_thread(
+; CHECK-NEXT: @sanitize_thread_callee
+; CHECK-NEXT: ret i32
+}
+
+
+; Check that:
+; * noattr callee is not inlined into sanitize_(address|memory|thread) caller,
+; * sanitize_(address|memory|thread) callee is inlined into the caller with the same attribute,
+; * alwaysinline callee is always inlined no matter what sanitize_* attributes are present.
+
+define i32 @test_sanitize_address(i32 %arg) sanitize_address {
+ %x1 = call i32 @noattr_callee(i32 %arg)
+ %x2 = call i32 @sanitize_address_callee(i32 %x1)
+ %x3 = call i32 @alwaysinline_callee(i32 %x2)
+ %x4 = call i32 @alwaysinline_sanitize_address_callee(i32 %x3)
+ ret i32 %x4
+; CHECK-LABEL: @test_sanitize_address(
+; CHECK-NEXT: @noattr_callee
+; CHECK-NEXT: ret i32
+}
+
+define i32 @test_sanitize_memory(i32 %arg) sanitize_memory {
+ %x1 = call i32 @noattr_callee(i32 %arg)
+ %x2 = call i32 @sanitize_memory_callee(i32 %x1)
+ %x3 = call i32 @alwaysinline_callee(i32 %x2)
+ %x4 = call i32 @alwaysinline_sanitize_memory_callee(i32 %x3)
+ ret i32 %x4
+; CHECK-LABEL: @test_sanitize_memory(
+; CHECK-NEXT: @noattr_callee
+; CHECK-NEXT: ret i32
+}
+
+define i32 @test_sanitize_thread(i32 %arg) sanitize_thread {
+ %x1 = call i32 @noattr_callee(i32 %arg)
+ %x2 = call i32 @sanitize_thread_callee(i32 %x1)
+ %x3 = call i32 @alwaysinline_callee(i32 %x2)
+ %x4 = call i32 @alwaysinline_sanitize_thread_callee(i32 %x3)
+ ret i32 %x4
+; CHECK-LABEL: @test_sanitize_thread(
+; CHECK-NEXT: @noattr_callee
+; CHECK-NEXT: ret i32
+}
diff --git a/test/Transforms/Inline/basictest.ll b/test/Transforms/Inline/basictest.ll
index 39e25cb5d627..085694febc6a 100644
--- a/test/Transforms/Inline/basictest.ll
+++ b/test/Transforms/Inline/basictest.ll
@@ -9,7 +9,7 @@ define i32 @test1(i32 %W) {
%X = call i32 @test1f(i32 7)
%Y = add i32 %X, %W
ret i32 %Y
-; CHECK: @test1(
+; CHECK-LABEL: @test1(
; CHECK-NEXT: %Y = add i32 7, %W
; CHECK-NEXT: ret i32 %Y
}
@@ -20,7 +20,7 @@ define i32 @test1(i32 %W) {
%T = type { i32, i32 }
-; CHECK-NOT: @test2f
+; CHECK-NOT: @test2f(
define internal %T* @test2f(i1 %cond, %T* %P) {
br i1 %cond, label %T, label %F
@@ -41,7 +41,7 @@ define i32 @test2(i1 %cond) {
%D = load i32* %C
ret i32 %D
-; CHECK: @test2(
+; CHECK-LABEL: @test2(
; CHECK-NOT: = alloca
; CHECK: ret i32
}
@@ -75,7 +75,7 @@ define i32 @test3() {
;
; The call to @h *can* be inlined.
-; CHECK: @test
+; CHECK-LABEL: @test(
define i32 @test() {
; CHECK: call i32 @f()
%a = call i32 @f()
diff --git a/test/Transforms/Inline/byval.ll b/test/Transforms/Inline/byval.ll
index e601faf2bb37..d7597adaf84f 100644
--- a/test/Transforms/Inline/byval.ll
+++ b/test/Transforms/Inline/byval.ll
@@ -104,3 +104,26 @@ entry:
; CHECK: ret i32 4
}
+%struct.S0 = type { i32 }
+
+@b = global %struct.S0 { i32 1 }, align 4
+@a = common global i32 0, align 4
+
+define internal void @f5(%struct.S0* byval nocapture readonly align 4 %p) {
+entry:
+ store i32 0, i32* getelementptr inbounds (%struct.S0* @b, i64 0, i32 0), align 4
+ %f2 = getelementptr inbounds %struct.S0* %p, i64 0, i32 0
+ %0 = load i32* %f2, align 4
+ store i32 %0, i32* @a, align 4
+ ret void
+}
+
+define i32 @test5() {
+entry:
+ tail call void @f5(%struct.S0* byval align 4 @b)
+ %0 = load i32* @a, align 4
+ ret i32 %0
+; CHECK: @test5()
+; CHECK: store i32 0, i32* getelementptr inbounds (%struct.S0* @b, i64 0, i32 0), align 4
+; CHECK-NOT: load i32* getelementptr inbounds (%struct.S0* @b, i64 0, i32 0), align 4
+}
diff --git a/test/Transforms/Inline/delete-call.ll b/test/Transforms/Inline/delete-call.ll
index 97c52af9e0d5..7f30ffb306b4 100644
--- a/test/Transforms/Inline/delete-call.ll
+++ b/test/Transforms/Inline/delete-call.ll
@@ -2,7 +2,7 @@
; RUN: opt -S -inline -stats < %s 2>&1 | FileCheck %s
; CHECK: Number of functions inlined
-; RUN: opt -S -inline -functionattrs -stats < %s 2>&1 | FileCheck -check-prefix=FUNCTIONATTRS %s
+; RUN: opt -S -inline -functionattrs -stats < %s 2>&1 | FileCheck -check-prefix=CHECK-FUNCTIONATTRS %s
; CHECK-FUNCTIONATTRS: Number of call sites deleted, not 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"
diff --git a/test/Transforms/Inline/devirtualize-2.ll b/test/Transforms/Inline/devirtualize-2.ll
index 02ff7679148d..b7eb1be19db2 100644
--- a/test/Transforms/Inline/devirtualize-2.ll
+++ b/test/Transforms/Inline/devirtualize-2.ll
@@ -40,5 +40,5 @@ define i32 @test2(i8* %this) ssp align 2 {
ret i32 %X
}
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: ret i32 41
diff --git a/test/Transforms/Inline/devirtualize.ll b/test/Transforms/Inline/devirtualize.ll
index d46154ef6a98..89482941267c 100644
--- a/test/Transforms/Inline/devirtualize.ll
+++ b/test/Transforms/Inline/devirtualize.ll
@@ -14,7 +14,7 @@ entry:
%X = add i32 %call, 4
ret i32 %X
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK-NEXT: entry:
; CHECK-NEXT: store
; CHECK-NEXT: store
diff --git a/test/Transforms/Inline/dynamic_alloca_test.ll b/test/Transforms/Inline/dynamic_alloca_test.ll
index 15a5c66815d2..1c17c7cd9748 100644
--- a/test/Transforms/Inline/dynamic_alloca_test.ll
+++ b/test/Transforms/Inline/dynamic_alloca_test.ll
@@ -19,7 +19,7 @@ define internal void @callee(i32 %N) {
}
define void @foo(i32 %N) {
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK: alloca i32, i32 %{{.*}}
; CHECK: call i8* @llvm.stacksave()
; CHECK: alloca i32, i32 %{{.*}}
diff --git a/test/Transforms/Inline/gvn-inline-iteration.ll b/test/Transforms/Inline/gvn-inline-iteration.ll
index 526ed79e7b48..7916a13df995 100644
--- a/test/Transforms/Inline/gvn-inline-iteration.ll
+++ b/test/Transforms/Inline/gvn-inline-iteration.ll
@@ -12,9 +12,9 @@ entry:
%call = tail call i32 %tmp3() nounwind ; <i32> [#uses=1]
ret i32 %call
}
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK: ret i32 7
-; CHECK: @bar
+; CHECK-LABEL: @bar(
; CHECK: ret i32 7
define internal i32 @bar() nounwind readnone ssp {
diff --git a/test/Transforms/Inline/inline-byval-bonus.ll b/test/Transforms/Inline/inline-byval-bonus.ll
index f3ed819a7f38..052a5f12a191 100644
--- a/test/Transforms/Inline/inline-byval-bonus.ll
+++ b/test/Transforms/Inline/inline-byval-bonus.ll
@@ -21,7 +21,7 @@ define i32 @caller(%struct.sphere* %i) {
%call = call i32 @ray_sphere(%struct.sphere* %i, %struct.ray* byval align 8 %shadow_ray, %struct.spoint* null)
ret i32 %call
-; CHECK: @caller
+; CHECK-LABEL: @caller(
; CHECK-NOT: call i32 @ray_sphere
; CHECK: ret i32
}
diff --git a/test/Transforms/Inline/inline-invoke-with-asm-call.ll b/test/Transforms/Inline/inline-invoke-with-asm-call.ll
new file mode 100644
index 000000000000..876f8d7455bf
--- /dev/null
+++ b/test/Transforms/Inline/inline-invoke-with-asm-call.ll
@@ -0,0 +1,32 @@
+; RUN: opt < %s -inline -S | FileCheck %s
+target triple = "x86_64-apple-darwin"
+
+; In inliner, we assume that inline asm does not throw. This testing case makes
+; sure that the inliner does not convert "call asm" to "invoke asm".
+; rdar://15317907
+; CHECK-LABEL: @caller
+; Make sure we are generating "call asm" instead of "invoke asm".
+; CHECK: call void asm
+; CHECK-LABEL: @callee_with_asm
+define void @caller() {
+ br i1 undef, label %1, label %4
+
+; <label>:1
+ invoke void @callee_with_asm()
+ to label %4 unwind label %2
+
+; <label>:2
+ %3 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*)
+ cleanup
+ resume { i8*, i32 } undef
+
+; <label>:4
+ ret void
+}
+
+define void @callee_with_asm() {
+ call void asm sideeffect "mov\09r7, r7\09\09@ marker for objc_retainAutoreleaseReturnValue", ""()
+ ret void
+}
+
+declare i32 @__objc_personality_v0(...)
diff --git a/test/Transforms/Inline/inline-optnone.ll b/test/Transforms/Inline/inline-optnone.ll
new file mode 100644
index 000000000000..9b99c4558ea0
--- /dev/null
+++ b/test/Transforms/Inline/inline-optnone.ll
@@ -0,0 +1,52 @@
+; RUN: opt < %s -inline -S | FileCheck %s
+
+; Test that functions with attribute optnone are not inlined.
+; Also test that only functions with attribute alwaysinline are
+; valid candidates for inlining if the caller has the optnone attribute.
+
+; Function Attrs: alwaysinline nounwind readnone uwtable
+define i32 @alwaysInlineFunction(i32 %a) #0 {
+entry:
+ %mul = mul i32 %a, %a
+ ret i32 %mul
+}
+
+; Function Attrs: nounwind readnone uwtable
+define i32 @simpleFunction(i32 %a) #1 {
+entry:
+ %add = add i32 %a, %a
+ ret i32 %add
+}
+
+; Function Attrs: nounwind noinline optnone readnone uwtable
+define i32 @OptnoneFunction(i32 %a) #2 {
+entry:
+ %0 = tail call i32 @alwaysInlineFunction(i32 %a)
+ %1 = tail call i32 @simpleFunction(i32 %a)
+ %add = add i32 %0, %1
+ ret i32 %add
+}
+
+; CHECK-LABEL: @OptnoneFunction
+; CHECK-NOT: call i32 @alwaysInlineFunction(i32 %a)
+; CHECK: call i32 @simpleFunction(i32 %a)
+; CHECK: ret
+
+; Function Attrs: nounwind readnone uwtable
+define i32 @bar(i32 %a) #1 {
+entry:
+ %0 = tail call i32 @OptnoneFunction(i32 5)
+ %1 = tail call i32 @simpleFunction(i32 6)
+ %add = add i32 %0, %1
+ ret i32 %add
+}
+
+; CHECK-LABEL: @bar
+; CHECK: call i32 @OptnoneFunction(i32 5)
+; CHECK-NOT: call i32 @simpleFunction(i32 6)
+; CHECK: ret
+
+
+attributes #0 = { alwaysinline nounwind readnone uwtable }
+attributes #1 = { nounwind readnone uwtable }
+attributes #2 = { nounwind noinline optnone readnone uwtable }
diff --git a/test/Transforms/Inline/inline_cleanup.ll b/test/Transforms/Inline/inline_cleanup.ll
index 3898aa7044ac..4361c2e8bbf4 100644
--- a/test/Transforms/Inline/inline_cleanup.ll
+++ b/test/Transforms/Inline/inline_cleanup.ll
@@ -52,7 +52,7 @@ UnifiedReturnBlock: ; preds = %cond_next13
declare void @ext(i32*)
define void @test() {
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK-NOT: ret
;
; FIXME: This should be a CHECK-NOT, but currently we have a bug that causes us
@@ -128,7 +128,7 @@ end4:
define void @outer2(i32 %z, i1 %b) {
; Ensure that after inlining, none of the blocks with a call to @f actually
; make it through inlining.
-; CHECK: define void @outer2
+; CHECK-LABEL: define void @outer2(
; CHECK-NOT: call
; CHECK: ret void
@@ -164,7 +164,7 @@ define void @PR12470_outer() {
; This previously crashed during inliner cleanup and folding inner return
; instructions. Check that we don't crash and we produce a function with a single
; return instruction due to merging the returns of the inlined function.
-; CHECK: define void @PR12470_outer
+; CHECK-LABEL: define void @PR12470_outer(
; CHECK-NOT: call
; CHECK: ret void
; CHECK-NOT: ret void
@@ -202,7 +202,7 @@ for.cond12.for.inc26_crit_edge.2:
}
define void @crasher_outer() {
-; CHECK: @crasher_outer
+; CHECK-LABEL: @crasher_outer(
; CHECK-NOT: call
; CHECK: ret void
; CHECK-NOT: ret
diff --git a/test/Transforms/Inline/inline_constprop.ll b/test/Transforms/Inline/inline_constprop.ll
index 77bc3784acb4..b59a270468e0 100644
--- a/test/Transforms/Inline/inline_constprop.ll
+++ b/test/Transforms/Inline/inline_constprop.ll
@@ -6,7 +6,7 @@ define internal i32 @callee1(i32 %A, i32 %B) {
}
define i32 @caller1() {
-; CHECK: define i32 @caller1
+; CHECK-LABEL: define i32 @caller1(
; CHECK-NEXT: ret i32 3
%X = call i32 @callee1( i32 10, i32 3 )
@@ -21,7 +21,7 @@ define i32 @caller2() {
; inline and be cheap. We should eventually do that and lower the threshold here
; to 1.
;
-; CHECK: @caller2
+; CHECK-LABEL: @caller2(
; CHECK-NOT: call void @callee2
; CHECK: ret
@@ -61,7 +61,7 @@ define i32 @caller3() {
; it doesn't count toward the inline cost when constant-prop proves those paths
; dead.
;
-; CHECK: @caller3
+; CHECK-LABEL: @caller3(
; CHECK-NOT: call
; CHECK: ret i32 6
@@ -119,7 +119,7 @@ define i8 @caller4(i8 %z) {
; as they are used heavily in standard library code and generic C++ code where
; the arguments are oftent constant but complete generality is required.
;
-; CHECK: @caller4
+; CHECK-LABEL: @caller4(
; CHECK-NOT: call
; CHECK: ret i8 -1
@@ -153,7 +153,7 @@ define i64 @caller5(i64 %y) {
; Check that we can round trip constants through various kinds of casts etc w/o
; losing track of the constant prop in the inline cost analysis.
;
-; CHECK: @caller5
+; CHECK-LABEL: @caller5(
; CHECK-NOT: call
; CHECK: ret i64 -1
@@ -187,6 +187,37 @@ bb.false:
ret i64 %y8
}
+define float @caller6() {
+; Check that we can constant-prop through fcmp instructions
+;
+; CHECK-LABEL: @caller6(
+; CHECK-NOT: call
+; CHECK: ret
+ %x = call float @callee6(float 42.0)
+ ret float %x
+}
+
+define float @callee6(float %x) {
+ %icmp = fcmp ugt float %x, 42.0
+ br i1 %icmp, label %bb.true, label %bb.false
+
+bb.true:
+ ; This block musn't be counted in the inline cost.
+ %x1 = fadd float %x, 1.0
+ %x2 = fadd float %x1, 1.0
+ %x3 = fadd float %x2, 1.0
+ %x4 = fadd float %x3, 1.0
+ %x5 = fadd float %x4, 1.0
+ %x6 = fadd float %x5, 1.0
+ %x7 = fadd float %x6, 1.0
+ %x8 = fadd float %x7, 1.0
+ ret float %x8
+
+bb.false:
+ ret float %x
+}
+
+
define i32 @PR13412.main() {
; This is a somewhat complicated three layer subprogram that was reported to
diff --git a/test/Transforms/Inline/inline_minisize.ll b/test/Transforms/Inline/inline_minisize.ll
index 3dddbcf3303d..b9aad6083399 100644
--- a/test/Transforms/Inline/inline_minisize.ll
+++ b/test/Transforms/Inline/inline_minisize.ll
@@ -200,7 +200,7 @@ for.end21: ; preds = %for.cond14
define i32 @fct3(i32 %c) nounwind uwtable ssp {
entry:
- ;CHECK: @fct3
+ ;CHECK-LABEL: @fct3(
;CHECK: call i32 @fct1
; The inline keyword gives a sufficient benefits to inline fct2
;CHECK-NOT: call i32 @fct2
@@ -216,7 +216,7 @@ entry:
define i32 @fct4(i32 %c) minsize nounwind uwtable ssp {
entry:
- ;CHECK: @fct4
+ ;CHECK-LABEL: @fct4(
;CHECK: call i32 @fct1
; With Oz (minsize attribute), the benefit of inlining fct2
; is the same as fct1, thus no inlining for fct2
diff --git a/test/Transforms/Inline/inline_returns_twice.ll b/test/Transforms/Inline/inline_returns_twice.ll
index ab2e954af151..678ee82f4b84 100644
--- a/test/Transforms/Inline/inline_returns_twice.ll
+++ b/test/Transforms/Inline/inline_returns_twice.ll
@@ -4,38 +4,81 @@
; if they are themselve marked as such.
declare i32 @a() returns_twice
-declare i32 @b() returns_twice
-define i32 @f() {
+define i32 @inner1() {
entry:
%call = call i32 @a() returns_twice
%add = add nsw i32 1, %call
ret i32 %add
}
-define i32 @g() {
+define i32 @outer1() {
entry:
-; CHECK: define i32 @g
-; CHECK: call i32 @f()
-; CHECK-NOT: call i32 @a()
- %call = call i32 @f()
+; CHECK-LABEL: define i32 @outer1(
+; CHECK: call i32 @inner1()
+ %call = call i32 @inner1()
%add = add nsw i32 1, %call
ret i32 %add
}
-define i32 @h() returns_twice {
+define i32 @inner2() returns_twice {
entry:
- %call = call i32 @b() returns_twice
+ %call = call i32 @a() returns_twice
+ %add = add nsw i32 1, %call
+ ret i32 %add
+}
+
+define i32 @outer2() {
+entry:
+; CHECK-LABEL: define i32 @outer2(
+; CHECK: call i32 @a()
+ %call = call i32 @inner2() returns_twice
%add = add nsw i32 1, %call
ret i32 %add
}
-define i32 @i() {
+define i32 @inner3() {
+entry:
+ %invoke = invoke i32 @a() returns_twice
+ to label %cont unwind label %lpad
+
+cont:
+ %add = add nsw i32 1, %invoke
+ ret i32 %add
+
+lpad:
+ %lp = landingpad i32 personality i8* null cleanup
+ resume i32 %lp
+}
+
+define i32 @outer3() {
+entry:
+; CHECK-LABEL: define i32 @outer3(
+; CHECK: call i32 @inner3()
+ %call = call i32 @inner3()
+ %add = add nsw i32 1, %call
+ ret i32 %add
+}
+
+define i32 @inner4() returns_twice {
+entry:
+ %invoke = invoke i32 @a() returns_twice
+ to label %cont unwind label %lpad
+
+cont:
+ %add = add nsw i32 1, %invoke
+ ret i32 %add
+
+lpad:
+ %lp = landingpad i32 personality i8* null cleanup
+ resume i32 %lp
+}
+
+define i32 @outer4() {
entry:
-; CHECK: define i32 @i
-; CHECK: call i32 @b()
-; CHECK-NOT: call i32 @h()
- %call = call i32 @h() returns_twice
+; CHECK-LABEL: define i32 @outer4(
+; CHECK: invoke i32 @a()
+ %call = call i32 @inner4() returns_twice
%add = add nsw i32 1, %call
ret i32 %add
}
diff --git a/test/Transforms/Inline/invoke-cost.ll b/test/Transforms/Inline/invoke-cost.ll
new file mode 100644
index 000000000000..84d33ad55120
--- /dev/null
+++ b/test/Transforms/Inline/invoke-cost.ll
@@ -0,0 +1,45 @@
+; RUN: opt -inline < %s -S -o - -inline-threshold=100 | FileCheck %s
+
+target datalayout = "p:32:32"
+
+@glbl = external global i32
+
+declare void @f()
+declare i32 @__gxx_personality_v0(...)
+declare i8* @__cxa_begin_catch(i8*)
+declare void @__cxa_end_catch()
+declare void @_ZSt9terminatev()
+
+define void @inner1() {
+entry:
+ invoke void @f() to label %cont1 unwind label %terminate.lpad
+
+cont1:
+ invoke void @f() to label %cont2 unwind label %terminate.lpad
+
+cont2:
+ invoke void @f() to label %cont3 unwind label %terminate.lpad
+
+cont3:
+ invoke void @f() to label %cont4 unwind label %terminate.lpad
+
+cont4:
+ ret void
+
+terminate.lpad:
+ landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
+ catch i8* null
+ call void @_ZSt9terminatev() noreturn nounwind
+ unreachable
+}
+
+define void @outer1() {
+; CHECK-LABEL: @outer1(
+;
+; This call should not get inlined because inner1 actually calls a function
+; many times, but it only does so through invoke as opposed to call.
+;
+; CHECK: call void @inner1
+ call void @inner1()
+ ret void
+}
diff --git a/test/Transforms/Inline/lifetime-no-datalayout.ll b/test/Transforms/Inline/lifetime-no-datalayout.ll
index f4ffef3850f1..5abb77f2c3fc 100644
--- a/test/Transforms/Inline/lifetime-no-datalayout.ll
+++ b/test/Transforms/Inline/lifetime-no-datalayout.ll
@@ -10,7 +10,7 @@ define void @helper() {
; Size in llvm.lifetime.X should be -1 (unknown).
define void @test() {
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK-NOT: lifetime
; CHECK: llvm.lifetime.start(i64 -1
; CHECK-NOT: lifetime
diff --git a/test/Transforms/Inline/lifetime.ll b/test/Transforms/Inline/lifetime.ll
index fc73385295ed..12c433b9e626 100644
--- a/test/Transforms/Inline/lifetime.ll
+++ b/test/Transforms/Inline/lifetime.ll
@@ -14,7 +14,7 @@ define void @helper_both_markers() {
}
define void @test_both_markers() {
-; CHECK: @test_both_markers
+; CHECK-LABEL: @test_both_markers(
; CHECK: llvm.lifetime.start(i64 2
; CHECK-NEXT: llvm.lifetime.end(i64 2
call void @helper_both_markers()
@@ -38,7 +38,7 @@ define void @helper_no_markers() {
;; We can't use CHECK-NEXT because there's an extra call void @use in between.
;; Instead, we use CHECK-NOT to verify that there are no other lifetime calls.
define void @test_no_marker() {
-; CHECK: @test_no_marker
+; CHECK-LABEL: @test_no_marker(
; CHECK-NOT: lifetime
; CHECK: llvm.lifetime.start(i64 1
; CHECK-NOT: lifetime
@@ -64,7 +64,7 @@ define void @helper_two_casts() {
}
define void @test_two_casts() {
-; CHECK: @test_two_casts
+; CHECK-LABEL: @test_two_casts(
; CHECK-NOT: lifetime
; CHECK: llvm.lifetime.start(i64 4
; CHECK-NOT: lifetime
@@ -88,7 +88,7 @@ define void @helper_arrays_alloca() {
}
define void @test_arrays_alloca() {
-; CHECK: @test_arrays_alloca
+; CHECK-LABEL: @test_arrays_alloca(
; CHECK-NOT: lifetime
; CHECK: llvm.lifetime.start(i64 40,
; CHECK-NOT: lifetime
diff --git a/test/Transforms/Inline/lit.local.cfg b/test/Transforms/Inline/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/Inline/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/Inline/nested-inline.ll b/test/Transforms/Inline/nested-inline.ll
index 12926671722e..9d08ac0c19c6 100644
--- a/test/Transforms/Inline/nested-inline.ll
+++ b/test/Transforms/Inline/nested-inline.ll
@@ -6,7 +6,7 @@
define fastcc void @foo(i32 %X) {
entry:
-; CHECK: @foo
+; CHECK-LABEL: @foo(
%ALL = alloca i32, align 4 ; <i32*> [#uses=1]
%tmp1 = and i32 %X, 1 ; <i32> [#uses=1]
%tmp1.upgrd.1 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1]
@@ -47,7 +47,7 @@ UnifiedReturnBlock: ; preds = %cond_next13
ret void
}
-; CHECK-NOT: @bar
+; CHECK-NOT: @bar(
define internal fastcc void @bar(i32 %X) {
entry:
%ALL = alloca i32, align 4 ; <i32*> [#uses=1]
@@ -101,7 +101,7 @@ declare void @ext(i32*)
define void @test(i32 %X) {
entry:
; CHECK: test
-; CHECK-NOT: @bar
+; CHECK-NOT: @bar(
tail call fastcc void @bar( i32 %X )
tail call fastcc void @bar( i32 %X )
tail call fastcc void @bar2( i32 %X )
diff --git a/test/Transforms/Inline/noinline-recursive-fn.ll b/test/Transforms/Inline/noinline-recursive-fn.ll
index 5520093ee457..2e581a7dbc4f 100644
--- a/test/Transforms/Inline/noinline-recursive-fn.ll
+++ b/test/Transforms/Inline/noinline-recursive-fn.ll
@@ -25,7 +25,7 @@ return: ; preds = %entry
}
-;; CHECK: @bonk
+;; CHECK-LABEL: @bonk(
;; CHECK: call void @foo(i32 42)
define void @bonk() nounwind ssp {
entry:
@@ -62,7 +62,7 @@ return: ; preds = %entry
}
-; CHECK: @top_level
+; CHECK-LABEL: @top_level(
; CHECK: call void @f2(i32 122
; Here we inline one instance of the cycle, but we don't want to completely
; unroll it.
@@ -100,7 +100,7 @@ one.else:
}
define i32 @fib_caller() {
-; CHECK: @fib_caller
+; CHECK-LABEL: @fib_caller(
; CHECK-NOT: call
; CHECK: ret
%f1 = call i32 @fib(i32 0)
diff --git a/test/Transforms/Inline/ptr-diff.ll b/test/Transforms/Inline/ptr-diff.ll
index 60fc3e2a3326..af42bc7cedeb 100644
--- a/test/Transforms/Inline/ptr-diff.ll
+++ b/test/Transforms/Inline/ptr-diff.ll
@@ -1,9 +1,9 @@
; RUN: opt -inline < %s -S -o - -inline-threshold=10 | FileCheck %s
-target datalayout = "p:32:32"
+target datalayout = "p:32:32-p1:64:64-p2:16:16-n16:32:64"
define i32 @outer1() {
-; CHECK: @outer1
+; CHECK-LABEL: @outer1(
; CHECK-NOT: call
; CHECK: ret i32
@@ -32,7 +32,7 @@ else:
define i32 @outer2(i32* %ptr) {
; Test that an inbounds GEP disables this -- it isn't safe in general as
; wrapping changes the behavior of lessthan and greaterthan comparisions.
-; CHECK: @outer2
+; CHECK-LABEL: @outer2(
; CHECK: call i32 @inner2
; CHECK: ret i32
@@ -56,3 +56,46 @@ else:
%t = load i32* %begin
ret i32 %t
}
+
+; The inttoptrs are free since it is a smaller integer to a larger
+; pointer size
+define i32 @inttoptr_free_cost(i32 %a, i32 %b, i32 %c) {
+ %p1 = inttoptr i32 %a to i32 addrspace(1)*
+ %p2 = inttoptr i32 %b to i32 addrspace(1)*
+ %p3 = inttoptr i32 %c to i32 addrspace(1)*
+ %t1 = load i32 addrspace(1)* %p1
+ %t2 = load i32 addrspace(1)* %p2
+ %t3 = load i32 addrspace(1)* %p3
+ %s = add i32 %t1, %t2
+ %s1 = add i32 %s, %t3
+ ret i32 %s1
+}
+
+define i32 @inttoptr_free_cost_user(i32 %begin, i32 %end) {
+; CHECK-LABEL: @inttoptr_free_cost_user(
+; CHECK-NOT: call
+ %x = call i32 @inttoptr_free_cost(i32 %begin, i32 %end, i32 9)
+ ret i32 %x
+}
+
+; The inttoptrs have a cost since it is a larger integer to a smaller
+; pointer size
+define i32 @inttoptr_cost_smaller_ptr(i32 %a, i32 %b, i32 %c) {
+ %p1 = inttoptr i32 %a to i32 addrspace(2)*
+ %p2 = inttoptr i32 %b to i32 addrspace(2)*
+ %p3 = inttoptr i32 %c to i32 addrspace(2)*
+ %t1 = load i32 addrspace(2)* %p1
+ %t2 = load i32 addrspace(2)* %p2
+ %t3 = load i32 addrspace(2)* %p3
+ %s = add i32 %t1, %t2
+ %s1 = add i32 %s, %t3
+ ret i32 %s1
+}
+
+define i32 @inttoptr_cost_smaller_ptr_user(i32 %begin, i32 %end) {
+; CHECK-LABEL: @inttoptr_cost_smaller_ptr_user(
+; CHECK: call
+ %x = call i32 @inttoptr_cost_smaller_ptr(i32 %begin, i32 %end, i32 9)
+ ret i32 %x
+}
+
diff --git a/test/Transforms/Inline/recursive.ll b/test/Transforms/Inline/recursive.ll
index fe1c041af9a8..b9b14d1dbb61 100644
--- a/test/Transforms/Inline/recursive.ll
+++ b/test/Transforms/Inline/recursive.ll
@@ -6,7 +6,7 @@ target triple = "i386-apple-darwin10.0"
; rdar://10853263
; Make sure that the callee is still here.
-; CHECK: define i32 @callee
+; CHECK-LABEL: define i32 @callee(
define i32 @callee(i32 %param) {
%yyy = alloca [100000 x i8]
%r = bitcast [100000 x i8]* %yyy to i8*
@@ -14,7 +14,7 @@ define i32 @callee(i32 %param) {
ret i32 4
}
-; CHECK: define i32 @caller
+; CHECK-LABEL: define i32 @caller(
; CHECK-NEXT: entry:
; CHECK-NOT: alloca
; CHECK: ret
diff --git a/test/Transforms/InstCombine/2002-05-14-SubFailure.ll b/test/Transforms/InstCombine/2002-05-14-SubFailure.ll
index d2b2b0027a52..854ec604d01a 100644
--- a/test/Transforms/InstCombine/2002-05-14-SubFailure.ll
+++ b/test/Transforms/InstCombine/2002-05-14-SubFailure.ll
@@ -1,7 +1,8 @@
; Instcombine was missing a test that caused it to make illegal transformations
; sometimes. In this case, it transforms the sub into an add:
-; RUN: opt < %s -instcombine -S | grep sub
-;
+; RUN: opt < %s -instcombine -S | FileCheck %s
+; CHECK: sub
+
define i32 @test(i32 %i, i32 %j) {
%A = mul i32 %i, %j
%B = sub i32 2, %A
diff --git a/test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll b/test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll
index 22574f77f1d9..49e55c620a49 100644
--- a/test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll
+++ b/test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll
@@ -1,4 +1,6 @@
-; RUN: opt < %s -instcombine -S | not grep add
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+; CHECK-NOT: add
define i32 @test(i32 %A) {
%A.neg = sub i32 0, %A ; <i32> [#uses=1]
diff --git a/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll b/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll
index c02d33ccc1b7..bb9a8181ccd4 100644
--- a/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll
+++ b/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll
@@ -1,6 +1,7 @@
-; This testcase can be simplified by "realizing" that alloca can never return
+; This testcase can be simplified by "realizing" that alloca can never return
; null.
-; RUN: opt < %s -instcombine -simplifycfg -S | not grep br
+; RUN: opt < %s -instcombine -simplifycfg -S | FileCheck %s
+; CHECK-NOT: br
declare i32 @bitmap_clear(...)
diff --git a/test/Transforms/InstCombine/2006-10-20-mask.ll b/test/Transforms/InstCombine/2006-10-20-mask.ll
index 0aaa5e8c21b4..e9797ae50c95 100644
--- a/test/Transforms/InstCombine/2006-10-20-mask.ll
+++ b/test/Transforms/InstCombine/2006-10-20-mask.ll
@@ -1,5 +1,5 @@
-; RUN: opt < %s -instcombine -S | \
-; RUN: grep and
+; RUN: opt < %s -instcombine -S | FileCheck %s
+; CHECK: and
define i64 @foo(i64 %tmp, i64 %tmp2) {
%tmp.upgrd.1 = trunc i64 %tmp to i32 ; <i32> [#uses=1]
diff --git a/test/Transforms/InstCombine/2006-10-26-VectorReassoc.ll b/test/Transforms/InstCombine/2006-10-26-VectorReassoc.ll
index d3ba1e2287a3..8ab50e222745 100644
--- a/test/Transforms/InstCombine/2006-10-26-VectorReassoc.ll
+++ b/test/Transforms/InstCombine/2006-10-26-VectorReassoc.ll
@@ -1,5 +1,6 @@
-; RUN: opt < %s -instcombine -S | \
-; RUN: grep mul | count 2
+; RUN: opt < %s -instcombine -S | FileCheck %s
+; CHECK: mul
+; CHECK: mul
define <4 x float> @test(<4 x float> %V) {
%Y = fmul <4 x float> %V, < float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00 > ; <<4 x float>> [#uses=1]
diff --git a/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll b/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll
index 2665791fe086..272753cc98d6 100644
--- a/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll
+++ b/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll
@@ -1,4 +1,5 @@
-; RUN: opt < %s -instcombine -S | grep select
+; RUN: opt < %s -instcombine -S | FileCheck %s
+; CHECK: select
; END.
target datalayout = "e-p:32:32"
diff --git a/test/Transforms/InstCombine/2007-01-27-AndICmp.ll b/test/Transforms/InstCombine/2007-01-27-AndICmp.ll
index 4d1b982f6766..6298a0723338 100644
--- a/test/Transforms/InstCombine/2007-01-27-AndICmp.ll
+++ b/test/Transforms/InstCombine/2007-01-27-AndICmp.ll
@@ -1,8 +1,8 @@
; RUN: opt < %s -instcombine -S | grep "ugt.*, 1"
define i1 @test(i32 %tmp1030) {
- %tmp1037 = icmp ne i32 %tmp1030, 40 ; <i1> [#uses=1]
- %tmp1039 = icmp ne i32 %tmp1030, 41 ; <i1> [#uses=1]
+ %tmp1037 = icmp ne i32 %tmp1030, 39 ; <i1> [#uses=1]
+ %tmp1039 = icmp ne i32 %tmp1030, 40 ; <i1> [#uses=1]
%tmp1042 = and i1 %tmp1037, %tmp1039 ; <i1> [#uses=1]
ret i1 %tmp1042
}
diff --git a/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll b/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll
index 23b606779e66..22c078250ece 100644
--- a/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll
+++ b/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll
@@ -1,23 +1,30 @@
; Ignore stderr, we expect warnings there
-; RUN: opt < %s -instcombine 2> /dev/null -S | not grep bitcast
+; RUN: opt < %s -instcombine 2> /dev/null -S | FileCheck %s
+
+; CHECK-NOT: bitcast
define void @a() {
- ret void
+ ret void
}
define signext i32 @b(i32* inreg %x) {
- ret i32 0
+ ret i32 0
}
define void @c(...) {
- ret void
+ ret void
}
define void @g(i32* %y) {
- call void bitcast (void ()* @a to void (i32*)*)( i32* noalias %y )
- call <2 x i32> bitcast (i32 (i32*)* @b to <2 x i32> (i32*)*)( i32* inreg null ) ; <<2 x i32>>:1 [#uses=0]
+; CHECK-LABEL: @g(
+; CHECK: call i64 bitcast (i32 (i32*)* @b to i64 (i32)*)(i32 0)
%x = call i64 bitcast (i32 (i32*)* @b to i64 (i32)*)( i32 0 ) ; <i64> [#uses=0]
- call void bitcast (void (...)* @c to void (i32)*)( i32 0 )
- call void bitcast (void (...)* @c to void (i32)*)( i32 zeroext 0 )
- ret void
+
+; The rest should not have bitcasts remaining
+; CHECK-NOT: bitcast
+ call void bitcast (void ()* @a to void (i32*)*)( i32* noalias %y )
+ call <2 x i32> bitcast (i32 (i32*)* @b to <2 x i32> (i32*)*)( i32* inreg null ) ; <<2 x i32>>:1 [#uses=0]
+ call void bitcast (void (...)* @c to void (i32)*)( i32 0 )
+ call void bitcast (void (...)* @c to void (i32)*)( i32 zeroext 0 )
+ ret void
}
diff --git a/test/Transforms/InstCombine/2008-01-06-VoidCast.ll b/test/Transforms/InstCombine/2008-01-06-VoidCast.ll
index 407ff4ddc29a..5dcaa38edc02 100644
--- a/test/Transforms/InstCombine/2008-01-06-VoidCast.ll
+++ b/test/Transforms/InstCombine/2008-01-06-VoidCast.ll
@@ -1,10 +1,12 @@
-; RUN: opt < %s -instcombine -S | not grep bitcast
+; RUN: opt < %s -instcombine -S | FileCheck %s
define void @f(i16 %y) {
- ret void
+ ret void
}
define i32 @g(i32 %y) {
- %x = call i32 bitcast (void (i16)* @f to i32 (i32)*)( i32 %y ) ; <i32> [#uses=1]
- ret i32 %x
+; CHECK-LABEL: @g(
+; CHECK: call i32 bitcast
+ %x = call i32 bitcast (void (i16)* @f to i32 (i32)*)( i32 %y ) ; <i32> [#uses=1]
+ ret i32 %x
}
diff --git a/test/Transforms/InstCombine/2008-01-27-FloatSelect.ll b/test/Transforms/InstCombine/2008-01-27-FloatSelect.ll
index c161bcc9045d..6b4e89dbbe60 100644
--- a/test/Transforms/InstCombine/2008-01-27-FloatSelect.ll
+++ b/test/Transforms/InstCombine/2008-01-27-FloatSelect.ll
@@ -1,4 +1,5 @@
-; RUN: opt < %s -instcombine -S | grep select
+; RUN: opt < %s -instcombine -S | FileCheck %s
+; CHECK: select
define double @fold(i1 %a, double %b) {
%s = select i1 %a, double 0., double 1.
diff --git a/test/Transforms/InstCombine/2008-02-13-MulURem.ll b/test/Transforms/InstCombine/2008-02-13-MulURem.ll
index a88c51097247..d85ef97553ab 100644
--- a/test/Transforms/InstCombine/2008-02-13-MulURem.ll
+++ b/test/Transforms/InstCombine/2008-02-13-MulURem.ll
@@ -1,6 +1,8 @@
-; RUN: opt < %s -instcombine -S | grep rem
+; RUN: opt < %s -instcombine -S | FileCheck %s
; PR1933
+; CHECK: rem
+
define i32 @fold(i32 %a) {
%s = mul i32 %a, 3
%c = urem i32 %s, 3
diff --git a/test/Transforms/InstCombine/2008-05-31-AddBool.ll b/test/Transforms/InstCombine/2008-05-31-AddBool.ll
index ed2069041d1b..31b17196d8f5 100644
--- a/test/Transforms/InstCombine/2008-05-31-AddBool.ll
+++ b/test/Transforms/InstCombine/2008-05-31-AddBool.ll
@@ -1,6 +1,8 @@
-; RUN: opt < %s -instcombine -S | grep "xor"
+; RUN: opt < %s -instcombine -S | FileCheck %s
; PR2389
+; CHECK: xor
+
define i1 @test(i1 %a, i1 %b) {
%A = add i1 %a, %b
ret i1 %A
diff --git a/test/Transforms/InstCombine/2008-11-20-DivMulRem.ll b/test/Transforms/InstCombine/2008-11-20-DivMulRem.ll
index 43af190abcea..0c0e55a0b2d9 100644
--- a/test/Transforms/InstCombine/2008-11-20-DivMulRem.ll
+++ b/test/Transforms/InstCombine/2008-11-20-DivMulRem.ll
@@ -2,7 +2,7 @@
; PR3103
define i8 @test1(i8 %x, i8 %y) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
%A = udiv i8 %x, %y
; CHECK-NEXT: urem
%B = mul i8 %A, %y
@@ -12,7 +12,7 @@ define i8 @test1(i8 %x, i8 %y) {
}
define i8 @test2(i8 %x, i8 %y) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
%A = sdiv i8 %x, %y
; CHECK-NEXT: srem
%B = mul i8 %A, %y
@@ -22,7 +22,7 @@ define i8 @test2(i8 %x, i8 %y) {
}
define i8 @test3(i8 %x, i8 %y) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
%A = udiv i8 %x, %y
; CHECK-NEXT: urem
%B = mul i8 %A, %y
@@ -33,7 +33,7 @@ define i8 @test3(i8 %x, i8 %y) {
}
define i8 @test4(i8 %x) {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
%A = udiv i8 %x, 3
; CHECK-NEXT: urem
%B = mul i8 %A, -3
@@ -45,7 +45,7 @@ define i8 @test4(i8 %x) {
}
define i32 @test5(i32 %x, i32 %y) {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; (((X / Y) * Y) / Y) -> X / Y
%div = sdiv i32 %x, %y
; CHECK-NEXT: sdiv
@@ -56,7 +56,7 @@ define i32 @test5(i32 %x, i32 %y) {
}
define i32 @test6(i32 %x, i32 %y) {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; (((X / Y) * Y) / Y) -> X / Y
%div = udiv i32 %x, %y
; CHECK-NEXT: udiv
diff --git a/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll b/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll
index 949fc592203f..e3543116a666 100644
--- a/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll
+++ b/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll
@@ -5,7 +5,7 @@ target triple = "i386-apple-darwin9.6"
define i32 @test(i32* %P) nounwind {
entry:
- %Q = bitcast i32* %P to i32 addrspace(1)*
+ %Q = addrspacecast i32* %P to i32 addrspace(1)*
store i32 0, i32 addrspace(1)* %Q, align 4
ret i32 0
}
diff --git a/test/Transforms/InstCombine/2010-03-03-ExtElim.ll b/test/Transforms/InstCombine/2010-03-03-ExtElim.ll
index bb3159e1e6fa..b1384ec00209 100644
--- a/test/Transforms/InstCombine/2010-03-03-ExtElim.ll
+++ b/test/Transforms/InstCombine/2010-03-03-ExtElim.ll
@@ -1,5 +1,4 @@
; RUN: opt -instcombine -S < %s | FileCheck %s
-; PR6486
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:32:32-n8:16:32"
target triple = "i386-unknown-linux-gnu"
@@ -7,8 +6,8 @@ target triple = "i386-unknown-linux-gnu"
@g_92 = common global [2 x i32*] zeroinitializer, align 4 ; <[2 x i32*]*> [#uses=1]
@g_177 = constant i32** bitcast (i8* getelementptr (i8* bitcast ([2 x i32*]* @g_92 to i8*), i64 4) to i32**), align 4 ; <i32***> [#uses=1]
-define i1 @test() nounwind {
-; CHECK: @test
+define i1 @PR6486() nounwind {
+; CHECK-LABEL: @PR6486(
%tmp = load i32*** @g_177 ; <i32**> [#uses=1]
%cmp = icmp ne i32** null, %tmp ; <i1> [#uses=1]
%conv = zext i1 %cmp to i32 ; <i32> [#uses=1]
@@ -16,3 +15,18 @@ define i1 @test() nounwind {
ret i1 %cmp1
; CHECK: ret i1 true
}
+
+@d = common global i32 0, align 4
+@a = common global [1 x i32] zeroinitializer, align 4
+
+define i1 @PR16462_1() nounwind {
+; CHECK-LABEL: @PR16462_1(
+ ret i1 icmp sgt (i32 sext (i16 trunc (i32 select (i1 icmp eq (i32* getelementptr inbounds ([1 x i32]* @a, i32 0, i32 0), i32* @d), i32 0, i32 1) to i16) to i32), i32 65535)
+; CHECK: ret i1 icmp sgt (i32 sext (i16 trunc (i32 select (i1 icmp eq (i32* getelementptr inbounds ([1 x i32]* @a, i32 0, i32 0), i32* @d), i32 0, i32 1) to i16) to i32), i32 65535)
+}
+
+define i1 @PR16462_2() nounwind {
+; CHECK-LABEL: @PR16462_2(
+ ret i1 icmp sgt (i32 sext (i16 trunc (i32 select (i1 icmp eq (i32* getelementptr inbounds ([1 x i32]* @a, i32 0, i32 0), i32* @d), i32 0, i32 1) to i16) to i32), i32 42)
+; CHECK: ret i1 icmp sgt (i16 trunc (i32 select (i1 icmp eq (i32* getelementptr inbounds ([1 x i32]* @a, i32 0, i32 0), i32* @d), i32 0, i32 1) to i16), i16 42)
+}
diff --git a/test/Transforms/InstCombine/2010-11-01-lshr-mask.ll b/test/Transforms/InstCombine/2010-11-01-lshr-mask.ll
index 800162197919..1549c0d0f46e 100644
--- a/test/Transforms/InstCombine/2010-11-01-lshr-mask.ll
+++ b/test/Transforms/InstCombine/2010-11-01-lshr-mask.ll
@@ -1,7 +1,7 @@
; RUN: opt -instcombine -S < %s | FileCheck %s
; <rdar://problem/8606771>
-; CHECK: @main
+; CHECK-LABEL: @main(
define i32 @main(i32 %argc) nounwind ssp {
entry:
%tmp3151 = trunc i32 %argc to i8
@@ -23,7 +23,7 @@ entry:
}
; rdar://8739316
-; CHECK: @foo
+; CHECK-LABEL: @foo(
define i8 @foo(i8 %arg, i8 %arg1) nounwind {
bb:
%tmp = shl i8 %arg, 7
diff --git a/test/Transforms/InstCombine/2010-11-21-SizeZeroTypeGEP.ll b/test/Transforms/InstCombine/2010-11-21-SizeZeroTypeGEP.ll
index 720365c4d6b2..80983ef27098 100644
--- a/test/Transforms/InstCombine/2010-11-21-SizeZeroTypeGEP.ll
+++ b/test/Transforms/InstCombine/2010-11-21-SizeZeroTypeGEP.ll
@@ -3,14 +3,14 @@
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"
define {}* @foo({}* %x, i32 %n) {
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK-NOT: getelementptr
%p = getelementptr {}* %x, i32 %n
ret {}* %p
}
define i8* @bar(i64 %n, {{}, [0 x {[0 x i8]}]}* %p) {
-; CHECK: @bar
+; CHECK-LABEL: @bar(
%g = getelementptr {{}, [0 x {[0 x i8]}]}* %p, i64 %n, i32 1, i64 %n, i32 0, i64 %n
; CHECK: %p, i64 0, i32 1, i64 0, i32 0, i64 %n
ret i8* %g
diff --git a/test/Transforms/InstCombine/2010-11-23-Distributed.ll b/test/Transforms/InstCombine/2010-11-23-Distributed.ll
index 4f8e8dc713b4..20bfed87798b 100644
--- a/test/Transforms/InstCombine/2010-11-23-Distributed.ll
+++ b/test/Transforms/InstCombine/2010-11-23-Distributed.ll
@@ -1,6 +1,6 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
define i32 @foo(i32 %x, i32 %y) {
-; CHECK: @foo
+; CHECK-LABEL: @foo(
%add = add nsw i32 %y, %x
%mul = mul nsw i32 %add, %y
%square = mul nsw i32 %y, %y
@@ -11,7 +11,7 @@ define i32 @foo(i32 %x, i32 %y) {
}
define i1 @bar(i64 %x, i64 %y) {
-; CHECK: @bar
+; CHECK-LABEL: @bar(
%a = and i64 %y, %x
; CHECK: and
; CHECK-NOT: and
diff --git a/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll b/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll
index fedb46dd24ad..a75a4656e68a 100644
--- a/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll
+++ b/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll
@@ -2,7 +2,7 @@
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
target triple = "i386-apple-darwin10.0.0"
-; CHECK: define void @fu1
+; CHECK-LABEL: define void @fu1(
define void @fu1(i32 %parm) nounwind ssp {
%1 = alloca i32, align 4
; CHECK: alloca double*
@@ -33,7 +33,7 @@ define void @fu1(i32 %parm) nounwind ssp {
declare void @bar(double*)
-; CHECK: define void @fu2
+; CHECK-LABEL: define void @fu2(
define void @fu2(i32 %parm) nounwind ssp {
%1 = alloca i32, align 4
%ptr = alloca double*, align 4
diff --git a/test/Transforms/InstCombine/2012-03-10-InstCombine.ll b/test/Transforms/InstCombine/2012-03-10-InstCombine.ll
index 58ccf12e6cf4..d1860bccd75e 100644
--- a/test/Transforms/InstCombine/2012-03-10-InstCombine.ll
+++ b/test/Transforms/InstCombine/2012-03-10-InstCombine.ll
@@ -2,7 +2,7 @@
; Derived from gcc.c-torture/execute/frame-address.c
-; CHECK: @func
+; CHECK-LABEL: @func(
; CHECK: return:
; CHECK-NOT: ret i32 0
; CHECK: ret i32 %retval
diff --git a/test/Transforms/InstCombine/2012-04-24-vselect.ll b/test/Transforms/InstCombine/2012-04-24-vselect.ll
index 8d2de2b2431c..211d401a3bca 100644
--- a/test/Transforms/InstCombine/2012-04-24-vselect.ll
+++ b/test/Transforms/InstCombine/2012-04-24-vselect.ll
@@ -1,6 +1,6 @@
; RUN: opt -instcombine -S < %s | FileCheck %s
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK: <i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
define <8 x i32> @foo() nounwind {
diff --git a/test/Transforms/InstCombine/2012-05-28-select-hang.ll b/test/Transforms/InstCombine/2012-05-28-select-hang.ll
index c580bacb0dcb..db1dbd5b6e2f 100644
--- a/test/Transforms/InstCombine/2012-05-28-select-hang.ll
+++ b/test/Transforms/InstCombine/2012-05-28-select-hang.ll
@@ -34,6 +34,6 @@ land.end: ; preds = %land.rhs, %entry
store i8 %conv9, i8* @a, align 1
ret void
-; CHECK: @func
+; CHECK-LABEL: @func(
; CHECK-NOT: select
}
diff --git a/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll b/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll
index 6f3df5b2fd99..4d185bf7e06e 100644
--- a/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll
+++ b/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll
@@ -1,10 +1,10 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
-; CHECK: bitcast
+; CHECK: addrspacecast
@base = internal addrspace(3) unnamed_addr global [16 x i32] zeroinitializer, align 16
declare void @foo(i32*)
define void @test() nounwind {
- call void @foo(i32* getelementptr (i32* bitcast ([16 x i32] addrspace(3)* @base to i32*), i64 2147483647)) nounwind
+ call void @foo(i32* getelementptr (i32* addrspacecast ([16 x i32] addrspace(3)* @base to i32*), i64 2147483647)) nounwind
ret void
}
diff --git a/test/Transforms/InstCombine/2012-08-28-udiv_ashl.ll b/test/Transforms/InstCombine/2012-08-28-udiv_ashl.ll
index 4efaf8c17255..0374bd52afd4 100644
--- a/test/Transforms/InstCombine/2012-08-28-udiv_ashl.ll
+++ b/test/Transforms/InstCombine/2012-08-28-udiv_ashl.ll
@@ -5,7 +5,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-; CHECK: @udiv400
+; CHECK-LABEL: @udiv400(
; CHECK: udiv i32 %x, 400
; CHECK: ret
define i32 @udiv400(i32 %x) {
@@ -16,7 +16,7 @@ entry:
}
-; CHECK: @udiv400_no
+; CHECK-LABEL: @udiv400_no(
; CHECK: ashr
; CHECK: div
; CHECK: ret
@@ -27,7 +27,7 @@ entry:
ret i32 %div1
}
-; CHECK: @sdiv400_yes
+; CHECK-LABEL: @sdiv400_yes(
; CHECK: udiv i32 %x, 400
; CHECK: ret
define i32 @sdiv400_yes(i32 %x) {
@@ -41,7 +41,7 @@ entry:
}
-; CHECK: @udiv_i80
+; CHECK-LABEL: @udiv_i80(
; CHECK: udiv i80 %x, 400
; CHECK: ret
define i80 @udiv_i80(i80 %x) {
diff --git a/test/Transforms/InstCombine/2012-09-17-ZeroSizedAlloca.ll b/test/Transforms/InstCombine/2012-09-17-ZeroSizedAlloca.ll
index ba025e92b010..7015725feb16 100644
--- a/test/Transforms/InstCombine/2012-09-17-ZeroSizedAlloca.ll
+++ b/test/Transforms/InstCombine/2012-09-17-ZeroSizedAlloca.ll
@@ -9,7 +9,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-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"
-; CHECK: @f
+; CHECK-LABEL: @f(
; CHECK-NEXT: alloca [0 x i8], align 1024
; CHECK-NOT: alloca
; CHECK: ret void
diff --git a/test/Transforms/InstCombine/2012-09-24-MemcpyFromGlobalCrash.ll b/test/Transforms/InstCombine/2012-09-24-MemcpyFromGlobalCrash.ll
index 4cd60b42fbe1..35b62850c626 100644
--- a/test/Transforms/InstCombine/2012-09-24-MemcpyFromGlobalCrash.ll
+++ b/test/Transforms/InstCombine/2012-09-24-MemcpyFromGlobalCrash.ll
@@ -8,7 +8,7 @@ declare void @bar(i8*)
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
define void @test() {
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK: llvm.memcpy
; CHECK: ret void
%A = alloca [100 x i8]
diff --git a/test/Transforms/InstCombine/2012-3-15-or-xor-constant.ll b/test/Transforms/InstCombine/2012-3-15-or-xor-constant.ll
index c1602da4c84d..466629cb5fd6 100644
--- a/test/Transforms/InstCombine/2012-3-15-or-xor-constant.ll
+++ b/test/Transforms/InstCombine/2012-3-15-or-xor-constant.ll
@@ -9,4 +9,4 @@ entry:
%or4 = or i32 or (i32 zext (i1 icmp eq (i32* @g, i32* null) to i32), i32 1), %xor
ret i32 %or4
}
-; CHECK: define i32 @function
+; CHECK-LABEL: define i32 @function(
diff --git a/test/Transforms/InstCombine/2013-03-05-Combine-BitcastTy-Into-Alloca.ll b/test/Transforms/InstCombine/2013-03-05-Combine-BitcastTy-Into-Alloca.ll
index b20c3a07c0ac..789e3172e7c4 100644
--- a/test/Transforms/InstCombine/2013-03-05-Combine-BitcastTy-Into-Alloca.ll
+++ b/test/Transforms/InstCombine/2013-03-05-Combine-BitcastTy-Into-Alloca.ll
@@ -10,7 +10,7 @@ target triple = "x86_64-apple-macosx10.9.0"
; allocation of an i96 because of the bitcast to create %2. That's not valid,
; as the other 32 bits of the structure still feed into the return value
define { i64, i64 } @function(i32 %x, i32 %y, i32 %z) nounwind {
-; CHECK: @function
+; CHECK-LABEL: @function(
; CHECK-NEXT: entry:
; CHECK-NEXT: %retval = alloca %struct._my_struct, align 8
; CHECK-NOT: bitcast i96* %retval to %struct._my_struct*
diff --git a/test/Transforms/InstCombine/ExtractCast.ll b/test/Transforms/InstCombine/ExtractCast.ll
index 5ebbefd97b3e..9a8872f2fb1f 100644
--- a/test/Transforms/InstCombine/ExtractCast.ll
+++ b/test/Transforms/InstCombine/ExtractCast.ll
@@ -1,6 +1,6 @@
; RUN: opt < %s -instcombine -S -o - | FileCheck %s
-; CHECK: @a
+; CHECK-LABEL: @a(
define i32 @a(<4 x i64> %I) {
entry:
; CHECK-NOT: trunc <4 x i64>
@@ -13,7 +13,7 @@ entry:
}
-; CHECK: @b
+; CHECK-LABEL: @b(
define i32 @b(<4 x float> %I) {
entry:
; CHECK-NOT: fptosi <4 x float>
diff --git a/test/Transforms/InstCombine/LandingPadClauses.ll b/test/Transforms/InstCombine/LandingPadClauses.ll
index de3b2d34fb94..10af4bcadf68 100644
--- a/test/Transforms/InstCombine/LandingPadClauses.ll
+++ b/test/Transforms/InstCombine/LandingPadClauses.ll
@@ -11,7 +11,7 @@ declare i32 @__objc_personality_v0(i32, i64, i8*, i8*)
declare void @bar()
define void @foo_generic() {
-; CHECK: @foo_generic
+; CHECK-LABEL: @foo_generic(
invoke void @bar()
to label %cont.a unwind label %lpad.a
cont.a:
@@ -131,7 +131,7 @@ lpad.i:
}
define void @foo_cxx() {
-; CHECK: @foo_cxx
+; CHECK-LABEL: @foo_cxx(
invoke void @bar()
to label %cont.a unwind label %lpad.a
cont.a:
@@ -182,7 +182,7 @@ lpad.d:
}
define void @foo_objc() {
-; CHECK: @foo_objc
+; CHECK-LABEL: @foo_objc(
invoke void @bar()
to label %cont.a unwind label %lpad.a
cont.a:
diff --git a/test/Transforms/SimplifyLibCalls/PR7357.ll b/test/Transforms/InstCombine/PR7357.ll
index 3529a9cfb1b8..c397c5ee05e3 100644
--- a/test/Transforms/SimplifyLibCalls/PR7357.ll
+++ b/test/Transforms/InstCombine/PR7357.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s "-default-data-layout=e-p:32:32:32-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-n32" -simplify-libcalls -S | FileCheck %s
+; RUN: opt < %s "-default-data-layout=e-p:32:32:32-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-n32" -instcombine -S | FileCheck %s
@.str1 = private constant [11 x i8] c"(){};[]&|:\00", align 4
; check that simplify libcalls will not replace a call with one calling
@@ -8,9 +8,10 @@
; CHECK: call arm_aapcscc i8* @strchr
define arm_aapcscc i32 @foo(i32 %argc) nounwind {
bb.nph:
- call arm_aapcscc i8* @strchr(i8* getelementptr ([11 x i8]* @.str1, i32 0,
+ %c = call arm_aapcscc i8* @strchr(i8* getelementptr ([11 x i8]* @.str1, i32 0,
i32 0), i32 %argc) nounwind readonly
- ret i32 0
+ %p = ptrtoint i8* %c to i32
+ ret i32 %p
}
declare arm_aapcscc i8* @strchr(i8*, i32) nounwind readonly
diff --git a/test/Transforms/InstCombine/abs-1.ll b/test/Transforms/InstCombine/abs-1.ll
index 807f238755b5..2c223edcfa74 100644
--- a/test/Transforms/InstCombine/abs-1.ll
+++ b/test/Transforms/InstCombine/abs-1.ll
@@ -11,7 +11,7 @@ declare i64 @llabs(i64)
; Check abs(x) -> x >s -1 ? x : -x.
define i32 @test_simplify1(i32 %x) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%ret = call i32 @abs(i32 %x)
; CHECK-NEXT: [[ISPOS:%[a-z0-9]+]] = icmp sgt i32 %x, -1
; CHECK-NEXT: [[NEG:%[a-z0-9]+]] = sub i32 0, %x
@@ -21,7 +21,7 @@ define i32 @test_simplify1(i32 %x) {
}
define i64 @test_simplify2(i64 %x) {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%ret = call i64 @labs(i64 %x)
; CHECK-NEXT: [[ISPOS:%[a-z0-9]+]] = icmp sgt i64 %x, -1
; CHECK-NEXT: [[NEG:%[a-z0-9]+]] = sub i64 0, %x
@@ -31,7 +31,7 @@ define i64 @test_simplify2(i64 %x) {
}
define i64 @test_simplify3(i64 %x) {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%ret = call i64 @llabs(i64 %x)
; CHECK-NEXT: [[ISPOS:%[a-z0-9]+]] = icmp sgt i64 %x, -1
; CHECK-NEXT: [[NEG:%[a-z0-9]+]] = sub i64 0, %x
diff --git a/test/Transforms/InstCombine/add2.ll b/test/Transforms/InstCombine/add2.ll
index c5109c528857..0964bc00d1cb 100644
--- a/test/Transforms/InstCombine/add2.ll
+++ b/test/Transforms/InstCombine/add2.ll
@@ -6,7 +6,7 @@ define i64 @test1(i64 %A, i32 %B) {
%tmp5 = add i64 %tmp3, %A
%tmp6 = and i64 %tmp5, 123
ret i64 %tmp6
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: and i64 %A, 123
; CHECK-NEXT: ret i64
}
@@ -16,7 +16,7 @@ define i32 @test2(i32 %A) {
%C = and i32 %A, 32
%F = add i32 %B, %C
ret i32 %F
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: and i32 %A, 39
; CHECK-NEXT: ret i32
}
@@ -26,7 +26,7 @@ define i32 @test3(i32 %A) {
%C = lshr i32 %A, 30
%F = add i32 %B, %C
ret i32 %F
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: and
; CHECK-NEXT: lshr
; CHECK-NEXT: or i32 %B, %C
@@ -36,7 +36,7 @@ define i32 @test3(i32 %A) {
define i32 @test4(i32 %A) {
%B = add nuw i32 %A, %A
ret i32 %B
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NEXT: %B = shl nuw i32 %A, 1
; CHECK-NEXT: ret i32 %B
}
diff --git a/test/Transforms/InstCombine/add4.ll b/test/Transforms/InstCombine/add4.ll
index 0fc0a6c1ac26..208c7f03200e 100644
--- a/test/Transforms/InstCombine/add4.ll
+++ b/test/Transforms/InstCombine/add4.ll
@@ -1,9 +1,5 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
-;; Target triple for gep raising case below.
-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 = "i686-apple-darwin8"
-
define float @test1(float %A, float %B, i1 %C) {
EntryBlock:
;; A*(1 - uitofp i1 C) -> select C, 0, A
@@ -11,7 +7,7 @@ EntryBlock:
%mc = fsub float 1.000000e+00, %cf
%p1 = fmul fast float %A, %mc
ret float %p1
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: select i1 %C, float -0.000000e+00, float %A
}
@@ -21,38 +17,63 @@ EntryBlock:
%cf = uitofp i1 %C to float
%p2 = fmul fast float %B, %cf
ret float %p2
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: select i1 %C, float %B, float -0.000000e+00
}
define float @test3(float %A, float %B, i1 %C) {
EntryBlock:
+ ;; select C, 0, B + select C, A, 0 -> select C, A, B
+ %cf = uitofp i1 %C to float
+ %s1 = select i1 %C, float 0.000000e+00, float %B
+ %s2 = select i1 %C, float %A, float 0.000000e+00
+ %sum = fadd fast float %s1, %s2
+ ret float %sum
+; CHECK-LABEL: @test3(
+; CHECK: select i1 %C, float %A, float %B
+}
+
+define float @test4(float %A, float %B, i1 %C) {
+EntryBlock:
+ ;; B*(uitofp i1 C) + A*(1 - uitofp i1 C) -> select C, A, B
+ %cf = uitofp i1 %C to float
+ %mc = fsub fast float 1.000000e+00, %cf
+ %p1 = fmul fast float %A, %mc
+ %p2 = fmul fast float %B, %cf
+ %s1 = fadd fast float %p2, %p1
+ ret float %s1
+; CHECK-LABEL: @test4(
+; CHECK: select i1 %C, float %B, float %A
+}
+
+define float @test5(float %A, float %B, i1 %C) {
+EntryBlock:
;; A*(1 - uitofp i1 C) + B*(uitofp i1 C) -> select C, A, B
%cf = uitofp i1 %C to float
- %mc = fsub float 1.000000e+00, %cf
+ %mc = fsub fast float 1.000000e+00, %cf
%p1 = fmul fast float %A, %mc
%p2 = fmul fast float %B, %cf
%s1 = fadd fast float %p1, %p2
ret float %s1
-; CHECK: @test3
+; CHECK-LABEL: @test5(
; CHECK: select i1 %C, float %B, float %A
}
; PR15952
-define float @test4(float %A, float %B, i32 %C) {
+define float @test6(float %A, float %B, i32 %C) {
%cf = uitofp i32 %C to float
%mc = fsub float 1.000000e+00, %cf
%p1 = fmul fast float %A, %mc
ret float %p1
-; CHECK: @test4
+; CHECK-LABEL: @test6(
; CHECK: uitofp
}
-define float @test5(float %A, float %B, i32 %C) {
+define float @test7(float %A, float %B, i32 %C) {
%cf = uitofp i32 %C to float
%p2 = fmul fast float %B, %cf
ret float %p2
-; CHECK: @test5
+; CHECK-LABEL: @test7(
; CHECK: uitofp
}
diff --git a/test/Transforms/InstCombine/addrspacecast.ll b/test/Transforms/InstCombine/addrspacecast.ll
new file mode 100644
index 000000000000..d908b556e195
--- /dev/null
+++ b/test/Transforms/InstCombine/addrspacecast.ll
@@ -0,0 +1,69 @@
+; RUN: opt -instcombine -S < %s | FileCheck %s
+
+target datalayout = "e-p:64:64:64-p1:32:32:32-p2:16:16:16-n8:16:32:64"
+
+
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) nounwind
+declare void @llvm.memcpy.p0i8.p1i8.i32(i8*, i8 addrspace(1)*, i32, i32, i1) nounwind
+declare void @llvm.memcpy.p0i8.p2i8.i32(i8*, i8 addrspace(2)*, i32, i32, i1) nounwind
+
+
+define i32* @combine_redundant_addrspacecast(i32 addrspace(1)* %x) nounwind {
+; CHECK-LABEL: @combine_redundant_addrspacecast(
+; CHECK: addrspacecast i32 addrspace(1)* %x to i32*
+; CHECK-NEXT: ret
+ %y = addrspacecast i32 addrspace(1)* %x to i32 addrspace(3)*
+ %z = addrspacecast i32 addrspace(3)* %y to i32*
+ ret i32* %z
+}
+
+define <4 x i32*> @combine_redundant_addrspacecast_vector(<4 x i32 addrspace(1)*> %x) nounwind {
+; CHECK-LABEL: @combine_redundant_addrspacecast_vector(
+; CHECK: addrspacecast <4 x i32 addrspace(1)*> %x to <4 x i32*>
+; CHECK-NEXT: ret
+ %y = addrspacecast <4 x i32 addrspace(1)*> %x to <4 x i32 addrspace(3)*>
+ %z = addrspacecast <4 x i32 addrspace(3)*> %y to <4 x i32*>
+ ret <4 x i32*> %z
+}
+
+define float* @combine_redundant_addrspacecast_types(i32 addrspace(1)* %x) nounwind {
+; CHECK-LABEL: @combine_redundant_addrspacecast_types(
+; CHECK: addrspacecast i32 addrspace(1)* %x to float*
+; CHECK-NEXT: ret
+ %y = addrspacecast i32 addrspace(1)* %x to i32 addrspace(3)*
+ %z = addrspacecast i32 addrspace(3)* %y to float*
+ ret float* %z
+}
+
+@const_array = addrspace(2) constant [60 x i8] [i8 2, i8 9, i8 4, i8 22, i8 2, i8 9, i8 4, i8 22, i8 2, i8 9, i8 4, i8 22,
+ i8 2, i8 9, i8 4, i8 22, i8 2, i8 9, i8 4, i8 22, i8 2, i8 9, i8 4, i8 22,
+ i8 2, i8 9, i8 4, i8 22, i8 2, i8 9, i8 4, i8 22, i8 2, i8 9, i8 4, i8 22,
+ i8 2, i8 9, i8 4, i8 22, i8 2, i8 9, i8 4, i8 22, i8 2, i8 9, i8 4, i8 22,
+ i8 2, i8 9, i8 4, i8 22, i8 2, i8 9, i8 4, i8 22, i8 2, i8 9, i8 4, i8 22 ]
+
+declare void @foo(i8*) nounwind
+
+; A copy from a constant addrspacecast'ed global
+; CHECK-LABEL: @memcpy_addrspacecast(
+; CHECK-NOT: call void @llvm.memcpy
+define i32 @memcpy_addrspacecast() nounwind {
+entry:
+ %alloca = alloca i8, i32 48
+ call void @llvm.memcpy.p0i8.p1i8.i32(i8* %alloca, i8 addrspace(1)* addrspacecast (i8 addrspace(2)* getelementptr inbounds ([60 x i8] addrspace(2)* @const_array, i16 0, i16 4) to i8 addrspace(1)*), i32 48, i32 4, i1 false) nounwind
+ br label %loop.body
+
+loop.body:
+ %i = phi i32 [ 0, %entry ], [ %i.inc, %loop.body ]
+ %sum = phi i32 [ 0, %entry ], [ %sum.inc, %loop.body]
+ %ptr = getelementptr i8* %alloca, i32 %i
+ %load = load i8* %ptr
+ %ext = zext i8 %load to i32
+ %sum.inc = add i32 %sum, %ext
+ %i.inc = add i32 %i, 1
+ %cmp = icmp ne i32 %i, 48
+ br i1 %cmp, label %loop.body, label %end
+
+end:
+ ret i32 %sum.inc
+}
+
diff --git a/test/Transforms/InstCombine/align-addr.ll b/test/Transforms/InstCombine/align-addr.ll
index 4ea1bd9beb3b..4d22c2cd2ef2 100644
--- a/test/Transforms/InstCombine/align-addr.ll
+++ b/test/Transforms/InstCombine/align-addr.ll
@@ -1,10 +1,10 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
-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"
+target datalayout = "E-p:64:64:64-p1:32:32:32-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"
; Instcombine should be able to prove vector alignment in the
; presence of a few mild address computation tricks.
-; CHECK: @test0(
+; CHECK-LABEL: @test0(
; CHECK: align 16
define void @test0(i8* %b, i64 %n, i64 %u, i64 %y) nounwind {
@@ -35,7 +35,7 @@ return:
; When we see a unaligned load from an insufficiently aligned global or
; alloca, increase the alignment of the load, turning it into an aligned load.
-; CHECK: @test1(
+; CHECK-LABEL: @test1(
; CHECK: tmp = load
; CHECK: GLOBAL{{.*}}align 16
@@ -47,9 +47,30 @@ entry:
ret <16 x i8> %tmp
}
+@GLOBAL_as1 = internal addrspace(1) global [4 x i32] zeroinitializer
+
+define <16 x i8> @test1_as1(<2 x i64> %x) {
+; CHECK-LABEL: @test1_as1(
+; CHECK: tmp = load
+; CHECK: GLOBAL_as1{{.*}}align 16
+ %tmp = load <16 x i8> addrspace(1)* bitcast ([4 x i32] addrspace(1)* @GLOBAL_as1 to <16 x i8> addrspace(1)*), align 1
+ ret <16 x i8> %tmp
+}
+
+@GLOBAL_as1_gep = internal addrspace(1) global [8 x i32] zeroinitializer
+
+define <16 x i8> @test1_as1_gep(<2 x i64> %x) {
+; CHECK-LABEL: @test1_as1_gep(
+; CHECK: tmp = load
+; CHECK: GLOBAL_as1_gep{{.*}}align 16
+ %tmp = load <16 x i8> addrspace(1)* bitcast (i32 addrspace(1)* getelementptr ([8 x i32] addrspace(1)* @GLOBAL_as1_gep, i16 0, i16 4) to <16 x i8> addrspace(1)*), align 1
+ ret <16 x i8> %tmp
+}
+
+
; When a load or store lacks an explicit alignment, add one.
-; CHECK: @test2(
+; CHECK-LABEL: @test2(
; CHECK: load double* %p, align 8
; CHECK: store double %n, double* %p, align 8
@@ -67,7 +88,7 @@ declare void @use(i8*)
define void @test3(%struct.s* sret %a4) {
; Check that the alignment is bumped up the alignment of the sret type.
-; CHECK: @test3
+; CHECK-LABEL: @test3(
%a4.cast = bitcast %struct.s* %a4 to i8*
call void @llvm.memset.p0i8.i64(i8* %a4.cast, i8 0, i64 16, i32 1, i1 false)
; CHECK: call void @llvm.memset.p0i8.i64(i8* %a4.cast, i8 0, i64 16, i32 4, i1 false)
diff --git a/test/Transforms/InstCombine/align-external.ll b/test/Transforms/InstCombine/align-external.ll
index c3ef2dbb70f0..66ff9c16e424 100644
--- a/test/Transforms/InstCombine/align-external.ll
+++ b/test/Transforms/InstCombine/align-external.ll
@@ -22,7 +22,7 @@ define i64 @foo(i64 %a) {
}
define i32 @bar() {
-; CHECK: @bar
+; CHECK-LABEL: @bar(
%r = load i32* @B, align 1
; CHECK: align 1
ret i32 %r
diff --git a/test/Transforms/InstCombine/alloca.ll b/test/Transforms/InstCombine/alloca.ll
index 68a671cec88a..ae1cfa1ed2fc 100644
--- a/test/Transforms/InstCombine/alloca.ll
+++ b/test/Transforms/InstCombine/alloca.ll
@@ -1,14 +1,14 @@
-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"
+; RUN: opt < %s -instcombine -S -default-data-layout="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" | FileCheck %s
+; RUN: opt < %s -instcombine -S -default-data-layout="E-p:32:32:32-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" | FileCheck %s -check-prefix=P32
+; RUN: opt < %s -instcombine -S | FileCheck %s -check-prefix=NODL
-; RUN: opt < %s -instcombine -S | FileCheck %s
-; END.
declare void @use(...)
@int = global i32 zeroinitializer
; Zero byte allocas should be merged if they can't be deleted.
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK: alloca
; CHECK-NOT: alloca
define void @test() {
@@ -25,7 +25,7 @@ define void @test() {
}
; Zero byte allocas should be deleted.
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NOT: alloca
define void @test2() {
%A = alloca i32 ; <i32*> [#uses=1]
@@ -34,7 +34,7 @@ define void @test2() {
}
; Zero byte allocas should be deleted.
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NOT: alloca
define void @test3() {
%A = alloca { i32 } ; <{ i32 }*> [#uses=1]
@@ -43,7 +43,7 @@ define void @test3() {
ret void
}
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: = zext i32 %n to i64
; CHECK: %A = alloca i32, i64 %
define i32* @test4(i32 %n) {
@@ -54,7 +54,7 @@ define i32* @test4(i32 %n) {
; Allocas which are only used by GEPs, bitcasts, and stores (transitively)
; should be deleted.
define void @test5() {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NOT: alloca
; CHECK-NOT: store
; CHECK: ret
@@ -80,7 +80,7 @@ declare void @f(i32* %p)
; Check that we don't delete allocas in some erroneous cases.
define void @test6() {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NOT: ret
; CHECK: alloca
; CHECK-NEXT: alloca
@@ -110,3 +110,22 @@ entry:
}
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
+
+
+; Check that the GEP indices use the pointer size, or 64 if unknown
+define void @test8() {
+; CHECK-LABEL: @test8(
+; CHECK: alloca [100 x i32]
+; CHECK: getelementptr inbounds [100 x i32]* %x1, i64 0, i64 0
+
+; P32-LABEL: @test8(
+; P32: alloca [100 x i32]
+; P32: getelementptr inbounds [100 x i32]* %x1, i32 0, i32 0
+
+; NODL-LABEL: @test8(
+; NODL: alloca [100 x i32]
+; NODL: getelementptr inbounds [100 x i32]* %x1, i64 0, i64 0
+ %x = alloca i32, i32 100
+ call void (...)* @use(i32* %x)
+ ret void
+}
diff --git a/test/Transforms/InstCombine/and-xor-or.ll b/test/Transforms/InstCombine/and-xor-or.ll
index 7ff810b6eeec..ec36d13ec1af 100644
--- a/test/Transforms/InstCombine/and-xor-or.ll
+++ b/test/Transforms/InstCombine/and-xor-or.ll
@@ -7,7 +7,7 @@ define i64 @or(i64 %x, i64 %y) nounwind uwtable readnone ssp {
%2 = xor i64 %y, %x
%3 = add i64 %1, %2
ret i64 %3
-; CHECK: @or
+; CHECK-LABEL: @or(
; CHECK: or i64
; CHECK-NEXT: ret
}
@@ -18,7 +18,7 @@ define i64 @or2(i64 %x, i64 %y) nounwind uwtable readnone ssp {
%2 = xor i64 %y, %x
%3 = or i64 %1, %2
ret i64 %3
-; CHECK: @or2
+; CHECK-LABEL: @or2(
; CHECK: or i64
; CHECK-NEXT: ret
}
diff --git a/test/Transforms/InstCombine/and.ll b/test/Transforms/InstCombine/and.ll
index 8492df9a1209..3d36bfb404d1 100644
--- a/test/Transforms/InstCombine/and.ll
+++ b/test/Transforms/InstCombine/and.ll
@@ -186,9 +186,9 @@ define i1 @test25(i32 %A) {
}
define i1 @test26(i32 %A) {
- %B = icmp ne i32 %A, 50 ; <i1> [#uses=1]
- %C = icmp ne i32 %A, 51 ; <i1> [#uses=1]
- ;; (A-50) > 1
+ %B = icmp ne i32 %A, 49 ; <i1> [#uses=1]
+ %C = icmp ne i32 %A, 50 ; <i1> [#uses=1]
+ ;; (A-49) > 1
%D = and i1 %B, %C ; <i1> [#uses=1]
ret i1 %D
}
diff --git a/test/Transforms/InstCombine/and2.ll b/test/Transforms/InstCombine/and2.ll
index 531aedb668a0..e88fd5983003 100644
--- a/test/Transforms/InstCombine/and2.ll
+++ b/test/Transforms/InstCombine/and2.ll
@@ -13,7 +13,7 @@ define i1 @test2(i1 %X, i1 %Y) {
%a = and i1 %X, %Y
%b = and i1 %a, %X
ret i1 %b
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: and i1 %X, %Y
; CHECK-NEXT: ret
}
@@ -22,7 +22,7 @@ define i32 @test3(i32 %X, i32 %Y) {
%a = and i32 %X, %Y
%b = and i32 %Y, %a
ret i32 %b
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: and i32 %X, %Y
; CHECK-NEXT: ret
}
@@ -32,7 +32,7 @@ define i1 @test4(i32 %X) {
%b = icmp slt i32 %X, 0
%c = and i1 %a, %b
ret i1 %c
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NEXT: ret i1 false
}
@@ -42,3 +42,15 @@ define <4 x i32> @test5(<4 x i32> %A) {
%2 = and <4 x i32> <i32 1, i32 2, i32 3, i32 4>, %1
ret <4 x i32> %2
}
+
+; Check that we combine "if x!=0 && x!=-1" into "if x+1u>1"
+define i32 @test6(i64 %x) nounwind {
+; CHECK: @test6
+; CHECK-NEXT: add i64 %x, 1
+; CHECK-NEXT: icmp ugt i64 %x.off, 1
+ %cmp1 = icmp ne i64 %x, -1
+ %not.cmp = icmp ne i64 %x, 0
+ %.cmp1 = and i1 %cmp1, %not.cmp
+ %land.ext = zext i1 %.cmp1 to i32
+ ret i32 %land.ext
+}
diff --git a/test/Transforms/InstCombine/apint-call-cast-target.ll b/test/Transforms/InstCombine/apint-call-cast-target.ll
index fe336de75242..4e98f9b2b3ac 100644
--- a/test/Transforms/InstCombine/apint-call-cast-target.ll
+++ b/test/Transforms/InstCombine/apint-call-cast-target.ll
@@ -1,16 +1,19 @@
-; RUN: opt < %s -instcombine -S | grep call | not grep bitcast
+; RUN: opt < %s -instcombine -S | FileCheck %s
target datalayout = "e-p:32:32"
target triple = "i686-pc-linux-gnu"
-
define i32 @main() {
+; CHECK-LABEL: @main(
+; CHECK: call i32 bitcast
entry:
%tmp = call i32 bitcast (i7* (i999*)* @ctime to i32 (i99*)*)( i99* null )
ret i32 %tmp
}
define i7* @ctime(i999*) {
+; CHECK-LABEL: @ctime(
+; CHECK: call i7* bitcast
entry:
%tmp = call i7* bitcast (i32 ()* @main to i7* ()*)( )
ret i7* %tmp
diff --git a/test/Transforms/InstCombine/apint-select.ll b/test/Transforms/InstCombine/apint-select.ll
index f2ea60101c5f..cf24a44d6288 100644
--- a/test/Transforms/InstCombine/apint-select.ll
+++ b/test/Transforms/InstCombine/apint-select.ll
@@ -1,6 +1,7 @@
; This test makes sure that these instructions are properly eliminated.
-; RUN: opt < %s -instcombine -S | not grep select
+; RUN: opt < %s -instcombine -S | FileCheck %s
+; CHECK-NOT: select
define i41 @test1(i1 %C) {
@@ -37,7 +38,7 @@ define i41 @test5(i41 %X) {
define i1023 @test6(i1023 %X) {
;; ((X & 27) ? 27 : 0)
- %Y = and i1023 %X, 64
+ %Y = and i1023 %X, 64
%t = icmp ne i1023 %Y, 0
%V = select i1 %t, i1023 64, i1023 0
ret i1023 %V
diff --git a/test/Transforms/InstCombine/apint-shift-simplify.ll b/test/Transforms/InstCombine/apint-shift-simplify.ll
index 14e895ad4bf6..63703ba112ac 100644
--- a/test/Transforms/InstCombine/apint-shift-simplify.ll
+++ b/test/Transforms/InstCombine/apint-shift-simplify.ll
@@ -5,7 +5,7 @@ define i41 @test0(i41 %A, i41 %B, i41 %C) {
%Y = shl i41 %B, %C
%Z = and i41 %X, %Y
ret i41 %Z
-; CHECK: @test0
+; CHECK-LABEL: @test0(
; CHECK-NEXT: and i41 %A, %B
; CHECK-NEXT: shl i41
; CHECK-NEXT: ret
@@ -16,7 +16,7 @@ define i57 @test1(i57 %A, i57 %B, i57 %C) {
%Y = lshr i57 %B, %C
%Z = or i57 %X, %Y
ret i57 %Z
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: or i57 %A, %B
; CHECK-NEXT: lshr i57
; CHECK-NEXT: ret
@@ -27,7 +27,7 @@ define i49 @test2(i49 %A, i49 %B, i49 %C) {
%Y = ashr i49 %B, %C
%Z = xor i49 %X, %Y
ret i49 %Z
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: xor i49 %A, %B
; CHECK-NEXT: ashr i49
; CHECK-NEXT: ret
diff --git a/test/Transforms/InstCombine/apint-shift.ll b/test/Transforms/InstCombine/apint-shift.ll
index 73f630ebfec6..f5764c2d5e8a 100644
--- a/test/Transforms/InstCombine/apint-shift.ll
+++ b/test/Transforms/InstCombine/apint-shift.ll
@@ -2,14 +2,14 @@
; even with arbitrary precision integers.
; RUN: opt < %s -instcombine -S | FileCheck %s
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NOT: sh
define i47 @test1(i47 %A) {
%B = shl i47 %A, 0 ; <i47> [#uses=1]
ret i47 %B
}
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NOT: sh
define i41 @test2(i7 %X) {
%A = zext i7 %X to i41 ; <i41> [#uses=1]
@@ -17,14 +17,14 @@ define i41 @test2(i7 %X) {
ret i41 %B
}
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NOT: sh
define i41 @test3(i41 %A) {
%B = ashr i41 %A, 0 ; <i41> [#uses=1]
ret i41 %B
}
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NOT: sh
define i39 @test4(i7 %X) {
%A = zext i7 %X to i39 ; <i39> [#uses=1]
@@ -32,21 +32,21 @@ define i39 @test4(i7 %X) {
ret i39 %B
}
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NOT: sh
define i55 @test5(i55 %A) {
%B = lshr i55 %A, 55 ; <i55> [#uses=1]
ret i55 %B
}
-; CHECK: @test5a
+; CHECK-LABEL: @test5a(
; CHECK-NOT: sh
define i32 @test5a(i32 %A) {
%B = shl i32 %A, 32 ; <i32> [#uses=1]
ret i32 %B
}
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: mul i55 %A, 6
define i55 @test6(i55 %A) {
%B = shl i55 %A, 1 ; <i55> [#uses=1]
@@ -54,7 +54,7 @@ define i55 @test6(i55 %A) {
ret i55 %C
}
-; CHECK: @test6a
+; CHECK-LABEL: @test6a(
; CHECK: mul i55 %A, 6
define i55 @test6a(i55 %A) {
%B = mul i55 %A, 3 ; <i55> [#uses=1]
@@ -62,7 +62,7 @@ define i55 @test6a(i55 %A) {
ret i55 %C
}
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NOT: sh
define i29 @test7(i8 %X) {
%A = zext i8 %X to i29 ; <i29> [#uses=1]
@@ -70,7 +70,7 @@ define i29 @test7(i8 %X) {
ret i29 %B
}
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK-NOT: sh
define i7 @test8(i7 %A) {
%B = shl i7 %A, 4 ; <i7> [#uses=1]
@@ -78,7 +78,7 @@ define i7 @test8(i7 %A) {
ret i7 %C
}
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK-NOT: sh
define i17 @test9(i17 %A) {
%B = shl i17 %A, 16 ; <i17> [#uses=1]
@@ -86,7 +86,7 @@ define i17 @test9(i17 %A) {
ret i17 %C
}
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK-NOT: sh
define i19 @test10(i19 %A) {
%B = lshr i19 %A, 18 ; <i19> [#uses=1]
@@ -94,7 +94,7 @@ define i19 @test10(i19 %A) {
ret i19 %C
}
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; Don't hide the shl from scalar evolution. DAGCombine will get it.
; CHECK: shl
define i23 @test11(i23 %A) {
@@ -104,7 +104,7 @@ define i23 @test11(i23 %A) {
ret i23 %C
}
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK-NOT: sh
define i47 @test12(i47 %A) {
%B = ashr i47 %A, 8 ; <i47> [#uses=1]
@@ -112,7 +112,7 @@ define i47 @test12(i47 %A) {
ret i47 %C
}
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; Don't hide the shl from scalar evolution. DAGCombine will get it.
; CHECK: shl
define i18 @test13(i18 %A) {
@@ -122,7 +122,7 @@ define i18 @test13(i18 %A) {
ret i18 %C
}
-; CHECK: @test14
+; CHECK-LABEL: @test14(
; CHECK-NOT: sh
define i35 @test14(i35 %A) {
%B = lshr i35 %A, 4 ; <i35> [#uses=1]
@@ -131,7 +131,7 @@ define i35 @test14(i35 %A) {
ret i35 %D
}
-; CHECK: @test14a
+; CHECK-LABEL: @test14a(
; CHECK-NOT: sh
define i79 @test14a(i79 %A) {
%B = shl i79 %A, 4 ; <i79> [#uses=1]
@@ -140,7 +140,7 @@ define i79 @test14a(i79 %A) {
ret i79 %D
}
-; CHECK: @test15
+; CHECK-LABEL: @test15(
; CHECK-NOT: sh
define i45 @test15(i1 %C) {
%A = select i1 %C, i45 3, i45 1 ; <i45> [#uses=1]
@@ -148,7 +148,7 @@ define i45 @test15(i1 %C) {
ret i45 %V
}
-; CHECK: @test15a
+; CHECK-LABEL: @test15a(
; CHECK-NOT: sh
define i53 @test15a(i1 %X) {
%A = select i1 %X, i8 3, i8 1 ; <i8> [#uses=1]
@@ -157,7 +157,7 @@ define i53 @test15a(i1 %X) {
ret i53 %V
}
-; CHECK: @test16
+; CHECK-LABEL: @test16(
; CHECK-NOT: sh
define i1 @test16(i84 %X) {
%tmp.3 = ashr i84 %X, 4 ; <i84> [#uses=1]
@@ -166,7 +166,7 @@ define i1 @test16(i84 %X) {
ret i1 %tmp.7
}
-; CHECK: @test17
+; CHECK-LABEL: @test17(
; CHECK-NOT: sh
define i1 @test17(i106 %A) {
%B = lshr i106 %A, 3 ; <i106> [#uses=1]
@@ -174,7 +174,7 @@ define i1 @test17(i106 %A) {
ret i1 %C
}
-; CHECK: @test18
+; CHECK-LABEL: @test18(
; CHECK-NOT: sh
define i1 @test18(i11 %A) {
%B = lshr i11 %A, 10 ; <i11> [#uses=1]
@@ -182,7 +182,7 @@ define i1 @test18(i11 %A) {
ret i1 %C
}
-; CHECK: @test19
+; CHECK-LABEL: @test19(
; CHECK-NOT: sh
define i1 @test19(i37 %A) {
%B = ashr i37 %A, 2 ; <i37> [#uses=1]
@@ -190,7 +190,7 @@ define i1 @test19(i37 %A) {
ret i1 %C
}
-; CHECK: @test19a
+; CHECK-LABEL: @test19a(
; CHECK-NOT: sh
define i1 @test19a(i39 %A) {
%B = ashr i39 %A, 2 ; <i39> [#uses=1]
@@ -198,7 +198,7 @@ define i1 @test19a(i39 %A) {
ret i1 %C
}
-; CHECK: @test20
+; CHECK-LABEL: @test20(
; CHECK-NOT: sh
define i1 @test20(i13 %A) {
%B = ashr i13 %A, 12 ; <i13> [#uses=1]
@@ -206,7 +206,7 @@ define i1 @test20(i13 %A) {
ret i1 %C
}
-; CHECK: @test21
+; CHECK-LABEL: @test21(
; CHECK-NOT: sh
define i1 @test21(i12 %A) {
%B = shl i12 %A, 6 ; <i12> [#uses=1]
@@ -214,7 +214,7 @@ define i1 @test21(i12 %A) {
ret i1 %C
}
-; CHECK: @test22
+; CHECK-LABEL: @test22(
; CHECK-NOT: sh
define i1 @test22(i14 %A) {
%B = shl i14 %A, 7 ; <i14> [#uses=1]
@@ -222,7 +222,7 @@ define i1 @test22(i14 %A) {
ret i1 %C
}
-; CHECK: @test23
+; CHECK-LABEL: @test23(
; CHECK-NOT: sh
define i11 @test23(i44 %A) {
%B = shl i44 %A, 33 ; <i44> [#uses=1]
@@ -231,7 +231,7 @@ define i11 @test23(i44 %A) {
ret i11 %D
}
-; CHECK: @test25
+; CHECK-LABEL: @test25(
; CHECK-NOT: sh
define i37 @test25(i37 %tmp.2, i37 %AA) {
%x = lshr i37 %AA, 17 ; <i37> [#uses=1]
@@ -241,7 +241,7 @@ define i37 @test25(i37 %tmp.2, i37 %AA) {
ret i37 %tmp.6
}
-; CHECK: @test26
+; CHECK-LABEL: @test26(
; CHECK-NOT: sh
define i40 @test26(i40 %A) {
%B = lshr i40 %A, 1 ; <i40> [#uses=1]
diff --git a/test/Transforms/InstCombine/apint-shl-trunc.ll b/test/Transforms/InstCombine/apint-shl-trunc.ll
index f2dc7d5130a9..b4450d4a3a00 100644
--- a/test/Transforms/InstCombine/apint-shl-trunc.ll
+++ b/test/Transforms/InstCombine/apint-shl-trunc.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
define i1 @test0(i39 %X, i39 %A) {
-; CHECK: @test0
+; CHECK-LABEL: @test0(
; CHECK: %[[V1:.*]] = shl i39 1, %A
; CHECK: %[[V2:.*]] = and i39 %[[V1]], %X
; CHECK: %[[V3:.*]] = icmp ne i39 %[[V2]], 0
@@ -13,7 +13,7 @@ define i1 @test0(i39 %X, i39 %A) {
}
define i1 @test1(i799 %X, i799 %A) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %[[V1:.*]] = shl i799 1, %A
; CHECK: %[[V2:.*]] = and i799 %[[V1]], %X
; CHECK: %[[V3:.*]] = icmp ne i799 %[[V2]], 0
diff --git a/test/Transforms/InstCombine/atomic.ll b/test/Transforms/InstCombine/atomic.ll
index 097cf5eafe06..ccee87433f32 100644
--- a/test/Transforms/InstCombine/atomic.ll
+++ b/test/Transforms/InstCombine/atomic.ll
@@ -6,7 +6,7 @@ target triple = "x86_64-apple-macosx10.7.0"
; Check transforms involving atomic operations
define i32* @test1(i8** %p) {
-; CHECK: define i32* @test1
+; CHECK-LABEL: define i32* @test1(
; CHECK: load atomic i8** %p monotonic, align 8
%c = bitcast i8** %p to i32**
%r = load atomic i32** %c monotonic, align 8
@@ -14,7 +14,7 @@ define i32* @test1(i8** %p) {
}
define i32 @test2(i32* %p) {
-; CHECK: define i32 @test2
+; CHECK-LABEL: define i32 @test2(
; CHECK: %x = load atomic i32* %p seq_cst, align 4
; CHECK: shl i32 %x, 1
%x = load atomic i32* %p seq_cst, align 4
diff --git a/test/Transforms/InstCombine/badmalloc.ll b/test/Transforms/InstCombine/badmalloc.ll
index 3abe28aede5d..2074d262ccbd 100644
--- a/test/Transforms/InstCombine/badmalloc.ll
+++ b/test/Transforms/InstCombine/badmalloc.ll
@@ -15,11 +15,11 @@ define i1 @test1() {
call void @free(i8* %A)
ret i1 %B
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret i1 false
}
-; CHECK: @test2
+; CHECK-LABEL: @test2(
define noalias i8* @test2() nounwind {
entry:
; CHECK: @malloc
diff --git a/test/Transforms/InstCombine/bitcast-alias-function.ll b/test/Transforms/InstCombine/bitcast-alias-function.ll
new file mode 100644
index 000000000000..a6b56f94ffbf
--- /dev/null
+++ b/test/Transforms/InstCombine/bitcast-alias-function.ll
@@ -0,0 +1,229 @@
+; RUN: opt -S -instcombine -o - %s | FileCheck %s
+target datalayout = "e-p:32:32:32-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v64:64:64-v128:128:128-a0:0:64"
+
+
+
+; Cases that should be bitcast
+
+; Test cast between scalars with same bit sizes
+@alias_i32_to_f32 = alias bitcast (i32 (i32)* @func_i32 to float (float)*)
+
+; Test cast between vectors with same number of elements and bit sizes
+@alias_v2i32_to_v2f32 = alias bitcast (<2 x i32> (<2 x i32>)* @func_v2i32 to <2 x float> (<2 x float>)*)
+
+; Test cast from vector to scalar with same number of bits
+@alias_v2f32_to_i64 = alias bitcast (i64 (i64)* @func_i64 to <2 x float> (<2 x float>)*)
+
+; Test cast from scalar to vector with same number of bits
+@alias_i64_to_v2f32 = alias bitcast (<2 x float> (<2 x float>)* @func_v2f32 to i64 (i64)*)
+
+; Test cast between vectors of pointers
+@alias_v2i32p_to_v2i64p = alias bitcast (<2 x i32*> (<2 x i32*>)* @func_v2i32p to <2 x i64*> (<2 x i64*>)*)
+
+
+; Cases that should be invalid and unchanged
+
+; Test cast between scalars with different bit sizes
+@alias_i64_to_f32 = alias bitcast (i64 (i64)* @func_i64 to float (float)*)
+
+; Test cast between vectors with different bit sizes but the
+; same number of elements
+@alias_v2i64_to_v2f32 = alias bitcast (<2 x i64> (<2 x i64>)* @func_v2i64 to <2 x float> (<2 x float>)*)
+
+; Test cast between vectors with same number of bits and different
+; numbers of elements
+@alias_v2i32_to_v4f32 = alias bitcast (<2 x i32> (<2 x i32>)* @func_v2i32 to <4 x float> (<4 x float>)*)
+
+; Test cast between scalar and vector with different number of bits
+@alias_i64_to_v4f32 = alias bitcast (<4 x float> (<4 x float>)* @func_v4f32 to i64 (i64)*)
+
+; Test cast between vector and scalar with different number of bits
+@alias_v4f32_to_i64 = alias bitcast (i64 (i64)* @func_i64 to <4 x float> (<4 x float>)*)
+
+; Test cast from scalar to vector of pointers with same number of bits
+; We don't know the pointer size at this point, so this can't be done
+@alias_i64_to_v2i32p = alias bitcast (<2 x i32*> (<2 x i32*>)* @func_v2i32p to i64 (i64)*)
+
+; Test cast between vector of pointers and scalar with different number of bits
+@alias_v4i32p_to_i64 = alias bitcast (i64 (i64)* @func_i64 to <4 x i32*> (<4 x i32*>)*)
+
+
+
+define internal <2 x i32> @func_v2i32(<2 x i32> %v) noinline nounwind {
+entry:
+ ret <2 x i32> %v
+}
+
+define internal <2 x float> @func_v2f32(<2 x float> %v) noinline nounwind {
+entry:
+ ret <2 x float> %v
+}
+
+define internal <4 x float> @func_v4f32(<4 x float> %v) noinline nounwind {
+entry:
+ ret <4 x float> %v
+}
+
+define internal i32 @func_i32(i32 %v) noinline nounwind {
+entry:
+ ret i32 %v
+}
+
+define internal i64 @func_i64(i64 %v) noinline nounwind {
+entry:
+ ret i64 %v
+}
+
+define internal <2 x i64> @func_v2i64(<2 x i64> %v) noinline nounwind {
+entry:
+ ret <2 x i64> %v
+}
+
+define internal <2 x i32*> @func_v2i32p(<2 x i32*> %v) noinline nounwind {
+entry:
+ ret <2 x i32*> %v
+}
+
+; Valid cases, only bitcast for argument / return type and call underlying function
+
+; Sizes match, should only bitcast
+define void @bitcast_alias_scalar(float* noalias %source, float* noalias %dest) nounwind {
+entry:
+; CHECK-LABEL: @bitcast_alias_scalar
+; CHECK: bitcast float %tmp to i32
+; CHECK-NOT: fptoui
+; CHECK-NOT: uitofp
+; CHECK: bitcast i32 %call to float
+ %tmp = load float* %source, align 8
+ %call = call float @alias_i32_to_f32(float %tmp) nounwind
+ store float %call, float* %dest, align 8
+ ret void
+}
+
+; Sizes match, should only bitcast
+define void @bitcast_alias_vector(<2 x float>* noalias %source, <2 x float>* noalias %dest) nounwind {
+entry:
+; CHECK-LABEL: @bitcast_alias_vector
+; CHECK: bitcast <2 x float> %tmp to <2 x i32>
+; CHECK-NOT: fptoui
+; CHECK-NOT: uitofp
+; CHECK: bitcast <2 x i32> %call to <2 x float>
+ %tmp = load <2 x float>* %source, align 8
+ %call = call <2 x float> @alias_v2i32_to_v2f32(<2 x float> %tmp) nounwind
+ store <2 x float> %call, <2 x float>* %dest, align 8
+ ret void
+}
+
+; Sizes match, should only bitcast
+define void @bitcast_alias_vector_scalar_same_size(<2 x float>* noalias %source, <2 x float>* noalias %dest) nounwind {
+entry:
+; CHECK-LABEL: @bitcast_alias_vector_scalar_same_size
+; CHECK: bitcast <2 x float> %tmp to i64
+; CHECK: %call = call i64 @func_i64
+; CHECK: bitcast i64 %call to <2 x float>
+ %tmp = load <2 x float>* %source, align 8
+ %call = call <2 x float> @alias_v2f32_to_i64(<2 x float> %tmp) nounwind
+ store <2 x float> %call, <2 x float>* %dest, align 8
+ ret void
+}
+
+define void @bitcast_alias_scalar_vector_same_size(i64* noalias %source, i64* noalias %dest) nounwind {
+entry:
+; CHECK-LABEL: @bitcast_alias_scalar_vector_same_size
+; CHECK: bitcast i64 %tmp to <2 x float>
+; CHECK: call <2 x float> @func_v2f32
+; CHECK: bitcast <2 x float> %call to i64
+ %tmp = load i64* %source, align 8
+ %call = call i64 @alias_i64_to_v2f32(i64 %tmp) nounwind
+ store i64 %call, i64* %dest, align 8
+ ret void
+}
+
+define void @bitcast_alias_vector_ptrs_same_size(<2 x i64*>* noalias %source, <2 x i64*>* noalias %dest) nounwind {
+entry:
+; CHECK-LABEL: @bitcast_alias_vector_ptrs_same_size
+; CHECK: bitcast <2 x i64*> %tmp to <2 x i32*>
+; CHECK: call <2 x i32*> @func_v2i32p
+; CHECK: bitcast <2 x i32*> %call to <2 x i64*>
+ %tmp = load <2 x i64*>* %source, align 8
+ %call = call <2 x i64*> @alias_v2i32p_to_v2i64p(<2 x i64*> %tmp) nounwind
+ store <2 x i64*> %call, <2 x i64*>* %dest, align 8
+ ret void
+}
+
+; Invalid cases:
+
+define void @bitcast_alias_mismatch_scalar_size(float* noalias %source, float* noalias %dest) nounwind {
+entry:
+; CHECK-LABEL: @bitcast_alias_mismatch_scalar_size
+; CHECK-NOT: fptoui
+; CHECK: @alias_i64_to_f32
+; CHECK-NOT: uitofp
+ %tmp = load float* %source, align 8
+ %call = call float @alias_i64_to_f32(float %tmp) nounwind
+ store float %call, float* %dest, align 8
+ ret void
+}
+
+define void @bitcast_alias_mismatch_vector_element_and_bit_size(<2 x float>* noalias %source, <2 x float>* noalias %dest) nounwind {
+entry:
+; CHECK-LABEL: @bitcast_alias_mismatch_vector_element_and_bit_size
+; CHECK-NOT: fptoui <2 x float> %tmp to <2 x i64>
+; CHECK: @alias_v2i64_to_v2f32
+; CHECK-NOT: uitofp <2 x i64> %call to <2 x float>
+ %tmp = load <2 x float>* %source, align 8
+ %call = call <2 x float> @alias_v2i64_to_v2f32(<2 x float> %tmp) nounwind
+ store <2 x float> %call, <2 x float>* %dest, align 8
+ ret void
+}
+
+define void @bitcast_alias_vector_mismatched_number_elements(<4 x float>* noalias %source, <4 x float>* noalias %dest) nounwind {
+entry:
+; CHECK-LABEL: @bitcast_alias_vector_mismatched_number_elements
+; CHECK: %call = call <4 x float> @alias_v2i32_to_v4f32
+ %tmp = load <4 x float>* %source, align 8
+ %call = call <4 x float> @alias_v2i32_to_v4f32(<4 x float> %tmp) nounwind
+ store <4 x float> %call, <4 x float>* %dest, align 8
+ ret void
+}
+
+define void @bitcast_alias_vector_scalar_mismatched_bit_size(<4 x float>* noalias %source, <4 x float>* noalias %dest) nounwind {
+entry:
+; CHECK-LABEL: @bitcast_alias_vector_scalar_mismatched_bit_size
+; CHECK: %call = call <4 x float> @alias_v4f32_to_i64
+ %tmp = load <4 x float>* %source, align 8
+ %call = call <4 x float> @alias_v4f32_to_i64(<4 x float> %tmp) nounwind
+ store <4 x float> %call, <4 x float>* %dest, align 8
+ ret void
+}
+
+define void @bitcast_alias_vector_ptrs_scalar_mismatched_bit_size(<4 x i32*>* noalias %source, <4 x i32*>* noalias %dest) nounwind {
+entry:
+; CHECK-LABEL: @bitcast_alias_vector_ptrs_scalar_mismatched_bit_size
+; CHECK: @alias_v4i32p_to_i64
+ %tmp = load <4 x i32*>* %source, align 8
+ %call = call <4 x i32*> @alias_v4i32p_to_i64(<4 x i32*> %tmp) nounwind
+ store <4 x i32*> %call, <4 x i32*>* %dest, align 8
+ ret void
+}
+
+define void @bitcast_alias_scalar_vector_ptrs_same_size(i64* noalias %source, i64* noalias %dest) nounwind {
+entry:
+; CHECK-LABEL: @bitcast_alias_scalar_vector_ptrs_same_size
+; CHECK: @alias_i64_to_v2i32p
+ %tmp = load i64* %source, align 8
+ %call = call i64 @alias_i64_to_v2i32p(i64 %tmp) nounwind
+ store i64 %call, i64* %dest, align 8
+ ret void
+}
+
+define void @bitcast_alias_scalar_vector_mismatched_bit_size(i64* noalias %source, i64* noalias %dest) nounwind {
+entry:
+; CHECK-LABEL: @bitcast_alias_scalar_vector_mismatched_bit_size
+; CHECK: call i64 @alias_i64_to_v4f32
+ %tmp = load i64* %source, align 8
+ %call = call i64 @alias_i64_to_v4f32(i64 %tmp) nounwind
+ store i64 %call, i64* %dest, align 8
+ ret void
+}
+
diff --git a/test/Transforms/InstCombine/bitcast-bigendian.ll b/test/Transforms/InstCombine/bitcast-bigendian.ll
index 4ded581a14c6..ed812e15f385 100644
--- a/test/Transforms/InstCombine/bitcast-bigendian.ll
+++ b/test/Transforms/InstCombine/bitcast-bigendian.ll
@@ -18,7 +18,7 @@ define float @test2(<2 x float> %A, <2 x i32> %B) {
%add = fadd float %tmp24, %tmp4
ret float %add
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: %tmp24 = extractelement <2 x float> %A, i32 1
; CHECK-NEXT: bitcast <2 x i32> %B to <2 x float>
; CHECK-NEXT: %tmp4 = extractelement <2 x float> {{.*}}, i32 1
@@ -40,7 +40,7 @@ define float @test3(<2 x float> %A, <2 x i64> %B) {
%add = fadd float %tmp24, %tmp4
ret float %add
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: %tmp24 = extractelement <2 x float> %A, i32 0
; CHECK-NEXT: bitcast <2 x i64> %B to <4 x float>
; CHECK-NEXT: %tmp4 = extractelement <4 x float> {{.*}}, i32 1
@@ -48,3 +48,44 @@ define float @test3(<2 x float> %A, <2 x i64> %B) {
; CHECK-NEXT: ret float %add
}
+define <2 x i32> @test4(i32 %A, i32 %B){
+ %tmp38 = zext i32 %A to i64
+ %tmp32 = zext i32 %B to i64
+ %tmp33 = shl i64 %tmp32, 32
+ %ins35 = or i64 %tmp33, %tmp38
+ %tmp43 = bitcast i64 %ins35 to <2 x i32>
+ ret <2 x i32> %tmp43
+ ; CHECK-LABEL: @test4(
+ ; CHECK-NEXT: insertelement <2 x i32> undef, i32 %B, i32 0
+ ; CHECK-NEXT: insertelement <2 x i32> {{.*}}, i32 %A, i32 1
+ ; CHECK-NEXT: ret <2 x i32>
+
+}
+
+define <2 x float> @test5(float %A, float %B) {
+ %tmp37 = bitcast float %A to i32
+ %tmp38 = zext i32 %tmp37 to i64
+ %tmp31 = bitcast float %B to i32
+ %tmp32 = zext i32 %tmp31 to i64
+ %tmp33 = shl i64 %tmp32, 32
+ %ins35 = or i64 %tmp33, %tmp38
+ %tmp43 = bitcast i64 %ins35 to <2 x float>
+ ret <2 x float> %tmp43
+ ; CHECK-LABEL: @test5(
+ ; CHECK-NEXT: insertelement <2 x float> undef, float %B, i32 0
+ ; CHECK-NEXT: insertelement <2 x float> {{.*}}, float %A, i32 1
+ ; CHECK-NEXT: ret <2 x float>
+}
+
+define <2 x float> @test6(float %A){
+ %tmp23 = bitcast float %A to i32 ; <i32> [#uses=1]
+ %tmp24 = zext i32 %tmp23 to i64 ; <i64> [#uses=1]
+ %tmp25 = shl i64 %tmp24, 32 ; <i64> [#uses=1]
+ %mask20 = or i64 %tmp25, 1109917696 ; <i64> [#uses=1]
+ %tmp35 = bitcast i64 %mask20 to <2 x float> ; <<2 x float>> [#uses=1]
+ ret <2 x float> %tmp35
+; CHECK-LABEL: @test6(
+; CHECK-NEXT: insertelement <2 x float> undef, float %A, i32 0
+; CHECK-NEXT: insertelement <2 x float> {{.*}}, float 4.200000e+01, i32 1
+; CHECK: ret
+}
diff --git a/test/Transforms/InstCombine/bitcast-vec-uniform.ll b/test/Transforms/InstCombine/bitcast-vec-uniform.ll
index 5975f1ec396e..bfb77191a75f 100644
--- a/test/Transforms/InstCombine/bitcast-vec-uniform.ll
+++ b/test/Transforms/InstCombine/bitcast-vec-uniform.ll
@@ -1,6 +1,6 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
-; CHECK: @a
+; CHECK-LABEL: @a(
; CHECK-NOT: bitcast
; CHECK: ret
define <4 x i32> @a(<1 x i64> %y) {
@@ -8,7 +8,7 @@ define <4 x i32> @a(<1 x i64> %y) {
ret <4 x i32> %c
}
-; CHECK: @b
+; CHECK-LABEL: @b(
; CHECK-NOT: bitcast
; CHECK: ret
@@ -17,7 +17,7 @@ define <4 x i32> @b(<1 x i64> %y) {
ret <4 x i32> %c
}
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK-NOT: bitcast
; CHECK: ret
@@ -28,7 +28,7 @@ define <2 x float> @foo() {
}
-; CHECK: @foo2
+; CHECK-LABEL: @foo2(
; CHECK-NOT: bitcast
; CHECK: ret
define <2 x double> @foo2() {
@@ -36,7 +36,7 @@ define <2 x double> @foo2() {
ret <2 x double> %cast
}
-; CHECK: @foo3
+; CHECK-LABEL: @foo3(
; CHECK-NOT: bitcast
; CHECK: ret
define <1 x float> @foo3() {
@@ -44,7 +44,7 @@ define <1 x float> @foo3() {
ret <1 x float> %cast
}
-; CHECK: @foo4
+; CHECK-LABEL: @foo4(
; CHECK-NOT: bitcast
; CHECK: ret
define float @foo4() {
@@ -52,7 +52,7 @@ define float @foo4() {
ret float %cast
}
-; CHECK: @foo5
+; CHECK-LABEL: @foo5(
; CHECK-NOT: bitcast
; CHECK: ret
define double @foo5() {
@@ -61,7 +61,7 @@ define double @foo5() {
}
-; CHECK: @foo6
+; CHECK-LABEL: @foo6(
; CHECK-NOT: bitcast
; CHECK: ret
define <2 x double> @foo6() {
diff --git a/test/Transforms/InstCombine/bitcast-vector-fold.ll b/test/Transforms/InstCombine/bitcast-vector-fold.ll
index 8fd7f35b7bb7..04c2861ae9b7 100644
--- a/test/Transforms/InstCombine/bitcast-vector-fold.ll
+++ b/test/Transforms/InstCombine/bitcast-vector-fold.ll
@@ -35,4 +35,4 @@ define <4 x i32> @test6() {
define i32 @test7() {
%tmp3 = bitcast <2 x half> <half 0xH1100, half 0xH0011> to i32
ret i32 %tmp3
-} \ No newline at end of file
+}
diff --git a/test/Transforms/InstCombine/bitcast.ll b/test/Transforms/InstCombine/bitcast.ll
index 1e6113256bf3..c7a520bcf360 100644
--- a/test/Transforms/InstCombine/bitcast.ll
+++ b/test/Transforms/InstCombine/bitcast.ll
@@ -12,7 +12,7 @@ define i32 @test1(i64 %a) {
%t4 = extractelement <2 x i32> %t3, i32 0
ret i32 %t4
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret i32 0
}
@@ -31,7 +31,7 @@ define float @test2(<2 x float> %A, <2 x i32> %B) {
%add = fadd float %tmp24, %tmp4
ret float %add
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: %tmp24 = extractelement <2 x float> %A, i32 0
; CHECK-NEXT: bitcast <2 x i32> %B to <2 x float>
; CHECK-NEXT: %tmp4 = extractelement <2 x float> {{.*}}, i32 0
@@ -56,7 +56,7 @@ define float @test3(<2 x float> %A, <2 x i64> %B) {
%add = fadd float %tmp24, %tmp4
ret float %add
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: %tmp24 = extractelement <2 x float> %A, i32 1
; CHECK-NEXT: bitcast <2 x i64> %B to <4 x float>
; CHECK-NEXT: %tmp4 = extractelement <4 x float> {{.*}}, i32 2
@@ -72,7 +72,7 @@ define <2 x i32> @test4(i32 %A, i32 %B){
%ins35 = or i64 %tmp33, %tmp38
%tmp43 = bitcast i64 %ins35 to <2 x i32>
ret <2 x i32> %tmp43
- ; CHECK: @test4
+ ; CHECK-LABEL: @test4(
; CHECK-NEXT: insertelement <2 x i32> undef, i32 %A, i32 0
; CHECK-NEXT: insertelement <2 x i32> {{.*}}, i32 %B, i32 1
; CHECK-NEXT: ret <2 x i32>
@@ -89,7 +89,7 @@ define <2 x float> @test5(float %A, float %B) {
%ins35 = or i64 %tmp33, %tmp38
%tmp43 = bitcast i64 %ins35 to <2 x float>
ret <2 x float> %tmp43
- ; CHECK: @test5
+ ; CHECK-LABEL: @test5(
; CHECK-NEXT: insertelement <2 x float> undef, float %A, i32 0
; CHECK-NEXT: insertelement <2 x float> {{.*}}, float %B, i32 1
; CHECK-NEXT: ret <2 x float>
@@ -102,7 +102,7 @@ define <2 x float> @test6(float %A){
%mask20 = or i64 %tmp25, 1109917696 ; <i64> [#uses=1]
%tmp35 = bitcast i64 %mask20 to <2 x float> ; <<2 x float>> [#uses=1]
ret <2 x float> %tmp35
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NEXT: insertelement <2 x float> <float 4.200000e+01, float undef>, float %A, i32 1
; CHECK: ret
}
@@ -110,7 +110,7 @@ define <2 x float> @test6(float %A){
define i64 @ISPC0(i64 %in) {
%out = and i64 %in, xor (i64 bitcast (<4 x i16> <i16 -1, i16 -1, i16 -1, i16 -1> to i64), i64 -1)
ret i64 %out
-; CHECK: @ISPC0
+; CHECK-LABEL: @ISPC0(
; CHECK: ret i64 0
}
@@ -118,14 +118,14 @@ define i64 @ISPC0(i64 %in) {
define i64 @Vec2(i64 %in) {
%out = and i64 %in, xor (i64 bitcast (<4 x i16> <i16 0, i16 0, i16 0, i16 0> to i64), i64 0)
ret i64 %out
-; CHECK: @Vec2
+; CHECK-LABEL: @Vec2(
; CHECK: ret i64 0
}
define i64 @All11(i64 %in) {
%out = and i64 %in, xor (i64 bitcast (<2 x float> bitcast (i64 -1 to <2 x float>) to i64), i64 -1)
ret i64 %out
-; CHECK: @All11
+; CHECK-LABEL: @All11(
; CHECK: ret i64 0
}
@@ -133,7 +133,7 @@ define i64 @All11(i64 %in) {
define i32 @All111(i32 %in) {
%out = and i32 %in, xor (i32 bitcast (<1 x float> bitcast (i32 -1 to <1 x float>) to i32), i32 -1)
ret i32 %out
-; CHECK: @All111
+; CHECK-LABEL: @All111(
; CHECK: ret i32 0
}
@@ -141,6 +141,16 @@ define <2 x i16> @BitcastInsert(i32 %a) {
%v = insertelement <1 x i32> undef, i32 %a, i32 0
%r = bitcast <1 x i32> %v to <2 x i16>
ret <2 x i16> %r
-; CHECK: @BitcastInsert
+; CHECK-LABEL: @BitcastInsert(
; CHECK: bitcast i32 %a to <2 x i16>
}
+
+; PR17293
+define <2 x i64> @test7(<2 x i8*>* %arg) nounwind {
+ %cast = bitcast <2 x i8*>* %arg to <2 x i64>*
+ %load = load <2 x i64>* %cast, align 16
+ ret <2 x i64> %load
+; CHECK: @test7
+; CHECK: bitcast
+; CHECK: load
+}
diff --git a/test/Transforms/InstCombine/call-cast-target.ll b/test/Transforms/InstCombine/call-cast-target.ll
index 7addc8abc84f..315c51683fd2 100644
--- a/test/Transforms/InstCombine/call-cast-target.ll
+++ b/test/Transforms/InstCombine/call-cast-target.ll
@@ -1,13 +1,14 @@
-; RUN: opt < %s -instcombine -S | \
-; RUN: grep call | not grep bitcast
+; RUN: opt < %s -instcombine -S | FileCheck %s
target datalayout = "e-p:32:32"
target triple = "i686-pc-linux-gnu"
define i32 @main() {
+; CHECK-LABEL: @main
+; CHECK: call i32 bitcast
entry:
- %tmp = call i32 bitcast (i8* (i32*)* @ctime to i32 (i32*)*)( i32* null ) ; <i32> [#uses=1]
- ret i32 %tmp
+ %tmp = call i32 bitcast (i8* (i32*)* @ctime to i32 (i32*)*)( i32* null ) ; <i32> [#uses=1]
+ ret i32 %tmp
}
declare i8* @ctime(i32*)
diff --git a/test/Transforms/InstCombine/call.ll b/test/Transforms/InstCombine/call.ll
index 96ec420eaa8e..e68c0ad9b208 100644
--- a/test/Transforms/InstCombine/call.ll
+++ b/test/Transforms/InstCombine/call.ll
@@ -1,98 +1,122 @@
; Ignore stderr, we expect warnings there
; RUN: opt < %s -instcombine 2> /dev/null -S | FileCheck %s
-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"
+target datalayout = "E-p:64:64:64-p1:16:16:16-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"
; Simple case, argument translatable without changing the value
declare void @test1a(i8*)
define void @test1(i32* %A) {
- call void bitcast (void (i8*)* @test1a to void (i32*)*)( i32* %A )
- ret void
+; CHECK-LABEL: @test1(
; CHECK: %1 = bitcast i32* %A to i8*
; CHECK: call void @test1a(i8* %1)
; CHECK: ret void
+ call void bitcast (void (i8*)* @test1a to void (i32*)*)( i32* %A )
+ ret void
}
-; More complex case, translate argument because of resolution. This is safe
+
+; Should not do because of change in address space of the parameter
+define void @test1_as1_illegal(i32 addrspace(1)* %A) {
+; CHECK-LABEL: @test1_as1_illegal(
+; CHECK: call void bitcast
+ call void bitcast (void (i8*)* @test1a to void (i32 addrspace(1)*)*)(i32 addrspace(1)* %A)
+ ret void
+}
+
+; Test1, but the argument has a different sized address-space
+declare void @test1a_as1(i8 addrspace(1)*)
+
+; This one is OK to perform
+define void @test1_as1(i32 addrspace(1)* %A) {
+; CHECK-LABEL: @test1_as1(
+; CHECK: %1 = bitcast i32 addrspace(1)* %A to i8 addrspace(1)*
+; CHECK: call void @test1a_as1(i8 addrspace(1)* %1)
+; CHECK: ret void
+ call void bitcast (void (i8 addrspace(1)*)* @test1a_as1 to void (i32 addrspace(1)*)*)(i32 addrspace(1)* %A )
+ ret void
+}
+
+; More complex case, translate argument because of resolution. This is safe
; because we have the body of the function
define void @test2a(i8 %A) {
- ret void
+; CHECK-LABEL: @test2a(
; CHECK: ret void
+ ret void
}
define i32 @test2(i32 %A) {
- call void bitcast (void (i8)* @test2a to void (i32)*)( i32 %A )
- ret i32 %A
-; CHECK: %1 = trunc i32 %A to i8
-; CHECK: call void @test2a(i8 %1)
+; CHECK-LABEL: @test2(
+; CHECK: call void bitcast
; CHECK: ret i32 %A
+ call void bitcast (void (i8)* @test2a to void (i32)*)( i32 %A )
+ ret i32 %A
}
-; Resolving this should insert a cast from sbyte to int, following the C
+; Resolving this should insert a cast from sbyte to int, following the C
; promotion rules.
define void @test3a(i8, ...) {unreachable }
define void @test3(i8 %A, i8 %B) {
- call void bitcast (void (i8, ...)* @test3a to void (i8, i8)*)( i8 %A, i8 %B
-)
- ret void
+; CHECK-LABEL: @test3(
; CHECK: %1 = zext i8 %B to i32
; CHECK: call void (i8, ...)* @test3a(i8 %A, i32 %1)
; CHECK: ret void
+ call void bitcast (void (i8, ...)* @test3a to void (i8, i8)*)( i8 %A, i8 %B)
+ ret void
}
-
; test conversion of return value...
define i8 @test4a() {
- ret i8 0
+; CHECK-LABEL: @test4a(
; CHECK: ret i8 0
+ ret i8 0
}
define i32 @test4() {
- %X = call i32 bitcast (i8 ()* @test4a to i32 ()*)( ) ; <i32> [#uses=1]
- ret i32 %X
-; CHECK: %X = call i8 @test4a()
-; CHECK: %1 = zext i8 %X to i32
-; CHECK: ret i32 %1
+; CHECK-LABEL: @test4(
+; CHECK: call i32 bitcast
+ %X = call i32 bitcast (i8 ()* @test4a to i32 ()*)( ) ; <i32> [#uses=1]
+ ret i32 %X
}
-
-; test conversion of return value... no value conversion occurs so we can do
+; test conversion of return value... no value conversion occurs so we can do
; this with just a prototype...
declare i32 @test5a()
define i32 @test5() {
- %X = call i32 @test5a( ) ; <i32> [#uses=1]
- ret i32 %X
+; CHECK-LABEL: @test5(
; CHECK: %X = call i32 @test5a()
; CHECK: ret i32 %X
+ %X = call i32 @test5a( ) ; <i32> [#uses=1]
+ ret i32 %X
}
-
; test addition of new arguments...
declare i32 @test6a(i32)
define i32 @test6() {
- %X = call i32 bitcast (i32 (i32)* @test6a to i32 ()*)( )
- ret i32 %X
+; CHECK-LABEL: @test6(
; CHECK: %X = call i32 @test6a(i32 0)
; CHECK: ret i32 %X
+ %X = call i32 bitcast (i32 (i32)* @test6a to i32 ()*)( )
+ ret i32 %X
}
-
; test removal of arguments, only can happen with a function body
define void @test7a() {
- ret void
+; CHECK-LABEL: @test7a(
; CHECK: ret void
+ ret void
}
define void @test7() {
- call void bitcast (void ()* @test7a to void (i32)*)( i32 5 )
- ret void
+; CHECK-LABEL: @test7(
; CHECK: call void @test7a()
; CHECK: ret void
+ call void bitcast (void ()* @test7a to void (i32)*)( i32 5 )
+ ret void
}
@@ -100,6 +124,11 @@ define void @test7() {
declare void @test8a()
define i8* @test8() {
+; CHECK-LABEL: @test8(
+; CHECK-NEXT: invoke void @test8a()
+; Don't turn this into "unreachable": the callee and caller don't agree in
+; calling conv, but the implementation of test8a may actually end up using the
+; right calling conv.
invoke void @test8a()
to label %invoke.cont unwind label %try.handler
@@ -114,23 +143,136 @@ try.handler: ; preds = %entry
declare i32 @__gxx_personality_v0(...)
-; Don't turn this into "unreachable": the callee and caller don't agree in
-; calling conv, but the implementation of test8a may actually end up using the
-; right calling conv.
-; CHECK: @test8() {
-; CHECK-NEXT: invoke void @test8a()
-
-
-; Don't turn this into a direct call, because test9x is just a prototype and
+; Don't turn this into a direct call, because test9x is just a prototype and
; doing so will make it varargs.
; rdar://9038601
declare i8* @test9x(i8*, i8*, ...) noredzone
define i8* @test9(i8* %arg, i8* %tmp3) nounwind ssp noredzone {
+; CHECK-LABEL: @test9
entry:
%call = call i8* bitcast (i8* (i8*, i8*, ...)* @test9x to i8* (i8*, i8*)*)(i8* %arg, i8* %tmp3) noredzone
ret i8* %call
-; CHECK: @test9(
+; CHECK-LABEL: @test9(
; CHECK: call i8* bitcast
}
+
+; Parameter that's a vector of pointers
+declare void @test10a(<2 x i8*>)
+
+define void @test10(<2 x i32*> %A) {
+; CHECK-LABEL: @test10(
+; CHECK: %1 = bitcast <2 x i32*> %A to <2 x i8*>
+; CHECK: call void @test10a(<2 x i8*> %1)
+; CHECK: ret void
+ call void bitcast (void (<2 x i8*>)* @test10a to void (<2 x i32*>)*)(<2 x i32*> %A)
+ ret void
+}
+
+; Don't transform because different address spaces
+declare void @test10a_mixed_as(<2 x i8 addrspace(1)*>)
+
+define void @test10_mixed_as(<2 x i8*> %A) {
+; CHECK-LABEL: @test10_mixed_as(
+; CHECK: call void bitcast
+ call void bitcast (void (<2 x i8 addrspace(1)*>)* @test10a_mixed_as to void (<2 x i8*>)*)(<2 x i8*> %A)
+ ret void
+}
+
+; Return type that's a pointer
+define i8* @test11a() {
+ ret i8* zeroinitializer
+}
+
+define i32* @test11() {
+; CHECK-LABEL: @test11(
+; CHECK: %X = call i8* @test11a()
+; CHECK: %1 = bitcast i8* %X to i32*
+ %X = call i32* bitcast (i8* ()* @test11a to i32* ()*)()
+ ret i32* %X
+}
+
+; Return type that's a pointer with a different address space
+define i8 addrspace(1)* @test11a_mixed_as() {
+ ret i8 addrspace(1)* zeroinitializer
+}
+
+define i8* @test11_mixed_as() {
+; CHECK-LABEL: @test11_mixed_as(
+; CHECK: call i8* bitcast
+ %X = call i8* bitcast (i8 addrspace(1)* ()* @test11a_mixed_as to i8* ()*)()
+ ret i8* %X
+}
+
+; Return type that's a vector of pointers
+define <2 x i8*> @test12a() {
+ ret <2 x i8*> zeroinitializer
+}
+
+define <2 x i32*> @test12() {
+; CHECK-LABEL: @test12(
+; CHECK: %X = call <2 x i8*> @test12a()
+; CHECK: %1 = bitcast <2 x i8*> %X to <2 x i32*>
+ %X = call <2 x i32*> bitcast (<2 x i8*> ()* @test12a to <2 x i32*> ()*)()
+ ret <2 x i32*> %X
+}
+
+define <2 x i8 addrspace(1)*> @test12a_mixed_as() {
+ ret <2 x i8 addrspace(1)*> zeroinitializer
+}
+
+define <2 x i8*> @test12_mixed_as() {
+; CHECK-LABEL: @test12_mixed_as(
+; CHECK: call <2 x i8*> bitcast
+ %X = call <2 x i8*> bitcast (<2 x i8 addrspace(1)*> ()* @test12a_mixed_as to <2 x i8*> ()*)()
+ ret <2 x i8*> %X
+}
+
+
+; Mix parameter that's a vector of integers and pointers of the same size
+declare void @test13a(<2 x i64>)
+
+define void @test13(<2 x i32*> %A) {
+; CHECK-LABEL: @test13(
+; CHECK: call void bitcast
+ call void bitcast (void (<2 x i64>)* @test13a to void (<2 x i32*>)*)(<2 x i32*> %A)
+ ret void
+}
+
+; Mix parameter that's a vector of integers and pointers of the same
+; size, but the other way around
+declare void @test14a(<2 x i8*>)
+
+define void @test14(<2 x i64> %A) {
+; CHECK-LABEL: @test14(
+; CHECK: call void bitcast
+ call void bitcast (void (<2 x i8*>)* @test14a to void (<2 x i64>)*)(<2 x i64> %A)
+ ret void
+}
+
+
+; Return type that's a vector
+define <2 x i16> @test15a() {
+ ret <2 x i16> zeroinitializer
+}
+
+define i32 @test15() {
+; CHECK-LABEL: @test15(
+; CHECK: %X = call <2 x i16> @test15a()
+; CHECK: %1 = bitcast <2 x i16> %X to i32
+ %X = call i32 bitcast (<2 x i16> ()* @test15a to i32 ()*)( )
+ ret i32 %X
+}
+
+define i32 @test16a() {
+ ret i32 0
+}
+
+define <2 x i16> @test16() {
+; CHECK-LABEL: @test16(
+; CHECK: %X = call i32 @test16a()
+; CHECK: %1 = bitcast i32 %X to <2 x i16>
+ %X = call <2 x i16> bitcast (i32 ()* @test16a to <2 x i16> ()*)( )
+ ret <2 x i16> %X
+}
diff --git a/test/Transforms/InstCombine/canonicalize_branch.ll b/test/Transforms/InstCombine/canonicalize_branch.ll
index 869546d57dcd..b62b143d9d51 100644
--- a/test/Transforms/InstCombine/canonicalize_branch.ll
+++ b/test/Transforms/InstCombine/canonicalize_branch.ll
@@ -5,7 +5,7 @@ define i32 @test0(i32 %X, i32 %Y) {
%C = icmp eq i32 %X, %Y
br i1 %C, label %T, label %F, !prof !0
-; CHECK: @test0
+; CHECK-LABEL: @test0(
; CHECK: %C = icmp eq i32 %X, %Y
; CHECK: br i1 %C, label %T, label %F
@@ -19,7 +19,7 @@ define i32 @test1(i32 %X, i32 %Y) {
%C = icmp ne i32 %X, %Y
br i1 %C, label %T, label %F, !prof !1
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %C = icmp eq i32 %X, %Y
; CHECK: br i1 %C, label %F, label %T
@@ -33,7 +33,7 @@ define i32 @test2(i32 %X, i32 %Y) {
%C = icmp ule i32 %X, %Y
br i1 %C, label %T, label %F, !prof !2
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: %C = icmp ugt i32 %X, %Y
; CHECK: br i1 %C, label %F, label %T
@@ -47,7 +47,7 @@ define i32 @test3(i32 %X, i32 %Y) {
%C = icmp uge i32 %X, %Y
br i1 %C, label %T, label %F, !prof !3
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: %C = icmp ult i32 %X, %Y
; CHECK: br i1 %C, label %F, label %T
diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll
index de738bb7c06d..cac0ec109163 100644
--- a/test/Transforms/InstCombine/cast.ll
+++ b/test/Transforms/InstCombine/cast.ll
@@ -1,6 +1,6 @@
; Tests to make sure elimination of casts is working correctly
; RUN: opt < %s -instcombine -S | FileCheck %s
-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-n8:16:32:64"
+target datalayout = "E-p:64:64:64-p1:32:32:32-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-n8:16:32:64"
@inbuf = external global [32832 x i8] ; <[32832 x i8]*> [#uses=1]
@@ -326,7 +326,7 @@ define i16 @test39(i16 %a) {
%tmp.upgrd.32 = or i32 %tmp21, %tmp5
%tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16
ret i16 %tmp.upgrd.3
-; CHECK: @test39
+; CHECK-LABEL: @test39(
; CHECK: %tmp.upgrd.32 = call i16 @llvm.bswap.i16(i16 %a)
; CHECK: ret i16 %tmp.upgrd.32
}
@@ -338,7 +338,7 @@ define i16 @test40(i16 %a) {
%tmp.upgrd.32 = or i32 %tmp21, %tmp5
%tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16
ret i16 %tmp.upgrd.3
-; CHECK: @test40
+; CHECK-LABEL: @test40(
; CHECK: %tmp21 = lshr i16 %a, 9
; CHECK: %tmp5 = shl i16 %a, 8
; CHECK: %tmp.upgrd.32 = or i16 %tmp21, %tmp5
@@ -350,7 +350,7 @@ define i32* @test41(i32* %tmp1) {
%tmp64 = bitcast i32* %tmp1 to { i32 }*
%tmp65 = getelementptr { i32 }* %tmp64, i32 0, i32 0
ret i32* %tmp65
-; CHECK: @test41
+; CHECK-LABEL: @test41(
; CHECK: ret i32* %tmp1
}
@@ -358,7 +358,7 @@ define i32 @test42(i32 %X) {
%Y = trunc i32 %X to i8 ; <i8> [#uses=1]
%Z = zext i8 %Y to i32 ; <i32> [#uses=1]
ret i32 %Z
-; CHECK: @test42
+; CHECK-LABEL: @test42(
; CHECK: %Z = and i32 %X, 255
}
@@ -368,7 +368,7 @@ define zeroext i64 @test43(i8 zeroext %on_off) nounwind readonly {
%B = add i32 %A, -1
%C = sext i32 %B to i64
ret i64 %C ;; Should be (add (zext i8 -> i64), -1)
-; CHECK: @test43
+; CHECK-LABEL: @test43(
; CHECK-NEXT: %A = zext i8 %on_off to i64
; CHECK-NEXT: %B = add i64 %A, -1
; CHECK-NEXT: ret i64 %B
@@ -379,7 +379,7 @@ define i64 @test44(i8 %T) {
%B = or i16 %A, 1234
%C = zext i16 %B to i64
ret i64 %C
-; CHECK: @test44
+; CHECK-LABEL: @test44(
; CHECK-NEXT: %A = zext i8 %T to i64
; CHECK-NEXT: %B = or i64 %A, 1234
; CHECK-NEXT: ret i64 %B
@@ -391,7 +391,7 @@ define i64 @test45(i8 %A, i64 %Q) {
%C = or i32 %B, %D
%E = zext i32 %C to i64
ret i64 %E
-; CHECK: @test45
+; CHECK-LABEL: @test45(
; CHECK-NEXT: %B = sext i8 %A to i64
; CHECK-NEXT: %C = or i64 %B, %Q
; CHECK-NEXT: %E = and i64 %C, 4294967295
@@ -405,7 +405,7 @@ define i64 @test46(i64 %A) {
%D = shl i32 %C, 8
%E = zext i32 %D to i64
ret i64 %E
-; CHECK: @test46
+; CHECK-LABEL: @test46(
; CHECK-NEXT: %C = shl i64 %A, 8
; CHECK-NEXT: %D = and i64 %C, 10752
; CHECK-NEXT: ret i64 %D
@@ -416,7 +416,7 @@ define i64 @test47(i8 %A) {
%C = or i32 %B, 42
%E = zext i32 %C to i64
ret i64 %E
-; CHECK: @test47
+; CHECK-LABEL: @test47(
; CHECK-NEXT: %B = sext i8 %A to i64
; CHECK-NEXT: %C = and i64 %B, 4294967253
; CHECK-NEXT: %E = or i64 %C, 42
@@ -430,7 +430,7 @@ define i64 @test48(i8 %A, i8 %a) {
%D = or i32 %C, %b
%E = zext i32 %D to i64
ret i64 %E
-; CHECK: @test48
+; CHECK-LABEL: @test48(
; CHECK-NEXT: %b = zext i8 %a to i64
; CHECK-NEXT: %B = zext i8 %A to i64
; CHECK-NEXT: %C = shl nuw nsw i64 %B, 8
@@ -443,7 +443,7 @@ define i64 @test49(i64 %A) {
%C = or i32 %B, 1
%D = sext i32 %C to i64
ret i64 %D
-; CHECK: @test49
+; CHECK-LABEL: @test49(
; CHECK-NEXT: %C = shl i64 %A, 32
; CHECK-NEXT: ashr exact i64 %C, 32
; CHECK-NEXT: %D = or i64 {{.*}}, 1
@@ -456,7 +456,7 @@ define i64 @test50(i64 %A) {
%D = add i32 %B, -1
%E = sext i32 %D to i64
ret i64 %E
-; CHECK: @test50
+; CHECK-LABEL: @test50(
; lshr+shl will be handled by DAGCombine.
; CHECK-NEXT: lshr i64 %A, 2
; CHECK-NEXT: shl i64 %a, 32
@@ -472,7 +472,7 @@ define i64 @test51(i64 %A, i1 %cond) {
%E = select i1 %cond, i32 %C, i32 %D
%F = sext i32 %E to i64
ret i64 %F
-; CHECK: @test51
+; CHECK-LABEL: @test51(
; CHECK-NEXT: %C = and i64 %A, 4294967294
; CHECK-NEXT: %D = or i64 %A, 1
; CHECK-NEXT: %E = select i1 %cond, i64 %C, i64 %D
@@ -487,7 +487,7 @@ define i32 @test52(i64 %A) {
%D = and i16 %C, -25350
%E = zext i16 %D to i32
ret i32 %E
-; CHECK: @test52
+; CHECK-LABEL: @test52(
; CHECK-NEXT: %B = trunc i64 %A to i32
; CHECK-NEXT: %C = and i32 %B, 7224
; CHECK-NEXT: %D = or i32 %C, 32962
@@ -500,7 +500,7 @@ define i64 @test53(i32 %A) {
%D = and i16 %C, -25350
%E = zext i16 %D to i64
ret i64 %E
-; CHECK: @test53
+; CHECK-LABEL: @test53(
; CHECK-NEXT: %B = zext i32 %A to i64
; CHECK-NEXT: %C = and i64 %B, 7224
; CHECK-NEXT: %D = or i64 %C, 32962
@@ -513,7 +513,7 @@ define i32 @test54(i64 %A) {
%D = and i16 %C, -25350
%E = sext i16 %D to i32
ret i32 %E
-; CHECK: @test54
+; CHECK-LABEL: @test54(
; CHECK-NEXT: %B = trunc i64 %A to i32
; CHECK-NEXT: %C = and i32 %B, 7224
; CHECK-NEXT: %D = or i32 %C, -32574
@@ -526,7 +526,7 @@ define i64 @test55(i32 %A) {
%D = and i16 %C, -25350
%E = sext i16 %D to i64
ret i64 %E
-; CHECK: @test55
+; CHECK-LABEL: @test55(
; CHECK-NEXT: %B = zext i32 %A to i64
; CHECK-NEXT: %C = and i64 %B, 7224
; CHECK-NEXT: %D = or i64 %C, -32574
@@ -538,7 +538,7 @@ define i64 @test56(i16 %A) nounwind {
%tmp354 = lshr i32 %tmp353, 5
%tmp355 = zext i32 %tmp354 to i64
ret i64 %tmp355
-; CHECK: @test56
+; CHECK-LABEL: @test56(
; CHECK-NEXT: %tmp353 = sext i16 %A to i64
; CHECK-NEXT: %tmp354 = lshr i64 %tmp353, 5
; CHECK-NEXT: %tmp355 = and i64 %tmp354, 134217727
@@ -550,7 +550,7 @@ define i64 @test57(i64 %A) nounwind {
%C = lshr i32 %B, 8
%E = zext i32 %C to i64
ret i64 %E
-; CHECK: @test57
+; CHECK-LABEL: @test57(
; CHECK-NEXT: %C = lshr i64 %A, 8
; CHECK-NEXT: %E = and i64 %C, 16777215
; CHECK-NEXT: ret i64 %E
@@ -563,7 +563,7 @@ define i64 @test58(i64 %A) nounwind {
%E = zext i32 %D to i64
ret i64 %E
-; CHECK: @test58
+; CHECK-LABEL: @test58(
; CHECK-NEXT: %C = lshr i64 %A, 8
; CHECK-NEXT: %D = and i64 %C, 16777087
; CHECK-NEXT: %E = or i64 %D, 128
@@ -579,7 +579,7 @@ define i64 @test59(i8 %A, i8 %B) nounwind {
%H = or i32 %G, %E
%I = zext i32 %H to i64
ret i64 %I
-; CHECK: @test59
+; CHECK-LABEL: @test59(
; CHECK-NEXT: %C = zext i8 %A to i64
; CHECK-NOT: i32
; CHECK: %F = zext i8 %B to i64
@@ -593,7 +593,7 @@ define <3 x i32> @test60(<4 x i32> %call4) nounwind {
%tmp10 = bitcast i96 %tmp9 to <3 x i32>
ret <3 x i32> %tmp10
-; CHECK: @test60
+; CHECK-LABEL: @test60(
; CHECK-NEXT: shufflevector
; CHECK-NEXT: ret
}
@@ -603,7 +603,7 @@ define <4 x i32> @test61(<3 x i32> %call4) nounwind {
%tmp9 = zext i96 %tmp11 to i128
%tmp10 = bitcast i128 %tmp9 to <4 x i32>
ret <4 x i32> %tmp10
-; CHECK: @test61
+; CHECK-LABEL: @test61(
; CHECK-NEXT: shufflevector
; CHECK-NEXT: ret
}
@@ -613,7 +613,7 @@ define <4 x i32> @test62(<3 x float> %call4) nounwind {
%tmp9 = zext i96 %tmp11 to i128
%tmp10 = bitcast i128 %tmp9 to <4 x i32>
ret <4 x i32> %tmp10
-; CHECK: @test62
+; CHECK-LABEL: @test62(
; CHECK-NEXT: bitcast
; CHECK-NEXT: shufflevector
; CHECK-NEXT: ret
@@ -625,7 +625,7 @@ entry:
%a = bitcast i64 %tmp8 to <2 x i32>
%vcvt.i = uitofp <2 x i32> %a to <2 x float>
ret <2 x float> %vcvt.i
-; CHECK: @test63
+; CHECK-LABEL: @test63(
; CHECK: bitcast
; CHECK: uitofp
}
@@ -634,7 +634,7 @@ define <4 x float> @test64(<4 x float> %c) nounwind {
%t0 = bitcast <4 x float> %c to <4 x i32>
%t1 = bitcast <4 x i32> %t0 to <4 x float>
ret <4 x float> %t1
-; CHECK: @test64
+; CHECK-LABEL: @test64(
; CHECK-NEXT: ret <4 x float> %c
}
@@ -642,7 +642,7 @@ define <4 x float> @test65(<4 x float> %c) nounwind {
%t0 = bitcast <4 x float> %c to <2 x double>
%t1 = bitcast <2 x double> %t0 to <4 x float>
ret <4 x float> %t1
-; CHECK: @test65
+; CHECK-LABEL: @test65(
; CHECK-NEXT: ret <4 x float> %c
}
@@ -650,13 +650,13 @@ define <2 x float> @test66(<2 x float> %c) nounwind {
%t0 = bitcast <2 x float> %c to double
%t1 = bitcast double %t0 to <2 x float>
ret <2 x float> %t1
-; CHECK: @test66
+; CHECK-LABEL: @test66(
; CHECK-NEXT: ret <2 x float> %c
}
define float @test2c() {
ret float extractelement (<2 x float> bitcast (double bitcast (<2 x float> <float -1.000000e+00, float -1.000000e+00> to double) to <2 x float>), i32 0)
-; CHECK: @test2c
+; CHECK-LABEL: @test2c(
; CHECK-NOT: extractelement
}
@@ -665,7 +665,7 @@ define i64 @test_mmx(<2 x i32> %c) nounwind {
%B = bitcast x86_mmx %A to <2 x i32>
%C = bitcast <2 x i32> %B to i64
ret i64 %C
-; CHECK: @test_mmx
+; CHECK-LABEL: @test_mmx(
; CHECK-NOT: x86_mmx
}
@@ -674,7 +674,7 @@ define i64 @test_mmx_const(<2 x i32> %c) nounwind {
%B = bitcast x86_mmx %A to <2 x i32>
%C = bitcast <2 x i32> %B to i64
ret i64 %C
-; CHECK: @test_mmx_const
+; CHECK-LABEL: @test_mmx_const(
; CHECK-NOT: x86_mmx
}
@@ -689,14 +689,14 @@ define i1 @test67(i1 %a, i32 %b) {
%trunc = trunc i32 %conv.i.i to i8
%tobool.i = icmp eq i8 %trunc, 0
ret i1 %tobool.i
-; CHECK: @test67
+; CHECK-LABEL: @test67(
; CHECK: ret i1 false
}
%s = type { i32, i32, i32 }
define %s @test68(%s *%p, i64 %i) {
-; CHECK: @test68
+; CHECK-LABEL: @test68(
%o = mul i64 %i, 12
%q = bitcast %s* %p to i8*
%pp = getelementptr inbounds i8* %q, i64 %o
@@ -708,8 +708,21 @@ define %s @test68(%s *%p, i64 %i) {
; CHECK-NEXT: ret %s
}
+define %s @test68_as1(%s addrspace(1)* %p, i32 %i) {
+; CHECK-LABEL: @test68_as1(
+ %o = mul i32 %i, 12
+ %q = bitcast %s addrspace(1)* %p to i8 addrspace(1)*
+ %pp = getelementptr inbounds i8 addrspace(1)* %q, i32 %o
+; CHECK-NEXT: getelementptr %s addrspace(1)*
+ %r = bitcast i8 addrspace(1)* %pp to %s addrspace(1)*
+ %l = load %s addrspace(1)* %r
+; CHECK-NEXT: load %s addrspace(1)*
+ ret %s %l
+; CHECK-NEXT: ret %s
+}
+
define double @test69(double *%p, i64 %i) {
-; CHECK: @test69
+; CHECK-LABEL: @test69(
%o = shl nsw i64 %i, 3
%q = bitcast double* %p to i8*
%pp = getelementptr inbounds i8* %q, i64 %o
@@ -722,7 +735,7 @@ define double @test69(double *%p, i64 %i) {
}
define %s @test70(%s *%p, i64 %i) {
-; CHECK: @test70
+; CHECK-LABEL: @test70(
%o = mul nsw i64 %i, 36
; CHECK-NEXT: mul nsw i64 %i, 3
%q = bitcast %s* %p to i8*
@@ -736,7 +749,7 @@ define %s @test70(%s *%p, i64 %i) {
}
define double @test71(double *%p, i64 %i) {
-; CHECK: @test71
+; CHECK-LABEL: @test71(
%o = shl i64 %i, 5
; CHECK-NEXT: shl i64 %i, 2
%q = bitcast double* %p to i8*
@@ -750,7 +763,7 @@ define double @test71(double *%p, i64 %i) {
}
define double @test72(double *%p, i32 %i) {
-; CHECK: @test72
+; CHECK-LABEL: @test72(
%so = mul nsw i32 %i, 8
%o = sext i32 %so to i64
; CHECK-NEXT: sext i32 %i to i64
@@ -765,7 +778,7 @@ define double @test72(double *%p, i32 %i) {
}
define double @test73(double *%p, i128 %i) {
-; CHECK: @test73
+; CHECK-LABEL: @test73(
%lo = mul nsw i128 %i, 8
%o = trunc i128 %lo to i64
; CHECK-NEXT: trunc i128 %i to i64
@@ -780,7 +793,7 @@ define double @test73(double *%p, i128 %i) {
}
define double @test74(double *%p, i64 %i) {
-; CHECK: @test74
+; CHECK-LABEL: @test74(
%q = bitcast double* %p to i64*
%pp = getelementptr inbounds i64* %q, i64 %i
; CHECK-NEXT: getelementptr inbounds double*
@@ -792,7 +805,7 @@ define double @test74(double *%p, i64 %i) {
}
define i32* @test75(i32* %p, i32 %x) {
-; CHECK: @test75
+; CHECK-LABEL: @test75(
%y = shl i32 %x, 3
; CHECK-NEXT: shl i32 %x, 3
%z = sext i32 %y to i64
@@ -804,7 +817,7 @@ define i32* @test75(i32* %p, i32 %x) {
}
define %s @test76(%s *%p, i64 %i, i64 %j) {
-; CHECK: @test76
+; CHECK-LABEL: @test76(
%o = mul i64 %i, 12
%o2 = mul nsw i64 %o, %j
; CHECK-NEXT: %o2 = mul i64 %i, %j
@@ -819,7 +832,7 @@ define %s @test76(%s *%p, i64 %i, i64 %j) {
}
define %s @test77(%s *%p, i64 %i, i64 %j) {
-; CHECK: @test77
+; CHECK-LABEL: @test77(
%o = mul nsw i64 %i, 36
%o2 = mul nsw i64 %o, %j
; CHECK-NEXT: %o = mul nsw i64 %i, 3
@@ -835,7 +848,7 @@ define %s @test77(%s *%p, i64 %i, i64 %j) {
}
define %s @test78(%s *%p, i64 %i, i64 %j, i32 %k, i32 %l, i128 %m, i128 %n) {
-; CHECK: @test78
+; CHECK-LABEL: @test78(
%a = mul nsw i32 %k, 36
; CHECK-NEXT: mul nsw i32 %k, 3
%b = mul nsw i32 %a, %l
@@ -863,7 +876,7 @@ define %s @test78(%s *%p, i64 %i, i64 %j, i32 %k, i32 %l, i128 %m, i128 %n) {
}
define %s @test79(%s *%p, i64 %i, i32 %j) {
-; CHECK: @test79
+; CHECK-LABEL: @test79(
%a = mul nsw i64 %i, 36
; CHECK: mul nsw i64 %i, 36
%b = trunc i64 %a to i32
@@ -877,7 +890,7 @@ define %s @test79(%s *%p, i64 %i, i32 %j) {
}
define double @test80([100 x double]* %p, i32 %i) {
-; CHECK: @test80
+; CHECK-LABEL: @test80(
%tmp = mul nsw i32 %i, 8
; CHECK-NEXT: sext i32 %i to i64
%q = bitcast [100 x double]* %p to i8*
@@ -890,6 +903,20 @@ define double @test80([100 x double]* %p, i32 %i) {
; CHECK-NEXT: ret double
}
+define double @test80_as1([100 x double] addrspace(1)* %p, i16 %i) {
+; CHECK-LABEL: @test80_as1(
+ %tmp = mul nsw i16 %i, 8
+; CHECK-NEXT: sext i16 %i to i32
+ %q = bitcast [100 x double] addrspace(1)* %p to i8 addrspace(1)*
+ %pp = getelementptr i8 addrspace(1)* %q, i16 %tmp
+; CHECK-NEXT: getelementptr [100 x double] addrspace(1)*
+ %r = bitcast i8 addrspace(1)* %pp to double addrspace(1)*
+ %l = load double addrspace(1)* %r
+; CHECK-NEXT: load double addrspace(1)*
+ ret double %l
+; CHECK-NEXT: ret double
+}
+
define double @test81(double *%p, float %f) {
%i = fptosi float %f to i64
%q = bitcast double* %p to i8*
@@ -898,3 +925,31 @@ define double @test81(double *%p, float %f) {
%l = load double* %r
ret double %l
}
+
+define i64 @test82(i64 %A) nounwind {
+ %B = trunc i64 %A to i32
+ %C = lshr i32 %B, 8
+ %D = shl i32 %C, 9
+ %E = zext i32 %D to i64
+ ret i64 %E
+
+; CHECK-LABEL: @test82(
+; CHECK-NEXT: [[REG:%[0-9]*]] = shl i64 %A, 1
+; CHECK-NEXT: %E = and i64 [[REG]], 4294966784
+; CHECK-NEXT: ret i64 %E
+}
+
+; PR15959
+define i64 @test83(i16 %a, i64 %k) {
+ %conv = sext i16 %a to i32
+ %sub = add nsw i64 %k, -1
+ %sh_prom = trunc i64 %sub to i32
+ %shl = shl i32 %conv, %sh_prom
+ %sh_prom1 = zext i32 %shl to i64
+ ret i64 %sh_prom1
+
+; CHECK-LABEL: @test83(
+; CHECK: %sub = add nsw i64 %k, 4294967295
+; CHECK: %sh_prom = trunc i64 %sub to i32
+; CHECK: %shl = shl i32 %conv, %sh_prom
+}
diff --git a/test/Transforms/InstCombine/cast_ptr.ll b/test/Transforms/InstCombine/cast_ptr.ll
index 09910fbc8481..23006a84604b 100644
--- a/test/Transforms/InstCombine/cast_ptr.ll
+++ b/test/Transforms/InstCombine/cast_ptr.ll
@@ -1,12 +1,12 @@
; Tests to make sure elimination of casts is working correctly
; RUN: opt < %s -instcombine -S | FileCheck %s
-target datalayout = "p:32:32"
+target datalayout = "p:32:32-p1:32:32-p2:16:16"
; This shouldn't convert to getelementptr because the relationship
; between the arithmetic and the layout of allocated memory is
; entirely unknown.
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ptrtoint
; CHECK: add
; CHECK: inttoptr
@@ -18,7 +18,7 @@ define i8* @test1(i8* %t) {
}
; These casts should be folded away.
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: icmp eq i8* %a, %b
define i1 @test2(i8* %a, i8* %b) {
%tmpa = ptrtoint i8* %a to i32 ; <i32> [#uses=1]
@@ -27,8 +27,28 @@ define i1 @test2(i8* %a, i8* %b) {
ret i1 %r
}
+; These casts should be folded away.
+; CHECK-LABEL: @test2_as2_same_int(
+; CHECK: icmp eq i8 addrspace(2)* %a, %b
+define i1 @test2_as2_same_int(i8 addrspace(2)* %a, i8 addrspace(2)* %b) {
+ %tmpa = ptrtoint i8 addrspace(2)* %a to i16
+ %tmpb = ptrtoint i8 addrspace(2)* %b to i16
+ %r = icmp eq i16 %tmpa, %tmpb
+ ret i1 %r
+}
+
+; These casts should be folded away.
+; CHECK-LABEL: @test2_as2_larger(
+; CHECK: icmp eq i8 addrspace(2)* %a, %b
+define i1 @test2_as2_larger(i8 addrspace(2)* %a, i8 addrspace(2)* %b) {
+ %tmpa = ptrtoint i8 addrspace(2)* %a to i32
+ %tmpb = ptrtoint i8 addrspace(2)* %b to i32
+ %r = icmp eq i32 %tmpa, %tmpb
+ ret i1 %r
+}
+
; These casts should also be folded away.
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: icmp eq i8* %a, @global
@global = global i8 0
define i1 @test3(i8* %a) {
@@ -41,13 +61,22 @@ define i1 @test4(i32 %A) {
%B = inttoptr i32 %A to i8*
%C = icmp eq i8* %B, null
ret i1 %C
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NEXT: %C = icmp eq i32 %A, 0
-; CHECK-NEXT: ret i1 %C
+; CHECK-NEXT: ret i1 %C
}
+define i1 @test4_as2(i16 %A) {
+; CHECK-LABEL: @test4_as2(
+; CHECK-NEXT: %C = icmp eq i16 %A, 0
+; CHECK-NEXT: ret i1 %C
+ %B = inttoptr i16 %A to i8 addrspace(2)*
+ %C = icmp eq i8 addrspace(2)* %B, null
+ ret i1 %C
+}
-; Pulling the cast out of the load allows us to eliminate the load, and then
+
+; Pulling the cast out of the load allows us to eliminate the load, and then
; the whole array.
%op = type { float }
@@ -60,7 +89,7 @@ define %unop* @test5(%op* %O) {
%tmp = load %unop* (%op*)** bitcast ([1 x %op* (%op*)*]* @Array to %unop* (%op*)**); <%unop* (%op*)*> [#uses=1]
%tmp.2 = call %unop* %tmp( %op* %O ) ; <%unop*> [#uses=1]
ret %unop* %tmp.2
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: call %op* @foo(%op* %O)
}
@@ -69,11 +98,11 @@ define %unop* @test5(%op* %O) {
; InstCombine can not 'load (cast P)' -> cast (load P)' if the cast changes
; the address space.
-define i8 @test6(i8 addrspace(1)* %source) {
-entry:
- %arrayidx223 = bitcast i8 addrspace(1)* %source to i8*
+define i8 @test6(i8 addrspace(1)* %source) {
+entry:
+ %arrayidx223 = addrspacecast i8 addrspace(1)* %source to i8*
%tmp4 = load i8* %arrayidx223
ret i8 %tmp4
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: load i8* %arrayidx223
-}
+}
diff --git a/test/Transforms/InstCombine/compare-signs.ll b/test/Transforms/InstCombine/compare-signs.ll
index 72db66e3ab0f..62cd5b3f94d5 100644
--- a/test/Transforms/InstCombine/compare-signs.ll
+++ b/test/Transforms/InstCombine/compare-signs.ll
@@ -22,11 +22,11 @@
;}
define i32 @test3(i32 %a, i32 %b) nounwind readnone {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
entry:
-; CHECK: xor i32 %a, %b
-; CHECK: lshr i32 %0, 31
-; CHECK: xor i32 %1, 1
+; CHECK: [[XOR1:%.*]] = xor i32 %a, %b
+; CHECK: [[SHIFT:%.*]] = lshr i32 [[XOR1]], 31
+; CHECK: [[XOR2:%.*]] = xor i32 [[SHIFT]], 1
%0 = lshr i32 %a, 31 ; <i32> [#uses=1]
%1 = lshr i32 %b, 31 ; <i32> [#uses=1]
%2 = icmp eq i32 %0, %1 ; <i1> [#uses=1]
@@ -34,13 +34,13 @@ entry:
ret i32 %3
; CHECK-NOT: icmp
; CHECK-NOT: zext
-; CHECK: ret i32 %2
+; CHECK: ret i32 [[XOR2]]
}
; Variation on @test3: checking the 2nd bit in a situation where the 5th bit
; is one, not zero.
define i32 @test3i(i32 %a, i32 %b) nounwind readnone {
-; CHECK: @test3i
+; CHECK-LABEL: @test3i(
entry:
; CHECK: xor i32 %a, %b
; CHECK: lshr i32 %0, 31
diff --git a/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll b/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll
new file mode 100644
index 000000000000..9f21d5419b72
--- /dev/null
+++ b/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll
@@ -0,0 +1,232 @@
+; RUN: opt -S -instcombine %s -o - | FileCheck %s
+target datalayout = "e-p:32:32:32-p1:64:64:64-p2:8:8:8-p3:16:16:16-p4:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32"
+
+@g = addrspace(3) global i32 89
+
+@const_zero_i8_as1 = addrspace(1) constant i8 0
+@const_zero_i32_as1 = addrspace(1) constant i32 0
+
+@const_zero_i8_as2 = addrspace(2) constant i8 0
+@const_zero_i32_as2 = addrspace(2) constant i32 0
+
+@const_zero_i8_as3 = addrspace(3) constant i8 0
+@const_zero_i32_as3 = addrspace(3) constant i32 0
+
+; Test constant folding of inttoptr (ptrtoint constantexpr)
+; The intermediate integer size is the same as the pointer size
+define i32 addrspace(3)* @test_constant_fold_inttoptr_as_pointer_same_size() {
+; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_same_size(
+; CHECK-NEXT: ret i32 addrspace(3)* @const_zero_i32_as3
+ %x = ptrtoint i32 addrspace(3)* @const_zero_i32_as3 to i32
+ %y = inttoptr i32 %x to i32 addrspace(3)*
+ ret i32 addrspace(3)* %y
+}
+
+; The intermediate integer size is larger than the pointer size
+define i32 addrspace(2)* @test_constant_fold_inttoptr_as_pointer_smaller() {
+; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_smaller(
+; CHECK-NEXT: ret i32 addrspace(2)* @const_zero_i32_as2
+ %x = ptrtoint i32 addrspace(2)* @const_zero_i32_as2 to i16
+ %y = inttoptr i16 %x to i32 addrspace(2)*
+ ret i32 addrspace(2)* %y
+}
+
+; Different address spaces that are the same size, but they are
+; different so nothing should happen
+define i32 addrspace(4)* @test_constant_fold_inttoptr_as_pointer_smaller_different_as() {
+; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_smaller_different_as(
+; CHECK-NEXT: ret i32 addrspace(4)* inttoptr (i16 ptrtoint (i32 addrspace(3)* @const_zero_i32_as3 to i16) to i32 addrspace(4)*)
+ %x = ptrtoint i32 addrspace(3)* @const_zero_i32_as3 to i16
+ %y = inttoptr i16 %x to i32 addrspace(4)*
+ ret i32 addrspace(4)* %y
+}
+
+; Make sure we don't introduce a bitcast between different sized
+; address spaces when folding this
+define i32 addrspace(2)* @test_constant_fold_inttoptr_as_pointer_smaller_different_size_as() {
+; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_smaller_different_size_as(
+; CHECK-NEXT: ret i32 addrspace(2)* inttoptr (i32 ptrtoint (i32 addrspace(3)* @const_zero_i32_as3 to i32) to i32 addrspace(2)*)
+ %x = ptrtoint i32 addrspace(3)* @const_zero_i32_as3 to i32
+ %y = inttoptr i32 %x to i32 addrspace(2)*
+ ret i32 addrspace(2)* %y
+}
+
+; The intermediate integer size is too small, nothing should happen
+define i32 addrspace(3)* @test_constant_fold_inttoptr_as_pointer_larger() {
+; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_larger(
+; CHECK-NEXT: ret i32 addrspace(3)* inttoptr (i8 ptrtoint (i32 addrspace(3)* @const_zero_i32_as3 to i8) to i32 addrspace(3)*)
+ %x = ptrtoint i32 addrspace(3)* @const_zero_i32_as3 to i8
+ %y = inttoptr i8 %x to i32 addrspace(3)*
+ ret i32 addrspace(3)* %y
+}
+
+define i8 @const_fold_ptrtoint() {
+; CHECK-LABEL: @const_fold_ptrtoint(
+; CHECK-NEXT: ret i8 4
+ ret i8 ptrtoint (i32 addrspace(2)* inttoptr (i4 4 to i32 addrspace(2)*) to i8)
+}
+
+; Test that mask happens when the destination pointer is smaller than
+; the original
+define i8 @const_fold_ptrtoint_mask() {
+; CHECK-LABEL: @const_fold_ptrtoint_mask(
+; CHECK-NEXT: ret i8 1
+ ret i8 ptrtoint (i32 addrspace(3)* inttoptr (i32 257 to i32 addrspace(3)*) to i8)
+}
+
+; Address space 0 is too small for the correct mask, should mask with
+; 64-bits instead of 32
+define i64 @const_fold_ptrtoint_mask_small_as0() {
+; CHECK-LABEL: @const_fold_ptrtoint_mask_small_as0(
+; CHECK: ret i64 -1
+ ret i64 ptrtoint (i32 addrspace(1)* inttoptr (i128 -1 to i32 addrspace(1)*) to i64)
+}
+
+define i32 addrspace(3)* @const_inttoptr() {
+; CHECK-LABEL: @const_inttoptr(
+; CHECK-NEXT: ret i32 addrspace(3)* inttoptr (i16 4 to i32 addrspace(3)*)
+ %p = inttoptr i16 4 to i32 addrspace(3)*
+ ret i32 addrspace(3)* %p
+}
+
+define i16 @const_ptrtoint() {
+; CHECK-LABEL: @const_ptrtoint(
+; CHECK-NEXT: ret i16 ptrtoint (i32 addrspace(3)* @g to i16)
+ %i = ptrtoint i32 addrspace(3)* @g to i16
+ ret i16 %i
+}
+
+define i16 @const_inttoptr_ptrtoint() {
+; CHECK-LABEL: @const_inttoptr_ptrtoint(
+; CHECK-NEXT: ret i16 9
+ ret i16 ptrtoint (i32 addrspace(3)* inttoptr (i16 9 to i32 addrspace(3)*) to i16)
+}
+
+define i1 @constant_fold_cmp_constantexpr_inttoptr() {
+; CHECK-LABEL: @constant_fold_cmp_constantexpr_inttoptr(
+; CHECK-NEXT: ret i1 true
+ %x = icmp eq i32 addrspace(3)* inttoptr (i16 0 to i32 addrspace(3)*), null
+ ret i1 %x
+}
+
+define i1 @constant_fold_inttoptr_null(i16 %i) {
+; CHECK-LABEL: @constant_fold_inttoptr_null(
+; CHECK-NEXT: ret i1 false
+ %x = icmp eq i32 addrspace(3)* inttoptr (i16 99 to i32 addrspace(3)*), inttoptr (i16 0 to i32 addrspace(3)*)
+ ret i1 %x
+}
+
+define i1 @constant_fold_ptrtoint_null() {
+; CHECK-LABEL: @constant_fold_ptrtoint_null(
+; CHECK-NEXT: ret i1 false
+ %x = icmp eq i16 ptrtoint (i32 addrspace(3)* @g to i16), ptrtoint (i32 addrspace(3)* null to i16)
+ ret i1 %x
+}
+
+define i1 @constant_fold_ptrtoint_null_2() {
+; CHECK-LABEL: @constant_fold_ptrtoint_null_2(
+; CHECK-NEXT: ret i1 false
+ %x = icmp eq i16 ptrtoint (i32 addrspace(3)* null to i16), ptrtoint (i32 addrspace(3)* @g to i16)
+ ret i1 %x
+}
+
+define i1 @constant_fold_ptrtoint() {
+; CHECK-LABEL: @constant_fold_ptrtoint(
+; CHECK-NEXT: ret i1 true
+ %x = icmp eq i16 ptrtoint (i32 addrspace(3)* @g to i16), ptrtoint (i32 addrspace(3)* @g to i16)
+ ret i1 %x
+}
+
+define i1 @constant_fold_inttoptr() {
+; CHECK-LABEL: @constant_fold_inttoptr(
+; CHECK-NEXT: ret i1 false
+ %x = icmp eq i32 addrspace(3)* inttoptr (i16 99 to i32 addrspace(3)*), inttoptr (i16 27 to i32 addrspace(3)*)
+ ret i1 %x
+}
+
+@g_float_as3 = addrspace(3) global float zeroinitializer
+@g_v4f_as3 = addrspace(3) global <4 x float> zeroinitializer
+
+define float @constant_fold_bitcast_ftoi_load() {
+; CHECK-LABEL: @constant_fold_bitcast_ftoi_load(
+; CHECK: load float addrspace(3)* bitcast (i32 addrspace(3)* @g to float addrspace(3)*), align 4
+ %a = load float addrspace(3)* bitcast (i32 addrspace(3)* @g to float addrspace(3)*), align 4
+ ret float %a
+}
+
+define i32 @constant_fold_bitcast_itof_load() {
+; CHECK-LABEL: @constant_fold_bitcast_itof_load(
+; CHECK: load i32 addrspace(3)* bitcast (float addrspace(3)* @g_float_as3 to i32 addrspace(3)*), align 4
+ %a = load i32 addrspace(3)* bitcast (float addrspace(3)* @g_float_as3 to i32 addrspace(3)*), align 4
+ ret i32 %a
+}
+
+define <4 x i32> @constant_fold_bitcast_vector_as() {
+; CHECK-LABEL: @constant_fold_bitcast_vector_as(
+; CHECK: load <4 x float> addrspace(3)* @g_v4f_as3, align 16
+; CHECK: bitcast <4 x float> %1 to <4 x i32>
+ %a = load <4 x i32> addrspace(3)* bitcast (<4 x float> addrspace(3)* @g_v4f_as3 to <4 x i32> addrspace(3)*), align 4
+ ret <4 x i32> %a
+}
+
+@i32_array_as3 = addrspace(3) global [10 x i32] zeroinitializer
+
+define i32 @test_cast_gep_small_indices_as() {
+; CHECK-LABEL: @test_cast_gep_small_indices_as(
+; CHECK: load i32 addrspace(3)* getelementptr inbounds ([10 x i32] addrspace(3)* @i32_array_as3, i16 0, i16 0), align 16
+ %p = getelementptr [10 x i32] addrspace(3)* @i32_array_as3, i7 0, i7 0
+ %x = load i32 addrspace(3)* %p, align 4
+ ret i32 %x
+}
+
+%struct.foo = type { float, float, [4 x i32], i32 addrspace(3)* }
+
+@constant_fold_global_ptr = addrspace(3) global %struct.foo {
+ float 0.0,
+ float 0.0,
+ [4 x i32] zeroinitializer,
+ i32 addrspace(3)* getelementptr ([10 x i32] addrspace(3)* @i32_array_as3, i64 0, i64 0)
+}
+
+define i32 @test_cast_gep_large_indices_as() {
+; CHECK-LABEL: @test_cast_gep_large_indices_as(
+; CHECK: load i32 addrspace(3)* getelementptr inbounds ([10 x i32] addrspace(3)* @i32_array_as3, i16 0, i16 0), align 16
+ %p = getelementptr [10 x i32] addrspace(3)* @i32_array_as3, i64 0, i64 0
+ %x = load i32 addrspace(3)* %p, align 4
+ ret i32 %x
+}
+
+define i32 @test_constant_cast_gep_struct_indices_as() {
+; CHECK-LABEL: @test_constant_cast_gep_struct_indices_as(
+; CHECK: load i32 addrspace(3)* getelementptr inbounds (%struct.foo addrspace(3)* @constant_fold_global_ptr, i16 0, i32 2, i16 2), align 8
+ %x = getelementptr %struct.foo addrspace(3)* @constant_fold_global_ptr, i18 0, i32 2, i12 2
+ %y = load i32 addrspace(3)* %x, align 4
+ ret i32 %y
+}
+
+@constant_data_as3 = addrspace(3) constant [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
+
+define i32 @test_read_data_from_global_as3() {
+; CHECK-LABEL: @test_read_data_from_global_as3(
+; CHECK-NEXT: ret i32 2
+ %x = getelementptr [5 x i32] addrspace(3)* @constant_data_as3, i32 0, i32 1
+ %y = load i32 addrspace(3)* %x, align 4
+ ret i32 %y
+}
+
+@a = addrspace(1) constant i32 9
+@b = addrspace(1) constant i32 23
+@c = addrspace(1) constant i32 34
+@d = addrspace(1) constant i32 99
+
+@ptr_array = addrspace(2) constant [4 x i32 addrspace(1)*] [ i32 addrspace(1)* @a, i32 addrspace(1)* @b, i32 addrspace(1)* @c, i32 addrspace(1)* @d]
+@indirect = addrspace(0) constant i32 addrspace(1)* addrspace(2)* getelementptr inbounds ([4 x i32 addrspace(1)*] addrspace(2)* @ptr_array, i1 0, i32 2)
+
+define i32 @constant_through_array_as_ptrs() {
+; CHECK-LABEL: @constant_through_array_as_ptrs(
+; CHECK-NEXT: ret i32 34
+ %p = load i32 addrspace(1)* addrspace(2)* addrspace(0)* @indirect, align 4
+ %a = load i32 addrspace(1)* addrspace(2)* %p, align 4
+ %b = load i32 addrspace(1)* %a, align 4
+ ret i32 %b
+}
diff --git a/test/Transforms/InstCombine/constant-fold-gep.ll b/test/Transforms/InstCombine/constant-fold-gep.ll
index e5b16ea0ffdc..5fb56023a4f6 100644
--- a/test/Transforms/InstCombine/constant-fold-gep.ll
+++ b/test/Transforms/InstCombine/constant-fold-gep.ll
@@ -1,5 +1,5 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
-target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"
+target datalayout = "E-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"
; Constant folding should fix notionally out-of-bounds indices
; and add inbounds keywords.
@@ -56,7 +56,7 @@ define void @frob() {
; PR8883 - Constant fold exotic gep subtract
-; CHECK: @test2
+; CHECK-LABEL: @test2(
@X = global [1000 x i8] zeroinitializer, align 16
define i64 @test2() {
@@ -72,3 +72,21 @@ entry:
ret i64 %E
; CHECK: ret i64 1000
}
+
+@X_as1 = addrspace(1) global [1000 x i8] zeroinitializer, align 16
+
+define i16 @test2_as1() {
+; CHECK-LABEL: @test2_as1(
+ ; CHECK: ret i16 1000
+
+entry:
+ %A = bitcast i8 addrspace(1)* getelementptr inbounds ([1000 x i8] addrspace(1)* @X_as1, i64 1, i64 0) to i8 addrspace(1)*
+ %B = bitcast i8 addrspace(1)* getelementptr inbounds ([1000 x i8] addrspace(1)* @X_as1, i64 0, i64 0) to i8 addrspace(1)*
+
+ %B2 = ptrtoint i8 addrspace(1)* %B to i16
+ %C = sub i16 0, %B2
+ %D = getelementptr i8 addrspace(1)* %A, i16 %C
+ %E = ptrtoint i8 addrspace(1)* %D to i16
+
+ ret i16 %E
+}
diff --git a/test/Transforms/InstCombine/cos-1.ll b/test/Transforms/InstCombine/cos-1.ll
index b92e448abd9f..c2e9a0db4053 100644
--- a/test/Transforms/InstCombine/cos-1.ll
+++ b/test/Transforms/InstCombine/cos-1.ll
@@ -10,7 +10,7 @@ declare double @cos(double)
; Check cos(-x) -> cos(x);
define double @test_simplify1(double %d) {
-; NO-FLOAT-SHRINK: @test_simplify1
+; NO-FLOAT-SHRINK-LABEL: @test_simplify1(
%neg = fsub double -0.000000e+00, %d
%cos = call double @cos(double %neg)
; NO-FLOAT-SHRINK: call double @cos(double %d)
@@ -18,7 +18,7 @@ define double @test_simplify1(double %d) {
}
define float @test_simplify2(float %f) {
-; DO-FLOAT-SHRINK: @test_simplify2
+; DO-FLOAT-SHRINK-LABEL: @test_simplify2(
%conv1 = fpext float %f to double
%neg = fsub double -0.000000e+00, %conv1
%cos = call double @cos(double %neg)
@@ -28,7 +28,7 @@ define float @test_simplify2(float %f) {
}
define float @test_simplify3(float %f) {
-; NO-FLOAT-SHRINK: @test_simplify3
+; NO-FLOAT-SHRINK-LABEL: @test_simplify3(
%conv1 = fpext float %f to double
%neg = fsub double -0.000000e+00, %conv1
%cos = call double @cos(double %neg)
diff --git a/test/Transforms/InstCombine/cos-2.ll b/test/Transforms/InstCombine/cos-2.ll
index 2f2dfafe484d..c9a9c7c07712 100644
--- a/test/Transforms/InstCombine/cos-2.ll
+++ b/test/Transforms/InstCombine/cos-2.ll
@@ -9,7 +9,7 @@ declare float @cos(double)
; Check that cos functions with the wrong prototype aren't simplified.
define float @test_no_simplify1(double %d) {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%neg = fsub double -0.000000e+00, %d
%cos = call float @cos(double %neg)
; CHECK: call float @cos(double %neg)
diff --git a/test/Transforms/InstCombine/debug-line.ll b/test/Transforms/InstCombine/debug-line.ll
index 084efdc989f9..2e3785fe597e 100644
--- a/test/Transforms/InstCombine/debug-line.ll
+++ b/test/Transforms/InstCombine/debug-line.ll
@@ -11,14 +11,18 @@ define void @foo() nounwind ssp {
declare i32 @printf(i8*, ...)
+!llvm.dbg.cu = !{!2}
+!llvm.module.flags = !{!10}
!llvm.dbg.sp = !{!0}
-!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 4, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 false, void ()* @foo} ; [ DW_TAG_subprogram ]
-!1 = metadata !{i32 589865, metadata !"m.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ]
-!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"m.c", metadata !"/private/tmp", metadata !"clang", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
-!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
+!0 = metadata !{i32 589870, metadata !8, metadata !1, metadata !"foo", metadata !"foo", metadata !"", i32 4, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 false, void ()* @foo, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
+!1 = metadata !{i32 589865, metadata !8} ; [ DW_TAG_file_type ]
+!2 = metadata !{i32 589841, metadata !8, i32 12, metadata !"clang", i1 true, metadata !"", i32 0, metadata !4, metadata !4, metadata !9, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
+!3 = metadata !{i32 589845, metadata !8, metadata !1, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!4 = metadata !{null}
!5 = metadata !{i32 5, i32 2, metadata !6, null}
-!6 = metadata !{i32 589835, metadata !0, i32 4, i32 12, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
+!6 = metadata !{i32 589835, metadata !8, metadata !0, i32 4, i32 12, i32 0} ; [ DW_TAG_lexical_block ]
!7 = metadata !{i32 6, i32 1, metadata !6, null}
-
+!8 = metadata !{metadata !"m.c", metadata !"/private/tmp"}
+!9 = metadata !{metadata !0}
+!10 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/InstCombine/debuginfo.ll b/test/Transforms/InstCombine/debuginfo.ll
index a9e3de3b3f7b..75082dcae055 100644
--- a/test/Transforms/InstCombine/debuginfo.ll
+++ b/test/Transforms/InstCombine/debuginfo.ll
@@ -2,7 +2,7 @@
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
-declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readnone
+declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) nounwind readnone
declare i8* @foo(i8*, i32, i64, i64) nounwind
@@ -23,34 +23,37 @@ entry:
%tmp1 = load i32* %__val.addr, align 4, !dbg !21
%tmp2 = load i64* %__len.addr, align 8, !dbg !21
%tmp3 = load i8** %__dest.addr, align 8, !dbg !21
- %0 = call i64 @llvm.objectsize.i64(i8* %tmp3, i1 false), !dbg !21
+ %0 = call i64 @llvm.objectsize.i64.p0i8(i8* %tmp3, i1 false), !dbg !21
%call = call i8* @foo(i8* %tmp, i32 %tmp1, i64 %tmp2, i64 %0), !dbg !21
ret i8* %call, !dbg !21
}
!llvm.dbg.cu = !{!3}
+!llvm.module.flags = !{!30}
!0 = metadata !{i32 786689, metadata !1, metadata !"__dest", metadata !2, i32 16777294, metadata !6, i32 0, null} ; [ DW_TAG_arg_variable ]
-!1 = metadata !{i32 786478, metadata !2, metadata !"foobar", metadata !"foobar", metadata !"", metadata !2, i32 79, metadata !4, i1 true, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i8* (i8*, i32, i64)* @foobar, null, null, metadata !25, i32 79} ; [ DW_TAG_subprogram ]
+!1 = metadata !{i32 786478, metadata !27, metadata !2, metadata !"foobar", metadata !"foobar", metadata !"", i32 79, metadata !4, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 true, i8* (i8*, i32, i64)* @foobar, null, null, metadata !25, i32 79} ; [ DW_TAG_subprogram ] [line 79] [local] [def] [foobar]
!2 = metadata !{i32 786473, metadata !27} ; [ DW_TAG_file_type ]
-!3 = metadata !{i32 786449, i32 0, i32 12, metadata !26, metadata !"clang version 3.0 (trunk 127710)", i1 true, metadata !"", i32 0, null, null, metadata !24, null, null} ; [ DW_TAG_compile_unit ]
-!4 = metadata !{i32 786453, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !5, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
+!3 = metadata !{i32 786449, metadata !28, i32 12, metadata !"clang version 3.0 (trunk 127710)", i1 true, metadata !"", i32 0, metadata !29, metadata !29, metadata !24, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
+!4 = metadata !{i32 786453, metadata !27, metadata !2, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !5, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!5 = metadata !{metadata !6}
-!6 = metadata !{i32 786447, metadata !3, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, null} ; [ DW_TAG_pointer_type ]
+!6 = metadata !{i32 786447, null, metadata !3, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, null} ; [ DW_TAG_pointer_type ]
!7 = metadata !{i32 786689, metadata !1, metadata !"__val", metadata !2, i32 33554510, metadata !8, i32 0, null} ; [ DW_TAG_arg_variable ]
-!8 = metadata !{i32 786468, metadata !3, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
+!8 = metadata !{i32 786468, null, metadata !3, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!9 = metadata !{i32 786689, metadata !1, metadata !"__len", metadata !2, i32 50331726, metadata !10, i32 0, null} ; [ DW_TAG_arg_variable ]
-!10 = metadata !{i32 589846, metadata !3, metadata !"size_t", metadata !2, i32 80, i64 0, i64 0, i64 0, i32 0, metadata !11} ; [ DW_TAG_typedef ]
-!11 = metadata !{i32 589846, metadata !3, metadata !"__darwin_size_t", metadata !2, i32 90, i64 0, i64 0, i64 0, i32 0, metadata !12} ; [ DW_TAG_typedef ]
-!12 = metadata !{i32 786468, metadata !3, metadata !"long unsigned int", null, i32 0, i64 64, i64 64, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ]
+!10 = metadata !{i32 589846, metadata !27, metadata !3, metadata !"size_t", i32 80, i64 0, i64 0, i64 0, i32 0, metadata !11} ; [ DW_TAG_typedef ]
+!11 = metadata !{i32 589846, metadata !27, metadata !3, metadata !"__darwin_size_t", i32 90, i64 0, i64 0, i64 0, i32 0, metadata !12} ; [ DW_TAG_typedef ]
+!12 = metadata !{i32 786468, null, metadata !3, metadata !"long unsigned int", i32 0, i64 64, i64 64, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ]
!16 = metadata !{i32 78, i32 28, metadata !1, null}
!18 = metadata !{i32 78, i32 40, metadata !1, null}
!20 = metadata !{i32 78, i32 54, metadata !1, null}
!21 = metadata !{i32 80, i32 3, metadata !22, null}
-!22 = metadata !{i32 786443, metadata !23, i32 80, i32 3, metadata !2, i32 7} ; [ DW_TAG_lexical_block ]
-!23 = metadata !{i32 786443, metadata !1, i32 79, i32 1, metadata !2, i32 6} ; [ DW_TAG_lexical_block ]
+!22 = metadata !{i32 786443, metadata !27, metadata !23, i32 80, i32 3, i32 7} ; [ DW_TAG_lexical_block ]
+!23 = metadata !{i32 786443, metadata !27, metadata !1, i32 79, i32 1, i32 6} ; [ DW_TAG_lexical_block ]
!24 = metadata !{metadata !1}
!25 = metadata !{metadata !0, metadata !7, metadata !9}
!26 = metadata !{i32 786473, metadata !28} ; [ DW_TAG_file_type ]
!27 = metadata !{metadata !"string.h", metadata !"Game"}
!28 = metadata !{metadata !"bits.c", metadata !"Game"}
+!29 = metadata !{i32 0}
+!30 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/InstCombine/disable-simplify-libcalls.ll b/test/Transforms/InstCombine/disable-simplify-libcalls.ll
index c2c29368b1a8..665278861791 100644
--- a/test/Transforms/InstCombine/disable-simplify-libcalls.ll
+++ b/test/Transforms/InstCombine/disable-simplify-libcalls.ll
@@ -51,42 +51,42 @@ declare i32 @printf(i8*)
declare i32 @sprintf(i8*, i8*)
define double @t1(double %x) {
-; CHECK: @t1
+; CHECK-LABEL: @t1(
%ret = call double @ceil(double %x)
ret double %ret
; CHECK: call double @ceil
}
define double @t2(double %x, double %y) {
-; CHECK: @t2
+; CHECK-LABEL: @t2(
%ret = call double @copysign(double %x, double %y)
ret double %ret
; CHECK: call double @copysign
}
define double @t3(double %x) {
-; CHECK: @t3
+; CHECK-LABEL: @t3(
%call = call double @cos(double %x)
ret double %call
; CHECK: call double @cos
}
define double @t4(double %x) {
-; CHECK: @t4
+; CHECK-LABEL: @t4(
%ret = call double @fabs(double %x)
ret double %ret
; CHECK: call double @fabs
}
define double @t5(double %x) {
-; CHECK: @t5
+; CHECK-LABEL: @t5(
%ret = call double @floor(double %x)
ret double %ret
; CHECK: call double @floor
}
define i8* @t6(i8* %x) {
-; CHECK: @t6
+; CHECK-LABEL: @t6(
%empty = getelementptr [1 x i8]* @empty, i32 0, i32 0
%ret = call i8* @strcat(i8* %x, i8* %empty)
ret i8* %ret
@@ -94,7 +94,7 @@ define i8* @t6(i8* %x) {
}
define i8* @t7(i8* %x) {
-; CHECK: @t7
+; CHECK-LABEL: @t7(
%empty = getelementptr [1 x i8]* @empty, i32 0, i32 0
%ret = call i8* @strncat(i8* %x, i8* %empty, i32 1)
ret i8* %ret
@@ -102,7 +102,7 @@ define i8* @t7(i8* %x) {
}
define i8* @t8() {
-; CHECK: @t8
+; CHECK-LABEL: @t8(
%x = getelementptr inbounds [13 x i8]* @.str1, i32 0, i32 0
%ret = call i8* @strchr(i8* %x, i32 119)
ret i8* %ret
@@ -110,7 +110,7 @@ define i8* @t8() {
}
define i8* @t9() {
-; CHECK: @t9
+; CHECK-LABEL: @t9(
%x = getelementptr inbounds [13 x i8]* @.str1, i32 0, i32 0
%ret = call i8* @strrchr(i8* %x, i32 119)
ret i8* %ret
@@ -118,7 +118,7 @@ define i8* @t9() {
}
define i32 @t10() {
-; CHECK: @t10
+; CHECK-LABEL: @t10(
%x = getelementptr inbounds [4 x i8]* @.str2, i32 0, i32 0
%y = getelementptr inbounds [4 x i8]* @.str3, i32 0, i32 0
%ret = call i32 @strcmp(i8* %x, i8* %y)
@@ -127,7 +127,7 @@ define i32 @t10() {
}
define i32 @t11() {
-; CHECK: @t11
+; CHECK-LABEL: @t11(
%x = getelementptr inbounds [4 x i8]* @.str2, i32 0, i32 0
%y = getelementptr inbounds [4 x i8]* @.str3, i32 0, i32 0
%ret = call i32 @strncmp(i8* %x, i8* %y, i64 3)
@@ -136,7 +136,7 @@ define i32 @t11() {
}
define i8* @t12(i8* %x) {
-; CHECK: @t12
+; CHECK-LABEL: @t12(
%y = getelementptr inbounds [4 x i8]* @.str2, i32 0, i32 0
%ret = call i8* @strcpy(i8* %x, i8* %y)
ret i8* %ret
@@ -144,7 +144,7 @@ define i8* @t12(i8* %x) {
}
define i8* @t13(i8* %x) {
-; CHECK: @t13
+; CHECK-LABEL: @t13(
%y = getelementptr inbounds [4 x i8]* @.str2, i32 0, i32 0
%ret = call i8* @stpcpy(i8* %x, i8* %y)
ret i8* %ret
@@ -152,7 +152,7 @@ define i8* @t13(i8* %x) {
}
define i8* @t14(i8* %x) {
-; CHECK: @t14
+; CHECK-LABEL: @t14(
%y = getelementptr inbounds [4 x i8]* @.str2, i32 0, i32 0
%ret = call i8* @strncpy(i8* %x, i8* %y, i64 3)
ret i8* %ret
@@ -160,7 +160,7 @@ define i8* @t14(i8* %x) {
}
define i64 @t15() {
-; CHECK: @t15
+; CHECK-LABEL: @t15(
%x = getelementptr inbounds [4 x i8]* @.str2, i32 0, i32 0
%ret = call i64 @strlen(i8* %x)
ret i64 %ret
@@ -168,7 +168,7 @@ define i64 @t15() {
}
define i8* @t16(i8* %x) {
-; CHECK: @t16
+; CHECK-LABEL: @t16(
%y = getelementptr inbounds [1 x i8]* @.str, i32 0, i32 0
%ret = call i8* @strpbrk(i8* %x, i8* %y)
ret i8* %ret
@@ -176,7 +176,7 @@ define i8* @t16(i8* %x) {
}
define i64 @t17(i8* %x) {
-; CHECK: @t17
+; CHECK-LABEL: @t17(
%y = getelementptr inbounds [1 x i8]* @.str, i32 0, i32 0
%ret = call i64 @strspn(i8* %x, i8* %y)
ret i64 %ret
@@ -184,7 +184,7 @@ define i64 @t17(i8* %x) {
}
define double @t18(i8** %y) {
-; CHECK: @t18
+; CHECK-LABEL: @t18(
%x = getelementptr inbounds [6 x i8]* @.str4, i64 0, i64 0
%ret = call double @strtod(i8* %x, i8** %y)
ret double %ret
@@ -192,7 +192,7 @@ define double @t18(i8** %y) {
}
define float @t19(i8** %y) {
-; CHECK: @t19
+; CHECK-LABEL: @t19(
%x = getelementptr inbounds [6 x i8]* @.str4, i64 0, i64 0
%ret = call float @strtof(i8* %x, i8** %y)
ret float %ret
@@ -200,7 +200,7 @@ define float @t19(i8** %y) {
}
define x86_fp80 @t20(i8** %y) {
-; CHECK: @t20
+; CHECK-LABEL: @t20(
%x = getelementptr inbounds [6 x i8]* @.str4, i64 0, i64 0
%ret = call x86_fp80 @strtold(i8* %x, i8** %y)
ret x86_fp80 %ret
@@ -208,7 +208,7 @@ define x86_fp80 @t20(i8** %y) {
}
define i64 @t21(i8** %y) {
-; CHECK: @t21
+; CHECK-LABEL: @t21(
%x = getelementptr inbounds [5 x i8]* @.str5, i64 0, i64 0
%ret = call i64 @strtol(i8* %x, i8** %y, i32 10)
ret i64 %ret
@@ -216,7 +216,7 @@ define i64 @t21(i8** %y) {
}
define i64 @t22(i8** %y) {
-; CHECK: @t22
+; CHECK-LABEL: @t22(
%x = getelementptr inbounds [5 x i8]* @.str5, i64 0, i64 0
%ret = call i64 @strtoll(i8* %x, i8** %y, i32 10)
ret i64 %ret
@@ -224,7 +224,7 @@ define i64 @t22(i8** %y) {
}
define i64 @t23(i8** %y) {
-; CHECK: @t23
+; CHECK-LABEL: @t23(
%x = getelementptr inbounds [5 x i8]* @.str5, i64 0, i64 0
%ret = call i64 @strtoul(i8* %x, i8** %y, i32 10)
ret i64 %ret
@@ -232,7 +232,7 @@ define i64 @t23(i8** %y) {
}
define i64 @t24(i8** %y) {
-; CHECK: @t24
+; CHECK-LABEL: @t24(
%x = getelementptr inbounds [5 x i8]* @.str5, i64 0, i64 0
%ret = call i64 @strtoull(i8* %x, i8** %y, i32 10)
ret i64 %ret
@@ -240,7 +240,7 @@ define i64 @t24(i8** %y) {
}
define i64 @t25(i8* %y) {
-; CHECK: @t25
+; CHECK-LABEL: @t25(
%x = getelementptr [1 x i8]* @empty, i32 0, i32 0
%ret = call i64 @strcspn(i8* %x, i8* %y)
ret i64 %ret
@@ -248,35 +248,35 @@ define i64 @t25(i8* %y) {
}
define i32 @t26(i32 %y) {
-; CHECK: @t26
+; CHECK-LABEL: @t26(
%ret = call i32 @abs(i32 %y)
ret i32 %ret
; CHECK: call i32 @abs
}
define i32 @t27(i32 %y) {
-; CHECK: @t27
+; CHECK-LABEL: @t27(
%ret = call i32 @ffs(i32 %y)
ret i32 %ret
; CHECK: call i32 @ffs
}
define i32 @t28(i64 %y) {
-; CHECK: @t28
+; CHECK-LABEL: @t28(
%ret = call i32 @ffsl(i64 %y)
ret i32 %ret
; CHECK: call i32 @ffsl
}
define i32 @t29(i64 %y) {
-; CHECK: @t29
+; CHECK-LABEL: @t29(
%ret = call i32 @ffsll(i64 %y)
ret i32 %ret
; CHECK: call i32 @ffsll
}
define void @t30() {
-; CHECK: @t30
+; CHECK-LABEL: @t30(
%x = getelementptr inbounds [13 x i8]* @.str1, i32 0, i32 0
call i32 @fprintf(i8* null, i8* %x)
ret void
@@ -284,42 +284,42 @@ define void @t30() {
}
define i32 @t31(i32 %y) {
-; CHECK: @t31
+; CHECK-LABEL: @t31(
%ret = call i32 @isascii(i32 %y)
ret i32 %ret
; CHECK: call i32 @isascii
}
define i32 @t32(i32 %y) {
-; CHECK: @t32
+; CHECK-LABEL: @t32(
%ret = call i32 @isdigit(i32 %y)
ret i32 %ret
; CHECK: call i32 @isdigit
}
define i32 @t33(i32 %y) {
-; CHECK: @t33
+; CHECK-LABEL: @t33(
%ret = call i32 @toascii(i32 %y)
ret i32 %ret
; CHECK: call i32 @toascii
}
define i64 @t34(i64 %y) {
-; CHECK: @t34
+; CHECK-LABEL: @t34(
%ret = call i64 @labs(i64 %y)
ret i64 %ret
; CHECK: call i64 @labs
}
define i64 @t35(i64 %y) {
-; CHECK: @t35
+; CHECK-LABEL: @t35(
%ret = call i64 @llabs(i64 %y)
ret i64 %ret
; CHECK: call i64 @llabs
}
define void @t36() {
-; CHECK: @t36
+; CHECK-LABEL: @t36(
%x = getelementptr inbounds [1 x i8]* @empty, i32 0, i32 0
call i32 @printf(i8* %x)
ret void
@@ -327,7 +327,7 @@ define void @t36() {
}
define void @t37(i8* %x) {
-; CHECK: @t37
+; CHECK-LABEL: @t37(
%y = getelementptr inbounds [13 x i8]* @.str1, i32 0, i32 0
call i32 @sprintf(i8* %x, i8* %y)
ret void
diff --git a/test/Transforms/InstCombine/div-shift-crash.ll b/test/Transforms/InstCombine/div-shift-crash.ll
new file mode 100644
index 000000000000..a61972456403
--- /dev/null
+++ b/test/Transforms/InstCombine/div-shift-crash.ll
@@ -0,0 +1,101 @@
+; RUN: opt -instcombine < %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-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+%struct.S0.0.1.2.3.4.13.22.31.44.48.53.54.55.56.58.59.60.66.68.70.74.77.106.107.108.109.110.113.117.118.128.129 = type <{ i64 }>
+
+; Function Attrs: nounwind
+define void @main() #0 {
+entry:
+ %l_819.i.i = alloca %struct.S0.0.1.2.3.4.13.22.31.44.48.53.54.55.56.58.59.60.66.68.70.74.77.106.107.108.109.110.113.117.118.128.129, align 8
+ br i1 undef, label %land.lhs.true, label %for.cond.i
+
+land.lhs.true: ; preds = %entry
+ br label %for.cond.i
+
+for.cond.i: ; preds = %land.lhs.true, %entry
+ %0 = getelementptr inbounds %struct.S0.0.1.2.3.4.13.22.31.44.48.53.54.55.56.58.59.60.66.68.70.74.77.106.107.108.109.110.113.117.118.128.129* %l_819.i.i, i64 0, i32 0
+ br label %for.cond.i6.i.i
+
+for.cond.i6.i.i: ; preds = %for.body.i8.i.i, %for.cond.i
+ br i1 undef, label %for.body.i8.i.i, label %lbl_707.i.i.i
+
+for.body.i8.i.i: ; preds = %for.cond.i6.i.i
+ br label %for.cond.i6.i.i
+
+lbl_707.i.i.i: ; preds = %for.cond.i6.i.i
+ br i1 undef, label %lor.rhs.i.i.i, label %lor.end.i.i.i
+
+lor.rhs.i.i.i: ; preds = %lbl_707.i.i.i
+ br label %lor.end.i.i.i
+
+lor.end.i.i.i: ; preds = %lor.rhs.i.i.i, %lbl_707.i.i.i
+ br label %for.cond1.i.i.i.i
+
+for.cond1.i.i.i.i: ; preds = %for.body4.i.i.i.i, %lor.end.i.i.i
+ br i1 undef, label %for.body4.i.i.i.i, label %func_39.exit.i.i
+
+for.body4.i.i.i.i: ; preds = %for.cond1.i.i.i.i
+ br label %for.cond1.i.i.i.i
+
+func_39.exit.i.i: ; preds = %for.cond1.i.i.i.i
+ %l_8191.sroa.0.0.copyload.i.i = load i64* %0, align 1
+ br label %for.cond1.i.i.i
+
+for.cond1.i.i.i: ; preds = %safe_div_func_uint32_t_u_u.exit.i.i.i, %func_39.exit.i.i
+ br i1 undef, label %for.cond7.i.i.i, label %func_11.exit.i
+
+for.cond7.i.i.i: ; preds = %for.end30.i.i.i, %for.cond1.i.i.i
+ %storemerge.i.i.i = phi i32 [ %sub.i.i.i, %for.end30.i.i.i ], [ 4, %for.cond1.i.i.i ]
+ br i1 undef, label %for.cond22.i.i.i, label %for.end32.i.i.i
+
+for.cond22.i.i.i: ; preds = %for.body25.i.i.i, %for.cond7.i.i.i
+ br i1 undef, label %for.body25.i.i.i, label %for.end30.i.i.i
+
+for.body25.i.i.i: ; preds = %for.cond22.i.i.i
+ br label %for.cond22.i.i.i
+
+for.end30.i.i.i: ; preds = %for.cond22.i.i.i
+ %sub.i.i.i = add nsw i32 0, -1
+ br label %for.cond7.i.i.i
+
+for.end32.i.i.i: ; preds = %for.cond7.i.i.i
+ %conv33.i.i.i = trunc i64 %l_8191.sroa.0.0.copyload.i.i to i32
+ %xor.i.i.i.i = xor i32 %storemerge.i.i.i, -701565022
+ %sub.i.i.i.i = sub nsw i32 0, %storemerge.i.i.i
+ %xor3.i.i.i.i = xor i32 %sub.i.i.i.i, %storemerge.i.i.i
+ %and4.i.i.i.i = and i32 %xor.i.i.i.i, %xor3.i.i.i.i
+ %cmp.i.i.i.i = icmp slt i32 %and4.i.i.i.i, 0
+ %sub5.i.i.i.i = sub nsw i32 -701565022, %storemerge.i.i.i
+ %.sub5.i.i.i.i = select i1 %cmp.i.i.i.i, i32 -701565022, i32 %sub5.i.i.i.i
+ br i1 undef, label %safe_div_func_uint32_t_u_u.exit.i.i.i, label %cond.false.i.i.i.i
+
+cond.false.i.i.i.i: ; preds = %for.end32.i.i.i
+ %div.i.i.i.i = udiv i32 %conv33.i.i.i, %.sub5.i.i.i.i
+ br label %safe_div_func_uint32_t_u_u.exit.i.i.i
+
+safe_div_func_uint32_t_u_u.exit.i.i.i: ; preds = %cond.false.i.i.i.i, %for.end32.i.i.i
+ %cond.i.i.i.i = phi i32 [ %div.i.i.i.i, %cond.false.i.i.i.i ], [ %conv33.i.i.i, %for.end32.i.i.i ]
+ %cmp35.i.i.i = icmp ne i32 %cond.i.i.i.i, -7
+ br label %for.cond1.i.i.i
+
+func_11.exit.i: ; preds = %for.cond1.i.i.i
+ br i1 undef, label %for.body, label %for.end
+
+for.body: ; preds = %func_11.exit.i
+ unreachable
+
+for.end: ; preds = %func_11.exit.i
+ br label %for.cond15
+
+for.cond15: ; preds = %for.cond19, %for.end
+ br i1 undef, label %for.cond19, label %for.end45
+
+for.cond19: ; preds = %for.cond15
+ br label %for.cond15
+
+for.end45: ; preds = %for.cond15
+ unreachable
+}
+
+attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/test/Transforms/InstCombine/div-shift.ll b/test/Transforms/InstCombine/div-shift.ll
index e0372ebac184..3350f1940554 100644
--- a/test/Transforms/InstCombine/div-shift.ll
+++ b/test/Transforms/InstCombine/div-shift.ll
@@ -35,3 +35,41 @@ define i64 @t3(i64 %x, i32 %y) nounwind {
%3 = udiv i64 %x, %2
ret i64 %3
}
+
+define i32 @t4(i32 %x, i32 %y) nounwind {
+; CHECK: t4
+; CHECK-NOT: udiv
+; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 %y, 5
+; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP]], i32 5, i32 %y
+; CHECK-NEXT: [[SHR:%.*]] = lshr i32 %x, [[SEL]]
+; CHECK-NEXT: ret i32 [[SHR]]
+ %1 = shl i32 1, %y
+ %2 = icmp ult i32 %1, 32
+ %3 = select i1 %2, i32 32, i32 %1
+ %4 = udiv i32 %x, %3
+ ret i32 %4
+}
+
+define i32 @t5(i1 %x, i1 %y, i32 %V) nounwind {
+; CHECK: t5
+; CHECK-NOT: udiv
+; CHECK-NEXT: [[SEL1:%.*]] = select i1 %x, i32 5, i32 6
+; CHECK-NEXT: [[LSHR:%.*]] = lshr i32 %V, [[SEL1]]
+; CHECK-NEXT: [[SEL2:%.*]] = select i1 %y, i32 [[LSHR]], i32 0
+; CHECK-NEXT: ret i32 [[SEL2]]
+ %1 = shl i32 1, %V
+ %2 = select i1 %x, i32 32, i32 64
+ %3 = select i1 %y, i32 %2, i32 %1
+ %4 = udiv i32 %V, %3
+ ret i32 %4
+}
+
+define i32 @t6(i32 %x, i32 %z) nounwind{
+; CHECK: t6
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 %x, 0
+; CHECK-NOT: udiv i32 %z, %x
+ %x_is_zero = icmp eq i32 %x, 0
+ %divisor = select i1 %x_is_zero, i32 1, i32 %x
+ %y = udiv i32 %z, %divisor
+ ret i32 %y
+}
diff --git a/test/Transforms/InstCombine/div.ll b/test/Transforms/InstCombine/div.ll
index 8a0897b972de..f67fd1c51be3 100644
--- a/test/Transforms/InstCombine/div.ll
+++ b/test/Transforms/InstCombine/div.ll
@@ -5,7 +5,7 @@
define i32 @test1(i32 %A) {
%B = sdiv i32 %A, 1 ; <i32> [#uses=1]
ret i32 %B
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: ret i32 %A
}
@@ -13,7 +13,7 @@ define i32 @test2(i32 %A) {
; => Shift
%B = udiv i32 %A, 8 ; <i32> [#uses=1]
ret i32 %B
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: lshr i32 %A, 3
}
@@ -21,7 +21,7 @@ define i32 @test3(i32 %A) {
; => 0, don't need to keep traps
%B = sdiv i32 0, %A ; <i32> [#uses=1]
ret i32 %B
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: ret i32 0
}
@@ -29,7 +29,7 @@ define i32 @test4(i32 %A) {
; 0-A
%B = sdiv i32 %A, -1 ; <i32> [#uses=1]
ret i32 %B
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NEXT: sub i32 0, %A
}
@@ -37,7 +37,7 @@ define i32 @test5(i32 %A) {
%B = udiv i32 %A, -16 ; <i32> [#uses=1]
%C = udiv i32 %B, -4 ; <i32> [#uses=1]
ret i32 %C
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NEXT: ret i32 0
}
@@ -46,7 +46,7 @@ define i1 @test6(i32 %A) {
; A < 123
%C = icmp eq i32 %B, 0 ; <i1> [#uses=1]
ret i1 %C
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NEXT: icmp ult i32 %A, 123
}
@@ -55,7 +55,7 @@ define i1 @test7(i32 %A) {
; A >= 20 && A < 30
%C = icmp eq i32 %B, 2 ; <i1> [#uses=1]
ret i1 %C
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NEXT: add i32 %A, -20
; CHECK-NEXT: icmp ult i32
}
@@ -65,7 +65,7 @@ define i1 @test8(i8 %A) {
; A >= 246
%C = icmp eq i8 %B, 2 ; <i1> [#uses=1]
ret i1 %C
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK-NEXT: icmp ugt i8 %A, -11
}
@@ -74,7 +74,7 @@ define i1 @test9(i8 %A) {
; A < 246
%C = icmp ne i8 %B, 2 ; <i1> [#uses=1]
ret i1 %C
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK-NEXT: icmp ult i8 %A, -10
}
@@ -82,7 +82,7 @@ define i32 @test10(i32 %X, i1 %C) {
%V = select i1 %C, i32 64, i32 8 ; <i32> [#uses=1]
%R = udiv i32 %X, %V ; <i32> [#uses=1]
ret i32 %R
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK-NEXT: select i1 %C, i32 6, i32 3
; CHECK-NEXT: lshr i32 %X
}
@@ -91,7 +91,7 @@ define i32 @test11(i32 %X, i1 %C) {
%A = select i1 %C, i32 1024, i32 32 ; <i32> [#uses=1]
%B = udiv i32 %X, %A ; <i32> [#uses=1]
ret i32 %B
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK-NEXT: select i1 %C, i32 10, i32 5
; CHECK-NEXT: lshr i32 %X
}
@@ -100,14 +100,14 @@ define i32 @test11(i32 %X, i1 %C) {
define i32 @test12(i32 %x) nounwind {
%tmp3 = udiv i32 %x, %x ; 1
ret i32 %tmp3
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK-NEXT: ret i32 1
}
define i32 @test13(i32 %x) nounwind {
%tmp3 = sdiv i32 %x, %x ; 1
ret i32 %tmp3
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; CHECK-NEXT: ret i32 1
}
@@ -115,7 +115,7 @@ define i32 @test14(i8 %x) nounwind {
%zext = zext i8 %x to i32
%div = udiv i32 %zext, 257 ; 0
ret i32 %div
-; CHECK: @test14
+; CHECK-LABEL: @test14(
; CHECK-NEXT: ret i32 0
}
@@ -125,7 +125,7 @@ define i32 @test15(i32 %a, i32 %b) nounwind {
%div = lshr i32 %shl, 2
%div2 = udiv i32 %a, %div
ret i32 %div2
-; CHECK: @test15
+; CHECK-LABEL: @test15(
; CHECK-NEXT: add i32 %b, -2
; CHECK-NEXT: lshr i32 %a,
; CHECK-NEXT: ret i32
diff --git a/test/Transforms/InstCombine/double-float-shrink-1.ll b/test/Transforms/InstCombine/double-float-shrink-1.ll
index e5448ee00765..5cacb591e006 100644
--- a/test/Transforms/InstCombine/double-float-shrink-1.ll
+++ b/test/Transforms/InstCombine/double-float-shrink-1.ll
@@ -263,6 +263,7 @@ define double @sin_test2(float %f) nounwind readnone {
ret double %call
; CHECK: call double @sin(double %conv)
}
+
define float @sqrt_test(float %f) nounwind readnone {
; CHECK: sqrt_test
%conv = fpext float %f to double
@@ -272,6 +273,15 @@ define float @sqrt_test(float %f) nounwind readnone {
; CHECK: call float @sqrtf(float %f)
}
+define float @sqrt_int_test(float %f) nounwind readnone {
+; CHECK: sqrt_int_test
+ %conv = fpext float %f to double
+ %call = call double @llvm.sqrt.f64(double %conv)
+ %conv1 = fptrunc double %call to float
+ ret float %conv1
+; CHECK: call float @llvm.sqrt.f32(float %f)
+}
+
define double @sqrt_test2(float %f) nounwind readnone {
; CHECK: sqrt_test2
%conv = fpext float %f to double
@@ -331,3 +341,6 @@ declare double @acos(double) nounwind readnone
declare double @acosh(double) nounwind readnone
declare double @asin(double) nounwind readnone
declare double @asinh(double) nounwind readnone
+
+declare double @llvm.sqrt.f64(double) nounwind readnone
+
diff --git a/test/Transforms/InstCombine/enforce-known-alignment.ll b/test/Transforms/InstCombine/enforce-known-alignment.ll
index 6645d99035fa..46bb60569fe2 100644
--- a/test/Transforms/InstCombine/enforce-known-alignment.ll
+++ b/test/Transforms/InstCombine/enforce-known-alignment.ll
@@ -1,8 +1,12 @@
-; RUN: opt < %s -instcombine -S | grep alloca | grep "align 16"
-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"
+; RUN: opt -instcombine -S %s | FileCheck %s
+
+target datalayout = "e-p:32:32:32-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin9.6"
define void @foo(i32) {
+; CHECK-LABEL: @foo(
+; CHECK: alloca
+; CHECK: align 16
%2 = alloca [3 x <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>], align 16 ; <[3 x <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>]*> [#uses=1]
%3 = getelementptr [3 x <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>]* %2, i32 0, i32 0 ; <<{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>*> [#uses=1]
%4 = getelementptr <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>* %3, i32 0, i32 0 ; <{ { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } }*> [#uses=1]
@@ -11,8 +15,24 @@ define void @foo(i32) {
%7 = getelementptr { [8 x i16] }* %6, i32 0, i32 0 ; <[8 x i16]*> [#uses=1]
%8 = getelementptr [8 x i16]* %7, i32 0, i32 0 ; <i16*> [#uses=1]
store i16 0, i16* %8, align 16
- call void @bar(i16* %8)
+ call void @bar(i16* %8)
ret void
}
declare void @bar(i16*)
+
+define void @foo_as1(i32 %a, [3 x <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>] addrspace(1)* %b) {
+; CHECK-LABEL: @foo_as1(
+; CHECK: align 16
+ %1 = getelementptr [3 x <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>] addrspace(1)* %b, i32 0, i32 0 ; <<{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>*> [#uses=1]
+ %2 = getelementptr <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }> addrspace(1)* %1, i32 0, i32 0 ; <{ { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } }*> [#uses=1]
+ %3 = getelementptr { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } addrspace(1)* %2, i32 0, i32 0 ; <{ [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 }*> [#uses=1]
+ %4 = bitcast { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } addrspace(1)* %3 to { [8 x i16] } addrspace(1)* ; <{ [8 x i16] }*> [#uses=1]
+ %5 = getelementptr { [8 x i16] } addrspace(1)* %4, i32 0, i32 0 ; <[8 x i16]*> [#uses=1]
+ %6 = getelementptr [8 x i16] addrspace(1)* %5, i32 0, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16 addrspace(1)* %6, align 16
+ call void @bar_as1(i16 addrspace(1)* %6)
+ ret void
+}
+
+declare void @bar_as1(i16 addrspace(1)*)
diff --git a/test/Transforms/InstCombine/err-rep-cold.ll b/test/Transforms/InstCombine/err-rep-cold.ll
new file mode 100644
index 000000000000..0cbafc43e0f6
--- /dev/null
+++ b/test/Transforms/InstCombine/err-rep-cold.ll
@@ -0,0 +1,77 @@
+; Test the static branch probability heuristics for error-reporting functions.
+; RUN: opt < %s -instcombine -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-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+%struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i64, i32, [20 x i8] }
+%struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 }
+
+@stdout = external global %struct._IO_FILE*
+@stderr = external global %struct._IO_FILE*
+@.str = private unnamed_addr constant [13 x i8] c"an error: %d\00", align 1
+@.str1 = private unnamed_addr constant [9 x i8] c"an error\00", align 1
+
+define i32 @test1(i32 %a) #0 {
+; CHECK-LABEL: @test1
+entry:
+ %cmp = icmp sgt i32 %a, 8
+ br i1 %cmp, label %if.then, label %return
+
+if.then: ; preds = %entry
+ %0 = load %struct._IO_FILE** @stderr, align 8
+ %call = tail call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf(%struct._IO_FILE* %0, i8* getelementptr inbounds ([13 x i8]* @.str, i64 0, i64 0), i32 %a) #1
+ br label %return
+
+; CHECK: %call = tail call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf(%struct._IO_FILE* %0, i8* getelementptr inbounds ([13 x i8]* @.str, i64 0, i64 0), i32 %a) #[[AT1:[0-9]+]]
+
+return: ; preds = %entry, %if.then
+ %retval.0 = phi i32 [ 1, %if.then ], [ 0, %entry ]
+ ret i32 %retval.0
+}
+
+declare i32 @fprintf(%struct._IO_FILE* nocapture, i8* nocapture readonly, ...) #1
+
+define i32 @test2(i32 %a) #0 {
+; CHECK-LABEL: @test2
+entry:
+ %cmp = icmp sgt i32 %a, 8
+ br i1 %cmp, label %if.then, label %return
+
+if.then: ; preds = %entry
+ %0 = load %struct._IO_FILE** @stderr, align 8
+ %1 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8]* @.str1, i64 0, i64 0), i64 8, i64 1, %struct._IO_FILE* %0)
+ br label %return
+
+; CHECK: tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8]* @.str1, i64 0, i64 0), i64 8, i64 1, %struct._IO_FILE* %0) #[[AT2:[0-9]+]]
+
+return: ; preds = %entry, %if.then
+ %retval.0 = phi i32 [ 1, %if.then ], [ 0, %entry ]
+ ret i32 %retval.0
+}
+
+declare i64 @fwrite(i8* nocapture, i64, i64, %struct._IO_FILE* nocapture) #1
+
+define i32 @test3(i32 %a) #0 {
+; CHECK-LABEL: @test3
+entry:
+ %cmp = icmp sgt i32 %a, 8
+ br i1 %cmp, label %if.then, label %return
+
+if.then: ; preds = %entry
+ %0 = load %struct._IO_FILE** @stdout, align 8
+ %1 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8]* @.str1, i64 0, i64 0), i64 8, i64 1, %struct._IO_FILE* %0)
+ br label %return
+
+; CHECK-NOT: tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8]* @.str1, i64 0, i64 0), i64 8, i64 1, %struct._IO_FILE* %0) #[[AT2]]
+
+return: ; preds = %entry, %if.then
+ %retval.0 = phi i32 [ 1, %if.then ], [ 0, %entry ]
+ ret i32 %retval.0
+}
+
+attributes #0 = { nounwind uwtable }
+attributes #1 = { nounwind }
+
+; CHECK: attributes #[[AT1]] = { cold nounwind }
+; CHECK: attributes #[[AT2]] = { cold }
+
diff --git a/test/Transforms/InstCombine/exact.ll b/test/Transforms/InstCombine/exact.ll
index 88ca88c3b927..868d60ac46b1 100644
--- a/test/Transforms/InstCombine/exact.ll
+++ b/test/Transforms/InstCombine/exact.ll
@@ -1,20 +1,20 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
-; CHECK: @sdiv1
+; CHECK-LABEL: @sdiv1(
; CHECK: sdiv i32 %x, 8
define i32 @sdiv1(i32 %x) {
%y = sdiv i32 %x, 8
ret i32 %y
}
-; CHECK: @sdiv2
+; CHECK-LABEL: @sdiv2(
; CHECK: ashr exact i32 %x, 3
define i32 @sdiv2(i32 %x) {
%y = sdiv exact i32 %x, 8
ret i32 %y
}
-; CHECK: @sdiv3
+; CHECK-LABEL: @sdiv3(
; CHECK: %y = srem i32 %x, 3
; CHECK: %z = sub i32 %x, %y
; CHECK: ret i32 %z
@@ -24,7 +24,7 @@ define i32 @sdiv3(i32 %x) {
ret i32 %z
}
-; CHECK: @sdiv4
+; CHECK-LABEL: @sdiv4(
; CHECK: ret i32 %x
define i32 @sdiv4(i32 %x) {
%y = sdiv exact i32 %x, 3
@@ -42,7 +42,7 @@ define i32 @sdiv5(i32 %x) {
ret i32 %z
}
-; CHECK: @sdiv6
+; CHECK-LABEL: @sdiv6(
; CHECK: %z = sub i32 0, %x
; CHECK: ret i32 %z
define i32 @sdiv6(i32 %x) {
@@ -51,7 +51,7 @@ define i32 @sdiv6(i32 %x) {
ret i32 %z
}
-; CHECK: @udiv1
+; CHECK-LABEL: @udiv1(
; CHECK: ret i32 %x
define i32 @udiv1(i32 %x, i32 %w) {
%y = udiv exact i32 %x, %w
@@ -59,7 +59,7 @@ define i32 @udiv1(i32 %x, i32 %w) {
ret i32 %z
}
-; CHECK: @udiv2
+; CHECK-LABEL: @udiv2(
; CHECK: %z = lshr exact i32 %x, %w
; CHECK: ret i32 %z
define i32 @udiv2(i32 %x, i32 %w) {
@@ -68,7 +68,7 @@ define i32 @udiv2(i32 %x, i32 %w) {
ret i32 %z
}
-; CHECK: @ashr1
+; CHECK-LABEL: @ashr1(
; CHECK: %B = ashr exact i64 %A, 2
; CHECK: ret i64 %B
define i64 @ashr1(i64 %X) nounwind {
@@ -78,7 +78,7 @@ define i64 @ashr1(i64 %X) nounwind {
}
; PR9120
-; CHECK: @ashr_icmp1
+; CHECK-LABEL: @ashr_icmp1(
; CHECK: %B = icmp eq i64 %X, 0
; CHECK: ret i1 %B
define i1 @ashr_icmp1(i64 %X) nounwind {
@@ -87,7 +87,7 @@ define i1 @ashr_icmp1(i64 %X) nounwind {
ret i1 %B
}
-; CHECK: @ashr_icmp2
+; CHECK-LABEL: @ashr_icmp2(
; CHECK: %Z = icmp slt i64 %X, 16
; CHECK: ret i1 %Z
define i1 @ashr_icmp2(i64 %X) nounwind {
@@ -98,7 +98,7 @@ define i1 @ashr_icmp2(i64 %X) nounwind {
; PR9998
; Make sure we don't transform the ashr here into an sdiv
-; CHECK: @pr9998
+; CHECK-LABEL: @pr9998(
; CHECK: [[BIT:%[A-Za-z0-9.]+]] = and i32 %V, 1
; CHECK-NEXT: [[CMP:%[A-Za-z0-9.]+]] = icmp ne i32 [[BIT]], 0
; CHECK-NEXT: ret i1 [[CMP]]
@@ -113,7 +113,7 @@ entry:
-; CHECK: @udiv_icmp1
+; CHECK-LABEL: @udiv_icmp1(
; CHECK: icmp ne i64 %X, 0
define i1 @udiv_icmp1(i64 %X) nounwind {
%A = udiv exact i64 %X, 5 ; X/5
@@ -121,7 +121,7 @@ define i1 @udiv_icmp1(i64 %X) nounwind {
ret i1 %B
}
-; CHECK: @sdiv_icmp1
+; CHECK-LABEL: @sdiv_icmp1(
; CHECK: icmp eq i64 %X, 0
define i1 @sdiv_icmp1(i64 %X) nounwind {
%A = sdiv exact i64 %X, 5 ; X/5 == 0 --> x == 0
@@ -129,7 +129,7 @@ define i1 @sdiv_icmp1(i64 %X) nounwind {
ret i1 %B
}
-; CHECK: @sdiv_icmp2
+; CHECK-LABEL: @sdiv_icmp2(
; CHECK: icmp eq i64 %X, 5
define i1 @sdiv_icmp2(i64 %X) nounwind {
%A = sdiv exact i64 %X, 5 ; X/5 == 1 --> x == 5
@@ -137,7 +137,7 @@ define i1 @sdiv_icmp2(i64 %X) nounwind {
ret i1 %B
}
-; CHECK: @sdiv_icmp3
+; CHECK-LABEL: @sdiv_icmp3(
; CHECK: icmp eq i64 %X, -5
define i1 @sdiv_icmp3(i64 %X) nounwind {
%A = sdiv exact i64 %X, 5 ; X/5 == -1 --> x == -5
@@ -145,7 +145,7 @@ define i1 @sdiv_icmp3(i64 %X) nounwind {
ret i1 %B
}
-; CHECK: @sdiv_icmp4
+; CHECK-LABEL: @sdiv_icmp4(
; CHECK: icmp eq i64 %X, 0
define i1 @sdiv_icmp4(i64 %X) nounwind {
%A = sdiv exact i64 %X, -5 ; X/-5 == 0 --> x == 0
@@ -153,7 +153,7 @@ define i1 @sdiv_icmp4(i64 %X) nounwind {
ret i1 %B
}
-; CHECK: @sdiv_icmp5
+; CHECK-LABEL: @sdiv_icmp5(
; CHECK: icmp eq i64 %X, -5
define i1 @sdiv_icmp5(i64 %X) nounwind {
%A = sdiv exact i64 %X, -5 ; X/-5 == 1 --> x == -5
@@ -161,7 +161,7 @@ define i1 @sdiv_icmp5(i64 %X) nounwind {
ret i1 %B
}
-; CHECK: @sdiv_icmp6
+; CHECK-LABEL: @sdiv_icmp6(
; CHECK: icmp eq i64 %X, 5
define i1 @sdiv_icmp6(i64 %X) nounwind {
%A = sdiv exact i64 %X, -5 ; X/-5 == 1 --> x == 5
diff --git a/test/Transforms/InstCombine/exp2-1.ll b/test/Transforms/InstCombine/exp2-1.ll
index 1b0ad5000412..99fb9ecfd2b2 100644
--- a/test/Transforms/InstCombine/exp2-1.ll
+++ b/test/Transforms/InstCombine/exp2-1.ll
@@ -10,7 +10,7 @@ declare float @exp2f(float)
; Check exp2(sitofp(x)) -> ldexp(1.0, sext(x)).
define double @test_simplify1(i32 %x) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%conv = sitofp i32 %x to double
%ret = call double @exp2(double %conv)
; CHECK: call double @ldexp
@@ -18,7 +18,7 @@ define double @test_simplify1(i32 %x) {
}
define double @test_simplify2(i16 signext %x) {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%conv = sitofp i16 %x to double
%ret = call double @exp2(double %conv)
; CHECK: call double @ldexp
@@ -26,7 +26,7 @@ define double @test_simplify2(i16 signext %x) {
}
define double @test_simplify3(i8 signext %x) {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%conv = sitofp i8 %x to double
%ret = call double @exp2(double %conv)
; CHECK: call double @ldexp
@@ -34,7 +34,7 @@ define double @test_simplify3(i8 signext %x) {
}
define float @test_simplify4(i32 %x) {
-; CHECK: @test_simplify4
+; CHECK-LABEL: @test_simplify4(
%conv = sitofp i32 %x to float
%ret = call float @exp2f(float %conv)
; CHECK: call float @ldexpf
@@ -44,7 +44,7 @@ define float @test_simplify4(i32 %x) {
; Check exp2(uitofp(x)) -> ldexp(1.0, zext(x)).
define double @test_no_simplify1(i32 %x) {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%conv = uitofp i32 %x to double
%ret = call double @exp2(double %conv)
; CHECK: call double @exp2
@@ -52,7 +52,7 @@ define double @test_no_simplify1(i32 %x) {
}
define double @test_simplify6(i16 zeroext %x) {
-; CHECK: @test_simplify6
+; CHECK-LABEL: @test_simplify6(
%conv = uitofp i16 %x to double
%ret = call double @exp2(double %conv)
; CHECK: call double @ldexp
@@ -60,7 +60,7 @@ define double @test_simplify6(i16 zeroext %x) {
}
define double @test_simplify7(i8 zeroext %x) {
-; CHECK: @test_simplify7
+; CHECK-LABEL: @test_simplify7(
%conv = uitofp i8 %x to double
%ret = call double @exp2(double %conv)
; CHECK: call double @ldexp
@@ -68,7 +68,7 @@ define double @test_simplify7(i8 zeroext %x) {
}
define float @test_simplify8(i8 zeroext %x) {
-; CHECK: @test_simplify8
+; CHECK-LABEL: @test_simplify8(
%conv = uitofp i8 %x to float
%ret = call float @exp2f(float %conv)
; CHECK: call float @ldexpf
diff --git a/test/Transforms/InstCombine/exp2-2.ll b/test/Transforms/InstCombine/exp2-2.ll
index bed063798e29..19368dc48c6b 100644
--- a/test/Transforms/InstCombine/exp2-2.ll
+++ b/test/Transforms/InstCombine/exp2-2.ll
@@ -9,7 +9,7 @@ declare float @exp2(double)
; Check that exp2 functions with the wrong prototype aren't simplified.
define float @test_no_simplify1(i32 %x) {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%conv = sitofp i32 %x to double
%ret = call float @exp2(double %conv)
; CHECK: call float @exp2(double %conv)
diff --git a/test/Transforms/InstCombine/extractvalue.ll b/test/Transforms/InstCombine/extractvalue.ll
index 5e4c67778224..04c7ffa219da 100644
--- a/test/Transforms/InstCombine/extractvalue.ll
+++ b/test/Transforms/InstCombine/extractvalue.ll
@@ -3,7 +3,7 @@
declare void @bar({i32, i32} %a)
declare i32 @baz(i32 %a)
-; CHECK: define i32 @foo
+; CHECK-LABEL: define i32 @foo(
; CHECK-NOT: extractvalue
define i32 @foo(i32 %a, i32 %b) {
; Instcombine should fold various combinations of insertvalue and extractvalue
@@ -39,7 +39,7 @@ define i32 @foo(i32 %a, i32 %b) {
ret i32 %v5
}
-; CHECK: define i32 @extract2gep
+; CHECK-LABEL: define i32 @extract2gep(
; CHECK-NEXT: [[GEP:%[a-z0-9]+]] = getelementptr inbounds {{.*}}* %pair, i32 0, i32 1
; CHECK-NEXT: [[LOAD:%[A-Za-z0-9]+]] = load i32* [[GEP]]
; CHECK-NEXT: store
@@ -67,7 +67,7 @@ end:
ret i32 %E
}
-; CHECK: define i32 @doubleextract2gep
+; CHECK-LABEL: define i32 @doubleextract2gep(
; CHECK-NEXT: [[GEP:%[a-z0-9]+]] = getelementptr inbounds {{.*}}* %arg, i32 0, i32 1, i32 1
; CHECK-NEXT: [[LOAD:%[A-Za-z0-9]+]] = load i32* [[GEP]]
; CHECK-NEXT: ret i32 [[LOAD]]
diff --git a/test/Transforms/InstCombine/fast-math.ll b/test/Transforms/InstCombine/fast-math.ll
index edcbcc71dfb4..d8ba2a59ff5e 100644
--- a/test/Transforms/InstCombine/fast-math.ll
+++ b/test/Transforms/InstCombine/fast-math.ll
@@ -6,14 +6,14 @@ define float @fold(float %a) {
%mul = fmul fast float %a, 0x3FF3333340000000
%mul1 = fmul fast float %mul, 0x4002666660000000
ret float %mul1
-; CHECK: @fold
+; CHECK-LABEL: @fold(
; CHECK: fmul fast float %a, 0x4006147AE0000000
}
; Same testing-case as the one used in fold() except that the operators have
; fixed FP mode.
define float @notfold(float %a) {
-; CHECK: @notfold
+; CHECK-LABEL: @notfold(
; CHECK: %mul = fmul fast float %a, 0x3FF3333340000000
%mul = fmul fast float %a, 0x3FF3333340000000
%mul1 = fmul float %mul, 0x4002666660000000
@@ -21,7 +21,7 @@ define float @notfold(float %a) {
}
define float @fold2(float %a) {
-; CHECK: @fold2
+; CHECK-LABEL: @fold2(
; CHECK: fmul fast float %a, 0x4006147AE0000000
%mul = fmul float %a, 0x3FF3333340000000
%mul1 = fmul fast float %mul, 0x4002666660000000
@@ -33,7 +33,7 @@ define double @fold3(double %f1) {
%t1 = fmul fast double 2.000000e+00, %f1
%t2 = fadd fast double %f1, %t1
ret double %t2
-; CHECK: @fold3
+; CHECK-LABEL: @fold3(
; CHECK: fmul fast double %f1, 3.000000e+00
}
@@ -43,7 +43,7 @@ define float @fold4(float %f1, float %f2) {
%sub1 = fsub float 5.000000e+00, %f2
%add = fadd fast float %sub, %sub1
ret float %add
-; CHECK: @fold4
+; CHECK-LABEL: @fold4(
; CHECK: %1 = fadd fast float %f1, %f2
; CHECK: fsub fast float 9.000000e+00, %1
}
@@ -53,7 +53,7 @@ define float @fold5(float %f1, float %f2) {
%add = fadd float %f1, 4.000000e+00
%add1 = fadd fast float %add, 5.000000e+00
ret float %add1
-; CHECK: @fold5
+; CHECK-LABEL: @fold5(
; CHECK: fadd fast float %f1, 9.000000e+00
}
@@ -62,7 +62,7 @@ define float @fold6(float %f1) {
%t1 = fadd fast float %f1, %f1
%t2 = fadd fast float %f1, %t1
ret float %t2
-; CHECK: @fold6
+; CHECK-LABEL: @fold6(
; CHECK: fmul fast float %f1, 3.000000e+00
}
@@ -72,7 +72,7 @@ define float @fold7(float %f1) {
%t2 = fadd fast float %f1, %f1
%t3 = fadd fast float %t1, %t2
ret float %t3
-; CHECK: @fold7
+; CHECK-LABEL: @fold7(
; CHECK: fmul fast float %f1, 7.000000e+00
}
@@ -92,7 +92,7 @@ define float @fold9(float %f1, float %f2) {
%t3 = fsub fast float %f1, %t1
ret float %t3
-; CHECK: @fold9
+; CHECK-LABEL: @fold9(
; CHECK: fsub fast float 0.000000e+00, %f2
}
@@ -106,7 +106,7 @@ define float @fold10(float %f1, float %f2) {
%t2 = fsub fast float %f2, 3.000000e+00
%t3 = fadd fast float %t1, %t2
ret float %t3
-; CHECK: @fold10
+; CHECK-LABEL: @fold10(
; CHECK: %t3 = fadd fast float %t2, -1.000000e+00
; CHECK: ret float %t3
}
@@ -117,7 +117,7 @@ define float @fail1(float %f1, float %f2) {
%add = fadd fast float %conv3, %conv3
%add2 = fadd fast float %add, %conv3
ret float %add2
-; CHECK: @fail1
+; CHECK-LABEL: @fail1(
; CHECK: ret
}
@@ -126,7 +126,7 @@ define double @fail2(double %f1, double %f2) {
%t2 = fadd fast double %f1, %f2
%t3 = fsub fast double %t1, %t2
ret double %t3
-; CHECK: @fail2
+; CHECK-LABEL: @fail2(
; CHECK: ret
}
@@ -152,7 +152,7 @@ define float @fmul_distribute1(float %f1) {
%t2 = fadd float %t1, 2.0e+3
%t3 = fmul fast float %t2, 5.0e+3
ret float %t3
-; CHECK: @fmul_distribute1
+; CHECK-LABEL: @fmul_distribute1(
; CHECK: %1 = fmul fast float %f1, 3.000000e+07
; CHECK: %t3 = fadd fast float %1, 1.000000e+07
}
@@ -165,7 +165,7 @@ define double @fmul_distribute2(double %f1, double %f2) {
%t3 = fmul fast double %t2, 0x10000000000000
ret double %t3
-; CHECK: @fmul_distribute2
+; CHECK-LABEL: @fmul_distribute2(
; CHECK: %1 = fdiv fast double %f1, 0x7FE8000000000000
; CHECK: fadd fast double %1, 0x69000000000000
}
@@ -178,7 +178,7 @@ define double @fmul_distribute3(double %f1) {
%t3 = fmul fast double %t2, 0x10000000000000
ret double %t3
-; CHECK: @fmul_distribute3
+; CHECK-LABEL: @fmul_distribute3(
; CHECK: fmul fast double %t2, 0x10000000000000
}
@@ -188,7 +188,7 @@ define float @fmul_distribute4(float %f1) {
%t2 = fsub float 2.0e+3, %t1
%t3 = fmul fast float %t2, 5.0e+3
ret float %t3
-; CHECK: @fmul_distribute4
+; CHECK-LABEL: @fmul_distribute4(
; CHECK: %1 = fmul fast float %f1, 3.000000e+07
; CHECK: %t3 = fsub fast float 1.000000e+07, %1
}
@@ -198,16 +198,28 @@ define float @fmul2(float %f1) {
%t1 = fdiv float 2.0e+3, %f1
%t3 = fmul fast float %t1, 6.0e+3
ret float %t3
-; CHECK: @fmul2
+; CHECK-LABEL: @fmul2(
; CHECK: fdiv fast float 1.200000e+07, %f1
}
+; X/C1 * C2 => X * (C2/C1) is disabled if X/C1 has multiple uses
+@fmul2_external = external global float
+define float @fmul2_disable(float %f1) {
+ %div = fdiv fast float 1.000000e+00, %f1
+ store float %div, float* @fmul2_external
+ %mul = fmul fast float %div, 2.000000e+00
+ ret float %mul
+; CHECK-LABEL: @fmul2_disable
+; CHECK: store
+; CHECK: fmul fast
+}
+
; X/C1 * C2 => X * (C2/C1) (if C2/C1 is normal Fp)
define float @fmul3(float %f1, float %f2) {
%t1 = fdiv float %f1, 2.0e+3
%t3 = fmul fast float %t1, 6.0e+3
ret float %t3
-; CHECK: @fmul3
+; CHECK-LABEL: @fmul3(
; CHECK: fmul fast float %f1, 3.000000e+00
}
@@ -218,7 +230,7 @@ define float @fmul4(float %f1, float %f2) {
%t1 = fdiv float %f1, 2.0e+3
%t3 = fmul fast float %t1, 0x3810000000000000
ret float %t3
-; CHECK: @fmul4
+; CHECK-LABEL: @fmul4(
; CHECK: fmul fast float %t1, 0x3810000000000000
}
@@ -229,7 +241,7 @@ define float @fmul5(float %f1, float %f2) {
%t1 = fdiv float %f1, 3.0e+0
%t3 = fmul fast float %t1, 0x3810000000000000
ret float %t3
-; CHECK: @fmul5
+; CHECK-LABEL: @fmul5(
; CHECK: fdiv fast float %f1, 0x47E8000000000000
}
@@ -238,7 +250,7 @@ define float @fmul6(float %f1, float %f2) {
%mul = fmul float %f1, %f2
%mul1 = fmul fast float %mul, %f1
ret float %mul1
-; CHECK: @fmul6
+; CHECK-LABEL: @fmul6(
; CHECK: fmul fast float %f1, %f1
}
@@ -248,7 +260,7 @@ define float @fmul7(float %f1, float %f2) {
%mul1 = fmul fast float %mul, %f1
%add = fadd float %mul1, %mul
ret float %add
-; CHECK: @fmul7
+; CHECK-LABEL: @fmul7(
; CHECK: fmul fast float %mul, %f1
}
@@ -262,7 +274,7 @@ define float @fneg1(float %f1, float %f2) {
%sub1 = fsub nsz float 0.000000e+00, %f2
%mul = fmul float %sub, %sub1
ret float %mul
-; CHECK: @fneg1
+; CHECK-LABEL: @fneg1(
; CHECK: fmul float %f1, %f2
}
@@ -280,7 +292,7 @@ define float @fdiv1(float %x) {
; 0x3FF3333340000000 = 1.2f
; 0x4002666660000000 = 2.3f
; 0x3FD7303B60000000 = 0.36231884057971014492
-; CHECK: @fdiv1
+; CHECK-LABEL: @fdiv1(
; CHECK: fmul fast float %x, 0x3FD7303B60000000
}
@@ -293,7 +305,7 @@ define float @fdiv2(float %x) {
; 0x3FF3333340000000 = 1.2f
; 0x4002666660000000 = 2.3f
; 0x3FE0B21660000000 = 0.52173918485641479492
-; CHECK: @fdiv2
+; CHECK-LABEL: @fdiv2(
; CHECK: fmul fast float %x, 0x3FE0B21660000000
}
@@ -303,7 +315,7 @@ define float @fdiv3(float %x) {
%div = fdiv float %x, 0x47EFFFFFE0000000
%div1 = fdiv fast float %div, 0x4002666660000000
ret float %div1
-; CHECK: @fdiv3
+; CHECK-LABEL: @fdiv3(
; CHECK: fdiv float %x, 0x47EFFFFFE0000000
}
@@ -312,7 +324,7 @@ define float @fdiv4(float %x) {
%mul = fmul float %x, 0x47EFFFFFE0000000
%div = fdiv float %mul, 0x3FC99999A0000000
ret float %div
-; CHECK: @fdiv4
+; CHECK-LABEL: @fdiv4(
; CHECK: fmul float %x, 0x47EFFFFFE0000000
}
@@ -321,7 +333,7 @@ define float @fdiv5(float %f1, float %f2, float %f3) {
%t1 = fdiv float %f1, %f2
%t2 = fdiv fast float %t1, %f3
ret float %t2
-; CHECK: @fdiv5
+; CHECK-LABEL: @fdiv5(
; CHECK: fmul float %f2, %f3
}
@@ -330,7 +342,7 @@ define float @fdiv6(float %f1, float %f2, float %f3) {
%t1 = fdiv float %f1, %f2
%t2 = fdiv fast float %f3, %t1
ret float %t2
-; CHECK: @fdiv6
+; CHECK-LABEL: @fdiv6(
; CHECK: fmul float %f3, %f2
}
@@ -339,7 +351,7 @@ define float @fdiv7(float %x) {
%t1 = fmul float %x, 3.0e0
%t2 = fdiv fast float 15.0e0, %t1
ret float %t2
-; CHECK: @fdiv7
+; CHECK-LABEL: @fdiv7(
; CHECK: fdiv fast float 5.000000e+00, %x
}
@@ -348,7 +360,7 @@ define float @fdiv8(float %x) {
%t1 = fdiv float %x, 3.0e0
%t2 = fdiv fast float 15.0e0, %t1
ret float %t2
-; CHECK: @fdiv8
+; CHECK-LABEL: @fdiv8(
; CHECK: fdiv fast float 4.500000e+01, %x
}
@@ -357,7 +369,7 @@ define float @fdiv9(float %x) {
%t1 = fdiv float 3.0e0, %x
%t2 = fdiv fast float 15.0e0, %t1
ret float %t2
-; CHECK: @fdiv9
+; CHECK-LABEL: @fdiv9(
; CHECK: fmul fast float %x, 5.000000e+00
}
@@ -372,7 +384,7 @@ define float @fact_mul1(float %x, float %y, float %z) {
%t2 = fmul fast float %y, %z
%t3 = fadd fast float %t1, %t2
ret float %t3
-; CHECK: @fact_mul1
+; CHECK-LABEL: @fact_mul1(
; CHECK: fmul fast float %1, %z
}
@@ -382,7 +394,7 @@ define float @fact_mul2(float %x, float %y, float %z) {
%t2 = fmul fast float %y, %z
%t3 = fsub fast float %t1, %t2
ret float %t3
-; CHECK: @fact_mul2
+; CHECK-LABEL: @fact_mul2(
; CHECK: fmul fast float %1, %z
}
@@ -392,7 +404,7 @@ define float @fact_mul3(float %x, float %y, float %z) {
%t1 = fmul fast float %z, %x
%t3 = fsub fast float %t1, %t2
ret float %t3
-; CHECK: @fact_mul3
+; CHECK-LABEL: @fact_mul3(
; CHECK: fmul fast float %1, %z
}
@@ -402,7 +414,7 @@ define float @fact_mul4(float %x, float %y, float %z) {
%t2 = fmul fast float %z, %y
%t3 = fsub fast float %t1, %t2
ret float %t3
-; CHECK: @fact_mul4
+; CHECK-LABEL: @fact_mul4(
; CHECK: fmul fast float %1, %z
}
diff --git a/test/Transforms/InstCombine/fcmp.ll b/test/Transforms/InstCombine/fcmp.ll
index 376fa079d24c..afc6782a0122 100644
--- a/test/Transforms/InstCombine/fcmp.ll
+++ b/test/Transforms/InstCombine/fcmp.ll
@@ -5,7 +5,7 @@ define i1 @test1(float %x, float %y) nounwind {
%ext2 = fpext float %y to double
%cmp = fcmp ogt double %ext1, %ext2
ret i1 %cmp
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: fcmp ogt float %x, %y
}
@@ -13,7 +13,7 @@ define i1 @test2(float %a) nounwind {
%ext = fpext float %a to double
%cmp = fcmp ogt double %ext, 1.000000e+00
ret i1 %cmp
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: fcmp ogt float %a, 1.0
}
@@ -21,7 +21,7 @@ define i1 @test3(float %a) nounwind {
%ext = fpext float %a to double
%cmp = fcmp ogt double %ext, 0x3FF0000000000001 ; more precision than float.
ret i1 %cmp
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: fpext float %a to double
}
@@ -29,7 +29,7 @@ define i1 @test4(float %a) nounwind {
%ext = fpext float %a to double
%cmp = fcmp ogt double %ext, 0x36A0000000000000 ; denormal in float.
ret i1 %cmp
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NEXT: fpext float %a to double
}
@@ -37,7 +37,7 @@ define i1 @test5(float %a) nounwind {
%neg = fsub float -0.000000e+00, %a
%cmp = fcmp ogt float %neg, 1.000000e+00
ret i1 %cmp
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NEXT: fcmp olt float %a, -1.0
}
@@ -46,7 +46,7 @@ define i1 @test6(float %x, float %y) nounwind {
%neg2 = fsub float -0.000000e+00, %y
%cmp = fcmp olt float %neg1, %neg2
ret i1 %cmp
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NEXT: fcmp ogt float %x, %y
}
@@ -54,7 +54,7 @@ define i1 @test7(float %x) nounwind readnone ssp noredzone {
%ext = fpext float %x to ppc_fp128
%cmp = fcmp ogt ppc_fp128 %ext, 0xM00000000000000000000000000000000
ret i1 %cmp
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NEXT: fcmp ogt float %x, 0.000000e+00
}
@@ -65,7 +65,7 @@ define float @test8(float %x) nounwind readnone optsize ssp {
%conv2 = sitofp i32 %conv1 to float
ret float %conv2
; Float comparison to zero shouldn't cast to double.
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK-NEXT: fcmp olt float %x, 0.000000e+00
}
@@ -76,7 +76,7 @@ define i32 @test9(double %a) nounwind {
%cmp = fcmp olt double %call, 0.000000e+00
%conv = zext i1 %cmp to i32
ret i32 %conv
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK-NOT: fabs
; CHECK: ret i32 0
}
@@ -86,7 +86,7 @@ define i32 @test10(double %a) nounwind {
%cmp = fcmp ole double %call, 0.000000e+00
%conv = zext i1 %cmp to i32
ret i32 %conv
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK-NOT: fabs
; CHECK: fcmp oeq double %a, 0.000000e+00
}
@@ -96,7 +96,7 @@ define i32 @test11(double %a) nounwind {
%cmp = fcmp ogt double %call, 0.000000e+00
%conv = zext i1 %cmp to i32
ret i32 %conv
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK-NOT: fabs
; CHECK: fcmp one double %a, 0.000000e+00
}
@@ -106,7 +106,7 @@ define i32 @test12(double %a) nounwind {
%cmp = fcmp oge double %call, 0.000000e+00
%conv = zext i1 %cmp to i32
ret i32 %conv
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK-NOT: fabs
; CHECK: fcmp ord double %a, 0.000000e+00
}
@@ -116,7 +116,7 @@ define i32 @test13(double %a) nounwind {
%cmp = fcmp une double %call, 0.000000e+00
%conv = zext i1 %cmp to i32
ret i32 %conv
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; CHECK-NOT: fabs
; CHECK: fcmp une double %a, 0.000000e+00
}
@@ -126,7 +126,7 @@ define i32 @test14(double %a) nounwind {
%cmp = fcmp oeq double %call, 0.000000e+00
%conv = zext i1 %cmp to i32
ret i32 %conv
-; CHECK: @test14
+; CHECK-LABEL: @test14(
; CHECK-NOT: fabs
; CHECK: fcmp oeq double %a, 0.000000e+00
}
@@ -136,7 +136,7 @@ define i32 @test15(double %a) nounwind {
%cmp = fcmp one double %call, 0.000000e+00
%conv = zext i1 %cmp to i32
ret i32 %conv
-; CHECK: @test15
+; CHECK-LABEL: @test15(
; CHECK-NOT: fabs
; CHECK: fcmp one double %a, 0.000000e+00
}
@@ -146,7 +146,7 @@ define i32 @test16(double %a) nounwind {
%cmp = fcmp ueq double %call, 0.000000e+00
%conv = zext i1 %cmp to i32
ret i32 %conv
-; CHECK: @test16
+; CHECK-LABEL: @test16(
; CHECK-NOT: fabs
; CHECK: fcmp ueq double %a, 0.000000e+00
}
diff --git a/test/Transforms/InstCombine/fdiv.ll b/test/Transforms/InstCombine/fdiv.ll
index a2cce016e188..1edbc5ecd60b 100644
--- a/test/Transforms/InstCombine/fdiv.ll
+++ b/test/Transforms/InstCombine/fdiv.ll
@@ -4,7 +4,7 @@ define float @test1(float %x) nounwind readnone ssp {
%div = fdiv float %x, 0x3810000000000000
ret float %div
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: fmul float %x, 0x47D0000000000000
}
@@ -12,7 +12,7 @@ define float @test2(float %x) nounwind readnone ssp {
%div = fdiv float %x, 0x47E0000000000000
ret float %div
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: fdiv float %x, 0x47E0000000000000
}
@@ -20,6 +20,6 @@ define float @test3(float %x) nounwind readnone ssp {
%div = fdiv float %x, 0x36A0000000000000
ret float %div
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: fdiv float %x, 0x36A0000000000000
}
diff --git a/test/Transforms/InstCombine/ffs-1.ll b/test/Transforms/InstCombine/ffs-1.ll
index 0510df3d24b9..1dec11da0eb0 100644
--- a/test/Transforms/InstCombine/ffs-1.ll
+++ b/test/Transforms/InstCombine/ffs-1.ll
@@ -1,7 +1,7 @@
; Test that the ffs* library call simplifier works correctly.
;
; RUN: opt < %s -instcombine -S | FileCheck %s
-; RUN: opt < %s -mtriple i386-pc-linux -instcombine -S | FileCheck %s -check-prefix=LINUX
+; RUN: opt < %s -mtriple i386-pc-linux -instcombine -S | FileCheck %s -check-prefix=CHECK-LINUX
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"
@@ -12,21 +12,21 @@ declare i32 @ffsll(i64)
; Check ffs(0) -> 0.
define i32 @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%ret = call i32 @ffs(i32 0)
ret i32 %ret
; CHECK-NEXT: ret i32 0
}
define i32 @test_simplify2() {
-; CHECK-LINUX: @test_simplify2
+; CHECK-LINUX-LABEL: @test_simplify2(
%ret = call i32 @ffsl(i32 0)
ret i32 %ret
; CHECK-LINUX-NEXT: ret i32 0
}
define i32 @test_simplify3() {
-; CHECK-LINUX: @test_simplify3
+; CHECK-LINUX-LABEL: @test_simplify3(
%ret = call i32 @ffsll(i64 0)
ret i32 %ret
; CHECK-LINUX-NEXT: ret i32 0
@@ -35,63 +35,63 @@ define i32 @test_simplify3() {
; Check ffs(c) -> cttz(c) + 1, where 'c' is a constant.
define i32 @test_simplify4() {
-; CHECK: @test_simplify4
+; CHECK-LABEL: @test_simplify4(
%ret = call i32 @ffs(i32 1)
ret i32 %ret
; CHECK-NEXT: ret i32 1
}
define i32 @test_simplify5() {
-; CHECK: @test_simplify5
+; CHECK-LABEL: @test_simplify5(
%ret = call i32 @ffs(i32 2048)
ret i32 %ret
; CHECK-NEXT: ret i32 12
}
define i32 @test_simplify6() {
-; CHECK: @test_simplify6
+; CHECK-LABEL: @test_simplify6(
%ret = call i32 @ffs(i32 65536)
ret i32 %ret
; CHECK-NEXT: ret i32 17
}
define i32 @test_simplify7() {
-; CHECK-LINUX: @test_simplify7
+; CHECK-LINUX-LABEL: @test_simplify7(
%ret = call i32 @ffsl(i32 65536)
ret i32 %ret
; CHECK-LINUX-NEXT: ret i32 17
}
define i32 @test_simplify8() {
-; CHECK-LINUX: @test_simplify8
+; CHECK-LINUX-LABEL: @test_simplify8(
%ret = call i32 @ffsll(i64 1024)
ret i32 %ret
; CHECK-LINUX-NEXT: ret i32 11
}
define i32 @test_simplify9() {
-; CHECK-LINUX: @test_simplify9
+; CHECK-LINUX-LABEL: @test_simplify9(
%ret = call i32 @ffsll(i64 65536)
ret i32 %ret
; CHECK-LINUX-NEXT: ret i32 17
}
define i32 @test_simplify10() {
-; CHECK-LINUX: @test_simplify10
+; CHECK-LINUX-LABEL: @test_simplify10(
%ret = call i32 @ffsll(i64 17179869184)
ret i32 %ret
; CHECK-LINUX-NEXT: ret i32 35
}
define i32 @test_simplify11() {
-; CHECK-LINUX: @test_simplify11
+; CHECK-LINUX-LABEL: @test_simplify11(
%ret = call i32 @ffsll(i64 281474976710656)
ret i32 %ret
; CHECK-LINUX-NEXT: ret i32 49
}
define i32 @test_simplify12() {
-; CHECK-LINUX: @test_simplify12
+; CHECK-LINUX-LABEL: @test_simplify12(
%ret = call i32 @ffsll(i64 1152921504606846976)
ret i32 %ret
; CHECK-LINUX-NEXT: ret i32 61
@@ -100,7 +100,7 @@ define i32 @test_simplify12() {
; Check ffs(x) -> x != 0 ? (i32)llvm.cttz(x) + 1 : 0.
define i32 @test_simplify13(i32 %x) {
-; CHECK: @test_simplify13
+; CHECK-LABEL: @test_simplify13(
%ret = call i32 @ffs(i32 %x)
; CHECK-NEXT: [[CTTZ:%[a-z0-9]+]] = call i32 @llvm.cttz.i32(i32 %x, i1 false)
; CHECK-NEXT: [[INC:%[a-z0-9]+]] = add i32 [[CTTZ]], 1
@@ -111,7 +111,7 @@ define i32 @test_simplify13(i32 %x) {
}
define i32 @test_simplify14(i32 %x) {
-; CHECK-LINUX: @test_simplify14
+; CHECK-LINUX-LABEL: @test_simplify14(
%ret = call i32 @ffsl(i32 %x)
; CHECK-LINUX-NEXT: [[CTTZ:%[a-z0-9]+]] = call i32 @llvm.cttz.i32(i32 %x, i1 false)
; CHECK-LINUX-NEXT: [[INC:%[a-z0-9]+]] = add i32 [[CTTZ]], 1
@@ -122,7 +122,7 @@ define i32 @test_simplify14(i32 %x) {
}
define i32 @test_simplify15(i64 %x) {
-; CHECK-LINUX: @test_simplify15
+; CHECK-LINUX-LABEL: @test_simplify15(
%ret = call i32 @ffsll(i64 %x)
; CHECK-LINUX-NEXT: [[CTTZ:%[a-z0-9]+]] = call i64 @llvm.cttz.i64(i64 %x, i1 false)
; CHECK-LINUX-NEXT: [[INC:%[a-z0-9]+]] = add i64 [[CTTZ]], 1
diff --git a/test/Transforms/SimplifyLibCalls/float-shrink-compare.ll b/test/Transforms/InstCombine/float-shrink-compare.ll
index ad54c3e38f13..26f77a7f702b 100644
--- a/test/Transforms/SimplifyLibCalls/float-shrink-compare.ll
+++ b/test/Transforms/InstCombine/float-shrink-compare.ll
@@ -1,4 +1,4 @@
-; RUN: opt -S -simplify-libcalls -instcombine < %s | FileCheck %s
+; RUN: opt -S -instcombine < %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-S128"
target triple = "x86_64-apple-macosx10.8.0"
@@ -9,7 +9,7 @@ define i32 @test1(float %x, float %y) nounwind uwtable {
%4 = fcmp oeq double %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: %ceilf = call float @ceilf(float %x)
; CHECK-NEXT: fcmp oeq float %ceilf, %y
}
@@ -21,7 +21,7 @@ define i32 @test2(float %x, float %y) nounwind uwtable {
%4 = fcmp oeq double %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: %fabsf = call float @fabsf(float %x)
; CHECK-NEXT: fcmp oeq float %fabsf, %y
}
@@ -33,7 +33,7 @@ define i32 @test3(float %x, float %y) nounwind uwtable {
%4 = fcmp oeq double %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: %floorf = call float @floorf(float %x)
; CHECK-NEXT: fcmp oeq float %floorf, %y
}
@@ -45,7 +45,7 @@ define i32 @test4(float %x, float %y) nounwind uwtable {
%4 = fcmp oeq double %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NEXT: %nearbyintf = call float @nearbyintf(float %x)
; CHECK-NEXT: fcmp oeq float %nearbyintf, %y
}
@@ -57,7 +57,7 @@ define i32 @test5(float %x, float %y) nounwind uwtable {
%4 = fcmp oeq double %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NEXT: %rintf = call float @rintf(float %x)
; CHECK-NEXT: fcmp oeq float %rintf, %y
}
@@ -69,7 +69,7 @@ define i32 @test6(float %x, float %y) nounwind uwtable {
%4 = fcmp oeq double %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NEXT: %roundf = call float @roundf(float %x)
; CHECK-NEXT: fcmp oeq float %roundf, %y
}
@@ -81,7 +81,7 @@ define i32 @test7(float %x, float %y) nounwind uwtable {
%4 = fcmp oeq double %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NEXT: %truncf = call float @truncf(float %x)
; CHECK-NEXT: fcmp oeq float %truncf, %y
}
@@ -93,7 +93,7 @@ define i32 @test8(float %x, float %y) nounwind uwtable {
%4 = fcmp oeq double %1, %3
%5 = zext i1 %4 to i32
ret i32 %5
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK-NEXT: %ceilf = call float @ceilf(float %x)
; CHECK-NEXT: fcmp oeq float %ceilf, %y
}
@@ -105,7 +105,7 @@ define i32 @test9(float %x, float %y) nounwind uwtable {
%4 = fcmp oeq double %1, %3
%5 = zext i1 %4 to i32
ret i32 %5
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK-NEXT: %fabsf = call float @fabsf(float %x)
; CHECK-NEXT: fcmp oeq float %fabsf, %y
}
@@ -117,7 +117,7 @@ define i32 @test10(float %x, float %y) nounwind uwtable {
%4 = fcmp oeq double %1, %3
%5 = zext i1 %4 to i32
ret i32 %5
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK-NEXT: %floorf = call float @floorf(float %x)
; CHECK-NEXT: fcmp oeq float %floorf, %y
}
@@ -129,7 +129,7 @@ define i32 @test11(float %x, float %y) nounwind uwtable {
%4 = fcmp oeq double %1, %3
%5 = zext i1 %4 to i32
ret i32 %5
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK-NEXT: %nearbyintf = call float @nearbyintf(float %x)
; CHECK-NEXT: fcmp oeq float %nearbyintf, %y
}
@@ -141,7 +141,7 @@ define i32 @test12(float %x, float %y) nounwind uwtable {
%4 = fcmp oeq double %1, %3
%5 = zext i1 %4 to i32
ret i32 %5
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK-NEXT: %rintf = call float @rintf(float %x)
; CHECK-NEXT: fcmp oeq float %rintf, %y
}
@@ -153,7 +153,7 @@ define i32 @test13(float %x, float %y) nounwind uwtable {
%4 = fcmp oeq double %1, %3
%5 = zext i1 %4 to i32
ret i32 %5
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; CHECK-NEXT: %roundf = call float @roundf(float %x)
; CHECK-NEXT: fcmp oeq float %roundf, %y
}
@@ -165,7 +165,7 @@ define i32 @test14(float %x, float %y) nounwind uwtable {
%4 = fcmp oeq double %1, %3
%5 = zext i1 %4 to i32
ret i32 %5
-; CHECK: @test14
+; CHECK-LABEL: @test14(
; CHECK-NEXT: %truncf = call float @truncf(float %x)
; CHECK-NEXT: fcmp oeq float %truncf, %y
}
diff --git a/test/Transforms/InstCombine/fmul.ll b/test/Transforms/InstCombine/fmul.ll
index 3671b4c6991c..402ee52e624a 100644
--- a/test/Transforms/InstCombine/fmul.ll
+++ b/test/Transforms/InstCombine/fmul.ll
@@ -6,7 +6,7 @@ define float @test1(float %x) {
%mul = fmul float %sub, 2.0e+1
ret float %mul
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: fmul float %x, -2.000000e+01
}
@@ -16,7 +16,7 @@ define float @test2(float %x) {
%mul = fmul float %sub, 2.0e+1
ret float %mul
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: fmul float %x, -2.000000e+01
}
@@ -26,7 +26,7 @@ define float @test3(float %x, float %y) {
%sub2 = fsub float -0.000000e+00, %y
%mul = fmul float %sub1, %sub2
ret float %mul
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: fmul float %x, %y
}
@@ -36,7 +36,7 @@ define float @test4(float %x, float %y) {
%sub2 = fsub nsz float 0.000000e+00, %y
%mul = fmul float %sub1, %sub2
ret float %mul
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: fmul float %x, %y
}
@@ -45,7 +45,7 @@ define float @test5(float %x, float %y) {
%sub1 = fsub float -0.000000e+00, %x
%mul = fmul float %sub1, %y
ret float %mul
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: %1 = fmul float %x, %y
; CHECK: %mul = fsub float -0.000000e+00, %1
}
@@ -55,7 +55,7 @@ define float @test6(float %x, float %y) {
%sub1 = fsub nsz float 0.000000e+00, %x
%mul = fmul float %sub1, %y
ret float %mul
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: %1 = fmul float %x, %y
; CHECK: %mul = fsub float -0.000000e+00, %1
}
@@ -67,6 +67,29 @@ define float @test7(float %x, float %y) {
%mul = fmul float %sub1, %y
%mul2 = fmul float %mul, %sub1
ret float %mul2
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: fsub float -0.000000e+00, %x
}
+
+; Don't crash when attempting to cast a constant FMul to an instruction.
+define void @test8(i32* %inout) {
+entry:
+ %0 = load i32* %inout, align 4
+ %conv = uitofp i32 %0 to float
+ %vecinit = insertelement <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float undef>, float %conv, i32 3
+ %sub = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %vecinit
+ %1 = shufflevector <4 x float> %sub, <4 x float> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
+ %mul = fmul <4 x float> zeroinitializer, %1
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %local_var_7.0 = phi <4 x float> [ %mul, %entry ], [ %2, %for.body ]
+ br i1 undef, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %2 = insertelement <4 x float> %local_var_7.0, float 0.000000e+00, i32 2
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
diff --git a/test/Transforms/InstCombine/fneg-ext.ll b/test/Transforms/InstCombine/fneg-ext.ll
new file mode 100644
index 000000000000..922d26a465b7
--- /dev/null
+++ b/test/Transforms/InstCombine/fneg-ext.ll
@@ -0,0 +1,23 @@
+; RUN: opt -instcombine -S < %s | FileCheck %s
+
+; CHECK: test1
+define double @test1(float %a, double %b) nounwind readnone ssp uwtable {
+; CHECK-NOT: fsub
+; CHECK: fpext
+; CHECK: fadd
+ %1 = fsub float -0.000000e+00, %a
+ %2 = fpext float %1 to double
+ %3 = fsub double %b, %2
+ ret double %3
+}
+
+; CHECK: test2
+define double @test2(float %a, double %b) nounwind readnone ssp uwtable {
+; CHECK-NOT: fsub
+; CHECK: fpext
+; CHECK: fadd fast
+ %1 = fsub float -0.000000e+00, %a
+ %2 = fpext float %1 to double
+ %3 = fsub fast double %b, %2
+ ret double %3
+}
diff --git a/test/Transforms/InstCombine/fold-bin-operand.ll b/test/Transforms/InstCombine/fold-bin-operand.ll
index a8bad0df5960..d3303262be3f 100644
--- a/test/Transforms/InstCombine/fold-bin-operand.ll
+++ b/test/Transforms/InstCombine/fold-bin-operand.ll
@@ -2,14 +2,14 @@
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 i1 @f(i1 %x) {
-; CHECK: @f
+; CHECK-LABEL: @f(
; CHECK: ret i1 false
%b = and i1 %x, icmp eq (i8* inttoptr (i32 1 to i8*), i8* inttoptr (i32 2 to i8*))
ret i1 %b
}
define i32 @g(i32 %x) {
-; CHECK: @g
+; CHECK-LABEL: @g(
; CHECK: ret i32 %x
%b = add i32 %x, zext (i1 icmp eq (i8* inttoptr (i32 1000000 to i8*), i8* inttoptr (i32 2000000 to i8*)) to i32)
ret i32 %b
diff --git a/test/Transforms/InstCombine/fold-calls.ll b/test/Transforms/InstCombine/fold-calls.ll
index 504f874beaeb..1a9a9fd2e9ee 100644
--- a/test/Transforms/InstCombine/fold-calls.ll
+++ b/test/Transforms/InstCombine/fold-calls.ll
@@ -1,7 +1,7 @@
; RUN: opt -instcombine -S < %s | FileCheck %s
; This shouldn't fold, because sin(inf) is invalid.
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK: %t = call double @sin(double 0x7FF0000000000000)
define double @foo() {
%t = call double @sin(double 0x7FF0000000000000)
@@ -9,7 +9,7 @@ define double @foo() {
}
; This should fold.
-; CHECK: @bar
+; CHECK-LABEL: @bar(
; CHECK: ret double 0.0
define double @bar() {
%t = call double @sin(double 0.0)
diff --git a/test/Transforms/InstCombine/fold-fops-into-selects.ll b/test/Transforms/InstCombine/fold-fops-into-selects.ll
new file mode 100644
index 000000000000..07aebb13eff3
--- /dev/null
+++ b/test/Transforms/InstCombine/fold-fops-into-selects.ll
@@ -0,0 +1,71 @@
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+define float @test1(i1 %A) {
+EntryBlock:
+ %cf = select i1 %A, float 1.000000e+00, float 0.000000e+00
+ %op = fsub float 1.000000e+00, %cf
+ ret float %op
+; CHECK-LABEL: @test1(
+; CHECK: select i1 %A, float 0.000000e+00, float 1.000000e+00
+}
+
+define float @test2(i1 %A, float %B) {
+EntryBlock:
+ %cf = select i1 %A, float 1.000000e+00, float %B
+ %op = fadd float 2.000000e+00, %cf
+ ret float %op
+; CHECK-LABEL: @test2(
+; CHECK: [[OP:%.*]] = fadd float %B, 2.000000e+00
+; CHECK: select i1 %A, float 3.000000e+00, float [[OP]]
+}
+
+define float @test3(i1 %A, float %B) {
+EntryBlock:
+ %cf = select i1 %A, float 1.000000e+00, float %B
+ %op = fsub float 2.000000e+00, %cf
+ ret float %op
+; CHECK-LABEL: @test3(
+; CHECK: [[OP:%.*]] = fsub float 2.000000e+00, %B
+; CHECK: select i1 %A, float 1.000000e+00, float [[OP]]
+}
+
+define float @test4(i1 %A, float %B) {
+EntryBlock:
+ %cf = select i1 %A, float 1.000000e+00, float %B
+ %op = fmul float 2.000000e+00, %cf
+ ret float %op
+; CHECK-LABEL: @test4(
+; CHECK: [[OP:%.*]] = fmul float %B, 2.000000e+00
+; CHECK: select i1 %A, float 2.000000e+00, float [[OP]]
+}
+
+define float @test5(i1 %A, float %B) {
+EntryBlock:
+ %cf = select i1 %A, float 1.000000e+00, float %B
+ %op = fdiv float 2.000000e+00, %cf
+ ret float %op
+; CHECK-LABEL: @test5(
+; CHECK: [[OP:%.*]] = fdiv float 2.000000e+00, %B
+; CHECK: select i1 %A, float 2.000000e+00, float [[OP]]
+}
+
+define float @test6(i1 %A, float %B) {
+EntryBlock:
+ %cf = select i1 %A, float 1.000000e+00, float %B
+ %op = fdiv float %cf, 2.000000e+00
+ ret float %op
+; CHECK-LABEL: @test6(
+; CHECK: [[OP:%.*]] = fmul float %B, 5.000000e-01
+; CHECK: select i1 %A, float 5.000000e-01, float [[OP]]
+}
+
+define float @test7(i1 %A, float %B) {
+EntryBlock:
+ %cf = select i1 %A, float 1.000000e+00, float %B
+ %op = fdiv float %cf, 3.000000e+00
+ ret float %op
+; CHECK-LABEL: @test7(
+; CHECK: [[OP:%.*]] = fdiv float %B, 3.000000e+00
+; CHECK: select i1 %A, float 0x3FD5555560000000, float [[OP]]
+}
+
diff --git a/test/Transforms/InstCombine/fold-vector-select.ll b/test/Transforms/InstCombine/fold-vector-select.ll
index 2cb970bf4177..b58d9dc90acc 100644
--- a/test/Transforms/InstCombine/fold-vector-select.ll
+++ b/test/Transforms/InstCombine/fold-vector-select.ll
@@ -1,4 +1,6 @@
-; RUN: opt < %s -instcombine -S | not grep select
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+; CHECK-NOT: select
define void @foo(<4 x i32> *%A, <4 x i32> *%B, <4 x i32> *%C, <4 x i32> *%D,
<4 x i32> *%E, <4 x i32> *%F, <4 x i32> *%G, <4 x i32> *%H,
diff --git a/test/Transforms/InstCombine/fpcast.ll b/test/Transforms/InstCombine/fpcast.ll
index 09f053289dc1..05d1b48d5996 100644
--- a/test/Transforms/InstCombine/fpcast.ll
+++ b/test/Transforms/InstCombine/fpcast.ll
@@ -31,4 +31,16 @@ define half @test4(float %a) {
ret half %c
}
+; CHECK: test5
+define half @test5(float %a, float %b, float %c) {
+; CHECK: fcmp ogt
+; CHECK: fptrunc
+; CHECK: select
+; CHECK: half 0xH3C00
+ %d = fcmp ogt float %a, %b
+ %e = select i1 %d, float %c, float 1.0
+ %f = fptrunc float %e to half
+ ret half %f
+}
+
declare float @llvm.fabs.f32(float) nounwind readonly
diff --git a/test/Transforms/InstCombine/fprintf-1.ll b/test/Transforms/InstCombine/fprintf-1.ll
index e1dc191bd700..3f6a314e3472 100644
--- a/test/Transforms/InstCombine/fprintf-1.ll
+++ b/test/Transforms/InstCombine/fprintf-1.ll
@@ -1,7 +1,7 @@
; Test that the fprintf library call simplifier works correctly.
;
; RUN: opt < %s -instcombine -S | FileCheck %s
-; RUN: opt < %s -mtriple xcore-xmos-elf -instcombine -S | FileCheck %s -check-prefix=IPRINTF
+; RUN: opt < %s -mtriple xcore-xmos-elf -instcombine -S | FileCheck %s -check-prefix=CHECK-IPRINTF
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"
@@ -18,7 +18,7 @@ declare i32 @fprintf(%FILE*, i8*, ...)
; Check fprintf(fp, "foo") -> fwrite("foo", 3, 1, fp).
define void @test_simplify1(%FILE* %fp) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%fmt = getelementptr [13 x i8]* @hello_world, i32 0, i32 0
call i32 (%FILE*, i8*, ...)* @fprintf(%FILE* %fp, i8* %fmt)
; CHECK-NEXT: call i32 @fwrite(i8* getelementptr inbounds ([13 x i8]* @hello_world, i32 0, i32 0), i32 12, i32 1, %FILE* %fp)
@@ -29,7 +29,7 @@ define void @test_simplify1(%FILE* %fp) {
; Check fprintf(fp, "%c", chr) -> fputc(chr, fp).
define void @test_simplify2(%FILE* %fp) {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%fmt = getelementptr [3 x i8]* @percent_c, i32 0, i32 0
call i32 (%FILE*, i8*, ...)* @fprintf(%FILE* %fp, i8* %fmt, i8 104)
; CHECK-NEXT: call i32 @fputc(i32 104, %FILE* %fp)
@@ -41,7 +41,7 @@ define void @test_simplify2(%FILE* %fp) {
; NOTE: The fputs simplifier simplifies this further to fwrite.
define void @test_simplify3(%FILE* %fp) {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%fmt = getelementptr [3 x i8]* @percent_s, i32 0, i32 0
%str = getelementptr [13 x i8]* @hello_world, i32 0, i32 0
call i32 (%FILE*, i8*, ...)* @fprintf(%FILE* %fp, i8* %fmt, i8* %str)
@@ -53,7 +53,7 @@ define void @test_simplify3(%FILE* %fp) {
; Check fprintf(fp, fmt, ...) -> fiprintf(fp, fmt, ...) if no floating point.
define void @test_simplify4(%FILE* %fp) {
-; CHECK-IPRINTF: @test_simplify4
+; CHECK-IPRINTF-LABEL: @test_simplify4(
%fmt = getelementptr [3 x i8]* @percent_d, i32 0, i32 0
call i32 (%FILE*, i8*, ...)* @fprintf(%FILE* %fp, i8* %fmt, i32 187)
; CHECK-NEXT-IPRINTF: call i32 (%FILE*, i8*, ...)* @fiprintf(%FILE* %fp, i8* getelementptr inbounds ([3 x i8]* @percent_d, i32 0, i32 0), i32 187)
@@ -62,7 +62,7 @@ define void @test_simplify4(%FILE* %fp) {
}
define void @test_no_simplify1(%FILE* %fp) {
-; CHECK-IPRINTF: @test_no_simplify1
+; CHECK-IPRINTF-LABEL: @test_no_simplify1(
%fmt = getelementptr [3 x i8]* @percent_f, i32 0, i32 0
call i32 (%FILE*, i8*, ...)* @fprintf(%FILE* %fp, i8* %fmt, double 1.87)
; CHECK-NEXT-IPRINTF: call i32 (%FILE*, i8*, ...)* @fprintf(%FILE* %fp, i8* getelementptr inbounds ([3 x i8]* @percent_f, i32 0, i32 0), double 1.870000e+00)
@@ -71,7 +71,7 @@ define void @test_no_simplify1(%FILE* %fp) {
}
define void @test_no_simplify2(%FILE* %fp, double %d) {
-; CHECK: @test_no_simplify2
+; CHECK-LABEL: @test_no_simplify2(
%fmt = getelementptr [3 x i8]* @percent_f, i32 0, i32 0
call i32 (%FILE*, i8*, ...)* @fprintf(%FILE* %fp, i8* %fmt, double %d)
; CHECK-NEXT: call i32 (%FILE*, i8*, ...)* @fprintf(%FILE* %fp, i8* getelementptr inbounds ([3 x i8]* @percent_f, i32 0, i32 0), double %d)
@@ -80,7 +80,7 @@ define void @test_no_simplify2(%FILE* %fp, double %d) {
}
define i32 @test_no_simplify3(%FILE* %fp) {
-; CHECK: @test_no_simplify3
+; CHECK-LABEL: @test_no_simplify3(
%fmt = getelementptr [13 x i8]* @hello_world, i32 0, i32 0
%1 = call i32 (%FILE*, i8*, ...)* @fprintf(%FILE* %fp, i8* %fmt)
; CHECK-NEXT: call i32 (%FILE*, i8*, ...)* @fprintf(%FILE* %fp, i8* getelementptr inbounds ([13 x i8]* @hello_world, i32 0, i32 0))
diff --git a/test/Transforms/InstCombine/fputs-1.ll b/test/Transforms/InstCombine/fputs-1.ll
index c7c5becfd038..473610e6120a 100644
--- a/test/Transforms/InstCombine/fputs-1.ll
+++ b/test/Transforms/InstCombine/fputs-1.ll
@@ -15,7 +15,7 @@ declare i32 @fputs(i8*, %FILE*)
; Check fputs(str, fp) --> fwrite(str, 1, strlen(s), fp).
define void @test_simplify1(%FILE* %fp) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%str = getelementptr [1 x i8]* @empty, i32 0, i32 0
call i32 @fputs(i8* %str, %FILE* %fp)
ret void
@@ -25,7 +25,7 @@ define void @test_simplify1(%FILE* %fp) {
; NOTE: The fwrite simplifier simplifies this further to fputc.
define void @test_simplify2(%FILE* %fp) {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%str = getelementptr [2 x i8]* @A, i32 0, i32 0
call i32 @fputs(i8* %str, %FILE* %fp)
; CHECK-NEXT: call i32 @fputc(i32 65, %FILE* %fp)
@@ -34,7 +34,7 @@ define void @test_simplify2(%FILE* %fp) {
}
define void @test_simplify3(%FILE* %fp) {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%str = getelementptr [7 x i8]* @hello, i32 0, i32 0
call i32 @fputs(i8* %str, %FILE* %fp)
; CHECK-NEXT: call i32 @fwrite(i8* getelementptr inbounds ([7 x i8]* @hello, i32 0, i32 0), i32 6, i32 1, %FILE* %fp)
diff --git a/test/Transforms/InstCombine/fwrite-1.ll b/test/Transforms/InstCombine/fwrite-1.ll
index 528cdec217f7..6f9a8e463a8c 100644
--- a/test/Transforms/InstCombine/fwrite-1.ll
+++ b/test/Transforms/InstCombine/fwrite-1.ll
@@ -14,7 +14,7 @@ declare i64 @fwrite(i8*, i64, i64, %FILE *)
; Check fwrite(S, 1, 1, fp) -> fputc(S[0], fp).
define void @test_simplify1(%FILE* %fp) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%str = getelementptr inbounds [1 x i8]* @str, i64 0, i64 0
call i64 @fwrite(i8* %str, i64 1, i64 1, %FILE* %fp)
; CHECK-NEXT: call i32 @fputc(i32 0, %FILE* %fp)
@@ -23,7 +23,7 @@ define void @test_simplify1(%FILE* %fp) {
}
define void @test_simplify2(%FILE* %fp) {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%str = getelementptr inbounds [0 x i8]* @empty, i64 0, i64 0
call i64 @fwrite(i8* %str, i64 1, i64 0, %FILE* %fp)
ret void
@@ -31,7 +31,7 @@ define void @test_simplify2(%FILE* %fp) {
}
define void @test_simplify3(%FILE* %fp) {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%str = getelementptr inbounds [0 x i8]* @empty, i64 0, i64 0
call i64 @fwrite(i8* %str, i64 0, i64 1, %FILE* %fp)
ret void
@@ -39,7 +39,7 @@ define void @test_simplify3(%FILE* %fp) {
}
define i64 @test_no_simplify1(%FILE* %fp) {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%str = getelementptr inbounds [1 x i8]* @str, i64 0, i64 0
%ret = call i64 @fwrite(i8* %str, i64 1, i64 1, %FILE* %fp)
; CHECK-NEXT: call i64 @fwrite
@@ -48,7 +48,7 @@ define i64 @test_no_simplify1(%FILE* %fp) {
}
define void @test_no_simplify2(%FILE* %fp, i64 %size) {
-; CHECK: @test_no_simplify2
+; CHECK-LABEL: @test_no_simplify2(
%str = getelementptr inbounds [1 x i8]* @str, i64 0, i64 0
call i64 @fwrite(i8* %str, i64 %size, i64 1, %FILE* %fp)
; CHECK-NEXT: call i64 @fwrite
diff --git a/test/Transforms/InstCombine/gep-addrspace.ll b/test/Transforms/InstCombine/gep-addrspace.ll
index dfe12dbfaf7f..24c355d817e5 100644
--- a/test/Transforms/InstCombine/gep-addrspace.ll
+++ b/test/Transforms/InstCombine/gep-addrspace.ll
@@ -9,7 +9,7 @@ target triple = "x86_64-pc-win32"
define void @func(%myStruct addrspace(1)* nocapture %p) nounwind {
ST:
%A = getelementptr inbounds %myStruct addrspace(1)* %p, i64 0
- %B = bitcast %myStruct addrspace(1)* %A to %myStruct*
+ %B = addrspacecast %myStruct addrspace(1)* %A to %myStruct*
%C = getelementptr inbounds %myStruct* %B, i32 0, i32 1
%D = getelementptr inbounds [3 x float]* %C, i32 0, i32 2
%E = load float* %D, align 4
diff --git a/test/Transforms/InstCombine/getelementptr.ll b/test/Transforms/InstCombine/getelementptr.ll
index bb07736ef803..c29a7dccb8ee 100644
--- a/test/Transforms/InstCombine/getelementptr.ll
+++ b/test/Transforms/InstCombine/getelementptr.ll
@@ -1,6 +1,7 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
-target datalayout = "e-p:64:64"
+target datalayout = "e-p:64:64-p1:16:16-p2:32:32:32"
+
%intstruct = type { i32 }
%pair = type { i32, i32 }
%struct.B = type { double }
@@ -8,20 +9,28 @@ target datalayout = "e-p:64:64"
@Global = constant [10 x i8] c"helloworld"
+@Global_as1 = addrspace(1) constant [10 x i8] c"helloworld"
; Test noop elimination
define i32* @test1(i32* %I) {
- %A = getelementptr i32* %I, i64 0
+ %A = getelementptr i32* %I, i64 0
ret i32* %A
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret i32* %I
}
+define i32 addrspace(1)* @test1_as1(i32 addrspace(1)* %I) {
+ %A = getelementptr i32 addrspace(1)* %I, i64 0
+ ret i32 addrspace(1)* %A
+; CHECK-LABEL: @test1_as1(
+; CHECK: ret i32 addrspace(1)* %I
+}
+
; Test noop elimination
define i32* @test2(i32* %I) {
%A = getelementptr i32* %I
ret i32* %A
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: ret i32* %I
}
@@ -30,52 +39,88 @@ define i32* @test3(i32* %I) {
%A = getelementptr i32* %I, i64 17
%B = getelementptr i32* %A, i64 4
ret i32* %B
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: getelementptr i32* %I, i64 21
}
; Test that two getelementptr insts fold
define i32* @test4({ i32 }* %I) {
- %A = getelementptr { i32 }* %I, i64 1
+ %A = getelementptr { i32 }* %I, i64 1
%B = getelementptr { i32 }* %A, i64 0, i32 0
ret i32* %B
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: getelementptr { i32 }* %I, i64 1, i32 0
}
define void @test5(i8 %B) {
; This should be turned into a constexpr instead of being an instruction
- %A = getelementptr [10 x i8]* @Global, i64 0, i64 4
+ %A = getelementptr [10 x i8]* @Global, i64 0, i64 4
store i8 %B, i8* %A
ret void
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: store i8 %B, i8* getelementptr inbounds ([10 x i8]* @Global, i64 0, i64 4)
}
+define void @test5_as1(i8 %B) {
+ ; This should be turned into a constexpr instead of being an instruction
+ %A = getelementptr [10 x i8] addrspace(1)* @Global_as1, i16 0, i16 4
+ store i8 %B, i8 addrspace(1)* %A
+ ret void
+; CHECK-LABEL: @test5_as1(
+; CHECK: store i8 %B, i8 addrspace(1)* getelementptr inbounds ([10 x i8] addrspace(1)* @Global_as1, i16 0, i16 4)
+}
+
+%as1_ptr_struct = type { i32 addrspace(1)* }
+%as2_ptr_struct = type { i32 addrspace(2)* }
+
+@global_as2 = addrspace(2) global i32 zeroinitializer
+@global_as1_as2_ptr = addrspace(1) global %as2_ptr_struct { i32 addrspace(2)* @global_as2 }
+
+; This should be turned into a constexpr instead of being an instruction
+define void @test_evaluate_gep_nested_as_ptrs(i32 addrspace(2)* %B) {
+; CHECK-LABEL: @test_evaluate_gep_nested_as_ptrs(
+; CHECK-NEXT: store i32 addrspace(2)* %B, i32 addrspace(2)* addrspace(1)* getelementptr inbounds (%as2_ptr_struct addrspace(1)* @global_as1_as2_ptr, i16 0, i32 0), align 8
+; CHECK-NEXT: ret void
+ %A = getelementptr %as2_ptr_struct addrspace(1)* @global_as1_as2_ptr, i16 0, i32 0
+ store i32 addrspace(2)* %B, i32 addrspace(2)* addrspace(1)* %A
+ ret void
+}
+
+@arst = addrspace(1) global [4 x i8 addrspace(2)*] zeroinitializer
+
+define void @test_evaluate_gep_as_ptrs_array(i8 addrspace(2)* %B) {
+; CHECK-LABEL: @test_evaluate_gep_as_ptrs_array(
+; CHECK-NEXT: store i8 addrspace(2)* %B, i8 addrspace(2)* addrspace(1)* getelementptr inbounds ([4 x i8 addrspace(2)*] addrspace(1)* @arst, i16 0, i16 2), align 4
+
+; CHECK-NEXT: ret void
+ %A = getelementptr [4 x i8 addrspace(2)*] addrspace(1)* @arst, i16 0, i16 2
+ store i8 addrspace(2)* %B, i8 addrspace(2)* addrspace(1)* %A
+ ret void
+}
define i32* @test7(i32* %I, i64 %C, i64 %D) {
- %A = getelementptr i32* %I, i64 %C
- %B = getelementptr i32* %A, i64 %D
+ %A = getelementptr i32* %I, i64 %C
+ %B = getelementptr i32* %A, i64 %D
ret i32* %B
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: %A.sum = add i64 %C, %D
; CHECK: getelementptr i32* %I, i64 %A.sum
}
define i8* @test8([10 x i32]* %X) {
;; Fold into the cast.
- %A = getelementptr [10 x i32]* %X, i64 0, i64 0
- %B = bitcast i32* %A to i8*
+ %A = getelementptr [10 x i32]* %X, i64 0, i64 0
+ %B = bitcast i32* %A to i8*
ret i8* %B
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: bitcast [10 x i32]* %X to i8*
}
define i32 @test9() {
%A = getelementptr { i32, double }* null, i32 0, i32 1
- %B = ptrtoint double* %A to i32
+ %B = ptrtoint double* %A to i32
ret i32 %B
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK: ret i32 8
}
@@ -83,17 +128,17 @@ define i1 @test10({ i32, i32 }* %x, { i32, i32 }* %y) {
%tmp.1 = getelementptr { i32, i32 }* %x, i32 0, i32 1
%tmp.3 = getelementptr { i32, i32 }* %y, i32 0, i32 1
;; seteq x, y
- %tmp.4 = icmp eq i32* %tmp.1, %tmp.3
+ %tmp.4 = icmp eq i32* %tmp.1, %tmp.3
ret i1 %tmp.4
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK: icmp eq { i32, i32 }* %x, %y
}
define i1 @test11({ i32, i32 }* %X) {
- %P = getelementptr { i32, i32 }* %X, i32 0, i32 0
- %Q = icmp eq i32* %P, null
+ %P = getelementptr { i32, i32 }* %X, i32 0, i32 0
+ %Q = icmp eq i32* %P, null
ret i1 %Q
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK: icmp eq { i32, i32 }* %X, null
}
@@ -105,13 +150,13 @@ entry:
store i32 10, i32* %g3, align 4
%g4 = getelementptr %struct.A* %a, i32 0, i32 0
-
+
%new_a = bitcast %struct.B* %g4 to %struct.A*
- %g5 = getelementptr %struct.A* %new_a, i32 0, i32 1
- %a_a = load i32* %g5, align 4
+ %g5 = getelementptr %struct.A* %new_a, i32 0, i32 1
+ %a_a = load i32* %g5, align 4
ret i32 %a_a
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK: getelementptr %struct.A* %a, i64 0, i32 1
; CHECK-NEXT: store i32 10, i32* %g3
; CHECK-NEXT: ret i32 10
@@ -125,17 +170,77 @@ define i1 @test13(i64 %X, %S* %P) {
%B = getelementptr inbounds %S* %P, i32 0, i32 0
%C = icmp eq i32* %A, %B
ret i1 %C
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; CHECK: %C = icmp eq i64 %X, -1
}
-
-@G = external global [3 x i8]
+define <2 x i1> @test13_vector(<2 x i64> %X, <2 x %S*> %P) nounwind {
+; CHECK-LABEL: @test13_vector(
+; CHECK-NEXT: shl nuw <2 x i64> %X, <i64 2, i64 2>
+; CHECK-NEXT: add <2 x i64> %A.idx, <i64 4, i64 4>
+; CHECK-NEXT: icmp eq <2 x i64> %A.offs, zeroinitializer
+ %A = getelementptr inbounds <2 x %S*> %P, <2 x i64> zeroinitializer, <2 x i32> <i32 1, i32 1>, <2 x i64> %X
+ %B = getelementptr inbounds <2 x %S*> %P, <2 x i64> <i64 0, i64 0>, <2 x i32> <i32 0, i32 0>
+ %C = icmp eq <2 x i32*> %A, %B
+ ret <2 x i1> %C
+}
+
+define i1 @test13_as1(i16 %X, %S addrspace(1)* %P) {
+; CHECK-LABEL: @test13_as1(
+; CHECK-NEXT: %C = icmp eq i16 %X, -1
+; CHECK-NEXT: ret i1 %C
+ %A = getelementptr inbounds %S addrspace(1)* %P, i16 0, i32 1, i16 %X
+ %B = getelementptr inbounds %S addrspace(1)* %P, i16 0, i32 0
+ %C = icmp eq i32 addrspace(1)* %A, %B
+ ret i1 %C
+}
+
+define <2 x i1> @test13_vector_as1(<2 x i16> %X, <2 x %S addrspace(1)*> %P) {
+; CHECK-LABEL: @test13_vector_as1(
+; CHECK-NEXT: shl nuw <2 x i16> %X, <i16 2, i16 2>
+; CHECK-NEXT: add <2 x i16> %A.idx, <i16 4, i16 4>
+; CHECK-NEXT: icmp eq <2 x i16> %A.offs, zeroinitializer
+; CHECK-NEXT: ret <2 x i1>
+ %A = getelementptr inbounds <2 x %S addrspace(1)*> %P, <2 x i16> <i16 0, i16 0>, <2 x i32> <i32 1, i32 1>, <2 x i16> %X
+ %B = getelementptr inbounds <2 x %S addrspace(1)*> %P, <2 x i16> <i16 0, i16 0>, <2 x i32> <i32 0, i32 0>
+ %C = icmp eq <2 x i32 addrspace(1)*> %A, %B
+ ret <2 x i1> %C
+}
+
+define i1 @test13_i32(i32 %X, %S* %P) {
+; CHECK-LABEL: @test13_i32(
+; CHECK: %C = icmp eq i32 %X, -1
+ %A = getelementptr inbounds %S* %P, i32 0, i32 1, i32 %X
+ %B = getelementptr inbounds %S* %P, i32 0, i32 0
+ %C = icmp eq i32* %A, %B
+ ret i1 %C
+}
+
+define i1 @test13_i16(i16 %X, %S* %P) {
+; CHECK-LABEL: @test13_i16(
+; CHECK: %C = icmp eq i16 %X, -1
+ %A = getelementptr inbounds %S* %P, i16 0, i32 1, i16 %X
+ %B = getelementptr inbounds %S* %P, i16 0, i32 0
+ %C = icmp eq i32* %A, %B
+ ret i1 %C
+}
+
+define i1 @test13_i128(i128 %X, %S* %P) {
+; CHECK-LABEL: @test13_i128(
+; CHECK: %C = icmp eq i64 %1, -1
+ %A = getelementptr inbounds %S* %P, i128 0, i32 1, i128 %X
+ %B = getelementptr inbounds %S* %P, i128 0, i32 0
+ %C = icmp eq i32* %A, %B
+ ret i1 %C
+}
+
+
+@G = external global [3 x i8]
define i8* @test14(i32 %Idx) {
%idx = zext i32 %Idx to i64
%tmp = getelementptr i8* getelementptr ([3 x i8]* @G, i32 0, i32 0), i64 %idx
ret i8* %tmp
-; CHECK: @test14
+; CHECK-LABEL: @test14(
; CHECK: getelementptr [3 x i8]* @G, i64 0, i64 %idx
}
@@ -145,15 +250,15 @@ define i8* @test14(i32 %Idx) {
define i32 *@test15(i64 %X) {
%A = getelementptr i32* getelementptr ([40 x i32]* @Array, i64 0, i64 0), i64 %X
ret i32* %A
-; CHECK: @test15
+; CHECK-LABEL: @test15(
; CHECK: getelementptr [40 x i32]* @Array, i64 0, i64 %X
}
define i32* @test16(i32* %X, i32 %Idx) {
- %R = getelementptr i32* %X, i32 %Idx
+ %R = getelementptr i32* %X, i32 %Idx
ret i32* %R
-; CHECK: @test16
+; CHECK-LABEL: @test16(
; CHECK: sext i32 %Idx to i64
}
@@ -163,25 +268,74 @@ define i1 @test17(i16* %P, i32 %I, i32 %J) {
%Y = getelementptr inbounds i16* %P, i32 %J
%C = icmp ult i16* %X, %Y
ret i1 %C
-; CHECK: @test17
-; CHECK: %C = icmp slt i32 %I, %J
+; CHECK-LABEL: @test17(
+; CHECK: %C = icmp slt i32 %I, %J
}
define i1 @test18(i16* %P, i32 %I) {
%X = getelementptr inbounds i16* %P, i32 %I
%C = icmp ult i16* %X, %P
ret i1 %C
-; CHECK: @test18
+; CHECK-LABEL: @test18(
; CHECK: %C = icmp slt i32 %I, 0
}
+; Larger than the pointer size for a non-zero address space
+define i1 @test18_as1(i16 addrspace(1)* %P, i32 %I) {
+; CHECK-LABEL: @test18_as1(
+; CHECK-NEXT: %1 = trunc i32 %I to i16
+; CHECK-NEXT: %C = icmp slt i16 %1, 0
+; CHECK-NEXT: ret i1 %C
+ %X = getelementptr inbounds i16 addrspace(1)* %P, i32 %I
+ %C = icmp ult i16 addrspace(1)* %X, %P
+ ret i1 %C
+}
+
+; Smaller than the pointer size for a non-zero address space
+define i1 @test18_as1_i32(i16 addrspace(1)* %P, i32 %I) {
+; CHECK-LABEL: @test18_as1_i32(
+; CHECK-NEXT: %1 = trunc i32 %I to i16
+; CHECK-NEXT: %C = icmp slt i16 %1, 0
+; CHECK-NEXT: ret i1 %C
+ %X = getelementptr inbounds i16 addrspace(1)* %P, i32 %I
+ %C = icmp ult i16 addrspace(1)* %X, %P
+ ret i1 %C
+}
+
+; Smaller than pointer size
+define i1 @test18_i16(i16* %P, i16 %I) {
+; CHECK-LABEL: @test18_i16(
+; CHECK: %C = icmp slt i16 %I, 0
+ %X = getelementptr inbounds i16* %P, i16 %I
+ %C = icmp ult i16* %X, %P
+ ret i1 %C
+}
+
+; Same as pointer size
+define i1 @test18_i64(i16* %P, i64 %I) {
+; CHECK-LABEL: @test18_i64(
+; CHECK: %C = icmp slt i64 %I, 0
+ %X = getelementptr inbounds i16* %P, i64 %I
+ %C = icmp ult i16* %X, %P
+ ret i1 %C
+}
+
+; Larger than the pointer size
+define i1 @test18_i128(i16* %P, i128 %I) {
+; CHECK-LABEL: @test18_i128(
+; CHECK: %C = icmp slt i64 %1, 0
+ %X = getelementptr inbounds i16* %P, i128 %I
+ %C = icmp ult i16* %X, %P
+ ret i1 %C
+}
+
define i32 @test19(i32* %P, i32 %A, i32 %B) {
%tmp.4 = getelementptr inbounds i32* %P, i32 %A
%tmp.9 = getelementptr inbounds i32* %P, i32 %B
%tmp.10 = icmp eq i32* %tmp.4, %tmp.9
%tmp.11 = zext i1 %tmp.10 to i32
ret i32 %tmp.11
-; CHECK: @test19
+; CHECK-LABEL: @test19(
; CHECK: icmp eq i32 %A, %B
}
@@ -190,10 +344,19 @@ define i32 @test20(i32* %P, i32 %A, i32 %B) {
%tmp.6 = icmp eq i32* %tmp.4, %P
%tmp.7 = zext i1 %tmp.6 to i32
ret i32 %tmp.7
-; CHECK: @test20
+; CHECK-LABEL: @test20(
; CHECK: icmp eq i32 %A, 0
}
+define i32 @test20_as1(i32 addrspace(1)* %P, i32 %A, i32 %B) {
+ %tmp.4 = getelementptr inbounds i32 addrspace(1)* %P, i32 %A
+ %tmp.6 = icmp eq i32 addrspace(1)* %tmp.4, %P
+ %tmp.7 = zext i1 %tmp.6 to i32
+ ret i32 %tmp.7
+; CHECK-LABEL: @test20_as1(
+; CHECK: icmp eq i16 %1, 0
+}
+
define i32 @test21() {
%pbob1 = alloca %intstruct
@@ -201,7 +364,7 @@ define i32 @test21() {
%pbobel = getelementptr %intstruct* %pbob2, i64 0, i32 0
%rval = load i32* %pbobel
ret i32 %rval
-; CHECK: @test21
+; CHECK-LABEL: @test21(
; CHECK: getelementptr %intstruct* %pbob1, i64 0, i32 0
}
@@ -210,10 +373,10 @@ define i32 @test21() {
@B = global i32 2 ; <i32*> [#uses=1]
define i1 @test22() {
- %C = icmp ult i32* getelementptr (i32* @A, i64 1),
- getelementptr (i32* @B, i64 2)
+ %C = icmp ult i32* getelementptr (i32* @A, i64 1),
+ getelementptr (i32* @B, i64 2)
ret i1 %C
-; CHECK: @test22
+; CHECK-LABEL: @test22(
; CHECK: icmp ult (i32* getelementptr inbounds (i32* @A, i64 1), i32* getelementptr (i32* @B, i64 2))
}
@@ -224,7 +387,7 @@ define i1 @test23() {
%A = getelementptr %X* null, i64 0, i32 0, i64 0 ; <i32*> [#uses=1]
%B = icmp ne i32* %A, null ; <i1> [#uses=1]
ret i1 %B
-; CHECK: @test23
+; CHECK-LABEL: @test23(
; CHECK: ret i1 false
}
@@ -239,7 +402,7 @@ entry:
%tmp27.i = sext i32 %sext to i64 ; <i64> [#uses=1]
tail call void @foo25( i32 0, i64 %tmp27.i )
unreachable
-; CHECK: @test25
+; CHECK-LABEL: @test25(
}
declare void @foo25(i32, i64)
@@ -251,7 +414,7 @@ define i1 @test26(i8* %arr) {
%Y = getelementptr i8* %arr, i32 1
%test = icmp uge i8* %X, %Y
ret i1 %test
-; CHECK: @test26
+; CHECK-LABEL: @test26(
; CHECK: ret i1 true
}
@@ -262,48 +425,48 @@ define i1 @test26(i8* %arr) {
define i32 @test27(%struct.compat_siginfo* %to, %struct.siginfo_t* %from) {
entry:
- %from_addr = alloca %struct.siginfo_t*
- %tmp344 = load %struct.siginfo_t** %from_addr, align 8
+ %from_addr = alloca %struct.siginfo_t*
+ %tmp344 = load %struct.siginfo_t** %from_addr, align 8
%tmp345 = getelementptr %struct.siginfo_t* %tmp344, i32 0, i32 3
%tmp346 = getelementptr { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] }* %tmp345, i32 0, i32 0
- %tmp346347 = bitcast { i32, i32, [0 x i8], %struct.sigval_t, i32 }* %tmp346 to { i32, i32, %struct.sigval_t }*
+ %tmp346347 = bitcast { i32, i32, [0 x i8], %struct.sigval_t, i32 }* %tmp346 to { i32, i32, %struct.sigval_t }*
%tmp348 = getelementptr { i32, i32, %struct.sigval_t }* %tmp346347, i32 0, i32 2
%tmp349 = getelementptr %struct.sigval_t* %tmp348, i32 0, i32 0
%tmp349350 = bitcast i8** %tmp349 to i32*
- %tmp351 = load i32* %tmp349350, align 8
+ %tmp351 = load i32* %tmp349350, align 8
%tmp360 = call i32 asm sideeffect "...",
"=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"( i32 %tmp351,
%struct.__large_struct* null, i32 -14, i32 0 )
unreachable
-; CHECK: @test27
+; CHECK-LABEL: @test27(
}
; PR1978
%struct.x = type <{ i8 }>
-@.str = internal constant [6 x i8] c"Main!\00"
-@.str1 = internal constant [12 x i8] c"destroy %p\0A\00"
+@.str = internal constant [6 x i8] c"Main!\00"
+@.str1 = internal constant [12 x i8] c"destroy %p\0A\00"
define i32 @test28() nounwind {
entry:
%orientations = alloca [1 x [1 x %struct.x]]
- %tmp3 = call i32 @puts( i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0) ) nounwind
+ %tmp3 = call i32 @puts( i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0) ) nounwind
%tmp45 = getelementptr inbounds [1 x [1 x %struct.x]]* %orientations, i32 1, i32 0, i32 0
%orientations62 = getelementptr [1 x [1 x %struct.x]]* %orientations, i32 0, i32 0, i32 0
br label %bb10
bb10:
%indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb10 ]
- %tmp.0.reg2mem.0.rec = mul i32 %indvar, -1
- %tmp12.rec = add i32 %tmp.0.reg2mem.0.rec, -1
+ %tmp.0.reg2mem.0.rec = mul i32 %indvar, -1
+ %tmp12.rec = add i32 %tmp.0.reg2mem.0.rec, -1
%tmp12 = getelementptr inbounds %struct.x* %tmp45, i32 %tmp12.rec
%tmp16 = call i32 (i8*, ...)* @printf( i8* getelementptr ([12 x i8]* @.str1, i32 0, i32 0), %struct.x* %tmp12 ) nounwind
%tmp84 = icmp eq %struct.x* %tmp12, %orientations62
%indvar.next = add i32 %indvar, 1
br i1 %tmp84, label %bb17, label %bb10
-bb17:
+bb17:
ret i32 0
-; CHECK: @test28
+; CHECK-LABEL: @test28(
; CHECK: icmp eq i32 %indvar, 0
}
@@ -318,7 +481,7 @@ declare i32 @printf(i8*, ...)
%T = type <{ i64, i64, i64 }>
define i32 @test29(i8* %start, i32 %X) nounwind {
entry:
- %tmp3 = load i64* null
+ %tmp3 = load i64* null
%add.ptr = getelementptr i8* %start, i64 %tmp3
%tmp158 = load i32* null
%add.ptr159 = getelementptr %T* null, i32 %tmp158
@@ -332,7 +495,7 @@ if.then216:
if.end363:
ret i32 0
-; CHECK: @test29
+; CHECK-LABEL: @test29(
}
@@ -345,7 +508,7 @@ entry:
%2 = getelementptr [0 x i32]* %1, i32 0, i32 %m
%3 = load i32* %2, align 4
ret i32 %3
-; CHECK: @test30
+; CHECK-LABEL: @test30(
; CHECK: getelementptr i32
}
@@ -356,9 +519,9 @@ declare void @test30f(i32*)
define i1 @test31(i32* %A) {
%B = getelementptr i32* %A, i32 1
%C = getelementptr i32* %A, i64 1
- %V = icmp eq i32* %B, %C
+ %V = icmp eq i32* %B, %C
ret i1 %V
-; CHECK: @test31
+; CHECK-LABEL: @test31(
; CHECK: ret i1 true
}
@@ -372,10 +535,10 @@ define i8* @test32(i8* %v) {
%D = getelementptr { [16 x i8] }* %C, i32 0, i32 0, i32 8
%E = bitcast i8* %D to i8**
store i8* %v, i8** %E
- %F = getelementptr [4 x i8*]* %A, i32 0, i32 2
+ %F = getelementptr [4 x i8*]* %A, i32 0, i32 2
%G = load i8** %F
ret i8* %G
-; CHECK: @test32
+; CHECK-LABEL: @test32(
; CHECK: %D = getelementptr [4 x i8*]* %A, i64 0, i64 1
; CHECK: %F = getelementptr [4 x i8*]* %A, i64 0, i64 2
}
@@ -384,27 +547,50 @@ define i8* @test32(i8* %v) {
%struct.Key = type { { i32, i32 } }
%struct.anon = type <{ i8, [3 x i8], i32 }>
-define i32 *@test33(%struct.Key *%A) {
- %B = bitcast %struct.Key* %A to %struct.anon*
- %C = getelementptr %struct.anon* %B, i32 0, i32 2
- ret i32 *%C
-; CHECK: @test33
+define i32* @test33(%struct.Key* %A) {
+; CHECK-LABEL: @test33(
; CHECK: getelementptr %struct.Key* %A, i64 0, i32 0, i32 1
+ %B = bitcast %struct.Key* %A to %struct.anon*
+ %C = getelementptr %struct.anon* %B, i32 0, i32 2
+ ret i32* %C
}
+define i32 addrspace(1)* @test33_as1(%struct.Key addrspace(1)* %A) {
+; CHECK-LABEL: @test33_as1(
+; CHECK: getelementptr %struct.Key addrspace(1)* %A, i16 0, i32 0, i32 1
+ %B = bitcast %struct.Key addrspace(1)* %A to %struct.anon addrspace(1)*
+ %C = getelementptr %struct.anon addrspace(1)* %B, i32 0, i32 2
+ ret i32 addrspace(1)* %C
+}
+define i32 addrspace(1)* @test33_array_as1([10 x i32] addrspace(1)* %A) {
+; CHECK-LABEL: @test33_array_as1(
+; CHECK: getelementptr [10 x i32] addrspace(1)* %A, i16 0, i16 2
+ %B = bitcast [10 x i32] addrspace(1)* %A to [5 x i32] addrspace(1)*
+ %C = getelementptr [5 x i32] addrspace(1)* %B, i32 0, i32 2
+ ret i32 addrspace(1)* %C
+}
+
+; Make sure the GEP indices use the right pointer sized integer
+define i32 addrspace(1)* @test33_array_struct_as1([10 x %struct.Key] addrspace(1)* %A) {
+; CHECK-LABEL: @test33_array_struct_as1(
+; CHECK: getelementptr [10 x %struct.Key] addrspace(1)* %A, i16 0, i16 1, i32 0, i32 0
+ %B = bitcast [10 x %struct.Key] addrspace(1)* %A to [20 x i32] addrspace(1)*
+ %C = getelementptr [20 x i32] addrspace(1)* %B, i32 0, i32 2
+ ret i32 addrspace(1)* %C
+}
%T2 = type { i8*, i8 }
define i8* @test34(i8* %Val, i64 %V) nounwind {
entry:
- %A = alloca %T2, align 8
+ %A = alloca %T2, align 8
%mrv_gep = bitcast %T2* %A to i64*
%B = getelementptr %T2* %A, i64 0, i32 0
-
+
store i64 %V, i64* %mrv_gep
%C = load i8** %B, align 8
ret i8* %C
-; CHECK: @test34
+; CHECK-LABEL: @test34(
; CHECK: %V.c = inttoptr i64 %V to i8*
; CHECK: ret i8* %V.c
}
@@ -423,7 +609,7 @@ define i32 @test35() nounwind {
call i32 (i8*, ...)* @printf(i8* getelementptr ([17 x i8]* @"\01LC8", i32 0, i32 0),
i8* getelementptr (%t1* bitcast (%t0* @s to %t1*), i32 0, i32 1, i32 0)) nounwind
ret i32 0
-; CHECK: @test35
+; CHECK-LABEL: @test35(
; CHECK: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([17 x i8]* @"\01LC8", i64 0, i64 0), i8* getelementptr inbounds (%t0* @s, i64 0, i32 1, i64 0)) [[NUW:#[0-9]+]]
}
@@ -434,14 +620,14 @@ define i32 @test35() nounwind {
define i8* @test36() nounwind {
ret i8* getelementptr ([11 x i8]* @array, i32 0, i64 -1)
-; CHECK: @test36
+; CHECK-LABEL: @test36(
; CHECK: ret i8* getelementptr ([11 x i8]* @array, i64 1676976733973595601, i64 4)
}
; Instcombine shouldn't assume that gep(A,0,1) != gep(A,1,0).
@A37 = external constant [1 x i8]
define i1 @test37() nounwind {
-; CHECK: @test37
+; CHECK-LABEL: @test37(
; CHECK: ret i1 true
%t = icmp eq i8* getelementptr ([1 x i8]* @A37, i64 0, i64 1),
getelementptr ([1 x i8]* @A37, i64 1, i64 0)
@@ -452,7 +638,7 @@ define i1 @test37() nounwind {
define i32* @test38(i32* %I, i32 %n) {
%A = getelementptr i32* %I, i32 %n
ret i32* %A
-; CHECK: @test38
+; CHECK-LABEL: @test38(
; CHECK: = sext i32 %n to i64
; CHECK: %A = getelementptr i32* %I, i64 %
}
@@ -469,7 +655,7 @@ entry:
call void @pr10322_f3(i8** %tmp2) nounwind
ret void
-; CHECK: @pr10322_f1
+; CHECK-LABEL: @pr10322_f1(
; CHECK: %tmp2 = getelementptr inbounds %pr10322_t* %arrayidx8, i64 0, i32 0
}
@@ -485,7 +671,7 @@ define void @three_gep_f(%three_gep_t2* %x) {
%gep3 = getelementptr %three_gep_t* %gep2, i64 0, i32 0
call void @three_gep_g(i32* %gep3)
-; CHECK: @three_gep_f
+; CHECK-LABEL: @three_gep_f(
; CHECK: %gep3 = getelementptr %three_gep_t2* %gep1, i64 0, i32 0, i32 0
ret void
}
@@ -504,9 +690,103 @@ define void @test39(%struct.ham* %arg, i8 %arg1) nounwind {
store i8 %arg1, i8* %tmp4, align 8
ret void
-; CHECK: @test39
+; CHECK-LABEL: @test39(
; CHECK: getelementptr inbounds %struct.ham* %arg, i64 0, i32 2
; CHECK: getelementptr inbounds i8* %tmp3, i64 -8
}
+define i1 @pr16483([1 x i8]* %a, [1 x i8]* %b) {
+ %c = getelementptr [1 x i8]* %a, i32 0, i32 0
+ %d = getelementptr [1 x i8]* %b, i32 0, i32 0
+ %cmp = icmp ult i8* %c, %d
+ ret i1 %cmp
+
+; CHECK-LABEL: @pr16483(
+; CHECK-NEXT: icmp ult [1 x i8]* %a, %b
+}
+
+define i8 @test_gep_bitcast_as1(i32 addrspace(1)* %arr, i16 %N) {
+; CHECK-LABEL: @test_gep_bitcast_as1(
+; CHECK: getelementptr i32 addrspace(1)* %arr, i16 %N
+; CHECK: bitcast
+ %cast = bitcast i32 addrspace(1)* %arr to i8 addrspace(1)*
+ %V = mul i16 %N, 4
+ %t = getelementptr i8 addrspace(1)* %cast, i16 %V
+ %x = load i8 addrspace(1)* %t
+ ret i8 %x
+}
+
+; The element size of the array matches the element size of the pointer
+define i64 @test_gep_bitcast_array_same_size_element([100 x double]* %arr, i64 %N) {
+; CHECK-LABEL: @test_gep_bitcast_array_same_size_element(
+; CHECK: getelementptr [100 x double]* %arr, i64 0, i64 %V
+; CHECK: bitcast
+ %cast = bitcast [100 x double]* %arr to i64*
+ %V = mul i64 %N, 8
+ %t = getelementptr i64* %cast, i64 %V
+ %x = load i64* %t
+ ret i64 %x
+}
+
+; The element size of the array is different the element size of the pointer
+define i8 @test_gep_bitcast_array_different_size_element([100 x double]* %arr, i64 %N) {
+; CHECK-LABEL: @test_gep_bitcast_array_different_size_element(
+; CHECK: getelementptr [100 x double]* %arr, i64 0, i64 %N
+; CHECK: bitcast
+ %cast = bitcast [100 x double]* %arr to i8*
+ %V = mul i64 %N, 8
+ %t = getelementptr i8* %cast, i64 %V
+ %x = load i8* %t
+ ret i8 %x
+}
+
+define i64 @test_gep_bitcast_array_same_size_element_as1([100 x double] addrspace(1)* %arr, i16 %N) {
+; CHECK-LABEL: @test_gep_bitcast_array_same_size_element_as1(
+; CHECK: getelementptr [100 x double] addrspace(1)* %arr, i16 0, i16 %V
+; CHECK: bitcast
+ %cast = bitcast [100 x double] addrspace(1)* %arr to i64 addrspace(1)*
+ %V = mul i16 %N, 8
+ %t = getelementptr i64 addrspace(1)* %cast, i16 %V
+ %x = load i64 addrspace(1)* %t
+ ret i64 %x
+}
+
+define i8 @test_gep_bitcast_array_different_size_element_as1([100 x double] addrspace(1)* %arr, i16 %N) {
+; CHECK-LABEL: @test_gep_bitcast_array_different_size_element_as1(
+; CHECK: getelementptr [100 x double] addrspace(1)* %arr, i16 0, i16 %N
+; CHECK: bitcast
+ %cast = bitcast [100 x double] addrspace(1)* %arr to i8 addrspace(1)*
+ %V = mul i16 %N, 8
+ %t = getelementptr i8 addrspace(1)* %cast, i16 %V
+ %x = load i8 addrspace(1)* %t
+ ret i8 %x
+}
+
+define i64 @test40() {
+ %array = alloca [3 x i32], align 4
+ %gep = getelementptr inbounds [3 x i32]* %array, i64 0, i64 2
+ %gepi8 = bitcast i32* %gep to i8*
+ %p = ptrtoint [3 x i32]* %array to i64
+ %np = sub i64 0, %p
+ %gep2 = getelementptr i8* %gepi8, i64 %np
+ %ret = ptrtoint i8* %gep2 to i64
+ ret i64 %ret
+
+; CHECK-LABEL: @test40
+; CHECK-NEXT: ret i64 8
+}
+
+define i16 @test41([3 x i32] addrspace(1)* %array) {
+ %gep = getelementptr inbounds [3 x i32] addrspace(1)* %array, i16 0, i16 2
+ %gepi8 = bitcast i32 addrspace(1)* %gep to i8 addrspace(1)*
+ %p = ptrtoint [3 x i32] addrspace(1)* %array to i16
+ %np = sub i16 0, %p
+ %gep2 = getelementptr i8 addrspace(1)* %gepi8, i16 %np
+ %ret = ptrtoint i8 addrspace(1)* %gep2 to i16
+ ret i16 %ret
+
+; CHECK-LABEL: @test41(
+; CHECK-NEXT: ret i16 8
+}
+
; CHECK: attributes [[NUW]] = { nounwind }
diff --git a/test/Transforms/InstCombine/icmp-logical.ll b/test/Transforms/InstCombine/icmp-logical.ll
new file mode 100644
index 000000000000..d5d8cbc8c26e
--- /dev/null
+++ b/test/Transforms/InstCombine/icmp-logical.ll
@@ -0,0 +1,152 @@
+; RUN: opt -instcombine -S -o - %s | FileCheck %s
+
+define i1 @masked_and_notallzeroes(i32 %A) {
+; CHECK-LABEL: @masked_and_notallzeroes
+; CHECK: [[MASK:%.*]] = and i32 %A, 7
+; CHECK: icmp ne i32 [[MASK]], 0
+; CHECK-NOT: and i32 %A, 39
+; CHECK: ret i1
+
+ %mask1 = and i32 %A, 7
+ %tst1 = icmp ne i32 %mask1, 0
+
+ %mask2 = and i32 %A, 39
+ %tst2 = icmp ne i32 %mask2, 0
+
+ %res = and i1 %tst1, %tst2
+ ret i1 %res
+}
+
+define i1 @masked_or_allzeroes(i32 %A) {
+; CHECK-LABEL: @masked_or_allzeroes
+; CHECK: [[MASK:%.*]] = and i32 %A, 7
+; CHECK: icmp eq i32 [[MASK]], 0
+; CHECK-NOT: and i32 %A, 39
+; CHECK: ret i1
+
+ %mask1 = and i32 %A, 7
+ %tst1 = icmp eq i32 %mask1, 0
+
+ %mask2 = and i32 %A, 39
+ %tst2 = icmp eq i32 %mask2, 0
+
+ %res = or i1 %tst1, %tst2
+ ret i1 %res
+}
+
+define i1 @masked_and_notallones(i32 %A) {
+; CHECK-LABEL: @masked_and_notallones
+; CHECK: [[MASK:%.*]] = and i32 %A, 7
+; CHECK: icmp ne i32 [[MASK]], 7
+; CHECK-NOT: and i32 %A, 39
+; CHECK: ret i1
+
+ %mask1 = and i32 %A, 7
+ %tst1 = icmp ne i32 %mask1, 7
+
+ %mask2 = and i32 %A, 39
+ %tst2 = icmp ne i32 %mask2, 39
+
+ %res = and i1 %tst1, %tst2
+ ret i1 %res
+}
+
+define i1 @masked_or_allones(i32 %A) {
+; CHECK-LABEL: @masked_or_allones
+; CHECK: [[MASK:%.*]] = and i32 %A, 7
+; CHECK: icmp eq i32 [[MASK]], 7
+; CHECK-NOT: and i32 %A, 39
+; CHECK: ret i1
+
+ %mask1 = and i32 %A, 7
+ %tst1 = icmp eq i32 %mask1, 7
+
+ %mask2 = and i32 %A, 39
+ %tst2 = icmp eq i32 %mask2, 39
+
+ %res = or i1 %tst1, %tst2
+ ret i1 %res
+}
+
+define i1 @masked_and_notA(i32 %A) {
+; CHECK-LABEL: @masked_and_notA
+; CHECK: [[MASK:%.*]] = and i32 %A, 39
+; CHECK: icmp ne i32 [[MASK]], %A
+; CHECK-NOT: and i32 %A, 7
+; CHECK: ret i1
+
+ %mask1 = and i32 %A, 7
+ %tst1 = icmp ne i32 %mask1, %A
+
+ %mask2 = and i32 %A, 39
+ %tst2 = icmp ne i32 %mask2, %A
+
+ %res = and i1 %tst1, %tst2
+ ret i1 %res
+}
+
+define i1 @masked_or_A(i32 %A) {
+; CHECK-LABEL: @masked_or_A
+; CHECK: [[MASK:%.*]] = and i32 %A, 39
+; CHECK: icmp eq i32 [[MASK]], %A
+; CHECK-NOT: and i32 %A, 7
+; CHECK: ret i1
+
+ %mask1 = and i32 %A, 7
+ %tst1 = icmp eq i32 %mask1, %A
+
+ %mask2 = and i32 %A, 39
+ %tst2 = icmp eq i32 %mask2, %A
+
+ %res = or i1 %tst1, %tst2
+ ret i1 %res
+}
+
+define i1 @masked_or_allzeroes_notoptimised(i32 %A) {
+; CHECK-LABEL: @masked_or_allzeroes_notoptimised
+; CHECK: [[MASK:%.*]] = and i32 %A, 15
+; CHECK: icmp eq i32 [[MASK]], 0
+; CHECK: [[MASK:%.*]] = and i32 %A, 39
+; CHECK: icmp eq i32 [[MASK]], 0
+; CHECK: ret i1
+
+ %mask1 = and i32 %A, 15
+ %tst1 = icmp eq i32 %mask1, 0
+
+ %mask2 = and i32 %A, 39
+ %tst2 = icmp eq i32 %mask2, 0
+
+ %res = or i1 %tst1, %tst2
+ ret i1 %res
+}
+
+define i1 @nomask_lhs(i32 %in) {
+; CHECK-LABEL: @nomask_lhs
+; CHECK: [[MASK:%.*]] = and i32 %in, 1
+; CHECK: icmp eq i32 [[MASK]], 0
+; CHECK-NOT: icmp
+; CHECK: ret i1
+ %tst1 = icmp eq i32 %in, 0
+
+ %masked = and i32 %in, 1
+ %tst2 = icmp eq i32 %masked, 0
+
+ %val = or i1 %tst1, %tst2
+ ret i1 %val
+}
+
+
+define i1 @nomask_rhs(i32 %in) {
+; CHECK-LABEL: @nomask_rhs
+; CHECK: [[MASK:%.*]] = and i32 %in, 1
+; CHECK: icmp eq i32 [[MASK]], 0
+; CHECK-NOT: icmp
+; CHECK: ret i1
+ %masked = and i32 %in, 1
+ %tst1 = icmp eq i32 %masked, 0
+
+ %tst2 = icmp eq i32 %in, 0
+
+ %val = or i1 %tst1, %tst2
+ ret i1 %val
+}
diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll
index c912a576c3d2..12a4744cc0fe 100644
--- a/test/Transforms/InstCombine/icmp.ll
+++ b/test/Transforms/InstCombine/icmp.ll
@@ -1,14 +1,14 @@
; RUN: opt < %s -instcombine -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"
+"e-p:64:64:64-p1:16:16:16-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"
define i32 @test1(i32 %X) {
entry:
icmp slt i32 %X, 0 ; <i1>:0 [#uses=1]
zext i1 %0 to i32 ; <i32>:1 [#uses=1]
ret i32 %1
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: lshr i32 %X, 31
; CHECK-NEXT: ret i32
}
@@ -18,7 +18,7 @@ entry:
icmp ult i32 %X, -2147483648 ; <i1>:0 [#uses=1]
zext i1 %0 to i32 ; <i32>:1 [#uses=1]
ret i32 %1
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: lshr i32 %X, 31
; CHECK-NEXT: xor i32
; CHECK-NEXT: ret i32
@@ -29,7 +29,7 @@ entry:
icmp slt i32 %X, 0 ; <i1>:0 [#uses=1]
sext i1 %0 to i32 ; <i32>:1 [#uses=1]
ret i32 %1
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: ashr i32 %X, 31
; CHECK-NEXT: ret i32
}
@@ -39,7 +39,7 @@ entry:
icmp ult i32 %X, -2147483648 ; <i1>:0 [#uses=1]
sext i1 %0 to i32 ; <i32>:1 [#uses=1]
ret i32 %1
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: ashr i32 %X, 31
; CHECK-NEXT: xor i32
; CHECK-NEXT: ret i32
@@ -50,7 +50,7 @@ define <2 x i1> @test5(<2 x i64> %x) {
entry:
%V = icmp eq <2 x i64> %x, undef
ret <2 x i1> %V
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: ret <2 x i1> <i1 true, i1 true>
}
@@ -60,7 +60,7 @@ define i32 @test6(i32 %a, i32 %b) {
%e = sub i32 0, %d
%f = and i32 %e, %b
ret i32 %f
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NEXT: ashr i32 %a, 31
; CHECK-NEXT: %f = and i32 %e, %b
; CHECK-NEXT: ret i32 %f
@@ -72,37 +72,36 @@ entry:
%a = add i32 %x, -1
%b = icmp ult i32 %a, %x
ret i1 %b
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: %b = icmp ne i32 %x, 0
; CHECK: ret i1 %b
}
define i1 @test8(i32 %x){
entry:
- %a = add i32 %x, -1
+ %a = add i32 %x, -1
%b = icmp eq i32 %a, %x
ret i1 %b
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: ret i1 false
}
define i1 @test9(i32 %x) {
entry:
%a = add i32 %x, -2
- %b = icmp ugt i32 %x, %a
+ %b = icmp ugt i32 %x, %a
ret i1 %b
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK: icmp ugt i32 %x, 1
; CHECK: ret i1 %b
}
define i1 @test10(i32 %x){
entry:
- %a = add i32 %x, -1
- %b = icmp slt i32 %a, %x
+ %a = add i32 %x, -1
+ %b = icmp slt i32 %a, %x
ret i1 %b
-
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK: %b = icmp ne i32 %x, -2147483648
; CHECK: ret i1 %b
}
@@ -111,7 +110,7 @@ define i1 @test11(i32 %x) {
%a = add nsw i32 %x, 8
%b = icmp slt i32 %x, %a
ret i1 %b
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK: ret i1 true
}
@@ -120,7 +119,7 @@ define i1 @test12(i1 %A) {
%S = select i1 %A, i64 -4294967295, i64 8589934591
%B = icmp ne i64 bitcast (<2 x i32> <i32 1, i32 -1> to i64), %S
ret i1 %B
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK-NEXT: = xor i1 %A, true
; CHECK-NEXT: ret i1
}
@@ -130,7 +129,7 @@ define i1 @test13(i8 %X) nounwind readnone {
entry:
%cmp = icmp slt i8 undef, %X
ret i1 %cmp
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; CHECK: ret i1 false
}
@@ -138,7 +137,7 @@ define i1 @test14(i8 %X) nounwind readnone {
entry:
%cmp = icmp slt i8 undef, -128
ret i1 %cmp
-; CHECK: @test14
+; CHECK-LABEL: @test14(
; CHECK: ret i1 false
}
@@ -146,7 +145,7 @@ define i1 @test15() nounwind readnone {
entry:
%cmp = icmp eq i8 undef, -128
ret i1 %cmp
-; CHECK: @test15
+; CHECK-LABEL: @test15(
; CHECK: ret i1 undef
}
@@ -154,7 +153,7 @@ define i1 @test16() nounwind readnone {
entry:
%cmp = icmp ne i8 undef, -128
ret i1 %cmp
-; CHECK: @test16
+; CHECK-LABEL: @test16(
; CHECK: ret i1 undef
}
@@ -163,7 +162,7 @@ define i1 @test17(i32 %x) nounwind {
%and = and i32 %shl, 8
%cmp = icmp eq i32 %and, 0
ret i1 %cmp
-; CHECK: @test17
+; CHECK-LABEL: @test17(
; CHECK-NEXT: %cmp = icmp ne i32 %x, 3
}
@@ -173,7 +172,7 @@ define i1 @test18(i32 %x) nounwind {
%and = and i32 %sh, 1
%cmp = icmp eq i32 %and, 0
ret i1 %cmp
-; CHECK: @test18
+; CHECK-LABEL: @test18(
; CHECK-NEXT: %cmp = icmp ne i32 %x, 3
}
@@ -182,7 +181,7 @@ define i1 @test19(i32 %x) nounwind {
%and = and i32 %shl, 8
%cmp = icmp eq i32 %and, 8
ret i1 %cmp
-; CHECK: @test19
+; CHECK-LABEL: @test19(
; CHECK-NEXT: %cmp = icmp eq i32 %x, 3
}
@@ -191,12 +190,12 @@ define i1 @test20(i32 %x) nounwind {
%and = and i32 %shl, 8
%cmp = icmp ne i32 %and, 0
ret i1 %cmp
-; CHECK: @test20
+; CHECK-LABEL: @test20(
; CHECK-NEXT: %cmp = icmp eq i32 %x, 3
}
define i1 @test21(i8 %x, i8 %y) {
-; CHECK: @test21
+; CHECK-LABEL: @test21(
; CHECK-NOT: or i8
; CHECK: icmp ugt
%A = or i8 %x, 1
@@ -205,7 +204,7 @@ define i1 @test21(i8 %x, i8 %y) {
}
define i1 @test22(i8 %x, i8 %y) {
-; CHECK: @test22
+; CHECK-LABEL: @test22(
; CHECK-NOT: or i8
; CHECK: icmp ult
%A = or i8 %x, 1
@@ -214,7 +213,7 @@ define i1 @test22(i8 %x, i8 %y) {
}
; PR2740
-; CHECK: @test23
+; CHECK-LABEL: @test23(
; CHECK: icmp sgt i32 %x, 1328634634
define i1 @test23(i32 %x) nounwind {
%i3 = sdiv i32 %x, -1328634635
@@ -225,7 +224,7 @@ define i1 @test23(i32 %x) nounwind {
@X = global [1000 x i32] zeroinitializer
; PR8882
-; CHECK: @test24
+; CHECK-LABEL: @test24(
; CHECK: %cmp = icmp eq i64 %i, 1000
; CHECK: ret i1 %cmp
define i1 @test24(i64 %i) {
@@ -234,7 +233,19 @@ define i1 @test24(i64 %i) {
ret i1 %cmp
}
-; CHECK: @test25
+@X_as1 = addrspace(1) global [1000 x i32] zeroinitializer
+
+; CHECK: @test24_as1
+; CHECK: trunc i64 %i to i16
+; CHECK: %cmp = icmp eq i16 %1, 1000
+; CHECK: ret i1 %cmp
+define i1 @test24_as1(i64 %i) {
+ %p1 = getelementptr inbounds i32 addrspace(1)* getelementptr inbounds ([1000 x i32] addrspace(1)* @X_as1, i64 0, i64 0), i64 %i
+ %cmp = icmp eq i32 addrspace(1)* %p1, getelementptr inbounds ([1000 x i32] addrspace(1)* @X_as1, i64 1, i64 0)
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @test25(
; X + Z > Y + Z -> X > Y if there is no overflow.
; CHECK: %c = icmp sgt i32 %x, %y
; CHECK: ret i1 %c
@@ -245,7 +256,7 @@ define i1 @test25(i32 %x, i32 %y, i32 %z) {
ret i1 %c
}
-; CHECK: @test26
+; CHECK-LABEL: @test26(
; X + Z > Y + Z -> X > Y if there is no overflow.
; CHECK: %c = icmp ugt i32 %x, %y
; CHECK: ret i1 %c
@@ -256,7 +267,7 @@ define i1 @test26(i32 %x, i32 %y, i32 %z) {
ret i1 %c
}
-; CHECK: @test27
+; CHECK-LABEL: @test27(
; X - Z > Y - Z -> X > Y if there is no overflow.
; CHECK: %c = icmp sgt i32 %x, %y
; CHECK: ret i1 %c
@@ -267,7 +278,7 @@ define i1 @test27(i32 %x, i32 %y, i32 %z) {
ret i1 %c
}
-; CHECK: @test28
+; CHECK-LABEL: @test28(
; X - Z > Y - Z -> X > Y if there is no overflow.
; CHECK: %c = icmp ugt i32 %x, %y
; CHECK: ret i1 %c
@@ -278,7 +289,7 @@ define i1 @test28(i32 %x, i32 %y, i32 %z) {
ret i1 %c
}
-; CHECK: @test29
+; CHECK-LABEL: @test29(
; X + Y > X -> Y > 0 if there is no overflow.
; CHECK: %c = icmp sgt i32 %y, 0
; CHECK: ret i1 %c
@@ -288,7 +299,7 @@ define i1 @test29(i32 %x, i32 %y) {
ret i1 %c
}
-; CHECK: @test30
+; CHECK-LABEL: @test30(
; X + Y > X -> Y > 0 if there is no overflow.
; CHECK: %c = icmp ne i32 %y, 0
; CHECK: ret i1 %c
@@ -298,7 +309,7 @@ define i1 @test30(i32 %x, i32 %y) {
ret i1 %c
}
-; CHECK: @test31
+; CHECK-LABEL: @test31(
; X > X + Y -> 0 > Y if there is no overflow.
; CHECK: %c = icmp slt i32 %y, 0
; CHECK: ret i1 %c
@@ -308,7 +319,7 @@ define i1 @test31(i32 %x, i32 %y) {
ret i1 %c
}
-; CHECK: @test32
+; CHECK-LABEL: @test32(
; X > X + Y -> 0 > Y if there is no overflow.
; CHECK: ret i1 false
define i1 @test32(i32 %x, i32 %y) {
@@ -317,7 +328,7 @@ define i1 @test32(i32 %x, i32 %y) {
ret i1 %c
}
-; CHECK: @test33
+; CHECK-LABEL: @test33(
; X - Y > X -> 0 > Y if there is no overflow.
; CHECK: %c = icmp slt i32 %y, 0
; CHECK: ret i1 %c
@@ -327,7 +338,7 @@ define i1 @test33(i32 %x, i32 %y) {
ret i1 %c
}
-; CHECK: @test34
+; CHECK-LABEL: @test34(
; X - Y > X -> 0 > Y if there is no overflow.
; CHECK: ret i1 false
define i1 @test34(i32 %x, i32 %y) {
@@ -336,7 +347,7 @@ define i1 @test34(i32 %x, i32 %y) {
ret i1 %c
}
-; CHECK: @test35
+; CHECK-LABEL: @test35(
; X > X - Y -> Y > 0 if there is no overflow.
; CHECK: %c = icmp sgt i32 %y, 0
; CHECK: ret i1 %c
@@ -346,7 +357,7 @@ define i1 @test35(i32 %x, i32 %y) {
ret i1 %c
}
-; CHECK: @test36
+; CHECK-LABEL: @test36(
; X > X - Y -> Y > 0 if there is no overflow.
; CHECK: %c = icmp ne i32 %y, 0
; CHECK: ret i1 %c
@@ -356,7 +367,7 @@ define i1 @test36(i32 %x, i32 %y) {
ret i1 %c
}
-; CHECK: @test37
+; CHECK-LABEL: @test37(
; X - Y > X - Z -> Z > Y if there is no overflow.
; CHECK: %c = icmp sgt i32 %z, %y
; CHECK: ret i1 %c
@@ -367,7 +378,7 @@ define i1 @test37(i32 %x, i32 %y, i32 %z) {
ret i1 %c
}
-; CHECK: @test38
+; CHECK-LABEL: @test38(
; X - Y > X - Z -> Z > Y if there is no overflow.
; CHECK: %c = icmp ugt i32 %z, %y
; CHECK: ret i1 %c
@@ -379,7 +390,7 @@ define i1 @test38(i32 %x, i32 %y, i32 %z) {
}
; PR9343 #1
-; CHECK: @test39
+; CHECK-LABEL: @test39(
; CHECK: %B = icmp eq i32 %X, 0
define i1 @test39(i32 %X, i32 %Y) {
%A = ashr exact i32 %X, %Y
@@ -387,7 +398,7 @@ define i1 @test39(i32 %X, i32 %Y) {
ret i1 %B
}
-; CHECK: @test40
+; CHECK-LABEL: @test40(
; CHECK: %B = icmp ne i32 %X, 0
define i1 @test40(i32 %X, i32 %Y) {
%A = lshr exact i32 %X, %Y
@@ -396,7 +407,7 @@ define i1 @test40(i32 %X, i32 %Y) {
}
; PR9343 #3
-; CHECK: @test41
+; CHECK-LABEL: @test41(
; CHECK: ret i1 true
define i1 @test41(i32 %X, i32 %Y) {
%A = urem i32 %X, %Y
@@ -404,7 +415,7 @@ define i1 @test41(i32 %X, i32 %Y) {
ret i1 %B
}
-; CHECK: @test42
+; CHECK-LABEL: @test42(
; CHECK: %B = icmp sgt i32 %Y, -1
define i1 @test42(i32 %X, i32 %Y) {
%A = srem i32 %X, %Y
@@ -412,7 +423,7 @@ define i1 @test42(i32 %X, i32 %Y) {
ret i1 %B
}
-; CHECK: @test43
+; CHECK-LABEL: @test43(
; CHECK: %B = icmp slt i32 %Y, 0
define i1 @test43(i32 %X, i32 %Y) {
%A = srem i32 %X, %Y
@@ -420,7 +431,7 @@ define i1 @test43(i32 %X, i32 %Y) {
ret i1 %B
}
-; CHECK: @test44
+; CHECK-LABEL: @test44(
; CHECK: %B = icmp sgt i32 %Y, -1
define i1 @test44(i32 %X, i32 %Y) {
%A = srem i32 %X, %Y
@@ -428,7 +439,7 @@ define i1 @test44(i32 %X, i32 %Y) {
ret i1 %B
}
-; CHECK: @test45
+; CHECK-LABEL: @test45(
; CHECK: %B = icmp slt i32 %Y, 0
define i1 @test45(i32 %X, i32 %Y) {
%A = srem i32 %X, %Y
@@ -437,7 +448,7 @@ define i1 @test45(i32 %X, i32 %Y) {
}
; PR9343 #4
-; CHECK: @test46
+; CHECK-LABEL: @test46(
; CHECK: %C = icmp ult i32 %X, %Y
define i1 @test46(i32 %X, i32 %Y, i32 %Z) {
%A = ashr exact i32 %X, %Z
@@ -447,7 +458,7 @@ define i1 @test46(i32 %X, i32 %Y, i32 %Z) {
}
; PR9343 #5
-; CHECK: @test47
+; CHECK-LABEL: @test47(
; CHECK: %C = icmp ugt i32 %X, %Y
define i1 @test47(i32 %X, i32 %Y, i32 %Z) {
%A = ashr exact i32 %X, %Z
@@ -457,7 +468,7 @@ define i1 @test47(i32 %X, i32 %Y, i32 %Z) {
}
; PR9343 #8
-; CHECK: @test48
+; CHECK-LABEL: @test48(
; CHECK: %C = icmp eq i32 %X, %Y
define i1 @test48(i32 %X, i32 %Y, i32 %Z) {
%A = sdiv exact i32 %X, %Z
@@ -467,17 +478,17 @@ define i1 @test48(i32 %X, i32 %Y, i32 %Z) {
}
; PR8469
-; CHECK: @test49
+; CHECK-LABEL: @test49(
; CHECK: ret <2 x i1> <i1 true, i1 true>
define <2 x i1> @test49(<2 x i32> %tmp3) {
entry:
%tmp11 = and <2 x i32> %tmp3, <i32 3, i32 3>
%cmp = icmp ult <2 x i32> %tmp11, <i32 4, i32 4>
- ret <2 x i1> %cmp
+ ret <2 x i1> %cmp
}
; PR9343 #7
-; CHECK: @test50
+; CHECK-LABEL: @test50(
; CHECK: ret i1 true
define i1 @test50(i16 %X, i32 %Y) {
%A = zext i16 %X to i32
@@ -486,7 +497,7 @@ define i1 @test50(i16 %X, i32 %Y) {
ret i1 %C
}
-; CHECK: @test51
+; CHECK-LABEL: @test51(
; CHECK: ret i1 %C
define i1 @test51(i32 %X, i32 %Y) {
%A = and i32 %X, 2147483648
@@ -495,7 +506,7 @@ define i1 @test51(i32 %X, i32 %Y) {
ret i1 %C
}
-; CHECK: @test52
+; CHECK-LABEL: @test52(
; CHECK-NEXT: and i32 %x1, 16711935
; CHECK-NEXT: icmp eq i32 {{.*}}, 4980863
; CHECK-NEXT: ret i1
@@ -511,18 +522,18 @@ define i1 @test52(i32 %x1) nounwind {
}
; PR9838
-; CHECK: @test53
-; CHECK-NEXT: ashr exact
-; CHECK-NEXT: ashr
+; CHECK-LABEL: @test53(
+; CHECK-NEXT: sdiv exact
+; CHECK-NEXT: sdiv
; CHECK-NEXT: icmp
define i1 @test53(i32 %a, i32 %b) nounwind {
- %x = ashr exact i32 %a, 30
- %y = ashr i32 %b, 30
+ %x = sdiv exact i32 %a, 30
+ %y = sdiv i32 %b, 30
%z = icmp eq i32 %x, %y
ret i1 %z
}
-; CHECK: @test54
+; CHECK-LABEL: @test54(
; CHECK-NEXT: %and = and i8 %a, -64
; CHECK-NEXT: icmp eq i8 %and, -128
define i1 @test54(i8 %a) nounwind {
@@ -532,7 +543,7 @@ define i1 @test54(i8 %a) nounwind {
ret i1 %ret
}
-; CHECK: @test55
+; CHECK-LABEL: @test55(
; CHECK-NEXT: icmp eq i32 %a, -123
define i1 @test55(i32 %a) {
%sub = sub i32 0, %a
@@ -540,7 +551,7 @@ define i1 @test55(i32 %a) {
ret i1 %cmp
}
-; CHECK: @test56
+; CHECK-LABEL: @test56(
; CHECK-NEXT: icmp eq i32 %a, -113
define i1 @test56(i32 %a) {
%sub = sub i32 10, %a
@@ -550,7 +561,7 @@ define i1 @test56(i32 %a) {
; PR10267 Don't make icmps more expensive when no other inst is subsumed.
declare void @foo(i32)
-; CHECK: @test57
+; CHECK-LABEL: @test57(
; CHECK: %and = and i32 %a, -2
; CHECK: %cmp = icmp ne i32 %and, 0
define i1 @test57(i32 %a) {
@@ -561,7 +572,7 @@ define i1 @test57(i32 %a) {
}
; rdar://problem/10482509
-; CHECK: @cmpabs1
+; CHECK-LABEL: @cmpabs1(
; CHECK-NEXT: icmp ne
define zeroext i1 @cmpabs1(i64 %val) {
%sub = sub nsw i64 0, %val
@@ -571,7 +582,7 @@ define zeroext i1 @cmpabs1(i64 %val) {
ret i1 %tobool
}
-; CHECK: @cmpabs2
+; CHECK-LABEL: @cmpabs2(
; CHECK-NEXT: icmp ne
define zeroext i1 @cmpabs2(i64 %val) {
%sub = sub nsw i64 0, %val
@@ -581,7 +592,7 @@ define zeroext i1 @cmpabs2(i64 %val) {
ret i1 %tobool
}
-; CHECK: @test58
+; CHECK-LABEL: @test58(
; CHECK-NEXT: call i32 @test58_d(i64 36029346783166592)
define void @test58() nounwind {
%cast = bitcast <1 x i64> <i64 36029346783166592> to i64
@@ -599,7 +610,22 @@ define i1 @test59(i8* %foo) {
%use = ptrtoint i8* %cast1 to i64
%call = call i32 @test58_d(i64 %use) nounwind
ret i1 %cmp
-; CHECK: @test59
+; CHECK-LABEL: @test59(
+; CHECK: ret i1 true
+}
+
+define i1 @test59_as1(i8 addrspace(1)* %foo) {
+ %bit = bitcast i8 addrspace(1)* %foo to i32 addrspace(1)*
+ %gep1 = getelementptr inbounds i32 addrspace(1)* %bit, i64 2
+ %gep2 = getelementptr inbounds i8 addrspace(1)* %foo, i64 10
+ %cast1 = bitcast i32 addrspace(1)* %gep1 to i8 addrspace(1)*
+ %cmp = icmp ult i8 addrspace(1)* %cast1, %gep2
+ %use = ptrtoint i8 addrspace(1)* %cast1 to i64
+ %call = call i32 @test58_d(i64 %use) nounwind
+ ret i1 %cmp
+; CHECK: @test59_as1
+; CHECK: %[[GEP:.+]] = getelementptr inbounds i8 addrspace(1)* %foo, i16 8
+; CHECK: ptrtoint i8 addrspace(1)* %[[GEP]] to i16
; CHECK: ret i1 true
}
@@ -610,12 +636,27 @@ define i1 @test60(i8* %foo, i64 %i, i64 %j) {
%cast1 = bitcast i32* %gep1 to i8*
%cmp = icmp ult i8* %cast1, %gep2
ret i1 %cmp
-; CHECK: @test60
+; CHECK-LABEL: @test60(
; CHECK-NEXT: %gep1.idx = shl nuw i64 %i, 2
; CHECK-NEXT: icmp slt i64 %gep1.idx, %j
; CHECK-NEXT: ret i1
}
+define i1 @test60_as1(i8 addrspace(1)* %foo, i64 %i, i64 %j) {
+ %bit = bitcast i8 addrspace(1)* %foo to i32 addrspace(1)*
+ %gep1 = getelementptr inbounds i32 addrspace(1)* %bit, i64 %i
+ %gep2 = getelementptr inbounds i8 addrspace(1)* %foo, i64 %j
+ %cast1 = bitcast i32 addrspace(1)* %gep1 to i8 addrspace(1)*
+ %cmp = icmp ult i8 addrspace(1)* %cast1, %gep2
+ ret i1 %cmp
+; CHECK: @test60_as1
+; CHECK: trunc i64 %i to i16
+; CHECK: trunc i64 %j to i16
+; CHECK: %gep1.idx = shl nuw i16 %{{.+}}, 2
+; CHECK-NEXT: icmp sgt i16 %{{.+}}, %gep1.idx
+; CHECK-NEXT: ret i1
+}
+
define i1 @test61(i8* %foo, i64 %i, i64 %j) {
%bit = bitcast i8* %foo to i32*
%gep1 = getelementptr i32* %bit, i64 %i
@@ -624,26 +665,48 @@ define i1 @test61(i8* %foo, i64 %i, i64 %j) {
%cmp = icmp ult i8* %cast1, %gep2
ret i1 %cmp
; Don't transform non-inbounds GEPs.
-; CHECK: @test61
+; CHECK-LABEL: @test61(
; CHECK: icmp ult i8* %cast1, %gep2
; CHECK-NEXT: ret i1
}
+define i1 @test61_as1(i8 addrspace(1)* %foo, i16 %i, i16 %j) {
+ %bit = bitcast i8 addrspace(1)* %foo to i32 addrspace(1)*
+ %gep1 = getelementptr i32 addrspace(1)* %bit, i16 %i
+ %gep2 = getelementptr i8 addrspace(1)* %foo, i16 %j
+ %cast1 = bitcast i32 addrspace(1)* %gep1 to i8 addrspace(1)*
+ %cmp = icmp ult i8 addrspace(1)* %cast1, %gep2
+ ret i1 %cmp
+; Don't transform non-inbounds GEPs.
+; CHECK: @test61_as1
+; CHECK: icmp ult i8 addrspace(1)* %cast1, %gep2
+; CHECK-NEXT: ret i1
+}
+
define i1 @test62(i8* %a) {
%arrayidx1 = getelementptr inbounds i8* %a, i64 1
%arrayidx2 = getelementptr inbounds i8* %a, i64 10
%cmp = icmp slt i8* %arrayidx1, %arrayidx2
ret i1 %cmp
-; CHECK: @test62
+; CHECK-LABEL: @test62(
; CHECK-NEXT: ret i1 true
}
+define i1 @test62_as1(i8 addrspace(1)* %a) {
+; CHECK-LABEL: @test62_as1(
+; CHECK-NEXT: ret i1 true
+ %arrayidx1 = getelementptr inbounds i8 addrspace(1)* %a, i64 1
+ %arrayidx2 = getelementptr inbounds i8 addrspace(1)* %a, i64 10
+ %cmp = icmp slt i8 addrspace(1)* %arrayidx1, %arrayidx2
+ ret i1 %cmp
+}
+
define i1 @test63(i8 %a, i32 %b) nounwind {
%z = zext i8 %a to i32
%t = and i32 %b, 255
%c = icmp eq i32 %z, %t
ret i1 %c
-; CHECK: @test63
+; CHECK-LABEL: @test63(
; CHECK-NEXT: %1 = trunc i32 %b to i8
; CHECK-NEXT: %c = icmp eq i8 %1, %a
; CHECK-NEXT: ret i1 %c
@@ -654,7 +717,7 @@ define i1 @test64(i8 %a, i32 %b) nounwind {
%z = zext i8 %a to i32
%c = icmp eq i32 %t, %z
ret i1 %c
-; CHECK: @test64
+; CHECK-LABEL: @test64(
; CHECK-NEXT: %1 = trunc i32 %b to i8
; CHECK-NEXT: %c = icmp eq i8 %1, %a
; CHECK-NEXT: ret i1 %c
@@ -664,7 +727,7 @@ define i1 @test65(i64 %A, i64 %B) {
%s1 = add i64 %A, %B
%s2 = add i64 %A, %B
%cmp = icmp eq i64 %s1, %s2
-; CHECK: @test65
+; CHECK-LABEL: @test65(
; CHECK-NEXT: ret i1 true
ret i1 %cmp
}
@@ -673,12 +736,12 @@ define i1 @test66(i64 %A, i64 %B) {
%s1 = add i64 %A, %B
%s2 = add i64 %B, %A
%cmp = icmp eq i64 %s1, %s2
-; CHECK: @test66
+; CHECK-LABEL: @test66(
; CHECK-NEXT: ret i1 true
ret i1 %cmp
}
-; CHECK: @test67
+; CHECK-LABEL: @test67(
; CHECK: %and = and i32 %x, 96
; CHECK: %cmp = icmp ne i32 %and, 0
define i1 @test67(i32 %x) nounwind uwtable {
@@ -687,7 +750,7 @@ define i1 @test67(i32 %x) nounwind uwtable {
ret i1 %cmp
}
-; CHECK: @test68
+; CHECK-LABEL: @test68(
; CHECK: %cmp = icmp ugt i32 %and, 30
define i1 @test68(i32 %x) nounwind uwtable {
%and = and i32 %x, 127
@@ -696,7 +759,7 @@ define i1 @test68(i32 %x) nounwind uwtable {
}
; PR14708
-; CHECK: @test69
+; CHECK-LABEL: @test69(
; CHECK: %1 = and i32 %c, -33
; CHECK: %2 = icmp eq i32 %1, 65
; CHECK: ret i1 %2
@@ -707,7 +770,19 @@ define i1 @test69(i32 %c) nounwind uwtable {
ret i1 %3
}
-; CHECK: @icmp_sext16trunc
+; PR15940
+; CHECK-LABEL: @test70(
+; CHECK-NEXT: %A = srem i32 5, %X
+; CHECK-NEXT: %C = icmp ne i32 %A, 2
+; CHECK-NEXT: ret i1 %C
+define i1 @test70(i32 %X) {
+ %A = srem i32 5, %X
+ %B = add i32 %A, 2
+ %C = icmp ne i32 %B, 4
+ ret i1 %C
+}
+
+; CHECK-LABEL: @icmp_sext16trunc(
; CHECK-NEXT: %1 = trunc i32 %x to i16
; CHECK-NEXT: %cmp = icmp slt i16 %1, 36
define i1 @icmp_sext16trunc(i32 %x) {
@@ -717,7 +792,7 @@ define i1 @icmp_sext16trunc(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_sext8trunc
+; CHECK-LABEL: @icmp_sext8trunc(
; CHECK-NEXT: %1 = trunc i32 %x to i8
; CHECK-NEXT: %cmp = icmp slt i8 %1, 36
define i1 @icmp_sext8trunc(i32 %x) {
@@ -727,7 +802,7 @@ define i1 @icmp_sext8trunc(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_shl16
+; CHECK-LABEL: @icmp_shl16(
; CHECK-NEXT: %1 = trunc i32 %x to i16
; CHECK-NEXT: %cmp = icmp slt i16 %1, 36
define i1 @icmp_shl16(i32 %x) {
@@ -736,7 +811,7 @@ define i1 @icmp_shl16(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_shl24
+; CHECK-LABEL: @icmp_shl24(
; CHECK-NEXT: %1 = trunc i32 %x to i8
; CHECK-NEXT: %cmp = icmp slt i8 %1, 36
define i1 @icmp_shl24(i32 %x) {
@@ -747,7 +822,7 @@ define i1 @icmp_shl24(i32 %x) {
; If the (shl x, C) preserved the sign and this is a sign test,
; compare the LHS operand instead
-; CHECK: @icmp_shl_nsw_sgt
+; CHECK-LABEL: @icmp_shl_nsw_sgt(
; CHECK-NEXT: icmp sgt i32 %x, 0
define i1 @icmp_shl_nsw_sgt(i32 %x) {
%shl = shl nsw i32 %x, 21
@@ -755,7 +830,7 @@ define i1 @icmp_shl_nsw_sgt(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_shl_nsw_sge0
+; CHECK-LABEL: @icmp_shl_nsw_sge0(
; CHECK-NEXT: icmp sgt i32 %x, -1
define i1 @icmp_shl_nsw_sge0(i32 %x) {
%shl = shl nsw i32 %x, 21
@@ -763,7 +838,7 @@ define i1 @icmp_shl_nsw_sge0(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_shl_nsw_sge1
+; CHECK-LABEL: @icmp_shl_nsw_sge1(
; CHECK-NEXT: icmp sgt i32 %x, 0
define i1 @icmp_shl_nsw_sge1(i32 %x) {
%shl = shl nsw i32 %x, 21
@@ -772,7 +847,7 @@ define i1 @icmp_shl_nsw_sge1(i32 %x) {
}
; Checks for icmp (eq|ne) (shl x, C), 0
-; CHECK: @icmp_shl_nsw_eq
+; CHECK-LABEL: @icmp_shl_nsw_eq(
; CHECK-NEXT: icmp eq i32 %x, 0
define i1 @icmp_shl_nsw_eq(i32 %x) {
%mul = shl nsw i32 %x, 5
@@ -780,7 +855,7 @@ define i1 @icmp_shl_nsw_eq(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_shl_eq
+; CHECK-LABEL: @icmp_shl_eq(
; CHECK-NOT: icmp eq i32 %mul, 0
define i1 @icmp_shl_eq(i32 %x) {
%mul = shl i32 %x, 5
@@ -788,7 +863,7 @@ define i1 @icmp_shl_eq(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_shl_nsw_ne
+; CHECK-LABEL: @icmp_shl_nsw_ne(
; CHECK-NEXT: icmp ne i32 %x, 0
define i1 @icmp_shl_nsw_ne(i32 %x) {
%mul = shl nsw i32 %x, 7
@@ -796,7 +871,7 @@ define i1 @icmp_shl_nsw_ne(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_shl_ne
+; CHECK-LABEL: @icmp_shl_ne(
; CHECK-NOT: icmp ne i32 %x, 0
define i1 @icmp_shl_ne(i32 %x) {
%mul = shl i32 %x, 7
@@ -806,7 +881,7 @@ define i1 @icmp_shl_ne(i32 %x) {
; If the (mul x, C) preserved the sign and this is sign test,
; compare the LHS operand instead
-; CHECK: @icmp_mul_nsw
+; CHECK-LABEL: @icmp_mul_nsw(
; CHECK-NEXT: icmp sgt i32 %x, 0
define i1 @icmp_mul_nsw(i32 %x) {
%mul = mul nsw i32 %x, 12
@@ -814,7 +889,7 @@ define i1 @icmp_mul_nsw(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_mul_nsw1
+; CHECK-LABEL: @icmp_mul_nsw1(
; CHECK-NEXT: icmp slt i32 %x, 0
define i1 @icmp_mul_nsw1(i32 %x) {
%mul = mul nsw i32 %x, 12
@@ -822,7 +897,7 @@ define i1 @icmp_mul_nsw1(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_mul_nsw_neg
+; CHECK-LABEL: @icmp_mul_nsw_neg(
; CHECK-NEXT: icmp slt i32 %x, 1
define i1 @icmp_mul_nsw_neg(i32 %x) {
%mul = mul nsw i32 %x, -12
@@ -830,7 +905,7 @@ define i1 @icmp_mul_nsw_neg(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_mul_nsw_neg1
+; CHECK-LABEL: @icmp_mul_nsw_neg1(
; CHECK-NEXT: icmp slt i32 %x, 0
define i1 @icmp_mul_nsw_neg1(i32 %x) {
%mul = mul nsw i32 %x, -12
@@ -838,7 +913,7 @@ define i1 @icmp_mul_nsw_neg1(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_mul_nsw_0
+; CHECK-LABEL: @icmp_mul_nsw_0(
; CHECK-NOT: icmp sgt i32 %x, 0
define i1 @icmp_mul_nsw_0(i32 %x) {
%mul = mul nsw i32 %x, 0
@@ -846,7 +921,7 @@ define i1 @icmp_mul_nsw_0(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_mul
+; CHECK-LABEL: @icmp_mul(
; CHECK-NEXT: %mul = mul i32 %x, -12
define i1 @icmp_mul(i32 %x) {
%mul = mul i32 %x, -12
@@ -855,7 +930,7 @@ define i1 @icmp_mul(i32 %x) {
}
; Checks for icmp (eq|ne) (mul x, C), 0
-; CHECK: @icmp_mul_neq0
+; CHECK-LABEL: @icmp_mul_neq0(
; CHECK-NEXT: icmp ne i32 %x, 0
define i1 @icmp_mul_neq0(i32 %x) {
%mul = mul nsw i32 %x, -12
@@ -863,7 +938,7 @@ define i1 @icmp_mul_neq0(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_mul_eq0
+; CHECK-LABEL: @icmp_mul_eq0(
; CHECK-NEXT: icmp eq i32 %x, 0
define i1 @icmp_mul_eq0(i32 %x) {
%mul = mul nsw i32 %x, 12
@@ -871,7 +946,7 @@ define i1 @icmp_mul_eq0(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_mul0_eq0
+; CHECK-LABEL: @icmp_mul0_eq0(
; CHECK-NEXT: ret i1 true
define i1 @icmp_mul0_eq0(i32 %x) {
%mul = mul i32 %x, 0
@@ -879,7 +954,7 @@ define i1 @icmp_mul0_eq0(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_mul0_ne0
+; CHECK-LABEL: @icmp_mul0_ne0(
; CHECK-NEXT: ret i1 false
define i1 @icmp_mul0_ne0(i32 %x) {
%mul = mul i32 %x, 0
@@ -887,7 +962,7 @@ define i1 @icmp_mul0_ne0(i32 %x) {
ret i1 %cmp
}
-; CHECK: @icmp_sub1_sge
+; CHECK-LABEL: @icmp_sub1_sge(
; CHECK-NEXT: icmp sgt i32 %x, %y
define i1 @icmp_sub1_sge(i32 %x, i32 %y) {
%sub = add nsw i32 %x, -1
@@ -895,7 +970,7 @@ define i1 @icmp_sub1_sge(i32 %x, i32 %y) {
ret i1 %cmp
}
-; CHECK: @icmp_add1_sgt
+; CHECK-LABEL: @icmp_add1_sgt(
; CHECK-NEXT: icmp sge i32 %x, %y
define i1 @icmp_add1_sgt(i32 %x, i32 %y) {
%add = add nsw i32 %x, 1
@@ -903,7 +978,7 @@ define i1 @icmp_add1_sgt(i32 %x, i32 %y) {
ret i1 %cmp
}
-; CHECK: @icmp_sub1_slt
+; CHECK-LABEL: @icmp_sub1_slt(
; CHECK-NEXT: icmp sle i32 %x, %y
define i1 @icmp_sub1_slt(i32 %x, i32 %y) {
%sub = add nsw i32 %x, -1
@@ -911,7 +986,7 @@ define i1 @icmp_sub1_slt(i32 %x, i32 %y) {
ret i1 %cmp
}
-; CHECK: @icmp_add1_sle
+; CHECK-LABEL: @icmp_add1_sle(
; CHECK-NEXT: icmp slt i32 %x, %y
define i1 @icmp_add1_sle(i32 %x, i32 %y) {
%add = add nsw i32 %x, 1
@@ -919,7 +994,7 @@ define i1 @icmp_add1_sle(i32 %x, i32 %y) {
ret i1 %cmp
}
-; CHECK: @icmp_add20_sge_add57
+; CHECK-LABEL: @icmp_add20_sge_add57(
; CHECK-NEXT: [[ADD:%[a-z0-9]+]] = add nsw i32 %y, 37
; CHECK-NEXT: icmp sle i32 [[ADD]], %x
define i1 @icmp_add20_sge_add57(i32 %x, i32 %y) {
@@ -929,7 +1004,7 @@ define i1 @icmp_add20_sge_add57(i32 %x, i32 %y) {
ret i1 %cmp
}
-; CHECK: @icmp_sub57_sge_sub20
+; CHECK-LABEL: @icmp_sub57_sge_sub20(
; CHECK-NEXT: [[SUB:%[a-z0-9]+]] = add nsw i32 %x, -37
; CHECK-NEXT: icmp sge i32 [[SUB]], %y
define i1 @icmp_sub57_sge_sub20(i32 %x, i32 %y) {
@@ -939,7 +1014,7 @@ define i1 @icmp_sub57_sge_sub20(i32 %x, i32 %y) {
ret i1 %cmp
}
-; CHECK: @icmp_and_shl_neg_ne_0
+; CHECK-LABEL: @icmp_and_shl_neg_ne_0(
; CHECK-NEXT: [[SHL:%[a-z0-9]+]] = shl i32 1, %B
; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i32 [[SHL]], %A
; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp eq i32 [[AND]], 0
@@ -952,7 +1027,7 @@ define i1 @icmp_and_shl_neg_ne_0(i32 %A, i32 %B) {
ret i1 %cmp
}
-; CHECK: @icmp_and_shl_neg_eq_0
+; CHECK-LABEL: @icmp_and_shl_neg_eq_0(
; CHECK-NEXT: [[SHL:%[a-z0-9]+]] = shl i32 1, %B
; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i32 [[SHL]], %A
; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp ne i32 [[AND]], 0
@@ -965,7 +1040,7 @@ define i1 @icmp_and_shl_neg_eq_0(i32 %A, i32 %B) {
ret i1 %cmp
}
-; CHECK: @icmp_add_and_shr_ne_0
+; CHECK-LABEL: @icmp_add_and_shr_ne_0(
; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i32 %X, 240
; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp ne i32 [[AND]], 224
; CHECK-NEXT: ret i1 [[CMP]]
@@ -976,3 +1051,308 @@ define i1 @icmp_add_and_shr_ne_0(i32 %X) {
%tobool = icmp ne i32 %add, 0
ret i1 %tobool
}
+
+; PR16244
+; CHECK-LABEL: define i1 @test71(
+; CHECK-NEXT: ret i1 false
+define i1 @test71(i8* %x) {
+ %a = getelementptr i8* %x, i64 8
+ %b = getelementptr inbounds i8* %x, i64 8
+ %c = icmp ugt i8* %a, %b
+ ret i1 %c
+}
+
+define i1 @test71_as1(i8 addrspace(1)* %x) {
+; CHECK-LABEL: @test71_as1(
+; CHECK-NEXT: ret i1 false
+ %a = getelementptr i8 addrspace(1)* %x, i64 8
+ %b = getelementptr inbounds i8 addrspace(1)* %x, i64 8
+ %c = icmp ugt i8 addrspace(1)* %a, %b
+ ret i1 %c
+}
+
+; CHECK-LABEL: @icmp_shl_1_V_ult_32(
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp ult i32 %V, 5
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_shl_1_V_ult_32(i32 %V) {
+ %shl = shl i32 1, %V
+ %cmp = icmp ult i32 %shl, 32
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @icmp_shl_1_V_eq_32(
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp eq i32 %V, 5
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_shl_1_V_eq_32(i32 %V) {
+ %shl = shl i32 1, %V
+ %cmp = icmp eq i32 %shl, 32
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @icmp_shl_1_V_eq_31(
+; CHECK-NEXT: ret i1 false
+define i1 @icmp_shl_1_V_eq_31(i32 %V) {
+ %shl = shl i32 1, %V
+ %cmp = icmp eq i32 %shl, 31
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @icmp_shl_1_V_ne_31(
+; CHECK-NEXT: ret i1 true
+define i1 @icmp_shl_1_V_ne_31(i32 %V) {
+ %shl = shl i32 1, %V
+ %cmp = icmp ne i32 %shl, 31
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @icmp_shl_1_V_ult_30(
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp ult i32 %V, 5
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_shl_1_V_ult_30(i32 %V) {
+ %shl = shl i32 1, %V
+ %cmp = icmp ult i32 %shl, 30
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @icmp_shl_1_V_ugt_30(
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp ugt i32 %V, 4
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_shl_1_V_ugt_30(i32 %V) {
+ %shl = shl i32 1, %V
+ %cmp = icmp ugt i32 %shl, 30
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @icmp_shl_1_V_ule_30(
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp ult i32 %V, 5
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_shl_1_V_ule_30(i32 %V) {
+ %shl = shl i32 1, %V
+ %cmp = icmp ule i32 %shl, 30
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @icmp_shl_1_V_uge_30(
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp ugt i32 %V, 4
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_shl_1_V_uge_30(i32 %V) {
+ %shl = shl i32 1, %V
+ %cmp = icmp uge i32 %shl, 30
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @icmp_shl_1_V_uge_2147483648(
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp eq i32 %V, 31
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_shl_1_V_uge_2147483648(i32 %V) {
+ %shl = shl i32 1, %V
+ %cmp = icmp uge i32 %shl, 2147483648
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @icmp_shl_1_V_ugt_2147483648(
+; CHECK-NEXT: ret i1 false
+define i1 @icmp_shl_1_V_ugt_2147483648(i32 %V) {
+ %shl = shl i32 1, %V
+ %cmp = icmp ugt i32 %shl, 2147483648
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @icmp_shl_1_V_ule_2147483648(
+; CHECK-NEXT: ret i1 true
+define i1 @icmp_shl_1_V_ule_2147483648(i32 %V) {
+ %shl = shl i32 1, %V
+ %cmp = icmp ule i32 %shl, 2147483648
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @icmp_shl_1_V_ult_2147483648(
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp ne i32 %V, 31
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_shl_1_V_ult_2147483648(i32 %V) {
+ %shl = shl i32 1, %V
+ %cmp = icmp ult i32 %shl, 2147483648
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @or_icmp_eq_B_0_icmp_ult_A_B(
+; CHECK-NEXT: [[SUB:%[a-z0-9]+]] = add i64 %b, -1
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp uge i64 [[SUB]], %a
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @or_icmp_eq_B_0_icmp_ult_A_B(i64 %a, i64 %b) {
+ %1 = icmp eq i64 %b, 0
+ %2 = icmp ult i64 %a, %b
+ %3 = or i1 %1, %2
+ ret i1 %3
+}
+
+; CHECK-LABEL: @icmp_add_ult_2(
+; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i32 %X, -2
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp eq i32 [[AND]], 14
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_add_ult_2(i32 %X) {
+ %add = add i32 %X, -14
+ %cmp = icmp ult i32 %add, 2
+ ret i1 %cmp
+}
+
+; CHECK: @icmp_add_X_-14_ult_2
+; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i32 %X, -2
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp eq i32 [[AND]], 14
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_add_X_-14_ult_2(i32 %X) {
+ %add = add i32 %X, -14
+ %cmp = icmp ult i32 %add, 2
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @icmp_sub_3_X_ult_2(
+; CHECK-NEXT: [[OR:%[a-z0-9]+]] = or i32 %X, 1
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp eq i32 [[OR]], 3
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_sub_3_X_ult_2(i32 %X) {
+ %add = sub i32 3, %X
+ %cmp = icmp ult i32 %add, 2
+ ret i1 %cmp
+}
+
+; CHECK: @icmp_add_X_-14_uge_2
+; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i32 %X, -2
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp ne i32 [[AND]], 14
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_add_X_-14_uge_2(i32 %X) {
+ %add = add i32 %X, -14
+ %cmp = icmp uge i32 %add, 2
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @icmp_sub_3_X_uge_2(
+; CHECK-NEXT: [[OR:%[a-z0-9]+]] = or i32 %X, 1
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp ne i32 [[OR]], 3
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_sub_3_X_uge_2(i32 %X) {
+ %add = sub i32 3, %X
+ %cmp = icmp uge i32 %add, 2
+ ret i1 %cmp
+}
+
+; CHECK: @icmp_and_X_-16_eq-16
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp ugt i32 %X, -17
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_and_X_-16_eq-16(i32 %X) {
+ %and = and i32 %X, -16
+ %cmp = icmp eq i32 %and, -16
+ ret i1 %cmp
+}
+
+; CHECK: @icmp_and_X_-16_ne-16
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp ult i32 %X, -16
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_and_X_-16_ne-16(i32 %X) {
+ %and = and i32 %X, -16
+ %cmp = icmp ne i32 %and, -16
+ ret i1 %cmp
+}
+
+; CHECK: @icmp_sub_-1_X_ult_4
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp ugt i32 %X, -5
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_sub_-1_X_ult_4(i32 %X) {
+ %sub = sub i32 -1, %X
+ %cmp = icmp ult i32 %sub, 4
+ ret i1 %cmp
+}
+
+; CHECK: @icmp_sub_-1_X_uge_4
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp ult i32 %X, -4
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_sub_-1_X_uge_4(i32 %X) {
+ %sub = sub i32 -1, %X
+ %cmp = icmp uge i32 %sub, 4
+ ret i1 %cmp
+}
+
+; CHECK-LABEL: @icmp_swap_operands_for_cse
+; CHECK: [[CMP:%[a-z0-9]+]] = icmp ult i32 %X, %Y
+; CHECK-NEXT: br i1 [[CMP]], label %true, label %false
+; CHECK: ret i1
+define i1 @icmp_swap_operands_for_cse(i32 %X, i32 %Y) {
+entry:
+ %sub = sub i32 %X, %Y
+ %cmp = icmp ugt i32 %Y, %X
+ br i1 %cmp, label %true, label %false
+true:
+ %restrue = trunc i32 %sub to i1
+ br label %end
+false:
+ %shift = lshr i32 %sub, 4
+ %resfalse = trunc i32 %shift to i1
+ br label %end
+end:
+ %res = phi i1 [%restrue, %true], [%resfalse, %false]
+ ret i1 %res
+}
+
+; CHECK-LABEL: @icmp_swap_operands_for_cse2
+; CHECK: [[CMP:%[a-z0-9]+]] = icmp ult i32 %X, %Y
+; CHECK-NEXT: br i1 [[CMP]], label %true, label %false
+; CHECK: ret i1
+define i1 @icmp_swap_operands_for_cse2(i32 %X, i32 %Y) {
+entry:
+ %cmp = icmp ugt i32 %Y, %X
+ br i1 %cmp, label %true, label %false
+true:
+ %sub = sub i32 %X, %Y
+ %sub1 = sub i32 %X, %Y
+ %add = add i32 %sub, %sub1
+ %restrue = trunc i32 %add to i1
+ br label %end
+false:
+ %sub2 = sub i32 %Y, %X
+ %resfalse = trunc i32 %sub2 to i1
+ br label %end
+end:
+ %res = phi i1 [%restrue, %true], [%resfalse, %false]
+ ret i1 %res
+}
+
+; CHECK-LABEL: @icmp_do_not_swap_operands_for_cse
+; CHECK: [[CMP:%[a-z0-9]+]] = icmp ugt i32 %Y, %X
+; CHECK-NEXT: br i1 [[CMP]], label %true, label %false
+; CHECK: ret i1
+define i1 @icmp_do_not_swap_operands_for_cse(i32 %X, i32 %Y) {
+entry:
+ %cmp = icmp ugt i32 %Y, %X
+ br i1 %cmp, label %true, label %false
+true:
+ %sub = sub i32 %X, %Y
+ %restrue = trunc i32 %sub to i1
+ br label %end
+false:
+ %sub2 = sub i32 %Y, %X
+ %resfalse = trunc i32 %sub2 to i1
+ br label %end
+end:
+ %res = phi i1 [%restrue, %true], [%resfalse, %false]
+ ret i1 %res
+}
+
+; CHECK-LABEL: @icmp_lshr_lshr_eq
+; CHECK: %z.unshifted = xor i32 %a, %b
+; CHECK: %z = icmp ult i32 %z.unshifted, 1073741824
+define i1 @icmp_lshr_lshr_eq(i32 %a, i32 %b) nounwind {
+ %x = lshr i32 %a, 30
+ %y = lshr i32 %b, 30
+ %z = icmp eq i32 %x, %y
+ ret i1 %z
+}
+
+; CHECK-LABEL: @icmp_ashr_ashr_ne
+; CHECK: %z.unshifted = xor i32 %a, %b
+; CHECK: %z = icmp ugt i32 %z.unshifted, 255
+define i1 @icmp_ashr_ashr_ne(i32 %a, i32 %b) nounwind {
+ %x = ashr i32 %a, 8
+ %y = ashr i32 %b, 8
+ %z = icmp ne i32 %x, %y
+ ret i1 %z
+}
diff --git a/test/Transforms/InstCombine/idioms.ll b/test/Transforms/InstCombine/idioms.ll
index 1a211668c3bf..58485442230c 100644
--- a/test/Transforms/InstCombine/idioms.ll
+++ b/test/Transforms/InstCombine/idioms.ll
@@ -25,7 +25,7 @@ bb3:
bb4:
%f = phi i32 [ %not2, %bb2 ], [ %e, %bb3 ]
ret i32 %f
-; CHECK: @test_asr
+; CHECK-LABEL: @test_asr(
; CHECK: bb4:
; CHECK: %f = ashr i32 %a, %b
; CHECK: ret i32 %f
diff --git a/test/Transforms/InstCombine/intrinsics.ll b/test/Transforms/InstCombine/intrinsics.ll
index f334b3b1e935..91c44704ce78 100644
--- a/test/Transforms/InstCombine/intrinsics.ll
+++ b/test/Transforms/InstCombine/intrinsics.ll
@@ -14,7 +14,7 @@ define i8 @uaddtest1(i8 %A, i8 %B) {
%x = call %overflow.result @llvm.uadd.with.overflow.i8(i8 %A, i8 %B)
%y = extractvalue %overflow.result %x, 0
ret i8 %y
-; CHECK: @uaddtest1
+; CHECK-LABEL: @uaddtest1(
; CHECK-NEXT: %y = add i8 %A, %B
; CHECK-NEXT: ret i8 %y
}
@@ -27,7 +27,7 @@ define i8 @uaddtest2(i8 %A, i8 %B, i1* %overflowPtr) {
%z = extractvalue %overflow.result %x, 1
store i1 %z, i1* %overflowPtr
ret i8 %y
-; CHECK: @uaddtest2
+; CHECK-LABEL: @uaddtest2(
; CHECK-NEXT: %and.A = and i8 %A, 127
; CHECK-NEXT: %and.B = and i8 %B, 127
; CHECK-NEXT: %x = add nuw i8 %and.A, %and.B
@@ -43,7 +43,7 @@ define i8 @uaddtest3(i8 %A, i8 %B, i1* %overflowPtr) {
%z = extractvalue %overflow.result %x, 1
store i1 %z, i1* %overflowPtr
ret i8 %y
-; CHECK: @uaddtest3
+; CHECK-LABEL: @uaddtest3(
; CHECK-NEXT: %or.A = or i8 %A, -128
; CHECK-NEXT: %or.B = or i8 %B, -128
; CHECK-NEXT: %x = add i8 %or.A, %or.B
@@ -57,7 +57,7 @@ define i8 @uaddtest4(i8 %A, i1* %overflowPtr) {
%z = extractvalue %overflow.result %x, 1
store i1 %z, i1* %overflowPtr
ret i8 %y
-; CHECK: @uaddtest4
+; CHECK-LABEL: @uaddtest4(
; CHECK-NEXT: ret i8 undef
}
@@ -67,7 +67,7 @@ define i8 @uaddtest5(i8 %A, i1* %overflowPtr) {
%z = extractvalue %overflow.result %x, 1
store i1 %z, i1* %overflowPtr
ret i8 %y
-; CHECK: @uaddtest5
+; CHECK-LABEL: @uaddtest5(
; CHECK: ret i8 %A
}
@@ -75,7 +75,7 @@ define i1 @uaddtest6(i8 %A, i8 %B) {
%x = call %overflow.result @llvm.uadd.with.overflow.i8(i8 %A, i8 -4)
%z = extractvalue %overflow.result %x, 1
ret i1 %z
-; CHECK: @uaddtest6
+; CHECK-LABEL: @uaddtest6(
; CHECK-NEXT: %z = icmp ugt i8 %A, 3
; CHECK-NEXT: ret i1 %z
}
@@ -84,7 +84,7 @@ define i8 @uaddtest7(i8 %A, i8 %B) {
%x = call %overflow.result @llvm.uadd.with.overflow.i8(i8 %A, i8 %B)
%z = extractvalue %overflow.result %x, 0
ret i8 %z
-; CHECK: @uaddtest7
+; CHECK-LABEL: @uaddtest7(
; CHECK-NEXT: %z = add i8 %A, %B
; CHECK-NEXT: ret i8 %z
}
@@ -96,7 +96,7 @@ define i8 @umultest1(i8 %A, i1* %overflowPtr) {
%z = extractvalue %overflow.result %x, 1
store i1 %z, i1* %overflowPtr
ret i8 %y
-; CHECK: @umultest1
+; CHECK-LABEL: @umultest1(
; CHECK-NEXT: store i1 false, i1* %overflowPtr
; CHECK-NEXT: ret i8 0
}
@@ -107,7 +107,7 @@ define i8 @umultest2(i8 %A, i1* %overflowPtr) {
%z = extractvalue %overflow.result %x, 1
store i1 %z, i1* %overflowPtr
ret i8 %y
-; CHECK: @umultest2
+; CHECK-LABEL: @umultest2(
; CHECK-NEXT: store i1 false, i1* %overflowPtr
; CHECK-NEXT: ret i8 %A
}
@@ -122,7 +122,7 @@ define i32 @umultest3(i32 %n) nounwind {
%res = extractvalue %ov.result.32 %mul, 0
%ret = select i1 %ov, i32 -1, i32 %res
ret i32 %ret
-; CHECK: @umultest3
+; CHECK-LABEL: @umultest3(
; CHECK-NEXT: shr
; CHECK-NEXT: mul nuw
; CHECK-NEXT: ret
@@ -135,7 +135,7 @@ define i32 @umultest4(i32 %n) nounwind {
%res = extractvalue %ov.result.32 %mul, 0
%ret = select i1 %ov, i32 -1, i32 %res
ret i32 %ret
-; CHECK: @umultest4
+; CHECK-LABEL: @umultest4(
; CHECK: umul.with.overflow
}
@@ -150,7 +150,7 @@ entry:
%C = tail call double @llvm.powi.f64(double %V, i32 1) nounwind
store volatile double %C, double* %P
ret void
-; CHECK: @powi
+; CHECK-LABEL: @powi(
; CHECK: %A = fdiv double 1.0{{.*}}, %V
; CHECK: store volatile double %A,
; CHECK: store volatile double 1.0
@@ -163,7 +163,7 @@ entry:
%and = and i32 %or, -8
%count = tail call i32 @llvm.cttz.i32(i32 %and, i1 true) nounwind readnone
ret i32 %count
-; CHECK: @cttz
+; CHECK-LABEL: @cttz(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret i32 3
}
@@ -174,7 +174,7 @@ entry:
%and = and i8 %or, 63
%count = tail call i8 @llvm.ctlz.i8(i8 %and, i1 true) nounwind readnone
ret i8 %count
-; CHECK: @ctlz
+; CHECK-LABEL: @ctlz(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret i8 2
}
@@ -206,7 +206,7 @@ define i32 @cttz_simplify1a(i32 %x) nounwind readnone ssp {
%shr3 = lshr i32 %tmp1, 5
ret i32 %shr3
-; CHECK: @cttz_simplify1a
+; CHECK-LABEL: @cttz_simplify1a(
; CHECK: icmp eq i32 %x, 0
; CHECK-NEXT: zext i1
; CHECK-NEXT: ret i32
@@ -217,7 +217,7 @@ define i32 @cttz_simplify1b(i32 %x) nounwind readnone ssp {
%shr3 = lshr i32 %tmp1, 5
ret i32 %shr3
-; CHECK: @cttz_simplify1b
+; CHECK-LABEL: @cttz_simplify1b(
; CHECK-NEXT: ret i32 0
}
@@ -225,7 +225,7 @@ define i32 @ctlz_undef(i32 %Value) nounwind {
%ctlz = call i32 @llvm.ctlz.i32(i32 0, i1 true)
ret i32 %ctlz
-; CHECK: @ctlz_undef
+; CHECK-LABEL: @ctlz_undef(
; CHECK-NEXT: ret i32 undef
}
@@ -233,7 +233,7 @@ define i32 @cttz_undef(i32 %Value) nounwind {
%cttz = call i32 @llvm.cttz.i32(i32 0, i1 true)
ret i32 %cttz
-; CHECK: @cttz_undef
+; CHECK-LABEL: @cttz_undef(
; CHECK-NEXT: ret i32 undef
}
@@ -243,7 +243,7 @@ define i32 @ctlz_select(i32 %Value) nounwind {
%s = select i1 %tobool, i32 %ctlz, i32 32
ret i32 %s
-; CHECK: @ctlz_select
+; CHECK-LABEL: @ctlz_select(
; CHECK: select i1 %tobool, i32 %ctlz, i32 32
}
@@ -253,6 +253,6 @@ define i32 @cttz_select(i32 %Value) nounwind {
%s = select i1 %tobool, i32 %cttz, i32 32
ret i32 %s
-; CHECK: @cttz_select
+; CHECK-LABEL: @cttz_select(
; CHECK: select i1 %tobool, i32 %cttz, i32 32
}
diff --git a/test/Transforms/InstCombine/invoke.ll b/test/Transforms/InstCombine/invoke.ll
index 04eaf86a287b..c4b58de61946 100644
--- a/test/Transforms/InstCombine/invoke.ll
+++ b/test/Transforms/InstCombine/invoke.ll
@@ -7,7 +7,7 @@ declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readonly
declare i8* @_Znwm(i64)
-; CHECK: @f1
+; CHECK-LABEL: @f1(
define i64 @f1() nounwind uwtable ssp {
entry:
; CHECK: nvoke noalias i8* undef()
@@ -27,7 +27,7 @@ lpad:
unreachable
}
-; CHECK: @f2
+; CHECK-LABEL: @f2(
define i64 @f2() nounwind uwtable ssp {
entry:
; CHECK: nvoke noalias i8* null()
@@ -47,7 +47,7 @@ lpad:
unreachable
}
-; CHECK: @f3
+; CHECK-LABEL: @f3(
define void @f3() nounwind uwtable ssp {
; CHECK: invoke void @llvm.donothing()
%call = invoke noalias i8* @_Znwm(i64 13)
diff --git a/test/Transforms/InstCombine/isascii-1.ll b/test/Transforms/InstCombine/isascii-1.ll
index 2a413d89b492..88f5ad66d2ef 100644
--- a/test/Transforms/InstCombine/isascii-1.ll
+++ b/test/Transforms/InstCombine/isascii-1.ll
@@ -9,21 +9,21 @@ declare i32 @isascii(i32)
; Check isascii(c) -> c <u 128.
define i32 @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%ret = call i32 @isascii(i32 127)
ret i32 %ret
; CHECK-NEXT: ret i32 1
}
define i32 @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%ret = call i32 @isascii(i32 128)
ret i32 %ret
; CHECK-NEXT: ret i32 0
}
define i32 @test_simplify3(i32 %x) {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%ret = call i32 @isascii(i32 %x)
; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp ult i32 %x, 128
; CHECK-NEXT: [[ZEXT:%[a-z0-9]+]] = zext i1 [[CMP]] to i32
diff --git a/test/Transforms/InstCombine/isdigit-1.ll b/test/Transforms/InstCombine/isdigit-1.ll
index f291296c8826..6791307aeaee 100644
--- a/test/Transforms/InstCombine/isdigit-1.ll
+++ b/test/Transforms/InstCombine/isdigit-1.ll
@@ -9,35 +9,35 @@ declare i32 @isdigit(i32)
; Check isdigit(c) -> (c - '0') <u 10;
define i32 @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%ret = call i32 @isdigit(i32 47)
ret i32 %ret
; CHECK-NEXT: ret i32 0
}
define i32 @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%ret = call i32 @isdigit(i32 48)
ret i32 %ret
; CHECK-NEXT: ret i32 1
}
define i32 @test_simplify3() {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%ret = call i32 @isdigit(i32 57)
ret i32 %ret
; CHECK-NEXT: ret i32 1
}
define i32 @test_simplify4() {
-; CHECK: @test_simplify4
+; CHECK-LABEL: @test_simplify4(
%ret = call i32 @isdigit(i32 58)
ret i32 %ret
; CHECK-NEXT: ret i32 0
}
define i32 @test_simplify5(i32 %x) {
-; CHECK: @test_simplify5
+; CHECK-LABEL: @test_simplify5(
%ret = call i32 @isdigit(i32 %x)
; CHECK-NEXT: [[ADD:%[a-z0-9]+]] = add i32 %x, -48
diff --git a/test/Transforms/InstCombine/lit.local.cfg b/test/Transforms/InstCombine/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/InstCombine/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/InstCombine/load-cmp.ll b/test/Transforms/InstCombine/load-cmp.ll
index 869215cb58d4..98100263b48c 100644
--- a/test/Transforms/InstCombine/load-cmp.ll
+++ b/test/Transforms/InstCombine/load-cmp.ll
@@ -1,18 +1,75 @@
-; RUN: opt < %s -instcombine -S | FileCheck %s
+; RUN: opt -instcombine -S < %s | FileCheck -check-prefix=NODL %s
+; RUN: opt -instcombine -S -default-data-layout="p:32:32:32-p1:16:16:16-n8:16:32:64" < %s | FileCheck -check-prefix=P32 %s
-@G16 = internal constant [10 x i16] [i16 35, i16 82, i16 69, i16 81, i16 85,
+@G16 = internal constant [10 x i16] [i16 35, i16 82, i16 69, i16 81, i16 85,
i16 73, i16 82, i16 69, i16 68, i16 0]
+
+@G16_as1 = internal addrspace(1) constant [10 x i16] [i16 35, i16 82, i16 69, i16 81, i16 85,
+ i16 73, i16 82, i16 69, i16 68, i16 0]
+
@GD = internal constant [6 x double]
[double -10.0, double 1.0, double 4.0, double 2.0, double -20.0, double -40.0]
+%Foo = type { i32, i32, i32, i32 }
+
+@GS = internal constant %Foo { i32 1, i32 4, i32 9, i32 14 }
+
+@GStructArr = internal constant [4 x %Foo] [ %Foo { i32 1, i32 4, i32 9, i32 14 },
+ %Foo { i32 5, i32 4, i32 6, i32 11 },
+ %Foo { i32 6, i32 5, i32 9, i32 20 },
+ %Foo { i32 12, i32 3, i32 9, i32 8 } ]
+
+
define i1 @test1(i32 %X) {
%P = getelementptr inbounds [10 x i16]* @G16, i32 0, i32 %X
%Q = load i16* %P
%R = icmp eq i16 %Q, 0
ret i1 %R
-; CHECK: @test1
-; CHECK-NEXT: %R = icmp eq i32 %X, 9
-; CHECK-NEXT: ret i1 %R
+; NODL-LABEL: @test1(
+; NODL-NEXT: %R = icmp eq i32 %X, 9
+; NODL-NEXT: ret i1 %R
+
+; P32-LABEL: @test1(
+; P32-NEXT: %R = icmp eq i32 %X, 9
+; P32-NEXT: ret i1 %R
+}
+
+define i1 @test1_noinbounds(i32 %X) {
+ %P = getelementptr [10 x i16]* @G16, i32 0, i32 %X
+ %Q = load i16* %P
+ %R = icmp eq i16 %Q, 0
+ ret i1 %R
+; NODL-LABEL: @test1_noinbounds(
+; NODL-NEXT: %P = getelementptr [10 x i16]* @G16, i32 0, i32 %X
+
+; P32-LABEL: @test1_noinbounds(
+; P32-NEXT: %R = icmp eq i32 %X, 9
+; P32-NEXT: ret i1 %R
+}
+
+define i1 @test1_noinbounds_i64(i64 %X) {
+ %P = getelementptr [10 x i16]* @G16, i64 0, i64 %X
+ %Q = load i16* %P
+ %R = icmp eq i16 %Q, 0
+ ret i1 %R
+; NODL-LABEL: @test1_noinbounds_i64(
+; NODL-NEXT: %P = getelementptr [10 x i16]* @G16, i64 0, i64 %X
+
+; P32-LABEL: @test1_noinbounds_i64(
+; P32: %R = icmp eq i32 %1, 9
+; P32-NEXT: ret i1 %R
+}
+
+define i1 @test1_noinbounds_as1(i32 %x) {
+ %p = getelementptr [10 x i16] addrspace(1)* @G16_as1, i16 0, i32 %x
+ %q = load i16 addrspace(1)* %p
+ %r = icmp eq i16 %q, 0
+ ret i1 %r
+
+; P32-LABEL: @test1_noinbounds_as1(
+; P32-NEXT: trunc i32 %x to i16
+; P32-NEXT: %r = icmp eq i16 %1, 9
+; P32-NEXT: ret i1 %r
}
define i1 @test2(i32 %X) {
@@ -20,9 +77,9 @@ define i1 @test2(i32 %X) {
%Q = load i16* %P
%R = icmp slt i16 %Q, 85
ret i1 %R
-; CHECK: @test2
-; CHECK-NEXT: %R = icmp ne i32 %X, 4
-; CHECK-NEXT: ret i1 %R
+; NODL-LABEL: @test2(
+; NODL-NEXT: %R = icmp ne i32 %X, 4
+; NODL-NEXT: ret i1 %R
}
define i1 @test3(i32 %X) {
@@ -30,9 +87,14 @@ define i1 @test3(i32 %X) {
%Q = load double* %P
%R = fcmp oeq double %Q, 1.0
ret i1 %R
-; CHECK: @test3
-; CHECK-NEXT: %R = icmp eq i32 %X, 1
-; CHECK-NEXT: ret i1 %R
+; NODL-LABEL: @test3(
+; NODL-NEXT: %R = icmp eq i32 %X, 1
+; NODL-NEXT: ret i1 %R
+
+; P32-LABEL: @test3(
+; P32-NEXT: %R = icmp eq i32 %X, 1
+; P32-NEXT: ret i1 %R
+
}
define i1 @test4(i32 %X) {
@@ -40,11 +102,17 @@ define i1 @test4(i32 %X) {
%Q = load i16* %P
%R = icmp sle i16 %Q, 73
ret i1 %R
-; CHECK: @test4
-; CHECK-NEXT: lshr i32 933, %X
-; CHECK-NEXT: and i32 {{.*}}, 1
-; CHECK-NEXT: %R = icmp ne i32 {{.*}}, 0
-; CHECK-NEXT: ret i1 %R
+; NODL-LABEL: @test4(
+; NODL-NEXT: lshr i32 933, %X
+; NODL-NEXT: and i32 {{.*}}, 1
+; NODL-NEXT: %R = icmp ne i32 {{.*}}, 0
+; NODL-NEXT: ret i1 %R
+
+; P32-LABEL: @test4(
+; P32-NEXT: lshr i32 933, %X
+; P32-NEXT: and i32 {{.*}}, 1
+; P32-NEXT: %R = icmp ne i32 {{.*}}, 0
+; P32-NEXT: ret i1 %R
}
define i1 @test4_i16(i16 %X) {
@@ -52,11 +120,19 @@ define i1 @test4_i16(i16 %X) {
%Q = load i16* %P
%R = icmp sle i16 %Q, 73
ret i1 %R
-; CHECK: @test4_i16
-; CHECK-NEXT: lshr i16 933, %X
-; CHECK-NEXT: and i16 {{.*}}, 1
-; CHECK-NEXT: %R = icmp ne i16 {{.*}}, 0
-; CHECK-NEXT: ret i1 %R
+
+; NODL-LABEL: @test4_i16(
+; NODL-NEXT: lshr i16 933, %X
+; NODL-NEXT: and i16 {{.*}}, 1
+; NODL-NEXT: %R = icmp ne i16 {{.*}}, 0
+; NODL-NEXT: ret i1 %R
+
+; P32-LABEL: @test4_i16(
+; P32-NEXT: sext i16 %X to i32
+; P32-NEXT: lshr i32 933, %1
+; P32-NEXT: and i32 {{.*}}, 1
+; P32-NEXT: %R = icmp ne i32 {{.*}}, 0
+; P32-NEXT: ret i1 %R
}
define i1 @test5(i32 %X) {
@@ -64,11 +140,17 @@ define i1 @test5(i32 %X) {
%Q = load i16* %P
%R = icmp eq i16 %Q, 69
ret i1 %R
-; CHECK: @test5
-; CHECK-NEXT: icmp eq i32 %X, 2
-; CHECK-NEXT: icmp eq i32 %X, 7
-; CHECK-NEXT: %R = or i1
-; CHECK-NEXT: ret i1 %R
+; NODL-LABEL: @test5(
+; NODL-NEXT: icmp eq i32 %X, 2
+; NODL-NEXT: icmp eq i32 %X, 7
+; NODL-NEXT: %R = or i1
+; NODL-NEXT: ret i1 %R
+
+; P32-LABEL: @test5(
+; P32-NEXT: icmp eq i32 %X, 2
+; P32-NEXT: icmp eq i32 %X, 7
+; P32-NEXT: %R = or i1
+; P32-NEXT: ret i1 %R
}
define i1 @test6(i32 %X) {
@@ -76,10 +158,15 @@ define i1 @test6(i32 %X) {
%Q = load double* %P
%R = fcmp ogt double %Q, 0.0
ret i1 %R
-; CHECK: @test6
-; CHECK-NEXT: add i32 %X, -1
-; CHECK-NEXT: %R = icmp ult i32 {{.*}}, 3
-; CHECK-NEXT: ret i1 %R
+; NODL-LABEL: @test6(
+; NODL-NEXT: add i32 %X, -1
+; NODL-NEXT: %R = icmp ult i32 {{.*}}, 3
+; NODL-NEXT: ret i1 %R
+
+; P32-LABEL: @test6(
+; P32-NEXT: add i32 %X, -1
+; P32-NEXT: %R = icmp ult i32 {{.*}}, 3
+; P32-NEXT: ret i1 %R
}
define i1 @test7(i32 %X) {
@@ -87,10 +174,15 @@ define i1 @test7(i32 %X) {
%Q = load double* %P
%R = fcmp olt double %Q, 0.0
ret i1 %R
-; CHECK: @test7
-; CHECK-NEXT: add i32 %X, -1
-; CHECK-NEXT: %R = icmp ugt i32 {{.*}}, 2
-; CHECK-NEXT: ret i1 %R
+; NODL-LABEL: @test7(
+; NODL-NEXT: add i32 %X, -1
+; NODL-NEXT: %R = icmp ugt i32 {{.*}}, 2
+; NODL-NEXT: ret i1 %R
+
+; P32-LABEL: @test7(
+; P32-NEXT: add i32 %X, -1
+; P32-NEXT: %R = icmp ugt i32 {{.*}}, 2
+; P32-NEXT: ret i1 %R
}
define i1 @test8(i32 %X) {
@@ -99,10 +191,15 @@ define i1 @test8(i32 %X) {
%R = and i16 %Q, 3
%S = icmp eq i16 %R, 0
ret i1 %S
-; CHECK: @test8
-; CHECK-NEXT: and i32 %X, -2
-; CHECK-NEXT: icmp eq i32 {{.*}}, 8
-; CHECK-NEXT: ret i1
+; NODL-LABEL: @test8(
+; NODL-NEXT: and i32 %X, -2
+; NODL-NEXT: icmp eq i32 {{.*}}, 8
+; NODL-NEXT: ret i1
+
+; P32-LABEL: @test8(
+; P32-NEXT: and i32 %X, -2
+; P32-NEXT: icmp eq i32 {{.*}}, 8
+; P32-NEXT: ret i1
}
@GA = internal constant [4 x { i32, i32 } ] [
@@ -117,8 +214,161 @@ define i1 @test9(i32 %X) {
%Q = load i32* %P
%R = icmp eq i32 %Q, 1
ret i1 %R
-; CHECK: @test9
-; CHECK-NEXT: add i32 %X, -1
-; CHECK-NEXT: icmp ult i32 {{.*}}, 2
-; CHECK-NEXT: ret i1
+; NODL-LABEL: @test9(
+; NODL-NEXT: add i32 %X, -1
+; NODL-NEXT: icmp ult i32 {{.*}}, 2
+; NODL-NEXT: ret i1
+
+; P32-LABEL: @test9(
+; P32-NEXT: add i32 %X, -1
+; P32-NEXT: icmp ult i32 {{.*}}, 2
+; P32-NEXT: ret i1
+}
+
+define i1 @test10_struct(i32 %x) {
+; NODL-LABEL: @test10_struct(
+; NODL: getelementptr inbounds %Foo* @GS, i32 %x, i32 0
+
+; P32-LABEL: @test10_struct(
+; P32: getelementptr inbounds %Foo* @GS, i32 %x, i32 0
+ %p = getelementptr inbounds %Foo* @GS, i32 %x, i32 0
+ %q = load i32* %p
+ %r = icmp eq i32 %q, 9
+ ret i1 %r
+}
+
+define i1 @test10_struct_noinbounds(i32 %x) {
+; NODL-LABEL: @test10_struct_noinbounds(
+; NODL: getelementptr %Foo* @GS, i32 %x, i32 0
+
+; P32-LABEL: @test10_struct_noinbounds(
+; P32: getelementptr %Foo* @GS, i32 %x, i32 0
+ %p = getelementptr %Foo* @GS, i32 %x, i32 0
+ %q = load i32* %p
+ %r = icmp eq i32 %q, 9
+ ret i1 %r
+}
+
+; Test that the GEP indices are converted before we ever get here
+; Index < ptr size
+define i1 @test10_struct_i16(i16 %x){
+; NODL-LABEL: @test10_struct_i16(
+; NODL: getelementptr inbounds %Foo* @GS, i16 %x, i32 0
+
+; P32-LABEL: @test10_struct_i16(
+; P32: %1 = sext i16 %x to i32
+; P32: getelementptr inbounds %Foo* @GS, i32 %1, i32 0
+ %p = getelementptr inbounds %Foo* @GS, i16 %x, i32 0
+ %q = load i32* %p
+ %r = icmp eq i32 %q, 0
+ ret i1 %r
+}
+
+; Test that the GEP indices are converted before we ever get here
+; Index > ptr size
+define i1 @test10_struct_i64(i64 %x){
+; NODL-LABEL: @test10_struct_i64(
+; NODL: getelementptr inbounds %Foo* @GS, i64 %x, i32 0
+
+; P32-LABEL: @test10_struct_i64(
+; P32: %1 = trunc i64 %x to i32
+; P32: getelementptr inbounds %Foo* @GS, i32 %1, i32 0
+ %p = getelementptr inbounds %Foo* @GS, i64 %x, i32 0
+ %q = load i32* %p
+ %r = icmp eq i32 %q, 0
+ ret i1 %r
+}
+
+define i1 @test10_struct_noinbounds_i16(i16 %x) {
+; NODL-LABEL: @test10_struct_noinbounds_i16(
+; NODL: getelementptr %Foo* @GS, i16 %x, i32 0
+
+; P32-LABEL: @test10_struct_noinbounds_i16(
+; P32: %1 = sext i16 %x to i32
+; P32: getelementptr %Foo* @GS, i32 %1, i32 0
+ %p = getelementptr %Foo* @GS, i16 %x, i32 0
+ %q = load i32* %p
+ %r = icmp eq i32 %q, 0
+ ret i1 %r
+}
+
+define i1 @test10_struct_arr(i32 %x) {
+; NODL-LABEL: @test10_struct_arr(
+; NODL-NEXT: %r = icmp ne i32 %x, 1
+; NODL-NEXT: ret i1 %r
+
+; P32-LABEL: @test10_struct_arr(
+; P32-NEXT: %r = icmp ne i32 %x, 1
+; P32-NEXT: ret i1 %r
+ %p = getelementptr inbounds [4 x %Foo]* @GStructArr, i32 0, i32 %x, i32 2
+ %q = load i32* %p
+ %r = icmp eq i32 %q, 9
+ ret i1 %r
+}
+
+define i1 @test10_struct_arr_noinbounds(i32 %x) {
+; NODL-LABEL: @test10_struct_arr_noinbounds(
+; NODL-NEXT %p = getelementptr [4 x %Foo]* @GStructArr, i32 0, i32 %x, i32 2
+
+; P32-LABEL: @test10_struct_arr_noinbounds(
+; P32-NEXT %p = getelementptr [4 x %Foo]* @GStructArr, i32 0, i32 %x, i32 2
+ %p = getelementptr [4 x %Foo]* @GStructArr, i32 0, i32 %x, i32 2
+ %q = load i32* %p
+ %r = icmp eq i32 %q, 9
+ ret i1 %r
+}
+
+define i1 @test10_struct_arr_i16(i16 %x) {
+; NODL-LABEL: @test10_struct_arr_i16(
+; NODL-NEXT: %r = icmp ne i16 %x, 1
+; NODL-NEXT: ret i1 %r
+
+; P32-LABEL: @test10_struct_arr_i16(
+; P32-NEXT: %r = icmp ne i16 %x, 1
+; P32-NEXT: ret i1 %r
+ %p = getelementptr inbounds [4 x %Foo]* @GStructArr, i16 0, i16 %x, i32 2
+ %q = load i32* %p
+ %r = icmp eq i32 %q, 9
+ ret i1 %r
+}
+
+define i1 @test10_struct_arr_i64(i64 %x) {
+; NODL-LABEL: @test10_struct_arr_i64(
+; NODL-NEXT: %r = icmp ne i64 %x, 1
+; NODL-NEXT: ret i1 %r
+
+; P32-LABEL: @test10_struct_arr_i64(
+; P32-NEXT: trunc i64 %x to i32
+; P32-NEXT: %r = icmp ne i32 %1, 1
+; P32-NEXT: ret i1 %r
+ %p = getelementptr inbounds [4 x %Foo]* @GStructArr, i64 0, i64 %x, i32 2
+ %q = load i32* %p
+ %r = icmp eq i32 %q, 9
+ ret i1 %r
+}
+
+define i1 @test10_struct_arr_noinbounds_i16(i16 %x) {
+; NODL-LABEL: @test10_struct_arr_noinbounds_i16(
+; NODL-NEXT: %p = getelementptr [4 x %Foo]* @GStructArr, i32 0, i16 %x, i32 2
+
+; P32-LABEL: @test10_struct_arr_noinbounds_i16(
+; P32-NEXT: %r = icmp ne i16 %x, 1
+ %p = getelementptr [4 x %Foo]* @GStructArr, i32 0, i16 %x, i32 2
+ %q = load i32* %p
+ %r = icmp eq i32 %q, 9
+ ret i1 %r
+}
+
+define i1 @test10_struct_arr_noinbounds_i64(i64 %x) {
+; FIXME: Should be no trunc?
+; NODL-LABEL: @test10_struct_arr_noinbounds_i64(
+; NODL-NEXT: %p = getelementptr [4 x %Foo]* @GStructArr, i32 0, i64 %x, i32 2
+
+; P32-LABEL: @test10_struct_arr_noinbounds_i64(
+; P32: %r = icmp ne i32 %1, 1
+; P32-NEXT: ret i1 %r
+ %p = getelementptr [4 x %Foo]* @GStructArr, i32 0, i64 %x, i32 2
+ %q = load i32* %p
+ %r = icmp eq i32 %q, 9
+ ret i1 %r
}
diff --git a/test/Transforms/InstCombine/load-select.ll b/test/Transforms/InstCombine/load-select.ll
index f3d83dc8210e..e8cbad335dea 100644
--- a/test/Transforms/InstCombine/load-select.ll
+++ b/test/Transforms/InstCombine/load-select.ll
@@ -5,7 +5,7 @@ target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-
@a = constant [2 x i32] [i32 3, i32 6] ; <[2 x i32]*> [#uses=2]
define i32 @b(i32 %y) nounwind readonly {
-; CHECK: @b
+; CHECK-LABEL: @b(
; CHECK-NOT: load
; CHECK: ret i32
entry:
diff --git a/test/Transforms/InstCombine/load3.ll b/test/Transforms/InstCombine/load3.ll
index db74426783c1..f79ef9a695c2 100644
--- a/test/Transforms/InstCombine/load3.ll
+++ b/test/Transforms/InstCombine/load3.ll
@@ -11,7 +11,7 @@ define i32 @test1(i32* %p) {
%x = load i32* %t1
%a = sub i32 %y, %x
ret i32 %a
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret i32 0
}
@@ -22,7 +22,7 @@ define float @test2() {
%tmp = load float* bitcast ([4 x i8]* @.str to float*), align 1
ret float %tmp
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: ret float 0x3806965600000000
}
@@ -41,6 +41,6 @@ define void @test3() nounwind {
store i32 %l, i32* getelementptr ([36 x i32]* @rslts32, i32 29826161, i32 28), align 4
ret void
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: store i32 1, i32* getelementptr inbounds ([36 x i32]* @rslts32, i32 0, i32 0)
}
diff --git a/test/Transforms/InstCombine/malloc-free-delete.ll b/test/Transforms/InstCombine/malloc-free-delete.ll
index cd12b29b1186..208520653848 100644
--- a/test/Transforms/InstCombine/malloc-free-delete.ll
+++ b/test/Transforms/InstCombine/malloc-free-delete.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
; PR1201
define i32 @main(i32 %argc, i8** %argv) {
-; CHECK: @main
+; CHECK-LABEL: @main(
%c_19 = alloca i8*
%malloc_206 = tail call i8* @malloc(i32 mul (i32 ptrtoint (i8* getelementptr (i8* null, i32 1) to i32), i32 10))
store i8* %malloc_206, i8** %c_19
@@ -16,7 +16,7 @@ declare noalias i8* @malloc(i32)
declare void @free(i8*)
define i1 @foo() {
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK-NEXT: ret i1 false
%m = call i8* @malloc(i32 1)
%z = icmp eq i8* %m, null
@@ -32,7 +32,7 @@ declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32,
declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1) nounwind
define void @test3(i8* %src) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: ret void
%a = call noalias i8* @malloc(i32 10)
call void @llvm.lifetime.start(i64 10, i8* %a)
@@ -49,7 +49,7 @@ define void @test3(i8* %src) {
;; This used to crash.
define void @test4() {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NEXT: ret void
%A = call i8* @malloc(i32 16000)
%B = bitcast i8* %A to double*
@@ -58,7 +58,7 @@ define void @test4() {
ret void
}
-; CHECK: @test5
+; CHECK-LABEL: @test5(
define void @test5(i8* %ptr, i8** %esc) {
; CHECK-NEXT: call i8* @malloc
; CHECK-NEXT: call i8* @malloc
@@ -98,7 +98,7 @@ define void @test5(i8* %ptr, i8** %esc) {
;; Using simplifycfg will remove the empty basic block and the branch operation
;; Then, performing a dead elimination will remove the comparison.
;; This is what happens with -O1 and upper.
-; CHECK: @test6
+; CHECK-LABEL: @test6(
define void @test6(i8* %foo) minsize {
; CHECK: %tobool = icmp eq i8* %foo, null
;; Call to free moved
@@ -120,3 +120,27 @@ if.then: ; preds = %entry
if.end: ; preds = %entry, %if.then
ret void
}
+
+declare i8* @_ZnwmRKSt9nothrow_t(i64, i8*) nobuiltin
+declare void @_ZdlPvRKSt9nothrow_t(i8*, i8*) nobuiltin
+declare i32 @__gxx_personality_v0(...)
+declare void @_ZN1AC2Ev(i8* %this)
+
+; CHECK-LABEL: @test7(
+define void @test7() {
+entry:
+ %nt = alloca i8
+ ; CHECK-NOT: call {{.*}}@_ZnwmRKSt9nothrow_t(
+ %call.i = tail call i8* @_ZnwmRKSt9nothrow_t(i64 1, i8* %nt) builtin nounwind
+ invoke void @_ZN1AC2Ev(i8* undef)
+ to label %.noexc.i unwind label %lpad.i
+
+.noexc.i: ; preds = %entry
+ unreachable
+
+lpad.i: ; preds = %entry
+ %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) cleanup
+ ; CHECK-NOT: call {{.*}}@_ZdlPvRKSt9nothrow_t(
+ call void @_ZdlPvRKSt9nothrow_t(i8* %call.i, i8* %nt) builtin nounwind
+ resume { i8*, i32 } %0
+}
diff --git a/test/Transforms/InstCombine/memcmp-1.ll b/test/Transforms/InstCombine/memcmp-1.ll
index c97b201fc0e9..65349c6e6906 100644
--- a/test/Transforms/InstCombine/memcmp-1.ll
+++ b/test/Transforms/InstCombine/memcmp-1.ll
@@ -13,7 +13,7 @@ declare i32 @memcmp(i8*, i8*, i32)
; Check memcmp(mem, mem, size) -> 0.
define i32 @test_simplify1(i8* %mem, i32 %size) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%ret = call i32 @memcmp(i8* %mem, i8* %mem, i32 %size)
ret i32 %ret
; CHECK: ret i32 0
@@ -22,7 +22,7 @@ define i32 @test_simplify1(i8* %mem, i32 %size) {
; Check memcmp(mem1, mem2, 0) -> 0.
define i32 @test_simplify2(i8* %mem1, i8* %mem2) {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%ret = call i32 @memcmp(i8* %mem1, i8* %mem2, i32 0)
ret i32 %ret
; CHECK: ret i32 0
@@ -31,7 +31,7 @@ define i32 @test_simplify2(i8* %mem1, i8* %mem2) {
;; Check memcmp(mem1, mem2, 1) -> *(unsigned char*)mem1 - *(unsigned char*)mem2.
define i32 @test_simplify3(i8* %mem1, i8* %mem2) {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%ret = call i32 @memcmp(i8* %mem1, i8* %mem2, i32 1)
; CHECK: [[LOAD1:%[a-z]+]] = load i8* %mem1, align 1
; CHECK: [[ZEXT1:%[a-z]+]] = zext i8 [[LOAD1]] to i32
@@ -45,7 +45,7 @@ define i32 @test_simplify3(i8* %mem1, i8* %mem2) {
; Check memcmp(mem1, mem2, size) -> cnst, where all arguments are constants.
define i32 @test_simplify4() {
-; CHECK: @test_simplify4
+; CHECK-LABEL: @test_simplify4(
%mem1 = getelementptr [4 x i8]* @hel, i32 0, i32 0
%mem2 = getelementptr [8 x i8]* @hello_u, i32 0, i32 0
%ret = call i32 @memcmp(i8* %mem1, i8* %mem2, i32 3)
@@ -54,7 +54,7 @@ define i32 @test_simplify4() {
}
define i32 @test_simplify5() {
-; CHECK: @test_simplify5
+; CHECK-LABEL: @test_simplify5(
%mem1 = getelementptr [4 x i8]* @hel, i32 0, i32 0
%mem2 = getelementptr [4 x i8]* @foo, i32 0, i32 0
%ret = call i32 @memcmp(i8* %mem1, i8* %mem2, i32 3)
@@ -63,7 +63,7 @@ define i32 @test_simplify5() {
}
define i32 @test_simplify6() {
-; CHECK: @test_simplify6
+; CHECK-LABEL: @test_simplify6(
%mem1 = getelementptr [4 x i8]* @foo, i32 0, i32 0
%mem2 = getelementptr [4 x i8]* @hel, i32 0, i32 0
%ret = call i32 @memcmp(i8* %mem1, i8* %mem2, i32 3)
diff --git a/test/Transforms/InstCombine/memcmp-2.ll b/test/Transforms/InstCombine/memcmp-2.ll
index 3796117bc24c..bed62eb3fb95 100644
--- a/test/Transforms/InstCombine/memcmp-2.ll
+++ b/test/Transforms/InstCombine/memcmp-2.ll
@@ -9,7 +9,7 @@ declare i32* @memcmp(i8*, i8*, i32)
; Check that memcmp functions with the wrong prototype aren't simplified.
define i32* @test_no_simplify1(i8* %mem, i32 %size) {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%ret = call i32* @memcmp(i8* %mem, i8* %mem, i32 %size)
; CHECK-NEXT: call i32* @memcmp
ret i32* %ret
diff --git a/test/Transforms/InstCombine/memcpy-1.ll b/test/Transforms/InstCombine/memcpy-1.ll
index 65b79ad03df4..9efbcc8283d2 100644
--- a/test/Transforms/InstCombine/memcpy-1.ll
+++ b/test/Transforms/InstCombine/memcpy-1.ll
@@ -9,7 +9,7 @@ declare i8* @memcpy(i8*, i8*, i32)
; Check memcpy(mem1, mem2, size) -> llvm.memcpy(mem1, mem2, size, 1).
define i8* @test_simplify1(i8* %mem1, i8* %mem2, i32 %size) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%ret = call i8* @memcpy(i8* %mem1, i8* %mem2, i32 %size)
; CHECK: call void @llvm.memcpy
ret i8* %ret
diff --git a/test/Transforms/InstCombine/memcpy-2.ll b/test/Transforms/InstCombine/memcpy-2.ll
index 4a8a02018f5e..a31854c01758 100644
--- a/test/Transforms/InstCombine/memcpy-2.ll
+++ b/test/Transforms/InstCombine/memcpy-2.ll
@@ -9,7 +9,7 @@ declare i8 @memcpy(i8*, i8*, i32)
; Check that memcpy functions with the wrong prototype aren't simplified.
define i8 @test_no_simplify1(i8* %mem1, i8* %mem2, i32 %size) {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%ret = call i8 @memcpy(i8* %mem1, i8* %mem2, i32 %size)
; CHECK: call i8 @memcpy
ret i8 %ret
diff --git a/test/Transforms/InstCombine/memcpy-from-global.ll b/test/Transforms/InstCombine/memcpy-from-global.ll
index 557b160a8785..58793ab431d1 100644
--- a/test/Transforms/InstCombine/memcpy-from-global.ll
+++ b/test/Transforms/InstCombine/memcpy-from-global.ll
@@ -8,7 +8,7 @@ entry:
%lookupTable1 = bitcast [128 x float]* %lookupTable to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %lookupTable1, i8* bitcast ([128 x float]* @C.0.1248 to i8*), i64 512, i32 16, i1 false)
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NOT: alloca
; CHECK-NOT: call{{.*}}@llvm.memcpy
@@ -50,7 +50,7 @@ define void @test2() {
%a = bitcast %T* %A to i8*
%b = bitcast %T* %B to i8*
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; %A alloca is deleted
; CHECK-NEXT: alloca [124 x i8]
@@ -73,7 +73,7 @@ define void @test3() {
%a = bitcast %T* %A to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* bitcast (%T* @G to i8*), i64 124, i32 4, i1 false)
call void @bar(i8* %a) readonly
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: call void @bar(i8* getelementptr inbounds (%T* @G, i64 0, i32 0))
ret void
}
@@ -83,7 +83,7 @@ define void @test4() {
%a = bitcast %T* %A to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* bitcast (%T* @G to i8*), i64 124, i32 4, i1 false)
call void @baz(i8* byval %a)
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NEXT: call void @baz(i8* byval getelementptr inbounds (%T* @G, i64 0, i32 0))
ret void
}
@@ -95,7 +95,7 @@ define void @test5() {
call void @llvm.lifetime.start(i64 -1, i8* %a)
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* bitcast (%T* @G to i8*), i64 124, i32 4, i1 false)
call void @baz(i8* byval %a)
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NEXT: call void @baz(i8* byval getelementptr inbounds (%T* @G, i64 0, i32 0))
ret void
}
@@ -109,7 +109,7 @@ define void @test6() {
%a = bitcast %U* %A to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* bitcast ([2 x %U]* @H to i8*), i64 20, i32 16, i1 false)
call void @bar(i8* %a) readonly
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NEXT: call void @bar(i8* bitcast ([2 x %U]* @H to i8*))
ret void
}
@@ -119,7 +119,7 @@ define void @test7() {
%a = bitcast %U* %A to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* bitcast (%U* getelementptr ([2 x %U]* @H, i64 0, i32 0) to i8*), i64 20, i32 4, i1 false)
call void @bar(i8* %a) readonly
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NEXT: call void @bar(i8* bitcast ([2 x %U]* @H to i8*))
ret void
}
@@ -129,7 +129,7 @@ define void @test8() {
%a = bitcast %U* %A to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* bitcast (%U* getelementptr ([2 x %U]* @H, i64 0, i32 1) to i8*), i64 20, i32 4, i1 false)
call void @bar(i8* %a) readonly
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: llvm.memcpy
; CHECK: bar
ret void
@@ -140,7 +140,7 @@ define void @test9() {
%a = bitcast %U* %A to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* bitcast (%U* getelementptr ([2 x %U]* @H, i64 0, i32 1) to i8*), i64 20, i32 4, i1 false)
call void @bar(i8* %a) readonly
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK-NEXT: call void @bar(i8* bitcast (%U* getelementptr inbounds ([2 x %U]* @H, i64 0, i64 1) to i8*))
ret void
}
diff --git a/test/Transforms/InstCombine/memcpy.ll b/test/Transforms/InstCombine/memcpy.ll
index 3a68ff95af82..f66e14c95af7 100644
--- a/test/Transforms/InstCombine/memcpy.ll
+++ b/test/Transforms/InstCombine/memcpy.ll
@@ -6,7 +6,7 @@ declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32,
define void @test1(i8* %a) {
tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i32 1, i1 false)
ret void
-; CHECK: define void @test1
+; CHECK-LABEL: define void @test1(
; CHECK-NEXT: ret void
}
@@ -15,13 +15,13 @@ define void @test1(i8* %a) {
define void @test2(i8* %a) {
tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i32 1, i1 true)
ret void
-; CHECK: define void @test2
+; CHECK-LABEL: define void @test2(
; CHECK-NEXT: call void @llvm.memcpy
}
define void @test3(i8* %d, i8* %s) {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %d, i8* %s, i64 17179869184, i32 4, i1 false)
ret void
-; CHECK: define void @test3
+; CHECK-LABEL: define void @test3(
; CHECK-NEXT: call void @llvm.memcpy
}
diff --git a/test/Transforms/InstCombine/memcpy_chk-1.ll b/test/Transforms/InstCombine/memcpy_chk-1.ll
index 7c7d91808a37..9216ae7fe95a 100644
--- a/test/Transforms/InstCombine/memcpy_chk-1.ll
+++ b/test/Transforms/InstCombine/memcpy_chk-1.ll
@@ -16,7 +16,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; Check cases where dstlen >= len.
define void @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%dst = bitcast %struct.T1* @t1 to i8*
%src = bitcast %struct.T2* @t2 to i8*
@@ -26,7 +26,7 @@ define void @test_simplify1() {
}
define void @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%dst = bitcast %struct.T1* @t1 to i8*
%src = bitcast %struct.T3* @t3 to i8*
@@ -38,7 +38,7 @@ define void @test_simplify2() {
; Check cases where dstlen < len.
define void @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%dst = bitcast %struct.T3* @t3 to i8*
%src = bitcast %struct.T1* @t1 to i8*
@@ -48,7 +48,7 @@ define void @test_no_simplify1() {
}
define void @test_no_simplify2() {
-; CHECK: @test_no_simplify2
+; CHECK-LABEL: @test_no_simplify2(
%dst = bitcast %struct.T1* @t1 to i8*
%src = bitcast %struct.T2* @t2 to i8*
diff --git a/test/Transforms/InstCombine/memcpy_chk-2.ll b/test/Transforms/InstCombine/memcpy_chk-2.ll
index aa43029d47fc..320b54f82dc6 100644
--- a/test/Transforms/InstCombine/memcpy_chk-2.ll
+++ b/test/Transforms/InstCombine/memcpy_chk-2.ll
@@ -12,7 +12,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
@t2 = common global %struct.T2 zeroinitializer
define void @test_no_simplify() {
-; CHECK: @test_no_simplify
+; CHECK-LABEL: @test_no_simplify(
%dst = bitcast %struct.T1* @t1 to i8*
%src = bitcast %struct.T2* @t2 to i8*
diff --git a/test/Transforms/InstCombine/memmove-1.ll b/test/Transforms/InstCombine/memmove-1.ll
index 53f2f116c777..0445a60aeddb 100644
--- a/test/Transforms/InstCombine/memmove-1.ll
+++ b/test/Transforms/InstCombine/memmove-1.ll
@@ -9,7 +9,7 @@ declare i8* @memmove(i8*, i8*, i32)
; Check memmove(mem1, mem2, size) -> llvm.memmove(mem1, mem2, size, 1).
define i8* @test_simplify1(i8* %mem1, i8* %mem2, i32 %size) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%ret = call i8* @memmove(i8* %mem1, i8* %mem2, i32 %size)
; CHECK: call void @llvm.memmove
ret i8* %ret
diff --git a/test/Transforms/InstCombine/memmove-2.ll b/test/Transforms/InstCombine/memmove-2.ll
index 23887bce31d8..b20e96bc5555 100644
--- a/test/Transforms/InstCombine/memmove-2.ll
+++ b/test/Transforms/InstCombine/memmove-2.ll
@@ -9,7 +9,7 @@ declare i8 @memmove(i8*, i8*, i32)
; Check that memmove functions with the wrong prototype aren't simplified.
define i8 @test_no_simplify1(i8* %mem1, i8* %mem2, i32 %size) {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%ret = call i8 @memmove(i8* %mem1, i8* %mem2, i32 %size)
; CHECK: call i8 @memmove
ret i8 %ret
diff --git a/test/Transforms/InstCombine/memmove_chk-1.ll b/test/Transforms/InstCombine/memmove_chk-1.ll
index f9ff9a103a30..6d93bbbf959e 100644
--- a/test/Transforms/InstCombine/memmove_chk-1.ll
+++ b/test/Transforms/InstCombine/memmove_chk-1.ll
@@ -16,7 +16,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; Check cases where dstlen >= len.
define void @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%dst = bitcast %struct.T1* @t1 to i8*
%src = bitcast %struct.T2* @t2 to i8*
@@ -26,7 +26,7 @@ define void @test_simplify1() {
}
define void @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%dst = bitcast %struct.T1* @t1 to i8*
%src = bitcast %struct.T3* @t3 to i8*
@@ -38,7 +38,7 @@ define void @test_simplify2() {
; Check cases where dstlen < len.
define void @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%dst = bitcast %struct.T3* @t3 to i8*
%src = bitcast %struct.T1* @t1 to i8*
@@ -48,7 +48,7 @@ define void @test_no_simplify1() {
}
define void @test_no_simplify2() {
-; CHECK: @test_no_simplify2
+; CHECK-LABEL: @test_no_simplify2(
%dst = bitcast %struct.T1* @t1 to i8*
%src = bitcast %struct.T2* @t2 to i8*
diff --git a/test/Transforms/InstCombine/memmove_chk-2.ll b/test/Transforms/InstCombine/memmove_chk-2.ll
index f0a915fde2e9..adadf905a588 100644
--- a/test/Transforms/InstCombine/memmove_chk-2.ll
+++ b/test/Transforms/InstCombine/memmove_chk-2.ll
@@ -12,7 +12,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
@t2 = common global %struct.T2 zeroinitializer
define void @test_no_simplify() {
-; CHECK: @test_no_simplify
+; CHECK-LABEL: @test_no_simplify(
%dst = bitcast %struct.T1* @t1 to i8*
%src = bitcast %struct.T2* @t2 to i8*
diff --git a/test/Transforms/InstCombine/memset-1.ll b/test/Transforms/InstCombine/memset-1.ll
index 48b433e137c0..991567d6b597 100644
--- a/test/Transforms/InstCombine/memset-1.ll
+++ b/test/Transforms/InstCombine/memset-1.ll
@@ -9,7 +9,7 @@ declare i8* @memset(i8*, i32, i32)
; Check memset(mem1, val, size) -> llvm.memset(mem1, val, size, 1).
define i8* @test_simplify1(i8* %mem, i32 %val, i32 %size) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%ret = call i8* @memset(i8* %mem, i32 %val, i32 %size)
; CHECK: call void @llvm.memset
ret i8* %ret
diff --git a/test/Transforms/InstCombine/memset-2.ll b/test/Transforms/InstCombine/memset-2.ll
index 8a9033302d04..5e446cb0ee00 100644
--- a/test/Transforms/InstCombine/memset-2.ll
+++ b/test/Transforms/InstCombine/memset-2.ll
@@ -9,7 +9,7 @@ declare i8 @memset(i8*, i32, i32)
; Check that memset functions with the wrong prototype aren't simplified.
define i8 @test_no_simplify1(i8* %mem, i32 %val, i32 %size) {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%ret = call i8 @memset(i8* %mem, i32 %val, i32 %size)
; CHECK: call i8 @memset
ret i8 %ret
diff --git a/test/Transforms/InstCombine/memset_chk-1.ll b/test/Transforms/InstCombine/memset_chk-1.ll
index be4c1cfccdb2..47cc7db998e4 100644
--- a/test/Transforms/InstCombine/memset_chk-1.ll
+++ b/test/Transforms/InstCombine/memset_chk-1.ll
@@ -12,7 +12,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; Check cases where dstlen >= len.
define void @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%dst = bitcast %struct.T* @t to i8*
; CHECK-NEXT: call void @llvm.memset.p0i8.i64
@@ -21,7 +21,7 @@ define void @test_simplify1() {
}
define void @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%dst = bitcast %struct.T* @t to i8*
; CHECK-NEXT: call void @llvm.memset.p0i8.i64
@@ -30,7 +30,7 @@ define void @test_simplify2() {
}
define void @test_simplify3() {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%dst = bitcast %struct.T* @t to i8*
; CHECK-NEXT: call void @llvm.memset.p0i8.i64
@@ -41,7 +41,7 @@ define void @test_simplify3() {
; Check cases where dstlen < len.
define void @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%dst = bitcast %struct.T* @t to i8*
; CHECK-NEXT: call i8* @__memset_chk
@@ -50,7 +50,7 @@ define void @test_no_simplify1() {
}
define void @test_no_simplify2() {
-; CHECK: @test_no_simplify2
+; CHECK-LABEL: @test_no_simplify2(
%dst = bitcast %struct.T* @t to i8*
; CHECK-NEXT: call i8* @__memset_chk
diff --git a/test/Transforms/InstCombine/memset_chk-2.ll b/test/Transforms/InstCombine/memset_chk-2.ll
index 60fbf163c212..bb4f772785e3 100644
--- a/test/Transforms/InstCombine/memset_chk-2.ll
+++ b/test/Transforms/InstCombine/memset_chk-2.ll
@@ -9,7 +9,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
@t = common global %struct.T zeroinitializer
define void @test_no_simplify() {
-; CHECK: @test_no_simplify
+; CHECK-LABEL: @test_no_simplify(
%dst = bitcast %struct.T* @t to i8*
; CHECK-NEXT: call i8* @__memset_chk
diff --git a/test/Transforms/InstCombine/merge-icmp.ll b/test/Transforms/InstCombine/merge-icmp.ll
index 00020b157e0f..b021fe0429a5 100644
--- a/test/Transforms/InstCombine/merge-icmp.ll
+++ b/test/Transforms/InstCombine/merge-icmp.ll
@@ -8,7 +8,7 @@ define i1 @test1(i16* %x) {
%cmp2 = icmp eq i16 %and, 17664
%or = and i1 %cmp1, %cmp2
ret i1 %or
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: load i16
; CHECK-NEXT: icmp eq i16 %load, 17791
; CHECK-NEXT: ret i1
@@ -22,7 +22,7 @@ define i1 @test2(i16* %x) {
%cmp2 = icmp eq i8 %trunc, 69
%or = and i1 %cmp1, %cmp2
ret i1 %or
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: load i16
; CHECK-NEXT: icmp eq i16 %load, 32581
; CHECK-NEXT: ret i1
diff --git a/test/Transforms/InstCombine/mul.ll b/test/Transforms/InstCombine/mul.ll
index 16213b8628ca..94fc1183c55a 100644
--- a/test/Transforms/InstCombine/mul.ll
+++ b/test/Transforms/InstCombine/mul.ll
@@ -2,14 +2,14 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
define i32 @test1(i32 %A) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
%B = mul i32 %A, 1 ; <i32> [#uses=1]
ret i32 %B
; CHECK: ret i32 %A
}
define i32 @test2(i32 %A) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; Should convert to an add instruction
%B = mul i32 %A, 2 ; <i32> [#uses=1]
ret i32 %B
@@ -17,7 +17,7 @@ define i32 @test2(i32 %A) {
}
define i32 @test3(i32 %A) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; This should disappear entirely
%B = mul i32 %A, 0 ; <i32> [#uses=1]
ret i32 %B
@@ -25,7 +25,7 @@ define i32 @test3(i32 %A) {
}
define double @test4(double %A) {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; This is safe for FP
%B = fmul double 1.000000e+00, %A ; <double> [#uses=1]
ret double %B
@@ -33,14 +33,14 @@ define double @test4(double %A) {
}
define i32 @test5(i32 %A) {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
%B = mul i32 %A, 8 ; <i32> [#uses=1]
ret i32 %B
; CHECK: shl i32 %A, 3
}
define i8 @test6(i8 %A) {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
%B = mul i8 %A, 8 ; <i8> [#uses=1]
%C = mul i8 %B, 8 ; <i8> [#uses=1]
ret i8 %C
@@ -48,28 +48,28 @@ define i8 @test6(i8 %A) {
}
define i32 @test7(i32 %i) {
-; CHECK: @test7
+; CHECK-LABEL: @test7(
%tmp = mul i32 %i, -1 ; <i32> [#uses=1]
ret i32 %tmp
; CHECK: sub i32 0, %i
}
define i64 @test8(i64 %i) {
-; CHECK: @test8
+; CHECK-LABEL: @test8(
%j = mul i64 %i, -1 ; <i64> [#uses=1]
ret i64 %j
; CHECK: sub i64 0, %i
}
define i32 @test9(i32 %i) {
-; CHECK: @test9
+; CHECK-LABEL: @test9(
%j = mul i32 %i, -1 ; <i32> [#uses=1]
ret i32 %j
; CHECK: sub i32 0, %i
}
define i32 @test10(i32 %a, i32 %b) {
-; CHECK: @test10
+; CHECK-LABEL: @test10(
%c = icmp slt i32 %a, 0 ; <i1> [#uses=1]
%d = zext i1 %c to i32 ; <i32> [#uses=1]
; e = b & (a >> 31)
@@ -81,7 +81,7 @@ define i32 @test10(i32 %a, i32 %b) {
}
define i32 @test11(i32 %a, i32 %b) {
-; CHECK: @test11
+; CHECK-LABEL: @test11(
%c = icmp sle i32 %a, -1 ; <i1> [#uses=1]
%d = zext i1 %c to i32 ; <i32> [#uses=1]
; e = b & (a >> 31)
@@ -93,7 +93,7 @@ define i32 @test11(i32 %a, i32 %b) {
}
define i32 @test12(i32 %a, i32 %b) {
-; CHECK: @test12
+; CHECK-LABEL: @test12(
%c = icmp ugt i32 %a, 2147483647 ; <i1> [#uses=1]
%d = zext i1 %c to i32 ; <i32> [#uses=1]
%e = mul i32 %d, %b ; <i32> [#uses=1]
@@ -106,7 +106,7 @@ define i32 @test12(i32 %a, i32 %b) {
; PR2642
define internal void @test13(<4 x float>*) {
-; CHECK: @test13
+; CHECK-LABEL: @test13(
load <4 x float>* %0, align 1
fmul <4 x float> %2, < float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00 >
store <4 x float> %3, <4 x float>* %0, align 1
@@ -115,7 +115,7 @@ define internal void @test13(<4 x float>*) {
}
define <16 x i8> @test14(<16 x i8> %a) {
-; CHECK: @test14
+; CHECK-LABEL: @test14(
%b = mul <16 x i8> %a, zeroinitializer
ret <16 x i8> %b
; CHECK-NEXT: ret <16 x i8> zeroinitializer
@@ -123,7 +123,7 @@ define <16 x i8> @test14(<16 x i8> %a) {
; rdar://7293527
define i32 @test15(i32 %A, i32 %B) {
-; CHECK: @test15
+; CHECK-LABEL: @test15(
entry:
%shl = shl i32 1, %B
%m = mul i32 %shl, %A
@@ -133,7 +133,7 @@ entry:
; X * Y (when Y is 0 or 1) --> x & (0-Y)
define i32 @test16(i32 %b, i1 %c) {
-; CHECK: @test16
+; CHECK-LABEL: @test16(
%d = zext i1 %c to i32 ; <i32> [#uses=1]
; e = b & (a >> 31)
%e = mul i32 %d, %b ; <i32> [#uses=1]
@@ -144,7 +144,7 @@ define i32 @test16(i32 %b, i1 %c) {
; X * Y (when Y is 0 or 1) --> x & (0-Y)
define i32 @test17(i32 %a, i32 %b) {
-; CHECK: @test17
+; CHECK-LABEL: @test17(
%a.lobit = lshr i32 %a, 31
%e = mul i32 %a.lobit, %b
ret i32 %e
@@ -154,7 +154,7 @@ define i32 @test17(i32 %a, i32 %b) {
}
define i32 @test18(i32 %A, i32 %B) {
-; CHECK: @test18
+; CHECK-LABEL: @test18(
%C = and i32 %A, 1
%D = and i32 %B, 1
@@ -168,7 +168,7 @@ declare {i32, i1} @llvm.smul.with.overflow.i32(i32, i32)
declare void @use(i1)
define i32 @test19(i32 %A, i32 %B) {
-; CHECK: @test19
+; CHECK-LABEL: @test19(
%C = and i32 %A, 1
%D = and i32 %B, 1
diff --git a/test/Transforms/InstCombine/multi-size-address-space-pointer.ll b/test/Transforms/InstCombine/multi-size-address-space-pointer.ll
new file mode 100644
index 000000000000..2d88bed4e7bf
--- /dev/null
+++ b/test/Transforms/InstCombine/multi-size-address-space-pointer.ll
@@ -0,0 +1,112 @@
+; RUN: opt -S -instcombine %s -o - | FileCheck %s
+target datalayout = "e-p:32:32:32-p1:64:64:64-p2:8:8:8-p3:16:16:16-p4:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32"
+
+
+define i32 @test_as0(i32 addrspace(0)* %a) {
+; CHECK-LABEL: @test_as0(
+; CHECK: %arrayidx = getelementptr i32* %a, i32 1
+ %arrayidx = getelementptr i32 addrspace(0)* %a, i64 1
+ %y = load i32 addrspace(0)* %arrayidx, align 4
+ ret i32 %y
+}
+
+define i32 @test_as1(i32 addrspace(1)* %a) {
+; CHECK-LABEL: @test_as1(
+; CHECK: %arrayidx = getelementptr i32 addrspace(1)* %a, i64 1
+ %arrayidx = getelementptr i32 addrspace(1)* %a, i32 1
+ %y = load i32 addrspace(1)* %arrayidx, align 4
+ ret i32 %y
+}
+
+define i32 @test_as2(i32 addrspace(2)* %a) {
+; CHECK-LABEL: @test_as2(
+; CHECK: %arrayidx = getelementptr i32 addrspace(2)* %a, i8 1
+ %arrayidx = getelementptr i32 addrspace(2)* %a, i32 1
+ %y = load i32 addrspace(2)* %arrayidx, align 4
+ ret i32 %y
+}
+
+define i32 @test_as3(i32 addrspace(3)* %a) {
+; CHECK-LABEL: @test_as3(
+; CHECK: %arrayidx = getelementptr i32 addrspace(3)* %a, i16 1
+ %arrayidx = getelementptr i32 addrspace(3)* %a, i32 1
+ %y = load i32 addrspace(3)* %arrayidx, align 4
+ ret i32 %y
+}
+
+define i32 @test_combine_ptrtoint(i32 addrspace(2)* %a) {
+; CHECK-LABEL: @test_combine_ptrtoint(
+; CHECK-NEXT: %y = load i32 addrspace(2)* %a
+; CHECK-NEXT: ret i32 %y
+ %cast = ptrtoint i32 addrspace(2)* %a to i8
+ %castback = inttoptr i8 %cast to i32 addrspace(2)*
+ %y = load i32 addrspace(2)* %castback, align 4
+ ret i32 %y
+}
+
+define i8 @test_combine_inttoptr(i8 %a) {
+; CHECK-LABEL: @test_combine_inttoptr(
+; CHECK-NEXT: ret i8 %a
+ %cast = inttoptr i8 %a to i32 addrspace(2)*
+ %castback = ptrtoint i32 addrspace(2)* %cast to i8
+ ret i8 %castback
+}
+
+define i32 @test_combine_vector_ptrtoint(<2 x i32 addrspace(2)*> %a) {
+; CHECK-LABEL: @test_combine_vector_ptrtoint(
+; CHECK-NEXT: %p = extractelement <2 x i32 addrspace(2)*> %a, i32 0
+; CHECK-NEXT: %y = load i32 addrspace(2)* %p, align 4
+; CHECK-NEXT: ret i32 %y
+ %cast = ptrtoint <2 x i32 addrspace(2)*> %a to <2 x i8>
+ %castback = inttoptr <2 x i8> %cast to <2 x i32 addrspace(2)*>
+ %p = extractelement <2 x i32 addrspace(2)*> %castback, i32 0
+ %y = load i32 addrspace(2)* %p, align 4
+ ret i32 %y
+}
+
+define <2 x i8> @test_combine_vector_inttoptr(<2 x i8> %a) {
+; CHECK-LABEL: @test_combine_vector_inttoptr(
+; CHECK-NEXT: ret <2 x i8> %a
+ %cast = inttoptr <2 x i8> %a to <2 x i32 addrspace(2)*>
+ %castback = ptrtoint <2 x i32 addrspace(2)*> %cast to <2 x i8>
+ ret <2 x i8> %castback
+}
+
+; Check that the GEP index is changed to the address space integer type (i64 -> i8)
+define i32 addrspace(2)* @shrink_gep_constant_index_64_as2(i32 addrspace(2)* %p) {
+; CHECK-LABEL: @shrink_gep_constant_index_64_as2(
+; CHECK-NEXT: getelementptr i32 addrspace(2)* %p, i8 1
+ %ret = getelementptr i32 addrspace(2)* %p, i64 1
+ ret i32 addrspace(2)* %ret
+}
+
+define i32 addrspace(2)* @shrink_gep_constant_index_32_as2(i32 addrspace(2)* %p) {
+; CHECK-LABEL: @shrink_gep_constant_index_32_as2(
+; CHECK-NEXT: getelementptr i32 addrspace(2)* %p, i8 1
+ %ret = getelementptr i32 addrspace(2)* %p, i32 1
+ ret i32 addrspace(2)* %ret
+}
+
+define i32 addrspace(3)* @shrink_gep_constant_index_64_as3(i32 addrspace(3)* %p) {
+; CHECK-LABEL: @shrink_gep_constant_index_64_as3(
+; CHECK-NEXT: getelementptr i32 addrspace(3)* %p, i16 1
+ %ret = getelementptr i32 addrspace(3)* %p, i64 1
+ ret i32 addrspace(3)* %ret
+}
+
+define i32 addrspace(2)* @shrink_gep_variable_index_64_as2(i32 addrspace(2)* %p, i64 %idx) {
+; CHECK-LABEL: @shrink_gep_variable_index_64_as2(
+; CHECK-NEXT: %1 = trunc i64 %idx to i8
+; CHECK-NEXT: getelementptr i32 addrspace(2)* %p, i8 %1
+ %ret = getelementptr i32 addrspace(2)* %p, i64 %idx
+ ret i32 addrspace(2)* %ret
+}
+
+define i32 addrspace(1)* @grow_gep_variable_index_8_as1(i32 addrspace(1)* %p, i8 %idx) {
+; CHECK-LABEL: @grow_gep_variable_index_8_as1(
+; CHECK-NEXT: %1 = sext i8 %idx to i64
+; CHECK-NEXT: getelementptr i32 addrspace(1)* %p, i64 %1
+ %ret = getelementptr i32 addrspace(1)* %p, i8 %idx
+ ret i32 addrspace(1)* %ret
+}
+
diff --git a/test/Transforms/InstCombine/no-negzero.ll b/test/Transforms/InstCombine/no-negzero.ll
index f295130b0ea4..4ed283603446 100644
--- a/test/Transforms/InstCombine/no-negzero.ll
+++ b/test/Transforms/InstCombine/no-negzero.ll
@@ -4,7 +4,7 @@
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin9.8"
-; CHECK: @mysqrt
+; CHECK-LABEL: @mysqrt(
; CHECK-NOT: fadd
; CHECK: ret
define double @mysqrt(double %x) nounwind {
diff --git a/test/Transforms/InstCombine/nsw.ll b/test/Transforms/InstCombine/nsw.ll
index 0140c2f80122..0bed76717ce9 100644
--- a/test/Transforms/InstCombine/nsw.ll
+++ b/test/Transforms/InstCombine/nsw.ll
@@ -1,6 +1,6 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
-; CHECK: @sub1
+; CHECK-LABEL: @sub1(
; CHECK: %y = sub i32 0, %x
; CHECK: %z = sdiv i32 %y, 337
; CHECK: ret i32 %z
@@ -10,7 +10,7 @@ define i32 @sub1(i32 %x) {
ret i32 %z
}
-; CHECK: @sub2
+; CHECK-LABEL: @sub2(
; CHECK: %z = sdiv i32 %x, -337
; CHECK: ret i32 %z
define i32 @sub2(i32 %x) {
@@ -19,7 +19,7 @@ define i32 @sub2(i32 %x) {
ret i32 %z
}
-; CHECK: @shl_icmp
+; CHECK-LABEL: @shl_icmp(
; CHECK: %B = icmp eq i64 %X, 0
; CHECK: ret i1 %B
define i1 @shl_icmp(i64 %X) nounwind {
@@ -28,7 +28,7 @@ define i1 @shl_icmp(i64 %X) nounwind {
ret i1 %B
}
-; CHECK: @shl1
+; CHECK-LABEL: @shl1(
; CHECK: %B = shl nuw nsw i64 %A, 8
; CHECK: ret i64 %B
define i64 @shl1(i64 %X, i64* %P) nounwind {
@@ -38,7 +38,7 @@ define i64 @shl1(i64 %X, i64* %P) nounwind {
ret i64 %B
}
-; CHECK: @preserve1
+; CHECK-LABEL: @preserve1(
; CHECK: add nsw i32 %x, 5
define i32 @preserve1(i32 %x) nounwind {
%add = add nsw i32 %x, 2
@@ -46,7 +46,7 @@ define i32 @preserve1(i32 %x) nounwind {
ret i32 %add3
}
-; CHECK: @nopreserve1
+; CHECK-LABEL: @nopreserve1(
; CHECK: add i8 %x, -126
define i8 @nopreserve1(i8 %x) nounwind {
%add = add nsw i8 %x, 127
@@ -54,7 +54,7 @@ define i8 @nopreserve1(i8 %x) nounwind {
ret i8 %add3
}
-; CHECK: @nopreserve2
+; CHECK-LABEL: @nopreserve2(
; CHECK: add i8 %x, 3
define i8 @nopreserve2(i8 %x) nounwind {
%add = add i8 %x, 1
@@ -62,7 +62,7 @@ define i8 @nopreserve2(i8 %x) nounwind {
ret i8 %add3
}
-; CHECK: @nopreserve3
+; CHECK-LABEL: @nopreserve3(
; CHECK: add i8 %A, %B
; CHECK: add i8
define i8 @nopreserve3(i8 %A, i8 %B) nounwind {
@@ -72,7 +72,7 @@ define i8 @nopreserve3(i8 %A, i8 %B) nounwind {
ret i8 %add
}
-; CHECK: @nopreserve4
+; CHECK-LABEL: @nopreserve4(
; CHECK: add i8 %A, %B
; CHECK: add i8
define i8 @nopreserve4(i8 %A, i8 %B) nounwind {
diff --git a/test/Transforms/InstCombine/objsize-64.ll b/test/Transforms/InstCombine/objsize-64.ll
index 530e1234b4a6..5046724038a3 100644
--- a/test/Transforms/InstCombine/objsize-64.ll
+++ b/test/Transforms/InstCombine/objsize-64.ll
@@ -7,7 +7,7 @@ declare i32 @__gxx_personality_v0(...)
declare void @__cxa_call_unexpected(i8*)
declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readonly
-; CHECK: @f1
+; CHECK-LABEL: @f1(
define i64 @f1(i8 **%esc) {
%call = call i8* @malloc(i32 4)
store i8* %call, i8** %esc
@@ -17,7 +17,7 @@ define i64 @f1(i8 **%esc) {
}
-; CHECK: @f2
+; CHECK-LABEL: @f2(
define i64 @f2(i8** %esc) nounwind uwtable ssp {
entry:
; CHECK: invoke noalias i8* @_Znwm(i64 13)
diff --git a/test/Transforms/InstCombine/objsize-address-space.ll b/test/Transforms/InstCombine/objsize-address-space.ll
new file mode 100644
index 000000000000..9cb688423960
--- /dev/null
+++ b/test/Transforms/InstCombine/objsize-address-space.ll
@@ -0,0 +1,80 @@
+; RUN: opt -S -instcombine -o - %s | FileCheck %s
+target datalayout = "e-p:32:32:32-p1:64:64:64-p2:8:8:8-p3:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32"
+
+declare i32 @llvm.objectsize.i32.p0i8(i8*, i1) nounwind readonly
+declare i32 @llvm.objectsize.i32.p1i8(i8 addrspace(1)*, i1) nounwind readonly
+declare i32 @llvm.objectsize.i32.p2i8(i8 addrspace(2)*, i1) nounwind readonly
+declare i32 @llvm.objectsize.i32.p3i8(i8 addrspace(3)*, i1) nounwind readonly
+declare i16 @llvm.objectsize.i16.p3i8(i8 addrspace(3)*, i1) nounwind readonly
+
+@array_as2 = private addrspace(2) global [60 x i8] zeroinitializer, align 4
+
+@array_as1_pointers = private global [10 x i32 addrspace(1)*] zeroinitializer, align 4
+@array_as2_pointers = private global [24 x i32 addrspace(2)*] zeroinitializer, align 4
+@array_as3_pointers = private global [42 x i32 addrspace(3)*] zeroinitializer, align 4
+
+@array_as2_as1_pointer_pointers = private global [16 x i32 addrspace(2)* addrspace(1)*] zeroinitializer, align 4
+
+
+@a_as3 = private addrspace(3) global [60 x i8] zeroinitializer, align 1
+
+define i32 @foo_as3() nounwind {
+; CHECK-LABEL: @foo_as3(
+; CHECK-NEXT: ret i32 60
+ %1 = call i32 @llvm.objectsize.i32.p3i8(i8 addrspace(3)* getelementptr inbounds ([60 x i8] addrspace(3)* @a_as3, i32 0, i32 0), i1 false)
+ ret i32 %1
+}
+
+define i16 @foo_as3_i16() nounwind {
+; CHECK-LABEL: @foo_as3_i16(
+; CHECK-NEXT: ret i16 60
+ %1 = call i16 @llvm.objectsize.i16.p3i8(i8 addrspace(3)* getelementptr inbounds ([60 x i8] addrspace(3)* @a_as3, i32 0, i32 0), i1 false)
+ ret i16 %1
+}
+
+@a_alias = alias weak [60 x i8] addrspace(3)* @a_as3
+define i32 @foo_alias() nounwind {
+ %1 = call i32 @llvm.objectsize.i32.p3i8(i8 addrspace(3)* getelementptr inbounds ([60 x i8] addrspace(3)* @a_alias, i32 0, i32 0), i1 false)
+ ret i32 %1
+}
+
+define i32 @array_as2_size() {
+; CHECK-LABEL: @array_as2_size(
+; CHECK-NEXT: ret i32 60
+ %bc = bitcast [60 x i8] addrspace(2)* @array_as2 to i8 addrspace(2)*
+ %1 = call i32 @llvm.objectsize.i32.p2i8(i8 addrspace(2)* %bc, i1 false)
+ ret i32 %1
+}
+
+define i32 @pointer_array_as1() {
+; CHECK-LABEL: @pointer_array_as1(
+; CHECK-NEXT: ret i32 80
+ %bc = addrspacecast [10 x i32 addrspace(1)*]* @array_as1_pointers to i8 addrspace(1)*
+ %1 = call i32 @llvm.objectsize.i32.p1i8(i8 addrspace(1)* %bc, i1 false)
+ ret i32 %1
+}
+
+define i32 @pointer_array_as2() {
+; CHECK-LABEL: @pointer_array_as2(
+; CHECK-NEXT: ret i32 24
+ %bc = bitcast [24 x i32 addrspace(2)*]* @array_as2_pointers to i8*
+ %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %bc, i1 false)
+ ret i32 %1
+}
+
+define i32 @pointer_array_as3() {
+; CHECK-LABEL: @pointer_array_as3(
+; CHECK-NEXT: ret i32 84
+ %bc = bitcast [42 x i32 addrspace(3)*]* @array_as3_pointers to i8*
+ %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %bc, i1 false)
+ ret i32 %1
+}
+
+define i32 @pointer_pointer_array_as2_as1() {
+; CHECK-LABEL: @pointer_pointer_array_as2_as1(
+; CHECK-NEXT: ret i32 128
+ %bc = bitcast [16 x i32 addrspace(2)* addrspace(1)*]* @array_as2_as1_pointer_pointers to i8*
+ %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %bc, i1 false)
+ ret i32 %1
+}
+
diff --git a/test/Transforms/InstCombine/objsize.ll b/test/Transforms/InstCombine/objsize.ll
index 122c6501a3f5..645903299c86 100644
--- a/test/Transforms/InstCombine/objsize.ll
+++ b/test/Transforms/InstCombine/objsize.ll
@@ -5,19 +5,18 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
@a = private global [60 x i8] zeroinitializer, align 1 ; <[60 x i8]*>
@.str = private constant [8 x i8] c"abcdefg\00" ; <[8 x i8]*>
-
define i32 @foo() nounwind {
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK-NEXT: ret i32 60
- %1 = call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i1 false)
+ %1 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i1 false)
ret i32 %1
}
define i8* @bar() nounwind {
-; CHECK: @bar
+; CHECK-LABEL: @bar(
entry:
%retval = alloca i8*
- %0 = call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i1 false)
+ %0 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i1 false)
%cmp = icmp ne i32 %0, -1
; CHECK: br i1 true
br i1 %cmp, label %cond.true, label %cond.false
@@ -32,27 +31,27 @@ cond.false:
}
define i32 @f() nounwind {
-; CHECK: @f
+; CHECK-LABEL: @f(
; CHECK-NEXT: ret i32 0
- %1 = call i32 @llvm.objectsize.i32(i8* getelementptr ([60 x i8]* @a, i32 1, i32 0), i1 false)
+ %1 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr ([60 x i8]* @a, i32 1, i32 0), i1 false)
ret i32 %1
}
@window = external global [0 x i8]
define i1 @baz() nounwind {
-; CHECK: @baz
+; CHECK-LABEL: @baz(
; CHECK-NEXT: objectsize
- %1 = tail call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([0 x i8]* @window, i32 0, i32 0), i1 false)
+ %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([0 x i8]* @window, i32 0, i32 0), i1 false)
%2 = icmp eq i32 %1, -1
ret i1 %2
}
define void @test1(i8* %q, i32 %x) nounwind noinline {
-; CHECK: @test1
-; CHECK: objectsize.i32
+; CHECK-LABEL: @test1(
+; CHECK: objectsize.i32.p0i8
entry:
- %0 = call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([0 x i8]* @window, i32 0, i32 10), i1 false) ; <i64> [#uses=1]
+ %0 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([0 x i8]* @window, i32 0, i32 10), i1 false) ; <i64> [#uses=1]
%1 = icmp eq i32 %0, -1 ; <i1> [#uses=1]
br i1 %1, label %"47", label %"46"
@@ -66,9 +65,9 @@ entry:
@.str5 = private constant [9 x i32] [i32 97, i32 98, i32 99, i32 100, i32 0, i32
101, i32 102, i32 103, i32 0], align 4
define i32 @test2() nounwind {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: ret i32 34
- %1 = call i32 @llvm.objectsize.i32(i8* getelementptr (i8* bitcast ([9 x i32]* @.str5 to i8*), i32 2), i1 false)
+ %1 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr (i8* bitcast ([9 x i32]* @.str5 to i8*), i32 2), i1 false)
ret i32 %1
}
@@ -77,19 +76,19 @@ define i32 @test2() nounwind {
declare i8* @__memcpy_chk(i8*, i8*, i32, i32) nounwind
-declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly
+declare i32 @llvm.objectsize.i32.p0i8(i8*, i1) nounwind readonly
declare i8* @__inline_memcpy_chk(i8*, i8*, i32) nounwind inlinehint
define void @test3() nounwind {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
entry:
br i1 undef, label %bb11, label %bb12
bb11:
%0 = getelementptr inbounds float* getelementptr inbounds ([480 x float]* @array, i32 0, i32 128), i32 -127 ; <float*> [#uses=1]
%1 = bitcast float* %0 to i8* ; <i8*> [#uses=1]
- %2 = call i32 @llvm.objectsize.i32(i8* %1, i1 false) ; <i32> [#uses=1]
+ %2 = call i32 @llvm.objectsize.i32.p0i8(i8* %1, i1 false) ; <i32> [#uses=1]
%3 = call i8* @__memcpy_chk(i8* undef, i8* undef, i32 512, i32 %2) nounwind ; <i8*> [#uses=0]
; CHECK: unreachable
unreachable
@@ -107,11 +106,11 @@ bb12:
%struct.data = type { [100 x i32], [100 x i32], [1024 x i8] }
define i32 @test4(i8** %esc) nounwind ssp {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
entry:
%0 = alloca %struct.data, align 8
%1 = bitcast %struct.data* %0 to i8*
- %2 = call i32 @llvm.objectsize.i32(i8* %1, i1 false) nounwind
+ %2 = call i32 @llvm.objectsize.i32.p0i8(i8* %1, i1 false) nounwind
; CHECK-NOT: @llvm.objectsize
; CHECK: @llvm.memset.p0i8.i32(i8* %1, i8 0, i32 1824, i32 8, i1 false)
%3 = call i8* @__memset_chk(i8* %1, i32 0, i32 1824, i32 %2) nounwind
@@ -123,10 +122,10 @@ entry:
@s = external global i8*
define i8* @test5(i32 %n) nounwind ssp {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
entry:
%0 = tail call noalias i8* @malloc(i32 20) nounwind
- %1 = tail call i32 @llvm.objectsize.i32(i8* %0, i1 false)
+ %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %0, i1 false)
%2 = load i8** @s, align 8
; CHECK-NOT: @llvm.objectsize
; CHECK: @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* %1, i32 10, i32 1, i1 false)
@@ -135,10 +134,10 @@ entry:
}
define void @test6(i32 %n) nounwind ssp {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
entry:
%0 = tail call noalias i8* @malloc(i32 20) nounwind
- %1 = tail call i32 @llvm.objectsize.i32(i8* %0, i1 false)
+ %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %0, i1 false)
%2 = load i8** @s, align 8
; CHECK-NOT: @llvm.objectsize
; CHECK: @__memcpy_chk(i8* %0, i8* %1, i32 30, i32 20)
@@ -151,11 +150,11 @@ declare i8* @__memset_chk(i8*, i32, i32, i32) nounwind
declare noalias i8* @malloc(i32) nounwind
define i32 @test7(i8** %esc) {
-; CHECK: @test7
+; CHECK-LABEL: @test7(
%alloc = call noalias i8* @malloc(i32 48) nounwind
store i8* %alloc, i8** %esc
%gep = getelementptr inbounds i8* %alloc, i32 16
- %objsize = call i32 @llvm.objectsize.i32(i8* %gep, i1 false) nounwind readonly
+ %objsize = call i32 @llvm.objectsize.i32.p0i8(i8* %gep, i1 false) nounwind readonly
; CHECK: ret i32 32
ret i32 %objsize
}
@@ -163,11 +162,11 @@ define i32 @test7(i8** %esc) {
declare noalias i8* @calloc(i32, i32) nounwind
define i32 @test8(i8** %esc) {
-; CHECK: @test8
+; CHECK-LABEL: @test8(
%alloc = call noalias i8* @calloc(i32 5, i32 7) nounwind
store i8* %alloc, i8** %esc
%gep = getelementptr inbounds i8* %alloc, i32 5
- %objsize = call i32 @llvm.objectsize.i32(i8* %gep, i1 false) nounwind readonly
+ %objsize = call i32 @llvm.objectsize.i32.p0i8(i8* %gep, i1 false) nounwind readonly
; CHECK: ret i32 30
ret i32 %objsize
}
@@ -175,52 +174,52 @@ define i32 @test8(i8** %esc) {
declare noalias i8* @strdup(i8* nocapture) nounwind
declare noalias i8* @strndup(i8* nocapture, i32) nounwind
-; CHECK: @test9
+; CHECK-LABEL: @test9(
define i32 @test9(i8** %esc) {
%call = tail call i8* @strdup(i8* getelementptr inbounds ([8 x i8]* @.str, i64 0, i64 0)) nounwind
store i8* %call, i8** %esc, align 8
- %1 = tail call i32 @llvm.objectsize.i32(i8* %call, i1 true)
+ %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i1 true)
; CHECK: ret i32 8
ret i32 %1
}
-; CHECK: @test10
+; CHECK-LABEL: @test10(
define i32 @test10(i8** %esc) {
%call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8]* @.str, i64 0, i64 0), i32 3) nounwind
store i8* %call, i8** %esc, align 8
- %1 = tail call i32 @llvm.objectsize.i32(i8* %call, i1 true)
+ %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i1 true)
; CHECK: ret i32 4
ret i32 %1
}
-; CHECK: @test11
+; CHECK-LABEL: @test11(
define i32 @test11(i8** %esc) {
%call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8]* @.str, i64 0, i64 0), i32 7) nounwind
store i8* %call, i8** %esc, align 8
- %1 = tail call i32 @llvm.objectsize.i32(i8* %call, i1 true)
+ %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i1 true)
; CHECK: ret i32 8
ret i32 %1
}
-; CHECK: @test12
+; CHECK-LABEL: @test12(
define i32 @test12(i8** %esc) {
%call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8]* @.str, i64 0, i64 0), i32 8) nounwind
store i8* %call, i8** %esc, align 8
- %1 = tail call i32 @llvm.objectsize.i32(i8* %call, i1 true)
+ %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i1 true)
; CHECK: ret i32 8
ret i32 %1
}
-; CHECK: @test13
+; CHECK-LABEL: @test13(
define i32 @test13(i8** %esc) {
%call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8]* @.str, i64 0, i64 0), i32 57) nounwind
store i8* %call, i8** %esc, align 8
- %1 = tail call i32 @llvm.objectsize.i32(i8* %call, i1 true)
+ %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i1 true)
; CHECK: ret i32 8
ret i32 %1
}
-; CHECK: @PR13390
+; CHECK-LABEL: @PR13390(
define i32 @PR13390(i1 %bool, i8* %a) {
entry:
%cond = or i1 %bool, true
@@ -229,8 +228,8 @@ entry:
xpto:
%select = select i1 %bool, i8* %select, i8* %a
%select2 = select i1 %bool, i8* %a, i8* %select2
- %0 = tail call i32 @llvm.objectsize.i32(i8* %select, i1 true)
- %1 = tail call i32 @llvm.objectsize.i32(i8* %select2, i1 true)
+ %0 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %select, i1 true)
+ %1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %select2, i1 true)
%2 = add i32 %0, %1
; CHECK: ret i32 undef
ret i32 %2
@@ -239,7 +238,7 @@ return:
ret i32 42
}
-; CHECK: @PR13621
+; CHECK-LABEL: @PR13621(
define i32 @PR13621(i1 %bool) nounwind {
entry:
%cond = or i1 %bool, true
@@ -249,7 +248,7 @@ entry:
xpto:
%gep2 = getelementptr i8* %gep, i32 1
%gep = getelementptr i8* %gep2, i32 1
- %o = call i32 @llvm.objectsize.i32(i8* %gep, i1 true)
+ %o = call i32 @llvm.objectsize.i32.p0i8(i8* %gep, i1 true)
; CHECK: ret i32 undef
ret i32 %o
@@ -259,20 +258,21 @@ return:
@globalalias = alias internal [60 x i8]* @a
-; CHECK: @test18
+; CHECK-LABEL: @test18(
; CHECK-NEXT: ret i32 60
define i32 @test18() {
%bc = bitcast [60 x i8]* @globalalias to i8*
- %1 = call i32 @llvm.objectsize.i32(i8* %bc, i1 false)
+ %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %bc, i1 false)
ret i32 %1
}
@globalalias2 = alias weak [60 x i8]* @a
-; CHECK: @test19
+; CHECK-LABEL: @test19(
; CHECK: llvm.objectsize
define i32 @test19() {
%bc = bitcast [60 x i8]* @globalalias2 to i8*
- %1 = call i32 @llvm.objectsize.i32(i8* %bc, i1 false)
+ %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %bc, i1 false)
ret i32 %1
}
+
diff --git a/test/Transforms/InstCombine/onehot_merge.ll b/test/Transforms/InstCombine/onehot_merge.ll
new file mode 100644
index 000000000000..51f955c2c248
--- /dev/null
+++ b/test/Transforms/InstCombine/onehot_merge.ll
@@ -0,0 +1,35 @@
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+;CHECK: @and_consts
+;CHECK: and i32 %k, 12
+;CHECK: icmp ne i32 %0, 12
+;CHECK: ret
+define i1 @and_consts(i32 %k, i32 %c1, i32 %c2) {
+bb:
+ %tmp1 = and i32 4, %k
+ %tmp2 = icmp eq i32 %tmp1, 0
+ %tmp5 = and i32 8, %k
+ %tmp6 = icmp eq i32 %tmp5, 0
+ %or = or i1 %tmp2, %tmp6
+ ret i1 %or
+}
+
+;CHECK: @foo1_and
+;CHECK: shl i32 1, %c1
+;CHECK-NEXT: shl i32 1, %c2
+;CHECK-NEXT: or i32
+;CHECK-NEXT: and i32
+;CHECK-NEXT: icmp ne i32 %1, %0
+;CHECK: ret
+define i1 @foo1_and(i32 %k, i32 %c1, i32 %c2) {
+bb:
+ %tmp = shl i32 1, %c1
+ %tmp4 = shl i32 1, %c2
+ %tmp1 = and i32 %tmp, %k
+ %tmp2 = icmp eq i32 %tmp1, 0
+ %tmp5 = and i32 %tmp4, %k
+ %tmp6 = icmp eq i32 %tmp5, 0
+ %or = or i1 %tmp2, %tmp6
+ ret i1 %or
+}
+
diff --git a/test/Transforms/InstCombine/or-fcmp.ll b/test/Transforms/InstCombine/or-fcmp.ll
index 09a3c994d93e..29963f6c5c24 100644
--- a/test/Transforms/InstCombine/or-fcmp.ll
+++ b/test/Transforms/InstCombine/or-fcmp.ll
@@ -1,6 +1,6 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
-; CHECK: @t1
+; CHECK-LABEL: @t1(
define zeroext i8 @t1(float %x, float %y) nounwind {
%a = fcmp ueq float %x, %y ; <i1> [#uses=1]
%b = fcmp uno float %x, %y ; <i1> [#uses=1]
@@ -11,7 +11,7 @@ define zeroext i8 @t1(float %x, float %y) nounwind {
ret i8 %retval
}
-; CHECK: @t2
+; CHECK-LABEL: @t2(
define zeroext i8 @t2(float %x, float %y) nounwind {
%a = fcmp olt float %x, %y ; <i1> [#uses=1]
%b = fcmp oeq float %x, %y ; <i1> [#uses=1]
@@ -23,7 +23,7 @@ define zeroext i8 @t2(float %x, float %y) nounwind {
ret i8 %retval
}
-; CHECK: @t3
+; CHECK-LABEL: @t3(
define zeroext i8 @t3(float %x, float %y) nounwind {
%a = fcmp ult float %x, %y ; <i1> [#uses=1]
%b = fcmp uge float %x, %y ; <i1> [#uses=1]
@@ -33,7 +33,7 @@ define zeroext i8 @t3(float %x, float %y) nounwind {
ret i8 %retval
}
-; CHECK: @t4
+; CHECK-LABEL: @t4(
define zeroext i8 @t4(float %x, float %y) nounwind {
%a = fcmp ult float %x, %y ; <i1> [#uses=1]
%b = fcmp ugt float %x, %y ; <i1> [#uses=1]
@@ -45,7 +45,7 @@ define zeroext i8 @t4(float %x, float %y) nounwind {
ret i8 %retval
}
-; CHECK: @t5
+; CHECK-LABEL: @t5(
define zeroext i8 @t5(float %x, float %y) nounwind {
%a = fcmp olt float %x, %y ; <i1> [#uses=1]
%b = fcmp oge float %x, %y ; <i1> [#uses=1]
diff --git a/test/Transforms/InstCombine/or-xor.ll b/test/Transforms/InstCombine/or-xor.ll
index f496dd48c402..cec36f119a9a 100644
--- a/test/Transforms/InstCombine/or-xor.ll
+++ b/test/Transforms/InstCombine/or-xor.ll
@@ -5,7 +5,7 @@ define i32 @test1(i32 %x, i32 %y) nounwind {
%not = xor i32 %or, -1
%z = or i32 %x, %not
ret i32 %z
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: %y.not = xor i32 %y, -1
; CHECK-NEXT: %z = or i32 %y.not, %x
; CHECK-NEXT: ret i32 %z
@@ -16,7 +16,7 @@ define i32 @test2(i32 %x, i32 %y) nounwind {
%not = xor i32 %or, -1
%z = or i32 %y, %not
ret i32 %z
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: %x.not = xor i32 %x, -1
; CHECK-NEXT: %z = or i32 %x.not, %y
; CHECK-NEXT: ret i32 %z
@@ -27,7 +27,7 @@ define i32 @test3(i32 %x, i32 %y) nounwind {
%not = xor i32 %xor, -1
%z = or i32 %x, %not
ret i32 %z
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: %y.not = xor i32 %y, -1
; CHECK-NEXT: %z = or i32 %y.not, %x
; CHECK-NEXT: ret i32 %z
@@ -38,7 +38,7 @@ define i32 @test4(i32 %x, i32 %y) nounwind {
%not = xor i32 %xor, -1
%z = or i32 %y, %not
ret i32 %z
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NEXT: %x.not = xor i32 %x, -1
; CHECK-NEXT: %z = or i32 %x.not, %y
; CHECK-NEXT: ret i32 %z
@@ -49,7 +49,7 @@ define i32 @test5(i32 %x, i32 %y) nounwind {
%not = xor i32 %and, -1
%z = or i32 %x, %not
ret i32 %z
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NEXT: ret i32 -1
}
@@ -58,7 +58,7 @@ define i32 @test6(i32 %x, i32 %y) nounwind {
%not = xor i32 %and, -1
%z = or i32 %y, %not
ret i32 %z
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NEXT: ret i32 -1
}
@@ -66,7 +66,7 @@ define i32 @test7(i32 %x, i32 %y) nounwind {
%xor = xor i32 %x, %y
%z = or i32 %y, %xor
ret i32 %z
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NEXT: %z = or i32 %x, %y
; CHECK-NEXT: ret i32 %z
}
@@ -76,7 +76,7 @@ define i32 @test8(i32 %x, i32 %y) nounwind {
%xor = xor i32 %x, %not
%z = or i32 %y, %xor
ret i32 %z
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK-NEXT: %x.not = xor i32 %x, -1
; CHECK-NEXT: %z = or i32 %x.not, %y
; CHECK-NEXT: ret i32 %z
@@ -87,7 +87,7 @@ define i32 @test9(i32 %x, i32 %y) nounwind {
%xor = xor i32 %not, %y
%z = or i32 %x, %xor
ret i32 %z
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK-NEXT: %y.not = xor i32 %y, -1
; CHECK-NEXT: %z = or i32 %y.not, %x
; CHECK-NEXT: ret i32 %z
diff --git a/test/Transforms/InstCombine/or.ll b/test/Transforms/InstCombine/or.ll
index 7226bd93996f..1cd897ee90c6 100644
--- a/test/Transforms/InstCombine/or.ll
+++ b/test/Transforms/InstCombine/or.ll
@@ -6,49 +6,49 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
define i32 @test1(i32 %A) {
%B = or i32 %A, 0
ret i32 %B
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret i32 %A
}
define i32 @test2(i32 %A) {
%B = or i32 %A, -1
ret i32 %B
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: ret i32 -1
}
define i8 @test2a(i8 %A) {
%B = or i8 %A, -1
ret i8 %B
-; CHECK: @test2a
+; CHECK-LABEL: @test2a(
; CHECK: ret i8 -1
}
define i1 @test3(i1 %A) {
%B = or i1 %A, false
ret i1 %B
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: ret i1 %A
}
define i1 @test4(i1 %A) {
%B = or i1 %A, true
ret i1 %B
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: ret i1 true
}
define i1 @test5(i1 %A) {
%B = or i1 %A, %A
ret i1 %B
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: ret i1 %A
}
define i32 @test6(i32 %A) {
%B = or i32 %A, %A
ret i32 %B
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: ret i32 %A
}
@@ -57,7 +57,7 @@ define i32 @test7(i32 %A) {
%NotA = xor i32 -1, %A
%B = or i32 %A, %NotA
ret i32 %B
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: ret i32 -1
}
@@ -65,7 +65,7 @@ define i8 @test8(i8 %A) {
%B = or i8 %A, -2
%C = or i8 %B, 1
ret i8 %C
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: ret i8 -1
}
@@ -75,7 +75,7 @@ define i8 @test9(i8 %A, i8 %B) {
%D = or i8 %B, -2
%E = or i8 %C, %D
ret i8 %E
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK: ret i8 -1
}
@@ -85,7 +85,7 @@ define i8 @test10(i8 %A) {
; (X & C1) | C2 --> (X | C2) & (C1|C2)
%D = or i8 %C, -2
ret i8 %D
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK: ret i8 -2
}
@@ -96,7 +96,7 @@ define i8 @test11(i8 %A) {
%D = or i8 %C, 1
%E = xor i8 %D, 12
ret i8 %E
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK: ret i8 -1
}
@@ -105,7 +105,7 @@ define i32 @test12(i32 %A) {
%B = or i32 %A, 4
%C = and i32 %B, 8
ret i32 %C
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK: %C = and i32 %A, 8
; CHECK: ret i32 %C
}
@@ -115,7 +115,7 @@ define i32 @test13(i32 %A) {
; Always equal to 8
%C = and i32 %B, 8
ret i32 %C
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; CHECK: ret i32 8
}
@@ -125,7 +125,7 @@ define i1 @test14(i32 %A, i32 %B) {
; (A < B) | (A > B) === A != B
%D = or i1 %C1, %C2
ret i1 %D
-; CHECK: @test14
+; CHECK-LABEL: @test14(
; CHECK: icmp ne i32 %A, %B
; CHECK: ret i1
}
@@ -136,7 +136,7 @@ define i1 @test15(i32 %A, i32 %B) {
; (A < B) | (A == B) === A <= B
%D = or i1 %C1, %C2
ret i1 %D
-; CHECK: @test15
+; CHECK-LABEL: @test15(
; CHECK: icmp ule i32 %A, %B
; CHECK: ret i1
}
@@ -148,7 +148,7 @@ define i32 @test16(i32 %A) {
; %D = and int %B, -1 == %B
%D = or i32 %B, %C
ret i32 %D
-; CHECK: @test16
+; CHECK-LABEL: @test16(
; CHECK: ret i32 %A
}
@@ -158,7 +158,7 @@ define i32 @test17(i32 %A) {
; %D = and int %B, 5
%D = or i32 %B, %C
ret i32 %D
-; CHECK: @test17
+; CHECK-LABEL: @test17(
; CHECK: %D = and i32 %A, 5
; CHECK: ret i32 %D
}
@@ -169,7 +169,7 @@ define i1 @test18(i32 %A) {
;; (A-50) >u 50
%D = or i1 %B, %C
ret i1 %D
-; CHECK: @test18
+; CHECK-LABEL: @test18(
; CHECK: add i32
; CHECK: icmp ugt
; CHECK: ret i1
@@ -181,7 +181,7 @@ define i1 @test19(i32 %A) {
;; (A&-2) == 50
%D = or i1 %B, %C
ret i1 %D
-; CHECK: @test19
+; CHECK-LABEL: @test19(
; CHECK: and i32
; CHECK: icmp eq
; CHECK: ret i1
@@ -191,7 +191,7 @@ define i32 @test20(i32 %x) {
%y = and i32 %x, 123
%z = or i32 %y, %x
ret i32 %z
-; CHECK: @test20
+; CHECK-LABEL: @test20(
; CHECK: ret i32 %x
}
@@ -202,7 +202,7 @@ define i32 @test21(i32 %tmp.1) {
;; add tmp.1, 2
%tmp.6 = or i32 %tmp.5, %tmp.3
ret i32 %tmp.6
-; CHECK: @test21
+; CHECK-LABEL: @test21(
; CHECK: add i32 %{{[^,]*}}, 2
; CHECK: ret i32
}
@@ -212,7 +212,7 @@ define i32 @test22(i32 %B) {
%ELIM7 = and i32 %B, -2
%ELIM5 = or i32 %ELIM41, %ELIM7
ret i32 %ELIM5
-; CHECK: @test22
+; CHECK-LABEL: @test22(
; CHECK: ret i32 %B
}
@@ -222,7 +222,7 @@ define i16 @test23(i16 %A) {
%C = or i16 %B, -32768
%D = xor i16 %C, 8193
ret i16 %D
-; CHECK: @test23
+; CHECK-LABEL: @test23(
; CHECK: %B = lshr i16 %A, 1
; CHECK: %D = xor i16 %B, -24575
; CHECK: ret i16 %D
@@ -235,7 +235,7 @@ define i1 @test24(double %X, double %Y) {
%bothcond = or i1 %tmp13, %tmp9 ; <i1> [#uses=1]
ret i1 %bothcond
-; CHECK: @test24
+; CHECK-LABEL: @test24(
; CHECK: = fcmp uno double %Y, %X
; CHECK: ret i1
}
@@ -248,7 +248,7 @@ define i1 @test25(i32 %A, i32 %B) {
%F = xor i1 %E, -1
ret i1 %F
-; CHECK: @test25
+; CHECK-LABEL: @test25(
; CHECK: icmp ne i32 %A, 0
; CHECK-NEXT: icmp ne i32 %B, 57
; CHECK-NEXT: %F = and i1
@@ -262,7 +262,7 @@ define i1 @test26(i32 %A, i32 %B) {
; (A == 0) & (A == 0) --> (A|B) == 0
%D = and i1 %C1, %C2
ret i1 %D
-; CHECK: @test26
+; CHECK-LABEL: @test26(
; CHECK: or i32 %A, %B
; CHECK: icmp eq i32 {{.*}}, 0
; CHECK: ret i1
@@ -274,7 +274,7 @@ define i1 @test27(i32* %A, i32* %B) {
%D = or i32 %C1, %C2
%E = icmp eq i32 %D, 0
ret i1 %E
-; CHECK: @test27
+; CHECK-LABEL: @test27(
; CHECK: icmp eq i32* %A, null
; CHECK: icmp eq i32* %B, null
; CHECK: and i1
@@ -288,7 +288,7 @@ define i1 @test28(i32 %A, i32 %B) {
; (A != 0) | (A != 0) --> (A|B) != 0
%D = or i1 %C1, %C2
ret i1 %D
-; CHECK: @test28
+; CHECK-LABEL: @test28(
; CHECK: or i32 %A, %B
; CHECK: icmp ne i32 {{.*}}, 0
; CHECK: ret i1
@@ -300,7 +300,7 @@ define i1 @test29(i32* %A, i32* %B) {
%D = or i32 %C1, %C2
%E = icmp ne i32 %D, 0
ret i1 %E
-; CHECK: @test29
+; CHECK-LABEL: @test29(
; CHECK: icmp ne i32* %A, null
; CHECK: icmp ne i32* %B, null
; CHECK: or i1
@@ -315,7 +315,7 @@ entry:
%D = and i32 %B, 40186
%E = or i32 %D, %C
ret i32 %E
-; CHECK: @test30
+; CHECK-LABEL: @test30(
; CHECK: %D = and i32 %A, -58312
; CHECK: %E = or i32 %D, 32962
; CHECK: ret i32 %E
@@ -331,7 +331,7 @@ define i64 @test31(i64 %A) nounwind readnone ssp noredzone {
%F = or i64 %D, %E
ret i64 %F
-; CHECK: @test31
+; CHECK-LABEL: @test31(
; CHECK-NEXT: %E = and i64 %A, 4294908984
; CHECK-NEXT: %F = or i64 %E, 32962
; CHECK-NEXT: ret i64 %F
@@ -345,7 +345,7 @@ define <4 x i32> @test32(<4 x i1> %and.i1352, <4 x i32> %vecinit6.i176, <4 x i32
%or.i = or <4 x i32> %and.i, %and.i129 ; <<4 x i32>> [#uses=1]
ret <4 x i32> %or.i
; codegen is mature enough to handle vector selects.
-; CHECK: @test32
+; CHECK-LABEL: @test32(
; CHECK: select <4 x i1> %and.i1352, <4 x i32> %vecinit6.i176, <4 x i32> %vecinit6.i191
}
@@ -353,7 +353,7 @@ define i1 @test33(i1 %X, i1 %Y) {
%a = or i1 %X, %Y
%b = or i1 %a, %X
ret i1 %b
-; CHECK: @test33
+; CHECK-LABEL: @test33(
; CHECK-NEXT: or i1 %X, %Y
; CHECK-NEXT: ret
}
@@ -362,7 +362,7 @@ define i32 @test34(i32 %X, i32 %Y) {
%a = or i32 %X, %Y
%b = or i32 %Y, %a
ret i32 %b
-; CHECK: @test34
+; CHECK-LABEL: @test34(
; CHECK-NEXT: or i32 %X, %Y
; CHECK-NEXT: ret
}
@@ -371,7 +371,7 @@ define i32 @test35(i32 %a, i32 %b) {
%1 = or i32 %a, 1135
%2 = or i32 %1, %b
ret i32 %2
- ; CHECK: @test35
+ ; CHECK-LABEL: @test35(
; CHECK-NEXT: or i32 %a, %b
; CHECK-NEXT: or i32 %1, 1135
}
@@ -383,14 +383,14 @@ define i1 @test36(i32 %x) {
%cmp3 = icmp eq i32 %x, 25
%ret2 = or i1 %ret1, %cmp3
ret i1 %ret2
-; CHECK: @test36
+; CHECK-LABEL: @test36(
; CHECK-NEXT: %x.off = add i32 %x, -23
; CHECK-NEXT: icmp ult i32 %x.off, 3
; CHECK-NEXT: ret i1
}
define i32 @test37(i32* %xp, i32 %y) {
-; CHECK: @test37
+; CHECK-LABEL: @test37(
; CHECK: select i1 %tobool, i32 -1, i32 %x
%tobool = icmp ne i32 %y, 0
%sext = sext i1 %tobool to i32
@@ -400,7 +400,7 @@ define i32 @test37(i32* %xp, i32 %y) {
}
define i32 @test38(i32* %xp, i32 %y) {
-; CHECK: @test38
+; CHECK-LABEL: @test38(
; CHECK: select i1 %tobool, i32 -1, i32 %x
%tobool = icmp ne i32 %y, 0
%sext = sext i1 %tobool to i32
diff --git a/test/Transforms/InstCombine/osx-names.ll b/test/Transforms/InstCombine/osx-names.ll
index 7b83526aceb5..926caadc49d8 100644
--- a/test/Transforms/InstCombine/osx-names.ll
+++ b/test/Transforms/InstCombine/osx-names.ll
@@ -14,14 +14,14 @@ target triple = "i386-apple-macosx10.7.2"
@.str2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
define void @test1(%struct.__sFILE* %stream) nounwind {
-; CHECK: define void @test1
+; CHECK-LABEL: define void @test1(
; CHECK: call i32 @"fwrite$UNIX2003"
%call = tail call i32 (%struct.__sFILE*, i8*, ...)* @fprintf(%struct.__sFILE* %stream, i8* getelementptr inbounds ([13 x i8]* @.str, i32 0, i32 0)) nounwind
ret void
}
define void @test2(%struct.__sFILE* %stream, i8* %str) nounwind ssp {
-; CHECK: define void @test2
+; CHECK-LABEL: define void @test2(
; CHECK: call i32 @"fputs$UNIX2003"
%call = tail call i32 (%struct.__sFILE*, i8*, ...)* @fprintf(%struct.__sFILE* %stream, i8* getelementptr inbounds ([3 x i8]* @.str2, i32 0, i32 0), i8* %str) nounwind
ret void
diff --git a/test/Transforms/InstCombine/overflow.ll b/test/Transforms/InstCombine/overflow.ll
index 81ceef8c41cf..3eddc80a7048 100644
--- a/test/Transforms/InstCombine/overflow.ll
+++ b/test/Transforms/InstCombine/overflow.ll
@@ -3,7 +3,7 @@
declare void @throwAnExceptionOrWhatever()
-; CHECK: @test1
+; CHECK-LABEL: @test1(
define i32 @test1(i32 %a, i32 %b) nounwind ssp {
entry:
; CHECK-NOT: sext
@@ -26,7 +26,7 @@ if.end:
ret i32 %conv9
}
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; This form should not be promoted for two reasons: 1) it is unprofitable to
; promote it since the add.off instruction has another use, and 2) it is unsafe
; because the add-with-off makes the high bits of the original add live.
@@ -76,7 +76,7 @@ if.end:
; CHECK: ret i64
}
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; Should be able to form an i8 sadd computed in an i32.
define zeroext i8 @test4(i8 signext %a, i8 signext %b) nounwind ssp {
entry:
@@ -97,7 +97,7 @@ if.end: ; preds = %entry
; CHECK: ret i8
}
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: llvm.uadd.with.overflow
; CHECK: ret i64
define i64 @test5(i64 %a, i64 %b) nounwind ssp {
@@ -108,7 +108,7 @@ entry:
ret i64 %Q
}
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: llvm.uadd.with.overflow
; CHECK: ret i64
define i64 @test6(i64 %a, i64 %b) nounwind ssp {
@@ -119,7 +119,7 @@ entry:
ret i64 %Q
}
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: llvm.uadd.with.overflow
; CHECK: ret i64
define i64 @test7(i64 %a, i64 %b) nounwind ssp {
@@ -130,7 +130,7 @@ entry:
ret i64 %Q
}
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; PR11438
; This is @test1, but the operands are not sign-extended. Make sure
; we don't transform this case.
diff --git a/test/Transforms/InstCombine/phi-select-constexpr.ll b/test/Transforms/InstCombine/phi-select-constexpr.ll
new file mode 100644
index 000000000000..054e0691d47a
--- /dev/null
+++ b/test/Transforms/InstCombine/phi-select-constexpr.ll
@@ -0,0 +1,19 @@
+; RUN: opt < %s -S -instcombine | FileCheck %s
+@A = extern_weak global i32, align 4
+@B = extern_weak global i32, align 4
+
+define i32 @foo(i1 %which) {
+entry:
+ br i1 %which, label %final, label %delay
+
+delay:
+ br label %final
+
+; CHECK-LABEL: final:
+; CHECK: phi i32 [ 1, %entry ], [ select (i1 icmp eq (i32* @A, i32* @B), i32 2, i32 1), %delay ]
+final:
+ %use2 = phi i1 [ false, %entry ], [ icmp eq (i32* @A, i32* @B), %delay ]
+ %value = select i1 %use2, i32 2, i32 1
+ ret i32 %value
+}
+
diff --git a/test/Transforms/InstCombine/phi.ll b/test/Transforms/InstCombine/phi.ll
index 1c307d430f3f..6e314651383c 100644
--- a/test/Transforms/InstCombine/phi.ll
+++ b/test/Transforms/InstCombine/phi.ll
@@ -15,7 +15,7 @@ BB1:
BB2:
ret i32 %A
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: BB1:
; CHECK-NEXT: ret i32 %A
}
@@ -31,7 +31,7 @@ BB2:
; Combine away PHI nodes with same values
%B = phi i32 [ %A, %BB0 ], [ %A, %BB1 ]
ret i32 %B
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: BB2:
; CHECK-NEXT: ret i32 %A
}
@@ -47,7 +47,7 @@ Loop:
Exit:
ret i32 %B
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: Exit:
; CHECK-NEXT: ret i32 %A
}
@@ -64,7 +64,7 @@ Loop: ; preds = %L2, %Loop
L2: ; preds = %Loop
br label %Loop
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: Loop:
; CHECK-NEXT: br i1 %b
}
@@ -80,7 +80,7 @@ Loop: ; preds = %Loop, %BB0
Exit: ; preds = %Loop
ret i32 %B
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: Loop:
; CHECK-NEXT: br i1 %b
; CHECK: Exit:
@@ -100,7 +100,7 @@ BB2:
;; Suck casts into phi
%B = phi i32 [ %X, %BB0 ], [ %Y, %BB1 ]
ret i32 %B
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: BB2:
; CHECK: zext i16 %A to i32
; CHECK-NEXT: ret i32
@@ -118,7 +118,7 @@ Loop: ; preds = %Loop, %BB0
Exit: ; preds = %Loop
ret i32 0
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: Loop:
; CHECK-NEXT: br i1 %b
}
@@ -136,7 +136,7 @@ BB2:
;; Suck GEPs into phi
%B = phi i32* [ %X, %BB0 ], [ %Y, %BB1 ]
ret i32* %B
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK-NOT: phi
; CHECK: BB2:
; CHECK-NEXT: %B = getelementptr { i32, i32 }* %A
@@ -159,7 +159,7 @@ bb1:
bb2:
%E = phi i32 [ %C, %bb ], [ %D, %bb1 ]
ret i32 %E
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK: bb2:
; CHECK-NEXT: phi i32* [ %B, %bb ], [ %A, %bb1 ]
; CHECK-NEXT: %E = load i32* %{{[^,]*}}, align 1
@@ -183,7 +183,7 @@ bb1:
bb2:
%E = phi i32 [ %C, %bb ], [ %D, %bb1 ]
ret i32 %E
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK: bb2:
; CHECK-NEXT: phi i32* [ %B, %bb ], [ %A, %bb1 ]
; CHECK-NEXT: %E = load i32* %{{[^,]*}}, align 16
@@ -219,7 +219,7 @@ end:
store i32 10, i32* %g
%z = call i1 @test11a()
ret i1 %z
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK-NOT: phi i32
; CHECK: ret i1 %z
}
@@ -245,7 +245,7 @@ end:
%tmp2 = add i64 %tmp32, %tmp30
ret i64 %tmp2
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK-NOT: zext
; CHECK: end:
; CHECK-NEXT: phi i64 [ 0, %entry ], [ %Val, %two ]
@@ -276,7 +276,7 @@ end:
call void @test13f(double %tmp31, i32 %tmp32)
ret void
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; CHECK-NOT: zext
; CHECK: end:
; CHECK-NEXT: phi double [ 0.000000e+00, %entry ], [ %Vald, %two ]
@@ -296,7 +296,7 @@ Loop:
Exit: ; preds = %Loop
ret i640 %C
-; CHECK: @test14a
+; CHECK-LABEL: @test14a(
; CHECK: Loop:
; CHECK-NEXT: phi i320
}
@@ -313,7 +313,7 @@ Loop:
Exit: ; preds = %Loop
ret i160 %C
-; CHECK: @test14b
+; CHECK-LABEL: @test14b(
; CHECK: Loop:
; CHECK-NEXT: phi i160
}
@@ -321,7 +321,7 @@ Exit: ; preds = %Loop
declare i64 @test15a(i64)
define i64 @test15b(i64 %A, i1 %b) {
-; CHECK: @test15b
+; CHECK-LABEL: @test15b(
entry:
%i0 = zext i64 %A to i128
%i1 = shl i128 %i0, 64
@@ -405,7 +405,7 @@ if.else: ; preds = %entry
; PR4413
declare i32 @ext()
-; CHECK: @test17
+; CHECK-LABEL: @test17(
define i32 @test17(i1 %a) {
entry:
br i1 %a, label %bb1, label %bb2
@@ -435,7 +435,7 @@ ret:
%ptr = phi i32* [ %zero, %true ] , [ %one, %false ]
%isnull = icmp eq i32* %ptr, null
ret i1 %isnull
-; CHECK: @test18
+; CHECK-LABEL: @test18(
; CHECK: ret i1 false
}
@@ -449,7 +449,7 @@ ret:
%p = phi double [ %x, %true ], [ 0x7FF0000000000000, %false ]; RHS = +infty
%cmp = fcmp ule double %x, %p
ret i1 %cmp
-; CHECK: @test19
+; CHECK-LABEL: @test19(
; CHECK: ret i1 true
}
@@ -466,7 +466,7 @@ ret:
%p = phi i32* [ %a, %true ], [ %b, %false ]
%r = icmp eq i32* %p, %c
ret i1 %r
-; CHECK: @test20
+; CHECK-LABEL: @test20(
; CHECK: ret i1 false
}
@@ -485,12 +485,12 @@ loop:
br i1 %c2, label %ret, label %loop
ret:
ret i1 %r
-; CHECK: @test21
+; CHECK-LABEL: @test21(
; CHECK: ret i1 false
}
define void @test22() {
-; CHECK: @test22
+; CHECK-LABEL: @test22(
entry:
br label %loop
loop:
@@ -518,7 +518,7 @@ Loop: ; preds = %Loop, %BB0
Exit: ; preds = %Loop
%E = add i32 %B, 19
ret i32 %E
-; CHECK: @test23
+; CHECK-LABEL: @test23(
; CHECK: %phitmp = add i32 %A, 19
; CHECK: Loop:
; CHECK-NEXT: %B = phi i32 [ %phitmp, %BB0 ], [ 61, %Loop ]
@@ -538,7 +538,7 @@ BB1:
BB2:
%C = phi i32 [ %X, %BB0 ], [ %Y, %BB1 ]
ret i32 %C
-; CHECK: @test24
+; CHECK-LABEL: @test24(
; CHECK-NOT: phi
; CHECK: BB2:
; CHECK-NEXT: %C = add nuw i32 %A, 1
@@ -573,7 +573,7 @@ end:
store i32 10, i32* %g
%z = call i1 @test25a()
ret i1 %z
-; CHECK: @test25
+; CHECK-LABEL: @test25(
; CHECK-NOT: phi i32
; CHECK: ret i1 %z
}
@@ -616,12 +616,12 @@ end:
store i32 10, i32* %g
%z = call i1 @test26a()
ret i1 %z
-; CHECK: @test26
+; CHECK-LABEL: @test26(
; CHECK-NOT: phi i32
; CHECK: ret i1 %z
}
-; CHECK: @test27(
+; CHECK-LABEL: @test27(
; CHECK: ret i32 undef
define i32 @test27(i1 %b) {
entry:
diff --git a/test/Transforms/InstCombine/pow-1.ll b/test/Transforms/InstCombine/pow-1.ll
index 8a311f0b74c6..9f1d073fe760 100644
--- a/test/Transforms/InstCombine/pow-1.ll
+++ b/test/Transforms/InstCombine/pow-1.ll
@@ -12,14 +12,14 @@ declare double @pow(double, double) nounwind readonly
; Check pow(1.0, x) -> 1.0.
define float @test_simplify1(float %x) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%retval = call float @powf(float 1.0, float %x)
ret float %retval
; CHECK-NEXT: ret float 1.000000e+00
}
define double @test_simplify2(double %x) {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%retval = call double @pow(double 1.0, double %x)
ret double %retval
; CHECK-NEXT: ret double 1.000000e+00
@@ -28,7 +28,7 @@ define double @test_simplify2(double %x) {
; Check pow(2.0, x) -> exp2(x).
define float @test_simplify3(float %x) {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%retval = call float @powf(float 2.0, float %x)
; CHECK-NEXT: [[EXP2F:%[a-z0-9]+]] = call float @exp2f(float %x) [[NUW_RO:#[0-9]+]]
ret float %retval
@@ -36,7 +36,7 @@ define float @test_simplify3(float %x) {
}
define double @test_simplify4(double %x) {
-; CHECK: @test_simplify4
+; CHECK-LABEL: @test_simplify4(
%retval = call double @pow(double 2.0, double %x)
; CHECK-NEXT: [[EXP2:%[a-z0-9]+]] = call double @exp2(double %x) [[NUW_RO]]
ret double %retval
@@ -46,14 +46,14 @@ define double @test_simplify4(double %x) {
; Check pow(x, 0.0) -> 1.0.
define float @test_simplify5(float %x) {
-; CHECK: @test_simplify5
+; CHECK-LABEL: @test_simplify5(
%retval = call float @powf(float %x, float 0.0)
ret float %retval
; CHECK-NEXT: ret float 1.000000e+00
}
define double @test_simplify6(double %x) {
-; CHECK: @test_simplify6
+; CHECK-LABEL: @test_simplify6(
%retval = call double @pow(double %x, double 0.0)
ret double %retval
; CHECK-NEXT: ret double 1.000000e+00
@@ -62,7 +62,7 @@ define double @test_simplify6(double %x) {
; Check pow(x, 0.5) -> fabs(sqrt(x)), where x != -infinity.
define float @test_simplify7(float %x) {
-; CHECK: @test_simplify7
+; CHECK-LABEL: @test_simplify7(
%retval = call float @powf(float %x, float 0.5)
; CHECK-NEXT: [[SQRTF:%[a-z0-9]+]] = call float @sqrtf(float %x) [[NUW_RO]]
; CHECK-NEXT: [[FABSF:%[a-z0-9]+]] = call float @fabsf(float [[SQRTF]]) [[NUW_RO]]
@@ -73,7 +73,7 @@ define float @test_simplify7(float %x) {
}
define double @test_simplify8(double %x) {
-; CHECK: @test_simplify8
+; CHECK-LABEL: @test_simplify8(
%retval = call double @pow(double %x, double 0.5)
; CHECK-NEXT: [[SQRT:%[a-z0-9]+]] = call double @sqrt(double %x) [[NUW_RO]]
; CHECK-NEXT: [[FABS:%[a-z0-9]+]] = call double @fabs(double [[SQRT]]) [[NUW_RO]]
@@ -86,14 +86,14 @@ define double @test_simplify8(double %x) {
; Check pow(-infinity, 0.5) -> +infinity.
define float @test_simplify9(float %x) {
-; CHECK: @test_simplify9
+; CHECK-LABEL: @test_simplify9(
%retval = call float @powf(float 0xFFF0000000000000, float 0.5)
ret float %retval
; CHECK-NEXT: ret float 0x7FF0000000000000
}
define double @test_simplify10(double %x) {
-; CHECK: @test_simplify10
+; CHECK-LABEL: @test_simplify10(
%retval = call double @pow(double 0xFFF0000000000000, double 0.5)
ret double %retval
; CHECK-NEXT: ret double 0x7FF0000000000000
@@ -102,14 +102,14 @@ define double @test_simplify10(double %x) {
; Check pow(x, 1.0) -> x.
define float @test_simplify11(float %x) {
-; CHECK: @test_simplify11
+; CHECK-LABEL: @test_simplify11(
%retval = call float @powf(float %x, float 1.0)
ret float %retval
; CHECK-NEXT: ret float %x
}
define double @test_simplify12(double %x) {
-; CHECK: @test_simplify12
+; CHECK-LABEL: @test_simplify12(
%retval = call double @pow(double %x, double 1.0)
ret double %retval
; CHECK-NEXT: ret double %x
@@ -118,7 +118,7 @@ define double @test_simplify12(double %x) {
; Check pow(x, 2.0) -> x*x.
define float @test_simplify13(float %x) {
-; CHECK: @test_simplify13
+; CHECK-LABEL: @test_simplify13(
%retval = call float @powf(float %x, float 2.0)
; CHECK-NEXT: [[SQUARE:%[a-z0-9]+]] = fmul float %x, %x
ret float %retval
@@ -126,7 +126,7 @@ define float @test_simplify13(float %x) {
}
define double @test_simplify14(double %x) {
-; CHECK: @test_simplify14
+; CHECK-LABEL: @test_simplify14(
%retval = call double @pow(double %x, double 2.0)
; CHECK-NEXT: [[SQUARE:%[a-z0-9]+]] = fmul double %x, %x
ret double %retval
@@ -136,7 +136,7 @@ define double @test_simplify14(double %x) {
; Check pow(x, -1.0) -> 1.0/x.
define float @test_simplify15(float %x) {
-; CHECK: @test_simplify15
+; CHECK-LABEL: @test_simplify15(
%retval = call float @powf(float %x, float -1.0)
; CHECK-NEXT: [[RECIPROCAL:%[a-z0-9]+]] = fdiv float 1.000000e+00, %x
ret float %retval
@@ -144,11 +144,24 @@ define float @test_simplify15(float %x) {
}
define double @test_simplify16(double %x) {
-; CHECK: @test_simplify16
+; CHECK-LABEL: @test_simplify16(
%retval = call double @pow(double %x, double -1.0)
; CHECK-NEXT: [[RECIPROCAL:%[a-z0-9]+]] = fdiv double 1.000000e+00, %x
ret double %retval
; CHECK-NEXT: ret double [[RECIPROCAL]]
}
+declare double @llvm.pow.f64(double %Val, double %Power)
+define double @test_simplify17(double %x) {
+; CHECK-LABEL: @test_simplify17(
+ %retval = call double @llvm.pow.f64(double %x, double 0.5)
+; CHECK-NEXT: [[SQRT:%[a-z0-9]+]] = call double @sqrt(double %x) [[NUW_RO]]
+; CHECK-NEXT: [[FABS:%[a-z0-9]+]] = call double @fabs(double [[SQRT]]) [[NUW_RO]]
+; CHECK-NEXT: [[FCMP:%[a-z0-9]+]] = fcmp oeq double %x, 0xFFF0000000000000
+; CHECK-NEXT: [[SELECT:%[a-z0-9]+]] = select i1 [[FCMP]], double 0x7FF0000000000000, double [[FABS]]
+ ret double %retval
+; CHECK-NEXT: ret double [[SELECT]]
+}
+
; CHECK: attributes [[NUW_RO]] = { nounwind readonly }
+
diff --git a/test/Transforms/InstCombine/pow-2.ll b/test/Transforms/InstCombine/pow-2.ll
index af64cda0904a..d1ffde703faa 100644
--- a/test/Transforms/InstCombine/pow-2.ll
+++ b/test/Transforms/InstCombine/pow-2.ll
@@ -7,7 +7,7 @@ declare float @pow(double, double)
; Check that pow functions with the wrong prototype aren't simplified.
define float @test_no_simplify1(double %x) {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%retval = call float @pow(double 1.0, double %x)
; CHECK-NEXT: call float @pow(double 1.000000e+00, double %x)
ret float %retval
diff --git a/test/Transforms/InstCombine/pow-3.ll b/test/Transforms/InstCombine/pow-3.ll
new file mode 100644
index 000000000000..1c5cf910a8af
--- /dev/null
+++ b/test/Transforms/InstCombine/pow-3.ll
@@ -0,0 +1,12 @@
+; Test that the pow won't get simplified to sqrt(fabs) when they are not available.
+;
+; RUN: opt < %s -disable-simplify-libcalls -instcombine -S | FileCheck %s
+
+declare double @llvm.pow.f64(double %Val, double %Power)
+
+define double @test_simplify_unavailable(double %x) {
+; CHECK-LABEL: @test_simplify_unavailable(
+ %retval = call double @llvm.pow.f64(double %x, double 0.5)
+; CHECK-NEXT: call double @llvm.pow.f64(double %x, double 5.000000e-01)
+ ret double %retval
+}
diff --git a/test/Transforms/InstCombine/pr17827.ll b/test/Transforms/InstCombine/pr17827.ll
new file mode 100644
index 000000000000..a8b592635523
--- /dev/null
+++ b/test/Transforms/InstCombine/pr17827.ll
@@ -0,0 +1,74 @@
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+; With left shift, the comparison should not be modified.
+; CHECK-LABEL: @test_shift_and_cmp_not_changed1(
+; CHECK: icmp slt i8 %andp, 32
+define i1 @test_shift_and_cmp_not_changed1(i8 %p) #0 {
+entry:
+ %shlp = shl i8 %p, 5
+ %andp = and i8 %shlp, -64
+ %cmp = icmp slt i8 %andp, 32
+ ret i1 %cmp
+}
+
+; With arithmetic right shift, the comparison should not be modified.
+; CHECK-LABEL: @test_shift_and_cmp_not_changed2(
+; CHECK: icmp slt i8 %andp, 32
+define i1 @test_shift_and_cmp_not_changed2(i8 %p) #0 {
+entry:
+ %shlp = ashr i8 %p, 5
+ %andp = and i8 %shlp, -64
+ %cmp = icmp slt i8 %andp, 32
+ ret i1 %cmp
+}
+
+; This should simplify functionally to the left shift case.
+; The extra input parameter should be optimized away.
+; CHECK-LABEL: @test_shift_and_cmp_changed1(
+; CHECK: %andp = shl i8 %p, 5
+; CHECK-NEXT: %shl = and i8 %andp, -64
+; CHECK-NEXT: %cmp = icmp slt i8 %shl, 32
+define i1 @test_shift_and_cmp_changed1(i8 %p, i8 %q) #0 {
+entry:
+ %andp = and i8 %p, 6
+ %andq = and i8 %q, 8
+ %or = or i8 %andq, %andp
+ %shl = shl i8 %or, 5
+ %ashr = ashr i8 %shl, 5
+ %cmp = icmp slt i8 %ashr, 1
+ ret i1 %cmp
+}
+
+; Unsigned compare allows a transformation to compare against 0.
+; CHECK-LABEL: @test_shift_and_cmp_changed2(
+; CHECK: icmp eq i8 %andp, 0
+define i1 @test_shift_and_cmp_changed2(i8 %p) #0 {
+entry:
+ %shlp = shl i8 %p, 5
+ %andp = and i8 %shlp, -64
+ %cmp = icmp ult i8 %andp, 32
+ ret i1 %cmp
+}
+
+; nsw on the shift should not affect the comparison.
+; CHECK-LABEL: @test_shift_and_cmp_changed3(
+; CHECK: icmp slt i8 %andp, 32
+define i1 @test_shift_and_cmp_changed3(i8 %p) #0 {
+entry:
+ %shlp = shl nsw i8 %p, 5
+ %andp = and i8 %shlp, -64
+ %cmp = icmp slt i8 %andp, 32
+ ret i1 %cmp
+}
+
+; Logical shift right allows a return true because the 'and' guarantees no bits are set.
+; CHECK-LABEL: @test_shift_and_cmp_changed4(
+; CHECK: ret i1 true
+define i1 @test_shift_and_cmp_changed4(i8 %p) #0 {
+entry:
+ %shlp = lshr i8 %p, 5
+ %andp = and i8 %shlp, -64
+ %cmp = icmp slt i8 %andp, 32
+ ret i1 %cmp
+}
+
diff --git a/test/Transforms/InstCombine/pr8547.ll b/test/Transforms/InstCombine/pr8547.ll
index 485f4d9644f3..7e9cbe17b68d 100644
--- a/test/Transforms/InstCombine/pr8547.ll
+++ b/test/Transforms/InstCombine/pr8547.ll
@@ -23,4 +23,4 @@ for.cond: ; preds = %for.cond, %codeRepl
codeRepl2: ; preds = %for.cond
%call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i64 0, i64 0), i32 %conv2) nounwind
ret i32 0
-} \ No newline at end of file
+}
diff --git a/test/Transforms/InstCombine/printf-1.ll b/test/Transforms/InstCombine/printf-1.ll
index 3a910ea437b7..c98ddd55df10 100644
--- a/test/Transforms/InstCombine/printf-1.ll
+++ b/test/Transforms/InstCombine/printf-1.ll
@@ -1,7 +1,7 @@
; Test that the printf library call simplifier works correctly.
;
; RUN: opt < %s -instcombine -S | FileCheck %s
-; RUN: opt < %s -mtriple xcore-xmos-elf -instcombine -S | FileCheck %s -check-prefix=IPRINTF
+; RUN: opt < %s -mtriple xcore-xmos-elf -instcombine -S | FileCheck %s -check-prefix=CHECK-IPRINTF
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"
@@ -20,7 +20,7 @@ declare i32 @printf(i8*, ...)
; Check printf("") -> noop.
define void @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%fmt = getelementptr [1 x i8]* @empty, i32 0, i32 0
call i32 (i8*, ...)* @printf(i8* %fmt)
ret void
@@ -30,7 +30,7 @@ define void @test_simplify1() {
; Check printf("x") -> putchar('x'), even for '%'.
define void @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%fmt = getelementptr [2 x i8]* @h, i32 0, i32 0
call i32 (i8*, ...)* @printf(i8* %fmt)
; CHECK-NEXT: call i32 @putchar(i32 104)
@@ -39,7 +39,7 @@ define void @test_simplify2() {
}
define void @test_simplify3() {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%fmt = getelementptr [2 x i8]* @percent, i32 0, i32 0
call i32 (i8*, ...)* @printf(i8* %fmt)
; CHECK-NEXT: call i32 @putchar(i32 37)
@@ -50,7 +50,7 @@ define void @test_simplify3() {
; Check printf("foo\n") -> puts("foo").
define void @test_simplify4() {
-; CHECK: @test_simplify4
+; CHECK-LABEL: @test_simplify4(
%fmt = getelementptr [13 x i8]* @hello_world, i32 0, i32 0
call i32 (i8*, ...)* @printf(i8* %fmt)
; CHECK-NEXT: call i32 @puts(i8* getelementptr inbounds ([12 x i8]* [[STR]], i32 0, i32 0))
@@ -61,7 +61,7 @@ define void @test_simplify4() {
; Check printf("%c", chr) -> putchar(chr).
define void @test_simplify5() {
-; CHECK: @test_simplify5
+; CHECK-LABEL: @test_simplify5(
%fmt = getelementptr [3 x i8]* @percent_c, i32 0, i32 0
call i32 (i8*, ...)* @printf(i8* %fmt, i8 104)
; CHECK-NEXT: call i32 @putchar(i32 104)
@@ -72,7 +72,7 @@ define void @test_simplify5() {
; Check printf("%s\n", str) -> puts(str).
define void @test_simplify6() {
-; CHECK: @test_simplify6
+; CHECK-LABEL: @test_simplify6(
%fmt = getelementptr [4 x i8]* @percent_s, i32 0, i32 0
%str = getelementptr [13 x i8]* @hello_world, i32 0, i32 0
call i32 (i8*, ...)* @printf(i8* %fmt, i8* %str)
@@ -84,7 +84,7 @@ define void @test_simplify6() {
; Check printf(format, ...) -> iprintf(format, ...) if no floating point.
define void @test_simplify7() {
-; CHECK-IPRINTF: @test_simplify7
+; CHECK-IPRINTF-LABEL: @test_simplify7(
%fmt = getelementptr [3 x i8]* @percent_d, i32 0, i32 0
call i32 (i8*, ...)* @printf(i8* %fmt, i32 187)
; CHECK-NEXT-IPRINTF: call i32 (i8*, ...)* @iprintf(i8* getelementptr inbounds ([3 x i8]* @percent_d, i32 0, i32 0), i32 187)
@@ -93,7 +93,7 @@ define void @test_simplify7() {
}
define void @test_no_simplify1() {
-; CHECK-IPRINTF: @test_no_simplify1
+; CHECK-IPRINTF-LABEL: @test_no_simplify1(
%fmt = getelementptr [3 x i8]* @percent_f, i32 0, i32 0
call i32 (i8*, ...)* @printf(i8* %fmt, double 1.87)
; CHECK-NEXT-IPRINTF: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([3 x i8]* @percent_f, i32 0, i32 0), double 1.870000e+00)
@@ -102,7 +102,7 @@ define void @test_no_simplify1() {
}
define void @test_no_simplify2(i8* %fmt, double %d) {
-; CHECK: @test_no_simplify2
+; CHECK-LABEL: @test_no_simplify2(
call i32 (i8*, ...)* @printf(i8* %fmt, double %d)
; CHECK-NEXT: call i32 (i8*, ...)* @printf(i8* %fmt, double %d)
ret void
@@ -110,7 +110,7 @@ define void @test_no_simplify2(i8* %fmt, double %d) {
}
define i32 @test_no_simplify3() {
-; CHECK: @test_no_simplify3
+; CHECK-LABEL: @test_no_simplify3(
%fmt = getelementptr [2 x i8]* @h, i32 0, i32 0
%ret = call i32 (i8*, ...)* @printf(i8* %fmt)
; CHECK-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([2 x i8]* @h, i32 0, i32 0))
diff --git a/test/Transforms/InstCombine/printf-2.ll b/test/Transforms/InstCombine/printf-2.ll
index 466ee1c75770..7e018ebba04d 100644
--- a/test/Transforms/InstCombine/printf-2.ll
+++ b/test/Transforms/InstCombine/printf-2.ll
@@ -13,7 +13,7 @@ declare void @printf(i8*, ...)
; Check simplification of printf with void return type.
define void @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%fmt = getelementptr [2 x i8]* @h, i32 0, i32 0
call void (i8*, ...)* @printf(i8* %fmt)
; CHECK-NEXT: call i32 @putchar(i32 104)
@@ -22,7 +22,7 @@ define void @test_simplify1() {
}
define void @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%fmt = getelementptr [13 x i8]* @hello_world, i32 0, i32 0
call void (i8*, ...)* @printf(i8* %fmt)
; CHECK-NEXT: call i32 @puts(i8* getelementptr inbounds ([12 x i8]* @str, i32 0, i32 0))
@@ -31,7 +31,7 @@ define void @test_simplify2() {
}
define void @test_simplify6() {
-; CHECK: @test_simplify6
+; CHECK-LABEL: @test_simplify6(
%fmt = getelementptr [4 x i8]* @percent_s, i32 0, i32 0
%str = getelementptr [13 x i8]* @hello_world, i32 0, i32 0
call void (i8*, ...)* @printf(i8* %fmt, i8* %str)
diff --git a/test/Transforms/InstCombine/ptr-int-cast.ll b/test/Transforms/InstCombine/ptr-int-cast.ll
index 7a6ecff9c0be..826c00484227 100644
--- a/test/Transforms/InstCombine/ptr-int-cast.ll
+++ b/test/Transforms/InstCombine/ptr-int-cast.ll
@@ -28,7 +28,7 @@ define i64 @f0(i32 %a0) nounwind {
}
define <4 x i32> @test4(<4 x i8*> %arg) nounwind {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: ptrtoint <4 x i8*> %arg to <4 x i64>
; CHECK: trunc <4 x i64> %1 to <4 x i32>
%p1 = ptrtoint <4 x i8*> %arg to <4 x i32>
@@ -36,7 +36,7 @@ define <4 x i32> @test4(<4 x i8*> %arg) nounwind {
}
define <4 x i128> @test5(<4 x i8*> %arg) nounwind {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: ptrtoint <4 x i8*> %arg to <4 x i64>
; CHECK: zext <4 x i64> %1 to <4 x i128>
%p1 = ptrtoint <4 x i8*> %arg to <4 x i128>
@@ -44,7 +44,7 @@ define <4 x i128> @test5(<4 x i8*> %arg) nounwind {
}
define <4 x i8*> @test6(<4 x i32> %arg) nounwind {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: zext <4 x i32> %arg to <4 x i64>
; CHECK: inttoptr <4 x i64> %1 to <4 x i8*>
%p1 = inttoptr <4 x i32> %arg to <4 x i8*>
@@ -52,7 +52,7 @@ define <4 x i8*> @test6(<4 x i32> %arg) nounwind {
}
define <4 x i8*> @test7(<4 x i128> %arg) nounwind {
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: trunc <4 x i128> %arg to <4 x i64>
; CHECK: inttoptr <4 x i64> %1 to <4 x i8*>
%p1 = inttoptr <4 x i128> %arg to <4 x i8*>
diff --git a/test/Transforms/InstCombine/puts-1.ll b/test/Transforms/InstCombine/puts-1.ll
index ef4e1bbd824c..bd7557ef650f 100644
--- a/test/Transforms/InstCombine/puts-1.ll
+++ b/test/Transforms/InstCombine/puts-1.ll
@@ -11,7 +11,7 @@ declare i32 @puts(i8*)
; Check puts("") -> putchar('\n').
define void @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%str = getelementptr [1 x i8]* @empty, i32 0, i32 0
call i32 @puts(i8* %str)
; CHECK-NEXT: call i32 @putchar(i32 10)
@@ -22,7 +22,7 @@ define void @test_simplify1() {
; Don't simplify if the return value is used.
define i32 @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%str = getelementptr [1 x i8]* @empty, i32 0, i32 0
%ret = call i32 @puts(i8* %str)
; CHECK-NEXT: call i32 @puts(i8* getelementptr inbounds ([1 x i8]* @empty, i32 0, i32 0))
diff --git a/test/Transforms/InstCombine/rem.ll b/test/Transforms/InstCombine/rem.ll
index b421b7c0e8b4..22fd90bf7a75 100644
--- a/test/Transforms/InstCombine/rem.ll
+++ b/test/Transforms/InstCombine/rem.ll
@@ -1,36 +1,56 @@
-; This test makes sure that these instructions are properly eliminated.
+; This test makes sure that urem instructions are properly eliminated.
;
-; RUN: opt < %s -instcombine -S | not grep rem
+; RUN: opt < %s -instcombine -S | FileCheck %s
; END.
define i32 @test1(i32 %A) {
+; CHECK-LABEL: @test1(
+; CHECK-NEXT: ret i32 0
%B = srem i32 %A, 1 ; ISA constant 0
ret i32 %B
}
define i32 @test2(i32 %A) { ; 0 % X = 0, we don't need to preserve traps
+; CHECK-LABEL: @test2(
+; CHECK-NEXT: ret i32 0
%B = srem i32 0, %A
ret i32 %B
}
define i32 @test3(i32 %A) {
+; CHECK-LABEL: @test3(
+; CHECK-NEXT: [[AND:%.*]] = and i32 %A, 7
+; CHECK-NEXT: ret i32 [[AND]]
%B = urem i32 %A, 8
ret i32 %B
}
define i1 @test3a(i32 %A) {
+; CHECK-LABEL: @test3a(
+; CHECK-NEXT: [[AND:%.*]] = and i32 %A, 7
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[AND]], 0
+; CHECK-NEXT: ret i1 [[CMP]]
%B = srem i32 %A, -8
%C = icmp ne i32 %B, 0
ret i1 %C
}
define i32 @test4(i32 %X, i1 %C) {
+; CHECK-LABEL: @test4(
+; CHECK-NEXT: [[SEL:%.*]] = select i1 %C, i32 0, i32 7
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[SEL]], %X
%V = select i1 %C, i32 1, i32 8
%R = urem i32 %X, %V
ret i32 %R
}
define i32 @test5(i32 %X, i8 %B) {
+; CHECK-LABEL: @test5(
+; CHECK-NEXT: [[ZEXT:%.*]] = zext i8 %B to i32
+; CHECK-NEXT: [[SHL:%.*]] = shl nuw i32 32, [[ZEXT]]
+; CHECK-NEXT: [[ADD:%.*]] = add i32 [[SHL]], -1
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[ADD]], %X
+; CHECK-NEXT: ret i32 [[AND]]
%shift.upgrd.1 = zext i8 %B to i32
%Amt = shl i32 32, %shift.upgrd.1
%V = urem i32 %X, %Amt
@@ -38,29 +58,39 @@ define i32 @test5(i32 %X, i8 %B) {
}
define i32 @test6(i32 %A) {
+; CHECK-LABEL: @test6(
+; CHECK-NEXT: ret i32 undef
%B = srem i32 %A, 0 ;; undef
ret i32 %B
}
define i32 @test7(i32 %A) {
+; CHECK-LABEL: @test7(
+; CHECK-NEXT: ret i32 0
%B = mul i32 %A, 8
%C = srem i32 %B, 4
ret i32 %C
}
define i32 @test8(i32 %A) {
+; CHECK-LABEL: @test8(
+; CHECK-NEXT: ret i32 0
%B = shl i32 %A, 4
%C = srem i32 %B, 8
ret i32 %C
}
define i32 @test9(i32 %A) {
+; CHECK-LABEL: @test9(
+; CHECK-NEXT: ret i32 0
%B = mul i32 %A, 64
%C = urem i32 %B, 32
ret i32 %C
}
define i32 @test10(i8 %c) {
+; CHECK-LABEL: @test10(
+; CHECK-NEXT: ret i32 0
%tmp.1 = zext i8 %c to i32
%tmp.2 = mul i32 %tmp.1, 4
%tmp.3 = sext i32 %tmp.2 to i64
@@ -70,6 +100,8 @@ define i32 @test10(i8 %c) {
}
define i32 @test11(i32 %i) {
+; CHECK-LABEL: @test11(
+; CHECK-NEXT: ret i32 0
%tmp.1 = and i32 %i, -2
%tmp.3 = mul i32 %tmp.1, 2
%tmp.5 = urem i32 %tmp.3, 4
@@ -77,12 +109,98 @@ define i32 @test11(i32 %i) {
}
define i32 @test12(i32 %i) {
+; CHECK-LABEL: @test12(
+; CHECK-NEXT: ret i32 0
%tmp.1 = and i32 %i, -4
%tmp.5 = srem i32 %tmp.1, 2
ret i32 %tmp.5
}
define i32 @test13(i32 %i) {
+; CHECK-LABEL: @test13(
+; CHECK-NEXT: ret i32 0
%x = srem i32 %i, %i
ret i32 %x
}
+
+define i64 @test14(i64 %x, i32 %y) {
+; CHECK-LABEL: @test14(
+; CHECK-NEXT: [[SHL:%.*]] = shl i32 1, %y
+; CHECK-NEXT: [[ZEXT:%.*]] = zext i32 [[SHL]] to i64
+; CHECK-NEXT: [[ADD:%.*]] = add i64 [[ZEXT]], -1
+; CHECK-NEXT: [[AND:%.*]] = and i64 [[ADD]], %x
+; CHECK-NEXT: ret i64 [[AND]]
+ %shl = shl i32 1, %y
+ %zext = zext i32 %shl to i64
+ %urem = urem i64 %x, %zext
+ ret i64 %urem
+}
+
+define i64 @test15(i32 %x, i32 %y) {
+; CHECK-LABEL: @test15(
+; CHECK-NEXT: [[SHL:%.*]] = shl nuw i32 1, %y
+; CHECK-NEXT: [[ADD:%.*]] = add i32 [[SHL]], -1
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[ADD]], %x
+; CHECK-NEXT: [[ZEXT:%.*]] = zext i32 [[AND]] to i64
+; CHECK-NEXT: ret i64 [[ZEXT]]
+ %shl = shl i32 1, %y
+ %zext0 = zext i32 %shl to i64
+ %zext1 = zext i32 %x to i64
+ %urem = urem i64 %zext1, %zext0
+ ret i64 %urem
+}
+
+define i32 @test16(i32 %x, i32 %y) {
+; CHECK-LABEL: @test16(
+; CHECK-NEXT: [[SHR:%.*]] = lshr i32 %y, 11
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[SHR]], 4
+; CHECK-NEXT: [[OR:%.*]] = or i32 [[AND]], 3
+; CHECK-NEXT: [[REM:%.*]] = and i32 [[OR]], %x
+; CHECK-NEXT: ret i32 [[REM]]
+ %shr = lshr i32 %y, 11
+ %and = and i32 %shr, 4
+ %add = add i32 %and, 4
+ %rem = urem i32 %x, %add
+ ret i32 %rem
+}
+
+define i32 @test17(i32 %X) {
+; CHECK-LABEL: @test17(
+; CHECK-NEXT: icmp ne i32 %X, 1
+; CHECK-NEXT: zext i1
+; CHECK-NEXT: ret
+ %A = urem i32 1, %X
+ ret i32 %A
+}
+
+define i32 @test18(i16 %x, i32 %y) {
+; CHECK: @test18
+; CHECK-NEXT: [[AND:%.*]] = and i16 %x, 4
+; CHECK-NEXT: [[EXT:%.*]] = zext i16 [[AND]] to i32
+; CHECK-NEXT: [[SHL:%.*]] = shl nuw nsw i32 [[EXT]], 3
+; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[SHL]], 63
+; CHECK-NEXT: [[REM:%.*]] = and i32 [[XOR]], %y
+; CHECK-NEXT: ret i32 [[REM]]
+ %1 = and i16 %x, 4
+ %2 = icmp ne i16 %1, 0
+ %3 = select i1 %2, i32 32, i32 64
+ %4 = urem i32 %y, %3
+ ret i32 %4
+}
+
+define i32 @test19(i32 %x, i32 %y) {
+; CHECK: @test19
+; CHECK-NEXT: [[SHL1:%.*]] = shl i32 1, %x
+; CHECK-NEXT: [[SHL2:%.*]] = shl i32 1, %y
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[SHL1]], [[SHL2]]
+; CHECK-NEXT: [[ADD:%.*]] = add i32 [[AND]], [[SHL1]]
+; CHECK-NEXT: [[SUB:%.*]] = add i32 [[ADD]], -1
+; CHECK-NEXT: [[REM:%.*]] = and i32 [[SUB]], %y
+; CHECK-NEXT: ret i32 [[REM]]
+ %A = shl i32 1, %x
+ %B = shl i32 1, %y
+ %C = and i32 %A, %B
+ %D = add i32 %C, %A
+ %E = urem i32 %y, %D
+ ret i32 %E
+}
diff --git a/test/Transforms/InstCombine/select-2.ll b/test/Transforms/InstCombine/select-2.ll
index a76addc9942b..5b9deb4515a8 100644
--- a/test/Transforms/InstCombine/select-2.ll
+++ b/test/Transforms/InstCombine/select-2.ll
@@ -1,4 +1,7 @@
-; RUN: opt < %s -instcombine -S | grep select | count 2
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+; CHECK: select
+; CHECK: select
; Make sure instcombine don't fold select into operands. We don't want to emit
; select of two integers unless it's selecting 0 / 1.
diff --git a/test/Transforms/InstCombine/select-crash.ll b/test/Transforms/InstCombine/select-crash.ll
index 946ea2b8b70c..77446cd8ba02 100644
--- a/test/Transforms/InstCombine/select-crash.ll
+++ b/test/Transforms/InstCombine/select-crash.ll
@@ -21,7 +21,7 @@ entry:
; PR10180: same crash, but with vectors
define <4 x float> @foo(i1 %b, <4 x float> %x, <4 x float> %y, <4 x float> %z) {
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK: fsub <4 x float>
; CHECK: select
; CHECK: fadd <4 x float>
@@ -31,7 +31,7 @@ define <4 x float> @foo(i1 %b, <4 x float> %x, <4 x float> %y, <4 x float> %z) {
ret <4 x float> %sel
}
-; CHECK: @test3
+; CHECK-LABEL: @test3(
define i32 @test3(i1 %bool, i32 %a) {
entry:
%cond = or i1 %bool, true
diff --git a/test/Transforms/InstCombine/select-extractelement.ll b/test/Transforms/InstCombine/select-extractelement.ll
new file mode 100644
index 000000000000..e7ea851d9214
--- /dev/null
+++ b/test/Transforms/InstCombine/select-extractelement.ll
@@ -0,0 +1,102 @@
+; RUN: opt -S -instcombine < %s | FileCheck %s
+
+declare void @v4float_user(<4 x float>) #0
+
+
+
+define float @extract_one_select(<4 x float> %a, <4 x float> %b, i32 %c) #0 {
+; CHECK-LABEL: @extract_one_select(
+; CHECK-NOT: select i1 {{.*}}, <4 x float>
+ %cmp = icmp ne i32 %c, 0
+ %sel = select i1 %cmp, <4 x float> %a, <4 x float> %b
+ %extract = extractelement <4 x float> %sel, i32 2
+ ret float %extract
+}
+
+; Multiple extractelements
+define <2 x float> @extract_two_select(<4 x float> %a, <4 x float> %b, i32 %c) #0 {
+; CHECK-LABEL: @extract_two_select(
+; CHECK: select i1 {{.*}}, <4 x float>
+ %cmp = icmp ne i32 %c, 0
+ %sel = select i1 %cmp, <4 x float> %a, <4 x float> %b
+ %extract1 = extractelement <4 x float> %sel, i32 1
+ %extract2 = extractelement <4 x float> %sel, i32 2
+ %build1 = insertelement <2 x float> undef, float %extract1, i32 0
+ %build2 = insertelement <2 x float> %build1, float %extract2, i32 1
+ ret <2 x float> %build2
+}
+
+; Select has an extra non-extractelement user, don't change it
+define float @extract_one_select_user(<4 x float> %a, <4 x float> %b, i32 %c) #0 {
+; CHECK-LABEL: @extract_one_select_user(
+; CHECK: select i1 {{.*}}, <4 x float>
+ %cmp = icmp ne i32 %c, 0
+ %sel = select i1 %cmp, <4 x float> %a, <4 x float> %b
+ %extract = extractelement <4 x float> %sel, i32 2
+ call void @v4float_user(<4 x float> %sel)
+ ret float %extract
+}
+
+define float @extract_one_vselect_user(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
+; CHECK-LABEL: @extract_one_vselect_user(
+; CHECK: select <4 x i1> {{.*}}, <4 x float>
+ %cmp = icmp ne <4 x i32> %c, zeroinitializer
+ %sel = select <4 x i1> %cmp, <4 x float> %a, <4 x float> %b
+ %extract = extractelement <4 x float> %sel, i32 2
+ call void @v4float_user(<4 x float> %sel)
+ ret float %extract
+}
+
+; Extract from a vector select
+define float @extract_one_vselect(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
+; CHECK-LABEL: @extract_one_vselect(
+; CHECK-NOT: select <4 x i1>
+ %cmp = icmp ne <4 x i32> %c, zeroinitializer
+ %select = select <4 x i1> %cmp, <4 x float> %a, <4 x float> %b
+ %extract = extractelement <4 x float> %select, i32 0
+ ret float %extract
+}
+
+; Multiple extractelements from a vector select
+define <2 x float> @extract_two_vselect(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
+; CHECK-LABEL: @extract_two_vselect(
+; CHECK-NOT: select i1 {{.*}}, <4 x float>
+ %cmp = icmp ne <4 x i32> %c, zeroinitializer
+ %sel = select <4 x i1> %cmp, <4 x float> %a, <4 x float> %b
+ %extract1 = extractelement <4 x float> %sel, i32 1
+ %extract2 = extractelement <4 x float> %sel, i32 2
+ %build1 = insertelement <2 x float> undef, float %extract1, i32 0
+ %build2 = insertelement <2 x float> %build1, float %extract2, i32 1
+ ret <2 x float> %build2
+}
+
+; All the vector selects should be decomposed into scalar selects
+; Test multiple extractelements
+define <4 x float> @simple_vector_select(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
+; CHECK-LABEL: @simple_vector_select(
+; CHECK-NOT: select i1 {{.*}}, <4 x float>
+entry:
+ %0 = extractelement <4 x i32> %c, i32 0
+ %tobool = icmp ne i32 %0, 0
+ %a.sink = select i1 %tobool, <4 x float> %a, <4 x float> %b
+ %1 = extractelement <4 x float> %a.sink, i32 0
+ %2 = insertelement <4 x float> undef, float %1, i32 0
+ %3 = extractelement <4 x i32> %c, i32 1
+ %tobool1 = icmp ne i32 %3, 0
+ %a.sink1 = select i1 %tobool1, <4 x float> %a, <4 x float> %b
+ %4 = extractelement <4 x float> %a.sink1, i32 1
+ %5 = insertelement <4 x float> %2, float %4, i32 1
+ %6 = extractelement <4 x i32> %c, i32 2
+ %tobool6 = icmp ne i32 %6, 0
+ %a.sink2 = select i1 %tobool6, <4 x float> %a, <4 x float> %b
+ %7 = extractelement <4 x float> %a.sink2, i32 2
+ %8 = insertelement <4 x float> %5, float %7, i32 2
+ %9 = extractelement <4 x i32> %c, i32 3
+ %tobool11 = icmp ne i32 %9, 0
+ %a.sink3 = select i1 %tobool11, <4 x float> %a, <4 x float> %b
+ %10 = extractelement <4 x float> %a.sink3, i32 3
+ %11 = insertelement <4 x float> %8, float %10, i32 3
+ ret <4 x float> %11
+}
+
+attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/test/Transforms/InstCombine/select.ll b/test/Transforms/InstCombine/select.ll
index c72a6f7c49c6..1458bde82124 100644
--- a/test/Transforms/InstCombine/select.ll
+++ b/test/Transforms/InstCombine/select.ll
@@ -6,14 +6,14 @@
define i32 @test1(i32 %A, i32 %B) {
%C = select i1 false, i32 %A, i32 %B
ret i32 %C
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret i32 %B
}
define i32 @test2(i32 %A, i32 %B) {
%C = select i1 true, i32 %A, i32 %B
ret i32 %C
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: ret i32 %A
}
@@ -22,7 +22,7 @@ define i32 @test3(i1 %C, i32 %I) {
; V = I
%V = select i1 %C, i32 %I, i32 %I
ret i32 %V
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: ret i32 %I
}
@@ -30,7 +30,7 @@ define i1 @test4(i1 %C) {
; V = C
%V = select i1 %C, i1 true, i1 false
ret i1 %V
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: ret i1 %C
}
@@ -38,7 +38,7 @@ define i1 @test5(i1 %C) {
; V = !C
%V = select i1 %C, i1 false, i1 true
ret i1 %V
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: xor i1 %C, true
; CHECK: ret i1
}
@@ -47,7 +47,7 @@ define i32 @test6(i1 %C) {
; V = cast C to int
%V = select i1 %C, i32 1, i32 0
ret i32 %V
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: %V = zext i1 %C to i32
; CHECK: ret i32 %V
}
@@ -56,7 +56,7 @@ define i1 @test7(i1 %C, i1 %X) {
; R = or C, X
%R = select i1 %C, i1 true, i1 %X
ret i1 %R
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: %R = or i1 %C, %X
; CHECK: ret i1 %R
}
@@ -65,7 +65,7 @@ define i1 @test8(i1 %C, i1 %X) {
; R = and C, X
%R = select i1 %C, i1 %X, i1 false
ret i1 %R
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: %R = and i1 %C, %X
; CHECK: ret i1 %R
}
@@ -74,7 +74,7 @@ define i1 @test9(i1 %C, i1 %X) {
; R = and !C, X
%R = select i1 %C, i1 false, i1 %X
ret i1 %R
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK: xor i1 %C, true
; CHECK: %R = and i1
; CHECK: ret i1 %R
@@ -84,7 +84,7 @@ define i1 @test10(i1 %C, i1 %X) {
; R = or !C, X
%R = select i1 %C, i1 %X, i1 true
ret i1 %R
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK: xor i1 %C, true
; CHECK: %R = or i1
; CHECK: ret i1 %R
@@ -94,7 +94,7 @@ define i32 @test11(i32 %a) {
%C = icmp eq i32 %a, 0
%R = select i1 %C, i32 0, i32 1
ret i32 %R
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK: icmp ne i32 %a, 0
; CHECK: %R = zext i1
; CHECK: ret i32 %R
@@ -104,7 +104,7 @@ define i32 @test12(i1 %cond, i32 %a) {
%b = or i32 %a, 1
%c = select i1 %cond, i32 %b, i32 %a
ret i32 %c
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK: %b = zext i1 %cond to i32
; CHECK: %c = or i32 %b, %a
; CHECK: ret i32 %c
@@ -114,7 +114,7 @@ define i32 @test12a(i1 %cond, i32 %a) {
%b = ashr i32 %a, 1
%c = select i1 %cond, i32 %b, i32 %a
ret i32 %c
-; CHECK: @test12a
+; CHECK-LABEL: @test12a(
; CHECK: %b = zext i1 %cond to i32
; CHECK: %c = ashr i32 %a, %b
; CHECK: ret i32 %c
@@ -124,7 +124,7 @@ define i32 @test12b(i1 %cond, i32 %a) {
%b = ashr i32 %a, 1
%c = select i1 %cond, i32 %a, i32 %b
ret i32 %c
-; CHECK: @test12b
+; CHECK-LABEL: @test12b(
; CHECK: zext i1 %cond to i32
; CHECK: %b = xor i32
; CHECK: %c = ashr i32 %a, %b
@@ -135,7 +135,7 @@ define i32 @test13(i32 %a, i32 %b) {
%C = icmp eq i32 %a, %b
%V = select i1 %C, i32 %a, i32 %b
ret i32 %V
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; CHECK: ret i32 %b
}
@@ -143,7 +143,7 @@ define i32 @test13a(i32 %a, i32 %b) {
%C = icmp ne i32 %a, %b
%V = select i1 %C, i32 %a, i32 %b
ret i32 %V
-; CHECK: @test13a
+; CHECK-LABEL: @test13a(
; CHECK: ret i32 %a
}
@@ -151,7 +151,7 @@ define i32 @test13b(i32 %a, i32 %b) {
%C = icmp eq i32 %a, %b
%V = select i1 %C, i32 %b, i32 %a
ret i32 %V
-; CHECK: @test13b
+; CHECK-LABEL: @test13b(
; CHECK: ret i32 %a
}
@@ -160,7 +160,7 @@ define i1 @test14a(i1 %C, i32 %X) {
; (X < 1) | !C
%R = icmp slt i32 %V, 1
ret i1 %R
-; CHECK: @test14a
+; CHECK-LABEL: @test14a(
; CHECK: icmp slt i32 %X, 1
; CHECK: xor i1 %C, true
; CHECK: or i1
@@ -172,7 +172,7 @@ define i1 @test14b(i1 %C, i32 %X) {
; (X < 1) | C
%R = icmp slt i32 %V, 1
ret i1 %R
-; CHECK: @test14b
+; CHECK-LABEL: @test14b(
; CHECK: icmp slt i32 %X, 1
; CHECK: or i1
; CHECK: ret i1 %R
@@ -184,7 +184,7 @@ define i32 @test15a(i32 %X) {
%t2 = icmp eq i32 %t1, 0
%t3 = select i1 %t2, i32 0, i32 16
ret i32 %t3
-; CHECK: @test15a
+; CHECK-LABEL: @test15a(
; CHECK: %t1 = and i32 %X, 16
; CHECK: ret i32 %t1
}
@@ -195,7 +195,7 @@ define i32 @test15b(i32 %X) {
%t2 = icmp eq i32 %t1, 0
%t3 = select i1 %t2, i32 32, i32 0
ret i32 %t3
-; CHECK: @test15b
+; CHECK-LABEL: @test15b(
; CHECK: %t1 = and i32 %X, 32
; CHECK: xor i32 %t1, 32
; CHECK: ret i32
@@ -207,7 +207,7 @@ define i32 @test15c(i32 %X) {
%t2 = icmp eq i32 %t1, 16
%t3 = select i1 %t2, i32 16, i32 0
ret i32 %t3
-; CHECK: @test15c
+; CHECK-LABEL: @test15c(
; CHECK: %t1 = and i32 %X, 16
; CHECK: ret i32 %t1
}
@@ -218,7 +218,7 @@ define i32 @test15d(i32 %X) {
%t2 = icmp ne i32 %t1, 0
%t3 = select i1 %t2, i32 16, i32 0
ret i32 %t3
-; CHECK: @test15d
+; CHECK-LABEL: @test15d(
; CHECK: %t1 = and i32 %X, 16
; CHECK: ret i32 %t1
}
@@ -229,7 +229,7 @@ define i32 @test15e(i32 %X) {
%t2 = icmp ne i32 %t1, 0
%t3 = select i1 %t2, i32 256, i32 0
ret i32 %t3
-; CHECK: @test15e
+; CHECK-LABEL: @test15e(
; CHECK: %t1 = shl i32 %X, 1
; CHECK: and i32 %t1, 256
; CHECK: ret i32
@@ -241,7 +241,7 @@ define i32 @test15f(i32 %X) {
%t2 = icmp ne i32 %t1, 0
%t3 = select i1 %t2, i32 0, i32 256
ret i32 %t3
-; CHECK: @test15f
+; CHECK-LABEL: @test15f(
; CHECK: %t1 = shl i32 %X, 1
; CHECK: and i32 %t1, 256
; CHECK: xor i32 %{{.*}}, 256
@@ -254,7 +254,7 @@ define i32 @test15g(i32 %X) {
%t2 = icmp ne i32 %t1, 0
%t3 = select i1 %t2, i32 -1, i32 -9
ret i32 %t3
-; CHECK: @test15g
+; CHECK-LABEL: @test15g(
; CHECK-NEXT: %1 = or i32 %X, -9
; CHECK-NEXT: ret i32 %1
}
@@ -265,7 +265,7 @@ define i32 @test15h(i32 %X) {
%t2 = icmp ne i32 %t1, 0
%t3 = select i1 %t2, i32 -9, i32 -1
ret i32 %t3
-; CHECK: @test15h
+; CHECK-LABEL: @test15h(
; CHECK-NEXT: %1 = or i32 %X, -9
; CHECK-NEXT: %2 = xor i32 %1, 8
; CHECK-NEXT: ret i32 %2
@@ -277,7 +277,7 @@ define i32 @test15i(i32 %X) {
%t2 = icmp ne i32 %t1, 0
%t3 = select i1 %t2, i32 577, i32 1089
ret i32 %t3
-; CHECK: @test15i
+; CHECK-LABEL: @test15i(
; CHECK-NEXT: %t1 = shl i32 %X, 8
; CHECK-NEXT: %1 = and i32 %t1, 512
; CHECK-NEXT: %2 = xor i32 %1, 512
@@ -291,7 +291,7 @@ define i32 @test15j(i32 %X) {
%t2 = icmp ne i32 %t1, 0
%t3 = select i1 %t2, i32 1089, i32 577
ret i32 %t3
-; CHECK: @test15j
+; CHECK-LABEL: @test15j(
; CHECK-NEXT: %t1 = shl i32 %X, 8
; CHECK-NEXT: %1 = and i32 %t1, 512
; CHECK-NEXT: %2 = add i32 %1, 577
@@ -302,7 +302,7 @@ define i32 @test16(i1 %C, i32* %P) {
%P2 = select i1 %C, i32* %P, i32* null
%V = load i32* %P2
ret i32 %V
-; CHECK: @test16
+; CHECK-LABEL: @test16(
; CHECK-NEXT: %V = load i32* %P
; CHECK: ret i32 %V
}
@@ -311,7 +311,7 @@ define i1 @test17(i32* %X, i1 %C) {
%R = select i1 %C, i32* %X, i32* null
%RV = icmp eq i32* %R, null
ret i1 %RV
-; CHECK: @test17
+; CHECK-LABEL: @test17(
; CHECK: icmp eq i32* %X, null
; CHECK: xor i1 %C, true
; CHECK: %RV = or i1
@@ -322,7 +322,7 @@ define i32 @test18(i32 %X, i32 %Y, i1 %C) {
%R = select i1 %C, i32 %X, i32 0
%V = sdiv i32 %Y, %R
ret i32 %V
-; CHECK: @test18
+; CHECK-LABEL: @test18(
; CHECK: %V = sdiv i32 %Y, %X
; CHECK: ret i32 %V
}
@@ -331,7 +331,7 @@ define i32 @test19(i32 %x) {
%tmp = icmp ugt i32 %x, 2147483647
%retval = select i1 %tmp, i32 -1, i32 0
ret i32 %retval
-; CHECK: @test19
+; CHECK-LABEL: @test19(
; CHECK-NEXT: ashr i32 %x, 31
; CHECK-NEXT: ret i32
}
@@ -340,7 +340,7 @@ define i32 @test20(i32 %x) {
%tmp = icmp slt i32 %x, 0
%retval = select i1 %tmp, i32 -1, i32 0
ret i32 %retval
-; CHECK: @test20
+; CHECK-LABEL: @test20(
; CHECK-NEXT: ashr i32 %x, 31
; CHECK-NEXT: ret i32
}
@@ -349,7 +349,7 @@ define i64 @test21(i32 %x) {
%tmp = icmp slt i32 %x, 0
%retval = select i1 %tmp, i64 -1, i64 0
ret i64 %retval
-; CHECK: @test21
+; CHECK-LABEL: @test21(
; CHECK-NEXT: ashr i32 %x, 31
; CHECK-NEXT: sext i32
; CHECK-NEXT: ret i64
@@ -359,7 +359,7 @@ define i16 @test22(i32 %x) {
%tmp = icmp slt i32 %x, 0
%retval = select i1 %tmp, i16 -1, i16 0
ret i16 %retval
-; CHECK: @test22
+; CHECK-LABEL: @test22(
; CHECK-NEXT: ashr i32 %x, 31
; CHECK-NEXT: trunc i32
; CHECK-NEXT: ret i16
@@ -368,7 +368,7 @@ define i16 @test22(i32 %x) {
define i1 @test23(i1 %a, i1 %b) {
%c = select i1 %a, i1 %b, i1 %a
ret i1 %c
-; CHECK: @test23
+; CHECK-LABEL: @test23(
; CHECK-NEXT: %c = and i1 %a, %b
; CHECK-NEXT: ret i1 %c
}
@@ -376,7 +376,7 @@ define i1 @test23(i1 %a, i1 %b) {
define i1 @test24(i1 %a, i1 %b) {
%c = select i1 %a, i1 %a, i1 %b
ret i1 %c
-; CHECK: @test24
+; CHECK-LABEL: @test24(
; CHECK-NEXT: %c = or i1 %a, %b
; CHECK-NEXT: ret i1 %c
}
@@ -390,7 +390,7 @@ ret:
%a = phi i1 [true, %jump], [false, %entry]
%b = select i1 %a, i32 10, i32 20
ret i32 %b
-; CHECK: @test25
+; CHECK-LABEL: @test25(
; CHECK: %a = phi i32 [ 10, %jump ], [ 20, %entry ]
; CHECK-NEXT: ret i32 %a
}
@@ -405,7 +405,7 @@ ret:
%a = phi i1 [true, %jump], [%c, %entry]
%b = select i1 %a, i32 10, i32 20
ret i32 %b
-; CHECK: @test26
+; CHECK-LABEL: @test26(
; CHECK: %a = phi i32 [ 10, %jump ], [ 20, %entry ]
; CHECK-NEXT: ret i32 %a
}
@@ -419,7 +419,7 @@ ret:
%a = phi i1 [true, %jump], [false, %entry]
%b = select i1 %a, i32 %A, i32 %B
ret i32 %b
-; CHECK: @test27
+; CHECK-LABEL: @test27(
; CHECK: %a = phi i32 [ %A, %jump ], [ %B, %entry ]
; CHECK-NEXT: ret i32 %a
}
@@ -434,7 +434,7 @@ ret:
%a = phi i1 [true, %jump], [false, %entry]
%b = select i1 %a, i32 %A, i32 %c
ret i32 %b
-; CHECK: @test28
+; CHECK-LABEL: @test28(
; CHECK: %a = phi i32 [ %A, %jump ], [ %B, %entry ]
; CHECK-NEXT: ret i32 %a
}
@@ -452,7 +452,7 @@ ret:
next:
%b = select i1 %a, i32 %A, i32 %c
ret i32 %b
-; CHECK: @test29
+; CHECK-LABEL: @test29(
; CHECK: %a = phi i32 [ %A, %jump ], [ %B, %entry ]
; CHECK: ret i32 %a
}
@@ -466,7 +466,7 @@ define i32 @test30(i32 %x, i32 %y) {
%cmp5 = icmp sgt i32 %cond, %x
%retval = select i1 %cmp5, i32 %cond, i32 %x
ret i32 %retval
-; CHECK: @test30
+; CHECK-LABEL: @test30(
; CHECK: ret i32 %cond
}
@@ -477,7 +477,7 @@ define i32 @test31(i32 %x, i32 %y) {
%cmp5 = icmp ugt i32 %cond, %x
%retval = select i1 %cmp5, i32 %cond, i32 %x
ret i32 %retval
-; CHECK: @test31
+; CHECK-LABEL: @test31(
; CHECK: ret i32 %cond
}
@@ -488,7 +488,7 @@ define i32 @test32(i32 %x, i32 %y) {
%cmp5 = icmp sgt i32 %cond, %x
%retval = select i1 %cmp5, i32 %x, i32 %cond
ret i32 %retval
-; CHECK: @test32
+; CHECK-LABEL: @test32(
; CHECK: ret i32 %cond
}
@@ -499,7 +499,7 @@ define i32 @test33(i32 %x, i32 %y) {
%cmp5 = icmp sgt i32 %cond, %x
%retval = select i1 %cmp5, i32 %cond, i32 %x
ret i32 %retval
-; CHECK: @test33
+; CHECK-LABEL: @test33(
; CHECK: ret i32 %x
}
@@ -510,7 +510,7 @@ define i32 @test34(i32 %x, i32 %y) {
%cmp5 = icmp sgt i32 %cond, %x
%retval = select i1 %cmp5, i32 %x, i32 %cond
ret i32 %retval
-; CHECK: @test34
+; CHECK-LABEL: @test34(
; CHECK: ret i32 %x
}
@@ -518,7 +518,7 @@ define i32 @test35(i32 %x) {
%cmp = icmp sge i32 %x, 0
%cond = select i1 %cmp, i32 60, i32 100
ret i32 %cond
-; CHECK: @test35
+; CHECK-LABEL: @test35(
; CHECK: ashr i32 %x, 31
; CHECK: and i32 {{.*}}, 40
; CHECK: add i32 {{.*}}, 60
@@ -529,7 +529,7 @@ define i32 @test36(i32 %x) {
%cmp = icmp slt i32 %x, 0
%cond = select i1 %cmp, i32 60, i32 100
ret i32 %cond
-; CHECK: @test36
+; CHECK-LABEL: @test36(
; CHECK: ashr i32 %x, 31
; CHECK: and i32 {{.*}}, -40
; CHECK: add i32 {{.*}}, 100
@@ -540,7 +540,7 @@ define i32 @test37(i32 %x) {
%cmp = icmp sgt i32 %x, -1
%cond = select i1 %cmp, i32 1, i32 -1
ret i32 %cond
-; CHECK: @test37
+; CHECK-LABEL: @test37(
; CHECK: ashr i32 %x, 31
; CHECK: or i32 {{.*}}, 1
; CHECK: ret
@@ -552,7 +552,7 @@ define i1 @test38(i1 %cond) {
%ptr = select i1 %cond, i32* %zero, i32* %one
%isnull = icmp eq i32* %ptr, null
ret i1 %isnull
-; CHECK: @test38
+; CHECK-LABEL: @test38(
; CHECK: ret i1 false
}
@@ -560,7 +560,7 @@ define i1 @test39(i1 %cond, double %x) {
%s = select i1 %cond, double %x, double 0x7FF0000000000000 ; RHS = +infty
%cmp = fcmp ule double %x, %s
ret i1 %cmp
-; CHECK: @test39
+; CHECK-LABEL: @test39(
; CHECK: ret i1 true
}
@@ -571,7 +571,7 @@ define i1 @test40(i1 %cond) {
%s = select i1 %cond, i32* %a, i32* %b
%r = icmp eq i32* %s, %c
ret i1 %r
-; CHECK: @test40
+; CHECK-LABEL: @test40(
; CHECK: ret i1 false
}
@@ -580,7 +580,7 @@ define i32 @test41(i1 %cond, i32 %x, i32 %y) {
%s = select i1 %cond, i32 %y, i32 %z
%r = and i32 %x, %s
ret i32 %r
-; CHECK: @test41
+; CHECK-LABEL: @test41(
; CHECK-NEXT: and i32 %x, %y
; CHECK-NEXT: ret i32
}
@@ -590,7 +590,7 @@ define i32 @test42(i32 %x, i32 %y) {
%cond = icmp eq i32 %x, 0
%c = select i1 %cond, i32 %b, i32 %y
ret i32 %c
-; CHECK: @test42
+; CHECK-LABEL: @test42(
; CHECK-NEXT: %cond = icmp eq i32 %x, 0
; CHECK-NEXT: %b = sext i1 %cond to i32
; CHECK-NEXT: %c = add i32 %b, %y
@@ -602,7 +602,7 @@ define i64 @test43(i32 %a) nounwind {
%is_a_nonnegative = icmp sgt i32 %a, -1
%max = select i1 %is_a_nonnegative, i64 %a_ext, i64 0
ret i64 %max
-; CHECK: @test43
+; CHECK-LABEL: @test43(
; CHECK-NEXT: %a_ext = sext i32 %a to i64
; CHECK-NEXT: %is_a_nonnegative = icmp slt i64 %a_ext, 0
; CHECK-NEXT: %max = select i1 %is_a_nonnegative, i64 0, i64 %a_ext
@@ -614,7 +614,7 @@ define i64 @test44(i32 %a) nounwind {
%is_a_nonpositive = icmp slt i32 %a, 1
%min = select i1 %is_a_nonpositive, i64 %a_ext, i64 0
ret i64 %min
-; CHECK: @test44
+; CHECK-LABEL: @test44(
; CHECK-NEXT: %a_ext = sext i32 %a to i64
; CHECK-NEXT: %is_a_nonpositive = icmp sgt i64 %a_ext, 0
; CHECK-NEXT: %min = select i1 %is_a_nonpositive, i64 0, i64 %a_ext
@@ -625,7 +625,7 @@ define i64 @test45(i32 %a) nounwind {
%is_a_nonnegative = icmp ugt i32 %a, 2
%max = select i1 %is_a_nonnegative, i64 %a_ext, i64 3
ret i64 %max
-; CHECK: @test45
+; CHECK-LABEL: @test45(
; CHECK-NEXT: %a_ext = zext i32 %a to i64
; CHECK-NEXT: %is_a_nonnegative = icmp ult i64 %a_ext, 3
; CHECK-NEXT: %max = select i1 %is_a_nonnegative, i64 3, i64 %a_ext
@@ -637,7 +637,7 @@ define i64 @test46(i32 %a) nounwind {
%is_a_nonpositive = icmp ult i32 %a, 3
%min = select i1 %is_a_nonpositive, i64 %a_ext, i64 2
ret i64 %min
-; CHECK: @test46
+; CHECK-LABEL: @test46(
; CHECK-NEXT: %a_ext = zext i32 %a to i64
; CHECK-NEXT: %is_a_nonpositive = icmp ugt i64 %a_ext, 2
; CHECK-NEXT: %min = select i1 %is_a_nonpositive, i64 2, i64 %a_ext
@@ -648,7 +648,7 @@ define i64 @test47(i32 %a) nounwind {
%is_a_nonnegative = icmp ugt i32 %a, 2
%max = select i1 %is_a_nonnegative, i64 %a_ext, i64 3
ret i64 %max
-; CHECK: @test47
+; CHECK-LABEL: @test47(
; CHECK-NEXT: %a_ext = sext i32 %a to i64
; CHECK-NEXT: %is_a_nonnegative = icmp ult i64 %a_ext, 3
; CHECK-NEXT: %max = select i1 %is_a_nonnegative, i64 3, i64 %a_ext
@@ -660,7 +660,7 @@ define i64 @test48(i32 %a) nounwind {
%is_a_nonpositive = icmp ult i32 %a, 3
%min = select i1 %is_a_nonpositive, i64 %a_ext, i64 2
ret i64 %min
-; CHECK: @test48
+; CHECK-LABEL: @test48(
; CHECK-NEXT: %a_ext = sext i32 %a to i64
; CHECK-NEXT: %is_a_nonpositive = icmp ugt i64 %a_ext, 2
; CHECK-NEXT: %min = select i1 %is_a_nonpositive, i64 2, i64 %a_ext
@@ -672,7 +672,7 @@ define i64 @test49(i32 %a) nounwind {
%is_a_nonpositive = icmp ult i32 %a, 3
%min = select i1 %is_a_nonpositive, i64 2, i64 %a_ext
ret i64 %min
-; CHECK: @test49
+; CHECK-LABEL: @test49(
; CHECK-NEXT: %a_ext = sext i32 %a to i64
; CHECK-NEXT: %is_a_nonpositive = icmp ugt i64 %a_ext, 2
; CHECK-NEXT: %min = select i1 %is_a_nonpositive, i64 %a_ext, i64 2
@@ -683,7 +683,7 @@ define i64 @test50(i32 %a) nounwind {
%a_ext = sext i32 %a to i64
%min = select i1 %is_a_nonpositive, i64 2, i64 %a_ext
ret i64 %min
-; CHECK: @test50
+; CHECK-LABEL: @test50(
; CHECK-NEXT: %a_ext = sext i32 %a to i64
; CHECK-NEXT: %is_a_nonpositive = icmp ugt i64 %a_ext, 2
; CHECK-NEXT: %min = select i1 %is_a_nonpositive, i64 %a_ext, i64 2
@@ -695,7 +695,7 @@ define i64 @test50(i32 %a) nounwind {
; This select instruction can't be eliminated because trying to do so would
; change the number of vector elements. This used to assert.
define i48 @test51(<3 x i1> %icmp, <3 x i16> %tmp) {
-; CHECK: @test51
+; CHECK-LABEL: @test51(
%select = select <3 x i1> %icmp, <3 x i16> zeroinitializer, <3 x i16> %tmp
; CHECK: select <3 x i1>
%tmp2 = bitcast <3 x i16> %select to i48
@@ -705,7 +705,7 @@ define i48 @test51(<3 x i1> %icmp, <3 x i16> %tmp) {
; PR8575
define i32 @test52(i32 %n, i32 %m) nounwind {
-; CHECK: @test52
+; CHECK-LABEL: @test52(
%cmp = icmp sgt i32 %n, %m
%. = select i1 %cmp, i32 1, i32 3
%add = add nsw i32 %., 3
@@ -720,7 +720,7 @@ define i32 @test53(i32 %x) nounwind {
%cmp = icmp eq i32 %and, %x
%sel = select i1 %cmp, i32 2, i32 1
ret i32 %sel
-; CHECK: @test53
+; CHECK-LABEL: @test53(
; CHECK: select i1 %cmp
; CHECK: ret
}
@@ -730,7 +730,7 @@ define i32 @test54(i32 %X, i32 %Y) {
%B = icmp eq i32 %A, 0
%C = select i1 %B, i32 %A, i32 1
ret i32 %C
-; CHECK: @test54
+; CHECK-LABEL: @test54(
; CHECK-NOT: ashr
; CHECK-NOT: select
; CHECK: icmp ne i32 %X, 0
@@ -743,7 +743,7 @@ define i1 @test55(i1 %X, i32 %Y, i32 %Z) {
%B = select i1 %X, i32 %Y, i32 %A
%C = icmp eq i32 %B, 0
ret i1 %C
-; CHECK: @test55
+; CHECK-LABEL: @test55(
; CHECK-NOT: ashr
; CHECK-NOT: select
; CHECK: icmp eq
@@ -755,7 +755,7 @@ define i32 @test56(i16 %x) nounwind {
%conv = zext i16 %x to i32
%cond = select i1 %tobool, i32 0, i32 %conv
ret i32 %cond
-; CHECK: @test56
+; CHECK-LABEL: @test56(
; CHECK-NEXT: zext
; CHECK-NEXT: ret
}
@@ -765,7 +765,7 @@ define i32 @test57(i32 %x, i32 %y) nounwind {
%tobool = icmp eq i32 %x, 0
%.and = select i1 %tobool, i32 0, i32 %and
ret i32 %.and
-; CHECK: @test57
+; CHECK-LABEL: @test57(
; CHECK-NEXT: and i32 %x, %y
; CHECK-NEXT: ret
}
@@ -775,7 +775,7 @@ define i32 @test58(i16 %x) nounwind {
%conv = zext i16 %x to i32
%cond = select i1 %tobool, i32 %conv, i32 1
ret i32 %cond
-; CHECK: @test58
+; CHECK-LABEL: @test58(
; CHECK-NEXT: zext
; CHECK-NEXT: ret
}
@@ -785,7 +785,7 @@ define i32 @test59(i32 %x, i32 %y) nounwind {
%tobool = icmp ne i32 %x, %y
%.and = select i1 %tobool, i32 %and, i32 %y
ret i32 %.and
-; CHECK: @test59
+; CHECK-LABEL: @test59(
; CHECK-NEXT: and i32 %x, %y
; CHECK-NEXT: ret
}
@@ -796,7 +796,7 @@ define i1 @test60(i32 %x, i1* %y) nounwind {
%cmp1 = icmp slt i32 %x, 1
%sel = select i1 %cmp, i1 %load, i1 %cmp1
ret i1 %sel
-; CHECK: @test60
+; CHECK-LABEL: @test60(
; CHECK: select
}
@@ -806,7 +806,7 @@ define i32 @test61(i32* %ptr) {
%B = icmp eq i32* %ptr, @glbl
%C = select i1 %B, i32 %A, i32 10
ret i32 %C
-; CHECK: @test61
+; CHECK-LABEL: @test61(
; CHECK: ret i32 10
}
@@ -814,7 +814,7 @@ define i1 @test62(i1 %A, i1 %B) {
%not = xor i1 %A, true
%C = select i1 %A, i1 %not, i1 %B
ret i1 %C
-; CHECK: @test62
+; CHECK-LABEL: @test62(
; CHECK: %not = xor i1 %A, true
; CHECK: %C = and i1 %not, %B
; CHECK: ret i1 %C
@@ -824,7 +824,7 @@ define i1 @test63(i1 %A, i1 %B) {
%not = xor i1 %A, true
%C = select i1 %A, i1 %B, i1 %not
ret i1 %C
-; CHECK: @test63
+; CHECK-LABEL: @test63(
; CHECK: %not = xor i1 %A, true
; CHECK: %C = or i1 %B, %not
; CHECK: ret i1 %C
@@ -860,11 +860,11 @@ cond.end17:
while.body:
br label %while.body
-; CHECK: @test64
+; CHECK-LABEL: @test64(
; CHECK-NOT: select
}
-; CHECK: @select_icmp_eq_and_1_0_or_2
+; CHECK-LABEL: @select_icmp_eq_and_1_0_or_2(
; CHECK-NEXT: [[SHL:%[a-z0-9]+]] = shl i32 %x, 1
; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i32 [[SHL]], 2
; CHECK-NEXT: [[OR:%[a-z0-9]+]] = or i32 [[AND]], %y
@@ -877,7 +877,7 @@ define i32 @select_icmp_eq_and_1_0_or_2(i32 %x, i32 %y) {
ret i32 %select
}
-; CHECK: @select_icmp_eq_and_32_0_or_8
+; CHECK-LABEL: @select_icmp_eq_and_32_0_or_8(
; CHECK-NEXT: [[LSHR:%[a-z0-9]+]] = lshr i32 %x, 2
; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i32 [[LSHR]], 8
; CHECK-NEXT: [[OR:%[a-z0-9]+]] = or i32 [[AND]], %y
@@ -890,7 +890,7 @@ define i32 @select_icmp_eq_and_32_0_or_8(i32 %x, i32 %y) {
ret i32 %select
}
-; CHECK: @select_icmp_ne_0_and_4096_or_4096
+; CHECK-LABEL: @select_icmp_ne_0_and_4096_or_4096(
; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i32 %x, 4096
; CHECK-NEXT: [[XOR:%[a-z0-9]+]] = xor i32 [[AND]], 4096
; CHECK-NEXT: [[OR:%[a-z0-9]+]] = or i32 [[XOR]], %y
@@ -903,7 +903,7 @@ define i32 @select_icmp_ne_0_and_4096_or_4096(i32 %x, i32 %y) {
ret i32 %select
}
-; CHECK: @select_icmp_eq_and_4096_0_or_4096
+; CHECK-LABEL: @select_icmp_eq_and_4096_0_or_4096(
; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i32 %x, 4096
; CHECK-NEXT: [[OR:%[a-z0-9]+]] = or i32 [[AND]], %y
; CHECK-NEXT: ret i32 [[OR]]
@@ -915,7 +915,7 @@ define i32 @select_icmp_eq_and_4096_0_or_4096(i32 %x, i32 %y) {
ret i32 %select
}
-; CHECK: @select_icmp_eq_0_and_1_or_1
+; CHECK-LABEL: @select_icmp_eq_0_and_1_or_1(
; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i64 %x, 1
; CHECK-NEXT: [[ZEXT:%[a-z0-9]+]] = trunc i64 [[AND]] to i32
; CHECK-NEXT: [[OR:%[a-z0-9]+]] = or i32 [[XOR]], %y
@@ -928,7 +928,7 @@ define i32 @select_icmp_eq_0_and_1_or_1(i64 %x, i32 %y) {
ret i32 %select
}
-; CHECK: @select_icmp_ne_0_and_4096_or_32
+; CHECK-LABEL: @select_icmp_ne_0_and_4096_or_32(
; CHECK-NEXT: [[LSHR:%[a-z0-9]+]] = lshr i32 %x, 7
; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i32 [[LSHR]], 32
; CHECK-NEXT: [[XOR:%[a-z0-9]+]] = xor i32 [[AND]], 32
@@ -942,7 +942,7 @@ define i32 @select_icmp_ne_0_and_4096_or_32(i32 %x, i32 %y) {
ret i32 %select
}
-; CHECK: @select_icmp_ne_0_and_32_or_4096
+; CHECK-LABEL: @select_icmp_ne_0_and_32_or_4096(
; CHECK-NEXT: [[SHL:%[a-z0-9]+]] = shl i32 %x, 7
; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i32 [[SHL]], 4096
; CHECK-NEXT: [[XOR:%[a-z0-9]+]] = xor i32 [[AND]], 4096
@@ -956,7 +956,7 @@ define i32 @select_icmp_ne_0_and_32_or_4096(i32 %x, i32 %y) {
ret i32 %select
}
-; CHECK: @select_icmp_ne_0_and_1073741824_or_8
+; CHECK-LABEL: @select_icmp_ne_0_and_1073741824_or_8(
; CHECK-NEXT: [[LSHR:%[a-z0-9]+]] = lshr i32 %x, 27
; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i32 [[LSHR]], 8
; CHECK-NEXT: [[TRUNC:%[a-z0-9]+]] = trunc i32 [[AND]] to i8
@@ -971,7 +971,7 @@ define i8 @select_icmp_ne_0_and_1073741824_or_8(i32 %x, i8 %y) {
ret i8 %select
}
-; CHECK: @select_icmp_ne_0_and_8_or_1073741824
+; CHECK-LABEL: @select_icmp_ne_0_and_8_or_1073741824(
; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i8 %x, 8
; CHECK-NEXT: [[ZEXT:%[a-z0-9]+]] = zext i8 [[AND]] to i32
; CHECK-NEXT: [[SHL:%[a-z0-9]+]] = shl nuw nsw i32 [[ZEXT]], 27
@@ -985,3 +985,49 @@ define i32 @select_icmp_ne_0_and_8_or_1073741824(i8 %x, i32 %y) {
%select = select i1 %cmp, i32 %y, i32 %or
ret i32 %select
}
+
+; We can't combine here, because the cmp is scalar and the or vector.
+; Just make sure we don't assert.
+define <2 x i32> @select_icmp_eq_and_1_0_or_vector_of_2s(i32 %x, <2 x i32> %y) {
+ %and = and i32 %x, 1
+ %cmp = icmp eq i32 %and, 0
+ %or = or <2 x i32> %y, <i32 2, i32 2>
+ %select = select i1 %cmp, <2 x i32> %y, <2 x i32> %or
+ ret <2 x i32> %select
+}
+
+define i32 @test65(i64 %x) {
+ %1 = and i64 %x, 16
+ %2 = icmp ne i64 %1, 0
+ %3 = select i1 %2, i32 40, i32 42
+ ret i32 %3
+
+; CHECK-LABEL: @test65(
+; CHECK: and i64 %x, 16
+; CHECK: trunc i64 %1 to i32
+; CHECK: lshr exact i32 %2, 3
+; CHECK: xor i32 %3, 42
+}
+
+define i32 @test66(i64 %x) {
+ %1 = and i64 %x, 4294967296
+ %2 = icmp ne i64 %1, 0
+ %3 = select i1 %2, i32 40, i32 42
+ ret i32 %3
+
+; CHECK-LABEL: @test66(
+; CHECK: select
+}
+
+define i32 @test67(i16 %x) {
+ %1 = and i16 %x, 4
+ %2 = icmp ne i16 %1, 0
+ %3 = select i1 %2, i32 40, i32 42
+ ret i32 %3
+
+; CHECK-LABEL: @test67(
+; CHECK: and i16 %x, 4
+; CHECK: zext i16 %1 to i32
+; CHECK: lshr exact i32 %2, 1
+; CHECK: xor i32 %3, 42
+}
diff --git a/test/Transforms/InstCombine/sext.ll b/test/Transforms/InstCombine/sext.ll
index 968f37c9c129..b8dfe2257b18 100644
--- a/test/Transforms/InstCombine/sext.ll
+++ b/test/Transforms/InstCombine/sext.ll
@@ -11,7 +11,7 @@ define i64 @test1(i32 %x) {
%s = sext i32 %t to i64
ret i64 %s
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: zext i32 %t
}
@@ -20,7 +20,7 @@ define i64 @test2(i32 %x) {
%s = sext i32 %t to i64
ret i64 %s
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: zext i32 %t
}
@@ -29,7 +29,7 @@ define i64 @test3(i32 %x) {
%s = sext i32 %t to i64
ret i64 %s
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: zext i32 %t
}
@@ -38,7 +38,7 @@ define i64 @test4(i32 %x) {
%s = sext i32 %t to i64
ret i64 %s
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: zext i32 %t
}
@@ -46,7 +46,7 @@ define i64 @test5(i32 %x) {
%t = urem i32 %x, 30000
%s = sext i32 %t to i64
ret i64 %s
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: zext i32 %t
}
@@ -55,7 +55,7 @@ define i64 @test6(i32 %x) {
%t = mul i32 %u, 3
%s = sext i32 %t to i64
ret i64 %s
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: zext i32 %t
}
@@ -64,7 +64,7 @@ define i64 @test7(i32 %x) {
%u = sub i32 20000, %t
%s = sext i32 %u to i64
ret i64 %s
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: zext i32 %u to i64
}
@@ -74,7 +74,7 @@ define i32 @test8(i8 %a, i32 %f, i1 %p, i32* %z) {
%s = trunc i32 %e to i16
%n = sext i16 %s to i32
ret i32 %n
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: %d = lshr i32 %f, 24
; CHECK: %n = select i1 %p, i32 %d, i32 0
; CHECK: ret i32 %n
@@ -92,7 +92,7 @@ F:
%V = phi i32 [%t2, %T], [42, %entry]
%W = trunc i32 %V to i16
ret i16 %W
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK: T:
; CHECK-NEXT: br label %F
; CHECK: F:
@@ -108,7 +108,7 @@ entry:
%a = ashr i8 %tmp16, 6
%b = sext i8 %a to i32
ret i32 %b
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK: shl i32 %i, 30
; CHECK-NEXT: ashr exact i32
; CHECK-NEXT: ret i32
@@ -120,7 +120,7 @@ define void @test11(<2 x i16> %srcA, <2 x i16> %srcB, <2 x i16>* %dst) {
%tmask = ashr <2 x i16> %sext, <i16 15, i16 15>
store <2 x i16> %tmask, <2 x i16>* %dst
ret void
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK-NEXT: icmp eq
; CHECK-NEXT: sext <2 x i1>
; CHECK-NEXT: store <2 x i16>
@@ -132,7 +132,7 @@ define i64 @test12(i32 %x) nounwind {
%sub = sub nsw i32 0, %shr
%conv = sext i32 %sub to i64
ret i64 %conv
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK: sext
; CHECK: ret
}
@@ -142,7 +142,7 @@ define i32 @test13(i32 %x) nounwind {
%cmp = icmp eq i32 %and, 0
%ext = sext i1 %cmp to i32
ret i32 %ext
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; CHECK-NEXT: %and = lshr i32 %x, 3
; CHECK-NEXT: %1 = and i32 %and, 1
; CHECK-NEXT: %sext = add i32 %1, -1
@@ -154,7 +154,7 @@ define i32 @test14(i16 %x) nounwind {
%cmp = icmp ne i16 %and, 16
%ext = sext i1 %cmp to i32
ret i32 %ext
-; CHECK: @test14
+; CHECK-LABEL: @test14(
; CHECK-NEXT: %and = lshr i16 %x, 4
; CHECK-NEXT: %1 = and i16 %and, 1
; CHECK-NEXT: %sext = add i16 %1, -1
@@ -167,7 +167,7 @@ define i32 @test15(i32 %x) nounwind {
%cmp = icmp ne i32 %and, 0
%ext = sext i1 %cmp to i32
ret i32 %ext
-; CHECK: @test15
+; CHECK-LABEL: @test15(
; CHECK-NEXT: %1 = shl i32 %x, 27
; CHECK-NEXT: %sext = ashr i32 %1, 31
; CHECK-NEXT: ret i32 %sext
@@ -178,7 +178,7 @@ define i32 @test16(i16 %x) nounwind {
%cmp = icmp eq i16 %and, 8
%ext = sext i1 %cmp to i32
ret i32 %ext
-; CHECK: @test16
+; CHECK-LABEL: @test16(
; CHECK-NEXT: %1 = shl i16 %x, 12
; CHECK-NEXT: %sext = ashr i16 %1, 15
; CHECK-NEXT: %ext = sext i16 %sext to i32
@@ -189,7 +189,7 @@ define i32 @test17(i1 %x) nounwind {
%c1 = sext i1 %x to i32
%c2 = sub i32 0, %c1
ret i32 %c2
-; CHECK: @test17
+; CHECK-LABEL: @test17(
; CHECK-NEXT: [[TEST17:%.*]] = zext i1 %x to i32
; CHECK-NEXT: ret i32 [[TEST17]]
}
diff --git a/test/Transforms/InstCombine/shift-sra.ll b/test/Transforms/InstCombine/shift-sra.ll
index a578bbe4d4fc..75235500d513 100644
--- a/test/Transforms/InstCombine/shift-sra.ll
+++ b/test/Transforms/InstCombine/shift-sra.ll
@@ -7,7 +7,7 @@ define i32 @test1(i32 %X, i8 %A) {
%Y = ashr i32 %X, %shift.upgrd.1 ; <i32> [#uses=1]
%Z = and i32 %Y, 1 ; <i32> [#uses=1]
ret i32 %Z
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: lshr i32 %X, %shift.upgrd.1
}
@@ -16,7 +16,7 @@ define i32 @test2(i8 %tmp) {
%tmp4 = add i32 %tmp3, 7 ; <i32> [#uses=1]
%tmp5 = ashr i32 %tmp4, 3 ; <i32> [#uses=1]
ret i32 %tmp5
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: lshr i32 %tmp4, 3
}
@@ -33,7 +33,7 @@ C:
%S = ashr i64 %P, 12
ret i64 %S
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: %P = phi i64
; CHECK-NEXT: ret i64 %P
}
@@ -52,7 +52,7 @@ C:
%S = ashr i64 %R, 12
ret i64 %S
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: %P = phi i64
; CHECK-NEXT: ret i64 %P
}
@@ -70,7 +70,7 @@ D:
%P = phi i32 [0, %A], [0, %B], [%Y, %C]
%S = ashr i32 %P, 16
ret i32 %S
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: %P = phi i32
; CHECK-NEXT: ashr i32 %P, 16
E:
diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll
index 41f8aa9ee812..b1082f06ef74 100644
--- a/test/Transforms/InstCombine/shift.ll
+++ b/test/Transforms/InstCombine/shift.ll
@@ -3,14 +3,14 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
define i32 @test1(i32 %A) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret i32 %A
%B = shl i32 %A, 0 ; <i32> [#uses=1]
ret i32 %B
}
define i32 @test2(i8 %A) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: ret i32 0
%shift.upgrd.1 = zext i8 %A to i32 ; <i32> [#uses=1]
%B = shl i32 0, %shift.upgrd.1 ; <i32> [#uses=1]
@@ -18,14 +18,14 @@ define i32 @test2(i8 %A) {
}
define i32 @test3(i32 %A) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: ret i32 %A
%B = ashr i32 %A, 0 ; <i32> [#uses=1]
ret i32 %B
}
define i32 @test4(i8 %A) {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: ret i32 0
%shift.upgrd.2 = zext i8 %A to i32 ; <i32> [#uses=1]
%B = ashr i32 0, %shift.upgrd.2 ; <i32> [#uses=1]
@@ -34,35 +34,35 @@ define i32 @test4(i8 %A) {
define i32 @test5(i32 %A) {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: ret i32 undef
%B = lshr i32 %A, 32 ;; shift all bits out
ret i32 %B
}
define i32 @test5a(i32 %A) {
-; CHECK: @test5a
+; CHECK-LABEL: @test5a(
; CHECK: ret i32 undef
%B = shl i32 %A, 32 ;; shift all bits out
ret i32 %B
}
define i32 @test5b() {
-; CHECK: @test5b
+; CHECK-LABEL: @test5b(
; CHECK: ret i32 -1
%B = ashr i32 undef, 2 ;; top two bits must be equal, so not undef
ret i32 %B
}
define i32 @test5b2(i32 %A) {
-; CHECK: @test5b2
+; CHECK-LABEL: @test5b2(
; CHECK: ret i32 -1
%B = ashr i32 undef, %A ;; top %A bits must be equal, so not undef
ret i32 %B
}
define i32 @test6(i32 %A) {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NEXT: mul i32 %A, 6
; CHECK-NEXT: ret i32
%B = shl i32 %A, 1 ;; convert to an mul instruction
@@ -71,7 +71,7 @@ define i32 @test6(i32 %A) {
}
define i32 @test6a(i32 %A) {
-; CHECK: @test6a
+; CHECK-LABEL: @test6a(
; CHECK-NEXT: mul i32 %A, 6
; CHECK-NEXT: ret i32
%B = mul i32 %A, 3
@@ -80,7 +80,7 @@ define i32 @test6a(i32 %A) {
}
define i32 @test7(i8 %A) {
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NEXT: ret i32 -1
%shift.upgrd.3 = zext i8 %A to i32
%B = ashr i32 -1, %shift.upgrd.3 ;; Always equal to -1
@@ -89,7 +89,7 @@ define i32 @test7(i8 %A) {
;; (A << 5) << 3 === A << 8 == 0
define i8 @test8(i8 %A) {
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: ret i8 0
%B = shl i8 %A, 5 ; <i8> [#uses=1]
%C = shl i8 %B, 3 ; <i8> [#uses=1]
@@ -98,7 +98,7 @@ define i8 @test8(i8 %A) {
;; (A << 7) >> 7 === A & 1
define i8 @test9(i8 %A) {
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK-NEXT: and i8 %A, 1
; CHECK-NEXT: ret i8
%B = shl i8 %A, 7 ; <i8> [#uses=1]
@@ -110,7 +110,7 @@ define i8 @test9(i8 %A) {
;; (A >> 7) << 7 === A & 128
;; The shl may be valuable to scalar evolution.
define i8 @test10(i8 %A) {
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK-NEXT: and i8 %A, -128
; CHECK-NEXT: ret i8
%B = lshr i8 %A, 7 ; <i8> [#uses=1]
@@ -120,7 +120,7 @@ define i8 @test10(i8 %A) {
;; Allow the simplification when the lshr shift is exact.
define i8 @test10a(i8 %A) {
-; CHECK: @test10a
+; CHECK-LABEL: @test10a(
; CHECK-NEXT: ret i8 %A
%B = lshr exact i8 %A, 7
%C = shl i8 %B, 7
@@ -131,7 +131,7 @@ define i8 @test10a(i8 %A) {
;; (A >> 3) << 4 === (A & 0x1F) << 1
;; The shl may be valuable to scalar evolution.
define i8 @test11(i8 %A) {
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK: shl i8
; CHECK-NEXT: ret i8
%a = mul i8 %A, 3 ; <i8> [#uses=1]
@@ -142,7 +142,7 @@ define i8 @test11(i8 %A) {
;; Allow the simplification in InstCombine when the lshr shift is exact.
define i8 @test11a(i8 %A) {
-; CHECK: @test11a
+; CHECK-LABEL: @test11a(
; CHECK-NEXT: mul i8 %A, 6
; CHECK-NEXT: ret i8
%a = mul i8 %A, 3
@@ -154,7 +154,7 @@ define i8 @test11a(i8 %A) {
;; This is deferred to DAGCombine unless %B is single-use.
;; (A >> 8) << 8 === A & -256
define i32 @test12(i32 %A) {
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK-NEXT: and i32 %A, -256
; CHECK-NEXT: ret i32
%B = ashr i32 %A, 8 ; <i32> [#uses=1]
@@ -166,7 +166,7 @@ define i32 @test12(i32 %A) {
;; (A >> 3) << 4 === (A & -8) * 2
;; The shl may be valuable to scalar evolution.
define i8 @test13(i8 %A) {
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; CHECK: shl i8
; CHECK-NEXT: ret i8
%a = mul i8 %A, 3 ; <i8> [#uses=1]
@@ -176,7 +176,7 @@ define i8 @test13(i8 %A) {
}
define i8 @test13a(i8 %A) {
-; CHECK: @test13a
+; CHECK-LABEL: @test13a(
; CHECK-NEXT: mul i8 %A, 6
; CHECK-NEXT: ret i8
%a = mul i8 %A, 3
@@ -187,7 +187,7 @@ define i8 @test13a(i8 %A) {
;; D = ((B | 1234) << 4) === ((B << 4)|(1234 << 4)
define i32 @test14(i32 %A) {
-; CHECK: @test14
+; CHECK-LABEL: @test14(
; CHECK-NEXT: %B = and i32 %A, -19760
; CHECK-NEXT: or i32 %B, 19744
; CHECK-NEXT: ret i32
@@ -199,7 +199,7 @@ define i32 @test14(i32 %A) {
;; D = ((B | 1234) << 4) === ((B << 4)|(1234 << 4)
define i32 @test14a(i32 %A) {
-; CHECK: @test14a
+; CHECK-LABEL: @test14a(
; CHECK-NEXT: and i32 %A, 77
; CHECK-NEXT: ret i32
%B = shl i32 %A, 4 ; <i32> [#uses=1]
@@ -209,7 +209,7 @@ define i32 @test14a(i32 %A) {
}
define i32 @test15(i1 %C) {
-; CHECK: @test15
+; CHECK-LABEL: @test15(
; CHECK-NEXT: select i1 %C, i32 12, i32 4
; CHECK-NEXT: ret i32
%A = select i1 %C, i32 3, i32 1 ; <i32> [#uses=1]
@@ -218,7 +218,7 @@ define i32 @test15(i1 %C) {
}
define i32 @test15a(i1 %C) {
-; CHECK: @test15a
+; CHECK-LABEL: @test15a(
; CHECK-NEXT: select i1 %C, i32 512, i32 128
; CHECK-NEXT: ret i32
%A = select i1 %C, i8 3, i8 1 ; <i8> [#uses=1]
@@ -228,7 +228,7 @@ define i32 @test15a(i1 %C) {
}
define i1 @test16(i32 %X) {
-; CHECK: @test16
+; CHECK-LABEL: @test16(
; CHECK-NEXT: and i32 %X, 16
; CHECK-NEXT: icmp ne i32
; CHECK-NEXT: ret i1
@@ -239,7 +239,7 @@ define i1 @test16(i32 %X) {
}
define i1 @test17(i32 %A) {
-; CHECK: @test17
+; CHECK-LABEL: @test17(
; CHECK-NEXT: and i32 %A, -8
; CHECK-NEXT: icmp eq i32
; CHECK-NEXT: ret i1
@@ -250,7 +250,7 @@ define i1 @test17(i32 %A) {
define i1 @test18(i8 %A) {
-; CHECK: @test18
+; CHECK-LABEL: @test18(
; CHECK: ret i1 false
%B = lshr i8 %A, 7 ; <i8> [#uses=1]
@@ -260,7 +260,7 @@ define i1 @test18(i8 %A) {
}
define i1 @test19(i32 %A) {
-; CHECK: @test19
+; CHECK-LABEL: @test19(
; CHECK-NEXT: icmp ult i32 %A, 4
; CHECK-NEXT: ret i1
%B = ashr i32 %A, 2 ; <i32> [#uses=1]
@@ -271,18 +271,17 @@ define i1 @test19(i32 %A) {
define i1 @test19a(i32 %A) {
-; CHECK: @test19a
-; CHECK-NEXT: and i32 %A, -4
-; CHECK-NEXT: icmp eq i32
+; CHECK-LABEL: @test19a(
+; CHECK-NEXT: icmp ugt i32 %A, -5
; CHECK-NEXT: ret i1
%B = ashr i32 %A, 2 ; <i32> [#uses=1]
- ;; (X & -4) == -4
+ ;; X >u ~4
%C = icmp eq i32 %B, -1 ; <i1> [#uses=1]
ret i1 %C
}
define i1 @test20(i8 %A) {
-; CHECK: @test20
+; CHECK-LABEL: @test20(
; CHECK: ret i1 false
%B = ashr i8 %A, 7 ; <i8> [#uses=1]
;; false
@@ -291,7 +290,7 @@ define i1 @test20(i8 %A) {
}
define i1 @test21(i8 %A) {
-; CHECK: @test21
+; CHECK-LABEL: @test21(
; CHECK-NEXT: and i8 %A, 15
; CHECK-NEXT: icmp eq i8
; CHECK-NEXT: ret i1
@@ -301,7 +300,7 @@ define i1 @test21(i8 %A) {
}
define i1 @test22(i8 %A) {
-; CHECK: @test22
+; CHECK-LABEL: @test22(
; CHECK-NEXT: and i8 %A, 15
; CHECK-NEXT: icmp eq i8
; CHECK-NEXT: ret i1
@@ -311,7 +310,7 @@ define i1 @test22(i8 %A) {
}
define i8 @test23(i32 %A) {
-; CHECK: @test23
+; CHECK-LABEL: @test23(
; CHECK-NEXT: trunc i32 %A to i8
; CHECK-NEXT: ret i8
@@ -323,7 +322,7 @@ define i8 @test23(i32 %A) {
}
define i8 @test24(i8 %X) {
-; CHECK: @test24
+; CHECK-LABEL: @test24(
; CHECK-NEXT: and i8 %X, 3
; CHECK-NEXT: ret i8
%Y = and i8 %X, -5 ; <i8> [#uses=1]
@@ -333,7 +332,7 @@ define i8 @test24(i8 %X) {
}
define i32 @test25(i32 %tmp.2, i32 %AA) {
-; CHECK: @test25
+; CHECK-LABEL: @test25(
; CHECK-NEXT: and i32 %tmp.2, -131072
; CHECK-NEXT: add i32 %{{[^,]*}}, %AA
; CHECK-NEXT: and i32 %{{[^,]*}}, -131072
@@ -347,7 +346,7 @@ define i32 @test25(i32 %tmp.2, i32 %AA) {
;; handle casts between shifts.
define i32 @test26(i32 %A) {
-; CHECK: @test26
+; CHECK-LABEL: @test26(
; CHECK-NEXT: and i32 %A, -2
; CHECK-NEXT: ret i32
%B = lshr i32 %A, 1 ; <i32> [#uses=1]
@@ -358,7 +357,7 @@ define i32 @test26(i32 %A) {
define i1 @test27(i32 %x) nounwind {
-; CHECK: @test27
+; CHECK-LABEL: @test27(
; CHECK-NEXT: and i32 %x, 8
; CHECK-NEXT: icmp ne i32
; CHECK-NEXT: ret i1
@@ -369,7 +368,7 @@ define i1 @test27(i32 %x) nounwind {
define i8 @test28(i8 %x) {
entry:
-; CHECK: @test28
+; CHECK-LABEL: @test28(
; CHECK: icmp slt i8 %x, 0
; CHECK-NEXT: br i1
%tmp1 = lshr i8 %x, 7
@@ -386,7 +385,7 @@ bb2:
define i8 @test28a(i8 %x, i8 %y) {
entry:
; This shouldn't be transformed.
-; CHECK: @test28a
+; CHECK-LABEL: @test28a(
; CHECK: %tmp1 = lshr i8 %x, 7
; CHECK: %cond1 = icmp eq i8 %tmp1, 0
; CHECK: br i1 %cond1, label %bb2, label %bb1
@@ -407,7 +406,7 @@ entry:
%tmp917 = trunc i64 %tmp916 to i32
%tmp10 = lshr i32 %tmp917, 31
ret i32 %tmp10
-; CHECK: @test29
+; CHECK-LABEL: @test29(
; CHECK: %tmp916 = lshr i64 %d18, 63
; CHECK: %tmp10 = trunc i64 %tmp916 to i32
}
@@ -418,7 +417,7 @@ define i32 @test30(i32 %A, i32 %B, i32 %C) {
%Y = shl i32 %B, %C
%Z = and i32 %X, %Y
ret i32 %Z
-; CHECK: @test30
+; CHECK-LABEL: @test30(
; CHECK: %X1 = and i32 %A, %B
; CHECK: %Z = shl i32 %X1, %C
}
@@ -428,7 +427,7 @@ define i32 @test31(i32 %A, i32 %B, i32 %C) {
%Y = lshr i32 %B, %C
%Z = or i32 %X, %Y
ret i32 %Z
-; CHECK: @test31
+; CHECK-LABEL: @test31(
; CHECK: %X1 = or i32 %A, %B
; CHECK: %Z = lshr i32 %X1, %C
}
@@ -438,7 +437,7 @@ define i32 @test32(i32 %A, i32 %B, i32 %C) {
%Y = ashr i32 %B, %C
%Z = xor i32 %X, %Y
ret i32 %Z
-; CHECK: @test32
+; CHECK-LABEL: @test32(
; CHECK: %X1 = xor i32 %A, %B
; CHECK: %Z = ashr i32 %X1, %C
; CHECK: ret i32 %Z
@@ -448,7 +447,7 @@ define i1 @test33(i32 %X) {
%tmp1 = shl i32 %X, 7
%tmp2 = icmp slt i32 %tmp1, 0
ret i1 %tmp2
-; CHECK: @test33
+; CHECK-LABEL: @test33(
; CHECK: %tmp1.mask = and i32 %X, 16777216
; CHECK: %tmp2 = icmp ne i32 %tmp1.mask, 0
}
@@ -457,7 +456,7 @@ define i1 @test34(i32 %X) {
%tmp1 = lshr i32 %X, 7
%tmp2 = icmp slt i32 %tmp1, 0
ret i1 %tmp2
-; CHECK: @test34
+; CHECK-LABEL: @test34(
; CHECK: ret i1 false
}
@@ -465,7 +464,7 @@ define i1 @test35(i32 %X) {
%tmp1 = ashr i32 %X, 7
%tmp2 = icmp slt i32 %tmp1, 0
ret i1 %tmp2
-; CHECK: @test35
+; CHECK-LABEL: @test35(
; CHECK: %tmp2 = icmp slt i32 %X, 0
; CHECK: ret i1 %tmp2
}
@@ -478,7 +477,7 @@ entry:
%tmp45 = lshr i128 %ins, 64
ret i128 %tmp45
-; CHECK: @test36
+; CHECK-LABEL: @test36(
; CHECK: %tmp231 = or i128 %B, %A
; CHECK: %ins = and i128 %tmp231, 18446744073709551615
; CHECK: ret i128 %ins
@@ -494,7 +493,7 @@ entry:
%tmp46 = trunc i128 %tmp45 to i64
ret i64 %tmp46
-; CHECK: @test37
+; CHECK-LABEL: @test37(
; CHECK: %tmp23 = shl nuw nsw i128 %tmp22, 32
; CHECK: %ins = or i128 %tmp23, %A
; CHECK: %tmp46 = trunc i128 %ins to i64
@@ -504,14 +503,14 @@ define i32 @test38(i32 %x) nounwind readnone {
%rem = srem i32 %x, 32
%shl = shl i32 1, %rem
ret i32 %shl
-; CHECK: @test38
+; CHECK-LABEL: @test38(
; CHECK-NEXT: and i32 %x, 31
; CHECK-NEXT: shl i32 1
; CHECK-NEXT: ret i32
}
; <rdar://problem/8756731>
-; CHECK: @test39
+; CHECK-LABEL: @test39(
define i8 @test39(i32 %a0) {
entry:
%tmp4 = trunc i32 %a0 to i8
@@ -537,7 +536,7 @@ define i32 @test40(i32 %a, i32 %b) nounwind {
%shl2 = shl i32 %shl1, 2
%div = udiv i32 %a, %shl2
ret i32 %div
-; CHECK: @test40
+; CHECK-LABEL: @test40(
; CHECK-NEXT: add i32 %b, 2
; CHECK-NEXT: lshr i32 %a
; CHECK-NEXT: ret i32
@@ -547,7 +546,7 @@ define i32 @test41(i32 %a, i32 %b) nounwind {
%1 = shl i32 1, %b
%2 = shl i32 %1, 3
ret i32 %2
-; CHECK: @test41
+; CHECK-LABEL: @test41(
; CHECK-NEXT: shl i32 8, %b
; CHECK-NEXT: ret i32
}
@@ -556,7 +555,7 @@ define i32 @test42(i32 %a, i32 %b) nounwind {
%div = lshr i32 4096, %b ; must be exact otherwise we'd divide by zero
%div2 = udiv i32 %a, %div
ret i32 %div2
-; CHECK: @test42
+; CHECK-LABEL: @test42(
; CHECK-NEXT: lshr exact i32 4096, %b
}
@@ -564,7 +563,7 @@ define i32 @test43(i32 %a, i32 %b) nounwind {
%div = shl i32 4096, %b ; must be exact otherwise we'd divide by zero
%div2 = udiv i32 %a, %div
ret i32 %div2
-; CHECK: @test43
+; CHECK-LABEL: @test43(
; CHECK-NEXT: add i32 %b, 12
; CHECK-NEXT: lshr
; CHECK-NEXT: ret
@@ -574,7 +573,7 @@ define i32 @test44(i32 %a) nounwind {
%y = shl nuw i32 %a, 1
%z = shl i32 %y, 4
ret i32 %z
-; CHECK: @test44
+; CHECK-LABEL: @test44(
; CHECK-NEXT: %y = shl i32 %a, 5
; CHECK-NEXT: ret i32 %y
}
@@ -583,7 +582,7 @@ define i32 @test45(i32 %a) nounwind {
%y = lshr exact i32 %a, 1
%z = lshr i32 %y, 4
ret i32 %z
-; CHECK: @test45
+; CHECK-LABEL: @test45(
; CHECK-NEXT: %y = lshr i32 %a, 5
; CHECK-NEXT: ret i32 %y
}
@@ -592,7 +591,7 @@ define i32 @test46(i32 %a) {
%y = ashr exact i32 %a, 3
%z = shl i32 %y, 1
ret i32 %z
-; CHECK: @test46
+; CHECK-LABEL: @test46(
; CHECK-NEXT: %z = ashr exact i32 %a, 2
; CHECK-NEXT: ret i32 %z
}
@@ -601,7 +600,7 @@ define i32 @test47(i32 %a) {
%y = lshr exact i32 %a, 3
%z = shl i32 %y, 1
ret i32 %z
-; CHECK: @test47
+; CHECK-LABEL: @test47(
; CHECK-NEXT: %z = lshr exact i32 %a, 2
; CHECK-NEXT: ret i32 %z
}
@@ -610,7 +609,7 @@ define i32 @test48(i32 %x) {
%A = lshr exact i32 %x, 1
%B = shl i32 %A, 3
ret i32 %B
-; CHECK: @test48
+; CHECK-LABEL: @test48(
; CHECK-NEXT: %B = shl i32 %x, 2
; CHECK-NEXT: ret i32 %B
}
@@ -619,7 +618,7 @@ define i32 @test49(i32 %x) {
%A = ashr exact i32 %x, 1
%B = shl i32 %A, 3
ret i32 %B
-; CHECK: @test49
+; CHECK-LABEL: @test49(
; CHECK-NEXT: %B = shl i32 %x, 2
; CHECK-NEXT: ret i32 %B
}
@@ -628,7 +627,7 @@ define i32 @test50(i32 %x) {
%A = shl nsw i32 %x, 1
%B = ashr i32 %A, 3
ret i32 %B
-; CHECK: @test50
+; CHECK-LABEL: @test50(
; CHECK-NEXT: %B = ashr i32 %x, 2
; CHECK-NEXT: ret i32 %B
}
@@ -637,7 +636,7 @@ define i32 @test51(i32 %x) {
%A = shl nuw i32 %x, 1
%B = lshr i32 %A, 3
ret i32 %B
-; CHECK: @test51
+; CHECK-LABEL: @test51(
; CHECK-NEXT: %B = lshr i32 %x, 2
; CHECK-NEXT: ret i32 %B
}
@@ -646,7 +645,7 @@ define i32 @test52(i32 %x) {
%A = shl nsw i32 %x, 3
%B = ashr i32 %A, 1
ret i32 %B
-; CHECK: @test52
+; CHECK-LABEL: @test52(
; CHECK-NEXT: %B = shl nsw i32 %x, 2
; CHECK-NEXT: ret i32 %B
}
@@ -655,7 +654,7 @@ define i32 @test53(i32 %x) {
%A = shl nuw i32 %x, 3
%B = lshr i32 %A, 1
ret i32 %B
-; CHECK: @test53
+; CHECK-LABEL: @test53(
; CHECK-NEXT: %B = shl nuw i32 %x, 2
; CHECK-NEXT: ret i32 %B
}
@@ -665,7 +664,7 @@ define i32 @test54(i32 %x) {
%shl = shl i32 %shr2, 4
%and = and i32 %shl, 16
ret i32 %and
-; CHECK: @test54
+; CHECK-LABEL: @test54(
; CHECK: shl i32 %x, 3
}
@@ -675,7 +674,7 @@ define i32 @test55(i32 %x) {
%shl = shl i32 %shr2, 4
%or = or i32 %shl, 8
ret i32 %or
-; CHECK: @test55
+; CHECK-LABEL: @test55(
; CHECK: shl i32 %x, 3
}
@@ -684,7 +683,7 @@ define i32 @test56(i32 %x) {
%shl = shl i32 %shr2, 4
%or = or i32 %shl, 7
ret i32 %or
-; CHECK: @test56
+; CHECK-LABEL: @test56(
; CHECK: shl i32 %shr2, 4
}
@@ -694,7 +693,7 @@ define i32 @test57(i32 %x) {
%shl = shl i32 %shr, 4
%and = and i32 %shl, 16
ret i32 %and
-; CHECK: @test57
+; CHECK-LABEL: @test57(
; CHECK: shl i32 %x, 3
}
@@ -703,7 +702,7 @@ define i32 @test58(i32 %x) {
%shl = shl i32 %shr, 4
%or = or i32 %shl, 8
ret i32 %or
-; CHECK: @test58
+; CHECK-LABEL: @test58(
; CHECK: shl i32 %x, 3
}
@@ -712,7 +711,7 @@ define i32 @test59(i32 %x) {
%shl = shl i32 %shr, 4
%or = or i32 %shl, 7
ret i32 %or
-; CHECK: @test59
+; CHECK-LABEL: @test59(
; CHECK: %shl = shl i32 %shr1, 4
}
@@ -722,7 +721,7 @@ define i32 @test60(i32 %x) {
%shl = shl i32 %shr, 1
%or = or i32 %shl, 1
ret i32 %or
-; CHECK: @test60
+; CHECK-LABEL: @test60(
; CHECK: ashr i32 %x, 3
}
@@ -732,7 +731,7 @@ define i32 @test61(i32 %x) {
%shl = shl i32 %shr, 1
%or = or i32 %shl, 2
ret i32 %or
-; CHECK: @test61
+; CHECK-LABEL: @test61(
; CHECK: ashr i32 %x, 4
}
@@ -742,6 +741,42 @@ define i32 @test62(i32 %x) {
%shl = shl i32 %shr, 1
%or = or i32 %shl, 1
ret i32 %or
-; CHECK: @test62
+; CHECK-LABEL: @test62(
; CHECK: ashr exact i32 %x, 3
}
+
+; PR17026
+; CHECK-LABEL: @test63(
+; CHECK-NOT: sh
+; CHECK: ret
+define void @test63(i128 %arg) {
+bb:
+ br i1 undef, label %bb1, label %bb12
+
+bb1: ; preds = %bb11, %bb
+ br label %bb2
+
+bb2: ; preds = %bb7, %bb1
+ br i1 undef, label %bb3, label %bb7
+
+bb3: ; preds = %bb2
+ %tmp = lshr i128 %arg, 36893488147419103232
+ %tmp4 = shl i128 %tmp, 0
+ %tmp5 = or i128 %tmp4, undef
+ %tmp6 = trunc i128 %tmp5 to i16
+ br label %bb8
+
+bb7: ; preds = %bb2
+ br i1 undef, label %bb8, label %bb2
+
+bb8: ; preds = %bb7, %bb3
+ %tmp9 = phi i16 [ %tmp6, %bb3 ], [ undef, %bb7 ]
+ %tmp10 = icmp eq i16 %tmp9, 0
+ br i1 %tmp10, label %bb11, label %bb12
+
+bb11: ; preds = %bb8
+ br i1 undef, label %bb1, label %bb12
+
+bb12: ; preds = %bb11, %bb8, %bb
+ ret void
+}
diff --git a/test/Transforms/InstCombine/sign-test-and-or.ll b/test/Transforms/InstCombine/sign-test-and-or.ll
index a6066d80020d..95ed9b976ba3 100644
--- a/test/Transforms/InstCombine/sign-test-and-or.ll
+++ b/test/Transforms/InstCombine/sign-test-and-or.ll
@@ -8,7 +8,7 @@ define void @test1(i32 %a, i32 %b) nounwind {
%or.cond = or i1 %1, %2
br i1 %or.cond, label %if.then, label %if.end
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: %1 = or i32 %a, %b
; CHECK-NEXT: %2 = icmp slt i32 %1, 0
; CHECK-NEXT: br
@@ -27,7 +27,7 @@ define void @test2(i32 %a, i32 %b) nounwind {
%or.cond = or i1 %1, %2
br i1 %or.cond, label %if.then, label %if.end
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: %1 = and i32 %a, %b
; CHECK-NEXT: %2 = icmp sgt i32 %1, -1
; CHECK-NEXT: br
@@ -46,7 +46,7 @@ define void @test3(i32 %a, i32 %b) nounwind {
%or.cond = and i1 %1, %2
br i1 %or.cond, label %if.then, label %if.end
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: %1 = and i32 %a, %b
; CHECK-NEXT: %2 = icmp slt i32 %1, 0
; CHECK-NEXT: br
@@ -65,7 +65,7 @@ define void @test4(i32 %a, i32 %b) nounwind {
%or.cond = and i1 %1, %2
br i1 %or.cond, label %if.then, label %if.end
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NEXT: %1 = or i32 %a, %b
; CHECK-NEXT: %2 = icmp sgt i32 %1, -1
; CHECK-NEXT: br
@@ -85,7 +85,7 @@ define void @test5(i32 %a) nounwind {
%or.cond = and i1 %1, %2
br i1 %or.cond, label %if.then, label %if.end
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NEXT: %1 = and i32 %a, -2013265920
; CHECK-NEXT: %2 = icmp eq i32 %1, 0
; CHECK-NEXT: br i1 %2, label %if.then, label %if.end
@@ -105,7 +105,7 @@ define void @test6(i32 %a) nounwind {
%or.cond = and i1 %1, %2
br i1 %or.cond, label %if.then, label %if.end
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NEXT: %1 = and i32 %a, -2013265920
; CHECK-NEXT: %2 = icmp eq i32 %1, 0
; CHECK-NEXT: br i1 %2, label %if.then, label %if.end
@@ -125,7 +125,7 @@ define void @test7(i32 %a) nounwind {
%or.cond = or i1 %1, %2
br i1 %or.cond, label %if.then, label %if.end
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NEXT: %1 = and i32 %a, -2013265920
; CHECK-NEXT: %2 = icmp eq i32 %1, 0
; CHECK-NEXT: br i1 %2, label %if.end, label %if.the
@@ -145,7 +145,7 @@ define void @test8(i32 %a) nounwind {
%or.cond = or i1 %1, %2
br i1 %or.cond, label %if.then, label %if.end
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK-NEXT: %1 = and i32 %a, -2013265920
; CHECK-NEXT: %2 = icmp eq i32 %1, 0
; CHECK-NEXT: br i1 %2, label %if.end, label %if.the
@@ -165,7 +165,7 @@ define void @test9(i32 %a) nounwind {
%or.cond = and i1 %2, %3
br i1 %or.cond, label %if.then, label %if.end
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK-NEXT: %1 = and i32 %a, -1073741824
; CHECK-NEXT: %2 = icmp eq i32 %1, 1073741824
; CHECK-NEXT: br i1 %2, label %if.then, label %if.end
diff --git a/test/Transforms/InstCombine/signext.ll b/test/Transforms/InstCombine/signext.ll
index 5ed1cd5590ae..d7004977cd63 100644
--- a/test/Transforms/InstCombine/signext.ll
+++ b/test/Transforms/InstCombine/signext.ll
@@ -7,7 +7,7 @@ define i32 @test1(i32 %x) {
%tmp.2 = xor i32 %tmp.1, -32768 ; <i32> [#uses=1]
%tmp.3 = add i32 %tmp.2, 32768 ; <i32> [#uses=1]
ret i32 %tmp.3
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %sext = shl i32 %x, 16
; CHECK: %tmp.3 = ashr exact i32 %sext, 16
; CHECK: ret i32 %tmp.3
@@ -18,7 +18,7 @@ define i32 @test2(i32 %x) {
%tmp.2 = xor i32 %tmp.1, 32768 ; <i32> [#uses=1]
%tmp.3 = add i32 %tmp.2, -32768 ; <i32> [#uses=1]
ret i32 %tmp.3
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: %sext = shl i32 %x, 16
; CHECK: %tmp.3 = ashr exact i32 %sext, 16
; CHECK: ret i32 %tmp.3
@@ -29,7 +29,7 @@ define i32 @test3(i16 %P) {
%tmp.4 = xor i32 %tmp.1, 32768 ; <i32> [#uses=1]
%tmp.5 = add i32 %tmp.4, -32768 ; <i32> [#uses=1]
ret i32 %tmp.5
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: %tmp.5 = sext i16 %P to i32
; CHECK: ret i32 %tmp.5
}
@@ -39,7 +39,7 @@ define i32 @test4(i16 %P) {
%tmp.4 = xor i32 %tmp.1, 32768 ; <i32> [#uses=1]
%tmp.5 = add i32 %tmp.4, -32768 ; <i32> [#uses=1]
ret i32 %tmp.5
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: %tmp.5 = sext i16 %P to i32
; CHECK: ret i32 %tmp.5
}
@@ -49,7 +49,7 @@ define i32 @test5(i32 %x) {
%tmp.2 = xor i32 %tmp.1, 128 ; <i32> [#uses=1]
%tmp.3 = add i32 %tmp.2, -128 ; <i32> [#uses=1]
ret i32 %tmp.3
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: %sext = shl i32 %x, 24
; CHECK: %tmp.3 = ashr exact i32 %sext, 24
; CHECK: ret i32 %tmp.3
@@ -59,7 +59,7 @@ define i32 @test6(i32 %x) {
%tmp.2 = shl i32 %x, 16 ; <i32> [#uses=1]
%tmp.4 = ashr i32 %tmp.2, 16 ; <i32> [#uses=1]
ret i32 %tmp.4
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: %tmp.2 = shl i32 %x, 16
; CHECK: %tmp.4 = ashr exact i32 %tmp.2, 16
; CHECK: ret i32 %tmp.4
@@ -70,7 +70,7 @@ define i32 @test7(i16 %P) {
%sext1 = shl i32 %tmp.1, 16 ; <i32> [#uses=1]
%tmp.5 = ashr i32 %sext1, 16 ; <i32> [#uses=1]
ret i32 %tmp.5
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: %tmp.5 = sext i16 %P to i32
; CHECK: ret i32 %tmp.5
}
@@ -81,7 +81,7 @@ entry:
%xor = xor i32 %shr, 67108864 ; <i32> [#uses=1]
%sub = add i32 %xor, -67108864 ; <i32> [#uses=1]
ret i32 %sub
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: %sub = ashr i32 %x, 5
; CHECK: ret i32 %sub
}
diff --git a/test/Transforms/InstCombine/simplify-libcalls.ll b/test/Transforms/InstCombine/simplify-libcalls.ll
new file mode 100644
index 000000000000..fae3e6e3d9be
--- /dev/null
+++ b/test/Transforms/InstCombine/simplify-libcalls.ll
@@ -0,0 +1,144 @@
+; RUN: opt -S < %s -instcombine | FileCheck %s
+
+@G = constant [3 x i8] c"%s\00" ; <[3 x i8]*> [#uses=1]
+
+declare i32 @sprintf(i8*, i8*, ...)
+
+define void @foo(i8* %P, i32* %X) {
+ call i32 (i8*, i8*, ...)* @sprintf( i8* %P, i8* getelementptr ([3 x i8]* @G, i32 0, i32 0), i32* %X ) ; <i32>:1 [#uses=0]
+ ret void
+}
+
+; PR1307
+@str = internal constant [5 x i8] c"foog\00"
+@str1 = internal constant [8 x i8] c"blahhh!\00"
+@str2 = internal constant [5 x i8] c"Ponk\00"
+
+define i8* @test1() {
+ %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str, i32 0, i32 2), i32 103 ) ; <i8*> [#uses=1]
+ ret i8* %tmp3
+
+; CHECK-LABEL: @test1(
+; CHECK: ret i8* getelementptr inbounds ([5 x i8]* @str, i32 0, i64 3)
+}
+
+declare i8* @strchr(i8*, i32)
+
+define i8* @test2() {
+ %tmp3 = tail call i8* @strchr( i8* getelementptr ([8 x i8]* @str1, i32 0, i32 2), i32 0 ) ; <i8*> [#uses=1]
+ ret i8* %tmp3
+
+; CHECK-LABEL: @test2(
+; CHECK: ret i8* getelementptr inbounds ([8 x i8]* @str1, i32 0, i64 7)
+}
+
+define i8* @test3() {
+entry:
+ %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str2, i32 0, i32 1), i32 80 ) ; <i8*> [#uses=1]
+ ret i8* %tmp3
+
+; CHECK-LABEL: @test3(
+; CHECK: ret i8* null
+}
+
+@_2E_str = external constant [5 x i8] ; <[5 x i8]*> [#uses=1]
+
+declare i32 @memcmp(i8*, i8*, i32) nounwind readonly
+
+define i1 @PR2341(i8** %start_addr) {
+entry:
+ %tmp4 = load i8** %start_addr, align 4 ; <i8*> [#uses=1]
+ %tmp5 = call i32 @memcmp( i8* %tmp4, i8* getelementptr ([5 x i8]* @_2E_str, i32 0, i32 0), i32 4 ) nounwind readonly ; <i32> [#uses=1]
+ %tmp6 = icmp eq i32 %tmp5, 0 ; <i1> [#uses=1]
+ ret i1 %tmp6
+
+; CHECK-LABEL: @PR2341(
+; CHECK: i32
+}
+
+define i32 @PR4284() nounwind {
+entry:
+ %c0 = alloca i8, align 1 ; <i8*> [#uses=2]
+ %c2 = alloca i8, align 1 ; <i8*> [#uses=2]
+ store i8 64, i8* %c0
+ store i8 -127, i8* %c2
+ %call = call i32 @memcmp(i8* %c0, i8* %c2, i32 1) ; <i32> [#uses=1]
+ ret i32 %call
+
+; CHECK-LABEL: @PR4284(
+; CHECK: ret i32 -65
+}
+
+%struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, i8*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64, %struct.pthread_mutex*, %struct.pthread*, i32, i32, %union.anon }
+%struct.__sbuf = type { i8*, i32, [4 x i8] }
+%struct.pthread = type opaque
+%struct.pthread_mutex = type opaque
+%union.anon = type { i64, [120 x i8] }
+@.str13 = external constant [2 x i8] ; <[2 x i8]*> [#uses=1]
+@.str14 = external constant [2 x i8] ; <[2 x i8]*> [#uses=1]
+
+define i32 @PR4641(i32 %argc, i8** %argv) nounwind {
+entry:
+ call void @exit(i32 0) nounwind
+ %cond392 = select i1 undef, i8* getelementptr ([2 x i8]* @.str13, i32 0, i32 0), i8* getelementptr ([2 x i8]* @.str14, i32 0, i32 0) ; <i8*> [#uses=1]
+ %call393 = call %struct.__sFILE* @fopen(i8* undef, i8* %cond392) nounwind ; <%struct.__sFILE*> [#uses=0]
+ unreachable
+}
+
+declare %struct.__sFILE* @fopen(i8*, i8*)
+
+declare void @exit(i32)
+
+define i32 @PR4645() {
+entry:
+ br label %if.then
+
+lor.lhs.false: ; preds = %while.body
+ br i1 undef, label %if.then, label %for.cond
+
+if.then: ; preds = %lor.lhs.false, %while.body
+ call void @exit(i32 1)
+ br label %for.cond
+
+for.cond: ; preds = %for.end, %if.then, %lor.lhs.false
+ %j.0 = phi i32 [ %inc47, %for.end ], [ 0, %if.then ], [ 0, %lor.lhs.false ] ; <i32> [#uses=1]
+ unreachable
+
+for.end: ; preds = %for.cond20
+ %inc47 = add i32 %j.0, 1 ; <i32> [#uses=1]
+ br label %for.cond
+}
+
+@h = constant [2 x i8] c"h\00" ; <[2 x i8]*> [#uses=1]
+@hel = constant [4 x i8] c"hel\00" ; <[4 x i8]*> [#uses=1]
+@hello_u = constant [8 x i8] c"hello_u\00" ; <[8 x i8]*> [#uses=1]
+
+define i32 @MemCpy() {
+ %h_p = getelementptr [2 x i8]* @h, i32 0, i32 0
+ %hel_p = getelementptr [4 x i8]* @hel, i32 0, i32 0
+ %hello_u_p = getelementptr [8 x i8]* @hello_u, i32 0, i32 0
+ %target = alloca [1024 x i8]
+ %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0
+ call void @llvm.memcpy.p0i8.p0i8.i32(i8* %target_p, i8* %h_p, i32 2, i32 2, i1 false)
+ call void @llvm.memcpy.p0i8.p0i8.i32(i8* %target_p, i8* %hel_p, i32 4, i32 4, i1 false)
+ call void @llvm.memcpy.p0i8.p0i8.i32(i8* %target_p, i8* %hello_u_p, i32 8, i32 8, i1 false)
+ ret i32 0
+
+; CHECK-LABEL: @MemCpy(
+; CHECK-NOT: llvm.memcpy
+; CHECK: ret i32 0
+}
+
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
+
+declare i32 @strcmp(i8*, i8*) #0
+
+define void @test9(i8* %x) {
+; CHECK-LABEL: @test9(
+; CHECK-NOT: strcmp
+ %y = call i32 @strcmp(i8* %x, i8* %x) #1
+ ret void
+}
+
+attributes #0 = { nobuiltin }
+attributes #1 = { builtin }
diff --git a/test/Transforms/InstCombine/sincospi.ll b/test/Transforms/InstCombine/sincospi.ll
new file mode 100644
index 000000000000..0d1a6027a00a
--- /dev/null
+++ b/test/Transforms/InstCombine/sincospi.ll
@@ -0,0 +1,91 @@
+; RUN: opt -instcombine -S < %s -mtriple=x86_64-apple-macosx10.9 | FileCheck %s --check-prefix=CHECK-FLOAT-IN-VEC
+; RUN: opt -instcombine -S < %s -mtriple=arm-apple-ios7.0 | FileCheck %s
+; RUN: opt -instcombine -S < %s -mtriple=x86_64-apple-macosx10.8 | FileCheck %s --check-prefix=CHECK-NO-SINCOS
+; RUN: opt -instcombine -S < %s -mtriple=arm-apple-ios6.0 | FileCheck %s --check-prefix=CHECK-NO-SINCOS
+; RUN: opt -instcombine -S < %s -mtriple=x86_64-none-linux-gnu | FileCheck %s --check-prefix=CHECK-NO-SINCOS
+
+
+attributes #0 = { readnone nounwind }
+
+declare float @__sinpif(float %x) #0
+declare float @__cospif(float %x) #0
+
+declare double @__sinpi(double %x) #0
+declare double @__cospi(double %x) #0
+
+@var32 = global float 0.0
+@var64 = global double 0.0
+
+define float @test_instbased_f32() {
+ %val = load float* @var32
+ %sin = call float @__sinpif(float %val) #0
+ %cos = call float @__cospif(float %val) #0
+ %res = fadd float %sin, %cos
+ ret float %res
+; CHECK-FLOAT-IN-VEC: [[VAL:%[a-z0-9]+]] = load float* @var32
+; CHECK-FLOAT-IN-VEC: [[SINCOS:%[a-z0-9]+]] = call <2 x float> @__sincospi_stretf(float [[VAL]])
+; CHECK-FLOAT-IN-VEC: extractelement <2 x float> [[SINCOS]], i32 0
+; CHECK-FLOAT-IN-VEC: extractelement <2 x float> [[SINCOS]], i32 1
+
+; CHECK: [[VAL:%[a-z0-9]+]] = load float* @var32
+; CHECK: [[SINCOS:%[a-z0-9]+]] = call { float, float } @__sincospi_stretf(float [[VAL]])
+; CHECK: extractvalue { float, float } [[SINCOS]], 0
+; CHECK: extractvalue { float, float } [[SINCOS]], 1
+
+; CHECK-NO-SINCOS: call float @__sinpif
+; CHECK-NO-SINCOS: call float @__cospif
+}
+
+define float @test_constant_f32() {
+ %sin = call float @__sinpif(float 1.0) #0
+ %cos = call float @__cospif(float 1.0) #0
+ %res = fadd float %sin, %cos
+ ret float %res
+; CHECK-FLOAT-IN-VEC: [[SINCOS:%[a-z0-9]+]] = call <2 x float> @__sincospi_stretf(float 1.000000e+00)
+; CHECK-FLOAT-IN-VEC: extractelement <2 x float> [[SINCOS]], i32 0
+; CHECK-FLOAT-IN-VEC: extractelement <2 x float> [[SINCOS]], i32 1
+
+; CHECK: [[SINCOS:%[a-z0-9]+]] = call { float, float } @__sincospi_stretf(float 1.000000e+00)
+; CHECK: extractvalue { float, float } [[SINCOS]], 0
+; CHECK: extractvalue { float, float } [[SINCOS]], 1
+
+; CHECK-NO-SINCOS: call float @__sinpif
+; CHECK-NO-SINCOS: call float @__cospif
+}
+
+define double @test_instbased_f64() {
+ %val = load double* @var64
+ %sin = call double @__sinpi(double %val) #0
+ %cos = call double @__cospi(double %val) #0
+ %res = fadd double %sin, %cos
+ ret double %res
+; CHECK-FLOAT-IN-VEC: [[VAL:%[a-z0-9]+]] = load double* @var64
+; CHECK-FLOAT-IN-VEC: [[SINCOS:%[a-z0-9]+]] = call { double, double } @__sincospi_stret(double [[VAL]])
+; CHECK-FLOAT-IN-VEC: extractvalue { double, double } [[SINCOS]], 0
+; CHECK-FLOAT-IN-VEC: extractvalue { double, double } [[SINCOS]], 1
+
+; CHECK: [[VAL:%[a-z0-9]+]] = load double* @var64
+; CHECK: [[SINCOS:%[a-z0-9]+]] = call { double, double } @__sincospi_stret(double [[VAL]])
+; CHECK: extractvalue { double, double } [[SINCOS]], 0
+; CHECK: extractvalue { double, double } [[SINCOS]], 1
+
+; CHECK-NO-SINCOS: call double @__sinpi
+; CHECK-NO-SINCOS: call double @__cospi
+}
+
+define double @test_constant_f64() {
+ %sin = call double @__sinpi(double 1.0) #0
+ %cos = call double @__cospi(double 1.0) #0
+ %res = fadd double %sin, %cos
+ ret double %res
+; CHECK-FLOAT-IN-VEC: [[SINCOS:%[a-z0-9]+]] = call { double, double } @__sincospi_stret(double 1.000000e+00)
+; CHECK-FLOAT-IN-VEC: extractvalue { double, double } [[SINCOS]], 0
+; CHECK-FLOAT-IN-VEC: extractvalue { double, double } [[SINCOS]], 1
+
+; CHECK: [[SINCOS:%[a-z0-9]+]] = call { double, double } @__sincospi_stret(double 1.000000e+00)
+; CHECK: extractvalue { double, double } [[SINCOS]], 0
+; CHECK: extractvalue { double, double } [[SINCOS]], 1
+
+; CHECK-NO-SINCOS: call double @__sinpi
+; CHECK-NO-SINCOS: call double @__cospi
+}
diff --git a/test/Transforms/InstCombine/sink_instruction.ll b/test/Transforms/InstCombine/sink_instruction.ll
index 5c4019a98df5..1bbd6b763841 100644
--- a/test/Transforms/InstCombine/sink_instruction.ll
+++ b/test/Transforms/InstCombine/sink_instruction.ll
@@ -4,7 +4,7 @@
;; arm of the 'if'.
define i32 @test1(i1 %C, i32 %A, i32 %B) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
entry:
%tmp.2 = sdiv i32 %A, %B ; <i32> [#uses=1]
%tmp.9 = add i32 %B, %A ; <i32> [#uses=1]
@@ -22,7 +22,7 @@ endif: ; preds = %entry
;; PHI use, sink divide before call.
define i32 @test2(i32 %x) nounwind ssp {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NOT: sdiv i32
entry:
br label %bb
diff --git a/test/Transforms/InstCombine/sprintf-1.ll b/test/Transforms/InstCombine/sprintf-1.ll
index 9b8c8b1b12c7..78dd7aa7df47 100644
--- a/test/Transforms/InstCombine/sprintf-1.ll
+++ b/test/Transforms/InstCombine/sprintf-1.ll
@@ -1,7 +1,7 @@
; Test that the sprintf library call simplifier works correctly.
;
; RUN: opt < %s -instcombine -S | FileCheck %s
-; RUN: opt < %s -mtriple xcore-xmos-elf -instcombine -S | FileCheck %s -check-prefix=IPRINTF
+; RUN: opt < %s -mtriple xcore-xmos-elf -instcombine -S | FileCheck %s -check-prefix=CHECK-IPRINTF
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"
@@ -19,7 +19,7 @@ declare i32 @sprintf(i8*, i8*, ...)
; Check sprintf(dst, fmt) -> llvm.memcpy(str, fmt, strlen(fmt) + 1, 1).
define void @test_simplify1(i8* %dst) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%fmt = getelementptr [13 x i8]* @hello_world, i32 0, i32 0
call i32 (i8*, i8*, ...)* @sprintf(i8* %dst, i8* %fmt)
; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* getelementptr inbounds ([13 x i8]* @hello_world, i32 0, i32 0), i32 13, i32 1, i1 false)
@@ -28,7 +28,7 @@ define void @test_simplify1(i8* %dst) {
}
define void @test_simplify2(i8* %dst) {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%fmt = getelementptr [1 x i8]* @null, i32 0, i32 0
call i32 (i8*, i8*, ...)* @sprintf(i8* %dst, i8* %fmt)
; CHECK-NEXT: store i8 0, i8* %dst, align 1
@@ -37,7 +37,7 @@ define void @test_simplify2(i8* %dst) {
}
define void @test_simplify3(i8* %dst) {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%fmt = getelementptr [7 x i8]* @null_hello, i32 0, i32 0
call i32 (i8*, i8*, ...)* @sprintf(i8* %dst, i8* %fmt)
; CHECK-NEXT: store i8 0, i8* %dst, align 1
@@ -48,7 +48,7 @@ define void @test_simplify3(i8* %dst) {
; Check sprintf(dst, "%c", chr) -> *(i8*)dst = chr; *((i8*)dst + 1) = 0.
define void @test_simplify4(i8* %dst) {
-; CHECK: @test_simplify4
+; CHECK-LABEL: @test_simplify4(
%fmt = getelementptr [3 x i8]* @percent_c, i32 0, i32 0
call i32 (i8*, i8*, ...)* @sprintf(i8* %dst, i8* %fmt, i8 104)
; CHECK-NEXT: store i8 104, i8* %dst, align 1
@@ -61,7 +61,7 @@ define void @test_simplify4(i8* %dst) {
; Check sprintf(dst, "%s", str) -> llvm.memcpy(dest, str, strlen(str) + 1, 1).
define void @test_simplify5(i8* %dst, i8* %str) {
-; CHECK: @test_simplify5
+; CHECK-LABEL: @test_simplify5(
%fmt = getelementptr [3 x i8]* @percent_s, i32 0, i32 0
call i32 (i8*, i8*, ...)* @sprintf(i8* %dst, i8* %fmt, i8* %str)
; CHECK-NEXT: [[STRLEN:%[a-z0-9]+]] = call i32 @strlen(i8* %str)
@@ -74,7 +74,7 @@ define void @test_simplify5(i8* %dst, i8* %str) {
; Check sprintf(dst, format, ...) -> siprintf(str, format, ...) if no floating.
define void @test_simplify6(i8* %dst) {
-; CHECK-IPRINTF: @test_simplify6
+; CHECK-IPRINTF-LABEL: @test_simplify6(
%fmt = getelementptr [3 x i8]* @percent_d, i32 0, i32 0
call i32 (i8*, i8*, ...)* @sprintf(i8* %dst, i8* %fmt, i32 187)
; CHECK-NEXT-IPRINTF: call i32 (i8*, i8*, ...)* @siprintf(i8* %dst, i8* getelementptr inbounds ([3 x i8]* @percent_d, i32 0, i32 0), i32 187)
@@ -83,7 +83,7 @@ define void @test_simplify6(i8* %dst) {
}
define void @test_no_simplify1(i8* %dst) {
-; CHECK-IPRINTF: @test_no_simplify1
+; CHECK-IPRINTF-LABEL: @test_no_simplify1(
%fmt = getelementptr [3 x i8]* @percent_f, i32 0, i32 0
call i32 (i8*, i8*, ...)* @sprintf(i8* %dst, i8* %fmt, double 1.87)
; CHECK-NEXT-IPRINTF: call i32 (i8*, i8*, ...)* @sprintf(i8* %dst, i8* getelementptr inbounds ([3 x i8]* @percent_f, i32 0, i32 0), double 1.870000e+00)
@@ -92,7 +92,7 @@ define void @test_no_simplify1(i8* %dst) {
}
define void @test_no_simplify2(i8* %dst, i8* %fmt, double %d) {
-; CHECK: @test_no_simplify2
+; CHECK-LABEL: @test_no_simplify2(
call i32 (i8*, i8*, ...)* @sprintf(i8* %dst, i8* %fmt, double %d)
; CHECK-NEXT: call i32 (i8*, i8*, ...)* @sprintf(i8* %dst, i8* %fmt, double %d)
ret void
diff --git a/test/Transforms/InstCombine/sqrt.ll b/test/Transforms/InstCombine/sqrt.ll
index 440b9748518d..650b10c6e966 100644
--- a/test/Transforms/InstCombine/sqrt.ll
+++ b/test/Transforms/InstCombine/sqrt.ll
@@ -2,7 +2,7 @@
define float @test1(float %x) nounwind readnone ssp {
entry:
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NOT: fpext
; CHECK-NOT: sqrt(
; CHECK: sqrtf(
@@ -17,7 +17,7 @@ entry:
; PR8096
define float @test2(float %x) nounwind readnone ssp {
entry:
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NOT: fpext
; CHECK-NOT: sqrt(
; CHECK: sqrtf(
@@ -34,7 +34,7 @@ entry:
; use of sqrt result.
define float @test3(float* %v) nounwind uwtable ssp {
entry:
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: sqrt(
; CHECK-NOT: sqrtf(
; CHECK: fptrunc
diff --git a/test/Transforms/InstCombine/store.ll b/test/Transforms/InstCombine/store.ll
index 164ba7632684..b64c800e546c 100644
--- a/test/Transforms/InstCombine/store.ll
+++ b/test/Transforms/InstCombine/store.ll
@@ -5,7 +5,7 @@ define void @test1(i32* %P) {
store i32 123, i32* undef
store i32 124, i32* null
ret void
-; CHECK: @test1(
+; CHECK-LABEL: @test1(
; CHECK-NEXT: store i32 123, i32* undef
; CHECK-NEXT: store i32 undef, i32* null
; CHECK-NEXT: ret void
@@ -16,7 +16,7 @@ define void @test2(i32* %P) {
%Y = add i32 %X, 0 ; <i32> [#uses=1]
store i32 %Y, i32* %P
ret void
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: ret void
}
@@ -38,7 +38,7 @@ Cond2:
Cont:
%V = load i32* %A
ret i32 %V
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NOT: alloca
; CHECK: Cont:
; CHECK-NEXT: %storemerge = phi i32 [ 47, %Cond2 ], [ -987654321, %Cond ]
@@ -58,7 +58,7 @@ Cond:
Cont:
%V = load i32* %A
ret i32 %V
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NOT: alloca
; CHECK: Cont:
; CHECK-NEXT: %storemerge = phi i32 [ -987654321, %Cond ], [ 47, %0 ]
@@ -76,7 +76,7 @@ Cond:
Cont:
ret void
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: Cont:
; CHECK-NEXT: %storemerge = phi i32
; CHECK-NEXT: store i32 %storemerge, i32* %P, align 1
@@ -107,13 +107,14 @@ for.body: ; preds = %for.cond
for.end: ; preds = %for.cond
ret void
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: for.cond:
; CHECK-NEXT: phi i32 [ 42
; CHECK-NEXT: store i32 %storemerge, i32* %gi, align 4, !tbaa !0
}
-!0 = metadata !{metadata !"int", metadata !1}
+!0 = metadata !{metadata !4, metadata !4, i64 0}
!1 = metadata !{metadata !"omnipotent char", metadata !2}
!2 = metadata !{metadata !"Simple C/C++ TBAA"}
!3 = metadata !{metadata !"float", metadata !1}
+!4 = metadata !{metadata !"int", metadata !1}
diff --git a/test/Transforms/InstCombine/stpcpy-1.ll b/test/Transforms/InstCombine/stpcpy-1.ll
index 8b6bb0e0d509..b918c9e9e890 100644
--- a/test/Transforms/InstCombine/stpcpy-1.ll
+++ b/test/Transforms/InstCombine/stpcpy-1.ll
@@ -12,7 +12,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
declare i8* @stpcpy(i8*, i8*)
define i8* @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
%src = getelementptr [6 x i8]* @hello, i32 0, i32 0
@@ -24,7 +24,7 @@ define i8* @test_simplify1() {
}
define i8* @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
@@ -35,7 +35,7 @@ define i8* @test_simplify2() {
}
define i8* @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
%src = getelementptr [32 x i8]* @b, i32 0, i32 0
diff --git a/test/Transforms/InstCombine/stpcpy-2.ll b/test/Transforms/InstCombine/stpcpy-2.ll
index 2e92c0895ed4..6a0f7530d5a8 100644
--- a/test/Transforms/InstCombine/stpcpy-2.ll
+++ b/test/Transforms/InstCombine/stpcpy-2.ll
@@ -11,7 +11,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
declare i16* @stpcpy(i8*, i8*)
define void @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
%src = getelementptr [6 x i8]* @hello, i32 0, i32 0
diff --git a/test/Transforms/InstCombine/stpcpy_chk-1.ll b/test/Transforms/InstCombine/stpcpy_chk-1.ll
index 05603918c642..8a02529c61ca 100644
--- a/test/Transforms/InstCombine/stpcpy_chk-1.ll
+++ b/test/Transforms/InstCombine/stpcpy_chk-1.ll
@@ -12,7 +12,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
; Check cases where slen >= strlen (src).
define void @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [12 x i8]* @.str, i32 0, i32 0
@@ -22,7 +22,7 @@ define void @test_simplify1() {
}
define void @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [12 x i8]* @.str, i32 0, i32 0
@@ -32,7 +32,7 @@ define void @test_simplify2() {
}
define void @test_simplify3() {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [12 x i8]* @.str, i32 0, i32 0
@@ -44,7 +44,7 @@ define void @test_simplify3() {
; Check cases where there are no string constants.
define void @test_simplify4() {
-; CHECK: @test_simplify4
+; CHECK-LABEL: @test_simplify4(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [60 x i8]* @b, i32 0, i32 0
@@ -56,12 +56,12 @@ define void @test_simplify4() {
; Check case where the string length is not constant.
define i8* @test_simplify5() {
-; CHECK: @test_simplify5
+; CHECK-LABEL: @test_simplify5(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [12 x i8]* @.str, i32 0, i32 0
; CHECK: @__memcpy_chk
- %len = call i32 @llvm.objectsize.i32(i8* %dst, i1 false)
+ %len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i1 false)
%ret = call i8* @__stpcpy_chk(i8* %dst, i8* %src, i32 %len)
; CHECK: ret i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 11)
ret i8* %ret
@@ -70,12 +70,12 @@ define i8* @test_simplify5() {
; Check case where the source and destination are the same.
define i8* @test_simplify6() {
-; CHECK: @test_simplify6
+; CHECK-LABEL: @test_simplify6(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
; CHECK: [[LEN:%[a-z]+]] = call i32 @strlen
; CHECK-NEXT: getelementptr inbounds [60 x i8]* @a, i32 0, i32 [[LEN]]
- %len = call i32 @llvm.objectsize.i32(i8* %dst, i1 false)
+ %len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i1 false)
%ret = call i8* @__stpcpy_chk(i8* %dst, i8* %dst, i32 %len)
ret i8* %ret
}
@@ -83,7 +83,7 @@ define i8* @test_simplify6() {
; Check case where slen < strlen (src).
define void @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [60 x i8]* @b, i32 0, i32 0
@@ -93,4 +93,4 @@ define void @test_no_simplify1() {
}
declare i8* @__stpcpy_chk(i8*, i8*, i32) nounwind
-declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly
+declare i32 @llvm.objectsize.i32.p0i8(i8*, i1) nounwind readonly
diff --git a/test/Transforms/InstCombine/stpcpy_chk-2.ll b/test/Transforms/InstCombine/stpcpy_chk-2.ll
index 46c2139276e2..b503da9c191c 100644
--- a/test/Transforms/InstCombine/stpcpy_chk-2.ll
+++ b/test/Transforms/InstCombine/stpcpy_chk-2.ll
@@ -9,7 +9,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
@.str = private constant [8 x i8] c"abcdefg\00"
define void @test_no_simplify() {
-; CHECK: @test_no_simplify
+; CHECK-LABEL: @test_no_simplify(
%dst = getelementptr inbounds [60 x i16]* @a, i32 0, i32 0
%src = getelementptr inbounds [8 x i8]* @.str, i32 0, i32 0
diff --git a/test/Transforms/InstCombine/strcat-1.ll b/test/Transforms/InstCombine/strcat-1.ll
index 3c05d6b06fa0..131ad4834837 100644
--- a/test/Transforms/InstCombine/strcat-1.ll
+++ b/test/Transforms/InstCombine/strcat-1.ll
@@ -13,7 +13,7 @@ declare i8* @strcat(i8*, i8*)
declare i32 @puts(i8*)
define i32 @main() {
-; CHECK: @main
+; CHECK-LABEL: @main(
; CHECK-NOT: call i8* @strcat
; CHECK: call i32 @puts
diff --git a/test/Transforms/InstCombine/strcat-2.ll b/test/Transforms/InstCombine/strcat-2.ll
index 379ee7495317..48f82670c325 100644
--- a/test/Transforms/InstCombine/strcat-2.ll
+++ b/test/Transforms/InstCombine/strcat-2.ll
@@ -11,7 +11,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
declare i8* @strcat(i8*, i8*)
define void @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
; CHECK-NOT: call i8* @strcat
; CHECK: ret void
@@ -22,7 +22,7 @@ define void @test_simplify1() {
}
define void @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
; CHECK-NEXT: ret void
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
diff --git a/test/Transforms/InstCombine/strcat-3.ll b/test/Transforms/InstCombine/strcat-3.ll
index 15aff2f1aa28..e3396df73d37 100644
--- a/test/Transforms/InstCombine/strcat-3.ll
+++ b/test/Transforms/InstCombine/strcat-3.ll
@@ -11,7 +11,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
declare i16* @strcat(i8*, i8*)
define void @test_nosimplify1() {
-; CHECK: @test_nosimplify1
+; CHECK-LABEL: @test_nosimplify1(
; CHECK: call i16* @strcat
; CHECK: ret void
diff --git a/test/Transforms/InstCombine/strchr-1.ll b/test/Transforms/InstCombine/strchr-1.ll
index 5efab9ec4bee..d2c989462156 100644
--- a/test/Transforms/InstCombine/strchr-1.ll
+++ b/test/Transforms/InstCombine/strchr-1.ll
@@ -52,3 +52,14 @@ define void @test_simplify4(i32 %chr) {
store i8* %dst, i8** @chp
ret void
}
+
+define void @test_simplify5() {
+; CHECK: store i8* getelementptr inbounds ([14 x i8]* @hello, i32 0, i32 13)
+; CHECK-NOT: call i8* @strchr
+; CHECK: ret void
+
+ %src = getelementptr [14 x i8]* @hello, i32 0, i32 0
+ %dst = call i8* @strchr(i8* %src, i32 65280)
+ store i8* %dst, i8** @chp
+ ret void
+}
diff --git a/test/Transforms/InstCombine/strcmp-1.ll b/test/Transforms/InstCombine/strcmp-1.ll
index 0679246e0915..fc58ffcb8cb0 100644
--- a/test/Transforms/InstCombine/strcmp-1.ll
+++ b/test/Transforms/InstCombine/strcmp-1.ll
@@ -12,7 +12,7 @@ declare i32 @strcmp(i8*, i8*)
; strcmp("", x) -> -*x
define i32 @test1(i8* %str2) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %strcmpload = load i8* %str
; CHECK: %1 = zext i8 %strcmpload to i32
; CHECK: %2 = sub i32 0, %1
@@ -26,7 +26,7 @@ define i32 @test1(i8* %str2) {
; strcmp(x, "") -> *x
define i32 @test2(i8* %str1) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: %strcmpload = load i8* %str
; CHECK: %1 = zext i8 %strcmpload to i32
; CHECK: ret i32 %1
@@ -38,7 +38,7 @@ define i32 @test2(i8* %str1) {
; strcmp(x, y) -> cnst
define i32 @test3() {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: ret i32 -1
%str1 = getelementptr inbounds [5 x i8]* @hell, i32 0, i32 0
@@ -48,7 +48,7 @@ define i32 @test3() {
}
define i32 @test4() {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: ret i32 1
%str1 = getelementptr inbounds [5 x i8]* @hell, i32 0, i32 0
@@ -60,7 +60,7 @@ define i32 @test4() {
; strcmp(x, y) -> memcmp(x, y, <known length>)
; (This transform is rather difficult to trigger in a useful manner)
define i32 @test5(i1 %b) {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: %memcmp = call i32 @memcmp(i8* getelementptr inbounds ([6 x i8]* @hello, i32 0, i32 0), i8* %str2, i32 5)
; CHECK: ret i32 %memcmp
@@ -74,7 +74,7 @@ define i32 @test5(i1 %b) {
; strcmp(x,x) -> 0
define i32 @test6(i8* %str) {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: ret i32 0
%temp1 = call i32 @strcmp(i8* %str, i8* %str)
diff --git a/test/Transforms/InstCombine/strcmp-2.ll b/test/Transforms/InstCombine/strcmp-2.ll
index 20518960f302..f0ef51652270 100644
--- a/test/Transforms/InstCombine/strcmp-2.ll
+++ b/test/Transforms/InstCombine/strcmp-2.ll
@@ -9,7 +9,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
declare i16 @strcmp(i8*, i8*)
define i16 @test_nosimplify() {
-; CHECK: @test_nosimplify
+; CHECK-LABEL: @test_nosimplify(
; CHECK: call i16 @strcmp
; CHECK: ret i16 %temp1
diff --git a/test/Transforms/InstCombine/strcpy-1.ll b/test/Transforms/InstCombine/strcpy-1.ll
index b6cf048b2a81..7c253f6f9fca 100644
--- a/test/Transforms/InstCombine/strcpy-1.ll
+++ b/test/Transforms/InstCombine/strcpy-1.ll
@@ -13,7 +13,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
declare i8* @strcpy(i8*, i8*)
define void @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
%src = getelementptr [6 x i8]* @hello, i32 0, i32 0
@@ -24,7 +24,7 @@ define void @test_simplify1() {
}
define i8* @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
@@ -34,7 +34,7 @@ define i8* @test_simplify2() {
}
define i8* @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
%src = getelementptr [32 x i8]* @b, i32 0, i32 0
diff --git a/test/Transforms/InstCombine/strcpy-2.ll b/test/Transforms/InstCombine/strcpy-2.ll
index 779e9fdd9598..bad392d7c648 100644
--- a/test/Transforms/InstCombine/strcpy-2.ll
+++ b/test/Transforms/InstCombine/strcpy-2.ll
@@ -11,7 +11,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
declare i16* @strcpy(i8*, i8*)
define void @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
%src = getelementptr [6 x i8]* @hello, i32 0, i32 0
diff --git a/test/Transforms/InstCombine/strcpy_chk-1.ll b/test/Transforms/InstCombine/strcpy_chk-1.ll
index 3e48f4fd3057..8e7fec76ef5c 100644
--- a/test/Transforms/InstCombine/strcpy_chk-1.ll
+++ b/test/Transforms/InstCombine/strcpy_chk-1.ll
@@ -12,7 +12,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
; Check cases where slen >= strlen (src).
define void @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [12 x i8]* @.str, i32 0, i32 0
@@ -22,7 +22,7 @@ define void @test_simplify1() {
}
define void @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [12 x i8]* @.str, i32 0, i32 0
@@ -32,7 +32,7 @@ define void @test_simplify2() {
}
define void @test_simplify3() {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [12 x i8]* @.str, i32 0, i32 0
@@ -44,7 +44,7 @@ define void @test_simplify3() {
; Check cases where there are no string constants.
define void @test_simplify4() {
-; CHECK: @test_simplify4
+; CHECK-LABEL: @test_simplify4(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [60 x i8]* @b, i32 0, i32 0
@@ -56,12 +56,12 @@ define void @test_simplify4() {
; Check case where the string length is not constant.
define void @test_simplify5() {
-; CHECK: @test_simplify5
+; CHECK-LABEL: @test_simplify5(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [12 x i8]* @.str, i32 0, i32 0
; CHECK: @__memcpy_chk
- %len = call i32 @llvm.objectsize.i32(i8* %dst, i1 false)
+ %len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i1 false)
call i8* @__strcpy_chk(i8* %dst, i8* %src, i32 %len)
ret void
}
@@ -69,11 +69,11 @@ define void @test_simplify5() {
; Check case where the source and destination are the same.
define i8* @test_simplify6() {
-; CHECK: @test_simplify6
+; CHECK-LABEL: @test_simplify6(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
; CHECK: getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0)
- %len = call i32 @llvm.objectsize.i32(i8* %dst, i1 false)
+ %len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i1 false)
%ret = call i8* @__strcpy_chk(i8* %dst, i8* %dst, i32 %len)
ret i8* %ret
}
@@ -81,7 +81,7 @@ define i8* @test_simplify6() {
; Check case where slen < strlen (src).
define void @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [60 x i8]* @b, i32 0, i32 0
@@ -91,4 +91,4 @@ define void @test_no_simplify1() {
}
declare i8* @__strcpy_chk(i8*, i8*, i32) nounwind
-declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly
+declare i32 @llvm.objectsize.i32.p0i8(i8*, i1) nounwind readonly
diff --git a/test/Transforms/InstCombine/strcpy_chk-2.ll b/test/Transforms/InstCombine/strcpy_chk-2.ll
index d76ea5d068bc..1eff5a822e78 100644
--- a/test/Transforms/InstCombine/strcpy_chk-2.ll
+++ b/test/Transforms/InstCombine/strcpy_chk-2.ll
@@ -9,7 +9,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
@.str = private constant [8 x i8] c"abcdefg\00"
define void @test_no_simplify() {
-; CHECK: @test_no_simplify
+; CHECK-LABEL: @test_no_simplify(
%dst = getelementptr inbounds [60 x i16]* @a, i32 0, i32 0
%src = getelementptr inbounds [8 x i8]* @.str, i32 0, i32 0
diff --git a/test/Transforms/InstCombine/strcpy_chk-64.ll b/test/Transforms/InstCombine/strcpy_chk-64.ll
index 036fcbe6de1d..31447d9569e1 100644
--- a/test/Transforms/InstCombine/strcpy_chk-64.ll
+++ b/test/Transforms/InstCombine/strcpy_chk-64.ll
@@ -3,7 +3,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-apple-darwin10.0.0"
define void @func(i8* %i) nounwind ssp {
-; CHECK: @func
+; CHECK-LABEL: @func(
; CHECK: @__strcpy_chk(i8* %arraydecay, i8* %i, i64 32)
entry:
%s = alloca [32 x i8], align 16
diff --git a/test/Transforms/InstCombine/strcspn-1.ll b/test/Transforms/InstCombine/strcspn-1.ll
index 60fad897b2c8..b3b52b5025a5 100644
--- a/test/Transforms/InstCombine/strcspn-1.ll
+++ b/test/Transforms/InstCombine/strcspn-1.ll
@@ -13,7 +13,7 @@ declare i64 @strcspn(i8*, i8*)
; Check strcspn(s, "") -> strlen(s).
define i64 @test_simplify1(i8* %str) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%pat = getelementptr [1 x i8]* @null, i32 0, i32 0
%ret = call i64 @strcspn(i8* %str, i8* %pat)
@@ -25,7 +25,7 @@ define i64 @test_simplify1(i8* %str) {
; Check strcspn("", s) -> 0.
define i64 @test_simplify2(i8* %pat) {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%str = getelementptr [1 x i8]* @null, i32 0, i32 0
%ret = call i64 @strcspn(i8* %str, i8* %pat)
@@ -36,7 +36,7 @@ define i64 @test_simplify2(i8* %pat) {
; Check strcspn(s1, s2), where s1 and s2 are constants.
define i64 @test_simplify3() {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%str = getelementptr [6 x i8]* @abcba, i32 0, i32 0
%pat = getelementptr [4 x i8]* @abc, i32 0, i32 0
@@ -48,7 +48,7 @@ define i64 @test_simplify3() {
; Check cases that shouldn't be simplified.
define i64 @test_no_simplify1(i8* %str, i8* %pat) {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%ret = call i64 @strcspn(i8* %str, i8* %pat)
; CHECK-NEXT: %ret = call i64 @strcspn(i8* %str, i8* %pat)
diff --git a/test/Transforms/InstCombine/strcspn-2.ll b/test/Transforms/InstCombine/strcspn-2.ll
index 4e2393686c7d..ecfa27d3b6ba 100644
--- a/test/Transforms/InstCombine/strcspn-2.ll
+++ b/test/Transforms/InstCombine/strcspn-2.ll
@@ -11,7 +11,7 @@ declare double @strcspn(i8*, i8*)
; Check that strcspn functions with the wrong prototype aren't simplified.
define double @test_no_simplify1(i8* %pat) {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%str = getelementptr [1 x i8]* @null, i32 0, i32 0
%ret = call double @strcspn(i8* %str, i8* %pat)
diff --git a/test/Transforms/InstCombine/strlen-1.ll b/test/Transforms/InstCombine/strlen-1.ll
index 6d7464a4cc80..4fa5b4fdb62f 100644
--- a/test/Transforms/InstCombine/strlen-1.ll
+++ b/test/Transforms/InstCombine/strlen-1.ll
@@ -15,7 +15,7 @@ declare i32 @strlen(i8*)
; Check strlen(string constant) -> integer constant.
define i32 @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%hello_p = getelementptr [6 x i8]* @hello, i32 0, i32 0
%hello_l = call i32 @strlen(i8* %hello_p)
ret i32 %hello_l
@@ -23,7 +23,7 @@ define i32 @test_simplify1() {
}
define i32 @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%null_p = getelementptr [1 x i8]* @null, i32 0, i32 0
%null_l = call i32 @strlen(i8* %null_p)
ret i32 %null_l
@@ -31,7 +31,7 @@ define i32 @test_simplify2() {
}
define i32 @test_simplify3() {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%null_hello_p = getelementptr [7 x i8]* @null_hello, i32 0, i32 0
%null_hello_l = call i32 @strlen(i8* %null_hello_p)
ret i32 %null_hello_l
@@ -39,7 +39,7 @@ define i32 @test_simplify3() {
}
define i32 @test_simplify4() {
-; CHECK: @test_simplify4
+; CHECK-LABEL: @test_simplify4(
%len = tail call i32 @strlen(i8* @nullstring) nounwind
ret i32 %len
; CHECK-NEXT: ret i32 0
@@ -48,7 +48,7 @@ define i32 @test_simplify4() {
; Check strlen(x) == 0 --> *x == 0.
define i1 @test_simplify5() {
-; CHECK: @test_simplify5
+; CHECK-LABEL: @test_simplify5(
%hello_p = getelementptr [6 x i8]* @hello, i32 0, i32 0
%hello_l = call i32 @strlen(i8* %hello_p)
%eq_hello = icmp eq i32 %hello_l, 0
@@ -57,7 +57,7 @@ define i1 @test_simplify5() {
}
define i1 @test_simplify6() {
-; CHECK: @test_simplify6
+; CHECK-LABEL: @test_simplify6(
%null_p = getelementptr [1 x i8]* @null, i32 0, i32 0
%null_l = call i32 @strlen(i8* %null_p)
%eq_null = icmp eq i32 %null_l, 0
@@ -68,7 +68,7 @@ define i1 @test_simplify6() {
; Check strlen(x) != 0 --> *x != 0.
define i1 @test_simplify7() {
-; CHECK: @test_simplify7
+; CHECK-LABEL: @test_simplify7(
%hello_p = getelementptr [6 x i8]* @hello, i32 0, i32 0
%hello_l = call i32 @strlen(i8* %hello_p)
%ne_hello = icmp ne i32 %hello_l, 0
@@ -77,7 +77,7 @@ define i1 @test_simplify7() {
}
define i1 @test_simplify8() {
-; CHECK: @test_simplify8
+; CHECK-LABEL: @test_simplify8(
%null_p = getelementptr [1 x i8]* @null, i32 0, i32 0
%null_l = call i32 @strlen(i8* %null_p)
%ne_null = icmp ne i32 %null_l, 0
@@ -88,7 +88,7 @@ define i1 @test_simplify8() {
; Check cases that shouldn't be simplified.
define i32 @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%a_p = getelementptr [32 x i8]* @a, i32 0, i32 0
%a_l = call i32 @strlen(i8* %a_p)
; CHECK-NEXT: %a_l = call i32 @strlen
diff --git a/test/Transforms/InstCombine/strlen-2.ll b/test/Transforms/InstCombine/strlen-2.ll
index c4fd54c06db9..6652a310ba6a 100644
--- a/test/Transforms/InstCombine/strlen-2.ll
+++ b/test/Transforms/InstCombine/strlen-2.ll
@@ -9,7 +9,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
declare i32 @strlen(i8*, i32)
define i32 @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%hello_p = getelementptr [6 x i8]* @hello, i32 0, i32 0
%hello_l = call i32 @strlen(i8* %hello_p, i32 187)
; CHECK-NEXT: %hello_l = call i32 @strlen
diff --git a/test/Transforms/InstCombine/strncat-1.ll b/test/Transforms/InstCombine/strncat-1.ll
index ad2a18b1465d..8eae3dae2e23 100644
--- a/test/Transforms/InstCombine/strncat-1.ll
+++ b/test/Transforms/InstCombine/strncat-1.ll
@@ -12,7 +12,7 @@ declare i8* @strncat(i8*, i8*, i32)
declare i32 @puts(i8*)
define i32 @main() {
-; CHECK: @main
+; CHECK-LABEL: @main(
; CHECK-NOT: call i8* @strncat
; CHECK: call i32 @puts
diff --git a/test/Transforms/InstCombine/strncat-2.ll b/test/Transforms/InstCombine/strncat-2.ll
index c56deacd39bb..b09fa1260a03 100644
--- a/test/Transforms/InstCombine/strncat-2.ll
+++ b/test/Transforms/InstCombine/strncat-2.ll
@@ -11,7 +11,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
declare i8* @strncat(i8*, i8*, i32)
define void @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
; CHECK-NOT: call i8* @strncat
; CHECK: ret void
@@ -22,7 +22,7 @@ define void @test_simplify1() {
}
define void @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
; CHECK-NEXT: ret void
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
@@ -32,7 +32,7 @@ define void @test_simplify2() {
}
define void @test_simplify3() {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
; CHECK-NEXT: ret void
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
@@ -42,7 +42,7 @@ define void @test_simplify3() {
}
define void @test_nosimplify1() {
-; CHECK: @test_nosimplify1
+; CHECK-LABEL: @test_nosimplify1(
; CHECK: call i8* @strncat
; CHECK: ret void
diff --git a/test/Transforms/InstCombine/strncat-3.ll b/test/Transforms/InstCombine/strncat-3.ll
index 3cd797168705..1b25b4aca1ae 100644
--- a/test/Transforms/InstCombine/strncat-3.ll
+++ b/test/Transforms/InstCombine/strncat-3.ll
@@ -11,7 +11,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
declare i16* @strncat(i8*, i8*, i32)
define void @test_nosimplify1() {
-; CHECK: @test_nosimplify1
+; CHECK-LABEL: @test_nosimplify1(
; CHECK: call i16* @strncat
; CHECK: ret void
diff --git a/test/Transforms/InstCombine/strncmp-1.ll b/test/Transforms/InstCombine/strncmp-1.ll
index 187c2fa50e82..df30dd100443 100644
--- a/test/Transforms/InstCombine/strncmp-1.ll
+++ b/test/Transforms/InstCombine/strncmp-1.ll
@@ -12,7 +12,7 @@ declare i32 @strncmp(i8*, i8*, i32)
; strncmp("", x, n) -> -*x
define i32 @test1(i8* %str2) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %strcmpload = load i8* %str
; CHECK: %1 = zext i8 %strcmpload to i32
; CHECK: %2 = sub i32 0, %1
@@ -25,7 +25,7 @@ define i32 @test1(i8* %str2) {
; strncmp(x, "", n) -> *x
define i32 @test2(i8* %str1) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: %strcmpload = load i8* %str1
; CHECK: %1 = zext i8 %strcmpload to i32
; CHECK: ret i32 %1
@@ -37,7 +37,7 @@ define i32 @test2(i8* %str1) {
; strncmp(x, y, n) -> cnst
define i32 @test3() {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: ret i32 -1
%str1 = getelementptr inbounds [5 x i8]* @hell, i32 0, i32 0
@@ -47,7 +47,7 @@ define i32 @test3() {
}
define i32 @test4() {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: ret i32 1
%str1 = getelementptr inbounds [5 x i8]* @hell, i32 0, i32 0
@@ -57,7 +57,7 @@ define i32 @test4() {
}
define i32 @test5() {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: ret i32 0
%str1 = getelementptr inbounds [5 x i8]* @hell, i32 0, i32 0
@@ -68,7 +68,7 @@ define i32 @test5() {
; strncmp(x,y,1) -> memcmp(x,y,1)
define i32 @test6(i8* %str1, i8* %str2) {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: [[LOAD1:%[a-z]+]] = load i8* %str1, align 1
; CHECK: [[ZEXT1:%[a-z]+]] = zext i8 [[LOAD1]] to i32
; CHECK: [[LOAD2:%[a-z]+]] = load i8* %str2, align 1
@@ -82,7 +82,7 @@ define i32 @test6(i8* %str1, i8* %str2) {
; strncmp(x,y,0) -> 0
define i32 @test7(i8* %str1, i8* %str2) {
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: ret i32 0
%temp1 = call i32 @strncmp(i8* %str1, i8* %str2, i32 0)
@@ -91,7 +91,7 @@ define i32 @test7(i8* %str1, i8* %str2) {
; strncmp(x,x,n) -> 0
define i32 @test8(i8* %str, i32 %n) {
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: ret i32 0
%temp1 = call i32 @strncmp(i8* %str, i8* %str, i32 %n)
diff --git a/test/Transforms/InstCombine/strncmp-2.ll b/test/Transforms/InstCombine/strncmp-2.ll
index 3fc43a6fd4f5..16ad8a4f62a7 100644
--- a/test/Transforms/InstCombine/strncmp-2.ll
+++ b/test/Transforms/InstCombine/strncmp-2.ll
@@ -9,7 +9,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
declare i16 @strncmp(i8*, i8*, i32)
define i16 @test_nosimplify() {
-; CHECK: @test_nosimplify
+; CHECK-LABEL: @test_nosimplify(
; CHECK: call i16 @strncmp
; CHECK: ret i16 %temp1
diff --git a/test/Transforms/InstCombine/strncpy-1.ll b/test/Transforms/InstCombine/strncpy-1.ll
index 3ce2b9b5eecc..c70197f12e28 100644
--- a/test/Transforms/InstCombine/strncpy-1.ll
+++ b/test/Transforms/InstCombine/strncpy-1.ll
@@ -16,7 +16,7 @@ declare i32 @puts(i8*)
; Check a bunch of strncpy invocations together.
define i32 @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
; CHECK-NOT: call i8* @strncpy
; CHECK: call i32 @puts
%target = alloca [1024 x i8]
@@ -39,7 +39,7 @@ define i32 @test_simplify1() {
; Check strncpy(x, "", y) -> memset(x, '\0', y, 1).
define void @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
%src = getelementptr [1 x i8]* @null, i32 0, i32 0
@@ -51,7 +51,7 @@ define void @test_simplify2() {
; Check strncpy(x, y, 0) -> x.
define i8* @test_simplify3() {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
%src = getelementptr [6 x i8]* @hello, i32 0, i32 0
@@ -63,7 +63,7 @@ define i8* @test_simplify3() {
; Check strncpy(x, s, c) -> memcpy(x, s, c, 1) [s and c are constant].
define void @test_simplify4() {
-; CHECK: @test_simplify4
+; CHECK-LABEL: @test_simplify4(
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
%src = getelementptr [6 x i8]* @hello, i32 0, i32 0
@@ -75,7 +75,7 @@ define void @test_simplify4() {
; Check cases that shouldn't be simplified.
define void @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
%src = getelementptr [32 x i8]* @b, i32 0, i32 0
@@ -85,7 +85,7 @@ define void @test_no_simplify1() {
}
define void @test_no_simplify2() {
-; CHECK: @test_no_simplify2
+; CHECK-LABEL: @test_no_simplify2(
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
%src = getelementptr [6 x i8]* @hello, i32 0, i32 0
diff --git a/test/Transforms/InstCombine/strncpy-2.ll b/test/Transforms/InstCombine/strncpy-2.ll
index ac28ea655009..acc2878648fc 100644
--- a/test/Transforms/InstCombine/strncpy-2.ll
+++ b/test/Transforms/InstCombine/strncpy-2.ll
@@ -12,7 +12,7 @@ declare i16* @strncpy(i8*, i8*, i32)
; Check that 'strncpy' functions with the wrong prototype aren't simplified.
define void @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%dst = getelementptr [32 x i8]* @a, i32 0, i32 0
%src = getelementptr [6 x i8]* @hello, i32 0, i32 0
diff --git a/test/Transforms/InstCombine/strncpy_chk-1.ll b/test/Transforms/InstCombine/strncpy_chk-1.ll
index aadff4268ec2..90b4173ced77 100644
--- a/test/Transforms/InstCombine/strncpy_chk-1.ll
+++ b/test/Transforms/InstCombine/strncpy_chk-1.ll
@@ -12,7 +12,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
; Check cases where dstlen >= len
define void @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [12 x i8]* @.str, i32 0, i32 0
@@ -22,7 +22,7 @@ define void @test_simplify1() {
}
define void @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [12 x i8]* @.str, i32 0, i32 0
@@ -32,7 +32,7 @@ define void @test_simplify2() {
}
define void @test_simplify3() {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [60 x i8]* @b, i32 0, i32 0
@@ -44,7 +44,7 @@ define void @test_simplify3() {
; Check cases where dstlen < len
define void @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [12 x i8]* @.str, i32 0, i32 0
@@ -54,7 +54,7 @@ define void @test_no_simplify1() {
}
define void @test_no_simplify2() {
-; CHECK: @test_no_simplify2
+; CHECK-LABEL: @test_no_simplify2(
%dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
%src = getelementptr inbounds [60 x i8]* @b, i32 0, i32 0
diff --git a/test/Transforms/InstCombine/strncpy_chk-2.ll b/test/Transforms/InstCombine/strncpy_chk-2.ll
index a0f132ebf63b..829a4798f09a 100644
--- a/test/Transforms/InstCombine/strncpy_chk-2.ll
+++ b/test/Transforms/InstCombine/strncpy_chk-2.ll
@@ -9,7 +9,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
@b = common global [60 x i16] zeroinitializer, align 1
define void @test_no_simplify() {
-; CHECK: @test_no_simplify
+; CHECK-LABEL: @test_no_simplify(
%dst = getelementptr inbounds [60 x i16]* @a, i32 0, i32 0
%src = getelementptr inbounds [60 x i16]* @b, i32 0, i32 0
diff --git a/test/Transforms/InstCombine/strpbrk-1.ll b/test/Transforms/InstCombine/strpbrk-1.ll
index a5d0d86501b1..58b2d9e88d2c 100644
--- a/test/Transforms/InstCombine/strpbrk-1.ll
+++ b/test/Transforms/InstCombine/strpbrk-1.ll
@@ -13,7 +13,7 @@ declare i8* @strpbrk(i8*, i8*)
; Check strpbrk(s, "") -> NULL.
define i8* @test_simplify1(i8* %str) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%pat = getelementptr [1 x i8]* @null, i32 0, i32 0
%ret = call i8* @strpbrk(i8* %str, i8* %pat)
@@ -24,7 +24,7 @@ define i8* @test_simplify1(i8* %str) {
; Check strpbrk("", s) -> NULL.
define i8* @test_simplify2(i8* %pat) {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%str = getelementptr [1 x i8]* @null, i32 0, i32 0
%ret = call i8* @strpbrk(i8* %str, i8* %pat)
@@ -35,7 +35,7 @@ define i8* @test_simplify2(i8* %pat) {
; Check strpbrk(s1, s2), where s1 and s2 are constants.
define i8* @test_simplify3() {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%str = getelementptr [12 x i8]* @hello, i32 0, i32 0
%pat = getelementptr [2 x i8]* @w, i32 0, i32 0
@@ -47,7 +47,7 @@ define i8* @test_simplify3() {
; Check strpbrk(s, "a") -> strchr(s, 'a').
define i8* @test_simplify4(i8* %str) {
-; CHECK: @test_simplify4
+; CHECK-LABEL: @test_simplify4(
%pat = getelementptr [2 x i8]* @w, i32 0, i32 0
%ret = call i8* @strpbrk(i8* %str, i8* %pat)
@@ -59,7 +59,7 @@ define i8* @test_simplify4(i8* %str) {
; Check cases that shouldn't be simplified.
define i8* @test_no_simplify1(i8* %str, i8* %pat) {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%ret = call i8* @strpbrk(i8* %str, i8* %pat)
; CHECK-NEXT: %ret = call i8* @strpbrk(i8* %str, i8* %pat)
diff --git a/test/Transforms/InstCombine/strpbrk-2.ll b/test/Transforms/InstCombine/strpbrk-2.ll
index 31ac2905df2c..b797d7a59527 100644
--- a/test/Transforms/InstCombine/strpbrk-2.ll
+++ b/test/Transforms/InstCombine/strpbrk-2.ll
@@ -12,7 +12,7 @@ declare i16* @strpbrk(i8*, i8*)
; Check that 'strpbrk' functions with the wrong prototype aren't simplified.
define i16* @test_no_simplify1() {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%str = getelementptr [12 x i8]* @hello, i32 0, i32 0
%pat = getelementptr [2 x i8]* @w, i32 0, i32 0
diff --git a/test/Transforms/InstCombine/strrchr-1.ll b/test/Transforms/InstCombine/strrchr-1.ll
index 854ce45bffb2..4615f5f2bd25 100644
--- a/test/Transforms/InstCombine/strrchr-1.ll
+++ b/test/Transforms/InstCombine/strrchr-1.ll
@@ -42,8 +42,19 @@ define void @test_simplify3() {
ret void
}
+define void @test_simplify4() {
+; CHECK: store i8* getelementptr inbounds ([14 x i8]* @hello, i32 0, i32 13)
+; CHECK-NOT: call i8* @strrchr
+; CHECK: ret void
+
+ %src = getelementptr [14 x i8]* @hello, i32 0, i32 0
+ %dst = call i8* @strrchr(i8* %src, i32 65280)
+ store i8* %dst, i8** @chp
+ ret void
+}
+
define void @test_nosimplify1(i32 %chr) {
-; CHECK: @test_nosimplify1
+; CHECK-LABEL: @test_nosimplify1(
; CHECK: call i8* @strrchr
; CHECK: ret void
diff --git a/test/Transforms/InstCombine/strspn-1.ll b/test/Transforms/InstCombine/strspn-1.ll
index 393f88735bd4..ac940cce9e56 100644
--- a/test/Transforms/InstCombine/strspn-1.ll
+++ b/test/Transforms/InstCombine/strspn-1.ll
@@ -13,7 +13,7 @@ declare i64 @strspn(i8*, i8*)
; Check strspn(s, "") -> 0.
define i64 @test_simplify1(i8* %str) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%pat = getelementptr [1 x i8]* @null, i32 0, i32 0
%ret = call i64 @strspn(i8* %str, i8* %pat)
@@ -24,7 +24,7 @@ define i64 @test_simplify1(i8* %str) {
; Check strspn("", s) -> 0.
define i64 @test_simplify2(i8* %pat) {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%str = getelementptr [1 x i8]* @null, i32 0, i32 0
%ret = call i64 @strspn(i8* %str, i8* %pat)
@@ -35,7 +35,7 @@ define i64 @test_simplify2(i8* %pat) {
; Check strspn(s1, s2), where s1 and s2 are constants.
define i64 @test_simplify3() {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%str = getelementptr [6 x i8]* @abcba, i32 0, i32 0
%pat = getelementptr [4 x i8]* @abc, i32 0, i32 0
@@ -47,7 +47,7 @@ define i64 @test_simplify3() {
; Check cases that shouldn't be simplified.
define i64 @test_no_simplify1(i8* %str, i8* %pat) {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%ret = call i64 @strspn(i8* %str, i8* %pat)
; CHECK-NEXT: %ret = call i64 @strspn(i8* %str, i8* %pat)
diff --git a/test/Transforms/InstCombine/strstr-1.ll b/test/Transforms/InstCombine/strstr-1.ll
index 81f52718747d..a946dd32779a 100644
--- a/test/Transforms/InstCombine/strstr-1.ll
+++ b/test/Transforms/InstCombine/strstr-1.ll
@@ -14,7 +14,7 @@ declare i8* @strstr(i8*, i8*)
; Check strstr(str, "") -> str.
define i8* @test_simplify1(i8* %str) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%pat = getelementptr inbounds [1 x i8]* @.str, i32 0, i32 0
%ret = call i8* @strstr(i8* %str, i8* %pat)
ret i8* %ret
@@ -24,7 +24,7 @@ define i8* @test_simplify1(i8* %str) {
; Check strstr(str, "a") -> strchr(str, 'a').
define i8* @test_simplify2(i8* %str) {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%pat = getelementptr inbounds [2 x i8]* @.str1, i32 0, i32 0
%ret = call i8* @strstr(i8* %str, i8* %pat)
ret i8* %ret
@@ -34,7 +34,7 @@ define i8* @test_simplify2(i8* %str) {
; Check strstr("abcde", "bcd") -> "abcde" + 1.
define i8* @test_simplify3() {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%str = getelementptr inbounds [6 x i8]* @.str2, i32 0, i32 0
%pat = getelementptr inbounds [4 x i8]* @.str3, i32 0, i32 0
%ret = call i8* @strstr(i8* %str, i8* %pat)
@@ -45,7 +45,7 @@ define i8* @test_simplify3() {
; Check strstr(str, str) -> str.
define i8* @test_simplify4(i8* %str) {
-; CHECK: @test_simplify4
+; CHECK-LABEL: @test_simplify4(
%ret = call i8* @strstr(i8* %str, i8* %str)
ret i8* %ret
; CHECK-NEXT: ret i8* %str
@@ -54,7 +54,7 @@ define i8* @test_simplify4(i8* %str) {
; Check strstr(str, pat) == str -> strncmp(str, pat, strlen(str)) == 0.
define i1 @test_simplify5(i8* %str, i8* %pat) {
-; CHECK: @test_simplify5
+; CHECK-LABEL: @test_simplify5(
%ret = call i8* @strstr(i8* %str, i8* %pat)
%cmp = icmp eq i8* %ret, %str
ret i1 %cmp
diff --git a/test/Transforms/InstCombine/strstr-2.ll b/test/Transforms/InstCombine/strstr-2.ll
index 5092f9b4f803..7b28ed0e691e 100644
--- a/test/Transforms/InstCombine/strstr-2.ll
+++ b/test/Transforms/InstCombine/strstr-2.ll
@@ -9,7 +9,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
declare i8 @strstr(i8*, i8*)
define i8 @test_no_simplify1(i8* %str) {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
%pat = getelementptr inbounds [1 x i8]* @null, i32 0, i32 0
%ret = call i8 @strstr(i8* %str, i8* %pat)
; CHECK-NEXT: call i8 @strstr
diff --git a/test/Transforms/InstCombine/strto-1.ll b/test/Transforms/InstCombine/strto-1.ll
index 7139972fe043..fc35dddcae5a 100644
--- a/test/Transforms/InstCombine/strto-1.ll
+++ b/test/Transforms/InstCombine/strto-1.ll
@@ -5,77 +5,77 @@
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"
declare i64 @strtol(i8* %s, i8** %endptr, i32 %base)
-; CHECK: declare i64 @strtol(i8*, i8** nocapture, i32)
+; CHECK: declare i64 @strtol(i8* readonly, i8** nocapture, i32)
declare double @strtod(i8* %s, i8** %endptr, i32 %base)
-; CHECK: declare double @strtod(i8*, i8** nocapture, i32)
+; CHECK: declare double @strtod(i8* readonly, i8** nocapture, i32)
declare float @strtof(i8* %s, i8** %endptr, i32 %base)
-; CHECK: declare float @strtof(i8*, i8** nocapture, i32)
+; CHECK: declare float @strtof(i8* readonly, i8** nocapture, i32)
declare i64 @strtoul(i8* %s, i8** %endptr, i32 %base)
-; CHECK: declare i64 @strtoul(i8*, i8** nocapture, i32)
+; CHECK: declare i64 @strtoul(i8* readonly, i8** nocapture, i32)
declare i64 @strtoll(i8* %s, i8** %endptr, i32 %base)
-; CHECK: declare i64 @strtoll(i8*, i8** nocapture, i32)
+; CHECK: declare i64 @strtoll(i8* readonly, i8** nocapture, i32)
declare double @strtold(i8* %s, i8** %endptr)
-; CHECK: declare double @strtold(i8*, i8** nocapture)
+; CHECK: declare double @strtold(i8* readonly, i8** nocapture)
declare i64 @strtoull(i8* %s, i8** %endptr, i32 %base)
-; CHECK: declare i64 @strtoull(i8*, i8** nocapture, i32)
+; CHECK: declare i64 @strtoull(i8* readonly, i8** nocapture, i32)
define void @test_simplify1(i8* %x, i8** %endptr) {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
call i64 @strtol(i8* %x, i8** null, i32 10)
; CHECK-NEXT: call i64 @strtol(i8* nocapture %x, i8** null, i32 10)
ret void
}
define void @test_simplify2(i8* %x, i8** %endptr) {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
call double @strtod(i8* %x, i8** null, i32 10)
; CHECK-NEXT: call double @strtod(i8* nocapture %x, i8** null, i32 10)
ret void
}
define void @test_simplify3(i8* %x, i8** %endptr) {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
call float @strtof(i8* %x, i8** null, i32 10)
; CHECK-NEXT: call float @strtof(i8* nocapture %x, i8** null, i32 10)
ret void
}
define void @test_simplify4(i8* %x, i8** %endptr) {
-; CHECK: @test_simplify4
+; CHECK-LABEL: @test_simplify4(
call i64 @strtoul(i8* %x, i8** null, i32 10)
; CHECK-NEXT: call i64 @strtoul(i8* nocapture %x, i8** null, i32 10)
ret void
}
define void @test_simplify5(i8* %x, i8** %endptr) {
-; CHECK: @test_simplify5
+; CHECK-LABEL: @test_simplify5(
call i64 @strtoll(i8* %x, i8** null, i32 10)
; CHECK-NEXT: call i64 @strtoll(i8* nocapture %x, i8** null, i32 10)
ret void
}
define void @test_simplify6(i8* %x, i8** %endptr) {
-; CHECK: @test_simplify6
+; CHECK-LABEL: @test_simplify6(
call double @strtold(i8* %x, i8** null)
; CHECK-NEXT: call double @strtold(i8* nocapture %x, i8** null)
ret void
}
define void @test_simplify7(i8* %x, i8** %endptr) {
-; CHECK: @test_simplify7
+; CHECK-LABEL: @test_simplify7(
call i64 @strtoull(i8* %x, i8** null, i32 10)
; CHECK-NEXT: call i64 @strtoull(i8* nocapture %x, i8** null, i32 10)
ret void
}
define void @test_no_simplify1(i8* %x, i8** %endptr) {
-; CHECK: @test_no_simplify1
+; CHECK-LABEL: @test_no_simplify1(
call i64 @strtol(i8* %x, i8** %endptr, i32 10)
; CHECK-NEXT: call i64 @strtol(i8* %x, i8** %endptr, i32 10)
ret void
diff --git a/test/Transforms/InstCombine/struct-assign-tbaa.ll b/test/Transforms/InstCombine/struct-assign-tbaa.ll
index 33a771e6d8b6..c80e31ae3ddc 100644
--- a/test/Transforms/InstCombine/struct-assign-tbaa.ll
+++ b/test/Transforms/InstCombine/struct-assign-tbaa.ll
@@ -24,7 +24,7 @@ entry:
%struct.test2 = type { i32 (i8*, i32*, double*)** }
define i32 (i8*, i32*, double*)*** @test2() {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NOT: memcpy
; CHECK: ret
%tmp = alloca %struct.test2, align 8
@@ -35,10 +35,12 @@ define i32 (i8*, i32*, double*)*** @test2() {
ret i32 (i8*, i32*, double*)*** %tmp2
}
-; CHECK: !0 = metadata !{metadata !"float", metadata !1}
+; CHECK: !0 = metadata !{metadata !1, metadata !1, i64 0}
+; CHECK: !1 = metadata !{metadata !"float", metadata !2}
!0 = metadata !{metadata !"Simple C/C++ TBAA"}
!1 = metadata !{metadata !"omnipotent char", metadata !0}
-!2 = metadata !{metadata !"float", metadata !0}
+!2 = metadata !{metadata !5, metadata !5, i64 0}
!3 = metadata !{i64 0, i64 4, metadata !2}
!4 = metadata !{i64 0, i64 8, null}
+!5 = metadata !{metadata !"float", metadata !0}
diff --git a/test/Transforms/InstCombine/sub-xor.ll b/test/Transforms/InstCombine/sub-xor.ll
index 1d14852bc803..e7aff00ba8d0 100644
--- a/test/Transforms/InstCombine/sub-xor.ll
+++ b/test/Transforms/InstCombine/sub-xor.ll
@@ -5,7 +5,7 @@ define i32 @test1(i32 %x) nounwind {
%sub = sub i32 63, %and
ret i32 %sub
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: and i32 %x, 31
; CHECK-NEXT: xor i32 %and, 63
; CHECK-NEXT: ret
@@ -18,7 +18,7 @@ define i32 @test2(i32 %x) nounwind {
%sub = sub i32 31, %count
ret i32 %sub
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: ctlz
; CHECK-NEXT: xor i32 %count, 31
; CHECK-NEXT: ret
@@ -30,7 +30,7 @@ define i32 @test3(i32 %x) nounwind {
%add = add i32 %sub, 42
ret i32 %add
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: and i32 %x, 31
; CHECK-NEXT: sub i32 73, %and
; CHECK-NEXT: ret
@@ -41,7 +41,7 @@ define i32 @test4(i32 %x) nounwind {
%add = add i32 %sub, 42
ret i32 %add
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NEXT: add i32 %x, -2147483606
; CHECK-NEXT: ret
}
diff --git a/test/Transforms/InstCombine/sub.ll b/test/Transforms/InstCombine/sub.ll
index b71ec8c98f83..36c523bd7b75 100644
--- a/test/Transforms/InstCombine/sub.ll
+++ b/test/Transforms/InstCombine/sub.ll
@@ -1,156 +1,156 @@
-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 datalayout = "e-p:64:64:64-p1:16:16:16-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"
; Optimize subtracts.
;
; RUN: opt < %s -instcombine -S | FileCheck %s
define i32 @test1(i32 %A) {
- %B = sub i32 %A, %A
+ %B = sub i32 %A, %A
ret i32 %B
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret i32 0
}
define i32 @test2(i32 %A) {
- %B = sub i32 %A, 0
+ %B = sub i32 %A, 0
ret i32 %B
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: ret i32 %A
}
define i32 @test3(i32 %A) {
- %B = sub i32 0, %A
- %C = sub i32 0, %B
+ %B = sub i32 0, %A
+ %C = sub i32 0, %B
ret i32 %C
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: ret i32 %A
}
define i32 @test4(i32 %A, i32 %x) {
- %B = sub i32 0, %A
- %C = sub i32 %x, %B
+ %B = sub i32 0, %A
+ %C = sub i32 %x, %B
ret i32 %C
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: %C = add i32 %x, %A
; CHECK: ret i32 %C
}
define i32 @test5(i32 %A, i32 %B, i32 %C) {
- %D = sub i32 %B, %C
- %E = sub i32 %A, %D
+ %D = sub i32 %B, %C
+ %E = sub i32 %A, %D
ret i32 %E
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: %D1 = sub i32 %C, %B
; CHECK: %E = add
; CHECK: ret i32 %E
}
define i32 @test6(i32 %A, i32 %B) {
- %C = and i32 %A, %B
- %D = sub i32 %A, %C
+ %C = and i32 %A, %B
+ %D = sub i32 %A, %C
ret i32 %D
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NEXT: xor i32 %B, -1
-; CHECK-NEXT: %D = and i32
+; CHECK-NEXT: %D = and i32
; CHECK-NEXT: ret i32 %D
}
define i32 @test7(i32 %A) {
- %B = sub i32 -1, %A
+ %B = sub i32 -1, %A
ret i32 %B
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: %B = xor i32 %A, -1
; CHECK: ret i32 %B
}
define i32 @test8(i32 %A) {
- %B = mul i32 9, %A
- %C = sub i32 %B, %A
+ %B = mul i32 9, %A
+ %C = sub i32 %B, %A
ret i32 %C
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: %C = shl i32 %A, 3
; CHECK: ret i32 %C
}
define i32 @test9(i32 %A) {
- %B = mul i32 3, %A
- %C = sub i32 %A, %B
+ %B = mul i32 3, %A
+ %C = sub i32 %A, %B
ret i32 %C
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK: %C = mul i32 %A, -2
; CHECK: ret i32 %C
}
define i32 @test10(i32 %A, i32 %B) {
- %C = sub i32 0, %A
- %D = sub i32 0, %B
- %E = mul i32 %C, %D
+ %C = sub i32 0, %A
+ %D = sub i32 0, %B
+ %E = mul i32 %C, %D
ret i32 %E
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK: %E = mul i32 %A, %B
; CHECK: ret i32 %E
}
define i32 @test10a(i32 %A) {
- %C = sub i32 0, %A
- %E = mul i32 %C, 7
+ %C = sub i32 0, %A
+ %E = mul i32 %C, 7
ret i32 %E
-; CHECK: @test10a
+; CHECK-LABEL: @test10a(
; CHECK: %E = mul i32 %A, -7
; CHECK: ret i32 %E
}
define i1 @test11(i8 %A, i8 %B) {
- %C = sub i8 %A, %B
- %cD = icmp ne i8 %C, 0
+ %C = sub i8 %A, %B
+ %cD = icmp ne i8 %C, 0
ret i1 %cD
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK: %cD = icmp ne i8 %A, %B
; CHECK: ret i1 %cD
}
define i32 @test12(i32 %A) {
- %B = ashr i32 %A, 31
- %C = sub i32 0, %B
+ %B = ashr i32 %A, 31
+ %C = sub i32 0, %B
ret i32 %C
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK: %C = lshr i32 %A, 31
; CHECK: ret i32 %C
}
define i32 @test13(i32 %A) {
- %B = lshr i32 %A, 31
- %C = sub i32 0, %B
+ %B = lshr i32 %A, 31
+ %C = sub i32 0, %B
ret i32 %C
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; CHECK: %C = ashr i32 %A, 31
; CHECK: ret i32 %C
}
define i32 @test14(i32 %A) {
- %B = lshr i32 %A, 31
- %C = bitcast i32 %B to i32
- %D = sub i32 0, %C
+ %B = lshr i32 %A, 31
+ %C = bitcast i32 %B to i32
+ %D = sub i32 0, %C
ret i32 %D
-; CHECK: @test14
+; CHECK-LABEL: @test14(
; CHECK: %D = ashr i32 %A, 31
; CHECK: ret i32 %D
}
define i32 @test15(i32 %A, i32 %B) {
- %C = sub i32 0, %A
- %D = srem i32 %B, %C
+ %C = sub i32 0, %A
+ %D = srem i32 %B, %C
ret i32 %D
-; CHECK: @test15
-; CHECK: %D = srem i32 %B, %A
+; CHECK-LABEL: @test15(
+; CHECK: %D = srem i32 %B, %A
; CHECK: ret i32 %D
}
define i32 @test16(i32 %A) {
- %X = sdiv i32 %A, 1123
- %Y = sub i32 0, %X
+ %X = sdiv i32 %A, 1123
+ %Y = sub i32 0, %X
ret i32 %Y
-; CHECK: @test16
+; CHECK-LABEL: @test16(
; CHECK: %Y = sdiv i32 %A, -1123
; CHECK: ret i32 %Y
}
@@ -158,57 +158,57 @@ define i32 @test16(i32 %A) {
; Can't fold subtract here because negation it might oveflow.
; PR3142
define i32 @test17(i32 %A) {
- %B = sub i32 0, %A
- %C = sdiv i32 %B, 1234
+ %B = sub i32 0, %A
+ %C = sdiv i32 %B, 1234
ret i32 %C
-; CHECK: @test17
+; CHECK-LABEL: @test17(
; CHECK: %B = sub i32 0, %A
; CHECK: %C = sdiv i32 %B, 1234
; CHECK: ret i32 %C
}
define i64 @test18(i64 %Y) {
- %tmp.4 = shl i64 %Y, 2
- %tmp.12 = shl i64 %Y, 2
- %tmp.8 = sub i64 %tmp.4, %tmp.12
+ %tmp.4 = shl i64 %Y, 2
+ %tmp.12 = shl i64 %Y, 2
+ %tmp.8 = sub i64 %tmp.4, %tmp.12
ret i64 %tmp.8
-; CHECK: @test18
+; CHECK-LABEL: @test18(
; CHECK: ret i64 0
}
define i32 @test19(i32 %X, i32 %Y) {
- %Z = sub i32 %X, %Y
- %Q = add i32 %Z, %Y
+ %Z = sub i32 %X, %Y
+ %Q = add i32 %Z, %Y
ret i32 %Q
-; CHECK: @test19
+; CHECK-LABEL: @test19(
; CHECK: ret i32 %X
}
define i1 @test20(i32 %g, i32 %h) {
- %tmp.2 = sub i32 %g, %h
- %tmp.4 = icmp ne i32 %tmp.2, %g
+ %tmp.2 = sub i32 %g, %h
+ %tmp.4 = icmp ne i32 %tmp.2, %g
ret i1 %tmp.4
-; CHECK: @test20
+; CHECK-LABEL: @test20(
; CHECK: %tmp.4 = icmp ne i32 %h, 0
; CHECK: ret i1 %tmp.4
}
define i1 @test21(i32 %g, i32 %h) {
- %tmp.2 = sub i32 %g, %h
- %tmp.4 = icmp ne i32 %tmp.2, %g
+ %tmp.2 = sub i32 %g, %h
+ %tmp.4 = icmp ne i32 %tmp.2, %g
ret i1 %tmp.4
-; CHECK: @test21
+; CHECK-LABEL: @test21(
; CHECK: %tmp.4 = icmp ne i32 %h, 0
; CHECK: ret i1 %tmp.4
}
; PR2298
define zeroext i1 @test22(i32 %a, i32 %b) nounwind {
- %tmp2 = sub i32 0, %a
- %tmp4 = sub i32 0, %b
- %tmp5 = icmp eq i32 %tmp2, %tmp4
+ %tmp2 = sub i32 0, %a
+ %tmp4 = sub i32 0, %b
+ %tmp5 = icmp eq i32 %tmp2, %tmp4
ret i1 %tmp5
-; CHECK: @test22
+; CHECK-LABEL: @test22(
; CHECK: %tmp5 = icmp eq i32 %b, %a
; CHECK: ret i1 %tmp5
}
@@ -222,32 +222,67 @@ define i32 @test23(i8* %P, i64 %A){
%F = trunc i64 %E to i32
%G = sub i32 %D, %F
ret i32 %G
-; CHECK: @test23
+; CHECK-LABEL: @test23(
; CHECK-NEXT: = trunc i64 %A to i32
; CHECK-NEXT: ret i32
}
+define i8 @test23_as1(i8 addrspace(1)* %P, i16 %A) {
+; CHECK: @test23_as1
+; CHECK-NEXT: = trunc i16 %A to i8
+; CHECK-NEXT: ret i8
+ %B = getelementptr inbounds i8 addrspace(1)* %P, i16 %A
+ %C = ptrtoint i8 addrspace(1)* %B to i16
+ %D = trunc i16 %C to i8
+ %E = ptrtoint i8 addrspace(1)* %P to i16
+ %F = trunc i16 %E to i8
+ %G = sub i8 %D, %F
+ ret i8 %G
+}
+
define i64 @test24(i8* %P, i64 %A){
%B = getelementptr inbounds i8* %P, i64 %A
%C = ptrtoint i8* %B to i64
%E = ptrtoint i8* %P to i64
%G = sub i64 %C, %E
ret i64 %G
-; CHECK: @test24
+; CHECK-LABEL: @test24(
; CHECK-NEXT: ret i64 %A
}
+define i16 @test24_as1(i8 addrspace(1)* %P, i16 %A) {
+; CHECK: @test24_as1
+; CHECK-NEXT: ret i16 %A
+ %B = getelementptr inbounds i8 addrspace(1)* %P, i16 %A
+ %C = ptrtoint i8 addrspace(1)* %B to i16
+ %E = ptrtoint i8 addrspace(1)* %P to i16
+ %G = sub i16 %C, %E
+ ret i16 %G
+}
+
define i64 @test24a(i8* %P, i64 %A){
%B = getelementptr inbounds i8* %P, i64 %A
%C = ptrtoint i8* %B to i64
%E = ptrtoint i8* %P to i64
%G = sub i64 %E, %C
ret i64 %G
-; CHECK: @test24a
+; CHECK-LABEL: @test24a(
; CHECK-NEXT: sub i64 0, %A
-; CHECK-NEXT: ret i64
+; CHECK-NEXT: ret i64
}
+define i16 @test24a_as1(i8 addrspace(1)* %P, i16 %A) {
+; CHECK: @test24a_as1
+; CHECK-NEXT: sub i16 0, %A
+; CHECK-NEXT: ret i16
+ %B = getelementptr inbounds i8 addrspace(1)* %P, i16 %A
+ %C = ptrtoint i8 addrspace(1)* %B to i16
+ %E = ptrtoint i8 addrspace(1)* %P to i16
+ %G = sub i16 %E, %C
+ ret i16 %G
+}
+
+
@Arr = external global [42 x i16]
define i64 @test24b(i8* %P, i64 %A){
@@ -255,9 +290,9 @@ define i64 @test24b(i8* %P, i64 %A){
%C = ptrtoint i16* %B to i64
%G = sub i64 %C, ptrtoint ([42 x i16]* @Arr to i64)
ret i64 %G
-; CHECK: @test24b
+; CHECK-LABEL: @test24b(
; CHECK-NEXT: shl nuw i64 %A, 1
-; CHECK-NEXT: ret i64
+; CHECK-NEXT: ret i64
}
@@ -266,17 +301,31 @@ define i64 @test25(i8* %P, i64 %A){
%C = ptrtoint i16* %B to i64
%G = sub i64 %C, ptrtoint (i16* getelementptr ([42 x i16]* @Arr, i64 1, i64 0) to i64)
ret i64 %G
-; CHECK: @test25
+; CHECK-LABEL: @test25(
; CHECK-NEXT: shl nuw i64 %A, 1
; CHECK-NEXT: add i64 {{.*}}, -84
-; CHECK-NEXT: ret i64
+; CHECK-NEXT: ret i64
+}
+
+@Arr_as1 = external addrspace(1) global [42 x i16]
+
+define i16 @test25_as1(i8 addrspace(1)* %P, i64 %A) {
+; CHECK: @test25_as1
+; CHECK-NEXT: %1 = trunc i64 %A to i16
+; CHECK-NEXT: shl nuw i16 %1, 1
+; CHECK-NEXT: add i16 {{.*}}, -84
+; CHECK-NEXT: ret i16
+ %B = getelementptr inbounds [42 x i16] addrspace(1)* @Arr_as1, i64 0, i64 %A
+ %C = ptrtoint i16 addrspace(1)* %B to i16
+ %G = sub i16 %C, ptrtoint (i16 addrspace(1)* getelementptr ([42 x i16] addrspace(1)* @Arr_as1, i64 1, i64 0) to i16)
+ ret i16 %G
}
define i32 @test26(i32 %x) {
%shl = shl i32 3, %x
%neg = sub i32 0, %shl
ret i32 %neg
-; CHECK: @test26
+; CHECK-LABEL: @test26(
; CHECK-NEXT: shl i32 -3
; CHECK-NEXT: ret i32
}
@@ -285,7 +334,7 @@ define i32 @test27(i32 %x, i32 %y) {
%mul = mul i32 %y, -8
%sub = sub i32 %x, %mul
ret i32 %sub
-; CHECK: @test27
+; CHECK-LABEL: @test27(
; CHECK-NEXT: shl i32 %y, 3
; CHECK-NEXT: add i32
; CHECK-NEXT: ret i32
@@ -296,7 +345,7 @@ define i32 @test28(i32 %x, i32 %y, i32 %z) {
%mul = mul i32 %neg, %y
%sub = sub i32 %x, %mul
ret i32 %sub
-; CHECK: @test28
+; CHECK-LABEL: @test28(
; CHECK-NEXT: mul i32 %z, %y
; CHECK-NEXT: add i32
; CHECK-NEXT: ret i32
@@ -309,7 +358,7 @@ define i64 @test29(i8* %foo, i64 %i, i64 %j) {
%cast2 = ptrtoint i8* %gep2 to i64
%sub = sub i64 %cast1, %cast2
ret i64 %sub
-; CHECK: @test29
+; CHECK-LABEL: @test29(
; CHECK-NEXT: sub i64 %i, %j
; CHECK-NEXT: ret i64
}
@@ -322,8 +371,24 @@ define i64 @test30(i8* %foo, i64 %i, i64 %j) {
%cast2 = ptrtoint i8* %gep2 to i64
%sub = sub i64 %cast1, %cast2
ret i64 %sub
-; CHECK: @test30
+; CHECK-LABEL: @test30(
; CHECK-NEXT: %gep1.idx = shl nuw i64 %i, 2
; CHECK-NEXT: sub i64 %gep1.idx, %j
; CHECK-NEXT: ret i64
}
+
+define i16 @test30_as1(i8 addrspace(1)* %foo, i16 %i, i16 %j) {
+; CHECK-LABEL: @test30_as1(
+; CHECK-NEXT: %gep1.idx = shl nuw i16 %i, 2
+; CHECK-NEXT: sub i16 %gep1.idx, %j
+; CHECK-NEXT: ret i16
+ %bit = bitcast i8 addrspace(1)* %foo to i32 addrspace(1)*
+ %gep1 = getelementptr inbounds i32 addrspace(1)* %bit, i16 %i
+ %gep2 = getelementptr inbounds i8 addrspace(1)* %foo, i16 %j
+ %cast1 = ptrtoint i32 addrspace(1)* %gep1 to i16
+ %cast2 = ptrtoint i8 addrspace(1)* %gep2 to i16
+ %sub = sub i16 %cast1, %cast2
+ ret i16 %sub
+}
+
+
diff --git a/test/Transforms/InstCombine/toascii-1.ll b/test/Transforms/InstCombine/toascii-1.ll
index c4a13e229393..f5e18983e122 100644
--- a/test/Transforms/InstCombine/toascii-1.ll
+++ b/test/Transforms/InstCombine/toascii-1.ll
@@ -9,49 +9,49 @@ declare i32 @toascii(i32)
; Check isascii(c) -> c & 0x7f.
define i32 @test_simplify1() {
-; CHECK: @test_simplify1
+; CHECK-LABEL: @test_simplify1(
%ret = call i32 @toascii(i32 0)
ret i32 %ret
; CHECK-NEXT: ret i32 0
}
define i32 @test_simplify2() {
-; CHECK: @test_simplify2
+; CHECK-LABEL: @test_simplify2(
%ret = call i32 @toascii(i32 1)
ret i32 %ret
; CHECK-NEXT: ret i32 1
}
define i32 @test_simplify3() {
-; CHECK: @test_simplify3
+; CHECK-LABEL: @test_simplify3(
%ret = call i32 @toascii(i32 127)
ret i32 %ret
; CHECK-NEXT: ret i32 127
}
define i32 @test_simplify4() {
-; CHECK: @test_simplify4
+; CHECK-LABEL: @test_simplify4(
%ret = call i32 @toascii(i32 128)
ret i32 %ret
; CHECK-NEXT: ret i32 0
}
define i32 @test_simplify5() {
-; CHECK: @test_simplify5
+; CHECK-LABEL: @test_simplify5(
%ret = call i32 @toascii(i32 255)
ret i32 %ret
; CHECK-NEXT: ret i32 127
}
define i32 @test_simplify6() {
-; CHECK: @test_simplify6
+; CHECK-LABEL: @test_simplify6(
%ret = call i32 @toascii(i32 256)
ret i32 %ret
; CHECK-NEXT: ret i32 0
}
define i32 @test_simplify7(i32 %x) {
-; CHECK: @test_simplify7
+; CHECK-LABEL: @test_simplify7(
%ret = call i32 @toascii(i32 %x)
; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i32 %x, 127
ret i32 %ret
diff --git a/test/Transforms/InstCombine/trunc.ll b/test/Transforms/InstCombine/trunc.ll
index cbbad7f79777..ee81cf8c3c5d 100644
--- a/test/Transforms/InstCombine/trunc.ll
+++ b/test/Transforms/InstCombine/trunc.ll
@@ -11,7 +11,7 @@ define i64 @test1(i64 %a) {
%d = zext i32 %c to i64
call void @use(i32 %b)
ret i64 %d
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NOT: ext
; CHECK: ret
}
@@ -22,7 +22,7 @@ define i64 @test2(i64 %a) {
%d = sext i32 %q to i64
call void @use(i32 %b)
ret i64 %d
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: shl i64 %a, 36
; CHECK: %d = ashr exact i64 {{.*}}, 36
; CHECK: ret i64 %d
@@ -33,7 +33,7 @@ define i64 @test3(i64 %a) {
%d = zext i32 %c to i64
call void @use(i32 %b)
ret i64 %d
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NOT: ext
; CHECK: ret
}
@@ -44,7 +44,7 @@ define i64 @test4(i64 %a) {
%d = zext i32 %x to i64
call void @use(i32 %b)
ret i64 %d
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: = and i64 %a, 8
; CHECK: = xor i64 {{.*}}, 8
; CHECK-NOT: ext
@@ -56,7 +56,7 @@ define i32 @test5(i32 %A) {
%C = lshr i128 %B, 16
%D = trunc i128 %C to i32
ret i32 %D
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: %C = lshr i32 %A, 16
; CHECK: ret i32 %C
}
@@ -66,7 +66,7 @@ define i32 @test6(i64 %A) {
%C = lshr i128 %B, 32
%D = trunc i128 %C to i32
ret i32 %D
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: %C = lshr i64 %A, 32
; CHECK: %D = trunc i64 %C to i32
; CHECK: ret i32 %D
@@ -77,7 +77,7 @@ define i92 @test7(i64 %A) {
%C = lshr i128 %B, 32
%D = trunc i128 %C to i92
ret i92 %D
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: %B = zext i64 %A to i92
; CHECK: %C = lshr i92 %B, 32
; CHECK: ret i92 %C
@@ -90,7 +90,7 @@ define i64 @test8(i32 %A, i32 %B) {
%ins35 = or i128 %tmp33, %tmp38
%tmp42 = trunc i128 %ins35 to i64
ret i64 %tmp42
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: %tmp38 = zext i32 %A to i64
; CHECK: %tmp32 = zext i32 %B to i64
; CHECK: %tmp33 = shl nuw i64 %tmp32, 32
@@ -102,7 +102,7 @@ define i8 @test9(i32 %X) {
%Y = and i32 %X, 42
%Z = trunc i32 %Y to i8
ret i8 %Z
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK: trunc
; CHECK: and
; CHECK: ret
@@ -113,7 +113,7 @@ define i8 @test10(i32 %X) {
%Y = trunc i32 %X to i8
%Z = and i8 %Y, 42
ret i8 %Z
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK: trunc
; CHECK: and
; CHECK: ret
diff --git a/test/Transforms/InstCombine/udivrem-change-width.ll b/test/Transforms/InstCombine/udivrem-change-width.ll
index b388a3b0634e..478e9ca387fc 100644
--- a/test/Transforms/InstCombine/udivrem-change-width.ll
+++ b/test/Transforms/InstCombine/udivrem-change-width.ll
@@ -9,7 +9,7 @@ define i8 @udiv_i8(i8 %a, i8 %b) nounwind {
%div = udiv i32 %conv, %conv2
%conv3 = trunc i32 %div to i8
ret i8 %conv3
-; CHECK: @udiv_i8
+; CHECK-LABEL: @udiv_i8(
; CHECK: udiv i8 %a, %b
}
@@ -19,7 +19,7 @@ define i8 @urem_i8(i8 %a, i8 %b) nounwind {
%div = urem i32 %conv, %conv2
%conv3 = trunc i32 %div to i8
ret i8 %conv3
-; CHECK: @urem_i8
+; CHECK-LABEL: @urem_i8(
; CHECK: urem i8 %a, %b
}
@@ -28,7 +28,7 @@ define i32 @udiv_i32(i8 %a, i8 %b) nounwind {
%conv2 = zext i8 %b to i32
%div = udiv i32 %conv, %conv2
ret i32 %div
-; CHECK: @udiv_i32
+; CHECK-LABEL: @udiv_i32(
; CHECK: udiv i8 %a, %b
; CHECK: zext
}
@@ -38,7 +38,7 @@ define i32 @urem_i32(i8 %a, i8 %b) nounwind {
%conv2 = zext i8 %b to i32
%div = urem i32 %conv, %conv2
ret i32 %div
-; CHECK: @urem_i32
+; CHECK-LABEL: @urem_i32(
; CHECK: urem i8 %a, %b
; CHECK: zext
}
@@ -47,7 +47,7 @@ define i32 @udiv_i32_c(i8 %a) nounwind {
%conv = zext i8 %a to i32
%div = udiv i32 %conv, 10
ret i32 %div
-; CHECK: @udiv_i32_c
+; CHECK-LABEL: @udiv_i32_c(
; CHECK: udiv i8 %a, 10
; CHECK: zext
}
@@ -56,7 +56,7 @@ define i32 @urem_i32_c(i8 %a) nounwind {
%conv = zext i8 %a to i32
%div = urem i32 %conv, 10
ret i32 %div
-; CHECK: @urem_i32_c
+; CHECK-LABEL: @urem_i32_c(
; CHECK: urem i8 %a, 10
; CHECK: zext
}
diff --git a/test/Transforms/InstCombine/vec_demanded_elts.ll b/test/Transforms/InstCombine/vec_demanded_elts.ll
index 0019a57627cb..d12412a92977 100644
--- a/test/Transforms/InstCombine/vec_demanded_elts.ll
+++ b/test/Transforms/InstCombine/vec_demanded_elts.ll
@@ -2,7 +2,7 @@
define i16 @test1(float %f) {
entry:
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: fmul float
; CHECK-NOT: insertelement {{.*}} 0.00
; CHECK-NOT: call {{.*}} @llvm.x86.sse.mul
@@ -22,7 +22,7 @@ entry:
}
define i32 @test2(float %f) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NOT: insertelement
; CHECK-NOT: extractelement
; CHECK: ret
@@ -37,7 +37,7 @@ define i32 @test2(float %f) {
}
define i64 @test3(float %f, double %d) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NOT: insertelement {{.*}} 0.00
; CHECK: ret
entry:
@@ -85,7 +85,7 @@ entry:
}
define void @get_image() nounwind {
-; CHECK: @get_image
+; CHECK-LABEL: @get_image(
; CHECK-NOT: extractelement
; CHECK: unreachable
entry:
@@ -105,7 +105,7 @@ bb3: ; preds = %bb2, %entry
; PR4340
define void @vac(<4 x float>* nocapture %a) nounwind {
-; CHECK: @vac
+; CHECK-LABEL: @vac(
; CHECK-NOT: load
; CHECK: ret
entry:
@@ -155,7 +155,7 @@ declare <4 x i32> @llvm.x86.sse41.pmovzxwd(<8 x i16>) nounwind readnone
define <4 x float> @dead_shuffle_elt(<4 x float> %x, <2 x float> %y) nounwind {
entry:
-; CHECK: define <4 x float> @dead_shuffle_elt
+; CHECK-LABEL: define <4 x float> @dead_shuffle_elt(
; CHECK: shufflevector <2 x float> %y, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%shuffle.i = shufflevector <2 x float> %y, <2 x float> %y, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
%shuffle9.i = shufflevector <4 x float> %x, <4 x float> %shuffle.i, <4 x i32> <i32 4, i32 5, i32 2, i32 3>
@@ -163,7 +163,7 @@ entry:
}
define <2 x float> @test_fptrunc(double %f) {
-; CHECK: @test_fptrunc
+; CHECK-LABEL: @test_fptrunc(
; CHECK: insertelement
; CHECK: insertelement
; CHECK-NOT: insertelement
@@ -177,7 +177,7 @@ define <2 x float> @test_fptrunc(double %f) {
}
define <2 x double> @test_fpext(float %f) {
-; CHECK: @test_fpext
+; CHECK-LABEL: @test_fpext(
; CHECK: insertelement
; CHECK: insertelement
; CHECK-NOT: insertelement
@@ -191,7 +191,7 @@ define <2 x double> @test_fpext(float %f) {
}
define <4 x float> @test_select(float %f, float %g) {
-; CHECK: @test_select
+; CHECK-LABEL: @test_select(
; CHECK: %a0 = insertelement <4 x float> undef, float %f, i32 0
; CHECK-NOT: insertelement
; CHECK: %a3 = insertelement <4 x float> %a0, float 3.000000e+00, i32 3
diff --git a/test/Transforms/InstCombine/vec_extract_elt.ll b/test/Transforms/InstCombine/vec_extract_elt.ll
index 166066a201bf..3daf72ede509 100644
--- a/test/Transforms/InstCombine/vec_extract_elt.ll
+++ b/test/Transforms/InstCombine/vec_extract_elt.ll
@@ -1,4 +1,5 @@
-; RUN: opt < %s -instcombine -S | not grep extractelement
+; RUN: opt < %s -instcombine -S | FileCheck %s
+; CHECK-NOT: extractelement
define i32 @test(float %f) {
%tmp7 = insertelement <4 x float> undef, float %f, i32 0 ; <<4 x float>> [#uses=1]
diff --git a/test/Transforms/InstCombine/vec_insertelt.ll b/test/Transforms/InstCombine/vec_insertelt.ll
index e35fa5e551fb..3b949209c4d7 100644
--- a/test/Transforms/InstCombine/vec_insertelt.ll
+++ b/test/Transforms/InstCombine/vec_insertelt.ll
@@ -1,4 +1,5 @@
-; RUN: opt < %s -instcombine -S | grep "ret <4 x i32> %A"
+; RUN: opt < %s -instcombine -S | FileCheck %s
+; CHECK: ret <4 x i32> %A
; PR1286
define <4 x i32> @test1(<4 x i32> %A) {
diff --git a/test/Transforms/InstCombine/vec_phi_extract.ll b/test/Transforms/InstCombine/vec_phi_extract.ll
index 2f10fc2c1ed2..73ec1f1bb04f 100644
--- a/test/Transforms/InstCombine/vec_phi_extract.ll
+++ b/test/Transforms/InstCombine/vec_phi_extract.ll
@@ -25,3 +25,28 @@ ret:
ret void
}
+define i1 @g(<3 x i32> %input_2) {
+; CHECK: extractelement
+entry:
+ br label %for.cond
+
+for.cond:
+; CHECK: phi i32
+ %input_2.addr.0 = phi <3 x i32> [ %input_2, %entry ], [ %div45, %for.body ]
+ %input_1.addr.1 = phi <3 x i32> [ undef, %entry ], [ %dec43, %for.body ]
+ br i1 undef, label %for.end, label %for.body
+
+; CHECK extractelement
+for.body:
+ %dec43 = add <3 x i32> %input_1.addr.1, <i32 -1, i32 -1, i32 -1>
+ %sub44 = sub <3 x i32> zeroinitializer, %dec43
+ %div45 = sdiv <3 x i32> %input_2.addr.0, %sub44
+ br label %for.cond
+
+for.end:
+ %0 = extractelement <3 x i32> %input_2.addr.0, i32 0
+ %.89 = select i1 false, i32 0, i32 %0
+ %tobool313 = icmp eq i32 %.89, 0
+ ret i1 %tobool313
+}
+
diff --git a/test/Transforms/InstCombine/vec_shuffle.ll b/test/Transforms/InstCombine/vec_shuffle.ll
index 8f78c2e6bd50..3ee43dc63a6f 100644
--- a/test/Transforms/InstCombine/vec_shuffle.ll
+++ b/test/Transforms/InstCombine/vec_shuffle.ll
@@ -1,21 +1,21 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
define <4 x float> @test1(<4 x float> %v1) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret <4 x float> %v1
%v2 = shufflevector <4 x float> %v1, <4 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
ret <4 x float> %v2
}
define <4 x float> @test2(<4 x float> %v1) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: ret <4 x float> %v1
%v2 = shufflevector <4 x float> %v1, <4 x float> %v1, <4 x i32> <i32 0, i32 5, i32 2, i32 7>
ret <4 x float> %v2
}
define float @test3(<4 x float> %A, <4 x float> %B, float %f) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: ret float %f
%C = insertelement <4 x float> %A, float %f, i32 0
%D = shufflevector <4 x float> %C, <4 x float> %B, <4 x i32> <i32 5, i32 0, i32 2, i32 7>
@@ -24,7 +24,7 @@ define float @test3(<4 x float> %A, <4 x float> %B, float %f) {
}
define i32 @test4(<4 x i32> %X) {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NEXT: extractelement
; CHECK-NEXT: ret
%tmp152.i53899.i = shufflevector <4 x i32> %X, <4 x i32> undef, <4 x i32> zeroinitializer
@@ -33,7 +33,7 @@ define i32 @test4(<4 x i32> %X) {
}
define i32 @test5(<4 x i32> %X) {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NEXT: extractelement
; CHECK-NEXT: ret
%tmp152.i53899.i = shufflevector <4 x i32> %X, <4 x i32> undef, <4 x i32> <i32 3, i32 2, i32 undef, i32 undef>
@@ -42,7 +42,7 @@ define i32 @test5(<4 x i32> %X) {
}
define float @test6(<4 x float> %X) {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NEXT: extractelement
; CHECK-NEXT: ret
%X1 = bitcast <4 x float> %X to <4 x i32>
@@ -53,7 +53,7 @@ define float @test6(<4 x float> %X) {
}
define <4 x float> @test7(<4 x float> %tmp45.i) {
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NEXT: ret <4 x float> %tmp45.i
%tmp1642.i = shufflevector <4 x float> %tmp45.i, <4 x float> undef, <4 x i32> < i32 0, i32 1, i32 6, i32 7 >
ret <4 x float> %tmp1642.i
@@ -61,7 +61,7 @@ define <4 x float> @test7(<4 x float> %tmp45.i) {
; This should turn into a single shuffle.
define <4 x float> @test8(<4 x float> %tmp, <4 x float> %tmp1) {
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK-NEXT: shufflevector
; CHECK-NEXT: ret
%tmp4 = extractelement <4 x float> %tmp, i32 1
@@ -77,7 +77,7 @@ define <4 x float> @test8(<4 x float> %tmp, <4 x float> %tmp1) {
; Test fold of two shuffles where the first shuffle vectors inputs are a
; different length then the second.
define <4 x i8> @test9(<16 x i8> %tmp6) nounwind {
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK-NEXT: shufflevector
; CHECK-NEXT: ret
%tmp7 = shufflevector <16 x i8> %tmp6, <16 x i8> undef, <4 x i32> < i32 13, i32 9, i32 4, i32 13 > ; <<4 x i8>> [#uses=1]
@@ -89,7 +89,7 @@ define <4 x i8> @test9(<16 x i8> %tmp6) nounwind {
; mask values of 2*N, where N is the mask length. These shuffles should not
; be folded (because [8,9,4,8] may not be a mask supported by the target).
define <4 x i8> @test9a(<16 x i8> %tmp6) nounwind {
-; CHECK: @test9a
+; CHECK-LABEL: @test9a(
; CHECK-NEXT: shufflevector
; CHECK-NEXT: shufflevector
; CHECK-NEXT: ret
@@ -101,7 +101,7 @@ define <4 x i8> @test9a(<16 x i8> %tmp6) nounwind {
; Test fold of two shuffles where the first shuffle vectors inputs are a
; different length then the second.
define <4 x i8> @test9b(<4 x i8> %tmp6, <4 x i8> %tmp7) nounwind {
-; CHECK: @test9
+; CHECK-LABEL: @test9b(
; CHECK-NEXT: shufflevector
; CHECK-NEXT: ret
%tmp1 = shufflevector <4 x i8> %tmp6, <4 x i8> %tmp7, <8 x i32> <i32 0, i32 1, i32 4, i32 5, i32 4, i32 5, i32 2, i32 3> ; <<4 x i8>> [#uses=1]
@@ -111,7 +111,7 @@ define <4 x i8> @test9b(<4 x i8> %tmp6, <4 x i8> %tmp7) nounwind {
; Redundant vector splats should be removed. Radar 8597790.
define <4 x i32> @test10(<4 x i32> %tmp5) nounwind {
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK-NEXT: shufflevector
; CHECK-NEXT: ret
%tmp6 = shufflevector <4 x i32> %tmp5, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
@@ -122,7 +122,7 @@ define <4 x i32> @test10(<4 x i32> %tmp5) nounwind {
; Test fold of two shuffles where the two shufflevector inputs's op1 are
; the same
define <8 x i8> @test11(<16 x i8> %tmp6) nounwind {
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK-NEXT: shufflevector <16 x i8> %tmp6, <16 x i8> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
; CHECK-NEXT: ret
%tmp1 = shufflevector <16 x i8> %tmp6, <16 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3> ; <<4 x i8>> [#uses=1]
@@ -134,7 +134,7 @@ define <8 x i8> @test11(<16 x i8> %tmp6) nounwind {
; Test fold of two shuffles where the first shufflevector's inputs are
; the same as the second
define <8 x i8> @test12(<8 x i8> %tmp6, <8 x i8> %tmp2) nounwind {
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK-NEXT: shufflevector <8 x i8> %tmp6, <8 x i8> %tmp2, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 9, i32 8, i32 11, i32 12>
; CHECK-NEXT: ret
%tmp1 = shufflevector <8 x i8> %tmp6, <8 x i8> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 5, i32 4, i32 undef, i32 7> ; <<8 x i8>> [#uses=1]
@@ -145,7 +145,7 @@ define <8 x i8> @test12(<8 x i8> %tmp6, <8 x i8> %tmp2) nounwind {
; Test fold of two shuffles where the first shufflevector's inputs are
; the same as the second
define <8 x i8> @test12a(<8 x i8> %tmp6, <8 x i8> %tmp2) nounwind {
-; CHECK: @test12a
+; CHECK-LABEL: @test12a(
; CHECK-NEXT: shufflevector <8 x i8> %tmp2, <8 x i8> %tmp6, <8 x i32> <i32 0, i32 3, i32 1, i32 4, i32 8, i32 9, i32 10, i32 11>
; CHECK-NEXT: ret
%tmp1 = shufflevector <8 x i8> %tmp6, <8 x i8> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 5, i32 4, i32 undef, i32 7> ; <<8 x i8>> [#uses=1]
@@ -153,3 +153,78 @@ define <8 x i8> @test12a(<8 x i8> %tmp6, <8 x i8> %tmp2) nounwind {
ret <8 x i8> %tmp3
}
+define <2 x i8> @test13a(i8 %x1, i8 %x2) {
+; CHECK-LABEL: @test13a(
+; CHECK-NEXT: insertelement {{.*}} undef, i8 %x1, i32 1
+; CHECK-NEXT: insertelement {{.*}} i8 %x2, i32 0
+; CHECK-NEXT: add {{.*}} <i8 7, i8 5>
+; CHECK-NEXT: ret
+ %A = insertelement <2 x i8> undef, i8 %x1, i32 0
+ %B = insertelement <2 x i8> %A, i8 %x2, i32 1
+ %C = add <2 x i8> %B, <i8 5, i8 7>
+ %D = shufflevector <2 x i8> %C, <2 x i8> undef, <2 x i32> <i32 1, i32 0>
+ ret <2 x i8> %D
+}
+
+define <2 x i8> @test13b(i8 %x) {
+; CHECK-LABEL: @test13b(
+; CHECK-NEXT: insertelement <2 x i8> undef, i8 %x, i32 1
+; CHECK-NEXT: ret
+ %A = insertelement <2 x i8> undef, i8 %x, i32 0
+ %B = shufflevector <2 x i8> %A, <2 x i8> undef, <2 x i32> <i32 undef, i32 0>
+ ret <2 x i8> %B
+}
+
+define <2 x i8> @test13c(i8 %x1, i8 %x2) {
+; CHECK-LABEL: @test13c(
+; CHECK-NEXT: insertelement <2 x i8> {{.*}}, i32 0
+; CHECK-NEXT: insertelement <2 x i8> {{.*}}, i32 1
+; CHECK-NEXT: ret
+ %A = insertelement <4 x i8> undef, i8 %x1, i32 0
+ %B = insertelement <4 x i8> %A, i8 %x2, i32 2
+ %C = shufflevector <4 x i8> %B, <4 x i8> undef, <2 x i32> <i32 0, i32 2>
+ ret <2 x i8> %C
+}
+
+define void @test14(i16 %conv10) {
+ %tmp = alloca <4 x i16>, align 8
+ %vecinit6 = insertelement <4 x i16> undef, i16 23, i32 3
+ store <4 x i16> %vecinit6, <4 x i16>* undef
+ %tmp1 = load <4 x i16>* undef
+ %vecinit11 = insertelement <4 x i16> undef, i16 %conv10, i32 3
+ %div = udiv <4 x i16> %tmp1, %vecinit11
+ store <4 x i16> %div, <4 x i16>* %tmp
+ %tmp4 = load <4 x i16>* %tmp
+ %tmp5 = shufflevector <4 x i16> %tmp4, <4 x i16> undef, <2 x i32> <i32 2, i32 0>
+ %cmp = icmp ule <2 x i16> %tmp5, undef
+ %sext = sext <2 x i1> %cmp to <2 x i16>
+ ret void
+}
+
+; Check that sequences of insert/extract element are
+; collapsed into valid shuffle instruction with correct shuffle indexes.
+
+define <4 x float> @test15a(<4 x float> %LHS, <4 x float> %RHS) {
+; CHECK-LABEL: @test15a
+; CHECK-NEXT: shufflevector <4 x float> %LHS, <4 x float> %RHS, <4 x i32> <i32 4, i32 0, i32 6, i32 6>
+; CHECK-NEXT: ret <4 x float> %tmp4
+ %tmp1 = extractelement <4 x float> %LHS, i32 0
+ %tmp2 = insertelement <4 x float> %RHS, float %tmp1, i32 1
+ %tmp3 = extractelement <4 x float> %RHS, i32 2
+ %tmp4 = insertelement <4 x float> %tmp2, float %tmp3, i32 3
+ ret <4 x float> %tmp4
+}
+
+define <4 x float> @test15b(<4 x float> %LHS, <4 x float> %RHS) {
+; CHECK-LABEL: @test15b
+; CHECK-NEXT: shufflevector <4 x float> %LHS, <4 x float> %RHS, <4 x i32> <i32 4, i32 3, i32 6, i32 6>
+; CHECK-NEXT: ret <4 x float> %tmp5
+ %tmp0 = extractelement <4 x float> %LHS, i32 3
+ %tmp1 = insertelement <4 x float> %RHS, float %tmp0, i32 0
+ %tmp2 = extractelement <4 x float> %tmp1, i32 0
+ %tmp3 = insertelement <4 x float> %RHS, float %tmp2, i32 1
+ %tmp4 = extractelement <4 x float> %RHS, i32 2
+ %tmp5 = insertelement <4 x float> %tmp3, float %tmp4, i32 3
+ ret <4 x float> %tmp5
+}
+
diff --git a/test/Transforms/InstCombine/vector-casts.ll b/test/Transforms/InstCombine/vector-casts.ll
index 2f2990b7b055..ca97b3407da6 100644
--- a/test/Transforms/InstCombine/vector-casts.ll
+++ b/test/Transforms/InstCombine/vector-casts.ll
@@ -5,7 +5,7 @@ define <2 x i1> @test1(<2 x i64> %a) {
%t = trunc <2 x i64> %a to <2 x i1>
ret <2 x i1> %t
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: and <2 x i64> %a, <i64 1, i64 1>
; CHECK: icmp ne <2 x i64> %1, zeroinitializer
}
@@ -16,7 +16,7 @@ define <2 x i64> @test2(<2 x i64> %a) {
%t = ashr <2 x i64> %b, <i64 1, i64 1>
ret <2 x i64> %t
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: and <2 x i64> %a, <i64 65535, i64 65535>
; CHECK: lshr <2 x i64> %b, <i64 1, i64 1>
}
@@ -33,7 +33,7 @@ entry:
%conv = bitcast <4 x i32> %and to <2 x i64>
ret <2 x i64> %conv
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: fcmp ord <4 x float> %a, %b
}
@@ -46,7 +46,7 @@ entry:
%or = or <4 x i32> %sext, %sext5
%conv = bitcast <4 x i32> %or to <2 x i64>
ret <2 x i64> %conv
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: fcmp uno <4 x float> %a, %b
}
@@ -62,7 +62,7 @@ entry:
%conv = bitcast <4 x i32> %and to <2 x i64>
ret <2 x i64> %conv
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: sext <4 x i1> %cmp to <4 x i32>
; The sext-and pair is canonicalized to a select.
; CHECK: select <4 x i1> %cmp4, <4 x i32> %sext, <4 x i32> zeroinitializer
@@ -126,7 +126,7 @@ define <2 x double> @fc(<2 x double> %t) {
; PR9228
; This was a crasher, so no CHECK statements.
define <4 x float> @f(i32 %a) nounwind alwaysinline {
-; CHECK: @f
+; CHECK-LABEL: @f(
entry:
%dim = insertelement <4 x i32> undef, i32 %a, i32 0
%dim30 = insertelement <4 x i32> %dim, i32 %a, i32 1
diff --git a/test/Transforms/InstCombine/vector-mul.ll b/test/Transforms/InstCombine/vector-mul.ll
new file mode 100644
index 000000000000..284d407ce33f
--- /dev/null
+++ b/test/Transforms/InstCombine/vector-mul.ll
@@ -0,0 +1,408 @@
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+; Check that instcombine rewrites multiply by a vector
+; of known constant power-of-2 elements with vector shift.
+
+define <4 x i8> @Zero_i8(<4 x i8> %InVec) {
+entry:
+ %mul = mul <4 x i8> %InVec, <i8 0, i8 0, i8 0, i8 0>
+ ret <4 x i8> %mul
+}
+
+; CHECK-LABEL: @Zero_i8(
+; CHECK: ret <4 x i8> zeroinitializer
+
+define <4 x i8> @Identity_i8(<4 x i8> %InVec) {
+entry:
+ %mul = mul <4 x i8> %InVec, <i8 1, i8 1, i8 1, i8 1>
+ ret <4 x i8> %mul
+}
+
+; CHECK-LABEL: @Identity_i8(
+; CHECK: ret <4 x i8> %InVec
+
+define <4 x i8> @AddToSelf_i8(<4 x i8> %InVec) {
+entry:
+ %mul = mul <4 x i8> %InVec, <i8 2, i8 2, i8 2, i8 2>
+ ret <4 x i8> %mul
+}
+
+; CHECK-LABEL: @AddToSelf_i8(
+; CHECK: shl <4 x i8> %InVec, <i8 1, i8 1, i8 1, i8 1>
+; CHECK: ret
+
+define <4 x i8> @SplatPow2Test1_i8(<4 x i8> %InVec) {
+entry:
+ %mul = mul <4 x i8> %InVec, <i8 4, i8 4, i8 4, i8 4>
+ ret <4 x i8> %mul
+}
+
+; CHECK-LABEL: @SplatPow2Test1_i8(
+; CHECK: shl <4 x i8> %InVec, <i8 2, i8 2, i8 2, i8 2>
+; CHECK: ret
+
+define <4 x i8> @SplatPow2Test2_i8(<4 x i8> %InVec) {
+entry:
+ %mul = mul <4 x i8> %InVec, <i8 8, i8 8, i8 8, i8 8>
+ ret <4 x i8> %mul
+}
+
+; CHECK-LABEL: @SplatPow2Test2_i8(
+; CHECK: shl <4 x i8> %InVec, <i8 3, i8 3, i8 3, i8 3>
+; CHECK: ret
+
+define <4 x i8> @MulTest1_i8(<4 x i8> %InVec) {
+entry:
+ %mul = mul <4 x i8> %InVec, <i8 1, i8 2, i8 4, i8 8>
+ ret <4 x i8> %mul
+}
+
+; CHECK-LABEL: @MulTest1_i8(
+; CHECK: shl <4 x i8> %InVec, <i8 0, i8 1, i8 2, i8 3>
+; CHECK: ret
+
+define <4 x i8> @MulTest2_i8(<4 x i8> %InVec) {
+entry:
+ %mul = mul <4 x i8> %InVec, <i8 3, i8 3, i8 3, i8 3>
+ ret <4 x i8> %mul
+}
+
+; CHECK-LABEL: @MulTest2_i8(
+; CHECK: mul <4 x i8> %InVec, <i8 3, i8 3, i8 3, i8 3>
+; CHECK: ret
+
+define <4 x i8> @MulTest3_i8(<4 x i8> %InVec) {
+entry:
+ %mul = mul <4 x i8> %InVec, <i8 4, i8 4, i8 2, i8 2>
+ ret <4 x i8> %mul
+}
+
+; CHECK-LABEL: @MulTest3_i8(
+; CHECK: shl <4 x i8> %InVec, <i8 2, i8 2, i8 1, i8 1>
+; CHECK: ret
+
+
+define <4 x i8> @MulTest4_i8(<4 x i8> %InVec) {
+entry:
+ %mul = mul <4 x i8> %InVec, <i8 4, i8 4, i8 0, i8 1>
+ ret <4 x i8> %mul
+}
+
+; CHECK-LABEL: @MulTest4_i8(
+; CHECK: mul <4 x i8> %InVec, <i8 4, i8 4, i8 0, i8 1>
+; CHECK: ret
+
+define <4 x i16> @Zero_i16(<4 x i16> %InVec) {
+entry:
+ %mul = mul <4 x i16> %InVec, <i16 0, i16 0, i16 0, i16 0>
+ ret <4 x i16> %mul
+}
+
+; CHECK-LABEL: @Zero_i16(
+; CHECK: ret <4 x i16> zeroinitializer
+
+define <4 x i16> @Identity_i16(<4 x i16> %InVec) {
+entry:
+ %mul = mul <4 x i16> %InVec, <i16 1, i16 1, i16 1, i16 1>
+ ret <4 x i16> %mul
+}
+
+; CHECK-LABEL: @Identity_i16(
+; CHECK: ret <4 x i16> %InVec
+
+define <4 x i16> @AddToSelf_i16(<4 x i16> %InVec) {
+entry:
+ %mul = mul <4 x i16> %InVec, <i16 2, i16 2, i16 2, i16 2>
+ ret <4 x i16> %mul
+}
+
+; CHECK-LABEL: @AddToSelf_i16(
+; CHECK: shl <4 x i16> %InVec, <i16 1, i16 1, i16 1, i16 1>
+; CHECK: ret
+
+define <4 x i16> @SplatPow2Test1_i16(<4 x i16> %InVec) {
+entry:
+ %mul = mul <4 x i16> %InVec, <i16 4, i16 4, i16 4, i16 4>
+ ret <4 x i16> %mul
+}
+
+; CHECK-LABEL: @SplatPow2Test1_i16(
+; CHECK: shl <4 x i16> %InVec, <i16 2, i16 2, i16 2, i16 2>
+; CHECK: ret
+
+define <4 x i16> @SplatPow2Test2_i16(<4 x i16> %InVec) {
+entry:
+ %mul = mul <4 x i16> %InVec, <i16 8, i16 8, i16 8, i16 8>
+ ret <4 x i16> %mul
+}
+
+; CHECK-LABEL: @SplatPow2Test2_i16(
+; CHECK: shl <4 x i16> %InVec, <i16 3, i16 3, i16 3, i16 3>
+; CHECK: ret
+
+define <4 x i16> @MulTest1_i16(<4 x i16> %InVec) {
+entry:
+ %mul = mul <4 x i16> %InVec, <i16 1, i16 2, i16 4, i16 8>
+ ret <4 x i16> %mul
+}
+
+; CHECK-LABEL: @MulTest1_i16(
+; CHECK: shl <4 x i16> %InVec, <i16 0, i16 1, i16 2, i16 3>
+; CHECK: ret
+
+define <4 x i16> @MulTest2_i16(<4 x i16> %InVec) {
+entry:
+ %mul = mul <4 x i16> %InVec, <i16 3, i16 3, i16 3, i16 3>
+ ret <4 x i16> %mul
+}
+
+; CHECK-LABEL: @MulTest2_i16(
+; CHECK: mul <4 x i16> %InVec, <i16 3, i16 3, i16 3, i16 3>
+; CHECK: ret
+
+define <4 x i16> @MulTest3_i16(<4 x i16> %InVec) {
+entry:
+ %mul = mul <4 x i16> %InVec, <i16 4, i16 4, i16 2, i16 2>
+ ret <4 x i16> %mul
+}
+
+; CHECK-LABEL: @MulTest3_i16(
+; CHECK: shl <4 x i16> %InVec, <i16 2, i16 2, i16 1, i16 1>
+; CHECK: ret
+
+define <4 x i16> @MulTest4_i16(<4 x i16> %InVec) {
+entry:
+ %mul = mul <4 x i16> %InVec, <i16 4, i16 4, i16 0, i16 2>
+ ret <4 x i16> %mul
+}
+
+; CHECK-LABEL: @MulTest4_i16(
+; CHECK: mul <4 x i16> %InVec, <i16 4, i16 4, i16 0, i16 2>
+; CHECK: ret
+
+define <4 x i32> @Zero_i32(<4 x i32> %InVec) {
+entry:
+ %mul = mul <4 x i32> %InVec, <i32 0, i32 0, i32 0, i32 0>
+ ret <4 x i32> %mul
+}
+
+; CHECK-LABEL: @Zero_i32(
+; CHECK: ret <4 x i32> zeroinitializer
+
+define <4 x i32> @Identity_i32(<4 x i32> %InVec) {
+entry:
+ %mul = mul <4 x i32> %InVec, <i32 1, i32 1, i32 1, i32 1>
+ ret <4 x i32> %mul
+}
+
+; CHECK-LABEL: @Identity_i32(
+; CHECK: ret <4 x i32> %InVec
+
+define <4 x i32> @AddToSelf_i32(<4 x i32> %InVec) {
+entry:
+ %mul = mul <4 x i32> %InVec, <i32 2, i32 2, i32 2, i32 2>
+ ret <4 x i32> %mul
+}
+
+; CHECK-LABEL: @AddToSelf_i32(
+; CHECK: shl <4 x i32> %InVec, <i32 1, i32 1, i32 1, i32 1>
+; CHECK: ret
+
+
+define <4 x i32> @SplatPow2Test1_i32(<4 x i32> %InVec) {
+entry:
+ %mul = mul <4 x i32> %InVec, <i32 4, i32 4, i32 4, i32 4>
+ ret <4 x i32> %mul
+}
+
+; CHECK-LABEL: @SplatPow2Test1_i32(
+; CHECK: shl <4 x i32> %InVec, <i32 2, i32 2, i32 2, i32 2>
+; CHECK: ret
+
+define <4 x i32> @SplatPow2Test2_i32(<4 x i32> %InVec) {
+entry:
+ %mul = mul <4 x i32> %InVec, <i32 8, i32 8, i32 8, i32 8>
+ ret <4 x i32> %mul
+}
+
+; CHECK-LABEL: @SplatPow2Test2_i32(
+; CHECK: shl <4 x i32> %InVec, <i32 3, i32 3, i32 3, i32 3>
+; CHECK: ret
+
+define <4 x i32> @MulTest1_i32(<4 x i32> %InVec) {
+entry:
+ %mul = mul <4 x i32> %InVec, <i32 1, i32 2, i32 4, i32 8>
+ ret <4 x i32> %mul
+}
+
+; CHECK-LABEL: @MulTest1_i32(
+; CHECK: shl <4 x i32> %InVec, <i32 0, i32 1, i32 2, i32 3>
+; CHECK: ret
+
+define <4 x i32> @MulTest2_i32(<4 x i32> %InVec) {
+entry:
+ %mul = mul <4 x i32> %InVec, <i32 3, i32 3, i32 3, i32 3>
+ ret <4 x i32> %mul
+}
+
+; CHECK-LABEL: @MulTest2_i32(
+; CHECK: mul <4 x i32> %InVec, <i32 3, i32 3, i32 3, i32 3>
+; CHECK: ret
+
+define <4 x i32> @MulTest3_i32(<4 x i32> %InVec) {
+entry:
+ %mul = mul <4 x i32> %InVec, <i32 4, i32 4, i32 2, i32 2>
+ ret <4 x i32> %mul
+}
+
+; CHECK-LABEL: @MulTest3_i32(
+; CHECK: shl <4 x i32> %InVec, <i32 2, i32 2, i32 1, i32 1>
+; CHECK: ret
+
+
+define <4 x i32> @MulTest4_i32(<4 x i32> %InVec) {
+entry:
+ %mul = mul <4 x i32> %InVec, <i32 4, i32 4, i32 0, i32 1>
+ ret <4 x i32> %mul
+}
+
+; CHECK-LABEL: @MulTest4_i32(
+; CHECK: mul <4 x i32> %InVec, <i32 4, i32 4, i32 0, i32 1>
+; CHECK: ret
+
+define <4 x i64> @Zero_i64(<4 x i64> %InVec) {
+entry:
+ %mul = mul <4 x i64> %InVec, <i64 0, i64 0, i64 0, i64 0>
+ ret <4 x i64> %mul
+}
+
+; CHECK-LABEL: @Zero_i64(
+; CHECK: ret <4 x i64> zeroinitializer
+
+define <4 x i64> @Identity_i64(<4 x i64> %InVec) {
+entry:
+ %mul = mul <4 x i64> %InVec, <i64 1, i64 1, i64 1, i64 1>
+ ret <4 x i64> %mul
+}
+
+; CHECK-LABEL: @Identity_i64(
+; CHECK: ret <4 x i64> %InVec
+
+define <4 x i64> @AddToSelf_i64(<4 x i64> %InVec) {
+entry:
+ %mul = mul <4 x i64> %InVec, <i64 2, i64 2, i64 2, i64 2>
+ ret <4 x i64> %mul
+}
+
+; CHECK-LABEL: @AddToSelf_i64(
+; CHECK: shl <4 x i64> %InVec, <i64 1, i64 1, i64 1, i64 1>
+; CHECK: ret
+
+define <4 x i64> @SplatPow2Test1_i64(<4 x i64> %InVec) {
+entry:
+ %mul = mul <4 x i64> %InVec, <i64 4, i64 4, i64 4, i64 4>
+ ret <4 x i64> %mul
+}
+
+; CHECK-LABEL: @SplatPow2Test1_i64(
+; CHECK: shl <4 x i64> %InVec, <i64 2, i64 2, i64 2, i64 2>
+; CHECK: ret
+
+define <4 x i64> @SplatPow2Test2_i64(<4 x i64> %InVec) {
+entry:
+ %mul = mul <4 x i64> %InVec, <i64 8, i64 8, i64 8, i64 8>
+ ret <4 x i64> %mul
+}
+
+; CHECK-LABEL: @SplatPow2Test2_i64(
+; CHECK: shl <4 x i64> %InVec, <i64 3, i64 3, i64 3, i64 3>
+; CHECK: ret
+
+define <4 x i64> @MulTest1_i64(<4 x i64> %InVec) {
+entry:
+ %mul = mul <4 x i64> %InVec, <i64 1, i64 2, i64 4, i64 8>
+ ret <4 x i64> %mul
+}
+
+; CHECK-LABEL: @MulTest1_i64(
+; CHECK: shl <4 x i64> %InVec, <i64 0, i64 1, i64 2, i64 3>
+; CHECK: ret
+
+define <4 x i64> @MulTest2_i64(<4 x i64> %InVec) {
+entry:
+ %mul = mul <4 x i64> %InVec, <i64 3, i64 3, i64 3, i64 3>
+ ret <4 x i64> %mul
+}
+
+; CHECK-LABEL: @MulTest2_i64(
+; CHECK: mul <4 x i64> %InVec, <i64 3, i64 3, i64 3, i64 3>
+; CHECK: ret
+
+define <4 x i64> @MulTest3_i64(<4 x i64> %InVec) {
+entry:
+ %mul = mul <4 x i64> %InVec, <i64 4, i64 4, i64 2, i64 2>
+ ret <4 x i64> %mul
+}
+
+; CHECK-LABEL: @MulTest3_i64(
+; CHECK: shl <4 x i64> %InVec, <i64 2, i64 2, i64 1, i64 1>
+; CHECK: ret
+
+define <4 x i64> @MulTest4_i64(<4 x i64> %InVec) {
+entry:
+ %mul = mul <4 x i64> %InVec, <i64 4, i64 4, i64 0, i64 1>
+ ret <4 x i64> %mul
+}
+
+; CHECK-LABEL: @MulTest4_i64(
+; CHECK: mul <4 x i64> %InVec, <i64 4, i64 4, i64 0, i64 1>
+; CHECK: ret
+
+; Test also that the following rewriting rule works with vectors
+; of integers as well:
+; ((X << C1)*C2) == (X * (C2 << C1))
+
+define <4 x i8> @ShiftMulTest1(<4 x i8> %InVec) {
+entry:
+ %shl = shl <4 x i8> %InVec, <i8 2, i8 2, i8 2, i8 2>
+ %mul = mul <4 x i8> %shl, <i8 3, i8 3, i8 3, i8 3>
+ ret <4 x i8> %mul
+}
+
+; CHECK-LABEL: @ShiftMulTest1(
+; CHECK: mul <4 x i8> %InVec, <i8 12, i8 12, i8 12, i8 12>
+; CHECK: ret
+
+define <4 x i16> @ShiftMulTest2(<4 x i16> %InVec) {
+entry:
+ %shl = shl <4 x i16> %InVec, <i16 2, i16 2, i16 2, i16 2>
+ %mul = mul <4 x i16> %shl, <i16 3, i16 3, i16 3, i16 3>
+ ret <4 x i16> %mul
+}
+
+; CHECK-LABEL: @ShiftMulTest2(
+; CHECK: mul <4 x i16> %InVec, <i16 12, i16 12, i16 12, i16 12>
+; CHECK: ret
+
+define <4 x i32> @ShiftMulTest3(<4 x i32> %InVec) {
+entry:
+ %shl = shl <4 x i32> %InVec, <i32 2, i32 2, i32 2, i32 2>
+ %mul = mul <4 x i32> %shl, <i32 3, i32 3, i32 3, i32 3>
+ ret <4 x i32> %mul
+}
+
+; CHECK-LABEL: @ShiftMulTest3(
+; CHECK: mul <4 x i32> %InVec, <i32 12, i32 12, i32 12, i32 12>
+; CHECK: ret
+
+define <4 x i64> @ShiftMulTest4(<4 x i64> %InVec) {
+entry:
+ %shl = shl <4 x i64> %InVec, <i64 2, i64 2, i64 2, i64 2>
+ %mul = mul <4 x i64> %shl, <i64 3, i64 3, i64 3, i64 3>
+ ret <4 x i64> %mul
+}
+
+; CHECK-LABEL: @ShiftMulTest4(
+; CHECK: mul <4 x i64> %InVec, <i64 12, i64 12, i64 12, i64 12>
+; CHECK: ret
+
diff --git a/test/Transforms/InstCombine/vector_gep2.ll b/test/Transforms/InstCombine/vector_gep2.ll
index 20165b110016..42057d60b8c8 100644
--- a/test/Transforms/InstCombine/vector_gep2.ll
+++ b/test/Transforms/InstCombine/vector_gep2.ll
@@ -4,7 +4,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-unknown-linux-gnu"
define <2 x i8*> @testa(<2 x i8*> %a) {
-; CHECK: @testa
+; CHECK-LABEL: @testa(
%g = getelementptr <2 x i8*> %a, <2 x i32> <i32 0, i32 1>
; CHECK: getelementptr <2 x i8*> %a, <2 x i64> <i64 0, i64 1>
ret <2 x i8*> %g
diff --git a/test/Transforms/InstCombine/weak-symbols.ll b/test/Transforms/InstCombine/weak-symbols.ll
index 0039b5962f74..ec946ead8602 100644
--- a/test/Transforms/InstCombine/weak-symbols.ll
+++ b/test/Transforms/InstCombine/weak-symbols.ll
@@ -8,7 +8,7 @@
@.str = private constant [2 x i8] c"y\00"
define i32 @foo() nounwind {
-; CHECK: define i32 @foo
+; CHECK-LABEL: define i32 @foo(
; CHECK: call i32 @strcmp
; CHECK: ret i32 %temp1
@@ -20,7 +20,7 @@ entry:
}
define i32 @bar() nounwind {
-; CHECK: define i32 @bar
+; CHECK-LABEL: define i32 @bar(
; CHECK: ret i32 0
entry:
diff --git a/test/Transforms/SimplifyLibCalls/win-math.ll b/test/Transforms/InstCombine/win-math.ll
index 367e5b80721c..e6e79e2b84a0 100644
--- a/test/Transforms/SimplifyLibCalls/win-math.ll
+++ b/test/Transforms/InstCombine/win-math.ll
@@ -9,7 +9,7 @@
declare double @acos(double %x)
define float @float_acos(float %x) nounwind readnone {
-; WIN32: @float_acos
+; WIN32-LABEL: @float_acos(
; WIN32-NOT: float @acosf
; WIN32: double @acos
%1 = fpext float %x to double
@@ -20,7 +20,7 @@ define float @float_acos(float %x) nounwind readnone {
declare double @asin(double %x)
define float @float_asin(float %x) nounwind readnone {
-; WIN32: @float_asin
+; WIN32-LABEL: @float_asin(
; WIN32-NOT: float @asinf
; WIN32: double @asin
%1 = fpext float %x to double
@@ -31,7 +31,7 @@ define float @float_asin(float %x) nounwind readnone {
declare double @atan(double %x)
define float @float_atan(float %x) nounwind readnone {
-; WIN32: @float_atan
+; WIN32-LABEL: @float_atan(
; WIN32-NOT: float @atanf
; WIN32: double @atan
%1 = fpext float %x to double
@@ -42,7 +42,7 @@ define float @float_atan(float %x) nounwind readnone {
declare double @atan2(double %x, double %y)
define float @float_atan2(float %x, float %y) nounwind readnone {
-; WIN32: @float_atan2
+; WIN32-LABEL: @float_atan2(
; WIN32-NOT: float @atan2f
; WIN32: double @atan2
%1 = fpext float %x to double
@@ -54,16 +54,16 @@ define float @float_atan2(float %x, float %y) nounwind readnone {
declare double @ceil(double %x)
define float @float_ceil(float %x) nounwind readnone {
-; WIN32: @float_ceil
+; WIN32-LABEL: @float_ceil(
; WIN32-NOT: float @ceilf
; WIN32: double @ceil
-; WIN64: @float_ceil
+; WIN64-LABEL: @float_ceil(
; WIN64: float @ceilf
; WIN64-NOT: double @ceil
-; MINGW32: @float_ceil
+; MINGW32-LABEL: @float_ceil(
; MINGW32: float @ceilf
; MINGW32-NOT: double @ceil
-; MINGW64: @float_ceil
+; MINGW64-LABEL: @float_ceil(
; MINGW64: float @ceilf
; MINGW64-NOT: double @ceil
%1 = fpext float %x to double
@@ -74,7 +74,7 @@ define float @float_ceil(float %x) nounwind readnone {
declare double @_copysign(double %x)
define float @float_copysign(float %x) nounwind readnone {
-; WIN32: @float_copysign
+; WIN32-LABEL: @float_copysign(
; WIN32-NOT: float @copysignf
; WIN32-NOT: float @_copysignf
; WIN32: double @_copysign
@@ -86,7 +86,7 @@ define float @float_copysign(float %x) nounwind readnone {
declare double @cos(double %x)
define float @float_cos(float %x) nounwind readnone {
-; WIN32: @float_cos
+; WIN32-LABEL: @float_cos(
; WIN32-NOT: float @cosf
; WIN32: double @cos
%1 = fpext float %x to double
@@ -97,7 +97,7 @@ define float @float_cos(float %x) nounwind readnone {
declare double @cosh(double %x)
define float @float_cosh(float %x) nounwind readnone {
-; WIN32: @float_cosh
+; WIN32-LABEL: @float_cosh(
; WIN32-NOT: float @coshf
; WIN32: double @cosh
%1 = fpext float %x to double
@@ -108,7 +108,7 @@ define float @float_cosh(float %x) nounwind readnone {
declare double @exp(double %x, double %y)
define float @float_exp(float %x, float %y) nounwind readnone {
-; WIN32: @float_exp
+; WIN32-LABEL: @float_exp(
; WIN32-NOT: float @expf
; WIN32: double @exp
%1 = fpext float %x to double
@@ -120,10 +120,10 @@ define float @float_exp(float %x, float %y) nounwind readnone {
declare double @fabs(double %x, double %y)
define float @float_fabs(float %x, float %y) nounwind readnone {
-; WIN32: @float_fabs
+; WIN32-LABEL: @float_fabs(
; WIN32-NOT: float @fabsf
; WIN32: double @fabs
-; WIN64: @float_fabs
+; WIN64-LABEL: @float_fabs(
; WIN64-NOT: float @fabsf
; WIN64: double @fabs
%1 = fpext float %x to double
@@ -135,16 +135,16 @@ define float @float_fabs(float %x, float %y) nounwind readnone {
declare double @floor(double %x)
define float @float_floor(float %x) nounwind readnone {
-; WIN32: @float_floor
+; WIN32-LABEL: @float_floor(
; WIN32-NOT: float @floorf
; WIN32: double @floor
-; WIN64: @float_floor
+; WIN64-LABEL: @float_floor(
; WIN64: float @floorf
; WIN64-NOT: double @floor
-; MINGW32: @float_floor
+; MINGW32-LABEL: @float_floor(
; MINGW32: float @floorf
; MINGW32-NOT: double @floor
-; MINGW64: @float_floor
+; MINGW64-LABEL: @float_floor(
; MINGW64: float @floorf
; MINGW64-NOT: double @floor
%1 = fpext float %x to double
@@ -155,7 +155,7 @@ define float @float_floor(float %x) nounwind readnone {
declare double @fmod(double %x, double %y)
define float @float_fmod(float %x, float %y) nounwind readnone {
-; WIN32: @float_fmod
+; WIN32-LABEL: @float_fmod(
; WIN32-NOT: float @fmodf
; WIN32: double @fmod
%1 = fpext float %x to double
@@ -167,7 +167,7 @@ define float @float_fmod(float %x, float %y) nounwind readnone {
declare double @log(double %x)
define float @float_log(float %x) nounwind readnone {
-; WIN32: @float_log
+; WIN32-LABEL: @float_log(
; WIN32-NOT: float @logf
; WIN32: double @log
%1 = fpext float %x to double
@@ -178,7 +178,7 @@ define float @float_log(float %x) nounwind readnone {
declare double @pow(double %x, double %y)
define float @float_pow(float %x, float %y) nounwind readnone {
-; WIN32: @float_pow
+; WIN32-LABEL: @float_pow(
; WIN32-NOT: float @powf
; WIN32: double @pow
%1 = fpext float %x to double
@@ -190,7 +190,7 @@ define float @float_pow(float %x, float %y) nounwind readnone {
declare double @sin(double %x)
define float @float_sin(float %x) nounwind readnone {
-; WIN32: @float_sin
+; WIN32-LABEL: @float_sin(
; WIN32-NOT: float @sinf
; WIN32: double @sin
%1 = fpext float %x to double
@@ -201,7 +201,7 @@ define float @float_sin(float %x) nounwind readnone {
declare double @sinh(double %x)
define float @float_sinh(float %x) nounwind readnone {
-; WIN32: @float_sinh
+; WIN32-LABEL: @float_sinh(
; WIN32-NOT: float @sinhf
; WIN32: double @sinh
%1 = fpext float %x to double
@@ -212,16 +212,16 @@ define float @float_sinh(float %x) nounwind readnone {
declare double @sqrt(double %x)
define float @float_sqrt(float %x) nounwind readnone {
-; WIN32: @float_sqrt
+; WIN32-LABEL: @float_sqrt(
; WIN32-NOT: float @sqrtf
; WIN32: double @sqrt
-; WIN64: @float_sqrt
+; WIN64-LABEL: @float_sqrt(
; WIN64: float @sqrtf
; WIN64-NOT: double @sqrt
-; MINGW32: @float_sqrt
+; MINGW32-LABEL: @float_sqrt(
; MINGW32: float @sqrtf
; MINGW32-NOT: double @sqrt
-; MINGW64: @float_sqrt
+; MINGW64-LABEL: @float_sqrt(
; MINGW64: float @sqrtf
; MINGW64-NOT: double @sqrt
%1 = fpext float %x to double
@@ -232,7 +232,7 @@ define float @float_sqrt(float %x) nounwind readnone {
declare double @tan(double %x)
define float @float_tan(float %x) nounwind readnone {
-; WIN32: @float_tan
+; WIN32-LABEL: @float_tan(
; WIN32-NOT: float @tanf
; WIN32: double @tan
%1 = fpext float %x to double
@@ -243,7 +243,7 @@ define float @float_tan(float %x) nounwind readnone {
declare double @tanh(double %x)
define float @float_tanh(float %x) nounwind readnone {
-; WIN32: @float_tanh
+; WIN32-LABEL: @float_tanh(
; WIN32-NOT: float @tanhf
; WIN32: double @tanh
%1 = fpext float %x to double
@@ -255,16 +255,16 @@ define float @float_tanh(float %x) nounwind readnone {
; win32 does not have round; mingw32 does
declare double @round(double %x)
define float @float_round(float %x) nounwind readnone {
-; WIN32: @float_round
+; WIN32-LABEL: @float_round(
; WIN32-NOT: float @roundf
; WIN32: double @round
-; WIN64: @float_round
+; WIN64-LABEL: @float_round(
; WIN64-NOT: float @roundf
; WIN64: double @round
-; MINGW32: @float_round
+; MINGW32-LABEL: @float_round(
; MINGW32: float @roundf
; MINGW32-NOT: double @round
-; MINGW64: @float_round
+; MINGW64-LABEL: @float_round(
; MINGW64: float @roundf
; MINGW64-NOT: double @round
%1 = fpext float %x to double
@@ -273,3 +273,23 @@ define float @float_round(float %x) nounwind readnone {
ret float %3
}
+declare float @powf(float, float)
+; win32 lacks sqrtf&fabsf, win64 lacks fabsf
+define float @float_powsqrt(float %x) nounwind readnone {
+; WIN32-LABEL: @float_powsqrt(
+; WIN32-NOT: float @sqrtf
+; WIN32: float @powf
+; WIN64-LABEL: @float_powsqrt(
+; WIN64-NOT: float @sqrtf
+; WIN64: float @powf
+; MINGW32-LABEL: @float_powsqrt(
+; MINGW32: float @sqrtf
+; MINGW32: float @fabsf
+; MINGW32-NOT: float @powf
+; MINGW64-LABEL: @float_powsqrt(
+; MINGW64: float @sqrtf
+; MINGW64: float @fabsf
+; MINGW64-NOT: float @powf
+ %1 = call float @powf(float %x, float 0.5)
+ ret float %1
+}
diff --git a/test/Transforms/InstCombine/xor2.ll b/test/Transforms/InstCombine/xor2.ll
index be06d7999d84..d153e035c899 100644
--- a/test/Transforms/InstCombine/xor2.ll
+++ b/test/Transforms/InstCombine/xor2.ll
@@ -4,7 +4,7 @@
; PR1253
define i1 @test0(i32 %A) {
-; CHECK: @test0
+; CHECK-LABEL: @test0(
; CHECK: %C = icmp slt i32 %A, 0
%B = xor i32 %A, -2147483648
%C = icmp sgt i32 %B, -1
@@ -12,7 +12,7 @@ define i1 @test0(i32 %A) {
}
define i1 @test1(i32 %A) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %C = icmp slt i32 %A, 0
%B = xor i32 %A, 12345
%C = icmp slt i32 %B, 0
@@ -21,7 +21,7 @@ define i1 @test1(i32 %A) {
; PR1014
define i32 @test2(i32 %tmp1) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: and i32 %tmp1, 32
; CHECK-NEXT: or i32 %ovm, 8
; CHECK-NEXT: ret i32
@@ -32,7 +32,7 @@ define i32 @test2(i32 %tmp1) {
}
define i32 @test3(i32 %tmp1) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: and i32 %tmp1, 32
; CHECK-NEXT: or i32 %ovm, 8
; CHECK-NEXT: ret i32
@@ -47,7 +47,7 @@ define i32 @test4(i32 %A, i32 %B) {
%2 = ashr i32 %1, %B
%3 = xor i32 %2, -1
ret i32 %3
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: %1 = ashr i32 %A, %B
; CHECK: ret i32 %1
}
@@ -62,7 +62,7 @@ test5:
%xor1 = xor i32 %shr, 1
%add = add i32 %xor1, %xor
ret i32 %add
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: lshr i32 %val1, 8
; CHECK: ret
}
@@ -78,7 +78,7 @@ define i32 @test6(i32 %x) {
%shr = lshr i32 %xor, 16
%add = add i32 %shr, %xor
ret i32 %add
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: lshr i32 %x, 16
; CHECK: ret
}
diff --git a/test/Transforms/InstCombine/zext-bool-add-sub.ll b/test/Transforms/InstCombine/zext-bool-add-sub.ll
index b5310575502b..d7f338b659b4 100644
--- a/test/Transforms/InstCombine/zext-bool-add-sub.ll
+++ b/test/Transforms/InstCombine/zext-bool-add-sub.ll
@@ -3,7 +3,7 @@
define i32 @a(i1 zeroext %x, i1 zeroext %y) {
entry:
-; CHECK: @a
+; CHECK-LABEL: @a(
; CHECK: [[TMP1:%.*]] = sext i1 %y to i32
; CHECK: [[TMP2:%.*]] = select i1 %x, i32 2, i32 1
; CHECK-NEXT: add i32 [[TMP2]], [[TMP1]]
diff --git a/test/Transforms/InstSimplify/2010-12-20-Boolean.ll b/test/Transforms/InstSimplify/2010-12-20-Boolean.ll
index 3aa1bd60cfd6..28c25c0e77ee 100644
--- a/test/Transforms/InstSimplify/2010-12-20-Boolean.ll
+++ b/test/Transforms/InstSimplify/2010-12-20-Boolean.ll
@@ -1,28 +1,28 @@
; RUN: opt < %s -instsimplify -S | FileCheck %s
define i1 @add(i1 %x) {
-; CHECK: @add
+; CHECK-LABEL: @add(
%z = add i1 %x, %x
ret i1 %z
; CHECK: ret i1 false
}
define i1 @sub(i1 %x) {
-; CHECK: @sub
+; CHECK-LABEL: @sub(
%z = sub i1 false, %x
ret i1 %z
; CHECK: ret i1 %x
}
define i1 @mul(i1 %x) {
-; CHECK: @mul
+; CHECK-LABEL: @mul(
%z = mul i1 %x, %x
ret i1 %z
; CHECK: ret i1 %x
}
define i1 @ne(i1 %x) {
-; CHECK: @ne
+; CHECK-LABEL: @ne(
%z = icmp ne i1 %x, 0
ret i1 %z
; CHECK: ret i1 %x
diff --git a/test/Transforms/InstSimplify/2010-12-20-Distribute.ll b/test/Transforms/InstSimplify/2010-12-20-Distribute.ll
index d20abd68c200..9ea0a5e10708 100644
--- a/test/Transforms/InstSimplify/2010-12-20-Distribute.ll
+++ b/test/Transforms/InstSimplify/2010-12-20-Distribute.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -instsimplify -S | FileCheck %s
define i32 @factorize(i32 %x, i32 %y) {
-; CHECK: @factorize
+; CHECK-LABEL: @factorize(
; (X | 1) & (X | 2) -> X | (1 & 2) -> X
%l = or i32 %x, 1
%r = or i32 %x, 2
@@ -11,7 +11,7 @@ define i32 @factorize(i32 %x, i32 %y) {
}
define i32 @factorize2(i32 %x) {
-; CHECK: @factorize2
+; CHECK-LABEL: @factorize2(
; 3*X - 2*X -> X
%l = mul i32 3, %x
%r = mul i32 2, %x
@@ -21,7 +21,7 @@ define i32 @factorize2(i32 %x) {
}
define i32 @factorize3(i32 %x, i32 %a, i32 %b) {
-; CHECK: @factorize3
+; CHECK-LABEL: @factorize3(
; (X | (A|B)) & (X | B) -> X | ((A|B) & B) -> X | B
%aORb = or i32 %a, %b
%l = or i32 %x, %aORb
@@ -32,7 +32,7 @@ define i32 @factorize3(i32 %x, i32 %a, i32 %b) {
}
define i32 @factorize4(i32 %x, i32 %y) {
-; CHECK: @factorize4
+; CHECK-LABEL: @factorize4(
%sh = shl i32 %y, 1
%ml = mul i32 %sh, %x
%mr = mul i32 %x, %y
@@ -42,7 +42,7 @@ define i32 @factorize4(i32 %x, i32 %y) {
}
define i32 @factorize5(i32 %x, i32 %y) {
-; CHECK: @factorize5
+; CHECK-LABEL: @factorize5(
%sh = mul i32 %y, 2
%ml = mul i32 %sh, %x
%mr = mul i32 %x, %y
@@ -52,7 +52,7 @@ define i32 @factorize5(i32 %x, i32 %y) {
}
define i32 @expand(i32 %x) {
-; CHECK: @expand
+; CHECK-LABEL: @expand(
; ((X & 1) | 2) & 1 -> ((X & 1) & 1) | (2 & 1) -> (X & 1) | 0 -> X & 1
%a = and i32 %x, 1
%b = or i32 %a, 2
diff --git a/test/Transforms/InstSimplify/2011-01-14-Thread.ll b/test/Transforms/InstSimplify/2011-01-14-Thread.ll
index 8fc4dc5d5bb7..9de06600c0c3 100644
--- a/test/Transforms/InstSimplify/2011-01-14-Thread.ll
+++ b/test/Transforms/InstSimplify/2011-01-14-Thread.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -instsimplify -S | FileCheck %s
define i32 @shift_select(i1 %cond) {
-; CHECK: @shift_select
+; CHECK-LABEL: @shift_select(
%s = select i1 %cond, i32 0, i32 1
%r = lshr i32 %s, 1
ret i32 %r
diff --git a/test/Transforms/InstSimplify/2011-02-01-Vector.ll b/test/Transforms/InstSimplify/2011-02-01-Vector.ll
index 3039a663fa45..3cbbf350ec12 100644
--- a/test/Transforms/InstSimplify/2011-02-01-Vector.ll
+++ b/test/Transforms/InstSimplify/2011-02-01-Vector.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -instsimplify -S | FileCheck %s
define <2 x i32> @sdiv(<2 x i32> %x) {
-; CHECK: @sdiv
+; CHECK-LABEL: @sdiv(
%div = sdiv <2 x i32> %x, <i32 1, i32 1>
ret <2 x i32> %div
; CHECK: ret <2 x i32> %x
diff --git a/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll b/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll
index d10c61fe2cf7..3514b3479374 100644
--- a/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll
+++ b/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll
@@ -14,7 +14,7 @@ lpad:
%exc_ptr2 = insertvalue { i8*, i32 } undef, i8* %exc_ptr, 0
%filter2 = insertvalue { i8*, i32 } %exc_ptr2, i32 %filter, 1
resume { i8*, i32 } %filter2
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NOT: extractvalue
; CHECK-NOT: insertvalue
}
@@ -25,5 +25,5 @@ define { i8, i32 } @test2({ i8*, i32 } %x) {
%ex = extractvalue { i8*, i32 } %x, 1
%ins = insertvalue { i8, i32 } undef, i32 %ex, 1
ret { i8, i32 } %ins
-; CHECK: @test2
+; CHECK-LABEL: @test2(
}
diff --git a/test/Transforms/InstSimplify/AndOrXor.ll b/test/Transforms/InstSimplify/AndOrXor.ll
index 33a4d6b02d63..c59d6c916a6b 100644
--- a/test/Transforms/InstSimplify/AndOrXor.ll
+++ b/test/Transforms/InstSimplify/AndOrXor.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -instsimplify -S | FileCheck %s
define i64 @pow2(i32 %x) {
-; CHECK: @pow2
+; CHECK-LABEL: @pow2(
%negx = sub i32 0, %x
%x2 = and i32 %x, %negx
%e = zext i32 %x2 to i64
@@ -12,7 +12,7 @@ define i64 @pow2(i32 %x) {
}
define i64 @pow2b(i32 %x) {
-; CHECK: @pow2b
+; CHECK-LABEL: @pow2b(
%sh = shl i32 2, %x
%e = zext i32 %sh to i64
%nege = sub i64 0, %e
diff --git a/test/Transforms/InstSimplify/call.ll b/test/Transforms/InstSimplify/call.ll
index cf2f8476763f..fd854c5b4662 100644
--- a/test/Transforms/InstSimplify/call.ll
+++ b/test/Transforms/InstSimplify/call.ll
@@ -3,7 +3,7 @@
declare {i8, i1} @llvm.uadd.with.overflow.i8(i8 %a, i8 %b)
define i1 @test_uadd1() {
-; CHECK: @test_uadd1
+; CHECK-LABEL: @test_uadd1(
%x = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 254, i8 3)
%overflow = extractvalue {i8, i1} %x, 1
ret i1 %overflow
@@ -11,7 +11,7 @@ define i1 @test_uadd1() {
}
define i8 @test_uadd2() {
-; CHECK: @test_uadd2
+; CHECK-LABEL: @test_uadd2(
%x = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 254, i8 44)
%result = extractvalue {i8, i1} %x, 0
ret i8 %result
@@ -21,7 +21,7 @@ define i8 @test_uadd2() {
declare i256 @llvm.cttz.i256(i256 %src, i1 %is_zero_undef)
define i256 @test_cttz() {
-; CHECK: @test_cttz
+; CHECK-LABEL: @test_cttz(
%x = call i256 @llvm.cttz.i256(i256 10, i1 false)
ret i256 %x
; CHECK-NEXT: ret i256 1
@@ -30,7 +30,7 @@ define i256 @test_cttz() {
declare i256 @llvm.ctpop.i256(i256 %src)
define i256 @test_ctpop() {
-; CHECK: @test_ctpop
+; CHECK-LABEL: @test_ctpop(
%x = call i256 @llvm.ctpop.i256(i256 10)
ret i256 %x
; CHECK-NEXT: ret i256 2
@@ -40,7 +40,7 @@ define i256 @test_ctpop() {
declare float @fabs(float %x)
define float @test_fabs_libcall() {
-; CHECK: @test_fabs_libcall
+; CHECK-LABEL: @test_fabs_libcall(
%x = call float @fabs(float -42.0)
; This is still a real function call, so instsimplify won't nuke it -- other
@@ -61,7 +61,7 @@ declare float @llvm.nearbyint.f32(float) nounwind readnone
; Test idempotent intrinsics
define float @test_idempotence(float %a) {
-; CHECK: @test_idempotence
+; CHECK-LABEL: @test_idempotence(
; CHECK: fabs
; CHECK-NOT: fabs
@@ -101,3 +101,66 @@ define float @test_idempotence(float %a) {
ret float %r4
}
+
+define i8* @operator_new() {
+entry:
+ %call = tail call noalias i8* @_Znwm(i64 8)
+ %cmp = icmp eq i8* %call, null
+ br i1 %cmp, label %cast.end, label %cast.notnull
+
+cast.notnull: ; preds = %entry
+ %add.ptr = getelementptr inbounds i8* %call, i64 4
+ br label %cast.end
+
+cast.end: ; preds = %cast.notnull, %entry
+ %cast.result = phi i8* [ %add.ptr, %cast.notnull ], [ null, %entry ]
+ ret i8* %cast.result
+
+; CHECK-LABEL: @operator_new
+; CHECK: br i1 false, label %cast.end, label %cast.notnull
+}
+
+declare noalias i8* @_Znwm(i64)
+
+%"struct.std::nothrow_t" = type { i8 }
+@_ZSt7nothrow = external global %"struct.std::nothrow_t"
+
+define i8* @operator_new_nothrow_t() {
+entry:
+ %call = tail call noalias i8* @_ZnamRKSt9nothrow_t(i64 8, %"struct.std::nothrow_t"* @_ZSt7nothrow)
+ %cmp = icmp eq i8* %call, null
+ br i1 %cmp, label %cast.end, label %cast.notnull
+
+cast.notnull: ; preds = %entry
+ %add.ptr = getelementptr inbounds i8* %call, i64 4
+ br label %cast.end
+
+cast.end: ; preds = %cast.notnull, %entry
+ %cast.result = phi i8* [ %add.ptr, %cast.notnull ], [ null, %entry ]
+ ret i8* %cast.result
+
+; CHECK-LABEL: @operator_new_nothrow_t
+; CHECK: br i1 %cmp, label %cast.end, label %cast.notnull
+}
+
+declare i8* @_ZnamRKSt9nothrow_t(i64, %"struct.std::nothrow_t"*) nounwind
+
+define i8* @malloc_can_return_null() {
+entry:
+ %call = tail call noalias i8* @malloc(i64 8)
+ %cmp = icmp eq i8* %call, null
+ br i1 %cmp, label %cast.end, label %cast.notnull
+
+cast.notnull: ; preds = %entry
+ %add.ptr = getelementptr inbounds i8* %call, i64 4
+ br label %cast.end
+
+cast.end: ; preds = %cast.notnull, %entry
+ %cast.result = phi i8* [ %add.ptr, %cast.notnull ], [ null, %entry ]
+ ret i8* %cast.result
+
+; CHECK-LABEL: @malloc_can_return_null
+; CHECK: br i1 %cmp, label %cast.end, label %cast.notnull
+}
+
+declare noalias i8* @malloc(i64)
diff --git a/test/Transforms/InstSimplify/compare.ll b/test/Transforms/InstSimplify/compare.ll
index b764c761cfb2..abb38695e710 100644
--- a/test/Transforms/InstSimplify/compare.ll
+++ b/test/Transforms/InstSimplify/compare.ll
@@ -2,7 +2,7 @@
target datalayout = "p:32:32"
define i1 @ptrtoint() {
-; CHECK: @ptrtoint
+; CHECK-LABEL: @ptrtoint(
%a = alloca i8
%tmp = ptrtoint i8* %a to i32
%r = icmp eq i32 %tmp, 0
@@ -11,7 +11,7 @@ define i1 @ptrtoint() {
}
define i1 @bitcast() {
-; CHECK: @bitcast
+; CHECK-LABEL: @bitcast(
%a = alloca i32
%b = alloca i64
%x = bitcast i32* %a to i8*
@@ -22,7 +22,7 @@ define i1 @bitcast() {
}
define i1 @gep() {
-; CHECK: @gep
+; CHECK-LABEL: @gep(
%a = alloca [3 x i8], align 8
%x = getelementptr inbounds [3 x i8]* %a, i32 0, i32 0
%cmp = icmp eq i8* %x, null
@@ -31,7 +31,7 @@ define i1 @gep() {
}
define i1 @gep2() {
-; CHECK: @gep2
+; CHECK-LABEL: @gep2(
%a = alloca [3 x i8], align 8
%x = getelementptr inbounds [3 x i8]* %a, i32 0, i32 0
%y = getelementptr inbounds [3 x i8]* %a, i32 0, i32 0
@@ -46,7 +46,7 @@ define i1 @gep2() {
@gepz = extern_weak global %gept
define i1 @gep3() {
-; CHECK: @gep3
+; CHECK-LABEL: @gep3(
%x = alloca %gept, align 8
%a = getelementptr %gept* %x, i64 0, i32 0
%b = getelementptr %gept* %x, i64 0, i32 1
@@ -56,7 +56,7 @@ define i1 @gep3() {
}
define i1 @gep4() {
-; CHECK: @gep4
+; CHECK-LABEL: @gep4(
%x = alloca %gept, align 8
%a = getelementptr %gept* @gepy, i64 0, i32 0
%b = getelementptr %gept* @gepy, i64 0, i32 1
@@ -66,7 +66,7 @@ define i1 @gep4() {
}
define i1 @gep5() {
-; CHECK: @gep5
+; CHECK-LABEL: @gep5(
%x = alloca %gept, align 8
%a = getelementptr inbounds %gept* %x, i64 0, i32 1
%b = getelementptr %gept* @gepy, i64 0, i32 0
@@ -77,7 +77,7 @@ define i1 @gep5() {
define i1 @gep6(%gept* %x) {
; Same as @gep3 but potentially null.
-; CHECK: @gep6
+; CHECK-LABEL: @gep6(
%a = getelementptr %gept* %x, i64 0, i32 0
%b = getelementptr %gept* %x, i64 0, i32 1
%equal = icmp eq i32* %a, %b
@@ -86,7 +86,7 @@ define i1 @gep6(%gept* %x) {
}
define i1 @gep7(%gept* %x) {
-; CHECK: @gep7
+; CHECK-LABEL: @gep7(
%a = getelementptr %gept* %x, i64 0, i32 0
%b = getelementptr %gept* @gepz, i64 0, i32 0
%equal = icmp eq i32* %a, %b
@@ -95,7 +95,7 @@ define i1 @gep7(%gept* %x) {
}
define i1 @gep8(%gept* %x) {
-; CHECK: @gep8
+; CHECK-LABEL: @gep8(
%a = getelementptr %gept* %x, i32 1
%b = getelementptr %gept* %x, i32 -1
%equal = icmp ugt %gept* %a, %b
@@ -104,7 +104,7 @@ define i1 @gep8(%gept* %x) {
}
define i1 @gep9(i8* %ptr) {
-; CHECK: @gep9
+; CHECK-LABEL: @gep9(
; CHECK-NOT: ret
; CHECK: ret i1 true
@@ -124,7 +124,7 @@ entry:
}
define i1 @gep10(i8* %ptr) {
-; CHECK: @gep10
+; CHECK-LABEL: @gep10(
; CHECK-NOT: ret
; CHECK: ret i1 true
@@ -140,7 +140,7 @@ entry:
}
define i1 @gep11(i8* %ptr) {
-; CHECK: @gep11
+; CHECK-LABEL: @gep11(
; CHECK-NOT: ret
; CHECK: ret i1 true
@@ -153,7 +153,7 @@ entry:
}
define i1 @gep12(i8* %ptr) {
-; CHECK: @gep12
+; CHECK-LABEL: @gep12(
; CHECK-NOT: ret
; CHECK: ret i1 %cmp
@@ -166,7 +166,7 @@ entry:
}
define i1 @gep13(i8* %ptr) {
-; CHECK: @gep13
+; CHECK-LABEL: @gep13(
; We can prove this GEP is non-null because it is inbounds.
%x = getelementptr inbounds i8* %ptr, i32 1
%cmp = icmp eq i8* %x, null
@@ -175,7 +175,7 @@ define i1 @gep13(i8* %ptr) {
}
define i1 @gep14({ {}, i8 }* %ptr) {
-; CHECK: @gep14
+; CHECK-LABEL: @gep14(
; We can't simplify this because the offset of one in the GEP actually doesn't
; move the pointer.
%x = getelementptr inbounds { {}, i8 }* %ptr, i32 0, i32 1
@@ -185,7 +185,7 @@ define i1 @gep14({ {}, i8 }* %ptr) {
}
define i1 @gep15({ {}, [4 x {i8, i8}]}* %ptr, i32 %y) {
-; CHECK: @gep15
+; CHECK-LABEL: @gep15(
; We can prove this GEP is non-null even though there is a user value, as we
; would necessarily violate inbounds on one side or the other.
%x = getelementptr inbounds { {}, [4 x {i8, i8}]}* %ptr, i32 0, i32 1, i32 %y, i32 1
@@ -195,7 +195,7 @@ define i1 @gep15({ {}, [4 x {i8, i8}]}* %ptr, i32 %y) {
}
define i1 @gep16(i8* %ptr, i32 %a) {
-; CHECK: @gep16
+; CHECK-LABEL: @gep16(
; We can prove this GEP is non-null because it is inbounds and because we know
; %b is non-zero even though we don't know its value.
%b = or i32 %a, 1
@@ -206,7 +206,7 @@ define i1 @gep16(i8* %ptr, i32 %a) {
}
define i1 @zext(i32 %x) {
-; CHECK: @zext
+; CHECK-LABEL: @zext(
%e1 = zext i32 %x to i64
%e2 = zext i32 %x to i64
%r = icmp eq i64 %e1, %e2
@@ -215,7 +215,7 @@ define i1 @zext(i32 %x) {
}
define i1 @zext2(i1 %x) {
-; CHECK: @zext2
+; CHECK-LABEL: @zext2(
%e = zext i1 %x to i32
%c = icmp ne i32 %e, 0
ret i1 %c
@@ -223,7 +223,7 @@ define i1 @zext2(i1 %x) {
}
define i1 @zext3() {
-; CHECK: @zext3
+; CHECK-LABEL: @zext3(
%e = zext i1 1 to i32
%c = icmp ne i32 %e, 0
ret i1 %c
@@ -231,7 +231,7 @@ define i1 @zext3() {
}
define i1 @sext(i32 %x) {
-; CHECK: @sext
+; CHECK-LABEL: @sext(
%e1 = sext i32 %x to i64
%e2 = sext i32 %x to i64
%r = icmp eq i64 %e1, %e2
@@ -240,7 +240,7 @@ define i1 @sext(i32 %x) {
}
define i1 @sext2(i1 %x) {
-; CHECK: @sext2
+; CHECK-LABEL: @sext2(
%e = sext i1 %x to i32
%c = icmp ne i32 %e, 0
ret i1 %c
@@ -248,7 +248,7 @@ define i1 @sext2(i1 %x) {
}
define i1 @sext3() {
-; CHECK: @sext3
+; CHECK-LABEL: @sext3(
%e = sext i1 1 to i32
%c = icmp ne i32 %e, 0
ret i1 %c
@@ -256,7 +256,7 @@ define i1 @sext3() {
}
define i1 @add(i32 %x, i32 %y) {
-; CHECK: @add
+; CHECK-LABEL: @add(
%l = lshr i32 %x, 1
%q = lshr i32 %y, 1
%r = or i32 %q, 1
@@ -267,7 +267,7 @@ define i1 @add(i32 %x, i32 %y) {
}
define i1 @add2(i8 %x, i8 %y) {
-; CHECK: @add2
+; CHECK-LABEL: @add2(
%l = or i8 %x, 128
%r = or i8 %y, 129
%s = add i8 %l, %r
@@ -277,7 +277,7 @@ define i1 @add2(i8 %x, i8 %y) {
}
define i1 @add3(i8 %x, i8 %y) {
-; CHECK: @add3
+; CHECK-LABEL: @add3(
%l = zext i8 %x to i32
%r = zext i8 %y to i32
%s = add i32 %l, %r
@@ -287,7 +287,7 @@ define i1 @add3(i8 %x, i8 %y) {
}
define i1 @add4(i32 %x, i32 %y) {
-; CHECK: @add4
+; CHECK-LABEL: @add4(
%z = add nsw i32 %y, 1
%s1 = add nsw i32 %x, %y
%s2 = add nsw i32 %x, %z
@@ -297,7 +297,7 @@ define i1 @add4(i32 %x, i32 %y) {
}
define i1 @add5(i32 %x, i32 %y) {
-; CHECK: @add5
+; CHECK-LABEL: @add5(
%z = add nuw i32 %y, 1
%s1 = add nuw i32 %x, %z
%s2 = add nuw i32 %x, %y
@@ -307,7 +307,7 @@ define i1 @add5(i32 %x, i32 %y) {
}
define i1 @add6(i64 %A, i64 %B) {
-; CHECK: @add6
+; CHECK-LABEL: @add6(
%s1 = add i64 %A, %B
%s2 = add i64 %B, %A
%cmp = icmp eq i64 %s1, %s2
@@ -316,7 +316,7 @@ define i1 @add6(i64 %A, i64 %B) {
}
define i1 @addpowtwo(i32 %x, i32 %y) {
-; CHECK: @addpowtwo
+; CHECK-LABEL: @addpowtwo(
%l = lshr i32 %x, 1
%r = shl i32 1, %y
%s = add i32 %l, %r
@@ -326,7 +326,7 @@ define i1 @addpowtwo(i32 %x, i32 %y) {
}
define i1 @or(i32 %x) {
-; CHECK: @or
+; CHECK-LABEL: @or(
%o = or i32 %x, 1
%c = icmp eq i32 %o, 0
ret i1 %c
@@ -334,7 +334,7 @@ define i1 @or(i32 %x) {
}
define i1 @shl(i32 %x) {
-; CHECK: @shl
+; CHECK-LABEL: @shl(
%s = shl i32 1, %x
%c = icmp eq i32 %s, 0
ret i1 %c
@@ -342,7 +342,7 @@ define i1 @shl(i32 %x) {
}
define i1 @lshr1(i32 %x) {
-; CHECK: @lshr1
+; CHECK-LABEL: @lshr1(
%s = lshr i32 -1, %x
%c = icmp eq i32 %s, 0
ret i1 %c
@@ -350,15 +350,23 @@ define i1 @lshr1(i32 %x) {
}
define i1 @lshr2(i32 %x) {
-; CHECK: @lshr2
+; CHECK-LABEL: @lshr2(
%s = lshr i32 %x, 30
%c = icmp ugt i32 %s, 8
ret i1 %c
; CHECK: ret i1 false
}
+define i1 @lshr3(i32 %x) {
+; CHECK-LABEL: @lshr3(
+ %s = lshr i32 %x, %x
+ %c = icmp eq i32 %s, 0
+ ret i1 %c
+; CHECK: ret i1 true
+}
+
define i1 @ashr1(i32 %x) {
-; CHECK: @ashr1
+; CHECK-LABEL: @ashr1(
%s = ashr i32 -1, %x
%c = icmp eq i32 %s, 0
ret i1 %c
@@ -366,15 +374,23 @@ define i1 @ashr1(i32 %x) {
}
define i1 @ashr2(i32 %x) {
-; CHECK: @ashr2
+; CHECK-LABEL: @ashr2(
%s = ashr i32 %x, 30
%c = icmp slt i32 %s, -5
ret i1 %c
; CHECK: ret i1 false
}
+define i1 @ashr3(i32 %x) {
+; CHECK-LABEL: @ashr3(
+ %s = ashr i32 %x, %x
+ %c = icmp eq i32 %s, 0
+ ret i1 %c
+; CHECK: ret i1 true
+}
+
define i1 @select1(i1 %cond) {
-; CHECK: @select1
+; CHECK-LABEL: @select1(
%s = select i1 %cond, i32 1, i32 0
%c = icmp eq i32 %s, 1
ret i1 %c
@@ -382,7 +398,7 @@ define i1 @select1(i1 %cond) {
}
define i1 @select2(i1 %cond) {
-; CHECK: @select2
+; CHECK-LABEL: @select2(
%x = zext i1 %cond to i32
%s = select i1 %cond, i32 %x, i32 0
%c = icmp ne i32 %s, 0
@@ -391,7 +407,7 @@ define i1 @select2(i1 %cond) {
}
define i1 @select3(i1 %cond) {
-; CHECK: @select3
+; CHECK-LABEL: @select3(
%x = zext i1 %cond to i32
%s = select i1 %cond, i32 1, i32 %x
%c = icmp ne i32 %s, 0
@@ -400,7 +416,7 @@ define i1 @select3(i1 %cond) {
}
define i1 @select4(i1 %cond) {
-; CHECK: @select4
+; CHECK-LABEL: @select4(
%invert = xor i1 %cond, 1
%s = select i1 %invert, i32 0, i32 1
%c = icmp ne i32 %s, 0
@@ -409,7 +425,7 @@ define i1 @select4(i1 %cond) {
}
define i1 @select5(i32 %x) {
-; CHECK: @select5
+; CHECK-LABEL: @select5(
%c = icmp eq i32 %x, 0
%s = select i1 %c, i32 1, i32 %x
%c2 = icmp eq i32 %s, 0
@@ -418,7 +434,7 @@ define i1 @select5(i32 %x) {
}
define i1 @select6(i32 %x) {
-; CHECK: @select6
+; CHECK-LABEL: @select6(
%c = icmp sgt i32 %x, 0
%s = select i1 %c, i32 %x, i32 4
%c2 = icmp eq i32 %s, 0
@@ -427,7 +443,7 @@ define i1 @select6(i32 %x) {
}
define i1 @urem1(i32 %X, i32 %Y) {
-; CHECK: @urem1
+; CHECK-LABEL: @urem1(
%A = urem i32 %X, %Y
%B = icmp ult i32 %A, %Y
ret i1 %B
@@ -435,7 +451,7 @@ define i1 @urem1(i32 %X, i32 %Y) {
}
define i1 @urem2(i32 %X, i32 %Y) {
-; CHECK: @urem2
+; CHECK-LABEL: @urem2(
%A = urem i32 %X, %Y
%B = icmp eq i32 %A, %Y
ret i1 %B
@@ -443,7 +459,7 @@ define i1 @urem2(i32 %X, i32 %Y) {
}
define i1 @urem3(i32 %X) {
-; CHECK: @urem3
+; CHECK-LABEL: @urem3(
%A = urem i32 %X, 10
%B = icmp ult i32 %A, 15
ret i1 %B
@@ -451,7 +467,7 @@ define i1 @urem3(i32 %X) {
}
define i1 @urem4(i32 %X) {
-; CHECK: @urem4
+; CHECK-LABEL: @urem4(
%A = urem i32 %X, 15
%B = icmp ult i32 %A, 10
ret i1 %B
@@ -459,24 +475,32 @@ define i1 @urem4(i32 %X) {
}
define i1 @urem5(i16 %X, i32 %Y) {
-; CHECK: @urem5
+; CHECK-LABEL: @urem5(
%A = zext i16 %X to i32
%B = urem i32 %A, %Y
%C = icmp slt i32 %B, %Y
ret i1 %C
-; CHECK: ret i1 true
+; CHECK-NOT: ret i1 true
}
define i1 @urem6(i32 %X, i32 %Y) {
-; CHECK: @urem6
+; CHECK-LABEL: @urem6(
%A = urem i32 %X, %Y
%B = icmp ugt i32 %Y, %A
ret i1 %B
; CHECK: ret i1 true
}
+define i1 @urem7(i32 %X) {
+; CHECK-LABEL: @urem7(
+ %A = urem i32 1, %X
+ %B = icmp sgt i32 %A, %X
+ ret i1 %B
+; CHECK-NOT: ret i1 false
+}
+
define i1 @srem1(i32 %X) {
-; CHECK: @srem1
+; CHECK-LABEL: @srem1(
%A = srem i32 %X, -5
%B = icmp sgt i32 %A, 5
ret i1 %B
@@ -484,7 +508,7 @@ define i1 @srem1(i32 %X) {
}
; PR9343 #15
-; CHECK: @srem2
+; CHECK-LABEL: @srem2(
; CHECK: ret i1 false
define i1 @srem2(i16 %X, i32 %Y) {
%A = zext i16 %X to i32
@@ -494,7 +518,7 @@ define i1 @srem2(i16 %X, i32 %Y) {
ret i1 %D
}
-; CHECK: @srem3
+; CHECK-LABEL: @srem3(
; CHECK-NEXT: ret i1 false
define i1 @srem3(i16 %X, i32 %Y) {
%A = zext i16 %X to i32
@@ -506,7 +530,7 @@ define i1 @srem3(i16 %X, i32 %Y) {
}
define i1 @udiv1(i32 %X) {
-; CHECK: @udiv1
+; CHECK-LABEL: @udiv1(
%A = udiv i32 %X, 1000000
%B = icmp ult i32 %A, 5000
ret i1 %B
@@ -514,7 +538,7 @@ define i1 @udiv1(i32 %X) {
}
define i1 @udiv2(i32 %X, i32 %Y, i32 %Z) {
-; CHECK: @udiv2
+; CHECK-LABEL: @udiv2(
%A = udiv exact i32 10, %Z
%B = udiv exact i32 20, %Z
%C = icmp ult i32 %A, %B
@@ -523,7 +547,7 @@ define i1 @udiv2(i32 %X, i32 %Y, i32 %Z) {
}
define i1 @udiv3(i32 %X, i32 %Y) {
-; CHECK: @udiv3
+; CHECK-LABEL: @udiv3(
%A = udiv i32 %X, %Y
%C = icmp ugt i32 %A, %X
ret i1 %C
@@ -531,7 +555,7 @@ define i1 @udiv3(i32 %X, i32 %Y) {
}
define i1 @udiv4(i32 %X, i32 %Y) {
-; CHECK: @udiv4
+; CHECK-LABEL: @udiv4(
%A = udiv i32 %X, %Y
%C = icmp ule i32 %A, %X
ret i1 %C
@@ -539,7 +563,7 @@ define i1 @udiv4(i32 %X, i32 %Y) {
}
define i1 @udiv5(i32 %X) {
-; CHECK: @udiv5
+; CHECK-LABEL: @udiv5(
%A = udiv i32 123, %X
%C = icmp ugt i32 %A, 124
ret i1 %C
@@ -548,7 +572,7 @@ define i1 @udiv5(i32 %X) {
; PR11340
define i1 @udiv6(i32 %X) nounwind {
-; CHECK: @udiv6
+; CHECK-LABEL: @udiv6(
%A = udiv i32 1, %X
%C = icmp eq i32 %A, 0
ret i1 %C
@@ -557,7 +581,7 @@ define i1 @udiv6(i32 %X) nounwind {
define i1 @sdiv1(i32 %X) {
-; CHECK: @sdiv1
+; CHECK-LABEL: @sdiv1(
%A = sdiv i32 %X, 1000000
%B = icmp slt i32 %A, 3000
ret i1 %B
@@ -565,7 +589,7 @@ define i1 @sdiv1(i32 %X) {
}
define i1 @or1(i32 %X) {
-; CHECK: @or1
+; CHECK-LABEL: @or1(
%A = or i32 %X, 62
%B = icmp ult i32 %A, 50
ret i1 %B
@@ -573,7 +597,7 @@ define i1 @or1(i32 %X) {
}
define i1 @and1(i32 %X) {
-; CHECK: @and1
+; CHECK-LABEL: @and1(
%A = and i32 %X, 62
%B = icmp ugt i32 %A, 70
ret i1 %B
@@ -581,7 +605,7 @@ define i1 @and1(i32 %X) {
}
define i1 @mul1(i32 %X) {
-; CHECK: @mul1
+; CHECK-LABEL: @mul1(
; Square of a non-zero number is non-zero if there is no overflow.
%Y = or i32 %X, 1
%M = mul nuw i32 %Y, %Y
@@ -591,7 +615,7 @@ define i1 @mul1(i32 %X) {
}
define i1 @mul2(i32 %X) {
-; CHECK: @mul2
+; CHECK-LABEL: @mul2(
; Square of a non-zero number is positive if there is no signed overflow.
%Y = or i32 %X, 1
%M = mul nsw i32 %Y, %Y
@@ -601,7 +625,7 @@ define i1 @mul2(i32 %X) {
}
define i1 @mul3(i32 %X, i32 %Y) {
-; CHECK: @mul3
+; CHECK-LABEL: @mul3(
; Product of non-negative numbers is non-negative if there is no signed overflow.
%XX = mul nsw i32 %X, %X
%YY = mul nsw i32 %Y, %Y
@@ -612,7 +636,7 @@ define i1 @mul3(i32 %X, i32 %Y) {
}
define <2 x i1> @vectorselect1(<2 x i1> %cond) {
-; CHECK: @vectorselect1
+; CHECK-LABEL: @vectorselect1(
%invert = xor <2 x i1> %cond, <i1 1, i1 1>
%s = select <2 x i1> %invert, <2 x i32> <i32 0, i32 0>, <2 x i32> <i32 1, i32 1>
%c = icmp ne <2 x i32> %s, <i32 0, i32 0>
@@ -684,7 +708,7 @@ define zeroext i1 @external_compare(i32* noalias %x) {
}
define i1 @alloca_gep(i64 %a, i64 %b) {
-; CHECK: @alloca_gep
+; CHECK-LABEL: @alloca_gep(
; We can prove this GEP is non-null because it is inbounds and the pointer
; is non-null.
%strs = alloca [1000 x [1001 x i8]], align 16
@@ -693,3 +717,25 @@ define i1 @alloca_gep(i64 %a, i64 %b) {
ret i1 %cmp
; CHECK-NEXT: ret i1 false
}
+
+define i1 @non_inbounds_gep_compare(i64* %a) {
+; CHECK-LABEL: @non_inbounds_gep_compare(
+; Equality compares with non-inbounds GEPs can be folded.
+ %x = getelementptr i64* %a, i64 42
+ %y = getelementptr inbounds i64* %x, i64 -42
+ %z = getelementptr i64* %a, i64 -42
+ %w = getelementptr inbounds i64* %z, i64 42
+ %cmp = icmp eq i64* %y, %w
+ ret i1 %cmp
+; CHECK-NEXT: ret i1 true
+}
+
+define i1 @non_inbounds_gep_compare2(i64* %a) {
+; CHECK-LABEL: @non_inbounds_gep_compare2(
+; Equality compares with non-inbounds GEPs can be folded.
+ %x = getelementptr i64* %a, i64 4294967297
+ %y = getelementptr i64* %a, i64 1
+ %cmp = icmp eq i64* %y, %y
+ ret i1 %cmp
+; CHECK-NEXT: ret i1 true
+}
diff --git a/test/Transforms/InstSimplify/exact-nsw-nuw.ll b/test/Transforms/InstSimplify/exact-nsw-nuw.ll
index f3a804eb5b5e..a0e326b13c02 100644
--- a/test/Transforms/InstSimplify/exact-nsw-nuw.ll
+++ b/test/Transforms/InstSimplify/exact-nsw-nuw.ll
@@ -2,7 +2,7 @@
; PR8862
-; CHECK: @shift1
+; CHECK-LABEL: @shift1(
; CHECK: ret i32 %A
define i32 @shift1(i32 %A, i32 %B) {
%C = lshr exact i32 %A, %B
@@ -10,7 +10,7 @@ define i32 @shift1(i32 %A, i32 %B) {
ret i32 %D
}
-; CHECK: @shift2
+; CHECK-LABEL: @shift2(
; CHECK: lshr
; CHECK: ret i32 %D
define i32 @shift2(i32 %A, i32 %B) {
@@ -19,7 +19,7 @@ define i32 @shift2(i32 %A, i32 %B) {
ret i32 %D
}
-; CHECK: @shift3
+; CHECK-LABEL: @shift3(
; CHECK: ret i32 %A
define i32 @shift3(i32 %A, i32 %B) {
%C = ashr exact i32 %A, %B
@@ -27,7 +27,7 @@ define i32 @shift3(i32 %A, i32 %B) {
ret i32 %D
}
-; CHECK: @shift4
+; CHECK-LABEL: @shift4(
; CHECK: ret i32 %A
define i32 @shift4(i32 %A, i32 %B) {
%C = shl nuw i32 %A, %B
@@ -35,7 +35,7 @@ define i32 @shift4(i32 %A, i32 %B) {
ret i32 %D
}
-; CHECK: @shift5
+; CHECK-LABEL: @shift5(
; CHECK: ret i32 %A
define i32 @shift5(i32 %A, i32 %B) {
%C = shl nsw i32 %A, %B
diff --git a/test/Transforms/InstSimplify/fast-math.ll b/test/Transforms/InstSimplify/fast-math.ll
index 154b96739791..71d1ed838491 100644
--- a/test/Transforms/InstSimplify/fast-math.ll
+++ b/test/Transforms/InstSimplify/fast-math.ll
@@ -71,7 +71,7 @@ define float @fadd_fsub_0(float %a) {
}
; fsub nnan ninf x, x ==> 0.0
-; CHECK: @fsub_x_x
+; CHECK-LABEL: @fsub_x_x(
define float @fsub_x_x(float %a) {
; X - X ==> 0
%zero1 = fsub nnan ninf float %a, %a
@@ -92,7 +92,7 @@ define float @fsub_x_x(float %a) {
}
; fadd nsz X, 0 ==> X
-; CHECK: @nofold_fadd_x_0
+; CHECK-LABEL: @nofold_fadd_x_0(
define float @nofold_fadd_x_0(float %a) {
; Dont fold
; CHECK: %no_zero1 = fadd
diff --git a/test/Transforms/InstSimplify/fdiv.ll b/test/Transforms/InstSimplify/fdiv.ll
index 9d85154b240f..53ad25d07476 100644
--- a/test/Transforms/InstSimplify/fdiv.ll
+++ b/test/Transforms/InstSimplify/fdiv.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -instsimplify -S | FileCheck %s
define double @fdiv_of_undef(double %X) {
-; CHECK: @fdiv_of_undef
+; CHECK-LABEL: @fdiv_of_undef(
; undef / X -> undef
%r = fdiv double undef, %X
ret double %r
@@ -9,7 +9,7 @@ define double @fdiv_of_undef(double %X) {
}
define double @fdiv_by_undef(double %X) {
-; CHECK: @fdiv_by_undef
+; CHECK-LABEL: @fdiv_by_undef(
; X / undef -> undef
%r = fdiv double %X, undef
ret double %r
diff --git a/test/Transforms/InstSimplify/floating-point-arithmetic.ll b/test/Transforms/InstSimplify/floating-point-arithmetic.ll
index 91ce26324b81..8177440472cb 100644
--- a/test/Transforms/InstSimplify/floating-point-arithmetic.ll
+++ b/test/Transforms/InstSimplify/floating-point-arithmetic.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -instsimplify -S | FileCheck %s
; fsub 0, (fsub 0, X) ==> X
-; CHECK: @fsub_0_0_x
+; CHECK-LABEL: @fsub_0_0_x(
define float @fsub_0_0_x(float %a) {
%t1 = fsub float -0.0, %a
%ret = fsub float -0.0, %t1
@@ -11,7 +11,7 @@ define float @fsub_0_0_x(float %a) {
}
; fsub X, 0 ==> X
-; CHECK: @fsub_x_0
+; CHECK-LABEL: @fsub_x_0(
define float @fsub_x_0(float %a) {
%ret = fsub float %a, 0.0
; CHECK: ret float %a
@@ -19,7 +19,7 @@ define float @fsub_x_0(float %a) {
}
; fadd X, -0 ==> X
-; CHECK: @fadd_x_n0
+; CHECK-LABEL: @fadd_x_n0(
define float @fadd_x_n0(float %a) {
%ret = fadd float %a, -0.0
; CHECK: ret float %a
@@ -27,7 +27,7 @@ define float @fadd_x_n0(float %a) {
}
; fmul X, 1.0 ==> X
-; CHECK: @fmul_X_1
+; CHECK-LABEL: @fmul_X_1(
define double @fmul_X_1(double %a) {
%b = fmul double 1.000000e+00, %a ; <double> [#uses=1]
; CHECK: ret double %a
diff --git a/test/Transforms/InstSimplify/lit.local.cfg b/test/Transforms/InstSimplify/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/InstSimplify/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/InstSimplify/maxmin.ll b/test/Transforms/InstSimplify/maxmin.ll
index e921214e0f0d..3c643ed3e03e 100644
--- a/test/Transforms/InstSimplify/maxmin.ll
+++ b/test/Transforms/InstSimplify/maxmin.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -instsimplify -S | FileCheck %s
define i1 @max1(i32 %x, i32 %y) {
-; CHECK: @max1
+; CHECK-LABEL: @max1(
%c = icmp sgt i32 %x, %y
%m = select i1 %c, i32 %x, i32 %y
%r = icmp slt i32 %m, %x
@@ -10,7 +10,7 @@ define i1 @max1(i32 %x, i32 %y) {
}
define i1 @max2(i32 %x, i32 %y) {
-; CHECK: @max2
+; CHECK-LABEL: @max2(
%c = icmp sge i32 %x, %y
%m = select i1 %c, i32 %x, i32 %y
%r = icmp sge i32 %m, %x
@@ -19,7 +19,7 @@ define i1 @max2(i32 %x, i32 %y) {
}
define i1 @max3(i32 %x, i32 %y) {
-; CHECK: @max3
+; CHECK-LABEL: @max3(
%c = icmp ugt i32 %x, %y
%m = select i1 %c, i32 %x, i32 %y
%r = icmp ult i32 %m, %x
@@ -28,7 +28,7 @@ define i1 @max3(i32 %x, i32 %y) {
}
define i1 @max4(i32 %x, i32 %y) {
-; CHECK: @max4
+; CHECK-LABEL: @max4(
%c = icmp uge i32 %x, %y
%m = select i1 %c, i32 %x, i32 %y
%r = icmp uge i32 %m, %x
@@ -37,7 +37,7 @@ define i1 @max4(i32 %x, i32 %y) {
}
define i1 @max5(i32 %x, i32 %y) {
-; CHECK: @max5
+; CHECK-LABEL: @max5(
%c = icmp sgt i32 %x, %y
%m = select i1 %c, i32 %x, i32 %y
%r = icmp sgt i32 %x, %m
@@ -46,7 +46,7 @@ define i1 @max5(i32 %x, i32 %y) {
}
define i1 @max6(i32 %x, i32 %y) {
-; CHECK: @max6
+; CHECK-LABEL: @max6(
%c = icmp sge i32 %x, %y
%m = select i1 %c, i32 %x, i32 %y
%r = icmp sle i32 %x, %m
@@ -55,7 +55,7 @@ define i1 @max6(i32 %x, i32 %y) {
}
define i1 @max7(i32 %x, i32 %y) {
-; CHECK: @max7
+; CHECK-LABEL: @max7(
%c = icmp ugt i32 %x, %y
%m = select i1 %c, i32 %x, i32 %y
%r = icmp ugt i32 %x, %m
@@ -64,7 +64,7 @@ define i1 @max7(i32 %x, i32 %y) {
}
define i1 @max8(i32 %x, i32 %y) {
-; CHECK: @max8
+; CHECK-LABEL: @max8(
%c = icmp uge i32 %x, %y
%m = select i1 %c, i32 %x, i32 %y
%r = icmp ule i32 %x, %m
@@ -73,7 +73,7 @@ define i1 @max8(i32 %x, i32 %y) {
}
define i1 @min1(i32 %x, i32 %y) {
-; CHECK: @min1
+; CHECK-LABEL: @min1(
%c = icmp sgt i32 %x, %y
%m = select i1 %c, i32 %y, i32 %x
%r = icmp sgt i32 %m, %x
@@ -82,7 +82,7 @@ define i1 @min1(i32 %x, i32 %y) {
}
define i1 @min2(i32 %x, i32 %y) {
-; CHECK: @min2
+; CHECK-LABEL: @min2(
%c = icmp sge i32 %x, %y
%m = select i1 %c, i32 %y, i32 %x
%r = icmp sle i32 %m, %x
@@ -91,7 +91,7 @@ define i1 @min2(i32 %x, i32 %y) {
}
define i1 @min3(i32 %x, i32 %y) {
-; CHECK: @min3
+; CHECK-LABEL: @min3(
%c = icmp ugt i32 %x, %y
%m = select i1 %c, i32 %y, i32 %x
%r = icmp ugt i32 %m, %x
@@ -100,7 +100,7 @@ define i1 @min3(i32 %x, i32 %y) {
}
define i1 @min4(i32 %x, i32 %y) {
-; CHECK: @min4
+; CHECK-LABEL: @min4(
%c = icmp uge i32 %x, %y
%m = select i1 %c, i32 %y, i32 %x
%r = icmp ule i32 %m, %x
@@ -109,7 +109,7 @@ define i1 @min4(i32 %x, i32 %y) {
}
define i1 @min5(i32 %x, i32 %y) {
-; CHECK: @min5
+; CHECK-LABEL: @min5(
%c = icmp sgt i32 %x, %y
%m = select i1 %c, i32 %y, i32 %x
%r = icmp slt i32 %x, %m
@@ -118,7 +118,7 @@ define i1 @min5(i32 %x, i32 %y) {
}
define i1 @min6(i32 %x, i32 %y) {
-; CHECK: @min6
+; CHECK-LABEL: @min6(
%c = icmp sge i32 %x, %y
%m = select i1 %c, i32 %y, i32 %x
%r = icmp sge i32 %x, %m
@@ -127,7 +127,7 @@ define i1 @min6(i32 %x, i32 %y) {
}
define i1 @min7(i32 %x, i32 %y) {
-; CHECK: @min7
+; CHECK-LABEL: @min7(
%c = icmp ugt i32 %x, %y
%m = select i1 %c, i32 %y, i32 %x
%r = icmp ult i32 %x, %m
@@ -136,7 +136,7 @@ define i1 @min7(i32 %x, i32 %y) {
}
define i1 @min8(i32 %x, i32 %y) {
-; CHECK: @min8
+; CHECK-LABEL: @min8(
%c = icmp uge i32 %x, %y
%m = select i1 %c, i32 %y, i32 %x
%r = icmp uge i32 %x, %m
@@ -145,7 +145,7 @@ define i1 @min8(i32 %x, i32 %y) {
}
define i1 @maxmin1(i32 %x, i32 %y, i32 %z) {
-; CHECK: @maxmin1
+; CHECK-LABEL: @maxmin1(
%c1 = icmp sge i32 %x, %y
%max = select i1 %c1, i32 %x, i32 %y
%c2 = icmp sge i32 %x, %z
@@ -156,7 +156,7 @@ define i1 @maxmin1(i32 %x, i32 %y, i32 %z) {
}
define i1 @maxmin2(i32 %x, i32 %y, i32 %z) {
-; CHECK: @maxmin2
+; CHECK-LABEL: @maxmin2(
%c1 = icmp sge i32 %x, %y
%max = select i1 %c1, i32 %x, i32 %y
%c2 = icmp sge i32 %x, %z
@@ -167,7 +167,7 @@ define i1 @maxmin2(i32 %x, i32 %y, i32 %z) {
}
define i1 @maxmin3(i32 %x, i32 %y, i32 %z) {
-; CHECK: @maxmin3
+; CHECK-LABEL: @maxmin3(
%c1 = icmp sge i32 %x, %y
%max = select i1 %c1, i32 %x, i32 %y
%c2 = icmp sge i32 %x, %z
@@ -178,7 +178,7 @@ define i1 @maxmin3(i32 %x, i32 %y, i32 %z) {
}
define i1 @maxmin4(i32 %x, i32 %y, i32 %z) {
-; CHECK: @maxmin4
+; CHECK-LABEL: @maxmin4(
%c1 = icmp sge i32 %x, %y
%max = select i1 %c1, i32 %x, i32 %y
%c2 = icmp sge i32 %x, %z
@@ -189,7 +189,7 @@ define i1 @maxmin4(i32 %x, i32 %y, i32 %z) {
}
define i1 @maxmin5(i32 %x, i32 %y, i32 %z) {
-; CHECK: @maxmin5
+; CHECK-LABEL: @maxmin5(
%c1 = icmp uge i32 %x, %y
%max = select i1 %c1, i32 %x, i32 %y
%c2 = icmp uge i32 %x, %z
@@ -200,7 +200,7 @@ define i1 @maxmin5(i32 %x, i32 %y, i32 %z) {
}
define i1 @maxmin6(i32 %x, i32 %y, i32 %z) {
-; CHECK: @maxmin6
+; CHECK-LABEL: @maxmin6(
%c1 = icmp uge i32 %x, %y
%max = select i1 %c1, i32 %x, i32 %y
%c2 = icmp uge i32 %x, %z
@@ -211,7 +211,7 @@ define i1 @maxmin6(i32 %x, i32 %y, i32 %z) {
}
define i1 @maxmin7(i32 %x, i32 %y, i32 %z) {
-; CHECK: @maxmin7
+; CHECK-LABEL: @maxmin7(
%c1 = icmp uge i32 %x, %y
%max = select i1 %c1, i32 %x, i32 %y
%c2 = icmp uge i32 %x, %z
@@ -222,7 +222,7 @@ define i1 @maxmin7(i32 %x, i32 %y, i32 %z) {
}
define i1 @maxmin8(i32 %x, i32 %y, i32 %z) {
-; CHECK: @maxmin8
+; CHECK-LABEL: @maxmin8(
%c1 = icmp uge i32 %x, %y
%max = select i1 %c1, i32 %x, i32 %y
%c2 = icmp uge i32 %x, %z
@@ -233,7 +233,7 @@ define i1 @maxmin8(i32 %x, i32 %y, i32 %z) {
}
define i1 @eqcmp1(i32 %x, i32 %y) {
-; CHECK: @eqcmp1
+; CHECK-LABEL: @eqcmp1(
%c = icmp sge i32 %x, %y
%max = select i1 %c, i32 %x, i32 %y
%r = icmp eq i32 %max, %x
@@ -242,7 +242,7 @@ define i1 @eqcmp1(i32 %x, i32 %y) {
}
define i1 @eqcmp2(i32 %x, i32 %y) {
-; CHECK: @eqcmp2
+; CHECK-LABEL: @eqcmp2(
%c = icmp sge i32 %x, %y
%max = select i1 %c, i32 %x, i32 %y
%r = icmp eq i32 %x, %max
@@ -251,7 +251,7 @@ define i1 @eqcmp2(i32 %x, i32 %y) {
}
define i1 @eqcmp3(i32 %x, i32 %y) {
-; CHECK: @eqcmp3
+; CHECK-LABEL: @eqcmp3(
%c = icmp uge i32 %x, %y
%max = select i1 %c, i32 %x, i32 %y
%r = icmp eq i32 %max, %x
@@ -260,7 +260,7 @@ define i1 @eqcmp3(i32 %x, i32 %y) {
}
define i1 @eqcmp4(i32 %x, i32 %y) {
-; CHECK: @eqcmp4
+; CHECK-LABEL: @eqcmp4(
%c = icmp uge i32 %x, %y
%max = select i1 %c, i32 %x, i32 %y
%r = icmp eq i32 %x, %max
diff --git a/test/Transforms/InstSimplify/phi.ll b/test/Transforms/InstSimplify/phi.ll
index 05cd40d90210..5b7aaa93caf1 100644
--- a/test/Transforms/InstSimplify/phi.ll
+++ b/test/Transforms/InstSimplify/phi.ll
@@ -2,7 +2,7 @@
; PR12189
define i1 @test1(i32 %x) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
br i1 true, label %a, label %b
a:
diff --git a/test/Transforms/InstSimplify/ptr_diff.ll b/test/Transforms/InstSimplify/ptr_diff.ll
index 8b4aa796013b..6a3f65237c5e 100644
--- a/test/Transforms/InstSimplify/ptr_diff.ll
+++ b/test/Transforms/InstSimplify/ptr_diff.ll
@@ -3,7 +3,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-unknown-linux-gnu"
define i64 @ptrdiff1(i8* %ptr) {
-; CHECK: @ptrdiff1
+; CHECK-LABEL: @ptrdiff1(
; CHECK-NEXT: ret i64 42
%first = getelementptr inbounds i8* %ptr, i32 0
@@ -15,7 +15,7 @@ define i64 @ptrdiff1(i8* %ptr) {
}
define i64 @ptrdiff2(i8* %ptr) {
-; CHECK: @ptrdiff2
+; CHECK-LABEL: @ptrdiff2(
; CHECK-NEXT: ret i64 42
%first1 = getelementptr inbounds i8* %ptr, i32 0
@@ -34,7 +34,7 @@ define i64 @ptrdiff2(i8* %ptr) {
define i64 @ptrdiff3(i8* %ptr) {
; Don't bother with non-inbounds GEPs.
-; CHECK: @ptrdiff3
+; CHECK-LABEL: @ptrdiff3(
; CHECK: getelementptr
; CHECK: sub
; CHECK: ret
@@ -49,7 +49,7 @@ define i64 @ptrdiff3(i8* %ptr) {
define <4 x i32> @ptrdiff4(<4 x i8*> %arg) nounwind {
; Handle simple cases of vectors of pointers.
-; CHECK: @ptrdiff4
+; CHECK-LABEL: @ptrdiff4(
; CHECK: ret <4 x i32> zeroinitializer
%p1 = ptrtoint <4 x i8*> %arg to <4 x i32>
%bc = bitcast <4 x i8*> %arg to <4 x i32*>
@@ -73,6 +73,6 @@ bb:
%tmp6 = ptrtoint [2 x i32]* %tmp5 to i32
%tmp7 = sub i32 %tmp3, %tmp6
ret i32 %tmp7
-; CHECK: @ptrdiff5
+; CHECK-LABEL: @ptrdiff5(
; CHECK: ret i32 0
}
diff --git a/test/Transforms/InstSimplify/reassociate.ll b/test/Transforms/InstSimplify/reassociate.ll
index e659e6f42c8d..d44f7155ffda 100644
--- a/test/Transforms/InstSimplify/reassociate.ll
+++ b/test/Transforms/InstSimplify/reassociate.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -instsimplify -S | FileCheck %s
define i32 @add1(i32 %x) {
-; CHECK: @add1
+; CHECK-LABEL: @add1(
; (X + -1) + 1 -> X
%l = add i32 %x, -1
%r = add i32 %l, 1
@@ -10,7 +10,7 @@ define i32 @add1(i32 %x) {
}
define i32 @and1(i32 %x, i32 %y) {
-; CHECK: @and1
+; CHECK-LABEL: @and1(
; (X & Y) & X -> X & Y
%l = and i32 %x, %y
%r = and i32 %l, %x
@@ -19,7 +19,7 @@ define i32 @and1(i32 %x, i32 %y) {
}
define i32 @and2(i32 %x, i32 %y) {
-; CHECK: @and2
+; CHECK-LABEL: @and2(
; X & (X & Y) -> X & Y
%r = and i32 %x, %y
%l = and i32 %x, %r
@@ -28,7 +28,7 @@ define i32 @and2(i32 %x, i32 %y) {
}
define i32 @or1(i32 %x, i32 %y) {
-; CHECK: @or1
+; CHECK-LABEL: @or1(
; (X | Y) | X -> X | Y
%l = or i32 %x, %y
%r = or i32 %l, %x
@@ -37,7 +37,7 @@ define i32 @or1(i32 %x, i32 %y) {
}
define i32 @or2(i32 %x, i32 %y) {
-; CHECK: @or2
+; CHECK-LABEL: @or2(
; X | (X | Y) -> X | Y
%r = or i32 %x, %y
%l = or i32 %x, %r
@@ -46,7 +46,7 @@ define i32 @or2(i32 %x, i32 %y) {
}
define i32 @xor1(i32 %x, i32 %y) {
-; CHECK: @xor1
+; CHECK-LABEL: @xor1(
; (X ^ Y) ^ X = Y
%l = xor i32 %x, %y
%r = xor i32 %l, %x
@@ -55,7 +55,7 @@ define i32 @xor1(i32 %x, i32 %y) {
}
define i32 @xor2(i32 %x, i32 %y) {
-; CHECK: @xor2
+; CHECK-LABEL: @xor2(
; X ^ (X ^ Y) = Y
%r = xor i32 %x, %y
%l = xor i32 %x, %r
@@ -64,7 +64,7 @@ define i32 @xor2(i32 %x, i32 %y) {
}
define i32 @sub1(i32 %x, i32 %y) {
-; CHECK: @sub1
+; CHECK-LABEL: @sub1(
%d = sub i32 %x, %y
%r = sub i32 %x, %d
ret i32 %r
@@ -72,7 +72,7 @@ define i32 @sub1(i32 %x, i32 %y) {
}
define i32 @sub2(i32 %x) {
-; CHECK: @sub2
+; CHECK-LABEL: @sub2(
; X - (X + 1) -> -1
%xp1 = add i32 %x, 1
%r = sub i32 %x, %xp1
@@ -81,7 +81,7 @@ define i32 @sub2(i32 %x) {
}
define i32 @sub3(i32 %x, i32 %y) {
-; CHECK: @sub3
+; CHECK-LABEL: @sub3(
; ((X + 1) + Y) - (Y + 1) -> X
%xp1 = add i32 %x, 1
%lhs = add i32 %xp1, %y
@@ -92,7 +92,7 @@ define i32 @sub3(i32 %x, i32 %y) {
}
define i32 @sdiv1(i32 %x, i32 %y) {
-; CHECK: @sdiv1
+; CHECK-LABEL: @sdiv1(
; (no overflow X * Y) / Y -> X
%mul = mul nsw i32 %x, %y
%r = sdiv i32 %mul, %y
@@ -101,7 +101,7 @@ define i32 @sdiv1(i32 %x, i32 %y) {
}
define i32 @sdiv2(i32 %x, i32 %y) {
-; CHECK: @sdiv2
+; CHECK-LABEL: @sdiv2(
; (((X / Y) * Y) / Y) -> X / Y
%div = sdiv i32 %x, %y
%mul = mul i32 %div, %y
@@ -111,7 +111,7 @@ define i32 @sdiv2(i32 %x, i32 %y) {
}
define i32 @sdiv3(i32 %x, i32 %y) {
-; CHECK: @sdiv3
+; CHECK-LABEL: @sdiv3(
; (X rem Y) / Y -> 0
%rem = srem i32 %x, %y
%div = sdiv i32 %rem, %y
@@ -120,7 +120,7 @@ define i32 @sdiv3(i32 %x, i32 %y) {
}
define i32 @sdiv4(i32 %x, i32 %y) {
-; CHECK: @sdiv4
+; CHECK-LABEL: @sdiv4(
; (X / Y) * Y -> X if the division is exact
%div = sdiv exact i32 %x, %y
%mul = mul i32 %div, %y
@@ -129,7 +129,7 @@ define i32 @sdiv4(i32 %x, i32 %y) {
}
define i32 @sdiv5(i32 %x, i32 %y) {
-; CHECK: @sdiv5
+; CHECK-LABEL: @sdiv5(
; Y * (X / Y) -> X if the division is exact
%div = sdiv exact i32 %x, %y
%mul = mul i32 %y, %div
@@ -139,7 +139,7 @@ define i32 @sdiv5(i32 %x, i32 %y) {
define i32 @udiv1(i32 %x, i32 %y) {
-; CHECK: @udiv1
+; CHECK-LABEL: @udiv1(
; (no overflow X * Y) / Y -> X
%mul = mul nuw i32 %x, %y
%r = udiv i32 %mul, %y
@@ -148,7 +148,7 @@ define i32 @udiv1(i32 %x, i32 %y) {
}
define i32 @udiv2(i32 %x, i32 %y) {
-; CHECK: @udiv2
+; CHECK-LABEL: @udiv2(
; (((X / Y) * Y) / Y) -> X / Y
%div = udiv i32 %x, %y
%mul = mul i32 %div, %y
@@ -158,7 +158,7 @@ define i32 @udiv2(i32 %x, i32 %y) {
}
define i32 @udiv3(i32 %x, i32 %y) {
-; CHECK: @udiv3
+; CHECK-LABEL: @udiv3(
; (X rem Y) / Y -> 0
%rem = urem i32 %x, %y
%div = udiv i32 %rem, %y
@@ -167,7 +167,7 @@ define i32 @udiv3(i32 %x, i32 %y) {
}
define i32 @udiv4(i32 %x, i32 %y) {
-; CHECK: @udiv4
+; CHECK-LABEL: @udiv4(
; (X / Y) * Y -> X if the division is exact
%div = udiv exact i32 %x, %y
%mul = mul i32 %div, %y
@@ -176,7 +176,7 @@ define i32 @udiv4(i32 %x, i32 %y) {
}
define i32 @udiv5(i32 %x, i32 %y) {
-; CHECK: @udiv5
+; CHECK-LABEL: @udiv5(
; Y * (X / Y) -> X if the division is exact
%div = udiv exact i32 %x, %y
%mul = mul i32 %y, %div
@@ -185,7 +185,7 @@ define i32 @udiv5(i32 %x, i32 %y) {
}
define i16 @trunc1(i32 %x) {
-; CHECK: @trunc1
+; CHECK-LABEL: @trunc1(
%y = add i32 %x, 1
%tx = trunc i32 %x to i16
%ty = trunc i32 %y to i16
diff --git a/test/Transforms/InstSimplify/rem.ll b/test/Transforms/InstSimplify/rem.ll
index 4c8f87cf5e92..80fa8e7b4831 100644
--- a/test/Transforms/InstSimplify/rem.ll
+++ b/test/Transforms/InstSimplify/rem.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -instsimplify -S | FileCheck %s
define i32 @select1(i32 %x, i1 %b) {
-; CHECK: @select1
+; CHECK-LABEL: @select1(
%rhs = select i1 %b, i32 %x, i32 1
%rem = srem i32 %x, %rhs
ret i32 %rem
@@ -9,7 +9,7 @@ define i32 @select1(i32 %x, i1 %b) {
}
define i32 @select2(i32 %x, i1 %b) {
-; CHECK: @select2
+; CHECK-LABEL: @select2(
%rhs = select i1 %b, i32 %x, i32 1
%rem = urem i32 %x, %rhs
ret i32 %rem
diff --git a/test/Transforms/Internalize/2008-05-09-AllButMain.ll b/test/Transforms/Internalize/2008-05-09-AllButMain.ll
deleted file mode 100644
index c07abb0c6365..000000000000
--- a/test/Transforms/Internalize/2008-05-09-AllButMain.ll
+++ /dev/null
@@ -1,55 +0,0 @@
-; No arguments means internalize everything
-; RUN: opt < %s -internalize -S | FileCheck --check-prefix=NOARGS %s
-
-; Internalize all but foo and j
-; RUN: opt < %s -internalize -internalize-public-api-list foo -internalize-public-api-list j -S | FileCheck --check-prefix=LIST %s
-
-; Non existent files should be treated as if they were empty (so internalize
-; everything)
-; RUN: opt < %s -internalize -internalize-public-api-file /nonexistent/file 2> /dev/null -S | FileCheck --check-prefix=EMPTYFILE %s
-
-; RUN: opt < %s -S -internalize -internalize-public-api-list bar -internalize-public-api-list foo -internalize-public-api-file /nonexistent/file 2> /dev/null | FileCheck --check-prefix=LIST2 %s
-
-; -file and -list options should be merged, the .apifile contains foo and j
-; RUN: opt < %s -internalize -internalize-public-api-list bar -internalize-public-api-file %s.apifile -S | FileCheck --check-prefix=MERGE %s
-
-; NOARGS: @i = internal global
-; LIST: @i = internal global
-; EMPTYFILE: @i = internal global
-; LIST2: @i = internal global
-; MERGE: @i = internal global
-@i = global i32 0
-
-; NOARGS: @j = internal global
-; LIST: @j = global
-; EMPTYFILE: @j = internal global
-; LIST2: @j = internal global
-; MERGE: @j = global
-@j = global i32 0
-
-; NOARGS: define internal void @main
-; LIST: define internal void @main
-; EMPTYFILE: define internal void @main
-; LIST2: define internal void @main
-; MERGE: define internal void @main
-define void @main() {
- ret void
-}
-
-; NOARGS: define internal void @foo
-; LIST: define void @foo
-; EMPTYFILE: define internal void @foo
-; LIST2: define void @foo
-; MERGE: define void @foo
-define void @foo() {
- ret void
-}
-
-; NOARGS: define internal void @bar
-; LIST: define internal void @bar
-; EMPTYFILE: define internal void @bar
-; LIST2: define void @bar
-; MERGE: define void @bar
-define void @bar() {
- ret void
-}
diff --git a/test/Transforms/Internalize/2008-05-09-AllButMain.ll.apifile b/test/Transforms/Internalize/apifile
index f6c58b80c1cd..f6c58b80c1cd 100644
--- a/test/Transforms/Internalize/2008-05-09-AllButMain.ll.apifile
+++ b/test/Transforms/Internalize/apifile
diff --git a/test/Transforms/Internalize/available_externally.ll b/test/Transforms/Internalize/available_externally.ll
deleted file mode 100644
index a2cf23fb3909..000000000000
--- a/test/Transforms/Internalize/available_externally.ll
+++ /dev/null
@@ -1,16 +0,0 @@
-; RUN: opt < %s -internalize -internalize-public-api-list foo -S | FileCheck %s
-
-; CHECK: define void @foo
-define void @foo() {
- ret void
-}
-
-; CHECK: define internal void @zed
-define void @zed() {
- ret void
-}
-
-; CHECK: define available_externally void @bar
-define available_externally void @bar() {
- ret void
-}
diff --git a/test/Transforms/Internalize/lists.ll b/test/Transforms/Internalize/lists.ll
new file mode 100644
index 000000000000..83e441a2dfe7
--- /dev/null
+++ b/test/Transforms/Internalize/lists.ll
@@ -0,0 +1,50 @@
+; No arguments means internalize everything
+; RUN: opt < %s -internalize -S | FileCheck --check-prefix=ALL %s
+
+; Non existent files should be treated as if they were empty (so internalize
+; everything)
+; RUN: opt < %s -internalize -internalize-public-api-file /nonexistent/file 2> /dev/null -S | FileCheck --check-prefix=ALL %s
+
+; Internalize all but foo and j
+; RUN: opt < %s -internalize -internalize-public-api-list foo -internalize-public-api-list j -S | FileCheck --check-prefix=FOO_AND_J %s
+
+; RUN: opt < %s -S -internalize -internalize-public-api-list bar -internalize-public-api-list foo -internalize-public-api-file /nonexistent/file 2> /dev/null | FileCheck --check-prefix=FOO_AND_BAR %s
+
+; -file and -list options should be merged, the apifile contains foo and j
+; RUN: opt < %s -internalize -internalize-public-api-list bar -internalize-public-api-file %S/apifile -S | FileCheck --check-prefix=FOO_J_AND_BAR %s
+
+; ALL: @i = internal global
+; FOO_AND_J: @i = internal global
+; FOO_AND_BAR: @i = internal global
+; FOO_J_AND_BAR: @i = internal global
+@i = global i32 0
+
+; ALL: @j = internal global
+; FOO_AND_J: @j = global
+; FOO_AND_BAR: @j = internal global
+; FOO_J_AND_BAR: @j = global
+@j = global i32 0
+
+; ALL: define internal void @main() {
+; FOO_AND_J: define internal void @main() {
+; FOO_AND_BAR: define internal void @main() {
+; FOO_J_AND_BAR: define internal void @main() {
+define void @main() {
+ ret void
+}
+
+; ALL: define internal void @foo() {
+; FOO_AND_J: define void @foo() {
+; FOO_AND_BAR: define void @foo() {
+; FOO_J_AND_BAR: define void @foo() {
+define void @foo() {
+ ret void
+}
+
+; ALL: define available_externally void @bar() {
+; FOO_AND_J: define available_externally void @bar() {
+; FOO_AND_BAR: define available_externally void @bar() {
+; FOO_J_AND_BAR: define available_externally void @bar() {
+define available_externally void @bar() {
+ ret void
+}
diff --git a/test/Transforms/Internalize/lit.local.cfg b/test/Transforms/Internalize/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/Internalize/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/Internalize/used.ll b/test/Transforms/Internalize/used.ll
new file mode 100644
index 000000000000..85b85acd5083
--- /dev/null
+++ b/test/Transforms/Internalize/used.ll
@@ -0,0 +1,20 @@
+; RUN: opt < %s -internalize -S | FileCheck %s
+
+@llvm.used = appending global [1 x void ()*] [void ()* @f], section "llvm.metadata"
+
+@llvm.compiler.used = appending global [1 x void ()*] [void ()* @g], section "llvm.metadata"
+
+; CHECK: define void @f()
+define void @f() {
+ ret void
+}
+
+; CHECK: define internal void @g()
+define void @g() {
+ ret void
+}
+
+; CHECK: define internal void @h()
+define void @h() {
+ ret void
+}
diff --git a/test/Transforms/JumpThreading/basic.ll b/test/Transforms/JumpThreading/basic.ll
index fe3dc77c9c13..32cc4de9285a 100644
--- a/test/Transforms/JumpThreading/basic.ll
+++ b/test/Transforms/JumpThreading/basic.ll
@@ -5,7 +5,7 @@ declare i32 @f2()
declare void @f3()
define i32 @test1(i1 %cond) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
br i1 %cond, label %T1, label %F1
@@ -37,7 +37,7 @@ F2:
;; cond is known false on Entry -> F1 edge!
define i32 @test2(i1 %cond) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
Entry:
br i1 %cond, label %T1, label %F1
@@ -62,7 +62,7 @@ F2:
; Undef handling.
define i32 @test3(i1 %cond) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: T1:
; CHECK-NEXT: ret i32 42
br i1 undef, label %T1, label %F1
@@ -75,7 +75,7 @@ F1:
}
define i32 @test4(i1 %cond, i1 %cond2) {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
br i1 %cond, label %T1, label %F1
@@ -108,7 +108,7 @@ F2:
;; This tests that the branch in 'merge' can be cloned up into T1.
define i32 @test5(i1 %cond, i1 %cond2) {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
br i1 %cond, label %T1, label %F1
@@ -144,7 +144,7 @@ F2:
define i32 @test6(i32 %A) {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
%tmp455 = icmp eq i32 %A, 42
br i1 %tmp455, label %BB1, label %BB2
@@ -180,7 +180,7 @@ BB4:
;; rdar://7367025
define i32 @test7(i1 %cond, i1 %cond2) {
Entry:
-; CHECK: @test7
+; CHECK-LABEL: @test7(
%v1 = call i32 @f1()
br i1 %cond, label %Merge, label %F1
@@ -213,7 +213,7 @@ F2:
declare i1 @test8a()
define i32 @test8b(i1 %cond, i1 %cond2) {
-; CHECK: @test8b
+; CHECK-LABEL: @test8b(
T0:
%A = call i1 @test8a()
br i1 %A, label %T1, label %F1
@@ -255,7 +255,7 @@ Y:
;;; Verify that we can handle constraint propagation through "xor x, 1".
define i32 @test9(i1 %cond, i1 %cond2) {
Entry:
-; CHECK: @test9
+; CHECK-LABEL: @test9(
%v1 = call i32 @f1()
br i1 %cond, label %Merge, label %F1
@@ -298,7 +298,7 @@ declare void @test10f3()
;; Non-local condition threading.
define i32 @test10g(i1 %cond) {
-; CHECK: @test10g
+; CHECK-LABEL: @test10g(
; CHECK-NEXT: br i1 %cond, label %T2, label %F2
br i1 %cond, label %T1, label %F1
@@ -329,7 +329,7 @@ F2:
; Impossible conditional constraints should get threaded. BB3 is dead here.
define i32 @test11(i32 %A) {
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK-NEXT: icmp
; CHECK-NEXT: br i1 %tmp455, label %BB4, label %BB2
%tmp455 = icmp eq i32 %A, 42
@@ -357,7 +357,7 @@ BB4:
;; Correlated value through boolean expression. GCC PR18046.
define void @test12(i32 %A) {
-; CHECK: @test12
+; CHECK-LABEL: @test12(
entry:
%cond = icmp eq i32 %A, 0
br i1 %cond, label %bb, label %bb1
@@ -393,7 +393,7 @@ return:
;; rdar://7391699
define i32 @test13(i1 %cond, i1 %cond2) {
Entry:
-; CHECK: @test13
+; CHECK-LABEL: @test13(
%v1 = call i32 @f1()
br i1 %cond, label %Merge, label %F1
@@ -421,7 +421,7 @@ F2:
; CHECK-NEXT: br i1 %N, label %T2, label %F2
}
-; CHECK: @test14
+; CHECK-LABEL: @test14(
define i32 @test14(i32 %in) {
entry:
%A = icmp eq i32 %in, 0
@@ -453,7 +453,7 @@ right_ret:
}
; PR5652
-; CHECK: @test15
+; CHECK-LABEL: @test15(
define i32 @test15(i32 %len) {
entry:
; CHECK: icmp ult i32 %len, 13
diff --git a/test/Transforms/JumpThreading/indirectbr.ll b/test/Transforms/JumpThreading/indirectbr.ll
index 141277fec626..b87fb6c22287 100644
--- a/test/Transforms/JumpThreading/indirectbr.ll
+++ b/test/Transforms/JumpThreading/indirectbr.ll
@@ -67,7 +67,7 @@ L2: ; preds = %indirectgoto
; Don't merge address-taken blocks.
@.str = private unnamed_addr constant [4 x i8] c"%p\0A\00"
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: __here:
; CHECK: blockaddress(@test3, %__here)
; CHECK: __here1:
diff --git a/test/Transforms/JumpThreading/landing-pad.ll b/test/Transforms/JumpThreading/landing-pad.ll
new file mode 100644
index 000000000000..9ee0526d0446
--- /dev/null
+++ b/test/Transforms/JumpThreading/landing-pad.ll
@@ -0,0 +1,203 @@
+; RUN: opt < %s -disable-output -jump-threading
+
+%class.E = type { i32 (...)**, %class.C }
+%class.C = type { %class.A }
+%class.A = type { i32 }
+%class.D = type { %class.F }
+%class.F = type { %class.E }
+%class.B = type { %class.D* }
+
+@_ZTV1D = unnamed_addr constant [3 x i8*] [i8* null, i8* bitcast ({ i8*, i8*, i8* }* @_ZTI1D to i8*), i8* bitcast (void (%class.D*)* @_ZN1D7doApplyEv to i8*)]
+@_ZTI1D = external unnamed_addr constant { i8*, i8*, i8* }
+
+define void @_ZN15EditCommandImpl5applyEv(%class.E* %this) uwtable align 2 {
+entry:
+ %0 = bitcast %class.E* %this to void (%class.E*)***
+ %vtable = load void (%class.E*)*** %0, align 8
+ %1 = load void (%class.E*)** %vtable, align 8
+ call void %1(%class.E* %this)
+ ret void
+}
+
+define void @_ZN1DC1Ev(%class.D* nocapture %this) unnamed_addr uwtable align 2 {
+entry:
+ call void @_ZN24CompositeEditCommandImplC2Ev()
+ %0 = getelementptr inbounds %class.D* %this, i64 0, i32 0, i32 0, i32 0
+ store i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*]* @_ZTV1D, i64 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8
+ ret void
+}
+
+define void @_ZN1DC2Ev(%class.D* nocapture %this) unnamed_addr uwtable align 2 {
+entry:
+ call void @_ZN24CompositeEditCommandImplC2Ev()
+ %0 = getelementptr inbounds %class.D* %this, i64 0, i32 0, i32 0, i32 0
+ store i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*]* @_ZTV1D, i64 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8
+ ret void
+}
+
+declare void @_ZN24CompositeEditCommandImplC2Ev() #1
+
+define void @_ZN1D7doApplyEv(%class.D* nocapture %this) unnamed_addr nounwind readnone uwtable align 2 {
+entry:
+ ret void
+}
+
+define void @_Z3fn1v() uwtable {
+entry:
+ %call = call noalias i8* @_Znwm() #8
+ invoke void @_ZN24CompositeEditCommandImplC2Ev()
+ to label %_ZN1DC1Ev.exit unwind label %lpad
+
+_ZN1DC1Ev.exit: ; preds = %entry
+ %0 = bitcast i8* %call to i32 (...)***
+ store i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*]* @_ZTV1D, i64 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8
+ %_ref.i.i.i = getelementptr inbounds i8* %call, i64 8
+ %1 = bitcast i8* %_ref.i.i.i to i32*
+ %2 = load i32* %1, align 4
+ %inc.i.i.i = add nsw i32 %2, 1
+ store i32 %inc.i.i.i, i32* %1, align 4
+ %3 = bitcast i8* %call to %class.D*
+ invoke void @_ZN1D7doApplyEv(%class.D* %3)
+ to label %_ZN15EditCommandImpl5applyEv.exit unwind label %lpad1
+
+_ZN15EditCommandImpl5applyEv.exit: ; preds = %_ZN1DC1Ev.exit
+ invoke void @_ZN1D16deleteKeyPressedEv()
+ to label %invoke.cont7 unwind label %lpad1
+
+invoke.cont7: ; preds = %_ZN15EditCommandImpl5applyEv.exit
+ ret void
+
+lpad: ; preds = %entry
+ %4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ cleanup
+ call void @_ZdlPv() #9
+ unreachable
+
+lpad1: ; preds = %_ZN1DC1Ev.exit, %_ZN15EditCommandImpl5applyEv.exit
+ %5 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ cleanup
+ %6 = load i32* %1, align 4
+ %tobool.i.i.i = icmp eq i32 %6, 0
+ br i1 %tobool.i.i.i, label %_ZN1BI1DED1Ev.exit, label %if.then.i.i.i
+
+if.then.i.i.i: ; preds = %lpad1
+ br i1 undef, label %_ZN1BI1DED1Ev.exit, label %delete.notnull.i.i.i
+
+delete.notnull.i.i.i: ; preds = %if.then.i.i.i
+ call void @_ZdlPv() #9
+ unreachable
+
+_ZN1BI1DED1Ev.exit: ; preds = %lpad1, %if.then.i.i.i
+ resume { i8*, i32 } undef
+
+terminate.lpad: ; No predecessors!
+ %7 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ catch i8* null
+ unreachable
+}
+
+define void @_ZN1BI1DEC1EPS0_(%class.B* nocapture %this, %class.D* %p1) unnamed_addr uwtable align 2 {
+entry:
+ %m_ptr.i = getelementptr inbounds %class.B* %this, i64 0, i32 0
+ store %class.D* %p1, %class.D** %m_ptr.i, align 8
+ %_ref.i.i = getelementptr inbounds %class.D* %p1, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
+ %0 = load i32* %_ref.i.i, align 4
+ %inc.i.i = add nsw i32 %0, 1
+ store i32 %inc.i.i, i32* %_ref.i.i, align 4
+ ret void
+}
+
+declare noalias i8* @_Znwm()
+
+declare i32 @__gxx_personality_v0(...)
+
+declare void @_ZdlPv()
+
+define %class.D* @_ZN1BI1DEptEv(%class.B* nocapture readonly %this) nounwind readonly uwtable align 2 {
+entry:
+ %m_ptr = getelementptr inbounds %class.B* %this, i64 0, i32 0
+ %0 = load %class.D** %m_ptr, align 8
+ ret %class.D* %0
+}
+
+declare void @_ZN1D16deleteKeyPressedEv()
+
+define void @_ZN1BI1DED1Ev(%class.B* nocapture readonly %this) unnamed_addr uwtable align 2 {
+entry:
+ %m_ptr.i = getelementptr inbounds %class.B* %this, i64 0, i32 0
+ %0 = load %class.D** %m_ptr.i, align 8
+ %_ref.i.i = getelementptr inbounds %class.D* %0, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
+ %1 = load i32* %_ref.i.i, align 4
+ %tobool.i.i = icmp eq i32 %1, 0
+ br i1 %tobool.i.i, label %_ZN1BI1DED2Ev.exit, label %if.then.i.i
+
+if.then.i.i: ; preds = %entry
+ br i1 undef, label %_ZN1BI1DED2Ev.exit, label %delete.notnull.i.i
+
+delete.notnull.i.i: ; preds = %if.then.i.i
+ call void @_ZdlPv() #9
+ unreachable
+
+_ZN1BI1DED2Ev.exit: ; preds = %entry, %if.then.i.i
+ ret void
+}
+
+declare hidden void @__clang_call_terminate()
+
+define void @_ZN1BI1DED2Ev(%class.B* nocapture readonly %this) unnamed_addr uwtable align 2 {
+entry:
+ %m_ptr = getelementptr inbounds %class.B* %this, i64 0, i32 0
+ %0 = load %class.D** %m_ptr, align 8
+ %_ref.i = getelementptr inbounds %class.D* %0, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
+ %1 = load i32* %_ref.i, align 4
+ %tobool.i = icmp eq i32 %1, 0
+ br i1 %tobool.i, label %_ZN1AI1CE5derefEv.exit, label %if.then.i
+
+if.then.i: ; preds = %entry
+ br i1 undef, label %_ZN1AI1CE5derefEv.exit, label %delete.notnull.i
+
+delete.notnull.i: ; preds = %if.then.i
+ call void @_ZdlPv() #9
+ unreachable
+
+_ZN1AI1CE5derefEv.exit: ; preds = %entry, %if.then.i
+ ret void
+}
+
+define void @_ZN1AI1CE5derefEv(%class.A* nocapture readonly %this) nounwind uwtable align 2 {
+entry:
+ %_ref = getelementptr inbounds %class.A* %this, i64 0, i32 0
+ %0 = load i32* %_ref, align 4
+ %tobool = icmp eq i32 %0, 0
+ br i1 %tobool, label %if.end, label %if.then
+
+if.then: ; preds = %entry
+ br i1 undef, label %if.end, label %delete.notnull
+
+delete.notnull: ; preds = %if.then
+ call void @_ZdlPv() #9
+ unreachable
+
+if.end: ; preds = %entry, %if.then
+ ret void
+}
+
+define void @_ZN1BI1DEC2EPS0_(%class.B* nocapture %this, %class.D* %p1) unnamed_addr uwtable align 2 {
+entry:
+ %m_ptr = getelementptr inbounds %class.B* %this, i64 0, i32 0
+ store %class.D* %p1, %class.D** %m_ptr, align 8
+ %_ref.i = getelementptr inbounds %class.D* %p1, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
+ %0 = load i32* %_ref.i, align 4
+ %inc.i = add nsw i32 %0, 1
+ store i32 %inc.i, i32* %_ref.i, align 4
+ ret void
+}
+
+define void @_ZN1AI1CE3refEv(%class.A* nocapture %this) nounwind uwtable align 2 {
+entry:
+ %_ref = getelementptr inbounds %class.A* %this, i64 0, i32 0
+ %0 = load i32* %_ref, align 4
+ %inc = add nsw i32 %0, 1
+ store i32 %inc, i32* %_ref, align 4
+ ret void
+}
diff --git a/test/Transforms/JumpThreading/lit.local.cfg b/test/Transforms/JumpThreading/lit.local.cfg
deleted file mode 100644
index c6106e4746f2..000000000000
--- a/test/Transforms/JumpThreading/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll']
diff --git a/test/Transforms/JumpThreading/select.ll b/test/Transforms/JumpThreading/select.ll
index 9676efec9df2..201e604e0c5e 100644
--- a/test/Transforms/JumpThreading/select.ll
+++ b/test/Transforms/JumpThreading/select.ll
@@ -10,7 +10,7 @@ declare void @quux()
; Mostly theoretical since instruction combining simplifies all selects of
; booleans where at least one operand is true/false/undef.
-; CHECK: @test_br
+; CHECK-LABEL: @test_br(
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 %cond, label %L1,
define void @test_br(i1 %cond, i1 %value) nounwind {
@@ -34,7 +34,7 @@ L3:
; Jump threading of switch with select as condition.
-; CHECK: @test_switch
+; CHECK-LABEL: @test_switch(
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 %cond, label %L1,
define void @test_switch(i1 %cond, i8 %value) nounwind {
@@ -69,7 +69,7 @@ L4:
; Jump threading of indirectbr with select as address.
-; CHECK: @test_indirectbr
+; CHECK-LABEL: @test_indirectbr(
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 %cond, label %L1, label %L3
define void @test_indirectbr(i1 %cond, i8* %address) nounwind {
@@ -93,7 +93,7 @@ L3:
; A more complicated case: the condition is a select based on a comparison.
-; CHECK: @test_switch_cmp
+; CHECK-LABEL: @test_switch_cmp(
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 %cond, label %L0, label %[[THREADED:[A-Za-z.0-9]+]]
; CHECK: [[THREADED]]:
@@ -157,3 +157,66 @@ L3:
L4:
ret void
}
+
+define void @unfold1(double %x, double %y) nounwind {
+entry:
+ %sub = fsub double %x, %y
+ %cmp = fcmp ogt double %sub, 1.000000e+01
+ br i1 %cmp, label %cond.end4, label %cond.false
+
+cond.false: ; preds = %entry
+ %add = fadd double %x, %y
+ %cmp1 = fcmp ogt double %add, 1.000000e+01
+ %add. = select i1 %cmp1, double %add, double 0.000000e+00
+ br label %cond.end4
+
+cond.end4: ; preds = %entry, %cond.false
+ %cond5 = phi double [ %add., %cond.false ], [ %sub, %entry ]
+ %cmp6 = fcmp oeq double %cond5, 0.000000e+00
+ br i1 %cmp6, label %if.then, label %if.end
+
+if.then: ; preds = %cond.end4
+ call void @foo()
+ br label %if.end
+
+if.end: ; preds = %if.then, %cond.end4
+ ret void
+
+; CHECK-LABEL: @unfold1
+; CHECK: br i1 %cmp, label %cond.end4, label %cond.false
+; CHECK: br i1 %cmp1, label %cond.end4, label %if.then
+; CHECK: br i1 %cmp6, label %if.then, label %if.end
+; CHECK: br label %if.end
+}
+
+
+define void @unfold2(i32 %x, i32 %y) nounwind {
+entry:
+ %sub = sub nsw i32 %x, %y
+ %cmp = icmp sgt i32 %sub, 10
+ br i1 %cmp, label %cond.end4, label %cond.false
+
+cond.false: ; preds = %entry
+ %add = add nsw i32 %x, %y
+ %cmp1 = icmp sgt i32 %add, 10
+ %add. = select i1 %cmp1, i32 0, i32 %add
+ br label %cond.end4
+
+cond.end4: ; preds = %entry, %cond.false
+ %cond5 = phi i32 [ %add., %cond.false ], [ %sub, %entry ]
+ %cmp6 = icmp eq i32 %cond5, 0
+ br i1 %cmp6, label %if.then, label %if.end
+
+if.then: ; preds = %cond.end4
+ call void @foo()
+ br label %if.end
+
+if.end: ; preds = %if.then, %cond.end4
+ ret void
+
+; CHECK-LABEL: @unfold2
+; CHECK: br i1 %cmp, label %if.end, label %cond.false
+; CHECK: br i1 %cmp1, label %if.then, label %cond.end4
+; CHECK: br i1 %cmp6, label %if.then, label %if.end
+; CHECK: br label %if.end
+}
diff --git a/test/Transforms/JumpThreading/thread-loads.ll b/test/Transforms/JumpThreading/thread-loads.ll
index 78d36e7053c9..e5bf64b9e256 100644
--- a/test/Transforms/JumpThreading/thread-loads.ll
+++ b/test/Transforms/JumpThreading/thread-loads.ll
@@ -6,7 +6,7 @@ target triple = "i386-apple-darwin7"
; Test that we can thread through the block with the partially redundant load (%2).
; rdar://6402033
define i32 @test1(i32* %P) nounwind {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
entry:
%0 = tail call i32 (...)* @f1() nounwind ; <i32> [#uses=1]
%1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
@@ -45,7 +45,7 @@ declare i32 @f2(...)
; rdar://11039258
define i32 @test2(i32* %P) nounwind {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
entry:
%0 = tail call i32 (...)* @f1() nounwind ; <i32> [#uses=1]
%1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
@@ -75,7 +75,7 @@ bb3: ; preds = %bb1
ret i32 %res.0
}
-!0 = metadata !{metadata !"int", metadata !1}
+!0 = metadata !{metadata !3, metadata !3, i64 0}
!1 = metadata !{metadata !"omnipotent char", metadata !2}
!2 = metadata !{metadata !"Simple C/C++ TBAA", null}
-
+!3 = metadata !{metadata !"int", metadata !1}
diff --git a/test/Transforms/LCSSA/lit.local.cfg b/test/Transforms/LCSSA/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/LCSSA/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/LICM/2011-04-06-PromoteResultOfPromotion.ll b/test/Transforms/LICM/2011-04-06-PromoteResultOfPromotion.ll
index 86c2679b076a..7cf7a323552d 100644
--- a/test/Transforms/LICM/2011-04-06-PromoteResultOfPromotion.ll
+++ b/test/Transforms/LICM/2011-04-06-PromoteResultOfPromotion.ll
@@ -30,8 +30,10 @@ for.end: ; preds = %for.inc
ret void
}
-!0 = metadata !{metadata !"any pointer", metadata !1}
+!0 = metadata !{metadata !5, metadata !5, i64 0}
!1 = metadata !{metadata !"omnipotent char", metadata !2}
!2 = metadata !{metadata !"Simple C/C++ TBAA", null}
!3 = metadata !{metadata !"short", metadata !1}
-!4 = metadata !{metadata !"int", metadata !1}
+!4 = metadata !{metadata !6, metadata !6, i64 0}
+!5 = metadata !{metadata !"any pointer", metadata !1}
+!6 = metadata !{metadata !"int", metadata !1}
diff --git a/test/Transforms/LICM/atomics.ll b/test/Transforms/LICM/atomics.ll
index 3902152ba2e5..acf605d2dad8 100644
--- a/test/Transforms/LICM/atomics.ll
+++ b/test/Transforms/LICM/atomics.ll
@@ -14,7 +14,7 @@ loop:
end:
ret i32 %val
-; CHECK: define i32 @test1(
+; CHECK-LABEL: define i32 @test1(
; CHECK: load atomic
; CHECK-NEXT: br label %loop
}
@@ -33,7 +33,7 @@ loop:
end:
ret i32 %val
-; CHECK: define i32 @test2(
+; CHECK-LABEL: define i32 @test2(
; CHECK: load atomic
; CHECK-NEXT: %exitcond = icmp ne
; CHECK-NEXT: br i1 %exitcond, label %end, label %loop
@@ -54,7 +54,7 @@ loop:
end:
ret i32 %vala
-; CHECK: define i32 @test3(
+; CHECK-LABEL: define i32 @test3(
; CHECK: load atomic i32* %x unordered
; CHECK-NEXT: br label %loop
}
@@ -73,7 +73,7 @@ loop:
end:
ret i32 %vala
-; CHECK: define i32 @test4(
+; CHECK-LABEL: define i32 @test4(
; CHECK: load atomic i32* %y monotonic
; CHECK-NEXT: store atomic
}
diff --git a/test/Transforms/LICM/debug-value.ll b/test/Transforms/LICM/debug-value.ll
index 889d4e2e3af9..e5c774ff8e9d 100644
--- a/test/Transforms/LICM/debug-value.ll
+++ b/test/Transforms/LICM/debug-value.ll
@@ -33,30 +33,33 @@ for.end104: ; preds = %for.cond.backedge
declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
+!llvm.module.flags = !{!26}
!llvm.dbg.sp = !{!0, !6, !9, !10}
-!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"idamax", metadata !"idamax", metadata !"", metadata !1, i32 112, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, null} ; [ DW_TAG_subprogram ]
-!1 = metadata !{i32 589865, metadata !"/Volumes/Lalgate/work/llvm/projects/llvm-test/SingleSource/Benchmarks/CoyoteBench/lpbench.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ]
-!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"/Volumes/Lalgate/work/llvm/projects/llvm-test/SingleSource/Benchmarks/CoyoteBench/lpbench.c", metadata !"/private/tmp", metadata !"clang version 2.9 (trunk 127169)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
-!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
+!0 = metadata !{i32 589870, metadata !25, metadata !1, metadata !"idamax", metadata !"idamax", metadata !"", i32 112, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
+!1 = metadata !{i32 589865, metadata !25} ; [ DW_TAG_file_type ]
+!2 = metadata !{i32 589841, metadata !25, i32 12, metadata !"clang version 2.9 (trunk 127169)", i1 true, metadata !"", i32 0, metadata !8, metadata !8, metadata !8, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
+!3 = metadata !{i32 589845, metadata !25, metadata !1, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
!4 = metadata !{metadata !5}
-!5 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
-!6 = metadata !{i32 589870, i32 0, metadata !1, metadata !"dscal", metadata !"dscal", metadata !"", metadata !1, i32 206, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, null} ; [ DW_TAG_subprogram ]
-!7 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
+!5 = metadata !{i32 589860, null, metadata !2, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
+!6 = metadata !{i32 589870, metadata !25, metadata !1, metadata !"dscal", metadata !"dscal", metadata !"", i32 206, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
+!7 = metadata !{i32 589845, metadata !25, metadata !1, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !8, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!8 = metadata !{null}
-!9 = metadata !{i32 589870, i32 0, metadata !1, metadata !"daxpy", metadata !"daxpy", metadata !"", metadata !1, i32 230, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, null} ; [ DW_TAG_subprogram ]
-!10 = metadata !{i32 589870, i32 0, metadata !1, metadata !"dgefa", metadata !"dgefa", metadata !"", metadata !1, i32 267, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, null} ; [ DW_TAG_subprogram ]
+!9 = metadata !{i32 589870, metadata !25, metadata !1, metadata !"daxpy", metadata !"daxpy", metadata !"", i32 230, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
+!10 = metadata !{i32 589870, metadata !25, metadata !1, metadata !"dgefa", metadata !"dgefa", metadata !"", i32 267, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ] [line 267] [def] [scope 0] [dgefa]
!11 = metadata !{i32 281, i32 9, metadata !12, null}
-!12 = metadata !{i32 589835, metadata !13, i32 272, i32 5, metadata !1, i32 32} ; [ DW_TAG_lexical_block ]
-!13 = metadata !{i32 589835, metadata !14, i32 271, i32 5, metadata !1, i32 31} ; [ DW_TAG_lexical_block ]
-!14 = metadata !{i32 589835, metadata !10, i32 267, i32 1, metadata !1, i32 30} ; [ DW_TAG_lexical_block ]
+!12 = metadata !{i32 589835, metadata !25, metadata !13, i32 272, i32 5, i32 32} ; [ DW_TAG_lexical_block ]
+!13 = metadata !{i32 589835, metadata !25, metadata !14, i32 271, i32 5, i32 31} ; [ DW_TAG_lexical_block ]
+!14 = metadata !{i32 589835, metadata !25, metadata !10, i32 267, i32 1, i32 30} ; [ DW_TAG_lexical_block ]
!15 = metadata !{i32 271, i32 5, metadata !14, null}
!16 = metadata !{i32 284, i32 10, metadata !17, null}
-!17 = metadata !{i32 589835, metadata !12, i32 282, i32 9, metadata !1, i32 33} ; [ DW_TAG_lexical_block ]
+!17 = metadata !{i32 589835, metadata !25, metadata !12, i32 282, i32 9, i32 33} ; [ DW_TAG_lexical_block ]
!18 = metadata !{double undef}
!19 = metadata !{i32 590080, metadata !14, metadata !"temp", metadata !1, i32 268, metadata !20, i32 0} ; [ DW_TAG_auto_variable ]
-!20 = metadata !{i32 589860, metadata !2, metadata !"double", null, i32 0, i64 64, i64 64, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ]
+!20 = metadata !{i32 589860, null, metadata !2, metadata !"double", i32 0, i64 64, i64 64, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ]
!21 = metadata !{i32 286, i32 14, metadata !22, null}
-!22 = metadata !{i32 589835, metadata !17, i32 285, i32 13, metadata !1, i32 34} ; [ DW_TAG_lexical_block ]
+!22 = metadata !{i32 589835, metadata !25, metadata !17, i32 285, i32 13, i32 34} ; [ DW_TAG_lexical_block ]
!23 = metadata !{i32 296, i32 13, metadata !17, null}
!24 = metadata !{i32 313, i32 1, metadata !14, null}
+!25 = metadata !{metadata !"/Volumes/Lalgate/work/llvm/projects/llvm-test/SingleSource/Benchmarks/CoyoteBench/lpbench.c", metadata !"/private/tmp"}
+!26 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/LICM/hoisting.ll b/test/Transforms/LICM/hoisting.ll
index 1ca377eb4a99..b4d297ac27bf 100644
--- a/test/Transforms/LICM/hoisting.ll
+++ b/test/Transforms/LICM/hoisting.ll
@@ -7,7 +7,7 @@ declare void @foo()
; This testcase tests for a problem where LICM hoists
; potentially trapping instructions when they are not guaranteed to execute.
define i32 @test1(i1 %c) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
%A = load i32* @X ; <i32> [#uses=2]
br label %Loop
Loop: ; preds = %LoopTail, %0
@@ -34,7 +34,7 @@ declare void @foo2(i32) nounwind
;; It is ok and desirable to hoist this potentially trapping instruction.
define i32 @test2(i1 %c) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: load i32* @X
; CHECK-NEXT: %B = sdiv i32 4, %A
%A = load i32* @X ; <i32> [#uses=2]
@@ -52,7 +52,7 @@ Out: ; preds = %Loop
; This loop invariant instruction should be constant folded, not hoisted.
define i32 @test3(i1 %c) {
-; CHECK: define i32 @test3
+; CHECK-LABEL: define i32 @test3(
; CHECK: call void @foo2(i32 6)
%A = load i32* @X ; <i32> [#uses=2]
br label %Loop
@@ -65,7 +65,7 @@ Out: ; preds = %Loop
ret i32 %C
}
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: call
; CHECK: sdiv
; CHECK: ret
@@ -91,7 +91,7 @@ for.end: ; preds = %for.body
declare void @foo_may_call_exit(i32)
; PR14854
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: extractvalue
; CHECK: br label %tailrecurse
; CHECK: tailrecurse:
diff --git a/test/Transforms/LICM/lit.local.cfg b/test/Transforms/LICM/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/LICM/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/LICM/promote-order.ll b/test/Transforms/LICM/promote-order.ll
index b016265bbb03..86f11fe04435 100644
--- a/test/Transforms/LICM/promote-order.ll
+++ b/test/Transforms/LICM/promote-order.ll
@@ -37,5 +37,7 @@ for.end: ; preds = %for.cond.for.end_cr
}
!0 = metadata !{metadata !"minimal TBAA"}
-!1 = metadata !{metadata !"float", metadata !0}
-!2 = metadata !{metadata !"int", metadata !0}
+!1 = metadata !{metadata !3, metadata !3, i64 0}
+!2 = metadata !{metadata !4, metadata !4, i64 0}
+!3 = metadata !{metadata !"float", metadata !0}
+!4 = metadata !{metadata !"int", metadata !0}
diff --git a/test/Transforms/LICM/scalar_promote.ll b/test/Transforms/LICM/scalar_promote.ll
index e7eab92aa8d7..92ef15581ce0 100644
--- a/test/Transforms/LICM/scalar_promote.ll
+++ b/test/Transforms/LICM/scalar_promote.ll
@@ -6,7 +6,7 @@ target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:1
define void @test1(i32 %i) {
Entry:
br label %Loop
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: Entry:
; CHECK-NEXT: load i32* @X
; CHECK-NEXT: br label %Loop
@@ -32,7 +32,7 @@ Out:
define void @test2(i32 %i) {
Entry:
br label %Loop
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: Entry:
; CHECK-NEXT: %.promoted = load i32* getelementptr inbounds (i32* @X, i64 1)
; CHECK-NEXT: br label %Loop
@@ -55,7 +55,7 @@ Exit: ; preds = %Loop
define void @test3(i32 %i) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
br label %Loop
Loop:
; Should not promote this to a register
@@ -73,7 +73,7 @@ Out: ; preds = %Loop
; PR8041
define void @test4(i8* %x, i8 %n) {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
%handle1 = alloca i8*
%handle2 = alloca i8*
store i8* %x, i8** %handle1
@@ -121,7 +121,7 @@ exit:
define void @test5(i32 %i, i32** noalias %P2) {
Entry:
br label %Loop
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: Entry:
; CHECK-NEXT: load i32* @X
; CHECK-NEXT: br label %Loop
@@ -181,7 +181,9 @@ for.end: ; preds = %for.cond.for.end_cr
; CHECK-NEXT: store i32 %inc, i32* %gi, align 4, !tbaa !0
}
-!0 = metadata !{metadata !"int", metadata !1}
+!0 = metadata !{metadata !4, metadata !4, i64 0}
!1 = metadata !{metadata !"omnipotent char", metadata !2}
!2 = metadata !{metadata !"Simple C/C++ TBAA"}
-!3 = metadata !{metadata !"float", metadata !1}
+!3 = metadata !{metadata !5, metadata !5, i64 0}
+!4 = metadata !{metadata !"int", metadata !1}
+!5 = metadata !{metadata !"float", metadata !1}
diff --git a/test/Transforms/LICM/sinking.ll b/test/Transforms/LICM/sinking.ll
index 68e4b64bf9bf..b503f96e42c0 100644
--- a/test/Transforms/LICM/sinking.ll
+++ b/test/Transforms/LICM/sinking.ll
@@ -14,7 +14,7 @@ Loop: ; preds = %Loop, %0
Out: ; preds = %Loop
ret i32 %A
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: Out:
; CHECK-NEXT: call i32 @strlen
; CHECK-NEXT: ret i32 %A
@@ -33,7 +33,7 @@ Loop: ; preds = %Loop, %0
Out: ; preds = %Loop
ret double %A
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: Out:
; CHECK-NEXT: call double @sin
; CHECK-NEXT: ret double %A
@@ -51,7 +51,7 @@ Exit:
%Y = phi i32 [ 0, %Entry ], [ %X, %Loop ]
ret void
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: Exit.loopexit:
; CHECK-NEXT: %X = add i32 0, 1
; CHECK-NEXT: br label %Exit
@@ -74,7 +74,7 @@ Loop: ; preds = %Loop, %Entry
br i1 %tmp.1, label %Loop, label %Out
Out: ; preds = %Loop
ret i32 %tmp.7
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: Out:
; CHECK-NEXT: mul i32 %N, %N_addr.0.pn
; CHECK-NEXT: sub i32 %tmp.6, %N
@@ -98,7 +98,7 @@ Loop: ; preds = %Loop, %Entry
br i1 %tmp.1, label %Loop, label %Out
Out: ; preds = %Loop
ret i32 %tmp.6
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: Out:
; CHECK-NEXT: %tmp.6 = load i32* @X
; CHECK-NEXT: ret i32 %tmp.6
@@ -122,7 +122,7 @@ Loop:
br i1 false, label %Loop, label %Out
Out: ; preds = %Loop
ret i32 %sunk2
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: Out:
; CHECK-NEXT: %dead = getelementptr %Ty* @X2, i64 0, i32 0
; CHECK-NEXT: %sunk2 = load i32* %dead
@@ -150,7 +150,7 @@ Out1: ; preds = %Loop
ret i32 %tmp.7
Out2: ; preds = %ContLoop
ret i32 %tmp.7
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: Out1:
; CHECK-NEXT: mul i32 %N, %N_addr.0.pn
; CHECK-NEXT: sub i32 %tmp.6, %N
@@ -179,7 +179,7 @@ exit1: ; preds = %Loop
ret i32 0
exit2: ; preds = %Cont
ret i32 %V
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: exit1:
; CHECK-NEXT: ret i32 0
; CHECK: exit2:
@@ -206,7 +206,7 @@ loopentry.3.i.preheader: ; preds = %loopentry.3.i.preheader.loopexit, %loopentr
return.i: ; preds = %no_exit.1.i
ret void
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK: loopentry.3.i.preheader.loopexit:
; CHECK-NEXT: %inc.1.i = add i32 0, 1
; CHECK-NEXT: br label %loopentry.3.i.preheader
@@ -227,7 +227,7 @@ Loop: ; preds = %Loop, %Entry
Out: ; preds = %Loop
ret i32 %tmp.6
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK: Out:
; CHECK-NEXT: %tmp.6 = sdiv i32 %N, %N_addr.0.pn
; CHECK-NEXT: ret i32 %tmp.6
@@ -241,7 +241,7 @@ Loop:
br i1 false, label %Loop, label %Out
Out:
ret void
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK: Out:
; CHECK-NEXT: ret void
}
diff --git a/test/Transforms/LICM/speculate.ll b/test/Transforms/LICM/speculate.ll
index 4c4d036b7dbf..4244f157d9f8 100644
--- a/test/Transforms/LICM/speculate.ll
+++ b/test/Transforms/LICM/speculate.ll
@@ -2,7 +2,7 @@
; UDiv is safe to speculate if the denominator is known non-zero.
-; CHECK: @safe_udiv
+; CHECK-LABEL: @safe_udiv(
; CHECK: %div = udiv i64 %x, %or
; CHECK-NEXT: br label %for.body
@@ -35,7 +35,7 @@ for.end: ; preds = %for.inc, %entry
; UDiv is unsafe to speculate if the denominator is not known non-zero.
-; CHECK: @unsafe_udiv
+; CHECK-LABEL: @unsafe_udiv(
; CHECK-NOT: udiv
; CHECK: for.body:
@@ -68,7 +68,7 @@ for.end: ; preds = %for.inc, %entry
; SDiv is safe to speculate if the denominator is known non-zero and
; known to have at least one zero bit.
-; CHECK: @safe_sdiv
+; CHECK-LABEL: @safe_sdiv(
; CHECK: %div = sdiv i64 %x, %or
; CHECK-NEXT: br label %for.body
@@ -102,7 +102,7 @@ for.end: ; preds = %for.inc, %entry
; SDiv is unsafe to speculate if the denominator is not known non-zero.
-; CHECK: @unsafe_sdiv_a
+; CHECK-LABEL: @unsafe_sdiv_a(
; CHECK-NOT: sdiv
; CHECK: for.body:
@@ -135,7 +135,7 @@ for.end: ; preds = %for.inc, %entry
; SDiv is unsafe to speculate if the denominator is not known to have a zero bit.
-; CHECK: @unsafe_sdiv_b
+; CHECK-LABEL: @unsafe_sdiv_b(
; CHECK-NOT: sdiv
; CHECK: for.body:
diff --git a/test/Transforms/LICM/volatile-alias.ll b/test/Transforms/LICM/volatile-alias.ll
new file mode 100644
index 000000000000..886d7f2f8074
--- /dev/null
+++ b/test/Transforms/LICM/volatile-alias.ll
@@ -0,0 +1,54 @@
+; RUN: opt -basicaa -sroa -loop-rotate -licm -S < %s | FileCheck %s
+; The objects *p and *q are aliased to each other, but even though *q is
+; volatile, *p can be considered invariant in the loop. Check if it is moved
+; out of the loop.
+; CHECK: load i32* %p
+; CHECK: for.body:
+; CHECK; load volatile i32* %q
+
+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"
+
+; Function Attrs: nounwind uwtable
+define i32 @foo(i32* %p, i32* %q, i32 %n) #0 {
+entry:
+ %p.addr = alloca i32*, align 8
+ %q.addr = alloca i32*, align 8
+ %n.addr = alloca i32, align 4
+ %i = alloca i32, align 4
+ %s = alloca i32, align 4
+ store i32* %p, i32** %p.addr, align 8
+ store i32* %q, i32** %q.addr, align 8
+ store i32 %n, i32* %n.addr, align 4
+ store i32 0, i32* %s, align 4
+ store i32 0, i32* %i, align 4
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %0 = load i32* %i, align 4
+ %1 = load i32* %n.addr, align 4
+ %cmp = icmp slt i32 %0, %1
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %2 = load i32** %p.addr, align 8
+ %3 = load i32* %2, align 4
+ %4 = load i32** %q.addr, align 8
+ %5 = load volatile i32* %4, align 4
+ %add = add nsw i32 %3, %5
+ %6 = load i32* %s, align 4
+ %add1 = add nsw i32 %6, %add
+ store i32 %add1, i32* %s, align 4
+ br label %for.inc
+
+for.inc: ; preds = %for.body
+ %7 = load i32* %i, align 4
+ %inc = add nsw i32 %7, 1
+ store i32 %inc, i32* %i, align 4
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ %8 = load i32* %s, align 4
+ ret i32 %8
+}
+
+attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/test/Transforms/LoopDeletion/lit.local.cfg b/test/Transforms/LoopDeletion/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/LoopDeletion/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/LoopIdiom/X86/lit.local.cfg b/test/Transforms/LoopIdiom/X86/lit.local.cfg
index a8ad0f1a28b2..ba763cf03ffc 100644
--- a/test/Transforms/LoopIdiom/X86/lit.local.cfg
+++ b/test/Transforms/LoopIdiom/X86/lit.local.cfg
@@ -1,5 +1,3 @@
-config.suffixes = ['.ll', '.c', '.cpp']
-
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True
diff --git a/test/Transforms/LoopIdiom/basic-address-space.ll b/test/Transforms/LoopIdiom/basic-address-space.ll
new file mode 100644
index 000000000000..697ab3726807
--- /dev/null
+++ b/test/Transforms/LoopIdiom/basic-address-space.ll
@@ -0,0 +1,91 @@
+; RUN: opt -basicaa -loop-idiom < %s -S | FileCheck %s
+
+target datalayout = "e-p:32:32:32-p1:64:64:64-p2:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-n8:16:32:64"
+target triple = "x86_64-apple-darwin10.0.0"
+
+; Two dimensional nested loop should be promoted to one big memset.
+define void @test10(i8 addrspace(2)* %X) nounwind ssp {
+; CHECK-LABEL: @test10(
+; CHECK: entry:
+; CHECK-NEXT: call void @llvm.memset.p2i8.i16(i8 addrspace(2)* %X, i8 0, i16 10000, i32 1, i1 false)
+; CHECK-NOT: store
+; CHECK: ret void
+
+entry:
+ br label %bb.nph
+
+bb.nph: ; preds = %entry, %for.inc10
+ %i.04 = phi i16 [ 0, %entry ], [ %inc12, %for.inc10 ]
+ br label %for.body5
+
+for.body5: ; preds = %for.body5, %bb.nph
+ %j.02 = phi i16 [ 0, %bb.nph ], [ %inc, %for.body5 ]
+ %mul = mul nsw i16 %i.04, 100
+ %add = add nsw i16 %j.02, %mul
+ %arrayidx = getelementptr inbounds i8 addrspace(2)* %X, i16 %add
+ store i8 0, i8 addrspace(2)* %arrayidx, align 1
+ %inc = add nsw i16 %j.02, 1
+ %cmp4 = icmp eq i16 %inc, 100
+ br i1 %cmp4, label %for.inc10, label %for.body5
+
+for.inc10: ; preds = %for.body5
+ %inc12 = add nsw i16 %i.04, 1
+ %cmp = icmp eq i16 %inc12, 100
+ br i1 %cmp, label %for.end13, label %bb.nph
+
+for.end13: ; preds = %for.inc10
+ ret void
+}
+
+define void @test11_pattern(i32 addrspace(2)* nocapture %P) nounwind ssp {
+; CHECK-LABEL: @test11_pattern(
+; CHECK-NOT: memset_pattern
+entry:
+ br label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %for.body ]
+ %arrayidx = getelementptr i32 addrspace(2)* %P, i64 %indvar
+ store i32 1, i32 addrspace(2)* %arrayidx, align 4
+ %indvar.next = add i64 %indvar, 1
+ %exitcond = icmp eq i64 %indvar.next, 10000
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body
+ ret void
+}
+
+; PR9815 - This is a partial overlap case that cannot be safely transformed
+; into a memcpy.
+@g_50 = addrspace(2) global [7 x i32] [i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 0], align 16
+
+
+define i32 @test14() nounwind {
+; CHECK-LABEL: @test14(
+; CHECK: for.body:
+; CHECK: load i32
+; CHECK: store i32
+; CHECK: br i1 %cmp
+
+entry:
+ br label %for.body
+
+for.body: ; preds = %for.inc, %for.body.lr.ph
+ %tmp5 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
+ %add = add nsw i32 %tmp5, 4
+ %idxprom = sext i32 %add to i64
+ %arrayidx = getelementptr inbounds [7 x i32] addrspace(2)* @g_50, i32 0, i64 %idxprom
+ %tmp2 = load i32 addrspace(2)* %arrayidx, align 4
+ %add4 = add nsw i32 %tmp5, 5
+ %idxprom5 = sext i32 %add4 to i64
+ %arrayidx6 = getelementptr inbounds [7 x i32] addrspace(2)* @g_50, i32 0, i64 %idxprom5
+ store i32 %tmp2, i32 addrspace(2)* %arrayidx6, align 4
+ %inc = add nsw i32 %tmp5, 1
+ %cmp = icmp slt i32 %inc, 2
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end: ; preds = %for.inc
+ %tmp8 = load i32 addrspace(2)* getelementptr inbounds ([7 x i32] addrspace(2)* @g_50, i32 0, i64 6), align 4
+ ret i32 %tmp8
+}
+
diff --git a/test/Transforms/LoopIdiom/basic.ll b/test/Transforms/LoopIdiom/basic.ll
index 06a5bd90864d..835a9f695ca9 100644
--- a/test/Transforms/LoopIdiom/basic.ll
+++ b/test/Transforms/LoopIdiom/basic.ll
@@ -16,7 +16,7 @@ for.body: ; preds = %bb.nph, %for.body
for.end: ; preds = %for.body, %entry
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: call void @llvm.memset.p0i8.i64(i8* %Base, i8 0, i64 %Size, i32 1, i1 false)
; CHECK-NOT: store
}
@@ -39,7 +39,7 @@ for.body.cont:
for.end: ; preds = %for.body, %entry
ret void
-; CHECK: @test1a
+; CHECK-LABEL: @test1a(
; CHECK: call void @llvm.memset.p0i8.i64(i8* %Base, i8 0, i64 %Size, i32 1, i1 false)
; CHECK-NOT: store
}
@@ -60,7 +60,7 @@ for.body: ; preds = %entry, %for.body
for.end: ; preds = %for.body, %entry
ret void
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: br i1 %cmp10,
; CHECK: %0 = mul i64 %Size, 4
; CHECK: call void @llvm.memset.p0i8.i64(i8* %Base1, i8 1, i64 %0, i32 4, i1 false)
@@ -85,7 +85,7 @@ for.body: ; preds = %entry, %for.body
for.end: ; preds = %entry
ret void
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NOT: memset
; CHECK: ret void
}
@@ -111,7 +111,7 @@ for.body: ; preds = %bb.nph, %for.body
for.end: ; preds = %for.body, %entry
ret void
-; CHECK-TODO: @test4
+; CHECK-TODO-LABEL: @test4(
; CHECK-TODO: call void @llvm.memset.p0i8.i64(i8* %Base, i8 0, i64 100, i32 1, i1 false)
; CHECK-TODO-NOT: store
}
@@ -133,7 +133,7 @@ for.body: ; preds = %bb.nph, %for.body
for.end: ; preds = %for.body, %entry
ret void
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NOT: memset
; CHECK: ret void
}
@@ -158,7 +158,7 @@ for.body: ; preds = %bb.nph, %for.body
for.end: ; preds = %for.body, %entry
ret void
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %Dest, i8* %Base, i64 %Size, i32 1, i1 false)
; CHECK-NOT: store
; CHECK: ret void
@@ -183,7 +183,7 @@ for.body.cont:
for.end: ; preds = %for.body, %entry
ret void
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: call void @llvm.memset.p0i8.i64(i8* %Base, i8 0, i64 %Size, i32 1, i1 false)
; CHECK-NOT: store
}
@@ -203,7 +203,7 @@ for.body: ; preds = %bb.nph, %for.body
for.end: ; preds = %for.body, %entry
ret void
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: store i64 0, i64* %PI
}
@@ -235,7 +235,7 @@ for.body: ; preds = %bb.nph, %for.body
for.end: ; preds = %for.body, %entry
ret void
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK-NOT: llvm.memcpy
; CHECK: ret void
}
@@ -267,7 +267,7 @@ for.inc10: ; preds = %for.body5
for.end13: ; preds = %for.inc10
ret void
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK: entry:
; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* %X, i8 0, i64 10000, i32 1, i1 false)
; CHECK-NOT: store
@@ -291,7 +291,7 @@ for.body: ; preds = %entry, %for.body
for.end: ; preds = %for.body
ret void
-; CHECK: @test11_pattern
+; CHECK-LABEL: @test11_pattern(
; CHECK-NEXT: entry:
; CHECK-NEXT: bitcast
; CHECK-NEXT: memset_pattern
@@ -314,7 +314,7 @@ for.body: ; preds = %entry, %for.body
for.end: ; preds = %for.body
ret void
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK-NEXT: entry:
; CHECK-NEXT: bitcast
; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* %P1, i8 0, i64 80000, i32 4, i1 false)
@@ -340,7 +340,7 @@ for.body: ; preds = %entry, %for.body
for.end: ; preds = %for.body
ret void
-; CHECK: @test13_pattern
+; CHECK-LABEL: @test13_pattern(
; CHECK-NEXT: entry:
; CHECK-NEXT: bitcast
; CHECK-NEXT: memset_pattern
@@ -375,7 +375,7 @@ for.body: ; preds = %for.inc, %for.body.
for.end: ; preds = %for.inc
%tmp8 = load i32* getelementptr inbounds ([7 x i32]* @g_50, i32 0, i64 6), align 4
ret i32 %tmp8
-; CHECK: @test14
+; CHECK-LABEL: @test14(
; CHECK: for.body:
; CHECK: load i32
; CHECK: store i32
@@ -389,7 +389,7 @@ define void @PR14241(i32* %s, i64 %size) {
; instead of a memmove. If we get the memmove transform back, this will catch
; regressions.
;
-; CHECK: @PR14241
+; CHECK-LABEL: @PR14241(
entry:
%end.idx = add i64 %size, -1
diff --git a/test/Transforms/LoopIdiom/debug-line.ll b/test/Transforms/LoopIdiom/debug-line.ll
index d31662d57e98..ef4a478d0e85 100644
--- a/test/Transforms/LoopIdiom/debug-line.ll
+++ b/test/Transforms/LoopIdiom/debug-line.ll
@@ -27,23 +27,26 @@ declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
+!llvm.module.flags = !{!19}
!llvm.dbg.sp = !{!0}
-!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, void (double*)* @foo} ; [ DW_TAG_subprogram ]
-!1 = metadata !{i32 589865, metadata !"li.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ]
-!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"li.c", metadata !"/private/tmp", metadata !"clang version 2.9 (trunk 127165:127174)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
-!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
+!0 = metadata !{i32 589870, metadata !18, metadata !1, metadata !"foo", metadata !"foo", metadata !"", i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (double*)* @foo, null, null, null, i32 0} ; [ DW_TAG_subprogram ] [line 2] [def] [scope 0] [foo]
+!1 = metadata !{i32 589865, metadata !18} ; [ DW_TAG_file_type ]
+!2 = metadata !{i32 589841, metadata !18, i32 12, metadata !"clang version 2.9 (trunk 127165:127174)", i1 true, metadata !"", i32 0, metadata !9, metadata !9, null, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
+!3 = metadata !{i32 589845, metadata !18, metadata !1, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!4 = metadata !{null}
!5 = metadata !{i32 590081, metadata !0, metadata !"a", metadata !1, i32 16777218, metadata !6, i32 0} ; [ DW_TAG_arg_variable ]
-!6 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !7} ; [ DW_TAG_pointer_type ]
-!7 = metadata !{i32 589860, metadata !2, metadata !"double", null, i32 0, i64 64, i64 64, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ]
+!6 = metadata !{i32 589839, null, metadata !2, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !7} ; [ DW_TAG_pointer_type ]
+!7 = metadata !{i32 589860, null, metadata !2, metadata !"double", i32 0, i64 64, i64 64, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ]
!8 = metadata !{i32 2, i32 18, metadata !0, null}
!9 = metadata !{i32 0}
!10 = metadata !{i32 590080, metadata !11, metadata !"i", metadata !1, i32 3, metadata !13, i32 0} ; [ DW_TAG_auto_variable ]
-!11 = metadata !{i32 589835, metadata !12, i32 3, i32 3, metadata !1, i32 1} ; [ DW_TAG_lexical_block ]
-!12 = metadata !{i32 589835, metadata !0, i32 2, i32 21, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
-!13 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
+!11 = metadata !{i32 589835, metadata !18, metadata !12, i32 3, i32 3, i32 1} ; [ DW_TAG_lexical_block ]
+!12 = metadata !{i32 589835, metadata !18, metadata !0, i32 2, i32 21, i32 0} ; [ DW_TAG_lexical_block ]
+!13 = metadata !{i32 589860, null, metadata !2, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!14 = metadata !{i32 3, i32 3, metadata !12, null}
!15 = metadata !{i32 4, i32 5, metadata !11, null}
!16 = metadata !{i32 3, i32 29, metadata !11, null}
!17 = metadata !{i32 5, i32 1, metadata !12, null}
+!18 = metadata !{metadata !"li.c", metadata !"/private/tmp"}
+!19 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/LoopIdiom/lit.local.cfg b/test/Transforms/LoopIdiom/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/LoopIdiom/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/LoopIdiom/memset_noidiom.ll b/test/Transforms/LoopIdiom/memset_noidiom.ll
index 168eb95357c4..f2b55aed5467 100644
--- a/test/Transforms/LoopIdiom/memset_noidiom.ll
+++ b/test/Transforms/LoopIdiom/memset_noidiom.ll
@@ -2,7 +2,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-darwin10.0.0"
-; CHECK: @memset
+; CHECK-LABEL: @memset(
; CHECK-NOT: llvm.memset
define i8* @memset(i8* %b, i32 %c, i64 %len) nounwind uwtable ssp {
entry:
diff --git a/test/Transforms/LoopReroll/basic.ll b/test/Transforms/LoopReroll/basic.ll
new file mode 100644
index 000000000000..314a14947e3e
--- /dev/null
+++ b/test/Transforms/LoopReroll/basic.ll
@@ -0,0 +1,327 @@
+; RUN: opt < %s -loop-reroll -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-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; int foo(int a);
+; void bar(int *x) {
+; for (int i = 0; i < 500; i += 3) {
+; foo(i);
+; foo(i+1);
+; foo(i+2);
+; }
+; }
+
+; Function Attrs: nounwind uwtable
+define void @bar(i32* nocapture readnone %x) #0 {
+entry:
+ br label %for.body
+
+for.body: ; preds = %for.body, %entry
+ %i.08 = phi i32 [ 0, %entry ], [ %add3, %for.body ]
+ %call = tail call i32 @foo(i32 %i.08) #1
+ %add = add nsw i32 %i.08, 1
+ %call1 = tail call i32 @foo(i32 %add) #1
+ %add2 = add nsw i32 %i.08, 2
+ %call3 = tail call i32 @foo(i32 %add2) #1
+ %add3 = add nsw i32 %i.08, 3
+ %exitcond = icmp eq i32 %add3, 500
+ br i1 %exitcond, label %for.end, label %for.body
+
+; CHECK-LABEL: @bar
+
+; CHECK: for.body:
+; CHECK: %indvar = phi i32 [ %indvar.next, %for.body ], [ 0, %entry ]
+; CHECK: %call = tail call i32 @foo(i32 %indvar) #1
+; CHECK: %indvar.next = add i32 %indvar, 1
+; CHECK: %exitcond1 = icmp eq i32 %indvar.next, 498
+; CHECK: br i1 %exitcond1, label %for.end, label %for.body
+
+; CHECK: ret
+
+for.end: ; preds = %for.body
+ ret void
+}
+
+declare i32 @foo(i32)
+
+; void hi1(int *x) {
+; for (int i = 0; i < 1500; i += 3) {
+; x[i] = foo(0);
+; x[i+1] = foo(0);
+; x[i+2] = foo(0);
+; }
+; }
+
+; Function Attrs: nounwind uwtable
+define void @hi1(i32* nocapture %x) #0 {
+entry:
+ br label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %call = tail call i32 @foo(i32 0) #1
+ %arrayidx = getelementptr inbounds i32* %x, i64 %indvars.iv
+ store i32 %call, i32* %arrayidx, align 4
+ %call1 = tail call i32 @foo(i32 0) #1
+ %0 = add nsw i64 %indvars.iv, 1
+ %arrayidx3 = getelementptr inbounds i32* %x, i64 %0
+ store i32 %call1, i32* %arrayidx3, align 4
+ %call4 = tail call i32 @foo(i32 0) #1
+ %1 = add nsw i64 %indvars.iv, 2
+ %arrayidx7 = getelementptr inbounds i32* %x, i64 %1
+ store i32 %call4, i32* %arrayidx7, align 4
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 3
+ %2 = trunc i64 %indvars.iv.next to i32
+ %cmp = icmp slt i32 %2, 1500
+ br i1 %cmp, label %for.body, label %for.end
+
+; CHECK-LABEL: @hi1
+
+; CHECK: for.body:
+; CHECK: %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
+; CHECK: %call = tail call i32 @foo(i32 0) #1
+; CHECK: %arrayidx = getelementptr inbounds i32* %x, i64 %indvar
+; CHECK: store i32 %call, i32* %arrayidx, align 4
+; CHECK: %indvar.next = add i64 %indvar, 1
+; CHECK: %exitcond = icmp eq i64 %indvar.next, 1500
+; CHECK: br i1 %exitcond, label %for.end, label %for.body
+
+; CHECK: ret
+
+for.end: ; preds = %for.body
+ ret void
+}
+
+; void hi2(int *x) {
+; for (int i = 0; i < 500; ++i) {
+; x[3*i] = foo(0);
+; x[3*i+1] = foo(0);
+; x[3*i+2] = foo(0);
+; }
+; }
+
+; Function Attrs: nounwind uwtable
+define void @hi2(i32* nocapture %x) #0 {
+entry:
+ br label %for.body
+
+for.body: ; preds = %for.body, %entry
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %call = tail call i32 @foo(i32 0) #1
+ %0 = mul nsw i64 %indvars.iv, 3
+ %arrayidx = getelementptr inbounds i32* %x, i64 %0
+ store i32 %call, i32* %arrayidx, align 4
+ %call1 = tail call i32 @foo(i32 0) #1
+ %1 = add nsw i64 %0, 1
+ %arrayidx4 = getelementptr inbounds i32* %x, i64 %1
+ store i32 %call1, i32* %arrayidx4, align 4
+ %call5 = tail call i32 @foo(i32 0) #1
+ %2 = add nsw i64 %0, 2
+ %arrayidx9 = getelementptr inbounds i32* %x, i64 %2
+ store i32 %call5, i32* %arrayidx9, align 4
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+ %exitcond = icmp eq i64 %indvars.iv.next, 500
+ br i1 %exitcond, label %for.end, label %for.body
+
+; CHECK-LABEL: @hi2
+
+; CHECK: for.body:
+; CHECK: %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+; CHECK: %call = tail call i32 @foo(i32 0) #1
+; CHECK: %arrayidx = getelementptr inbounds i32* %x, i64 %indvars.iv
+; CHECK: store i32 %call, i32* %arrayidx, align 4
+; CHECK: %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+; CHECK: %exitcond1 = icmp eq i64 %indvars.iv.next, 1500
+; CHECK: br i1 %exitcond1, label %for.end, label %for.body
+
+; CHECK: ret
+
+for.end: ; preds = %for.body
+ ret void
+}
+
+; void goo(float alpha, float *a, float *b) {
+; for (int i = 0; i < 3200; i += 5) {
+; a[i] += alpha * b[i];
+; a[i + 1] += alpha * b[i + 1];
+; a[i + 2] += alpha * b[i + 2];
+; a[i + 3] += alpha * b[i + 3];
+; a[i + 4] += alpha * b[i + 4];
+; }
+; }
+
+; Function Attrs: nounwind uwtable
+define void @goo(float %alpha, float* nocapture %a, float* nocapture readonly %b) #0 {
+entry:
+ br label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %arrayidx = getelementptr inbounds float* %b, i64 %indvars.iv
+ %0 = load float* %arrayidx, align 4
+ %mul = fmul float %0, %alpha
+ %arrayidx2 = getelementptr inbounds float* %a, i64 %indvars.iv
+ %1 = load float* %arrayidx2, align 4
+ %add = fadd float %1, %mul
+ store float %add, float* %arrayidx2, align 4
+ %2 = add nsw i64 %indvars.iv, 1
+ %arrayidx5 = getelementptr inbounds float* %b, i64 %2
+ %3 = load float* %arrayidx5, align 4
+ %mul6 = fmul float %3, %alpha
+ %arrayidx9 = getelementptr inbounds float* %a, i64 %2
+ %4 = load float* %arrayidx9, align 4
+ %add10 = fadd float %4, %mul6
+ store float %add10, float* %arrayidx9, align 4
+ %5 = add nsw i64 %indvars.iv, 2
+ %arrayidx13 = getelementptr inbounds float* %b, i64 %5
+ %6 = load float* %arrayidx13, align 4
+ %mul14 = fmul float %6, %alpha
+ %arrayidx17 = getelementptr inbounds float* %a, i64 %5
+ %7 = load float* %arrayidx17, align 4
+ %add18 = fadd float %7, %mul14
+ store float %add18, float* %arrayidx17, align 4
+ %8 = add nsw i64 %indvars.iv, 3
+ %arrayidx21 = getelementptr inbounds float* %b, i64 %8
+ %9 = load float* %arrayidx21, align 4
+ %mul22 = fmul float %9, %alpha
+ %arrayidx25 = getelementptr inbounds float* %a, i64 %8
+ %10 = load float* %arrayidx25, align 4
+ %add26 = fadd float %10, %mul22
+ store float %add26, float* %arrayidx25, align 4
+ %11 = add nsw i64 %indvars.iv, 4
+ %arrayidx29 = getelementptr inbounds float* %b, i64 %11
+ %12 = load float* %arrayidx29, align 4
+ %mul30 = fmul float %12, %alpha
+ %arrayidx33 = getelementptr inbounds float* %a, i64 %11
+ %13 = load float* %arrayidx33, align 4
+ %add34 = fadd float %13, %mul30
+ store float %add34, float* %arrayidx33, align 4
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 5
+ %14 = trunc i64 %indvars.iv.next to i32
+ %cmp = icmp slt i32 %14, 3200
+ br i1 %cmp, label %for.body, label %for.end
+
+; CHECK-LABEL: @goo
+
+; CHECK: for.body:
+; CHECK: %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
+; CHECK: %arrayidx = getelementptr inbounds float* %b, i64 %indvar
+; CHECK: %0 = load float* %arrayidx, align 4
+; CHECK: %mul = fmul float %0, %alpha
+; CHECK: %arrayidx2 = getelementptr inbounds float* %a, i64 %indvar
+; CHECK: %1 = load float* %arrayidx2, align 4
+; CHECK: %add = fadd float %1, %mul
+; CHECK: store float %add, float* %arrayidx2, align 4
+; CHECK: %indvar.next = add i64 %indvar, 1
+; CHECK: %exitcond = icmp eq i64 %indvar.next, 3200
+; CHECK: br i1 %exitcond, label %for.end, label %for.body
+
+; CHECK: ret
+
+for.end: ; preds = %for.body
+ ret void
+}
+
+; void hoo(float alpha, float *a, float *b, int *ip) {
+; for (int i = 0; i < 3200; i += 5) {
+; a[i] += alpha * b[ip[i]];
+; a[i + 1] += alpha * b[ip[i + 1]];
+; a[i + 2] += alpha * b[ip[i + 2]];
+; a[i + 3] += alpha * b[ip[i + 3]];
+; a[i + 4] += alpha * b[ip[i + 4]];
+; }
+; }
+
+; Function Attrs: nounwind uwtable
+define void @hoo(float %alpha, float* nocapture %a, float* nocapture readonly %b, i32* nocapture readonly %ip) #0 {
+entry:
+ br label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %arrayidx = getelementptr inbounds i32* %ip, i64 %indvars.iv
+ %0 = load i32* %arrayidx, align 4
+ %idxprom1 = sext i32 %0 to i64
+ %arrayidx2 = getelementptr inbounds float* %b, i64 %idxprom1
+ %1 = load float* %arrayidx2, align 4
+ %mul = fmul float %1, %alpha
+ %arrayidx4 = getelementptr inbounds float* %a, i64 %indvars.iv
+ %2 = load float* %arrayidx4, align 4
+ %add = fadd float %2, %mul
+ store float %add, float* %arrayidx4, align 4
+ %3 = add nsw i64 %indvars.iv, 1
+ %arrayidx7 = getelementptr inbounds i32* %ip, i64 %3
+ %4 = load i32* %arrayidx7, align 4
+ %idxprom8 = sext i32 %4 to i64
+ %arrayidx9 = getelementptr inbounds float* %b, i64 %idxprom8
+ %5 = load float* %arrayidx9, align 4
+ %mul10 = fmul float %5, %alpha
+ %arrayidx13 = getelementptr inbounds float* %a, i64 %3
+ %6 = load float* %arrayidx13, align 4
+ %add14 = fadd float %6, %mul10
+ store float %add14, float* %arrayidx13, align 4
+ %7 = add nsw i64 %indvars.iv, 2
+ %arrayidx17 = getelementptr inbounds i32* %ip, i64 %7
+ %8 = load i32* %arrayidx17, align 4
+ %idxprom18 = sext i32 %8 to i64
+ %arrayidx19 = getelementptr inbounds float* %b, i64 %idxprom18
+ %9 = load float* %arrayidx19, align 4
+ %mul20 = fmul float %9, %alpha
+ %arrayidx23 = getelementptr inbounds float* %a, i64 %7
+ %10 = load float* %arrayidx23, align 4
+ %add24 = fadd float %10, %mul20
+ store float %add24, float* %arrayidx23, align 4
+ %11 = add nsw i64 %indvars.iv, 3
+ %arrayidx27 = getelementptr inbounds i32* %ip, i64 %11
+ %12 = load i32* %arrayidx27, align 4
+ %idxprom28 = sext i32 %12 to i64
+ %arrayidx29 = getelementptr inbounds float* %b, i64 %idxprom28
+ %13 = load float* %arrayidx29, align 4
+ %mul30 = fmul float %13, %alpha
+ %arrayidx33 = getelementptr inbounds float* %a, i64 %11
+ %14 = load float* %arrayidx33, align 4
+ %add34 = fadd float %14, %mul30
+ store float %add34, float* %arrayidx33, align 4
+ %15 = add nsw i64 %indvars.iv, 4
+ %arrayidx37 = getelementptr inbounds i32* %ip, i64 %15
+ %16 = load i32* %arrayidx37, align 4
+ %idxprom38 = sext i32 %16 to i64
+ %arrayidx39 = getelementptr inbounds float* %b, i64 %idxprom38
+ %17 = load float* %arrayidx39, align 4
+ %mul40 = fmul float %17, %alpha
+ %arrayidx43 = getelementptr inbounds float* %a, i64 %15
+ %18 = load float* %arrayidx43, align 4
+ %add44 = fadd float %18, %mul40
+ store float %add44, float* %arrayidx43, align 4
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 5
+ %19 = trunc i64 %indvars.iv.next to i32
+ %cmp = icmp slt i32 %19, 3200
+ br i1 %cmp, label %for.body, label %for.end
+
+; CHECK-LABEL: @hoo
+
+; CHECK: for.body:
+; CHECK: %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
+; CHECK: %arrayidx = getelementptr inbounds i32* %ip, i64 %indvar
+; CHECK: %0 = load i32* %arrayidx, align 4
+; CHECK: %idxprom1 = sext i32 %0 to i64
+; CHECK: %arrayidx2 = getelementptr inbounds float* %b, i64 %idxprom1
+; CHECK: %1 = load float* %arrayidx2, align 4
+; CHECK: %mul = fmul float %1, %alpha
+; CHECK: %arrayidx4 = getelementptr inbounds float* %a, i64 %indvar
+; CHECK: %2 = load float* %arrayidx4, align 4
+; CHECK: %add = fadd float %2, %mul
+; CHECK: store float %add, float* %arrayidx4, align 4
+; CHECK: %indvar.next = add i64 %indvar, 1
+; CHECK: %exitcond = icmp eq i64 %indvar.next, 3200
+; CHECK: br i1 %exitcond, label %for.end, label %for.body
+
+; CHECK: ret
+
+for.end: ; preds = %for.body
+ ret void
+}
+
+attributes #0 = { nounwind uwtable }
+attributes #1 = { nounwind }
+
diff --git a/test/Transforms/LoopReroll/reduction.ll b/test/Transforms/LoopReroll/reduction.ll
new file mode 100644
index 000000000000..aed7670b666d
--- /dev/null
+++ b/test/Transforms/LoopReroll/reduction.ll
@@ -0,0 +1,96 @@
+; RUN: opt < %s -loop-reroll -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-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @foo(i32* nocapture readonly %x) #0 {
+entry:
+ br label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %r.029 = phi i32 [ 0, %entry ], [ %add12, %for.body ]
+ %arrayidx = getelementptr inbounds i32* %x, i64 %indvars.iv
+ %0 = load i32* %arrayidx, align 4
+ %add = add nsw i32 %0, %r.029
+ %1 = or i64 %indvars.iv, 1
+ %arrayidx3 = getelementptr inbounds i32* %x, i64 %1
+ %2 = load i32* %arrayidx3, align 4
+ %add4 = add nsw i32 %add, %2
+ %3 = or i64 %indvars.iv, 2
+ %arrayidx7 = getelementptr inbounds i32* %x, i64 %3
+ %4 = load i32* %arrayidx7, align 4
+ %add8 = add nsw i32 %add4, %4
+ %5 = or i64 %indvars.iv, 3
+ %arrayidx11 = getelementptr inbounds i32* %x, i64 %5
+ %6 = load i32* %arrayidx11, align 4
+ %add12 = add nsw i32 %add8, %6
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 4
+ %7 = trunc i64 %indvars.iv.next to i32
+ %cmp = icmp slt i32 %7, 400
+ br i1 %cmp, label %for.body, label %for.end
+
+; CHECK-LABEL: @foo
+
+; CHECK: for.body:
+; CHECK: %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
+; CHECK: %r.029 = phi i32 [ 0, %entry ], [ %add, %for.body ]
+; CHECK: %arrayidx = getelementptr inbounds i32* %x, i64 %indvar
+; CHECK: %0 = load i32* %arrayidx, align 4
+; CHECK: %add = add nsw i32 %0, %r.029
+; CHECK: %indvar.next = add i64 %indvar, 1
+; CHECK: %exitcond = icmp eq i64 %indvar.next, 400
+; CHECK: br i1 %exitcond, label %for.end, label %for.body
+
+; CHECK: ret
+
+for.end: ; preds = %for.body
+ ret i32 %add12
+}
+
+define float @bar(float* nocapture readonly %x) #0 {
+entry:
+ br label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %r.029 = phi float [ 0.0, %entry ], [ %add12, %for.body ]
+ %arrayidx = getelementptr inbounds float* %x, i64 %indvars.iv
+ %0 = load float* %arrayidx, align 4
+ %add = fadd float %0, %r.029
+ %1 = or i64 %indvars.iv, 1
+ %arrayidx3 = getelementptr inbounds float* %x, i64 %1
+ %2 = load float* %arrayidx3, align 4
+ %add4 = fadd float %add, %2
+ %3 = or i64 %indvars.iv, 2
+ %arrayidx7 = getelementptr inbounds float* %x, i64 %3
+ %4 = load float* %arrayidx7, align 4
+ %add8 = fadd float %add4, %4
+ %5 = or i64 %indvars.iv, 3
+ %arrayidx11 = getelementptr inbounds float* %x, i64 %5
+ %6 = load float* %arrayidx11, align 4
+ %add12 = fadd float %add8, %6
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 4
+ %7 = trunc i64 %indvars.iv.next to i32
+ %cmp = icmp slt i32 %7, 400
+ br i1 %cmp, label %for.body, label %for.end
+
+; CHECK-LABEL: @bar
+
+; CHECK: for.body:
+; CHECK: %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
+; CHECK: %r.029 = phi float [ 0.000000e+00, %entry ], [ %add, %for.body ]
+; CHECK: %arrayidx = getelementptr inbounds float* %x, i64 %indvar
+; CHECK: %0 = load float* %arrayidx, align 4
+; CHECK: %add = fadd float %0, %r.029
+; CHECK: %indvar.next = add i64 %indvar, 1
+; CHECK: %exitcond = icmp eq i64 %indvar.next, 400
+; CHECK: br i1 %exitcond, label %for.end, label %for.body
+
+; CHECK: ret
+
+for.end: ; preds = %for.body
+ ret float %add12
+}
+
+attributes #0 = { nounwind readonly uwtable }
+
diff --git a/test/Transforms/LoopRotate/basic.ll b/test/Transforms/LoopRotate/basic.ll
index 78878f9fa663..6b92a6ecac13 100644
--- a/test/Transforms/LoopRotate/basic.ll
+++ b/test/Transforms/LoopRotate/basic.ll
@@ -5,7 +5,7 @@ target triple = "x86_64-apple-darwin10.0.0"
; PR5319 - The "arrayidx" gep should be hoisted, not duplicated. We should
; end up with one phi node.
define void @test1() nounwind ssp {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
entry:
%array = alloca [20 x i32], align 16
br label %for.cond
@@ -33,7 +33,7 @@ for.end: ; preds = %for.cond
declare void @g(i32*)
-; CHECK: @test2
+; CHECK-LABEL: @test2(
define void @test2() nounwind ssp {
entry:
%array = alloca [20 x i32], align 16
diff --git a/test/Transforms/LoopRotate/dbgvalue.ll b/test/Transforms/LoopRotate/dbgvalue.ll
index 6a8d30820f6e..9461980ac08d 100644
--- a/test/Transforms/LoopRotate/dbgvalue.ll
+++ b/test/Transforms/LoopRotate/dbgvalue.ll
@@ -4,7 +4,7 @@ declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
define i32 @tak(i32 %x, i32 %y, i32 %z) nounwind ssp {
-; CHECK: define i32 @tak
+; CHECK-LABEL: define i32 @tak(
; CHECK: entry
; CHECK-NEXT: call void @llvm.dbg.value(metadata !{i32 %x}
@@ -43,7 +43,7 @@ return: ; preds = %if.end
define void @FindFreeHorzSeg(i64 %startCol, i64 %row, i64* %rowStart) {
; Ensure that the loop increment basic block is rotated into the tail of the
; body, even though it contains a debug intrinsic call.
-; CHECK: define void @FindFreeHorzSeg
+; CHECK-LABEL: define void @FindFreeHorzSeg(
; CHECK: %dec = add
; CHECK-NEXT: tail call void @llvm.dbg.value
; CHECK-NEXT: br i1 %tobool, label %for.cond, label %for.end
@@ -68,7 +68,7 @@ for.body:
for.inc:
%dec = add i64 %i.0, -1
- tail call void @llvm.dbg.value(metadata !{i64 %dec}, i64 0, metadata undef)
+ tail call void @llvm.dbg.value(metadata !{i64 %dec}, i64 0, metadata !{metadata !"undef"})
br label %for.cond
for.end:
@@ -77,14 +77,15 @@ for.end:
ret void
}
+!llvm.module.flags = !{!20}
!llvm.dbg.sp = !{!0}
-!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"tak", metadata !"tak", metadata !"", metadata !1, i32 32, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, i32 (i32, i32, i32)* @tak} ; [ DW_TAG_subprogram ]
-!1 = metadata !{i32 589865, metadata !"/Volumes/Lalgate/cj/llvm/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame/recursive.c", metadata !"/Volumes/Lalgate/cj/D/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame", metadata !2} ; [ DW_TAG_file_type ]
-!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"/Volumes/Lalgate/cj/llvm/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame/recursive.c", metadata !"/Volumes/Lalgate/cj/D/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame", metadata !"clang version 2.9 (trunk 125492)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
-!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
+!0 = metadata !{i32 589870, metadata !18, metadata !1, metadata !"tak", metadata !"tak", metadata !"", i32 32, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32, i32, i32)* @tak, null, null, null, i32 0} ; [ DW_TAG_subprogram ] [line 32] [def] [scope 0] [tak]
+!1 = metadata !{i32 589865, metadata !18} ; [ DW_TAG_file_type ]
+!2 = metadata !{i32 589841, metadata !18, i32 12, metadata !"clang version 2.9 (trunk 125492)", i1 true, metadata !"", i32 0, metadata !19, metadata !19, null, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
+!3 = metadata !{i32 589845, metadata !18, metadata !1, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!4 = metadata !{metadata !5}
-!5 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
+!5 = metadata !{i32 589860, null, metadata !2, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!6 = metadata !{i32 590081, metadata !0, metadata !"x", metadata !1, i32 32, metadata !5, i32 0} ; [ DW_TAG_arg_variable ]
!7 = metadata !{i32 32, i32 13, metadata !0, null}
!8 = metadata !{i32 590081, metadata !0, metadata !"y", metadata !1, i32 32, metadata !5, i32 0} ; [ DW_TAG_arg_variable ]
@@ -92,8 +93,11 @@ for.end:
!10 = metadata !{i32 590081, metadata !0, metadata !"z", metadata !1, i32 32, metadata !5, i32 0} ; [ DW_TAG_arg_variable ]
!11 = metadata !{i32 32, i32 27, metadata !0, null}
!12 = metadata !{i32 33, i32 3, metadata !13, null}
-!13 = metadata !{i32 589835, metadata !0, i32 32, i32 30, metadata !1, i32 6} ; [ DW_TAG_lexical_block ]
+!13 = metadata !{i32 589835, metadata !18, metadata !0, i32 32, i32 30, i32 6} ; [ DW_TAG_lexical_block ]
!14 = metadata !{i32 34, i32 5, metadata !15, null}
-!15 = metadata !{i32 589835, metadata !13, i32 33, i32 14, metadata !1, i32 7} ; [ DW_TAG_lexical_block ]
+!15 = metadata !{i32 589835, metadata !18, metadata !13, i32 33, i32 14, i32 7} ; [ DW_TAG_lexical_block ]
!16 = metadata !{i32 36, i32 3, metadata !13, null}
!17 = metadata !{i32 37, i32 1, metadata !13, null}
+!18 = metadata !{metadata !"/Volumes/Lalgate/cj/llvm/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame/recursive.c", metadata !"/Volumes/Lalgate/cj/D/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame"}
+!19 = metadata !{i32 0}
+!20 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/LoopRotate/lit.local.cfg b/test/Transforms/LoopRotate/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/LoopRotate/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/LoopRotate/multiple-exits.ll b/test/Transforms/LoopRotate/multiple-exits.ll
index 675d71f60da4..cc8738e479d4 100644
--- a/test/Transforms/LoopRotate/multiple-exits.ll
+++ b/test/Transforms/LoopRotate/multiple-exits.ll
@@ -32,7 +32,7 @@ return: ; preds = %for.cond, %land.rhs
%retval.0 = phi i32 [ 1000, %land.rhs ], [ %sum.0, %for.cond ]
ret i32 %retval.0
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: for.cond1.preheader:
; CHECK: %sum.04 = phi i32 [ 0, %entry ], [ %sum.1.lcssa, %for.cond.loopexit ]
; CHECK: br label %for.cond1
@@ -73,7 +73,7 @@ return.loopexit: ; preds = %for.cond
return: ; preds = %return.loopexit, %a
ret void
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: if.end:
; CHECK: %inc = add i32 %i.02, 1
; CHECK: %cmp = icmp eq i32 %inc, %x
diff --git a/test/Transforms/LoopRotate/phi-duplicate.ll b/test/Transforms/LoopRotate/phi-duplicate.ll
index 8ad2dce71a65..86a4f2a475fa 100644
--- a/test/Transforms/LoopRotate/phi-duplicate.ll
+++ b/test/Transforms/LoopRotate/phi-duplicate.ll
@@ -29,7 +29,7 @@ for.end: ; preds = %for.cond
}
; Should only end up with one phi.
-; CHECK: define void @test
+; CHECK-LABEL: define void @test(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label %for.body
; CHECK: for.body:
diff --git a/test/Transforms/LoopRotate/simplifylatch.ll b/test/Transforms/LoopRotate/simplifylatch.ll
index 037bb2042f95..d646cb9d6cb2 100644
--- a/test/Transforms/LoopRotate/simplifylatch.ll
+++ b/test/Transforms/LoopRotate/simplifylatch.ll
@@ -3,7 +3,7 @@
@mode_table = global [4 x i32] zeroinitializer ; <[4 x i32]*> [#uses=1]
-; CHECK: @f
+; CHECK-LABEL: @f(
; CHECK-NOT: bb4
define i8 @f() {
entry:
diff --git a/test/Transforms/LoopSimplify/dup-preds.ll b/test/Transforms/LoopSimplify/dup-preds.ll
new file mode 100644
index 000000000000..3d1f1499b11c
--- /dev/null
+++ b/test/Transforms/LoopSimplify/dup-preds.ll
@@ -0,0 +1,46 @@
+; RUN: opt -loop-simplify -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-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-bgq-linux"
+
+define fastcc void @do_update_md([3 x float]* nocapture readonly %x) #0 {
+entry:
+ br i1 undef, label %if.end365, label %lor.lhs.false134
+
+lor.lhs.false134: ; preds = %entry
+ br i1 undef, label %lor.lhs.false138, label %if.end365
+
+lor.lhs.false138: ; preds = %lor.lhs.false134
+ br i1 undef, label %lor.lhs.false142, label %if.end365
+
+lor.lhs.false142: ; preds = %lor.lhs.false138
+ br i1 undef, label %for.body276.lr.ph, label %if.end365
+
+for.body276.lr.ph: ; preds = %lor.lhs.false142
+ switch i16 undef, label %if.then288 [
+ i16 4, label %for.body344
+ i16 2, label %for.body344
+ ]
+
+if.then288: ; preds = %for.body276.lr.ph
+ br label %for.body305
+
+for.body305: ; preds = %for.body305, %if.then288
+ br label %for.body305
+
+for.body344: ; preds = %for.body344, %for.body276.lr.ph, %for.body276.lr.ph
+ %indvar = phi i64 [ %indvar.next, %for.body344 ], [ 0, %for.body276.lr.ph ]
+ %indvars.iv552 = phi i64 [ %indvars.iv.next553, %for.body344 ], [ 0, %for.body276.lr.ph ], [ 0, %for.body276.lr.ph ]
+ %indvars.iv.next553 = add nuw nsw i64 %indvars.iv552, 1
+ %indvar.next = add i64 %indvar, 1
+ br label %for.body344
+
+; CHECK-LABEL: @do_update_md
+; CHECK: %indvars.iv552 = phi i64 [ %indvars.iv.next553, %for.body344 ], [ 0, %for.body344.preheader ]
+; CHECK: ret
+
+if.end365: ; preds = %lor.lhs.false142, %lor.lhs.false138, %lor.lhs.false134, %entry
+ ret void
+}
+
+attributes #0 = { nounwind }
+
diff --git a/test/Transforms/LoopSimplify/lit.local.cfg b/test/Transforms/LoopSimplify/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/LoopSimplify/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/LoopSimplify/preserve-scev.ll b/test/Transforms/LoopSimplify/preserve-scev.ll
index 854c612f02dd..89626b2af518 100644
--- a/test/Transforms/LoopSimplify/preserve-scev.ll
+++ b/test/Transforms/LoopSimplify/preserve-scev.ll
@@ -50,7 +50,7 @@ return: ; preds = %for.body18, %for.bo
declare void @foo() nounwind
; Notify SCEV when removing an ExitingBlock.
-; CHECK: @mergeExit
+; CHECK-LABEL: @mergeExit(
; CHECK: while.cond191:
; CHECK: br i1 %or.cond, label %while.body197
; CHECK-NOT: land.rhs:
diff --git a/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll b/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll
index af3a53708b49..ccf8ebdd5d13 100644
--- a/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll
+++ b/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll
@@ -5,7 +5,7 @@
target triple = "x86-apple-darwin"
; Verify that identical edges are merged. rdar://problem/6453893
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: bb89:
; CHECK: phi i8* [ %lsr.iv.next1, %bbA.bb89_crit_edge ], [ %lsr.iv.next1, %bbB.bb89_crit_edge ]{{$}}
@@ -43,7 +43,7 @@ exit:
}
; Handle single-predecessor phis: PR13756
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: bb89:
; CHECK: phi i8* [ %lsr.iv.next1, %bbA ], [ %lsr.iv.next1, %bbA ], [ %lsr.iv.next1, %bbA ]{{$}}
define i8* @test2() {
diff --git a/test/Transforms/LoopStrengthReduce/2011-10-06-ReusePhi.ll b/test/Transforms/LoopStrengthReduce/2011-10-06-ReusePhi.ll
index 1ee9bb409d91..83963e3126da 100644
--- a/test/Transforms/LoopStrengthReduce/2011-10-06-ReusePhi.ll
+++ b/test/Transforms/LoopStrengthReduce/2011-10-06-ReusePhi.ll
@@ -5,7 +5,7 @@
target triple = "x86-apple-darwin"
-; CHECK: @test
+; CHECK-LABEL: @test(
; multiplies are hoisted out of the loop
; CHECK: while.body.lr.ph:
; CHECK: mul i64
diff --git a/test/Transforms/LoopStrengthReduce/2011-10-13-SCEVChain.ll b/test/Transforms/LoopStrengthReduce/2011-10-13-SCEVChain.ll
index 4718529bfd50..484fefaad413 100644
--- a/test/Transforms/LoopStrengthReduce/2011-10-13-SCEVChain.ll
+++ b/test/Transforms/LoopStrengthReduce/2011-10-13-SCEVChain.ll
@@ -8,7 +8,7 @@ target triple = "x86_64-apple-darwin"
; Verify that -loop-reduce runs without "hanging" and reuses post-inc
; expansions.
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
diff --git a/test/Transforms/LoopStrengthReduce/2011-10-14-IntPtr.ll b/test/Transforms/LoopStrengthReduce/2011-10-14-IntPtr.ll
index 60cc7a516326..068b716651d8 100644
--- a/test/Transforms/LoopStrengthReduce/2011-10-14-IntPtr.ll
+++ b/test/Transforms/LoopStrengthReduce/2011-10-14-IntPtr.ll
@@ -5,7 +5,7 @@
target triple = "x86_64-apple-darwin"
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK: phi
; CHECK-NOT: phi
define void @test(i32 %rowStride) ssp align 2 {
diff --git a/test/Transforms/LoopStrengthReduce/2011-12-19-PostincQuadratic.ll b/test/Transforms/LoopStrengthReduce/2011-12-19-PostincQuadratic.ll
index 392a8bcf89db..6c128feb541c 100644
--- a/test/Transforms/LoopStrengthReduce/2011-12-19-PostincQuadratic.ll
+++ b/test/Transforms/LoopStrengthReduce/2011-12-19-PostincQuadratic.ll
@@ -9,7 +9,7 @@ target triple = "i386-unknown-freebsd10.0"
@b = external global [121 x i32]
-; CHECK: @vb
+; CHECK-LABEL: @vb(
; Outer recurrence:
; CHECK: %lsr.iv1 = phi [121 x i32]*
; Inner recurrence:
diff --git a/test/Transforms/LoopStrengthReduce/2012-01-02-nopreheader.ll b/test/Transforms/LoopStrengthReduce/2012-01-02-nopreheader.ll
index d7f5723188c2..87dd39730ec1 100644
--- a/test/Transforms/LoopStrengthReduce/2012-01-02-nopreheader.ll
+++ b/test/Transforms/LoopStrengthReduce/2012-01-02-nopreheader.ll
@@ -11,7 +11,7 @@ target triple = "i386-apple-darwin"
; cannot find a preheader, so they should be expanded in the loop header
; (bb7.lr.ph.us) below the existing phi i.12.us.
; Currently, LSR won't kick in on such loops.
-; CHECK: @nopreheader
+; CHECK-LABEL: @nopreheader(
; CHECK: bb7.us:
; CHECK-NOT: phi float*
; CHECK: %j.01.us = phi i32
@@ -54,7 +54,7 @@ return: ; preds = %bb9, %bb9.us, %bb10
; In this case, SCEVExpander simply cannot materialize the AddRecExpr
; that LSR picks. We must detect that %bb8.preheader does not have a
; preheader and avoid performing LSR on %bb7.
-; CHECK: @nopreheader2
+; CHECK-LABEL: @nopreheader2(
; CHECK: bb7:
; CHECK: %indvar = phi i32
define fastcc void @nopreheader2([200 x i32]* nocapture %Array2) nounwind {
diff --git a/test/Transforms/LoopStrengthReduce/2012-01-16-nopreheader.ll b/test/Transforms/LoopStrengthReduce/2012-01-16-nopreheader.ll
index 3036a7e38bbf..94a037ec28eb 100644
--- a/test/Transforms/LoopStrengthReduce/2012-01-16-nopreheader.ll
+++ b/test/Transforms/LoopStrengthReduce/2012-01-16-nopreheader.ll
@@ -8,7 +8,7 @@ target triple = "x86_64-apple-darwin10.0.0"
; while.cond197 is a dominates the simplified loop while.cond238 but
; has no with no preheader.
;
-; CHECK: @nopreheader
+; CHECK-LABEL: @nopreheader(
; CHECK: %while.cond238
; CHECK: phi i64
; CHECK-NOT: phi
diff --git a/test/Transforms/LoopStrengthReduce/2012-03-15-nopreheader.ll b/test/Transforms/LoopStrengthReduce/2012-03-15-nopreheader.ll
index 0172492edc99..5fa3838c8297 100644
--- a/test/Transforms/LoopStrengthReduce/2012-03-15-nopreheader.ll
+++ b/test/Transforms/LoopStrengthReduce/2012-03-15-nopreheader.ll
@@ -7,7 +7,7 @@ target triple = "x86_64-apple-darwin10.0.0"
; IVUsers should not consider tmp128 a valid user because it is not in a
; simplified loop nest.
-; CHECK: @nopreheader
+; CHECK-LABEL: @nopreheader(
; CHECK: for.cond:
; CHECK: %tmp128 = add i64 %0, %indvar65
define void @nopreheader(i8* %cmd) nounwind ssp {
diff --git a/test/Transforms/LoopStrengthReduce/2012-07-13-ExpandUDiv.ll b/test/Transforms/LoopStrengthReduce/2012-07-13-ExpandUDiv.ll
index 8bac639ae559..ea1d65b1652e 100644
--- a/test/Transforms/LoopStrengthReduce/2012-07-13-ExpandUDiv.ll
+++ b/test/Transforms/LoopStrengthReduce/2012-07-13-ExpandUDiv.ll
@@ -10,7 +10,7 @@ target triple = "x86_64-apple-darwin"
@g_3 = global i32 0, align 4
; Ensure that %div.i.i.us is not hoisted.
-; CHECK: @main
+; CHECK-LABEL: @main(
; CHECK: for.body.i.i.us:
; CHECK: %div.i.i.i.us
; CHECK: %cmp5.i.i.us
diff --git a/test/Transforms/LoopStrengthReduce/2013-01-05-IndBr.ll b/test/Transforms/LoopStrengthReduce/2013-01-05-IndBr.ll
index bce234cd4066..8a5a0a4c5fcd 100644
--- a/test/Transforms/LoopStrengthReduce/2013-01-05-IndBr.ll
+++ b/test/Transforms/LoopStrengthReduce/2013-01-05-IndBr.ll
@@ -5,7 +5,7 @@
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128"
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK: bb8:
; CHECK-NEXT: phi i8
; CHECK-NEXT: phi i8
diff --git a/test/Transforms/LoopStrengthReduce/2013-01-14-ReuseCast.ll b/test/Transforms/LoopStrengthReduce/2013-01-14-ReuseCast.ll
index 8fbddf8ae4c8..79dbf0d53703 100644
--- a/test/Transforms/LoopStrengthReduce/2013-01-14-ReuseCast.ll
+++ b/test/Transforms/LoopStrengthReduce/2013-01-14-ReuseCast.ll
@@ -8,14 +8,14 @@
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"
; Verify that nothing uses the "dead" ptrtoint from "undef".
-; CHECK: @VerifyDiagnosticConsumerTest
+; CHECK-LABEL: @VerifyDiagnosticConsumerTest(
; CHECK: bb:
-; CHECK: %0 = ptrtoint i8* undef to i64
-; CHECK-NOT: %0
+; "dead" ptrpoint not emitted (or dead code eliminated) with
+; current LSR cost model.
+; CHECK-NOT: = ptrtoint i8* undef to i64
; CHECK: .lr.ph
-; CHECK-NOT: %0
-; CHECK: sub i64 %7, %tmp6
-; CHECK-NOT: %0
+; CHECK: [[TMP:%[^ ]+]] = add i64 %tmp5, 1
+; CHECK: sub i64 [[TMP]], %tmp6
; CHECK: ret void
define void @VerifyDiagnosticConsumerTest() unnamed_addr nounwind uwtable align 2 {
bb:
diff --git a/test/Transforms/LoopStrengthReduce/ARM/ivchain-ARM.ll b/test/Transforms/LoopStrengthReduce/ARM/ivchain-ARM.ll
index ee3cc4dd78fc..ab7f20f0129b 100644
--- a/test/Transforms/LoopStrengthReduce/ARM/ivchain-ARM.ll
+++ b/test/Transforms/LoopStrengthReduce/ARM/ivchain-ARM.ll
@@ -138,7 +138,7 @@ for.end: ; preds = %for.body, %entry
; Consequently, we should *not* form any chains.
;
; A9: foldedidx:
-; A9: ldrb.w {{r[0-9]|lr}}, [{{r[0-9]|lr}}, #3]
+; A9: ldrb{{(.w)?}} {{r[0-9]|lr}}, [{{r[0-9]|lr}}, #3]
define void @foldedidx(i8* nocapture %a, i8* nocapture %b, i8* nocapture %c) nounwind ssp {
entry:
br label %for.body
diff --git a/test/Transforms/LoopStrengthReduce/ARM/lit.local.cfg b/test/Transforms/LoopStrengthReduce/ARM/lit.local.cfg
index bac2ffab31d9..8a3ba96497e7 100644
--- a/test/Transforms/LoopStrengthReduce/ARM/lit.local.cfg
+++ b/test/Transforms/LoopStrengthReduce/ARM/lit.local.cfg
@@ -1,5 +1,3 @@
-config.suffixes = ['.ll']
-
targets = set(config.root.targets_to_build.split())
if not 'ARM' in targets:
config.unsupported = True
diff --git a/test/Transforms/LoopStrengthReduce/X86/2011-07-20-DoubleIV.ll b/test/Transforms/LoopStrengthReduce/X86/2011-07-20-DoubleIV.ll
index a932b4792586..2fe62e39fc93 100644
--- a/test/Transforms/LoopStrengthReduce/X86/2011-07-20-DoubleIV.ll
+++ b/test/Transforms/LoopStrengthReduce/X86/2011-07-20-DoubleIV.ll
@@ -5,7 +5,7 @@
; rdar://9786536
; First, make sure LSR doesn't crash on an empty IVUsers list.
-; CHECK: @dummyIV
+; CHECK-LABEL: @dummyIV(
; CHECK-NOT: phi
; CHECK-NOT: sitofp
; CHECK: br
@@ -24,7 +24,7 @@ for.end:
}
; Now check that the computed double constant is correct.
-; CHECK: @doubleIV
+; CHECK-LABEL: @doubleIV(
; CHECK: phi double [ -3.900000e+01, %entry ]
; CHECK: br
define void @doubleIV() nounwind {
diff --git a/test/Transforms/LoopStrengthReduce/X86/2011-11-29-postincphi.ll b/test/Transforms/LoopStrengthReduce/X86/2011-11-29-postincphi.ll
index cb23ad01a497..8053940df13f 100644
--- a/test/Transforms/LoopStrengthReduce/X86/2011-11-29-postincphi.ll
+++ b/test/Transforms/LoopStrengthReduce/X86/2011-11-29-postincphi.ll
@@ -11,9 +11,9 @@ declare i1 @check() nounwind
; Check that LSR did something close to the behavior at the time of the bug.
; CHECK: @sqlite3DropTriggerPtr
-; CHECK: incq %rax
+; CHECK: incq %r{{[a-d]}}x
; CHECK: jne
-; CHECK: decq %rax
+; CHECK: decq %r{{[a-d]}}x
; CHECK: ret
define i64 @sqlite3DropTriggerPtr() nounwind {
bb:
diff --git a/test/Transforms/LoopStrengthReduce/X86/2011-12-04-loserreg.ll b/test/Transforms/LoopStrengthReduce/X86/2011-12-04-loserreg.ll
index eedfc200f48b..001a1d695c99 100644
--- a/test/Transforms/LoopStrengthReduce/X86/2011-12-04-loserreg.ll
+++ b/test/Transforms/LoopStrengthReduce/X86/2011-12-04-loserreg.ll
@@ -1,6 +1,6 @@
; RUN: opt < %s -loop-reduce -S | FileCheck %s
;
-; Test LSR's ability to prune formulae that refer to nonexistant
+; Test LSR's ability to prune formulae that refer to nonexistent
; AddRecs in other loops.
;
; Unable to reduce this case further because it requires LSR to exceed
@@ -14,7 +14,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-darwin"
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK: for.body:
; CHECK: %lsr.iv
; CHECK-NOT: %dummyout
diff --git a/test/Transforms/LoopStrengthReduce/X86/lit.local.cfg b/test/Transforms/LoopStrengthReduce/X86/lit.local.cfg
index da2db5a45f9c..ba763cf03ffc 100644
--- a/test/Transforms/LoopStrengthReduce/X86/lit.local.cfg
+++ b/test/Transforms/LoopStrengthReduce/X86/lit.local.cfg
@@ -1,5 +1,3 @@
-config.suffixes = ['.ll']
-
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True
diff --git a/test/Transforms/LoopStrengthReduce/addrec-gep-address-space.ll b/test/Transforms/LoopStrengthReduce/addrec-gep-address-space.ll
new file mode 100644
index 000000000000..6333291aa65d
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/addrec-gep-address-space.ll
@@ -0,0 +1,88 @@
+; RUN: opt < %s -loop-reduce -S | FileCheck %s
+; CHECK: bb1:
+; CHECK: load double addrspace(1)* [[IV:%[^,]+]]
+; CHECK: store double {{.*}}, double addrspace(1)* [[IV]]
+
+; CHECK-NOT: cast
+; Make sure the GEP has the right index type
+; CHECK: getelementptr double addrspace(1)* [[IV]], i16 1
+; CHECK: br {{.*}} label %bb1
+
+; Make sure the GEP has the right index type
+; CHECK: getelementptr double addrspace(1)* {{.*}}, i16
+
+
+; This test tests several things. The load and store should use the
+; same address instead of having it computed twice, and SCEVExpander should
+; be able to reconstruct the full getelementptr, despite it having a few
+; obstacles set in its way.
+; We only check that the inner loop (bb1-bb2) is "reduced" because LSR
+; currently only operates on inner loops.
+
+target datalayout = "e-p:64:64:64-p1:16:16:16-n16:32:64"
+
+define void @foo(i64 %n, i64 %m, i64 %o, i64 %q, double addrspace(1)* nocapture %p) nounwind {
+entry:
+ %tmp = icmp sgt i64 %n, 0 ; <i1> [#uses=1]
+ br i1 %tmp, label %bb.nph3, label %return
+
+bb.nph: ; preds = %bb2.preheader
+ %tmp1 = mul i64 %tmp16, %i.02 ; <i64> [#uses=1]
+ %tmp2 = mul i64 %tmp19, %i.02 ; <i64> [#uses=1]
+ br label %bb1
+
+bb1: ; preds = %bb2, %bb.nph
+ %j.01 = phi i64 [ %tmp9, %bb2 ], [ 0, %bb.nph ] ; <i64> [#uses=3]
+ %tmp3 = add i64 %j.01, %tmp1 ; <i64> [#uses=1]
+ %tmp4 = add i64 %j.01, %tmp2 ; <i64> [#uses=1]
+ %z0 = add i64 %tmp3, 5203
+ %tmp5 = getelementptr double addrspace(1)* %p, i64 %z0 ; <double addrspace(1)*> [#uses=1]
+ %tmp6 = load double addrspace(1)* %tmp5, align 8 ; <double> [#uses=1]
+ %tmp7 = fdiv double %tmp6, 2.100000e+00 ; <double> [#uses=1]
+ %z1 = add i64 %tmp4, 5203
+ %tmp8 = getelementptr double addrspace(1)* %p, i64 %z1 ; <double addrspace(1)*> [#uses=1]
+ store double %tmp7, double addrspace(1)* %tmp8, align 8
+ %tmp9 = add i64 %j.01, 1 ; <i64> [#uses=2]
+ br label %bb2
+
+bb2: ; preds = %bb1
+ %tmp10 = icmp slt i64 %tmp9, %m ; <i1> [#uses=1]
+ br i1 %tmp10, label %bb1, label %bb2.bb3_crit_edge
+
+bb2.bb3_crit_edge: ; preds = %bb2
+ br label %bb3
+
+bb3: ; preds = %bb2.preheader, %bb2.bb3_crit_edge
+ %tmp11 = add i64 %i.02, 1 ; <i64> [#uses=2]
+ br label %bb4
+
+bb4: ; preds = %bb3
+ %tmp12 = icmp slt i64 %tmp11, %n ; <i1> [#uses=1]
+ br i1 %tmp12, label %bb2.preheader, label %bb4.return_crit_edge
+
+bb4.return_crit_edge: ; preds = %bb4
+ br label %bb4.return_crit_edge.split
+
+bb4.return_crit_edge.split: ; preds = %bb.nph3, %bb4.return_crit_edge
+ br label %return
+
+bb.nph3: ; preds = %entry
+ %tmp13 = icmp sgt i64 %m, 0 ; <i1> [#uses=1]
+ %tmp14 = mul i64 %n, 37 ; <i64> [#uses=1]
+ %tmp15 = mul i64 %tmp14, %o ; <i64> [#uses=1]
+ %tmp16 = mul i64 %tmp15, %q ; <i64> [#uses=1]
+ %tmp17 = mul i64 %n, 37 ; <i64> [#uses=1]
+ %tmp18 = mul i64 %tmp17, %o ; <i64> [#uses=1]
+ %tmp19 = mul i64 %tmp18, %q ; <i64> [#uses=1]
+ br i1 %tmp13, label %bb.nph3.split, label %bb4.return_crit_edge.split
+
+bb.nph3.split: ; preds = %bb.nph3
+ br label %bb2.preheader
+
+bb2.preheader: ; preds = %bb.nph3.split, %bb4
+ %i.02 = phi i64 [ %tmp11, %bb4 ], [ 0, %bb.nph3.split ] ; <i64> [#uses=3]
+ br i1 true, label %bb.nph, label %bb3
+
+return: ; preds = %bb4.return_crit_edge.split, %entry
+ ret void
+}
diff --git a/test/Transforms/LoopStrengthReduce/address-space-loop.ll b/test/Transforms/LoopStrengthReduce/address-space-loop.ll
new file mode 100644
index 000000000000..9c1b213b5979
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/address-space-loop.ll
@@ -0,0 +1,56 @@
+; RUN: opt -S -loop-reduce < %s | FileCheck %s
+
+; LSR shouldn't consider %t8 to be an interesting user of %t6, and it
+; should be able to form pretty GEPs.
+
+target datalayout = "e-p:64:64:64-p1:16:16:16-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"
+
+; Copy of uglygep with a different address space
+; This tests expandAddToGEP uses the right smaller integer type for
+; another address space
+define void @Z4() nounwind {
+; CHECK-LABEL: @Z4(
+bb:
+ br label %bb3
+
+bb1: ; preds = %bb3
+ br i1 undef, label %bb10, label %bb2
+
+bb2: ; preds = %bb1
+ %t = add i16 %t4, 1 ; <i16> [#uses=1]
+ br label %bb3
+
+bb3: ; preds = %bb2, %bb
+ %t4 = phi i16 [ %t, %bb2 ], [ 0, %bb ] ; <i16> [#uses=3]
+ br label %bb1
+
+; CHECK: bb10:
+; CHECK-NEXT: %t7 = icmp eq i16 %t4, 0
+; Host %t2 computation outside the loop.
+; CHECK-NEXT: [[SCEVGEP:%[^ ]+]] = getelementptr i8 addrspace(1)* undef, i16 %t4
+; CHECK-NEXT: br label %bb14
+bb10: ; preds = %bb9
+ %t7 = icmp eq i16 %t4, 0 ; <i1> [#uses=1]
+ %t3 = add i16 %t4, 16 ; <i16> [#uses=1]
+ br label %bb14
+
+; CHECK: bb14:
+; CHECK-NEXT: store i8 undef, i8 addrspace(1)* [[SCEVGEP]]
+; CHECK-NEXT: %t6 = load float addrspace(1)* addrspace(1)* undef
+; Fold %t3's add within the address.
+; CHECK-NEXT: [[SCEVGEP1:%[^ ]+]] = getelementptr float addrspace(1)* %t6, i16 4
+; CHECK-NEXT: [[SCEVGEP2:%[^ ]+]] = bitcast float addrspace(1)* [[SCEVGEP1]] to i8 addrspace(1)*
+; Use the induction variable (%t4) to access the right element
+; CHECK-NEXT: [[ADDRESS:%[^ ]+]] = getelementptr i8 addrspace(1)* [[SCEVGEP2]], i16 %t4
+; CHECK-NEXT: store i8 undef, i8 addrspace(1)* [[ADDRESS]]
+; CHECK-NEXT: br label %bb14
+bb14: ; preds = %bb14, %bb10
+ %t2 = getelementptr inbounds i8 addrspace(1)* undef, i16 %t4 ; <i8*> [#uses=1]
+ store i8 undef, i8 addrspace(1)* %t2
+ %t6 = load float addrspace(1)* addrspace(1)* undef
+ %t8 = bitcast float addrspace(1)* %t6 to i8 addrspace(1)* ; <i8*> [#uses=1]
+ %t9 = getelementptr inbounds i8 addrspace(1)* %t8, i16 %t3 ; <i8*> [#uses=1]
+ store i8 undef, i8 addrspace(1)* %t9
+ br label %bb14
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/dominate-assert.ll b/test/Transforms/LoopStrengthReduce/dominate-assert.ll
index ff8cab83137b..3ba93ff74835 100644
--- a/test/Transforms/LoopStrengthReduce/dominate-assert.ll
+++ b/test/Transforms/LoopStrengthReduce/dominate-assert.ll
@@ -68,3 +68,46 @@ bb7:
catch i8* null
ret void
}
+
+; PR17425
+define void @i() {
+entry:
+ br label %while.cond
+
+while.cond: ; preds = %while.cond, %entry
+ %c.0 = phi i16* [ undef, %entry ], [ %incdec.ptr, %while.cond ]
+ %incdec.ptr = getelementptr inbounds i16* %c.0, i64 1
+ br i1 undef, label %while.cond1, label %while.cond
+
+while.cond1: ; preds = %while.cond1, %while.cond
+ %c.1 = phi i16* [ %incdec.ptr5, %while.cond1 ], [ %c.0, %while.cond ]
+ %incdec.ptr5 = getelementptr inbounds i16* %c.1, i64 1
+ br i1 undef, label %while.cond7, label %while.cond1
+
+while.cond7: ; preds = %while.cond7, %while.cond1
+ %0 = phi i16* [ %incdec.ptr10, %while.cond7 ], [ %c.1, %while.cond1 ]
+ %incdec.ptr10 = getelementptr inbounds i16* %0, i64 1
+ br i1 undef, label %while.cond12.preheader, label %while.cond7
+
+while.cond12.preheader: ; preds = %while.cond7
+ br i1 undef, label %while.end16, label %while.body13.lr.ph
+
+while.body13: ; preds = %if.else, %while.body13.lr.ph
+ %1 = phi i16* [ %2, %while.body13.lr.ph ], [ %incdec.ptr15, %if.else ]
+ br i1 undef, label %while.cond12.outer.loopexit, label %if.else
+
+while.cond12.outer.loopexit: ; preds = %while.body13
+ br i1 undef, label %while.end16, label %while.body13.lr.ph
+
+while.body13.lr.ph: ; preds = %while.cond12.outer.loopexit, %while.cond12.preheader
+ %2 = phi i16* [ %1, %while.cond12.outer.loopexit ], [ undef, %while.cond12.preheader ]
+ br label %while.body13
+
+if.else: ; preds = %while.body13
+ %incdec.ptr15 = getelementptr inbounds i16* %1, i64 1
+ %cmp = icmp eq i16* %incdec.ptr15, %0
+ br i1 %cmp, label %while.end16, label %while.body13
+
+while.end16: ; preds = %if.else, %while.cond12.outer.loopexit, %while.cond12.preheader
+ ret void
+}
diff --git a/test/Transforms/LoopStrengthReduce/ivchain.ll b/test/Transforms/LoopStrengthReduce/ivchain.ll
index ce7ad198de49..233800b71c64 100644
--- a/test/Transforms/LoopStrengthReduce/ivchain.ll
+++ b/test/Transforms/LoopStrengthReduce/ivchain.ll
@@ -6,7 +6,7 @@
%struct = type { i8*, i8*, i16, i64, i16, i16, i16, i64, i64, i16, i8*, i64, i64, i64 }
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK: for.body:
; CHECK: lsr.iv = phi %struct
; CHECK: br
diff --git a/test/Transforms/LoopStrengthReduce/lit.local.cfg b/test/Transforms/LoopStrengthReduce/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/LoopStrengthReduce/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/LoopStrengthReduce/lsr-expand-quadratic.ll b/test/Transforms/LoopStrengthReduce/lsr-expand-quadratic.ll
new file mode 100644
index 000000000000..255cf41a8174
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/lsr-expand-quadratic.ll
@@ -0,0 +1,42 @@
+; RUN: opt -loop-reduce -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-S128"
+target triple = "x86_64-apple-macosx"
+
+; PR15470: LSR miscompile. The test2 function should return '1'.
+;
+; SCEV expander cannot expand quadratic recurrences outside of the
+; loop. This recurrence depends on %sub.us, so can't be expanded.
+;
+; CHECK-LABEL: @test2
+; CHECK-LABEL: test2.loop:
+; CHECK: %lsr.iv = phi i32 [ %lsr.iv.next, %test2.loop ], [ -16777216, %entry ]
+; CHECK: %lsr.iv.next = add nsw i32 %lsr.iv, 16777216
+;
+; CHECK=LABEL: for.end:
+; CHECK: %sub.cond.us = sub nsw i32 %inc1115.us, %sub.us
+; CHECK: %sext.us = mul i32 %lsr.iv.next, %sub.cond.us
+; CHECK: %f = ashr i32 %sext.us, 24
+; CHECK: ret i32 %f
+define i32 @test2() {
+entry:
+ br label %test2.loop
+
+test2.loop:
+ %inc1115.us = phi i32 [ 0, %entry ], [ %inc11.us, %test2.loop ]
+ %inc11.us = add nsw i32 %inc1115.us, 1
+ %cmp.us = icmp slt i32 %inc11.us, 2
+ br i1 %cmp.us, label %test2.loop, label %for.end
+
+for.end:
+ %tobool.us = icmp eq i32 %inc1115.us, 0
+ %sub.us = select i1 %tobool.us, i32 0, i32 0
+ %mul.us = shl i32 %inc1115.us, 24
+ %sub.cond.us = sub nsw i32 %inc1115.us, %sub.us
+ %sext.us = mul i32 %mul.us, %sub.cond.us
+ %f = ashr i32 %sext.us, 24
+ br label %exit
+
+exit:
+ ret i32 %f
+}
diff --git a/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll b/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll
index 011824116b3a..65aa61fb937e 100644
--- a/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll
+++ b/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll
@@ -1,18 +1,50 @@
-; RUN: opt < %s -analyze -iv-users | grep "{1,+,3,+,2}<%loop> (post-inc with loop %loop)"
+; RUN: opt < %s -analyze -iv-users | FileCheck %s
; The value of %r is dependent on a polynomial iteration expression.
-
+;
+; CHECK-LABEL: IV Users for loop %foo.loop
+; CHECK: {1,+,3,+,2}<%foo.loop>
define i64 @foo(i64 %n) {
entry:
- br label %loop
+ br label %foo.loop
-loop:
- %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %loop ]
+foo.loop:
+ %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %foo.loop ]
%indvar.next = add i64 %indvar, 1
%c = icmp eq i64 %indvar.next, %n
- br i1 %c, label %exit, label %loop
+ br i1 %c, label %exit, label %foo.loop
exit:
%r = mul i64 %indvar.next, %indvar.next
ret i64 %r
}
+
+; PR15470: LSR miscompile. The test2 function should return '1'.
+;
+; SCEV does not know how to denormalize chained recurrences, so make
+; sure they aren't marked as post-inc users.
+;
+; CHECK-LABEL: IV Users for loop %test2.loop
+; CHECK: %sext.us = {0,+,(16777216 + (-16777216 * %sub.us)),+,33554432}<%test2.loop> in %f = ashr i32 %sext.us, 24
+define i32 @test2() {
+entry:
+ br label %test2.loop
+
+test2.loop:
+ %inc1115.us = phi i32 [ 0, %entry ], [ %inc11.us, %test2.loop ]
+ %inc11.us = add nsw i32 %inc1115.us, 1
+ %cmp.us = icmp slt i32 %inc11.us, 2
+ br i1 %cmp.us, label %test2.loop, label %for.end
+
+for.end:
+ %tobool.us = icmp eq i32 %inc1115.us, 0
+ %sub.us = select i1 %tobool.us, i32 0, i32 0
+ %mul.us = shl i32 %inc1115.us, 24
+ %sub.cond.us = sub nsw i32 %inc1115.us, %sub.us
+ %sext.us = mul i32 %mul.us, %sub.cond.us
+ %f = ashr i32 %sext.us, 24
+ br label %exit
+
+exit:
+ ret i32 %f
+}
diff --git a/test/Transforms/LoopStrengthReduce/scaling_factor_cost_crash.ll b/test/Transforms/LoopStrengthReduce/scaling_factor_cost_crash.ll
new file mode 100644
index 000000000000..a652a7661e23
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/scaling_factor_cost_crash.ll
@@ -0,0 +1,68 @@
+; RUN: opt -loop-reduce %s -S -o - | FileCheck %s
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S32"
+target triple = "i686-pc-win32"
+
+; <rdar://problem/14199725> Assertion failed: (CurScaleCost >= 0 && "Legal addressing mode has an illegal cost!")
+; CHECK-LABEL: @scalingFactorCrash(
+define void @scalingFactorCrash() {
+ br i1 undef, label %1, label %24
+
+; <label>:1 ; preds = %0
+ br i1 undef, label %2, label %24
+
+; <label>:2 ; preds = %1
+ br i1 undef, label %3, label %24
+
+; <label>:3 ; preds = %2
+ br i1 undef, label %4, label %24
+
+; <label>:4 ; preds = %3
+ br i1 undef, label %24, label %6
+
+; <label>:5 ; preds = %6
+ br i1 undef, label %24, label %7
+
+; <label>:6 ; preds = %6, %4
+ br i1 undef, label %6, label %5
+
+; <label>:7 ; preds = %9, %5
+ br label %8
+
+; <label>:8 ; preds = %8, %7
+ br i1 undef, label %9, label %8
+
+; <label>:9 ; preds = %8
+ br i1 undef, label %7, label %10
+
+; <label>:10 ; preds = %9
+ br i1 undef, label %24, label %11
+
+; <label>:11 ; preds = %10
+ br i1 undef, label %15, label %13
+
+; <label>:12 ; preds = %14
+ br label %15
+
+; <label>:13 ; preds = %11
+ br label %14
+
+; <label>:14 ; preds = %14, %13
+ br i1 undef, label %14, label %12
+
+; <label>:15 ; preds = %12, %11
+ br i1 undef, label %16, label %24
+
+; <label>:16 ; preds = %16, %15
+ %17 = phi i32 [ %21, %16 ], [ undef, %15 ]
+ %18 = sub i32 %17, 1623127498
+ %19 = getelementptr inbounds i32* undef, i32 %18
+ store i32 undef, i32* %19, align 4
+ %20 = add i32 %17, 1623127499
+ %21 = add i32 %20, -1623127498
+ %22 = add i32 %21, -542963121
+ %23 = icmp ult i32 %22, undef
+ br i1 undef, label %16, label %24
+
+; <label>:24 ; preds = %16, %15, %10, %5, %4, %3, %2, %1, %0
+ ret void
+}
diff --git a/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll b/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll
new file mode 100644
index 000000000000..2c65261f57f5
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll
@@ -0,0 +1,56 @@
+; RUN: opt < %s -loop-reduce -S | FileCheck %s
+
+; LSR shouldn't consider %t8 to be an interesting user of %t6, and it
+; should be able to form pretty GEPs.
+
+target datalayout = "e-p:64:64:64-p1:16:16:16-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"
+
+; Copy of uglygep with a different address space
+; This tests expandAddToGEP uses the right smaller integer type for
+; another address space
+define void @Z4() nounwind {
+; CHECK: define void @Z4
+bb:
+ br label %bb3
+
+bb1: ; preds = %bb3
+ br i1 undef, label %bb10, label %bb2
+
+bb2: ; preds = %bb1
+ %t = add i16 %t4, 1 ; <i16> [#uses=1]
+ br label %bb3
+
+bb3: ; preds = %bb2, %bb
+ %t4 = phi i16 [ %t, %bb2 ], [ 0, %bb ] ; <i16> [#uses=3]
+ br label %bb1
+
+; CHECK: bb10:
+; CHECK-NEXT: %t7 = icmp eq i16 %t4, 0
+; Host %t2 computation outside the loop.
+; CHECK-NEXT: [[SCEVGEP:%[^ ]+]] = getelementptr i8 addrspace(1)* undef, i16 %t4
+; CHECK-NEXT: br label %bb14
+bb10: ; preds = %bb9
+ %t7 = icmp eq i16 %t4, 0 ; <i1> [#uses=1]
+ %t3 = add i16 %t4, 16 ; <i16> [#uses=1]
+ br label %bb14
+
+; CHECK: bb14:
+; CHECK-NEXT: store i8 undef, i8 addrspace(1)* [[SCEVGEP]]
+; CHECK-NEXT: %t6 = load float addrspace(1)* addrspace(1)* undef
+; Fold %t3's add within the address.
+; CHECK-NEXT: [[SCEVGEP1:%[^ ]+]] = getelementptr float addrspace(1)* %t6, i16 4
+; CHECK-NEXT: [[SCEVGEP2:%[^ ]+]] = bitcast float addrspace(1)* [[SCEVGEP1]] to i8 addrspace(1)*
+; Use the induction variable (%t4) to access the right element
+; CHECK-NEXT: [[ADDRESS:%[^ ]+]] = getelementptr i8 addrspace(1)* [[SCEVGEP2]], i16 %t4
+; CHECK-NEXT: store i8 undef, i8 addrspace(1)* [[ADDRESS]]
+; CHECK-NEXT: br label %bb14
+bb14: ; preds = %bb14, %bb10
+ %t2 = getelementptr inbounds i8 addrspace(1)* undef, i16 %t4 ; <i8*> [#uses=1]
+ store i8 undef, i8 addrspace(1)* %t2
+ %t6 = load float addrspace(1)* addrspace(1)* undef
+ %t8 = bitcast float addrspace(1)* %t6 to i8 addrspace(1)* ; <i8*> [#uses=1]
+ %t9 = getelementptr inbounds i8 addrspace(1)* %t8, i16 %t3 ; <i8*> [#uses=1]
+ store i8 undef, i8 addrspace(1)* %t9
+ br label %bb14
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/uglygep.ll b/test/Transforms/LoopStrengthReduce/uglygep.ll
index 8af5cf1dfd72..4562d29a0a20 100644
--- a/test/Transforms/LoopStrengthReduce/uglygep.ll
+++ b/test/Transforms/LoopStrengthReduce/uglygep.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -loop-reduce -S | not grep uglygep
+; RUN: opt < %s -loop-reduce -S | FileCheck %s
; LSR shouldn't consider %t8 to be an interesting user of %t6, and it
; should be able to form pretty GEPs.
@@ -6,6 +6,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
define void @Z4() nounwind {
+; CHECK-LABEL: define void @Z4(
bb:
br label %bb3
@@ -20,11 +21,26 @@ bb3: ; preds = %bb2, %bb
%t4 = phi i64 [ %t, %bb2 ], [ 0, %bb ] ; <i64> [#uses=3]
br label %bb1
+; CHECK: bb10:
+; CHECK-NEXT: %t7 = icmp eq i64 %t4, 0
+; Host %t2 computation outside the loop.
+; CHECK-NEXT: [[SCEVGEP:%[^ ]+]] = getelementptr i8* undef, i64 %t4
+; CHECK-NEXT: br label %bb14
bb10: ; preds = %bb9
%t7 = icmp eq i64 %t4, 0 ; <i1> [#uses=1]
%t3 = add i64 %t4, 16 ; <i64> [#uses=1]
br label %bb14
+; CHECK: bb14:
+; CHECK-NEXT: store i8 undef, i8* [[SCEVGEP]]
+; CHECK-NEXT: %t6 = load float** undef
+; Fold %t3's add within the address.
+; CHECK-NEXT: [[SCEVGEP1:%[^ ]+]] = getelementptr float* %t6, i64 4
+; CHECK-NEXT: [[SCEVGEP2:%[^ ]+]] = bitcast float* [[SCEVGEP1]] to i8*
+; Use the induction variable (%t4) to access the right element
+; CHECK-NEXT: [[ADDRESS:%[^ ]+]] = getelementptr i8* [[SCEVGEP2]], i64 %t4
+; CHECK-NEXT: store i8 undef, i8* [[ADDRESS]]
+; CHECK-NEXT: br label %bb14
bb14: ; preds = %bb14, %bb10
%t2 = getelementptr inbounds i8* undef, i64 %t4 ; <i8*> [#uses=1]
store i8 undef, i8* %t2
@@ -36,9 +52,15 @@ bb14: ; preds = %bb14, %bb10
}
define fastcc void @TransformLine() nounwind {
+; CHECK-LABEL: @TransformLine(
bb:
br label %loop0
+; CHECK: loop0:
+; Induction variable is initialized to -2.
+; CHECK-NEXT: [[PHIIV:%[^ ]+]] = phi i32 [ [[IVNEXT:%[^ ]+]], %loop0 ], [ -2, %bb ]
+; CHECK-NEXT: [[IVNEXT]] = add i32 [[PHIIV]], 1
+; CHECK-NEXT: br i1 false, label %loop0, label %bb0
loop0: ; preds = %loop0, %bb
%i0 = phi i32 [ %i0.next, %loop0 ], [ 0, %bb ] ; <i32> [#uses=2]
%i0.next = add i32 %i0, 1 ; <i32> [#uses=1]
@@ -47,18 +69,52 @@ loop0: ; preds = %loop0, %bb
bb0: ; preds = %loop0
br label %loop1
+; CHECK: loop1:
+; CHECK-NEXT: %i1 = phi i32 [ 0, %bb0 ], [ %i1.next, %bb5 ]
+; IVNEXT covers the uses of %i0 and %t0.
+; Therefore, %t0 has been removed.
+; The critical edge has been split.
+; CHECK-NEXT: br i1 false, label %bb2, label %[[LOOP1BB6:.+]]
loop1: ; preds = %bb5, %bb0
%i1 = phi i32 [ 0, %bb0 ], [ %i1.next, %bb5 ] ; <i32> [#uses=4]
%t0 = add i32 %i0, %i1 ; <i32> [#uses=1]
br i1 false, label %bb2, label %bb6
+; CHECK: bb2:
+; Critical edge split.
+; CHECK-NEXT: br i1 true, label %[[BB2BB6:[^,]+]], label %bb5
bb2: ; preds = %loop1
br i1 true, label %bb6, label %bb5
+; CHECK: bb5:
+; CHECK-NEXT: %i1.next = add i32 %i1, 1
+; CHECK-NEXT: br i1 true, label %[[BB5BB6:[^,]+]], label %loop1
bb5: ; preds = %bb2
%i1.next = add i32 %i1, 1 ; <i32> [#uses=1]
br i1 true, label %bb6, label %loop1
+; bb5 to bb6 split basic block.
+; CHECK: [[BB5BB6]]:
+; CHECK-NEXT: [[INITIALVAL:%[^ ]+]] = add i32 [[IVNEXT]], %i1.next
+; CHECK-NEXT: br label %[[SPLITTOBB6:.+]]
+
+; bb2 to bb6 split basic block.
+; CHECK: [[BB2BB6]]:
+; CHECK-NEXT: br label %[[SPLITTOBB6]]
+
+; Split basic blocks to bb6.
+; CHECK: [[SPLITTOBB6]]:
+; CHECK-NEXT: [[INITP8:%[^ ]+]] = phi i32 [ [[INITIALVAL]], %[[BB5BB6]] ], [ undef, %[[BB2BB6]] ]
+; CHECK-NEXT: [[INITP9:%[^ ]+]] = phi i32 [ undef, %[[BB5BB6]] ], [ %i1, %[[BB2BB6]] ]
+; CHECK-NEXT: br label %bb6
+
+; CHECK: [[LOOP1BB6]]:
+; CHECK-NEXT: br label %bb6
+
+; CHECK: bb6:
+; CHECK-NEXT: %p8 = phi i32 [ undef, %[[LOOP1BB6]] ], [ [[INITP8]], %[[SPLITTOBB6]] ]
+; CHECK-NEXT: %p9 = phi i32 [ %i1, %[[LOOP1BB6]] ], [ [[INITP9]], %[[SPLITTOBB6]] ]
+; CHECK-NEXT: unreachable
bb6: ; preds = %bb5, %bb2, %loop1
%p8 = phi i32 [ %t0, %bb5 ], [ undef, %loop1 ], [ undef, %bb2 ] ; <i32> [#uses=0]
%p9 = phi i32 [ undef, %bb5 ], [ %i1, %loop1 ], [ %i1, %bb2 ] ; <i32> [#uses=0]
diff --git a/test/Transforms/LoopUnroll/2011-08-08-PhiUpdate.ll b/test/Transforms/LoopUnroll/2011-08-08-PhiUpdate.ll
index cd954c80ec37..bf6d6d5989c9 100644
--- a/test/Transforms/LoopUnroll/2011-08-08-PhiUpdate.ll
+++ b/test/Transforms/LoopUnroll/2011-08-08-PhiUpdate.ll
@@ -30,7 +30,7 @@ if.then: ; preds = %if.else, %entry
; PR7318: assertion failure after doing a simple loop unroll
;
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: bb1.bb2_crit_edge:
; CHECK: %.lcssa = phi i32 [ %{{[2468]}}, %bb1{{.*}} ], [ %{{[2468]}}, %bb1{{.*}} ], [ %{{[2468]}}, %bb1{{.*}} ], [ %{{[2468]}}, %bb1{{.*}} ]
; CHECK: bb1.3:
@@ -67,7 +67,7 @@ bb2: ; preds = %bb1.bb2_crit_edge,
; Check phi update for loop with an early-exit.
;
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: return.loopexit:
; CHECK: %tmp7.i.lcssa = phi i32 [ %tmp7.i{{.*}}, %land.lhs.true{{.*}} ], [ %tmp7.i{{.*}}, %land.lhs.true{{.*}} ], [ %tmp7.i{{.*}}, %land.lhs.true{{.*}} ], [ %tmp7.i{{.*}}, %land.lhs.true{{.*}} ]
; CHECK: exit.3:
diff --git a/test/Transforms/LoopUnroll/2011-08-09-PhiUpdate.ll b/test/Transforms/LoopUnroll/2011-08-09-PhiUpdate.ll
index c1221f595ac2..8344993a6fd2 100644
--- a/test/Transforms/LoopUnroll/2011-08-09-PhiUpdate.ll
+++ b/test/Transforms/LoopUnroll/2011-08-09-PhiUpdate.ll
@@ -12,10 +12,10 @@ declare i32 @getval() nounwind
; Check that the loop exit merges values from all the iterations. This
; could be a tad fragile, but it's a good test.
;
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK: return:
; CHECK: %retval.0 = phi i32 [ %tmp7.i, %land.lhs.true ], [ 0, %do.cond ], [ %tmp7.i.1, %land.lhs.true.1 ], [ 0, %do.cond.1 ], [ %tmp7.i.2, %land.lhs.true.2 ], [ 0, %do.cond.2 ], [ %tmp7.i.3, %land.lhs.true.3 ], [ 0, %do.cond.3 ]
-; CHECK-NOT: @bar
+; CHECK-NOT: @bar(
; CHECK: bar.exit.3
define i32 @foo() uwtable ssp align 2 {
entry:
diff --git a/test/Transforms/LoopUnroll/2011-10-01-NoopTrunc.ll b/test/Transforms/LoopUnroll/2011-10-01-NoopTrunc.ll
index 7fb471ea7509..617d4dbe8fdd 100644
--- a/test/Transforms/LoopUnroll/2011-10-01-NoopTrunc.ll
+++ b/test/Transforms/LoopUnroll/2011-10-01-NoopTrunc.ll
@@ -8,7 +8,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
; Check that for.body was unrolled 19 times.
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK: %0 = load
; CHECK: %conv = sext i8 %0 to i32
; CHECK: %add.1 = add nsw i32 %conv.1, %conv
diff --git a/test/Transforms/LoopUnroll/PowerPC/a2-unrolling.ll b/test/Transforms/LoopUnroll/PowerPC/a2-unrolling.ll
new file mode 100644
index 000000000000..17c91e5c07b1
--- /dev/null
+++ b/test/Transforms/LoopUnroll/PowerPC/a2-unrolling.ll
@@ -0,0 +1,48 @@
+; RUN: opt < %s -S -mtriple=powerpc64-unknown-linux-gnu -mcpu=a2 -loop-unroll | FileCheck %s
+define void @unroll_opt_for_size() nounwind optsize {
+entry:
+ br label %loop
+
+loop:
+ %iv = phi i32 [ 0, %entry ], [ %inc, %loop ]
+ %inc = add i32 %iv, 1
+ %exitcnd = icmp uge i32 %inc, 1024
+ br i1 %exitcnd, label %exit, label %loop
+
+exit:
+ ret void
+}
+
+; CHECK-LABEL: @unroll_opt_for_size
+; CHECK: add
+; CHECK-NEXT: add
+; CHECK-NEXT: add
+; CHECK: icmp
+
+define i32 @test(i32* nocapture %a, i32 %n) nounwind uwtable readonly {
+entry:
+ %cmp1 = icmp eq i32 %n, 0
+ br i1 %cmp1, label %for.end, label %for.body
+
+for.body: ; preds = %for.body, %entry
+ %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
+ %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]
+ %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv
+ %0 = load i32* %arrayidx, align 4
+ %add = add nsw i32 %0, %sum.02
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, %n
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
+ ret i32 %sum.0.lcssa
+}
+
+; CHECK-LABEL: @test
+; CHECK: unr.cmp{{.*}}:
+; CHECK: for.body.unr{{.*}}:
+; CHECK: for.body:
+; CHECK: br i1 %exitcond.7, label %for.end.loopexit{{.*}}, label %for.body
+
diff --git a/test/Transforms/LoopUnroll/PowerPC/lit.local.cfg b/test/Transforms/LoopUnroll/PowerPC/lit.local.cfg
new file mode 100644
index 000000000000..2e463005586f
--- /dev/null
+++ b/test/Transforms/LoopUnroll/PowerPC/lit.local.cfg
@@ -0,0 +1,4 @@
+targets = set(config.root.targets_to_build.split())
+if not 'PowerPC' in targets:
+ config.unsupported = True
+
diff --git a/test/Transforms/LoopUnroll/basic.ll b/test/Transforms/LoopUnroll/basic.ll
index ab5bc568ede4..2bfd3e6de8fc 100644
--- a/test/Transforms/LoopUnroll/basic.ll
+++ b/test/Transforms/LoopUnroll/basic.ll
@@ -3,7 +3,7 @@
; This should not unroll since the address of the loop header is taken.
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: store i8* blockaddress(@test1, %l1), i8** %P
; CHECK: l1:
; CHECK-NEXT: phi i32
@@ -25,7 +25,7 @@ l2: ; preds = %l1
; This should not unroll since the call is 'noduplicate'.
-; CHECK: @test2
+; CHECK-LABEL: @test2(
define i32 @test2(i8** %P) nounwind ssp {
entry:
br label %l1
diff --git a/test/Transforms/LoopUnroll/lit.local.cfg b/test/Transforms/LoopUnroll/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/LoopUnroll/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/LoopUnroll/pr14167.ll b/test/Transforms/LoopUnroll/pr14167.ll
index 205ae44b72e4..9aac70115d9a 100644
--- a/test/Transforms/LoopUnroll/pr14167.ll
+++ b/test/Transforms/LoopUnroll/pr14167.ll
@@ -4,7 +4,7 @@ target triple = "powerpc64-bgq-linux"
define void @test1() nounwind {
; Ensure that we don't crash when the trip count == -1.
-; CHECK: @test1
+; CHECK-LABEL: @test1(
entry:
br label %for.cond2.preheader
diff --git a/test/Transforms/LoopUnroll/scevunroll.ll b/test/Transforms/LoopUnroll/scevunroll.ll
index 308a0363165c..c3086e8335f9 100644
--- a/test/Transforms/LoopUnroll/scevunroll.ll
+++ b/test/Transforms/LoopUnroll/scevunroll.ll
@@ -7,7 +7,7 @@
; Completely unroll loops without a canonical IV.
;
-; CHECK: @sansCanonical
+; CHECK-LABEL: @sansCanonical(
; CHECK-NOT: phi
; CHECK-NOT: icmp
; CHECK: ret
@@ -35,7 +35,7 @@ exit:
; latch block. Canonical unrolling incorrectly unrolls it, but SCEV
; unrolling does not.
;
-; CHECK: @earlyLoopTest
+; CHECK-LABEL: @earlyLoopTest(
; CHECK: tail:
; CHECK-NOT: br
; CHECK: br i1 %cmp2, label %loop, label %exit2
@@ -69,7 +69,7 @@ exit2:
; SCEV cannot currently unroll this loop.
; It should ideally detect a trip count of 5.
; rdar:14038809 [SCEV]: Optimize trip count computation for multi-exit loops.
-; CHECK: @multiExit
+; CHECK-LABEL: @multiExit(
; CHECKFIXME: getelementptr i32* %base, i32 10
; CHECKFIXME-NEXT: load i32*
; CHECKFIXME: br i1 false, label %l2.10, label %exit1
@@ -103,7 +103,7 @@ exit2:
; LoopUnroll utility uses this assumption to optimize the latch
; block's branch.
;
-; CHECK: @multiExit
+; CHECK-LABEL: @multiExitIncomplete(
; CHECK: l3:
; CHECK-NOT: br
; CHECK: br i1 %cmp3, label %l1, label %exit3
@@ -137,7 +137,7 @@ exit3:
; When loop unroll merges a loop exit with one of its parent loop's
; exits, SCEV must forget its ExitNotTaken info.
;
-; CHECK: @nestedUnroll
+; CHECK-LABEL: @nestedUnroll(
; CHECK-NOT: br i1
; CHECK: for.body87:
define void @nestedUnroll() nounwind {
@@ -183,7 +183,7 @@ for.body87:
; the loop latch's exit count of zero is an upper bound on the number
; of iterations.
;
-; CHECK: @nsw_latch
+; CHECK-LABEL: @nsw_latch(
; CHECK: for.body:
; CHECK: %b.03 = phi i32 [ 0, %entry ], [ %add, %for.cond ]
; CHECK: return:
diff --git a/test/Transforms/LoopUnroll/unloop.ll b/test/Transforms/LoopUnroll/unloop.ll
index 9a938cc28774..b98b4a3fffba 100644
--- a/test/Transforms/LoopUnroll/unloop.ll
+++ b/test/Transforms/LoopUnroll/unloop.ll
@@ -7,7 +7,7 @@ declare i1 @check() nounwind
; Ensure that tail->inner is removed and rely on verify-loopinfo to
; check soundness.
;
-; CHECK: @skiplevelexit
+; CHECK-LABEL: @skiplevelexit(
; CHECK: tail:
; CHECK-NOT: br
; CHECK: ret void
@@ -38,7 +38,7 @@ exit:
; Ensure that only the middle loop is removed and rely on verify-loopinfo to
; check soundness.
;
-; CHECK: @unloopNested
+; CHECK-LABEL: @unloopNested(
; Outer loop control.
; CHECK: while.body:
; CHECK: br i1 %cmp3, label %if.then, label %if.end
@@ -128,7 +128,7 @@ return:
;
; This test must be disabled until trip count computation can be optimized...
; rdar:14038809 [SCEV]: Optimize trip count computation for multi-exit loops.
-; CHECKFIXME: @unloopDeepNested
+; CHECKFIXME-LABEL: @unloopDeepNested(
; Inner-inner loop control.
; CHECKFIXME: while.cond.us.i:
; CHECKFIXME: br i1 %cmp.us.i, label %next_data.exit, label %while.body.us.i
@@ -248,7 +248,7 @@ while.end:
; Ensure that only the middle loop is removed and rely on verify-loopinfo to
; check soundness.
;
-; CHECK: @unloopIrreducible
+; CHECK-LABEL: @unloopIrreducible(
; Irreducible loop.
; CHECK: for.inc117:
; CHECK: br label %for.cond103t
@@ -326,7 +326,7 @@ for.end166:
; Ensure that only the loop is removed and rely on verify-loopinfo to
; check soundness.
;
-; CHECK: @unloopCriticalEdge
+; CHECK-LABEL: @unloopCriticalEdge(
; CHECK: while.cond.outer.i.loopexit.split:
; CHECK: br label %while.body
; CHECK: while.body:
@@ -431,7 +431,7 @@ return: ; preds = %sw.bb304
}
; PR11335: the most deeply nested block should be removed from the outer loop.
-; CHECK: @removeSubloopBlocks2
+; CHECK-LABEL: @removeSubloopBlocks2(
; CHECK: for.cond3:
; CHECK-NOT: br
; CHECK: ret void
diff --git a/test/Transforms/LoopUnswitch/basictest.ll b/test/Transforms/LoopUnswitch/basictest.ll
index e98d82b6522d..85e44eca9b63 100644
--- a/test/Transforms/LoopUnswitch/basictest.ll
+++ b/test/Transforms/LoopUnswitch/basictest.ll
@@ -32,7 +32,7 @@ return: ; preds = %endif, %then
; This simple test would normally unswitch, but should be inhibited by the presence of
; the noduplicate call.
-; CHECK: @test2
+; CHECK-LABEL: @test2(
define i32 @test2(i32* %var) {
%mem = alloca i32
store i32 2, i32* %mem
diff --git a/test/Transforms/LoopUnswitch/infinite-loop.ll b/test/Transforms/LoopUnswitch/infinite-loop.ll
index 8261e389370a..e79d874d9ca6 100644
--- a/test/Transforms/LoopUnswitch/infinite-loop.ll
+++ b/test/Transforms/LoopUnswitch/infinite-loop.ll
@@ -11,7 +11,7 @@
; STATS: 2 loop-unswitch - Number of branches unswitched
; STATS: 1 loop-unswitch - Number of unswitches that are trivial
-; CHECK: @func_16
+; CHECK-LABEL: @func_16(
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 %a, label %entry.split, label %abort0.split
diff --git a/test/Transforms/LoopUnswitch/lit.local.cfg b/test/Transforms/LoopUnswitch/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/LoopUnswitch/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/LoopVectorize/12-12-11-if-conv.ll b/test/Transforms/LoopVectorize/12-12-11-if-conv.ll
index bab6300f2e7f..1e1396f80085 100644
--- a/test/Transforms/LoopVectorize/12-12-11-if-conv.ll
+++ b/test/Transforms/LoopVectorize/12-12-11-if-conv.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-;CHECK: @foo
+;CHECK-LABEL: @foo(
;CHECK: icmp eq <4 x i32>
;CHECK: select <4 x i1>
;CHECK: ret i32
@@ -30,7 +30,7 @@ if.then: ; preds = %for.body
if.end: ; preds = %for.body, %if.then
%z.0 = phi i32 [ %add1, %if.then ], [ 9, %for.body ]
store i32 %z.0, i32* %arrayidx, align 4
- %indvars.iv.next = add i64 %indvars.iv, 1
+ %indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond = icmp eq i32 %lftr.wideiv, %x
br i1 %exitcond, label %for.end, label %for.body
diff --git a/test/Transforms/LoopVectorize/ARM/arm-unroll.ll b/test/Transforms/LoopVectorize/ARM/arm-unroll.ll
index c8d307f5d443..39363ab2d802 100644
--- a/test/Transforms/LoopVectorize/ARM/arm-unroll.ll
+++ b/test/Transforms/LoopVectorize/ARM/arm-unroll.ll
@@ -4,11 +4,11 @@
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
target triple = "thumbv7-apple-ios3.0.0"
-;CHECK: @foo
+;CHECK-LABEL: @foo(
;CHECK: load <4 x i32>
;CHECK-NOT: load <4 x i32>
;CHECK: ret
-;SWIFT: @foo
+;SWIFT-LABEL: @foo(
;SWIFT: load <4 x i32>
;SWIFT: load <4 x i32>
;SWIFT: ret
diff --git a/test/Transforms/LoopVectorize/ARM/gather-cost.ll b/test/Transforms/LoopVectorize/ARM/gather-cost.ll
new file mode 100644
index 000000000000..239a28fa6c7c
--- /dev/null
+++ b/test/Transforms/LoopVectorize/ARM/gather-cost.ll
@@ -0,0 +1,88 @@
+; RUN: opt -loop-vectorize -mtriple=thumbv7s-apple-ios6.0.0 -S < %s | FileCheck %s
+
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
+
+@kernel = global [512 x float] zeroinitializer, align 4
+@kernel2 = global [512 x float] zeroinitializer, align 4
+@kernel3 = global [512 x float] zeroinitializer, align 4
+@kernel4 = global [512 x float] zeroinitializer, align 4
+@src_data = global [1536 x float] zeroinitializer, align 4
+@r_ = global i8 0, align 4
+@g_ = global i8 0, align 4
+@b_ = global i8 0, align 4
+
+; We don't want to vectorize most loops containing gathers because they are
+; expensive. This function represents a point where vectorization starts to
+; become beneficial.
+; Make sure we are conservative and don't vectorize it.
+; CHECK-NOT: <2 x float>
+; CHECK-NOT: <4 x float>
+
+define void @_Z4testmm(i32 %size, i32 %offset) {
+entry:
+ %cmp53 = icmp eq i32 %size, 0
+ br i1 %cmp53, label %for.end, label %for.body.lr.ph
+
+for.body.lr.ph:
+ br label %for.body
+
+for.body:
+ %r.057 = phi float [ 0.000000e+00, %for.body.lr.ph ], [ %add10, %for.body ]
+ %g.056 = phi float [ 0.000000e+00, %for.body.lr.ph ], [ %add20, %for.body ]
+ %v.055 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
+ %b.054 = phi float [ 0.000000e+00, %for.body.lr.ph ], [ %add30, %for.body ]
+ %add = add i32 %v.055, %offset
+ %mul = mul i32 %add, 3
+ %arrayidx = getelementptr inbounds [1536 x float]* @src_data, i32 0, i32 %mul
+ %0 = load float* %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds [512 x float]* @kernel, i32 0, i32 %v.055
+ %1 = load float* %arrayidx2, align 4
+ %mul3 = fmul fast float %0, %1
+ %arrayidx4 = getelementptr inbounds [512 x float]* @kernel2, i32 0, i32 %v.055
+ %2 = load float* %arrayidx4, align 4
+ %mul5 = fmul fast float %mul3, %2
+ %arrayidx6 = getelementptr inbounds [512 x float]* @kernel3, i32 0, i32 %v.055
+ %3 = load float* %arrayidx6, align 4
+ %mul7 = fmul fast float %mul5, %3
+ %arrayidx8 = getelementptr inbounds [512 x float]* @kernel4, i32 0, i32 %v.055
+ %4 = load float* %arrayidx8, align 4
+ %mul9 = fmul fast float %mul7, %4
+ %add10 = fadd fast float %r.057, %mul9
+ %arrayidx.sum = add i32 %mul, 1
+ %arrayidx11 = getelementptr inbounds [1536 x float]* @src_data, i32 0, i32 %arrayidx.sum
+ %5 = load float* %arrayidx11, align 4
+ %mul13 = fmul fast float %1, %5
+ %mul15 = fmul fast float %2, %mul13
+ %mul17 = fmul fast float %3, %mul15
+ %mul19 = fmul fast float %4, %mul17
+ %add20 = fadd fast float %g.056, %mul19
+ %arrayidx.sum52 = add i32 %mul, 2
+ %arrayidx21 = getelementptr inbounds [1536 x float]* @src_data, i32 0, i32 %arrayidx.sum52
+ %6 = load float* %arrayidx21, align 4
+ %mul23 = fmul fast float %1, %6
+ %mul25 = fmul fast float %2, %mul23
+ %mul27 = fmul fast float %3, %mul25
+ %mul29 = fmul fast float %4, %mul27
+ %add30 = fadd fast float %b.054, %mul29
+ %inc = add i32 %v.055, 1
+ %exitcond = icmp ne i32 %inc, %size
+ br i1 %exitcond, label %for.body, label %for.cond.for.end_crit_edge
+
+for.cond.for.end_crit_edge:
+ %add30.lcssa = phi float [ %add30, %for.body ]
+ %add20.lcssa = phi float [ %add20, %for.body ]
+ %add10.lcssa = phi float [ %add10, %for.body ]
+ %phitmp = fptoui float %add10.lcssa to i8
+ %phitmp60 = fptoui float %add20.lcssa to i8
+ %phitmp61 = fptoui float %add30.lcssa to i8
+ br label %for.end
+
+for.end:
+ %r.0.lcssa = phi i8 [ %phitmp, %for.cond.for.end_crit_edge ], [ 0, %entry ]
+ %g.0.lcssa = phi i8 [ %phitmp60, %for.cond.for.end_crit_edge ], [ 0, %entry ]
+ %b.0.lcssa = phi i8 [ %phitmp61, %for.cond.for.end_crit_edge ], [ 0, %entry ]
+ store i8 %r.0.lcssa, i8* @r_, align 4
+ store i8 %g.0.lcssa, i8* @g_, align 4
+ store i8 %b.0.lcssa, i8* @b_, align 4
+ ret void
+}
diff --git a/test/Transforms/LoopVectorize/ARM/gcc-examples.ll b/test/Transforms/LoopVectorize/ARM/gcc-examples.ll
index 6a68e81bcae0..f2bd0ac200d4 100644
--- a/test/Transforms/LoopVectorize/ARM/gcc-examples.ll
+++ b/test/Transforms/LoopVectorize/ARM/gcc-examples.ll
@@ -8,7 +8,7 @@ target triple = "thumbv7-apple-ios3.0.0"
@a = common global [2048 x i32] zeroinitializer, align 16
; Select VF = 8;
-;CHECK: @example1
+;CHECK-LABEL: @example1(
;CHECK: load <4 x i32>
;CHECK: add nsw <4 x i32>
;CHECK: store <4 x i32>
@@ -34,7 +34,7 @@ define void @example1() nounwind uwtable ssp {
ret void
}
-;CHECK: @example10b
+;CHECK-LABEL: @example10b(
;CHECK: load <4 x i16>
;CHECK: sext <4 x i16>
;CHECK: store <4 x i32>
diff --git a/test/Transforms/LoopVectorize/ARM/lit.local.cfg b/test/Transforms/LoopVectorize/ARM/lit.local.cfg
index cb77b09ef4ad..8a3ba96497e7 100644
--- a/test/Transforms/LoopVectorize/ARM/lit.local.cfg
+++ b/test/Transforms/LoopVectorize/ARM/lit.local.cfg
@@ -1,5 +1,3 @@
-config.suffixes = ['.ll', '.c', '.cpp']
-
targets = set(config.root.targets_to_build.split())
if not 'ARM' in targets:
config.unsupported = True
diff --git a/test/Transforms/LoopVectorize/ARM/width-detect.ll b/test/Transforms/LoopVectorize/ARM/width-detect.ll
index c0795b6a79af..99d7fa75ee33 100644
--- a/test/Transforms/LoopVectorize/ARM/width-detect.ll
+++ b/test/Transforms/LoopVectorize/ARM/width-detect.ll
@@ -3,27 +3,27 @@
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
target triple = "thumbv7-apple-ios3.0.0"
-;CHECK:foo_F64
-;CHECK: <2 x double>
+;CHECK:foo_F32
+;CHECK: <4 x float>
;CHECK:ret
-define double @foo_F64(double* nocapture %A, i32 %n) nounwind uwtable readonly ssp {
+define float @foo_F32(float* nocapture %A, i32 %n) nounwind uwtable readonly ssp {
%1 = icmp sgt i32 %n, 0
br i1 %1, label %.lr.ph, label %._crit_edge
.lr.ph: ; preds = %0, %.lr.ph
%indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
- %prod.01 = phi double [ %4, %.lr.ph ], [ 0.000000e+00, %0 ]
- %2 = getelementptr inbounds double* %A, i64 %indvars.iv
- %3 = load double* %2, align 8
- %4 = fmul fast double %prod.01, %3
+ %prod.01 = phi float [ %4, %.lr.ph ], [ 0.000000e+00, %0 ]
+ %2 = getelementptr inbounds float* %A, i64 %indvars.iv
+ %3 = load float* %2, align 8
+ %4 = fmul fast float %prod.01, %3
%indvars.iv.next = add i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond = icmp eq i32 %lftr.wideiv, %n
br i1 %exitcond, label %._crit_edge, label %.lr.ph
._crit_edge: ; preds = %.lr.ph, %0
- %prod.0.lcssa = phi double [ 0.000000e+00, %0 ], [ %4, %.lr.ph ]
- ret double %prod.0.lcssa
+ %prod.0.lcssa = phi float [ 0.000000e+00, %0 ], [ %4, %.lr.ph ]
+ ret float %prod.0.lcssa
}
;CHECK:foo_I8
diff --git a/test/Transforms/LoopVectorize/X86/already-vectorized.ll b/test/Transforms/LoopVectorize/X86/already-vectorized.ll
new file mode 100644
index 000000000000..885418c0fdd9
--- /dev/null
+++ b/test/Transforms/LoopVectorize/X86/already-vectorized.ll
@@ -0,0 +1,46 @@
+; RUN: opt < %s -debug-only=loop-vectorize -O3 -S 2>&1 | FileCheck %s
+; REQUIRES: asserts
+; We want to make sure that we don't even try to vectorize loops again
+; The vectorizer used to mark the un-vectorized loop only as already vectorized
+; thus, trying to vectorize the vectorized loop again
+
+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-unknown-linux-gnu"
+
+@a = external global [255 x i32]
+
+; Function Attrs: nounwind readonly uwtable
+define i32 @vect() {
+; CHECK: LV: Checking a loop in "vect"
+entry:
+ br label %for.body
+
+for.body: ; preds = %for.body, %entry
+; We need to make sure we did vectorize the loop
+; CHECK: LV: Found a loop: for.body
+; CHECK: LV: We can vectorize this loop!
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %red.05 = phi i32 [ 0, %entry ], [ %add, %for.body ]
+ %arrayidx = getelementptr inbounds [255 x i32]* @a, i64 0, i64 %indvars.iv
+ %0 = load i32* %arrayidx, align 4
+ %add = add nsw i32 %0, %red.05
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+ %exitcond = icmp eq i64 %indvars.iv.next, 255
+ br i1 %exitcond, label %for.end, label %for.body
+
+; If it did, we have two loops:
+; CHECK: vector.body:
+; CHECK: br {{.*}} label %vector.body, !llvm.loop [[vect:![0-9]+]]
+; CHECK: for.body:
+; CHECK: br {{.*}} label %for.body, !llvm.loop [[scalar:![0-9]+]]
+
+for.end: ; preds = %for.body
+ ret i32 %add
+}
+
+; Now, we check for the Hint metadata
+; CHECK: [[vect]] = metadata !{metadata [[vect]], metadata [[width:![0-9]+]], metadata [[unroll:![0-9]+]]}
+; CHECK: [[width]] = metadata !{metadata !"llvm.vectorizer.width", i32 1}
+; CHECK: [[unroll]] = metadata !{metadata !"llvm.vectorizer.unroll", i32 1}
+; CHECK: [[scalar]] = metadata !{metadata [[scalar]], metadata [[width]], metadata [[unroll]]}
+
diff --git a/test/Transforms/LoopVectorize/X86/avx1.ll b/test/Transforms/LoopVectorize/X86/avx1.ll
index 6c0366eae973..01c912567b61 100644
--- a/test/Transforms/LoopVectorize/X86/avx1.ll
+++ b/test/Transforms/LoopVectorize/X86/avx1.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-;CHECK: @read_mod_write_single_ptr
+;CHECK-LABEL: @read_mod_write_single_ptr(
;CHECK: load <8 x float>
;CHECK: ret i32
define i32 @read_mod_write_single_ptr(float* nocapture %a, i32 %n) nounwind uwtable ssp {
@@ -26,7 +26,7 @@ define i32 @read_mod_write_single_ptr(float* nocapture %a, i32 %n) nounwind uwta
}
-;CHECK: @read_mod_i64
+;CHECK-LABEL: @read_mod_i64(
;CHECK: load <2 x i64>
;CHECK: ret i32
define i32 @read_mod_i64(i64* nocapture %a, i32 %n) nounwind uwtable ssp {
diff --git a/test/Transforms/LoopVectorize/X86/conversion-cost.ll b/test/Transforms/LoopVectorize/X86/conversion-cost.ll
index 760d28deaf27..0af562db8479 100644
--- a/test/Transforms/LoopVectorize/X86/conversion-cost.ll
+++ b/test/Transforms/LoopVectorize/X86/conversion-cost.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-;CHECK: @conversion_cost1
+;CHECK-LABEL: @conversion_cost1(
;CHECK: store <32 x i8>
;CHECK: ret
define i32 @conversion_cost1(i32 %n, i8* nocapture %A, float* nocapture %B) nounwind uwtable ssp {
@@ -24,7 +24,7 @@ define i32 @conversion_cost1(i32 %n, i8* nocapture %A, float* nocapture %B) noun
ret i32 undef
}
-;CHECK: @conversion_cost2
+;CHECK-LABEL: @conversion_cost2(
;CHECK: <2 x float>
;CHECK: ret
define i32 @conversion_cost2(i32 %n, i8* nocapture %A, float* nocapture %B) nounwind uwtable ssp {
diff --git a/test/Transforms/LoopVectorize/X86/cost-model.ll b/test/Transforms/LoopVectorize/X86/cost-model.ll
index b7f479acf962..98718e1e9708 100644
--- a/test/Transforms/LoopVectorize/X86/cost-model.ll
+++ b/test/Transforms/LoopVectorize/X86/cost-model.ll
@@ -9,7 +9,7 @@ target triple = "x86_64-apple-macosx10.8.0"
@a = common global [2048 x i32] zeroinitializer, align 16
; The program below gathers and scatters data. We better not vectorize it.
-;CHECK: cost_model_1
+;CHECK-LABEL: @cost_model_1(
;CHECK-NOT: <2 x i32>
;CHECK-NOT: <4 x i32>
;CHECK-NOT: <8 x i32>
diff --git a/test/Transforms/LoopVectorize/X86/gather-cost.ll b/test/Transforms/LoopVectorize/X86/gather-cost.ll
new file mode 100644
index 000000000000..09363d65eefc
--- /dev/null
+++ b/test/Transforms/LoopVectorize/X86/gather-cost.ll
@@ -0,0 +1,86 @@
+; RUN: opt -loop-vectorize -mtriple=x86_64-apple-macosx -S -mcpu=corei7-avx < %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-S128"
+
+@kernel = global [512 x float] zeroinitializer, align 16
+@kernel2 = global [512 x float] zeroinitializer, align 16
+@kernel3 = global [512 x float] zeroinitializer, align 16
+@kernel4 = global [512 x float] zeroinitializer, align 16
+@src_data = global [1536 x float] zeroinitializer, align 16
+@r_ = global i8 0, align 1
+@g_ = global i8 0, align 1
+@b_ = global i8 0, align 1
+
+; We don't want to vectorize most loops containing gathers because they are
+; expensive. This function represents a point where vectorization starts to
+; become beneficial.
+; Make sure we are conservative and don't vectorize it.
+; CHECK-NOT: x float>
+
+define void @_Z4testmm(i64 %size, i64 %offset) {
+entry:
+ %cmp53 = icmp eq i64 %size, 0
+ br i1 %cmp53, label %for.end, label %for.body.lr.ph
+
+for.body.lr.ph:
+ br label %for.body
+
+for.body:
+ %r.057 = phi float [ 0.000000e+00, %for.body.lr.ph ], [ %add10, %for.body ]
+ %g.056 = phi float [ 0.000000e+00, %for.body.lr.ph ], [ %add20, %for.body ]
+ %v.055 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
+ %b.054 = phi float [ 0.000000e+00, %for.body.lr.ph ], [ %add30, %for.body ]
+ %add = add i64 %v.055, %offset
+ %mul = mul i64 %add, 3
+ %arrayidx = getelementptr inbounds [1536 x float]* @src_data, i64 0, i64 %mul
+ %0 = load float* %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds [512 x float]* @kernel, i64 0, i64 %v.055
+ %1 = load float* %arrayidx2, align 4
+ %mul3 = fmul fast float %0, %1
+ %arrayidx4 = getelementptr inbounds [512 x float]* @kernel2, i64 0, i64 %v.055
+ %2 = load float* %arrayidx4, align 4
+ %mul5 = fmul fast float %mul3, %2
+ %arrayidx6 = getelementptr inbounds [512 x float]* @kernel3, i64 0, i64 %v.055
+ %3 = load float* %arrayidx6, align 4
+ %mul7 = fmul fast float %mul5, %3
+ %arrayidx8 = getelementptr inbounds [512 x float]* @kernel4, i64 0, i64 %v.055
+ %4 = load float* %arrayidx8, align 4
+ %mul9 = fmul fast float %mul7, %4
+ %add10 = fadd fast float %r.057, %mul9
+ %arrayidx.sum = add i64 %mul, 1
+ %arrayidx11 = getelementptr inbounds [1536 x float]* @src_data, i64 0, i64 %arrayidx.sum
+ %5 = load float* %arrayidx11, align 4
+ %mul13 = fmul fast float %1, %5
+ %mul15 = fmul fast float %2, %mul13
+ %mul17 = fmul fast float %3, %mul15
+ %mul19 = fmul fast float %4, %mul17
+ %add20 = fadd fast float %g.056, %mul19
+ %arrayidx.sum52 = add i64 %mul, 2
+ %arrayidx21 = getelementptr inbounds [1536 x float]* @src_data, i64 0, i64 %arrayidx.sum52
+ %6 = load float* %arrayidx21, align 4
+ %mul23 = fmul fast float %1, %6
+ %mul25 = fmul fast float %2, %mul23
+ %mul27 = fmul fast float %3, %mul25
+ %mul29 = fmul fast float %4, %mul27
+ %add30 = fadd fast float %b.054, %mul29
+ %inc = add i64 %v.055, 1
+ %exitcond = icmp ne i64 %inc, %size
+ br i1 %exitcond, label %for.body, label %for.cond.for.end_crit_edge
+
+for.cond.for.end_crit_edge:
+ %add30.lcssa = phi float [ %add30, %for.body ]
+ %add20.lcssa = phi float [ %add20, %for.body ]
+ %add10.lcssa = phi float [ %add10, %for.body ]
+ %phitmp = fptoui float %add10.lcssa to i8
+ %phitmp60 = fptoui float %add20.lcssa to i8
+ %phitmp61 = fptoui float %add30.lcssa to i8
+ br label %for.end
+
+for.end:
+ %r.0.lcssa = phi i8 [ %phitmp, %for.cond.for.end_crit_edge ], [ 0, %entry ]
+ %g.0.lcssa = phi i8 [ %phitmp60, %for.cond.for.end_crit_edge ], [ 0, %entry ]
+ %b.0.lcssa = phi i8 [ %phitmp61, %for.cond.for.end_crit_edge ], [ 0, %entry ]
+ store i8 %r.0.lcssa, i8* @r_, align 1
+ store i8 %g.0.lcssa, i8* @g_, align 1
+ store i8 %b.0.lcssa, i8* @b_, align 1
+ ret void
+}
diff --git a/test/Transforms/LoopVectorize/X86/gcc-examples.ll b/test/Transforms/LoopVectorize/X86/gcc-examples.ll
index d2d0eac305f5..e1113fdd911c 100644
--- a/test/Transforms/LoopVectorize/X86/gcc-examples.ll
+++ b/test/Transforms/LoopVectorize/X86/gcc-examples.ll
@@ -9,13 +9,13 @@ target triple = "x86_64-apple-macosx10.8.0"
@a = common global [2048 x i32] zeroinitializer, align 16
; Select VF = 8;
-;CHECK: @example1
+;CHECK-LABEL: @example1(
;CHECK: load <4 x i32>
;CHECK: add nsw <4 x i32>
;CHECK: store <4 x i32>
;CHECK: ret void
-;UNROLL: @example1
+;UNROLL-LABEL: @example1(
;UNROLL: load <4 x i32>
;UNROLL: load <4 x i32>
;UNROLL: add nsw <4 x i32>
@@ -45,12 +45,12 @@ define void @example1() nounwind uwtable ssp {
}
; Select VF=4 because sext <8 x i1> to <8 x i32> is expensive.
-;CHECK: @example10b
+;CHECK-LABEL: @example10b(
;CHECK: load <4 x i16>
;CHECK: sext <4 x i16>
;CHECK: store <4 x i32>
;CHECK: ret void
-;UNROLL: @example10b
+;UNROLL-LABEL: @example10b(
;UNROLL: load <4 x i16>
;UNROLL: load <4 x i16>
;UNROLL: store <4 x i32>
diff --git a/test/Transforms/LoopVectorize/X86/illegal-parallel-loop-uniform-write.ll b/test/Transforms/LoopVectorize/X86/illegal-parallel-loop-uniform-write.ll
index 47a5e7aee4c1..d6120e76cc0b 100644
--- a/test/Transforms/LoopVectorize/X86/illegal-parallel-loop-uniform-write.ll
+++ b/test/Transforms/LoopVectorize/X86/illegal-parallel-loop-uniform-write.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-;CHECK: @foo
+;CHECK-LABEL: @foo(
;CHECK-NOT: <4 x i32>
;CHECK: ret void
@@ -21,7 +21,7 @@ for.end.us: ; preds = %for.body3.us
%indvars.iv.next34 = add i64 %indvars.iv33, 1
%lftr.wideiv35 = trunc i64 %indvars.iv.next34 to i32
%exitcond36 = icmp eq i32 %lftr.wideiv35, %m
- br i1 %exitcond36, label %for.end15, label %for.body3.lr.ph.us, !llvm.loop.parallel !5
+ br i1 %exitcond36, label %for.end15, label %for.body3.lr.ph.us, !llvm.loop !5
for.body3.us: ; preds = %for.body3.us, %for.body3.lr.ph.us
%indvars.iv29 = phi i64 [ 0, %for.body3.lr.ph.us ], [ %indvars.iv.next30, %for.body3.us ]
@@ -35,7 +35,7 @@ for.body3.us: ; preds = %for.body3.us, %for.
%indvars.iv.next30 = add i64 %indvars.iv29, 1
%lftr.wideiv31 = trunc i64 %indvars.iv.next30 to i32
%exitcond32 = icmp eq i32 %lftr.wideiv31, %m
- br i1 %exitcond32, label %for.end.us, label %for.body3.us, !llvm.loop.parallel !4
+ br i1 %exitcond32, label %for.end.us, label %for.body3.us, !llvm.loop !4
for.body3.lr.ph.us: ; preds = %for.end.us, %entry
%indvars.iv33 = phi i64 [ %indvars.iv.next34, %for.end.us ], [ 0, %entry ]
diff --git a/test/Transforms/LoopVectorize/X86/lit.local.cfg b/test/Transforms/LoopVectorize/X86/lit.local.cfg
index a8ad0f1a28b2..ba763cf03ffc 100644
--- a/test/Transforms/LoopVectorize/X86/lit.local.cfg
+++ b/test/Transforms/LoopVectorize/X86/lit.local.cfg
@@ -1,5 +1,3 @@
-config.suffixes = ['.ll', '.c', '.cpp']
-
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True
diff --git a/test/Transforms/LoopVectorize/X86/parallel-loops-after-reg2mem.ll b/test/Transforms/LoopVectorize/X86/parallel-loops-after-reg2mem.ll
index f904a8e0b117..2c47fcb4d389 100644
--- a/test/Transforms/LoopVectorize/X86/parallel-loops-after-reg2mem.ll
+++ b/test/Transforms/LoopVectorize/X86/parallel-loops-after-reg2mem.ll
@@ -35,7 +35,7 @@ for.body: ; preds = %for.body.for.body_c
%indvars.iv.next.reload = load i64* %indvars.iv.next.reg2mem
%lftr.wideiv = trunc i64 %indvars.iv.next.reload to i32
%exitcond = icmp eq i32 %lftr.wideiv, 512
- br i1 %exitcond, label %for.end, label %for.body.for.body_crit_edge, !llvm.loop.parallel !3
+ br i1 %exitcond, label %for.end, label %for.body.for.body_crit_edge, !llvm.loop !3
for.body.for.body_crit_edge: ; preds = %for.body
%indvars.iv.next.reload2 = load i64* %indvars.iv.next.reg2mem
diff --git a/test/Transforms/LoopVectorize/X86/parallel-loops.ll b/test/Transforms/LoopVectorize/X86/parallel-loops.ll
index 3f1a071e69fa..7e156a9edad4 100644
--- a/test/Transforms/LoopVectorize/X86/parallel-loops.ll
+++ b/test/Transforms/LoopVectorize/X86/parallel-loops.ll
@@ -12,7 +12,7 @@ target triple = "x86_64-unknown-linux-gnu"
; }
;}
-;CHECK: @loop
+;CHECK-LABEL: @loop(
;CHECK-NOT: <4 x i32>
define void @loop(i32* nocapture %a, i32* nocapture %b) nounwind uwtable {
entry:
@@ -42,7 +42,7 @@ for.end: ; preds = %for.body
; The same loop with parallel loop metadata added to the loop branch
; and the memory instructions.
-;CHECK: @parallel_loop
+;CHECK-LABEL: @parallel_loop(
;CHECK: <4 x i32>
define void @parallel_loop(i32* nocapture %a, i32* nocapture %b) nounwind uwtable {
entry:
@@ -65,7 +65,7 @@ for.body: ; preds = %for.body, %entry
store i32 %2, i32* %arrayidx2, align 4, !llvm.mem.parallel_loop_access !3
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond = icmp eq i32 %lftr.wideiv, 512
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop.parallel !3
+ br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !3
for.end: ; preds = %for.body
ret void
@@ -74,7 +74,7 @@ for.end: ; preds = %for.body
; The same loop with an illegal parallel loop metadata: the memory
; accesses refer to a different loop's identifier.
-;CHECK: @mixed_metadata
+;CHECK-LABEL: @mixed_metadata(
;CHECK-NOT: <4 x i32>
define void @mixed_metadata(i32* nocapture %a, i32* nocapture %b) nounwind uwtable {
@@ -98,7 +98,7 @@ for.body: ; preds = %for.body, %entry
store i32 %2, i32* %arrayidx2, align 4, !llvm.mem.parallel_loop_access !6
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond = icmp eq i32 %lftr.wideiv, 512
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop.parallel !6
+ br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !6
for.end: ; preds = %for.body
ret void
diff --git a/test/Transforms/LoopVectorize/X86/rauw-bug.ll b/test/Transforms/LoopVectorize/X86/rauw-bug.ll
new file mode 100644
index 000000000000..4284fbacfa7e
--- /dev/null
+++ b/test/Transforms/LoopVectorize/X86/rauw-bug.ll
@@ -0,0 +1,33 @@
+; RUN: opt -slp-vectorizer -S %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-n32:64-S128"
+target triple = "x86_64-apple-macosx"
+
+; This test used to fail under libgmalloc. Because we would try to access a
+; pointer that was already deleted.
+;
+; llvm-lit -v --param use_gmalloc=1 --param
+; gmalloc_path=/usr/lib/libgmalloc.dylib
+; test/Transforms/LoopVectorize/X86/rauw-bug.ll
+;
+; radar://15498655
+
+; CHECK: reduced
+define void @reduced() {
+entry:
+ br i1 undef, label %while.body, label %while.cond63.preheader.while.end76_crit_edge
+
+while.cond63.preheader.while.end76_crit_edge:
+ ret void
+
+while.body:
+ %d2_fx.015 = phi double [ %sub52, %while.body ], [ undef, %entry ]
+ %d2_fy.014 = phi double [ %sub58, %while.body ], [ undef, %entry ]
+ %d3_fy.013 = phi double [ %div56, %while.body ], [ undef, %entry ]
+ %d3_fx.012 = phi double [ %div50, %while.body ], [ undef, %entry ]
+ %div50 = fmul double %d3_fx.012, 1.250000e-01
+ %sub52 = fsub double 0.000000e+00, %div50
+ %div56 = fmul double %d3_fy.013, 1.250000e-01
+ %sub58 = fsub double 0.000000e+00, %div56
+ br label %while.body
+}
diff --git a/test/Transforms/LoopVectorize/X86/reduction-crash.ll b/test/Transforms/LoopVectorize/X86/reduction-crash.ll
index f580846a0228..3957a5541422 100644
--- a/test/Transforms/LoopVectorize/X86/reduction-crash.ll
+++ b/test/Transforms/LoopVectorize/X86/reduction-crash.ll
@@ -5,7 +5,7 @@ target triple = "i386-apple-darwin"
; PR15344
define void @test1(float* nocapture %arg, i32 %arg1) nounwind {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: preheader
; CHECK: insertelement <2 x double> zeroinitializer, double %tmp, i32 0
; CHECK: vector.memcheck
diff --git a/test/Transforms/LoopVectorize/X86/small-size.ll b/test/Transforms/LoopVectorize/X86/small-size.ll
index f390b33c0388..14ac417bb573 100644
--- a/test/Transforms/LoopVectorize/X86/small-size.ll
+++ b/test/Transforms/LoopVectorize/X86/small-size.ll
@@ -20,7 +20,7 @@ target triple = "x86_64-apple-macosx10.8.0"
@dj = common global [1024 x i32] zeroinitializer, align 16
; We can optimize this test without a tail.
-;CHECK: @example1
+;CHECK-LABEL: @example1(
;CHECK: load <4 x i32>
;CHECK: add nsw <4 x i32>
;CHECK: store <4 x i32>
@@ -47,7 +47,7 @@ define void @example1() optsize {
}
; Can't vectorize in 'optsize' mode because we need a tail.
-;CHECK: @example2
+;CHECK-LABEL: @example2(
;CHECK-NOT: store <4 x i32>
;CHECK: ret void
define void @example2(i32 %n, i32 %x) optsize {
@@ -92,7 +92,7 @@ define void @example2(i32 %n, i32 %x) optsize {
}
; N is unknown, we need a tail. Can't vectorize.
-;CHECK: @example3
+;CHECK-LABEL: @example3(
;CHECK-NOT: <4 x i32>
;CHECK: ret void
define void @example3(i32 %n, i32* noalias nocapture %p, i32* noalias nocapture %q) optsize {
@@ -117,7 +117,7 @@ define void @example3(i32 %n, i32* noalias nocapture %p, i32* noalias nocapture
; We can't vectorize this one because we need a runtime ptr check.
-;CHECK: @example23
+;CHECK-LABEL: @example23(
;CHECK-NOT: <4 x i32>
;CHECK: ret void
define void @example23(i16* nocapture %src, i32* nocapture %dst) optsize {
@@ -143,7 +143,7 @@ define void @example23(i16* nocapture %src, i32* nocapture %dst) optsize {
; We CAN vectorize this example because the pointers are marked as noalias.
-;CHECK: @example23b
+;CHECK-LABEL: @example23b(
;CHECK: <4 x i32>
;CHECK: ret void
define void @example23b(i16* noalias nocapture %src, i32* noalias nocapture %dst) optsize {
diff --git a/test/Transforms/LoopVectorize/X86/tripcount.ll b/test/Transforms/LoopVectorize/X86/tripcount.ll
new file mode 100644
index 000000000000..6b38bacf8888
--- /dev/null
+++ b/test/Transforms/LoopVectorize/X86/tripcount.ll
@@ -0,0 +1,39 @@
+; RUN: opt -S -loop-vectorize -force-vector-width=2 -force-vector-unroll=1 -mcpu=prescott < %s | FileCheck %s
+
+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:32:32-n8:16:32-S128"
+target triple = "i386-unknown-freebsd11.0"
+
+@big = external global [0 x i32]
+
+; PR18049
+; We need to truncate the exit count to i32. This is legal because the
+; arithmetic is signed (%inc is nsw).
+
+; CHECK-LABEL: tripcount
+; CHECK: trunc i64 %count to i32
+
+define void @tripcount(i64 %count) {
+entry:
+ %cmp6 = icmp sgt i64 %count, 0
+ br i1 %cmp6, label %for.body.preheader, label %for.end
+
+for.body.preheader:
+ br label %for.body
+
+for.body:
+ %i.07 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %arrayidx = getelementptr inbounds [0 x i32]* @big, i32 0, i32 %i.07
+ %0 = load i32* %arrayidx, align 4
+ %neg = xor i32 %0, -1
+ store i32 %neg, i32* %arrayidx, align 4
+ %inc = add nsw i32 %i.07, 1
+ %conv = sext i32 %inc to i64
+ %cmp = icmp slt i64 %conv, %count
+ br i1 %cmp, label %for.body, label %for.end.loopexit
+
+for.end.loopexit:
+ br label %for.end
+
+for.end:
+ ret void
+}
diff --git a/test/Transforms/LoopVectorize/X86/unroll-pm.ll b/test/Transforms/LoopVectorize/X86/unroll-pm.ll
new file mode 100644
index 000000000000..5064fec286ce
--- /dev/null
+++ b/test/Transforms/LoopVectorize/X86/unroll-pm.ll
@@ -0,0 +1,31 @@
+; RUN: opt < %s -O2 -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx -force-vector-width=4 -S | FileCheck %s
+; RUN: opt < %s -O2 -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx -force-vector-width=4 -disable-loop-unrolling -S | FileCheck %s -check-prefix=CHECK-NOUNRL
+
+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"
+;CHECK-LABEL: @bar(
+;CHECK: store <4 x i32>
+;CHECK: store <4 x i32>
+;CHECK: ret
+;CHECK-NOUNRL-LABEL: @bar(
+;CHECK-NOUNRL: store <4 x i32>
+;CHECK-NOUNRL-NOT: store <4 x i32>
+;CHECK-NOUNRL: ret
+define i32 @bar(i32* nocapture %A, i32 %n) nounwind uwtable ssp {
+ %1 = icmp sgt i32 %n, 0
+ br i1 %1, label %.lr.ph, label %._crit_edge
+
+.lr.ph: ; preds = %0, %.lr.ph
+ %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
+ %2 = getelementptr inbounds i32* %A, i64 %indvars.iv
+ %3 = load i32* %2, align 4
+ %4 = add nsw i32 %3, 6
+ store i32 %4, i32* %2, align 4
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, %n
+ br i1 %exitcond, label %._crit_edge, label %.lr.ph
+
+._crit_edge: ; preds = %.lr.ph, %0
+ ret i32 undef
+}
diff --git a/test/Transforms/LoopVectorize/X86/unroll-small-loops.ll b/test/Transforms/LoopVectorize/X86/unroll-small-loops.ll
index ef63a145d0c1..ea107dc4dc51 100644
--- a/test/Transforms/LoopVectorize/X86/unroll-small-loops.ll
+++ b/test/Transforms/LoopVectorize/X86/unroll-small-loops.ll
@@ -2,7 +2,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-;CHECK: @foo
+;CHECK-LABEL: @foo(
;CHECK: load <4 x i32>
;CHECK-NOT: load <4 x i32>
;CHECK: store <4 x i32>
@@ -26,7 +26,7 @@ define i32 @foo(i32* nocapture %A) nounwind uwtable ssp {
ret i32 undef
}
-;CHECK: @bar
+;CHECK-LABEL: @bar(
;CHECK: store <4 x i32>
;CHECK: store <4 x i32>
;CHECK: ret
diff --git a/test/Transforms/LoopVectorize/X86/x86_fp80-vector-store.ll b/test/Transforms/LoopVectorize/X86/x86_fp80-vector-store.ll
index b66119f4ef59..efc93d94a7c5 100644
--- a/test/Transforms/LoopVectorize/X86/x86_fp80-vector-store.ll
+++ b/test/Transforms/LoopVectorize/X86/x86_fp80-vector-store.ll
@@ -5,7 +5,7 @@ target triple = "x86_64-apple-macosx10.7.0"
@x = common global [1024 x x86_fp80] zeroinitializer, align 16
-;CHECK: @example
+;CHECK-LABEL: @example(
;CHECK-NOT: bitcast x86_fp80* {{%[^ ]+}} to <{{[2-9][0-9]*}} x x86_fp80>*
;CHECK: store
;CHECK: ret void
diff --git a/test/Transforms/LoopVectorize/XCore/lit.local.cfg b/test/Transforms/LoopVectorize/XCore/lit.local.cfg
new file mode 100644
index 000000000000..4d17d4642045
--- /dev/null
+++ b/test/Transforms/LoopVectorize/XCore/lit.local.cfg
@@ -0,0 +1,3 @@
+targets = set(config.root.targets_to_build.split())
+if not 'XCore' in targets:
+ config.unsupported = True
diff --git a/test/Transforms/LoopVectorize/XCore/no-vector-registers.ll b/test/Transforms/LoopVectorize/XCore/no-vector-registers.ll
new file mode 100644
index 000000000000..a099daa740e5
--- /dev/null
+++ b/test/Transforms/LoopVectorize/XCore/no-vector-registers.ll
@@ -0,0 +1,23 @@
+; RUN: opt < %s -loop-vectorize -force-vector-width=4 -force-vector-unroll=2 -S -mtriple=xcore | FileCheck %s
+
+target datalayout = "e-p:32:32:32-a0:0:32-n32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f16:16:32-f32:32:32-f64:32:32"
+target triple = "xcore"
+; The xcore target has no vector registers, so loop should not be vectorized.
+;CHECK-LABEL: @f(
+;CHECK: entry:
+;CHECK-NOT: vector.body
+;CHECK-NEXT: br label %do.body
+define void @f(i8* nocapture %ptr, i32 %len) {
+entry:
+ br label %do.body
+do.body:
+ %ptr.addr.0 = phi i8* [ %ptr, %entry ], [ %incdec.ptr, %do.body ]
+ %len.addr.0 = phi i32 [ %len, %entry ], [ %dec, %do.body ]
+ %incdec.ptr = getelementptr inbounds i8* %ptr.addr.0, i32 1
+ store i8 0, i8* %ptr.addr.0, align 1
+ %dec = add nsw i32 %len.addr.0, -1
+ %tobool = icmp eq i32 %len.addr.0, 0
+ br i1 %tobool, label %do.end, label %do.body
+do.end:
+ ret void
+}
diff --git a/test/Transforms/LoopVectorize/align.ll b/test/Transforms/LoopVectorize/align.ll
new file mode 100644
index 000000000000..84b03615d374
--- /dev/null
+++ b/test/Transforms/LoopVectorize/align.ll
@@ -0,0 +1,33 @@
+; RUN: opt < %s -loop-vectorize -force-vector-unroll=1 -force-vector-width=4 -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-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+; Make sure we output the abi alignment if no alignment is specified.
+
+;CHECK-LABEL: @align
+;CHECK: load <4 x i32>* {{.*}} align 4
+;CHECK: load <4 x i32>* {{.*}} align 4
+;CHECK: store <4 x i32> {{.*}} align 4
+
+define void @align(i32* %a, i32* %b, i32* %c) nounwind uwtable ssp {
+ br label %1
+
+; <label>:1 ; preds = %1, %0
+ %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %1 ]
+ %2 = getelementptr inbounds i32* %b, i64 %indvars.iv
+ %3 = load i32* %2
+ %4 = getelementptr inbounds i32* %c, i64 %indvars.iv
+ %5 = load i32* %4
+ %6 = add nsw i32 %5, %3
+ %7 = getelementptr inbounds i32* %a, i64 %indvars.iv
+ store i32 %6, i32* %7
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, 128
+ br i1 %exitcond, label %8, label %1
+
+; <label>:8 ; preds = %1
+ ret void
+}
+
diff --git a/test/Transforms/LoopVectorize/bsd_regex.ll b/test/Transforms/LoopVectorize/bsd_regex.ll
index a14b92d229b4..7b712729a1cd 100644
--- a/test/Transforms/LoopVectorize/bsd_regex.ll
+++ b/test/Transforms/LoopVectorize/bsd_regex.ll
@@ -4,7 +4,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
;PR 15830.
-;CHECK: foo
+;CHECK-LABEL: @foo(
; When scalarizing stores we need to preserve the original order.
; Make sure that we are extracting in the correct order (0101, and not 0011).
;CHECK: extractelement <2 x i64> {{.*}}, i32 0
diff --git a/test/Transforms/LoopVectorize/cast-induction.ll b/test/Transforms/LoopVectorize/cast-induction.ll
index 2aa29ed2c820..255ce9c77eaf 100644
--- a/test/Transforms/LoopVectorize/cast-induction.ll
+++ b/test/Transforms/LoopVectorize/cast-induction.ll
@@ -7,7 +7,7 @@ target triple = "x86_64-apple-macosx10.8.0"
@a = common global [2048 x i32] zeroinitializer, align 16
-;CHECK: @example12
+;CHECK-LABEL: @example12(
;CHECK: trunc i64
;CHECK: store <4 x i32>
;CHECK: ret void
diff --git a/test/Transforms/LoopVectorize/cpp-new-array.ll b/test/Transforms/LoopVectorize/cpp-new-array.ll
index da0fb05fe843..c8215a107de7 100644
--- a/test/Transforms/LoopVectorize/cpp-new-array.ll
+++ b/test/Transforms/LoopVectorize/cpp-new-array.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-;CHECK: @cpp_new_arrays
+;CHECK-LABEL: @cpp_new_arrays(
;CHECK: sext i32
;CHECK: load <4 x float>
;CHECK: fadd <4 x float>
diff --git a/test/Transforms/LoopVectorize/dbg.value.ll b/test/Transforms/LoopVectorize/dbg.value.ll
index 127d479b3a06..2497b25ea1da 100644
--- a/test/Transforms/LoopVectorize/dbg.value.ll
+++ b/test/Transforms/LoopVectorize/dbg.value.ll
@@ -8,7 +8,7 @@ target triple = "x86_64-apple-macosx10.8.0"
@B = global [1024 x i32] zeroinitializer, align 16
@C = global [1024 x i32] zeroinitializer, align 16
-; CHECK: @test
+; CHECK-LABEL: @test(
define i32 @test() #0 {
entry:
tail call void @llvm.dbg.value(metadata !1, i64 0, metadata !9), !dbg !18
@@ -38,30 +38,33 @@ declare void @llvm.dbg.declare(metadata, metadata) #1
declare void @llvm.dbg.value(metadata, i64, metadata) #1
-attributes #0 = { nounwind ssp uwtable "fp-contract-model"="standard" "no-frame-pointer-elim" "no-frame-pointer-elim-non-leaf" "realign-stack" "relocation-model"="pic" "ssp-buffers-size"="8" }
+attributes #0 = { nounwind ssp uwtable "fp-contract-model"="standard" "no-frame-pointer-elim" "no-frame-pointer-elim-non-leaf" "relocation-model"="pic" "ssp-buffers-size"="8" }
attributes #1 = { nounwind readnone }
!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!26}
-!0 = metadata !{i32 786449, i32 0, i32 4, metadata !"test", metadata !"/path/to/somewhere", metadata !"clang", i1 true, i1 true, metadata !"", i32 0, metadata !1, metadata !1, metadata !2, metadata !11, metadata !""}
+!0 = metadata !{i32 786449, metadata !25, i32 4, metadata !"clang", i1 true, metadata !"", i32 0, metadata !1, metadata !1, metadata !2, metadata !11, null, metadata !""}
!1 = metadata !{i32 0}
!2 = metadata !{metadata !3}
-!3 = metadata !{i32 786478, i32 0, metadata !4, metadata !"test", metadata !"test", metadata !"test", metadata !4, i32 5, metadata !5, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i32 ()* @test, null, null, metadata !8, i32 5}
-!4 = metadata !{i32 786473, metadata !"test", metadata !"/path/to/somewhere", null}
-!5 = metadata !{i32 786453, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !6, i32 0, i32 0}
+!3 = metadata !{i32 786478, metadata !25, metadata !4, metadata !"test", metadata !"test", metadata !"test", i32 5, metadata !5, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i32 ()* @test, null, null, metadata !8, i32 5}
+!4 = metadata !{i32 786473, metadata !25}
+!5 = metadata !{i32 786453, i32 0, null, i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !6, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!6 = metadata !{metadata !7}
-!7 = metadata !{i32 786468, null, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5}
+!7 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5}
!8 = metadata !{metadata !9}
!9 = metadata !{i32 786688, metadata !10, metadata !"i", metadata !4, i32 6, metadata !7, i32 0, i32 0}
-!10 = metadata !{i32 786443, metadata !3, i32 6, i32 0, metadata !4, i32 0}
+!10 = metadata !{i32 786443, metadata !25, metadata !3, i32 6, i32 0, i32 0}
!11 = metadata !{metadata !12, metadata !16, metadata !17}
!12 = metadata !{i32 786484, i32 0, null, metadata !"A", metadata !"A", metadata !"", metadata !4, i32 1, metadata !13, i32 0, i32 1, [1024 x i32]* @A, null}
-!13 = metadata !{i32 786433, null, metadata !"", null, i32 0, i64 32768, i64 32, i32 0, i32 0, metadata !7, metadata !14, i32 0, i32 0}
+!13 = metadata !{i32 786433, null, null, null, i32 0, i64 32768, i64 32, i32 0, i32 0, metadata !7, metadata !14, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 32768, align 32, offset 0] [from int]
!14 = metadata !{metadata !15}
!15 = metadata !{i32 786465, i64 0, i64 1024}
!16 = metadata !{i32 786484, i32 0, null, metadata !"B", metadata !"B", metadata !"", metadata !4, i32 2, metadata !13, i32 0, i32 1, [1024 x i32]* @B, null}
!17 = metadata !{i32 786484, i32 0, null, metadata !"C", metadata !"C", metadata !"", metadata !4, i32 3, metadata !13, i32 0, i32 1, [1024 x i32]* @C, null}
!18 = metadata !{i32 6, i32 0, metadata !10, null}
!19 = metadata !{i32 7, i32 0, metadata !20, null}
-!20 = metadata !{i32 786443, metadata !10, i32 6, i32 0, metadata !4, i32 1}
+!20 = metadata !{i32 786443, metadata !25, metadata !10, i32 6, i32 0, i32 1}
!24 = metadata !{i32 9, i32 0, metadata !3, null}
+!25 = metadata !{metadata !"test", metadata !"/path/to/somewhere"}
+!26 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/LoopVectorize/debugloc.ll b/test/Transforms/LoopVectorize/debugloc.ll
new file mode 100644
index 000000000000..bf0b4184b7a1
--- /dev/null
+++ b/test/Transforms/LoopVectorize/debugloc.ll
@@ -0,0 +1,90 @@
+; RUN: opt -S < %s -loop-vectorize -force-vector-unroll=1 -force-vector-width=2 | 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-S128"
+
+; Make sure we are preserving debug info in the vectorized code.
+
+; CHECK: for.body.lr.ph
+; CHECK: cmp.zero = icmp eq i64 {{.*}}, 0, !dbg ![[LOC:[0-9]+]]
+; CHECK: vector.body
+; CHECK: index {{.*}}, !dbg ![[LOC]]
+; CHECK: getelementptr inbounds i32* %a, {{.*}}, !dbg ![[LOC2:[0-9]+]]
+; CHECK: load <2 x i32>* {{.*}}, !dbg ![[LOC2]]
+; CHECK: add <2 x i32> {{.*}}, !dbg ![[LOC2]]
+; CHECK: add i64 %index, 2, !dbg ![[LOC]]
+; CHECK: icmp eq i64 %index.next, %end.idx.rnd.down, !dbg ![[LOC]]
+; CHECK: middle.block
+; CHECK: add <2 x i32> %rdx.vec.exit.phi, %rdx.shuf, !dbg ![[LOC2]]
+; CHECK: extractelement <2 x i32> %bin.rdx, i32 0, !dbg ![[LOC2]]
+
+define i32 @f(i32* nocapture %a, i32 %size) #0 {
+entry:
+ tail call void @llvm.dbg.value(metadata !{i32* %a}, i64 0, metadata !13), !dbg !19
+ tail call void @llvm.dbg.value(metadata !{i32 %size}, i64 0, metadata !14), !dbg !19
+ tail call void @llvm.dbg.value(metadata !2, i64 0, metadata !15), !dbg !20
+ tail call void @llvm.dbg.value(metadata !2, i64 0, metadata !16), !dbg !21
+ %cmp4 = icmp eq i32 %size, 0, !dbg !21
+ br i1 %cmp4, label %for.end, label %for.body.lr.ph, !dbg !21
+
+for.body.lr.ph: ; preds = %entry
+ br label %for.body, !dbg !21
+
+for.body: ; preds = %for.body.lr.ph, %for.body
+ %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
+ %sum.05 = phi i32 [ 0, %for.body.lr.ph ], [ %add, %for.body ]
+ %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv, !dbg !22
+ %0 = load i32* %arrayidx, align 4, !dbg !22
+ %add = add i32 %0, %sum.05, !dbg !22
+ tail call void @llvm.dbg.value(metadata !{i32 %add.lcssa}, i64 0, metadata !15), !dbg !22
+ %indvars.iv.next = add i64 %indvars.iv, 1, !dbg !21
+ tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !16), !dbg !21
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !21
+ %exitcond = icmp ne i32 %lftr.wideiv, %size, !dbg !21
+ br i1 %exitcond, label %for.body, label %for.cond.for.end_crit_edge, !dbg !21
+
+for.cond.for.end_crit_edge: ; preds = %for.body
+ %add.lcssa = phi i32 [ %add, %for.body ]
+ br label %for.end, !dbg !21
+
+for.end: ; preds = %entry, %for.cond.for.end_crit_edge
+ %sum.0.lcssa = phi i32 [ %add.lcssa, %for.cond.for.end_crit_edge ], [ 0, %entry ]
+ ret i32 %sum.0.lcssa, !dbg !26
+}
+
+; Function Attrs: nounwind readnone
+declare void @llvm.dbg.declare(metadata, metadata) #1
+
+; Function Attrs: nounwind readnone
+declare void @llvm.dbg.value(metadata, i64, metadata) #1
+
+attributes #0 = { nounwind readonly ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "unsafe-fp-math"="true" "use-soft-float"="false" }
+attributes #1 = { nounwind readnone }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!18, !27}
+
+!0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.4 (trunk 185038) (llvm/trunk 185097)", i1 true, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [/Volumes/Data/backedup/dev/os/llvm/debug/-] [DW_LANG_C99]
+!1 = metadata !{metadata !"-", metadata !"/Volumes/Data/backedup/dev/os/llvm/debug"}
+!2 = metadata !{i32 0}
+!3 = metadata !{metadata !4}
+!4 = metadata !{i32 786478, metadata !5, metadata !6, metadata !"f", metadata !"f", metadata !"", i32 3, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i32 (i32*, i32)* @f, null, null, metadata !12, i32 3} ; [ DW_TAG_subprogram ] [line 3] [def] [f]
+!5 = metadata !{metadata !"<stdin>", metadata !"/Volumes/Data/backedup/dev/os/llvm/debug"}
+!6 = metadata !{i32 786473, metadata !5} ; [ DW_TAG_file_type ] [/Volumes/Data/backedup/dev/os/llvm/debug/<stdin>]
+!7 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !8, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
+!8 = metadata !{metadata !9, metadata !10, metadata !11}
+!9 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
+!10 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !9} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from int]
+!11 = metadata !{i32 786468, null, null, metadata !"unsigned int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ] [unsigned int] [line 0, size 32, align 32, offset 0, enc DW_ATE_unsigned]
+!12 = metadata !{metadata !13, metadata !14, metadata !15, metadata !16}
+!13 = metadata !{i32 786689, metadata !4, metadata !"a", metadata !6, i32 16777219, metadata !10, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [a] [line 3]
+!14 = metadata !{i32 786689, metadata !4, metadata !"size", metadata !6, i32 33554435, metadata !11, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [size] [line 3]
+!15 = metadata !{i32 786688, metadata !4, metadata !"sum", metadata !6, i32 4, metadata !11, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [sum] [line 4]
+!16 = metadata !{i32 786688, metadata !17, metadata !"i", metadata !6, i32 5, metadata !11, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [i] [line 5]
+!17 = metadata !{i32 786443, metadata !5, metadata !4, i32 5, i32 0, i32 0} ; [ DW_TAG_lexical_block ] [/Volumes/Data/backedup/dev/os/llvm/debug/<stdin>]
+!18 = metadata !{i32 2, metadata !"Dwarf Version", i32 3}
+!19 = metadata !{i32 3, i32 0, metadata !4, null}
+!20 = metadata !{i32 4, i32 0, metadata !4, null}
+!21 = metadata !{i32 5, i32 0, metadata !17, null}
+!22 = metadata !{i32 6, i32 0, metadata !17, null}
+!26 = metadata !{i32 7, i32 0, metadata !4, null}
+!27 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/LoopVectorize/ee-crash.ll b/test/Transforms/LoopVectorize/ee-crash.ll
new file mode 100644
index 000000000000..8a4f8ce3c122
--- /dev/null
+++ b/test/Transforms/LoopVectorize/ee-crash.ll
@@ -0,0 +1,35 @@
+; RUN: opt < %s -loop-vectorize -force-vector-unroll=1 -force-vector-width=4 -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-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+; This test checks that we deal with an in-loop extractelement (for now, this
+; means not crashing by not vectorizing).
+; CHECK-LABEL: @_Z4foo1Pii(
+; CHECK-NOT: <4 x i32>
+; CHECK: ret
+define i32 @_Z4foo1Pii(i32* %A, i32 %n, <2 x i32> %q) #0 {
+entry:
+ %idx.ext = sext i32 %n to i64
+ %add.ptr = getelementptr inbounds i32* %A, i64 %idx.ext
+ %cmp3.i = icmp eq i32 %n, 0
+ br i1 %cmp3.i, label %_ZSt10accumulateIPiiET0_T_S2_S1_.exit, label %for.body.i
+
+for.body.i: ; preds = %entry, %for.body.i
+ %__init.addr.05.i = phi i32 [ %add.i, %for.body.i ], [ 0, %entry ]
+ %__first.addr.04.i = phi i32* [ %incdec.ptr.i, %for.body.i ], [ %A, %entry ]
+ %0 = load i32* %__first.addr.04.i, align 4
+ %q1 = extractelement <2 x i32> %q, i32 %n
+ %q2 = add nsw i32 %0, %q1
+ %add.i = add nsw i32 %q2, %__init.addr.05.i
+ %incdec.ptr.i = getelementptr inbounds i32* %__first.addr.04.i, i64 1
+ %cmp.i = icmp eq i32* %incdec.ptr.i, %add.ptr
+ br i1 %cmp.i, label %_ZSt10accumulateIPiiET0_T_S2_S1_.exit, label %for.body.i
+
+_ZSt10accumulateIPiiET0_T_S2_S1_.exit: ; preds = %for.body.i, %entry
+ %__init.addr.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i, %for.body.i ]
+ ret i32 %__init.addr.0.lcssa.i
+}
+
+attributes #0 = { nounwind readonly ssp uwtable }
+
diff --git a/test/Transforms/LoopVectorize/flags.ll b/test/Transforms/LoopVectorize/flags.ll
index 656912e178f9..a4ebb4284881 100644
--- a/test/Transforms/LoopVectorize/flags.ll
+++ b/test/Transforms/LoopVectorize/flags.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-;CHECK: @flags1
+;CHECK-LABEL: @flags1(
;CHECK: load <4 x i32>
;CHECK: mul nsw <4 x i32>
;CHECK: store <4 x i32>
@@ -28,7 +28,7 @@ define i32 @flags1(i32 %n, i32* nocapture %A) nounwind uwtable ssp {
}
-;CHECK: @flags2
+;CHECK-LABEL: @flags2(
;CHECK: load <4 x i32>
;CHECK: mul <4 x i32>
;CHECK: store <4 x i32>
diff --git a/test/Transforms/LoopVectorize/float-reduction.ll b/test/Transforms/LoopVectorize/float-reduction.ll
index 54ca172e8696..c45098dd2c3b 100644
--- a/test/Transforms/LoopVectorize/float-reduction.ll
+++ b/test/Transforms/LoopVectorize/float-reduction.ll
@@ -2,7 +2,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-;CHECK: @foo
+;CHECK-LABEL: @foo(
;CHECK: fadd <4 x float>
;CHECK: ret
define float @foo(float* nocapture %A, i32* nocapture %n) nounwind uwtable readonly ssp {
diff --git a/test/Transforms/LoopVectorize/funcall.ll b/test/Transforms/LoopVectorize/funcall.ll
new file mode 100644
index 000000000000..f1f068c43db3
--- /dev/null
+++ b/test/Transforms/LoopVectorize/funcall.ll
@@ -0,0 +1,32 @@
+; RUN: opt -S -loop-vectorize -force-vector-width=2 -force-vector-unroll=1 < %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-S128"
+
+; Make sure we can vectorize loops with functions to math library functions.
+; They might read the rounding mode but we are only vectorizing loops that
+; contain a limited set of function calls and none of them sets the rounding
+; mode, so vectorizing them is safe.
+
+; CHECK-LABEL: @test(
+; CHECK: <2 x double>
+
+define void @test(double* %d, double %t) {
+entry:
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %arrayidx = getelementptr inbounds double* %d, i64 %indvars.iv
+ %0 = load double* %arrayidx, align 8
+ %1 = tail call double @llvm.pow.f64(double %0, double %t)
+ store double %1, double* %arrayidx, align 8
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, 128
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
+
+declare double @llvm.pow.f64(double, double)
diff --git a/test/Transforms/LoopVectorize/gcc-examples.ll b/test/Transforms/LoopVectorize/gcc-examples.ll
index f335557c0019..d8959d4c106a 100644
--- a/test/Transforms/LoopVectorize/gcc-examples.ll
+++ b/test/Transforms/LoopVectorize/gcc-examples.ll
@@ -20,12 +20,12 @@ target triple = "x86_64-apple-macosx10.8.0"
@dd = common global [1024 x float] zeroinitializer, align 16
@dj = common global [1024 x i32] zeroinitializer, align 16
-;CHECK: @example1
+;CHECK-LABEL: @example1(
;CHECK: load <4 x i32>
;CHECK: add nsw <4 x i32>
;CHECK: store <4 x i32>
;CHECK: ret void
-;UNROLL: @example1
+;UNROLL-LABEL: @example1(
;UNROLL: load <4 x i32>
;UNROLL: load <4 x i32>
;UNROLL: load <4 x i32>
@@ -60,10 +60,10 @@ define void @example1() nounwind uwtable ssp {
ret void
}
-;CHECK: @example2
+;CHECK-LABEL: @example2(
;CHECK: store <4 x i32>
;CHECK: ret void
-;UNROLL: @example2
+;UNROLL-LABEL: @example2(
;UNROLL: store <4 x i32>
;UNROLL: store <4 x i32>
;UNROLL: store <4 x i32>
@@ -110,10 +110,10 @@ define void @example2(i32 %n, i32 %x) nounwind uwtable ssp {
ret void
}
-;CHECK: @example3
+;CHECK-LABEL: @example3(
;CHECK: <4 x i32>
;CHECK: ret void
-;UNROLL: @example3
+;UNROLL-LABEL: @example3(
;UNROLL: <4 x i32>
;UNROLL: <4 x i32>
;UNROLL: <4 x i32>
@@ -139,10 +139,10 @@ define void @example3(i32 %n, i32* noalias nocapture %p, i32* noalias nocapture
ret void
}
-;CHECK: @example4
+;CHECK-LABEL: @example4(
;CHECK: load <4 x i32>
;CHECK: ret void
-;UNROLL: @example4
+;UNROLL-LABEL: @example4(
;UNROLL: load <4 x i32>
;UNROLL: load <4 x i32>
;UNROLL: load <4 x i32>
@@ -205,10 +205,10 @@ define void @example4(i32 %n, i32* noalias nocapture %p, i32* noalias nocapture
ret void
}
-;CHECK: @example8
+;CHECK-LABEL: @example8(
;CHECK: store <4 x i32>
;CHECK: ret void
-;UNROLL: @example8
+;UNROLL-LABEL: @example8(
;UNROLL: store <4 x i32>
;UNROLL: store <4 x i32>
;UNROLL: store <4 x i32>
@@ -240,7 +240,7 @@ define void @example8(i32 %x) nounwind uwtable ssp {
ret void
}
-;CHECK: @example9
+;CHECK-LABEL: @example9(
;CHECK: phi <4 x i32>
;CHECK: ret i32
define i32 @example9() nounwind uwtable readonly ssp {
@@ -264,7 +264,7 @@ define i32 @example9() nounwind uwtable readonly ssp {
ret i32 %7
}
-;CHECK: @example10a
+;CHECK-LABEL: @example10a(
;CHECK: load <4 x i32>
;CHECK: add nsw <4 x i32>
;CHECK: load <4 x i16>
@@ -299,7 +299,7 @@ define void @example10a(i16* noalias nocapture %sa, i16* noalias nocapture %sb,
ret void
}
-;CHECK: @example10b
+;CHECK-LABEL: @example10b(
;CHECK: load <4 x i16>
;CHECK: sext <4 x i16>
;CHECK: store <4 x i32>
@@ -323,7 +323,7 @@ define void @example10b(i16* noalias nocapture %sa, i16* noalias nocapture %sb,
ret void
}
-;CHECK: @example11
+;CHECK-LABEL: @example11(
;CHECK: load i32
;CHECK: load i32
;CHECK: load i32
@@ -367,7 +367,7 @@ define void @example11() nounwind uwtable ssp {
ret void
}
-;CHECK: @example12
+;CHECK-LABEL: @example12(
;CHECK: trunc i64
;CHECK: store <4 x i32>
;CHECK: ret void
@@ -389,7 +389,7 @@ define void @example12() nounwind uwtable ssp {
}
; Can't vectorize because of reductions.
-;CHECK: @example13
+;CHECK-LABEL: @example13(
;CHECK-NOT: <4 x i32>
;CHECK: ret void
define void @example13(i32** nocapture %A, i32** nocapture %B, i32* nocapture %out) nounwind uwtable ssp {
@@ -430,7 +430,7 @@ define void @example13(i32** nocapture %A, i32** nocapture %B, i32* nocapture %o
}
; Can vectorize.
-;CHECK: @example14
+;CHECK-LABEL: @example14(
;CHECK: <4 x i32>
;CHECK: ret void
define void @example14(i32** nocapture %in, i32** nocapture %coeff, i32* nocapture %out) nounwind uwtable ssp {
@@ -575,7 +575,7 @@ define void @example14(i32** nocapture %in, i32** nocapture %coeff, i32* nocaptu
ret void
}
-;CHECK: @example21
+;CHECK-LABEL: @example21(
;CHECK: load <4 x i32>
;CHECK: shufflevector {{.*}} <i32 3, i32 2, i32 1, i32 0>
;CHECK: ret i32
@@ -603,7 +603,7 @@ define i32 @example21(i32* nocapture %b, i32 %n) nounwind uwtable readonly ssp {
ret i32 %a.0.lcssa
}
-;CHECK: @example23
+;CHECK-LABEL: @example23(
;CHECK: <4 x i32>
;CHECK: ret void
define void @example23(i16* nocapture %src, i32* nocapture %dst) nounwind uwtable ssp {
@@ -627,7 +627,7 @@ define void @example23(i16* nocapture %src, i32* nocapture %dst) nounwind uwtabl
ret void
}
-;CHECK: @example24
+;CHECK-LABEL: @example24(
;CHECK: shufflevector <4 x i16>
;CHECK: ret void
define void @example24(i16 signext %x, i16 signext %y) nounwind uwtable ssp {
@@ -653,7 +653,7 @@ define void @example24(i16 signext %x, i16 signext %y) nounwind uwtable ssp {
ret void
}
-;CHECK: @example25
+;CHECK-LABEL: @example25(
;CHECK: and <4 x i1>
;CHECK: zext <4 x i1>
;CHECK: ret void
diff --git a/test/Transforms/LoopVectorize/global_alias.ll b/test/Transforms/LoopVectorize/global_alias.ll
index 121da8ba7e16..0118fb47412a 100644
--- a/test/Transforms/LoopVectorize/global_alias.ll
+++ b/test/Transforms/LoopVectorize/global_alias.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -O3 -loop-vectorize -force-vector-unroll=1 -force-vector-width=4 -dce -instcombine -S | FileCheck %s
+; RUN: opt < %s -O1 -loop-vectorize -force-vector-unroll=1 -force-vector-width=4 -dce -instcombine -S | FileCheck %s
target datalayout = "e-p:32:32:32-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:64:128-a0:0:64-n32-S64"
@@ -22,7 +22,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; Foo.A[i] = Foo.B[i] + a;
; return Foo.A[a];
; }
-; CHECK: define i32 @noAlias01
+; CHECK-LABEL: define i32 @noAlias01(
; CHECK: add nsw <4 x i32>
; CHECK: ret
@@ -70,7 +70,7 @@ for.end: ; preds = %for.cond
; Foo.A[i] = Foo.B[i+10] + a;
; return Foo.A[a];
; }
-; CHECK: define i32 @noAlias02
+; CHECK-LABEL: define i32 @noAlias02(
; CHECK: add nsw <4 x i32>
; CHECK: ret
@@ -119,7 +119,7 @@ for.end: ; preds = %for.cond
; Foo.A[i+10] = Foo.B[i] + a;
; return Foo.A[a];
; }
-; CHECK: define i32 @noAlias03
+; CHECK-LABEL: define i32 @noAlias03(
; CHECK: add nsw <4 x i32>
; CHECK: ret
@@ -168,7 +168,7 @@ for.end: ; preds = %for.cond
; *(PA+i) = *(PB+i) + a;
; return *(PA+a);
; }
-; CHECK: define i32 @noAlias04
+; CHECK-LABEL: define i32 @noAlias04(
; CHECK-NOT: add nsw <4 x i32>
; CHECK: ret
;
@@ -222,7 +222,7 @@ for.end: ; preds = %for.cond
; Bar.A[N][i] = Bar.B[N][i] + a;
; return Bar.A[N][a];
; }
-; CHECK: define i32 @noAlias05
+; CHECK-LABEL: define i32 @noAlias05(
; CHECK: add nsw <4 x i32>
; CHECK: ret
@@ -278,7 +278,7 @@ for.end: ; preds = %for.cond
; Bar.A[N][i] = Bar.A[N+1][i] + a;
; return Bar.A[N][a];
; }
-; CHECK: define i32 @noAlias06
+; CHECK-LABEL: define i32 @noAlias06(
; CHECK: add nsw <4 x i32>
; CHECK: ret
@@ -335,10 +335,9 @@ for.end: ; preds = %for.cond
; Foo.A[SIZE-i-1] = Foo.B[SIZE-i-1] + a;
; return Foo.A[a];
; }
-; CHECK: define i32 @noAlias07
-; CHECK: sub nsw <4 x i32>
+; CHECK-LABEL: define i32 @noAlias07(
+; CHECK: store <4 x i32>
; CHECK: ret
-
define i32 @noAlias07(i32 %a) #0 {
entry:
%a.addr = alloca i32, align 4
@@ -387,7 +386,7 @@ for.end: ; preds = %for.cond
; Foo.A[SIZE-i-1] = Foo.B[SIZE-i-10] + a;
; return Foo.A[a];
; }
-; CHECK: define i32 @noAlias08
+; CHECK-LABEL: define i32 @noAlias08(
; CHECK: sub nsw <4 x i32>
; CHECK: ret
@@ -439,7 +438,7 @@ for.end: ; preds = %for.cond
; Foo.A[SIZE-i-10] = Foo.B[SIZE-i-1] + a;
; return Foo.A[a];
; }
-; CHECK: define i32 @noAlias09
+; CHECK-LABEL: define i32 @noAlias09(
; CHECK: sub nsw <4 x i32>
; CHECK: ret
@@ -491,7 +490,7 @@ for.end: ; preds = %for.cond
; *(PA+SIZE-i-1) = *(PB+SIZE-i-1) + a;
; return *(PA+a);
; }
-; CHECK: define i32 @noAlias10
+; CHECK-LABEL: define i32 @noAlias10(
; CHECK-NOT: sub nsw <4 x i32>
; CHECK: ret
;
@@ -551,8 +550,8 @@ for.end: ; preds = %for.cond
; Bar.A[N][SIZE-i-1] = Bar.B[N][SIZE-i-1] + a;
; return Bar.A[N][a];
; }
-; CHECK: define i32 @noAlias11
-; CHECK: sub nsw <4 x i32>
+; CHECK-LABEL: define i32 @noAlias11(
+; CHECK: store <4 x i32>
; CHECK: ret
define i32 @noAlias11(i32 %a) #0 {
@@ -611,8 +610,8 @@ for.end: ; preds = %for.cond
; Bar.A[N][SIZE-i-1] = Bar.A[N+1][SIZE-i-1] + a;
; return Bar.A[N][a];
; }
-; CHECK: define i32 @noAlias12
-; CHECK: sub nsw <4 x i32>
+; CHECK-LABEL: define i32 @noAlias12(
+; CHECK: store <4 x i32>
; CHECK: ret
define i32 @noAlias12(i32 %a) #0 {
@@ -672,7 +671,7 @@ for.end: ; preds = %for.cond
; Foo.A[i] = Foo.A[i+4] + a;
; return Foo.A[a];
; }
-; CHECK: define i32 @noAlias13
+; CHECK-LABEL: define i32 @noAlias13(
; CHECK: add nsw <4 x i32>
; CHECK: ret
@@ -721,7 +720,7 @@ for.end: ; preds = %for.cond
; Foo.A[SIZE-i-1] = Foo.A[SIZE-i-5] + a;
; return Foo.A[a];
; }
-; CHECK: define i32 @noAlias14
+; CHECK-LABEL: define i32 @noAlias14(
; CHECK: sub nsw <4 x i32>
; CHECK: ret
@@ -777,7 +776,7 @@ for.end: ; preds = %for.cond
; Foo.A[i] = Foo.B[SIZE-i-1] + a;
; return Foo.A[a];
; }
-; CHECK: define i32 @mayAlias01
+; CHECK-LABEL: define i32 @mayAlias01(
; CHECK-NOT: add nsw <4 x i32>
; CHECK: ret
@@ -827,7 +826,7 @@ for.end: ; preds = %for.cond
; Foo.A[SIZE-i-1] = Foo.B[i] + a;
; return Foo.A[a];
; }
-; CHECK: define i32 @mayAlias02
+; CHECK-LABEL: define i32 @mayAlias02(
; CHECK-NOT: add nsw <4 x i32>
; CHECK: ret
@@ -877,7 +876,7 @@ for.end: ; preds = %for.cond
; *(PA+i) = *(PB+SIZE-i-1) + a;
; return *(PA+a);
; }
-; CHECK: define i32 @mayAlias03
+; CHECK-LABEL: define i32 @mayAlias03(
; CHECK-NOT: add nsw <4 x i32>
; CHECK: ret
@@ -934,7 +933,7 @@ for.end: ; preds = %for.cond
; Foo.A[i+10] = Foo.B[SIZE-i-1] + a;
; return Foo.A[a];
; }
-; CHECK: define i32 @mustAlias01
+; CHECK-LABEL: define i32 @mustAlias01(
; CHECK-NOT: add nsw <4 x i32>
; CHECK: ret
@@ -984,7 +983,7 @@ for.end: ; preds = %for.cond
; Foo.A[i] = Foo.B[SIZE-i-10] + a;
; return Foo.A[a];
; }
-; CHECK: define i32 @mustAlias02
+; CHECK-LABEL: define i32 @mustAlias02(
; CHECK-NOT: add nsw <4 x i32>
; CHECK: ret
@@ -1033,7 +1032,7 @@ for.end: ; preds = %for.cond
; Foo.A[i+10] = Foo.B[SIZE-i-10] + a;
; return Foo.A[a];
; }
-; CHECK: define i32 @mustAlias03
+; CHECK-LABEL: define i32 @mustAlias03(
; CHECK-NOT: add nsw <4 x i32>
; CHECK: ret
diff --git a/test/Transforms/LoopVectorize/hoist-loads.ll b/test/Transforms/LoopVectorize/hoist-loads.ll
new file mode 100644
index 000000000000..765e14d6985b
--- /dev/null
+++ b/test/Transforms/LoopVectorize/hoist-loads.ll
@@ -0,0 +1,69 @@
+; RUN: opt -loop-vectorize -force-vector-width=2 -force-vector-unroll=1 -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-S128"
+
+@A = common global [1024 x float] zeroinitializer, align 16
+@B = common global [1024 x float] zeroinitializer, align 16
+
+; Make sure we can vectorize in the presence of hoistable conditional loads.
+; CHECK-LABEL: @hoist_cond_load(
+; CHECK: load <2 x float>
+
+define void @hoist_cond_load() {
+entry:
+ br label %for.body
+for.body:
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %if.end9 ]
+ %arrayidx = getelementptr inbounds [1024 x float]* @A, i64 0, i64 %indvars.iv
+ %arrayidx2 = getelementptr inbounds [1024 x float]* @B, i64 0, i64 %indvars.iv
+ %0 = load float* %arrayidx2, align 4
+ %cmp3 = fcmp oeq float %0, 0.000000e+00
+ br i1 %cmp3, label %if.end9, label %if.else
+
+if.else:
+ %1 = load float* %arrayidx, align 4
+ br label %if.end9
+
+if.end9:
+ %tmp.0 = phi float [ %1, %if.else ], [ 0.000000e+00, %for.body ]
+ store float %tmp.0, float* %arrayidx, align 4
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, 1024
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
+
+; However, we can't hoist loads whose address we have not seen unconditionally
+; accessed.
+; CHECK-LABEL: @dont_hoist_cond_load(
+; CHECK-NOT: load <2 x float>
+
+define void @dont_hoist_cond_load() {
+entry:
+ br label %for.body
+for.body:
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %if.end9 ]
+ %arrayidx = getelementptr inbounds [1024 x float]* @A, i64 0, i64 %indvars.iv
+ %arrayidx2 = getelementptr inbounds [1024 x float]* @B, i64 0, i64 %indvars.iv
+ %0 = load float* %arrayidx2, align 4
+ %cmp3 = fcmp oeq float %0, 0.000000e+00
+ br i1 %cmp3, label %if.end9, label %if.else
+
+if.else:
+ %1 = load float* %arrayidx, align 4
+ br label %if.end9
+
+if.end9:
+ %tmp.0 = phi float [ %1, %if.else ], [ 0.000000e+00, %for.body ]
+ store float %tmp.0, float* %arrayidx2, align 4
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, 1024
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
diff --git a/test/Transforms/LoopVectorize/if-conv-crash.ll b/test/Transforms/LoopVectorize/if-conv-crash.ll
index 3283456aa3c3..f8f2cf1fff4b 100644
--- a/test/Transforms/LoopVectorize/if-conv-crash.ll
+++ b/test/Transforms/LoopVectorize/if-conv-crash.ll
@@ -37,3 +37,25 @@ if.end21: ; preds = %lor.lhs.false
if.end25: ; preds = %entry
ret void
}
+
+; PR15990
+; We can have basic blocks with single entry PHI nodes.
+define void @single_entry_phi(i32* %a, i32 *%b) {
+entry:
+ br label %for.cond1.preheader
+
+for.cond1.preheader:
+ %inc10 = phi i32 [ 0, %entry ], [ %inc, %for.end ]
+ br label %for.end
+
+for.end:
+ %malicious.phi = phi i32 [ 0, %for.cond1.preheader ]
+ %inc = add nsw i32 %inc10, 1
+ %tobool = icmp eq i32 %inc, 0
+ br i1 %tobool, label %for.cond.for.end5, label %for.cond1.preheader
+
+for.cond.for.end5:
+ %and.lcssa = phi i32 [ %malicious.phi, %for.end ]
+ store i32 %and.lcssa, i32* %a, align 4
+ ret void
+}
diff --git a/test/Transforms/LoopVectorize/if-conversion-edgemasks.ll b/test/Transforms/LoopVectorize/if-conversion-edgemasks.ll
new file mode 100644
index 000000000000..27c274d557eb
--- /dev/null
+++ b/test/Transforms/LoopVectorize/if-conversion-edgemasks.ll
@@ -0,0 +1,243 @@
+; RUN: opt -S -loop-vectorize < %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-S128"
+target triple = "x86_64-apple-macosx10.9.0"
+
+@a = global i32* null, align 8
+@b = global i32* null, align 8
+@c = global i32* null, align 8
+
+; Don't create an exponetial IR for the edge masks needed when if-converting
+; this code.
+
+; PR16472
+
+; CHECK-NOT: %6000000 =
+
+define void @_Z3fn4i(i32 %p1) {
+entry:
+ %cmp88 = icmp sgt i32 %p1, 0
+ br i1 %cmp88, label %for.body.lr.ph, label %for.end
+
+for.body.lr.ph:
+ %0 = load i32** @b, align 8 %1 = load i32** @a, align 8 %2 = load i32** @c, align 8 br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %_ZL3fn3ii.exit58 ]
+ %arrayidx = getelementptr inbounds i32* %0, i64 %indvars.iv
+ %3 = load i32* %arrayidx, align 4 %4 = trunc i64 %indvars.iv to i32
+ %and.i = and i32 %4, 1
+ %tobool.i.i = icmp eq i32 %and.i, 0
+ br i1 %tobool.i.i, label %if.end.i, label %if.then.i
+
+if.then.i:
+ %and.i.i = lshr i32 %3, 2
+ %and.lobit.i.i = and i32 %and.i.i, 1
+ %5 = xor i32 %and.lobit.i.i, 1
+ %or.i.i = or i32 %5, %3
+ %cmp.i = icmp sgt i32 %or.i.i, 0
+ %conv.i = zext i1 %cmp.i to i32
+ br label %if.end.i
+
+if.end.i:
+ %tobool.i87 = phi i1 [ true, %if.then.i ], [ false, %for.body ]
+ %p1.addr.0.i = phi i32 [ %conv.i, %if.then.i ], [ %3, %for.body ]
+ %6 = trunc i64 %indvars.iv to i32
+ %and1.i = and i32 %6, 7
+ %tobool2.i = icmp eq i32 %and1.i, 0
+ br i1 %tobool2.i, label %if.end7.i, label %if.then3.i
+
+if.then3.i:
+ %p1.addr.0.lobit.i = lshr i32 %p1.addr.0.i, 31
+ %and6.i = and i32 %p1.addr.0.i, 1
+ %or.i = or i32 %p1.addr.0.lobit.i, %and6.i
+ br label %if.end7.i
+
+if.end7.i:
+ %p1.addr.1.i = phi i32 [ %or.i, %if.then3.i ], [ %p1.addr.0.i, %if.end.i ]
+ br i1 %tobool.i87, label %if.then10.i, label %if.end13.i
+
+if.then10.i:
+ %cmp11.i = icmp sgt i32 %p1.addr.1.i, 0
+ %conv12.i = zext i1 %cmp11.i to i32
+ br label %if.end13.i
+
+if.end13.i:
+ %p1.addr.2.i = phi i32 [ %conv12.i, %if.then10.i ], [ %p1.addr.1.i, %if.end7.i ]
+ br i1 %tobool.i.i, label %_Z3fn2iii.exit, label %if.then16.i
+
+if.then16.i:
+ %and17.i = lshr i32 %p1.addr.2.i, 3
+ %and17.lobit.i = and i32 %and17.i, 1
+ br label %_Z3fn2iii.exit
+
+_Z3fn2iii.exit:
+ %p1.addr.3.i = phi i32 [ %and17.lobit.i, %if.then16.i ], [ %p1.addr.2.i, %if.end13.i ]
+ %7 = trunc i64 %indvars.iv to i32
+ %shr.i = ashr i32 %7, 1
+ %and.i18.i = and i32 %shr.i, 1
+ %tobool.i19.i = icmp ne i32 %and.i18.i, 0
+ br i1 %tobool.i19.i, label %if.then.i20.i, label %if.end.i.i
+
+if.then.i20.i:
+ %cmp.i.i = icmp sgt i32 %p1.addr.3.i, 0
+ %conv.i.i = zext i1 %cmp.i.i to i32
+ br label %if.end.i.i
+
+if.end.i.i:
+ %p1.addr.0.i21.i = phi i32 [ %conv.i.i, %if.then.i20.i ], [ %p1.addr.3.i, %_Z3fn2iii.exit ]
+ %and1.i.i = and i32 %shr.i, 7
+ %tobool2.i.i = icmp eq i32 %and1.i.i, 0
+ br i1 %tobool2.i.i, label %if.end7.i.i, label %if.then3.i.i
+
+if.then3.i.i:
+ %p1.addr.0.lobit.i.i = lshr i32 %p1.addr.0.i21.i, 31
+ %and6.i.i = and i32 %p1.addr.0.i21.i, 1
+ %or.i22.i = or i32 %p1.addr.0.lobit.i.i, %and6.i.i
+ br label %if.end7.i.i
+
+if.end7.i.i:
+ %p1.addr.1.i.i = phi i32 [ %or.i22.i, %if.then3.i.i ], [ %p1.addr.0.i21.i, %if.end.i.i ]
+ br i1 %tobool.i19.i, label %if.then10.i.i, label %if.end13.i.i
+
+if.then10.i.i:
+ %cmp11.i.i = icmp sgt i32 %p1.addr.1.i.i, 0
+ %conv12.i.i = zext i1 %cmp11.i.i to i32
+ br label %if.end13.i.i
+
+if.end13.i.i:
+ %p1.addr.2.i.i = phi i32 [ %conv12.i.i, %if.then10.i.i ], [ %p1.addr.1.i.i, %if.end7.i.i ]
+ %and14.i.i = and i32 %shr.i, 5
+ %tobool15.i.i = icmp eq i32 %and14.i.i, 0
+ br i1 %tobool15.i.i, label %_Z3fn2iii.exit.i, label %if.then16.i.i
+
+if.then16.i.i:
+ %and17.i.i = lshr i32 %p1.addr.2.i.i, 3
+ %and17.lobit.i.i = and i32 %and17.i.i, 1
+ br label %_Z3fn2iii.exit.i
+
+_Z3fn2iii.exit.i:
+ %p1.addr.3.i.i = phi i32 [ %and17.lobit.i.i, %if.then16.i.i ], [ %p1.addr.2.i.i, %if.end13.i.i ]
+ %8 = trunc i64 %indvars.iv to i32
+ %tobool.i11.i = icmp eq i32 %8, 0
+ br i1 %tobool.i11.i, label %_ZL3fn3ii.exit, label %if.then.i15.i
+
+if.then.i15.i:
+ %and.i12.i = lshr i32 %p1.addr.3.i.i, 2
+ %and.lobit.i13.i = and i32 %and.i12.i, 1
+ %9 = xor i32 %and.lobit.i13.i, 1
+ %or.i14.i = or i32 %9, %p1.addr.3.i.i
+ br label %_ZL3fn3ii.exit
+
+_ZL3fn3ii.exit:
+ %p1.addr.0.i16.i = phi i32 [ %or.i14.i, %if.then.i15.i ], [ %p1.addr.3.i.i, %_Z3fn2iii.exit.i ]
+ %arrayidx2 = getelementptr inbounds i32* %1, i64 %indvars.iv
+ store i32 %p1.addr.0.i16.i, i32* %arrayidx2, align 4 %arrayidx4 = getelementptr inbounds i32* %0, i64 %indvars.iv
+ %10 = load i32* %arrayidx4, align 4 br i1 %tobool.i.i, label %_Z3fn1ii.exit.i26, label %if.then.i.i21
+
+if.then.i.i21:
+ %and.i.i18 = lshr i32 %10, 2
+ %and.lobit.i.i19 = and i32 %and.i.i18, 1
+ %11 = xor i32 %and.lobit.i.i19, 1
+ %or.i.i20 = or i32 %11, %10
+ br label %_Z3fn1ii.exit.i26
+
+_Z3fn1ii.exit.i26:
+ %p1.addr.0.i.i22 = phi i32 [ %or.i.i20, %if.then.i.i21 ], [ %10, %_ZL3fn3ii.exit ]
+ br i1 %tobool.i87, label %if.then.i63, label %if.end.i67
+
+if.then.i63:
+ %cmp.i61 = icmp sgt i32 %p1.addr.0.i.i22, 0
+ %conv.i62 = zext i1 %cmp.i61 to i32
+ br label %if.end.i67
+
+if.end.i67:
+ %p1.addr.0.i64 = phi i32 [ %conv.i62, %if.then.i63 ], [ %p1.addr.0.i.i22, %_Z3fn1ii.exit.i26 ]
+ br i1 %tobool2.i, label %if.end7.i73, label %if.then3.i71
+
+if.then3.i71:
+ %p1.addr.0.lobit.i68 = lshr i32 %p1.addr.0.i64, 31
+ %and6.i69 = and i32 %p1.addr.0.i64, 1
+ %or.i70 = or i32 %p1.addr.0.lobit.i68, %and6.i69
+ br label %if.end7.i73
+
+if.end7.i73:
+ %p1.addr.1.i72 = phi i32 [ %or.i70, %if.then3.i71 ], [ %p1.addr.0.i64, %if.end.i67 ]
+ br i1 %tobool.i87, label %if.then10.i76, label %if.end13.i80
+
+if.then10.i76:
+ %cmp11.i74 = icmp sgt i32 %p1.addr.1.i72, 0
+ %conv12.i75 = zext i1 %cmp11.i74 to i32
+ br label %if.end13.i80
+
+if.end13.i80:
+ %p1.addr.2.i77 = phi i32 [ %conv12.i75, %if.then10.i76 ], [ %p1.addr.1.i72, %if.end7.i73 ]
+ br i1 %tobool.i.i, label %_Z3fn2iii.exit85, label %if.then16.i83
+
+if.then16.i83:
+ %and17.i81 = lshr i32 %p1.addr.2.i77, 3
+ %and17.lobit.i82 = and i32 %and17.i81, 1
+ br label %_Z3fn2iii.exit85
+
+_Z3fn2iii.exit85:
+ %p1.addr.3.i84 = phi i32 [ %and17.lobit.i82, %if.then16.i83 ], [ %p1.addr.2.i77, %if.end13.i80 ]
+ br i1 %tobool.i19.i, label %if.then.i20.i29, label %if.end.i.i33
+
+if.then.i20.i29:
+ %cmp.i.i27 = icmp sgt i32 %p1.addr.3.i84, 0
+ %conv.i.i28 = zext i1 %cmp.i.i27 to i32
+ br label %if.end.i.i33
+
+if.end.i.i33:
+ %p1.addr.0.i21.i30 = phi i32 [ %conv.i.i28, %if.then.i20.i29 ], [ %p1.addr.3.i84, %_Z3fn2iii.exit85 ]
+ br i1 %tobool2.i.i, label %if.end7.i.i39, label %if.then3.i.i37
+
+if.then3.i.i37:
+ %p1.addr.0.lobit.i.i34 = lshr i32 %p1.addr.0.i21.i30, 31
+ %and6.i.i35 = and i32 %p1.addr.0.i21.i30, 1
+ %or.i22.i36 = or i32 %p1.addr.0.lobit.i.i34, %and6.i.i35
+ br label %if.end7.i.i39
+
+if.end7.i.i39:
+ %p1.addr.1.i.i38 = phi i32 [ %or.i22.i36, %if.then3.i.i37 ], [ %p1.addr.0.i21.i30, %if.end.i.i33 ]
+ br i1 %tobool.i19.i, label %if.then10.i.i42, label %if.end13.i.i46
+
+if.then10.i.i42:
+ %cmp11.i.i40 = icmp sgt i32 %p1.addr.1.i.i38, 0
+ %conv12.i.i41 = zext i1 %cmp11.i.i40 to i32
+ br label %if.end13.i.i46
+
+if.end13.i.i46:
+ %p1.addr.2.i.i43 = phi i32 [ %conv12.i.i41, %if.then10.i.i42 ], [ %p1.addr.1.i.i38, %if.end7.i.i39 ]
+ br i1 %tobool15.i.i, label %_Z3fn2iii.exit.i52, label %if.then16.i.i49
+
+if.then16.i.i49:
+ %and17.i.i47 = lshr i32 %p1.addr.2.i.i43, 3
+ %and17.lobit.i.i48 = and i32 %and17.i.i47, 1
+ br label %_Z3fn2iii.exit.i52
+
+_Z3fn2iii.exit.i52:
+ %p1.addr.3.i.i50 = phi i32 [ %and17.lobit.i.i48, %if.then16.i.i49 ], [ %p1.addr.2.i.i43, %if.end13.i.i46 ]
+ br i1 %tobool.i11.i, label %_ZL3fn3ii.exit58, label %if.then.i15.i56
+
+if.then.i15.i56:
+ %and.i12.i53 = lshr i32 %p1.addr.3.i.i50, 2
+ %and.lobit.i13.i54 = and i32 %and.i12.i53, 1
+ %12 = xor i32 %and.lobit.i13.i54, 1
+ %or.i14.i55 = or i32 %12, %p1.addr.3.i.i50
+ br label %_ZL3fn3ii.exit58
+
+_ZL3fn3ii.exit58:
+ %p1.addr.0.i16.i57 = phi i32 [ %or.i14.i55, %if.then.i15.i56 ], [ %p1.addr.3.i.i50, %_Z3fn2iii.exit.i52 ]
+ %arrayidx7 = getelementptr inbounds i32* %2, i64 %indvars.iv
+ store i32 %p1.addr.0.i16.i57, i32* %arrayidx7, align 4 %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, %p1
+ br i1 %exitcond, label %for.body, label %for.cond.for.end_crit_edge
+
+for.cond.for.end_crit_edge:
+ br label %for.end
+
+for.end:
+ ret void
+}
diff --git a/test/Transforms/LoopVectorize/if-conversion-nest.ll b/test/Transforms/LoopVectorize/if-conversion-nest.ll
index f44862a2ebb9..92cb06e5e525 100644
--- a/test/Transforms/LoopVectorize/if-conversion-nest.ll
+++ b/test/Transforms/LoopVectorize/if-conversion-nest.ll
@@ -2,7 +2,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
-;CHECK: @foo
+;CHECK-LABEL: @foo(
;CHECK: icmp sgt
;CHECK: icmp sgt
;CHECK: icmp slt
diff --git a/test/Transforms/LoopVectorize/if-conversion-reduction.ll b/test/Transforms/LoopVectorize/if-conversion-reduction.ll
index 3a2d82e15d63..8cb703cdfa4b 100644
--- a/test/Transforms/LoopVectorize/if-conversion-reduction.ll
+++ b/test/Transforms/LoopVectorize/if-conversion-reduction.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9.0"
-;CHECK: @reduction_func
+;CHECK-LABEL: @reduction_func(
;CHECK-NOT: load <4 x i32>
;CHECK: ret i32
define i32 @reduction_func(i32* nocapture %A, i32 %n) nounwind uwtable readonly ssp {
diff --git a/test/Transforms/LoopVectorize/if-conversion.ll b/test/Transforms/LoopVectorize/if-conversion.ll
index 6e7c03a556c4..dbe0243a8110 100644
--- a/test/Transforms/LoopVectorize/if-conversion.ll
+++ b/test/Transforms/LoopVectorize/if-conversion.ll
@@ -17,7 +17,7 @@ target triple = "x86_64-apple-macosx10.9.0"
; }
;}
-;CHECK: @function0
+;CHECK-LABEL: @function0(
;CHECK: load <4 x i32>
;CHECK: icmp sgt <4 x i32>
;CHECK: mul <4 x i32>
@@ -70,7 +70,7 @@ for.end:
; return sum;
; }
-;CHECK: @reduction_func
+;CHECK-LABEL: @reduction_func(
;CHECK: load <4 x i32>
;CHECK: icmp sgt <4 x i32>
;CHECK: add <4 x i32>
@@ -106,3 +106,66 @@ for.end: ; preds = %for.inc, %entry
ret i32 %sum.0.lcssa
}
+@a = common global [1 x i32*] zeroinitializer, align 8
+@c = common global i32* null, align 8
+
+; We use to if convert this loop. This is not safe because there is a trapping
+; constant expression.
+; PR16729
+
+; CHECK-LABEL: trapping_constant_expression
+; CHECK-NOT: or <4 x i32>
+
+define i32 @trapping_constant_expression() {
+entry:
+ br label %for.body
+
+for.body:
+ %inc3 = phi i32 [ 0, %entry ], [ %inc, %cond.end ]
+ %or2 = phi i32 [ 0, %entry ], [ %or, %cond.end ]
+ br i1 icmp eq (i32** getelementptr inbounds ([1 x i32*]* @a, i64 0, i64 0), i32** @c), label %cond.false, label %cond.end
+
+cond.false:
+ br label %cond.end
+
+cond.end:
+ %cond = phi i32 [ sdiv (i32 1, i32 zext (i1 icmp eq (i32** getelementptr inbounds ([1 x i32*]* @a, i64 0, i64 0), i32** @c) to i32)), %cond.false ], [ 0, %for.body ]
+ %or = or i32 %or2, %cond
+ %inc = add nsw i32 %inc3, 1
+ %cmp = icmp slt i32 %inc, 128
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end:
+ ret i32 %or
+}
+
+; Neither should we if-convert if there is an instruction operand that is a
+; trapping constant expression.
+; PR16729
+
+; CHECK-LABEL: trapping_constant_expression2
+; CHECK-NOT: or <4 x i32>
+
+define i32 @trapping_constant_expression2() {
+entry:
+ br label %for.body
+
+for.body:
+ %inc3 = phi i32 [ 0, %entry ], [ %inc, %cond.end ]
+ %or2 = phi i32 [ 0, %entry ], [ %or, %cond.end ]
+ br i1 icmp eq (i32** getelementptr inbounds ([1 x i32*]* @a, i64 0, i64 0), i32** @c), label %cond.false, label %cond.end
+
+cond.false:
+ %cond.1 = or i32 %inc3, sdiv (i32 1, i32 zext (i1 icmp eq (i32** getelementptr inbounds ([1 x i32*]* @a, i64 0, i64 0), i32** @c) to i32))
+ br label %cond.end
+
+cond.end:
+ %cond = phi i32 [ %cond.1, %cond.false ], [ %inc3, %for.body ]
+ %or = or i32 %or2, %cond
+ %inc = add nsw i32 %inc3, 1
+ %cmp = icmp slt i32 %inc, 128
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end:
+ ret i32 %or
+}
diff --git a/test/Transforms/LoopVectorize/increment.ll b/test/Transforms/LoopVectorize/increment.ll
index 3fa6b19ca928..d35bd58a0281 100644
--- a/test/Transforms/LoopVectorize/increment.ll
+++ b/test/Transforms/LoopVectorize/increment.ll
@@ -9,7 +9,7 @@ target triple = "x86_64-apple-macosx10.8.0"
; for (i=0; i<n; i++){
; a[i] += i;
; }
-;CHECK: @inc
+;CHECK-LABEL: @inc(
;CHECK: load <4 x i32>
;CHECK: add nsw <4 x i32>
;CHECK: store <4 x i32>
@@ -39,7 +39,7 @@ define void @inc(i32 %n) nounwind uwtable noinline ssp {
; for (i = 0; i < n; ++i) {
; A[B[i]]++;
;
-;CHECK: @histogram
+;CHECK-LABEL: @histogram(
;CHECK-NOT: <4 x i32>
;CHECK: ret i32
define i32 @histogram(i32* nocapture noalias %A, i32* nocapture noalias %B, i32 %n) nounwind uwtable ssp {
diff --git a/test/Transforms/LoopVectorize/induction.ll b/test/Transforms/LoopVectorize/induction.ll
new file mode 100644
index 000000000000..50c3b6b6e79b
--- /dev/null
+++ b/test/Transforms/LoopVectorize/induction.ll
@@ -0,0 +1,110 @@
+; RUN: opt < %s -loop-vectorize -force-vector-unroll=1 -force-vector-width=2 -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-S128"
+
+; Make sure that we can handle multiple integer induction variables.
+; CHECK-LABEL: @multi_int_induction(
+; CHECK: vector.body:
+; CHECK: %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
+; CHECK: %normalized.idx = sub i64 %index, 0
+; CHECK: %[[VAR:.*]] = trunc i64 %normalized.idx to i32
+; CHECK: %offset.idx = add i32 190, %[[VAR]]
+define void @multi_int_induction(i32* %A, i32 %N) {
+for.body.lr.ph:
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
+ %count.09 = phi i32 [ 190, %for.body.lr.ph ], [ %inc, %for.body ]
+ %arrayidx2 = getelementptr inbounds i32* %A, i64 %indvars.iv
+ store i32 %count.09, i32* %arrayidx2, align 4
+ %inc = add nsw i32 %count.09, 1
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, %N
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
+
+; RUN: opt < %s -loop-vectorize -force-vector-unroll=1 -force-vector-width=2 -instcombine -S | FileCheck %s --check-prefix=IND
+
+; Make sure we remove unneeded vectorization of induction variables.
+; In order for instcombine to cleanup the vectorized induction variables that we
+; create in the loop vectorizer we need to perform some form of redundancy
+; elimination to get rid of multiple uses.
+
+; IND-LABEL: scalar_use
+
+; IND: br label %vector.body
+; IND: vector.body:
+; Vectorized induction variable.
+; IND-NOT: insertelement <2 x i64>
+; IND-NOT: shufflevector <2 x i64>
+; IND: br {{.*}}, label %vector.body
+
+define void @scalar_use(float* %a, float %b, i64 %offset, i64 %offset2, i64 %n) {
+entry:
+ br label %for.body
+
+for.body:
+ %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
+ %ind.sum = add i64 %iv, %offset
+ %arr.idx = getelementptr inbounds float* %a, i64 %ind.sum
+ %l1 = load float* %arr.idx, align 4
+ %ind.sum2 = add i64 %iv, %offset2
+ %arr.idx2 = getelementptr inbounds float* %a, i64 %ind.sum2
+ %l2 = load float* %arr.idx2, align 4
+ %m = fmul fast float %b, %l2
+ %ad = fadd fast float %l1, %m
+ store float %ad, float* %arr.idx, align 4
+ %iv.next = add nuw nsw i64 %iv, 1
+ %exitcond = icmp eq i64 %iv.next, %n
+ br i1 %exitcond, label %loopexit, label %for.body
+
+loopexit:
+ ret void
+}
+
+
+; Make sure that the loop exit count computation does not overflow for i8 and
+; i16. The exit count of these loops is i8/i16 max + 1. If we don't cast the
+; induction variable to a bigger type the exit count computation will overflow
+; to 0.
+; PR17532
+
+; CHECK-LABEL: i8_loop
+; CHECK; icmp eq i32 {{.*}}, 256
+define i32 @i8_loop() nounwind readnone ssp uwtable {
+ br label %1
+
+; <label>:1 ; preds = %1, %0
+ %a.0 = phi i32 [ 1, %0 ], [ %2, %1 ]
+ %b.0 = phi i8 [ 0, %0 ], [ %3, %1 ]
+ %2 = and i32 %a.0, 4
+ %3 = add i8 %b.0, -1
+ %4 = icmp eq i8 %3, 0
+ br i1 %4, label %5, label %1
+
+; <label>:5 ; preds = %1
+ ret i32 %2
+}
+
+; CHECK-LABEL: i16_loop
+; CHECK; icmp eq i32 {{.*}}, 65536
+
+define i32 @i16_loop() nounwind readnone ssp uwtable {
+ br label %1
+
+; <label>:1 ; preds = %1, %0
+ %a.0 = phi i32 [ 1, %0 ], [ %2, %1 ]
+ %b.0 = phi i16 [ 0, %0 ], [ %3, %1 ]
+ %2 = and i32 %a.0, 4
+ %3 = add i16 %b.0, -1
+ %4 = icmp eq i16 %3, 0
+ br i1 %4, label %5, label %1
+
+; <label>:5 ; preds = %1
+ ret i32 %2
+}
diff --git a/test/Transforms/LoopVectorize/induction_plus.ll b/test/Transforms/LoopVectorize/induction_plus.ll
index 96595cdc16bc..9c8201ab7805 100644
--- a/test/Transforms/LoopVectorize/induction_plus.ll
+++ b/test/Transforms/LoopVectorize/induction_plus.ll
@@ -5,9 +5,9 @@ target triple = "x86_64-apple-macosx10.8.0"
@array = common global [1024 x i32] zeroinitializer, align 16
-;CHECK: @array_at_plus_one
-;CHECK: trunc i64
+;CHECK-LABEL: @array_at_plus_one(
;CHECK: add i64 %index, 12
+;CHECK: trunc i64
;CHECK: ret i32
define i32 @array_at_plus_one(i32 %n) nounwind uwtable ssp {
%1 = icmp sgt i32 %n, 0
diff --git a/test/Transforms/LoopVectorize/infiniteloop.ll b/test/Transforms/LoopVectorize/infiniteloop.ll
new file mode 100644
index 000000000000..5c5e1a3be0a2
--- /dev/null
+++ b/test/Transforms/LoopVectorize/infiniteloop.ll
@@ -0,0 +1,34 @@
+; RUN: opt -S -indvars -loop-vectorize -force-vector-width=2 < %s | FileCheck %s
+
+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:32:32-n8:16:32-S128"
+
+@a = common global i64 0, align 8
+@x = common global i32 0, align 4
+
+; We used to assert on this loop because we could not find an induction
+; variable but assumed there must be one. Scalar evolution returned a exit
+; count for the loop below and from there on we assumed that there must be an
+; induction variable. This is not a valid assumption:
+; // getExitCount - Get the expression for the number of loop iterations for
+; // which this loop is *guaranteed not to exit* via ExitingBlock. Otherwise
+; // return SCEVCouldNotCompute.
+; For an infinite loop SE can return any number.
+
+; CHECK-LABEL: @fn1(
+define void @fn1() {
+entry:
+ store i64 0, i64* @a, align 8
+ br label %for.body
+
+for.body: ; preds = %for.body, %entry
+ %inc1 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
+ store volatile i32 0, i32* @x, align 4
+ %inc = add nsw i64 %inc1, 1
+ %cmp = icmp sgt i64 %inc1, -2
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end: ; preds = %for.body
+ %inc.lcssa = phi i64 [ %inc, %for.body ]
+ store i64 %inc.lcssa, i64* @a, align 8
+ ret void
+}
diff --git a/test/Transforms/LoopVectorize/intrinsic.ll b/test/Transforms/LoopVectorize/intrinsic.ll
index defbb5bd94ba..c3d570c03a77 100644
--- a/test/Transforms/LoopVectorize/intrinsic.ll
+++ b/test/Transforms/LoopVectorize/intrinsic.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-;CHECK: @sqrt_f32
+;CHECK-LABEL: @sqrt_f32(
;CHECK: llvm.sqrt.v4f32
;CHECK: ret void
define void @sqrt_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable {
@@ -29,7 +29,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.sqrt.f32(float) nounwind readnone
-;CHECK: @sqrt_f64
+;CHECK-LABEL: @sqrt_f64(
;CHECK: llvm.sqrt.v4f64
;CHECK: ret void
define void @sqrt_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable {
@@ -55,7 +55,7 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.sqrt.f64(double) nounwind readnone
-;CHECK: @sin_f32
+;CHECK-LABEL: @sin_f32(
;CHECK: llvm.sin.v4f32
;CHECK: ret void
define void @sin_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable {
@@ -81,7 +81,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.sin.f32(float) nounwind readnone
-;CHECK: @sin_f64
+;CHECK-LABEL: @sin_f64(
;CHECK: llvm.sin.v4f64
;CHECK: ret void
define void @sin_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable {
@@ -107,7 +107,7 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.sin.f64(double) nounwind readnone
-;CHECK: @cos_f32
+;CHECK-LABEL: @cos_f32(
;CHECK: llvm.cos.v4f32
;CHECK: ret void
define void @cos_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable {
@@ -133,7 +133,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.cos.f32(float) nounwind readnone
-;CHECK: @cos_f64
+;CHECK-LABEL: @cos_f64(
;CHECK: llvm.cos.v4f64
;CHECK: ret void
define void @cos_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable {
@@ -159,7 +159,7 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.cos.f64(double) nounwind readnone
-;CHECK: @exp_f32
+;CHECK-LABEL: @exp_f32(
;CHECK: llvm.exp.v4f32
;CHECK: ret void
define void @exp_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable {
@@ -185,7 +185,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.exp.f32(float) nounwind readnone
-;CHECK: @exp_f64
+;CHECK-LABEL: @exp_f64(
;CHECK: llvm.exp.v4f64
;CHECK: ret void
define void @exp_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable {
@@ -211,7 +211,7 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.exp.f64(double) nounwind readnone
-;CHECK: @exp2_f32
+;CHECK-LABEL: @exp2_f32(
;CHECK: llvm.exp2.v4f32
;CHECK: ret void
define void @exp2_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable {
@@ -237,7 +237,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.exp2.f32(float) nounwind readnone
-;CHECK: @exp2_f64
+;CHECK-LABEL: @exp2_f64(
;CHECK: llvm.exp2.v4f64
;CHECK: ret void
define void @exp2_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable {
@@ -263,7 +263,7 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.exp2.f64(double) nounwind readnone
-;CHECK: @log_f32
+;CHECK-LABEL: @log_f32(
;CHECK: llvm.log.v4f32
;CHECK: ret void
define void @log_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable {
@@ -289,7 +289,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.log.f32(float) nounwind readnone
-;CHECK: @log_f64
+;CHECK-LABEL: @log_f64(
;CHECK: llvm.log.v4f64
;CHECK: ret void
define void @log_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable {
@@ -315,7 +315,7 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.log.f64(double) nounwind readnone
-;CHECK: @log10_f32
+;CHECK-LABEL: @log10_f32(
;CHECK: llvm.log10.v4f32
;CHECK: ret void
define void @log10_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable {
@@ -341,7 +341,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.log10.f32(float) nounwind readnone
-;CHECK: @log10_f64
+;CHECK-LABEL: @log10_f64(
;CHECK: llvm.log10.v4f64
;CHECK: ret void
define void @log10_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable {
@@ -367,7 +367,7 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.log10.f64(double) nounwind readnone
-;CHECK: @log2_f32
+;CHECK-LABEL: @log2_f32(
;CHECK: llvm.log2.v4f32
;CHECK: ret void
define void @log2_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable {
@@ -393,7 +393,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.log2.f32(float) nounwind readnone
-;CHECK: @log2_f64
+;CHECK-LABEL: @log2_f64(
;CHECK: llvm.log2.v4f64
;CHECK: ret void
define void @log2_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable {
@@ -419,7 +419,7 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.log2.f64(double) nounwind readnone
-;CHECK: @fabs_f32
+;CHECK-LABEL: @fabs_f32(
;CHECK: llvm.fabs.v4f32
;CHECK: ret void
define void @fabs_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable {
@@ -468,7 +468,60 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.fabs(double) nounwind readnone
-;CHECK: @floor_f32
+;CHECK-LABEL: @copysign_f32(
+;CHECK: llvm.copysign.v4f32
+;CHECK: ret void
+define void @copysign_f32(i32 %n, float* noalias %y, float* noalias %x, float* noalias %z) nounwind uwtable {
+entry:
+ %cmp6 = icmp sgt i32 %n, 0
+ br i1 %cmp6, label %for.body, label %for.end
+
+for.body: ; preds = %entry, %for.body
+ %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
+ %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv
+ %0 = load float* %arrayidx, align 4
+ %arrayidx1 = getelementptr inbounds float* %z, i64 %indvars.iv
+ %1 = load float* %arrayidx1, align 4
+ %call = tail call float @llvm.copysign.f32(float %0, float %1) nounwind readnone
+ %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv
+ store float %call, float* %arrayidx2, align 4
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, %n
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ ret void
+}
+
+declare float @llvm.copysign.f32(float, float) nounwind readnone
+
+define void @copysign_f64(i32 %n, double* noalias %y, double* noalias %x, double* noalias %z) nounwind uwtable {
+entry:
+ %cmp6 = icmp sgt i32 %n, 0
+ br i1 %cmp6, label %for.body, label %for.end
+
+for.body: ; preds = %entry, %for.body
+ %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
+ %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv
+ %0 = load double* %arrayidx, align 8
+ %arrayidx1 = getelementptr inbounds double* %z, i64 %indvars.iv
+ %1 = load double* %arrayidx, align 8
+ %call = tail call double @llvm.copysign(double %0, double %1) nounwind readnone
+ %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv
+ store double %call, double* %arrayidx2, align 8
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, %n
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ ret void
+}
+
+declare double @llvm.copysign(double, double) nounwind readnone
+
+;CHECK-LABEL: @floor_f32(
;CHECK: llvm.floor.v4f32
;CHECK: ret void
define void @floor_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable {
@@ -494,7 +547,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.floor.f32(float) nounwind readnone
-;CHECK: @floor_f64
+;CHECK-LABEL: @floor_f64(
;CHECK: llvm.floor.v4f64
;CHECK: ret void
define void @floor_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable {
@@ -520,7 +573,7 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.floor.f64(double) nounwind readnone
-;CHECK: @ceil_f32
+;CHECK-LABEL: @ceil_f32(
;CHECK: llvm.ceil.v4f32
;CHECK: ret void
define void @ceil_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable {
@@ -546,7 +599,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.ceil.f32(float) nounwind readnone
-;CHECK: @ceil_f64
+;CHECK-LABEL: @ceil_f64(
;CHECK: llvm.ceil.v4f64
;CHECK: ret void
define void @ceil_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable {
@@ -572,7 +625,7 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.ceil.f64(double) nounwind readnone
-;CHECK: @trunc_f32
+;CHECK-LABEL: @trunc_f32(
;CHECK: llvm.trunc.v4f32
;CHECK: ret void
define void @trunc_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable {
@@ -598,7 +651,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.trunc.f32(float) nounwind readnone
-;CHECK: @trunc_f64
+;CHECK-LABEL: @trunc_f64(
;CHECK: llvm.trunc.v4f64
;CHECK: ret void
define void @trunc_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable {
@@ -624,7 +677,7 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.trunc.f64(double) nounwind readnone
-;CHECK: @rint_f32
+;CHECK-LABEL: @rint_f32(
;CHECK: llvm.rint.v4f32
;CHECK: ret void
define void @rint_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable {
@@ -650,7 +703,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.rint.f32(float) nounwind readnone
-;CHECK: @rint_f64
+;CHECK-LABEL: @rint_f64(
;CHECK: llvm.rint.v4f64
;CHECK: ret void
define void @rint_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable {
@@ -676,7 +729,7 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.rint.f64(double) nounwind readnone
-;CHECK: @nearbyint_f32
+;CHECK-LABEL: @nearbyint_f32(
;CHECK: llvm.nearbyint.v4f32
;CHECK: ret void
define void @nearbyint_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable {
@@ -702,7 +755,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.nearbyint.f32(float) nounwind readnone
-;CHECK: @nearbyint_f64
+;CHECK-LABEL: @nearbyint_f64(
;CHECK: llvm.nearbyint.v4f64
;CHECK: ret void
define void @nearbyint_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable {
@@ -728,7 +781,59 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.nearbyint.f64(double) nounwind readnone
-;CHECK: @fma_f32
+;CHECK-LABEL: @round_f32(
+;CHECK: llvm.round.v4f32
+;CHECK: ret void
+define void @round_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable {
+entry:
+ %cmp6 = icmp sgt i32 %n, 0
+ br i1 %cmp6, label %for.body, label %for.end
+
+for.body: ; preds = %entry, %for.body
+ %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
+ %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv
+ %0 = load float* %arrayidx, align 4
+ %call = tail call float @llvm.round.f32(float %0) nounwind readnone
+ %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv
+ store float %call, float* %arrayidx2, align 4
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, %n
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ ret void
+}
+
+declare float @llvm.round.f32(float) nounwind readnone
+
+;CHECK-LABEL: @round_f64(
+;CHECK: llvm.round.v4f64
+;CHECK: ret void
+define void @round_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable {
+entry:
+ %cmp6 = icmp sgt i32 %n, 0
+ br i1 %cmp6, label %for.body, label %for.end
+
+for.body: ; preds = %entry, %for.body
+ %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
+ %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv
+ %0 = load double* %arrayidx, align 8
+ %call = tail call double @llvm.round.f64(double %0) nounwind readnone
+ %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv
+ store double %call, double* %arrayidx2, align 8
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, %n
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ ret void
+}
+
+declare double @llvm.round.f64(double) nounwind readnone
+
+;CHECK-LABEL: @fma_f32(
;CHECK: llvm.fma.v4f32
;CHECK: ret void
define void @fma_f32(i32 %n, float* noalias %y, float* noalias %x, float* noalias %z, float* noalias %w) nounwind uwtable {
@@ -758,7 +863,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.fma.f32(float, float, float) nounwind readnone
-;CHECK: @fma_f64
+;CHECK-LABEL: @fma_f64(
;CHECK: llvm.fma.v4f64
;CHECK: ret void
define void @fma_f64(i32 %n, double* noalias %y, double* noalias %x, double* noalias %z, double* noalias %w) nounwind uwtable {
@@ -788,7 +893,7 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.fma.f64(double, double, double) nounwind readnone
-;CHECK: @fmuladd_f32
+;CHECK-LABEL: @fmuladd_f32(
;CHECK: llvm.fmuladd.v4f32
;CHECK: ret void
define void @fmuladd_f32(i32 %n, float* noalias %y, float* noalias %x, float* noalias %z, float* noalias %w) nounwind uwtable {
@@ -818,7 +923,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.fmuladd.f32(float, float, float) nounwind readnone
-;CHECK: @fmuladd_f64
+;CHECK-LABEL: @fmuladd_f64(
;CHECK: llvm.fmuladd.v4f64
;CHECK: ret void
define void @fmuladd_f64(i32 %n, double* noalias %y, double* noalias %x, double* noalias %z, double* noalias %w) nounwind uwtable {
@@ -848,7 +953,7 @@ for.end: ; preds = %for.body, %entry
declare double @llvm.fmuladd.f64(double, double, double) nounwind readnone
-;CHECK: @pow_f32
+;CHECK-LABEL: @pow_f32(
;CHECK: llvm.pow.v4f32
;CHECK: ret void
define void @pow_f32(i32 %n, float* noalias %y, float* noalias %x, float* noalias %z) nounwind uwtable {
@@ -876,7 +981,7 @@ for.end: ; preds = %for.body, %entry
declare float @llvm.pow.f32(float, float) nounwind readnone
-;CHECK: @pow_f64
+;CHECK-LABEL: @pow_f64(
;CHECK: llvm.pow.v4f64
;CHECK: ret void
define void @pow_f64(i32 %n, double* noalias %y, double* noalias %x, double* noalias %z) nounwind uwtable {
@@ -927,3 +1032,61 @@ for.end: ; preds = %for.body
declare float @fabsf(float) nounwind readnone
declare double @llvm.pow.f64(double, double) nounwind readnone
+
+
+
+; Make sure we don't replace calls to functions with standard library function
+; signatures but defined with internal linkage.
+
+define internal float @roundf(float %x) nounwind readnone {
+ ret float 0.00000000
+}
+; CHECK-LABEL: internal_round
+; CHECK-NOT: load <4 x float>
+
+define void @internal_round(float* nocapture %x) nounwind {
+entry:
+ br label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %arrayidx = getelementptr inbounds float* %x, i64 %indvars.iv
+ %0 = load float* %arrayidx, align 4
+ %call = tail call float @roundf(float %0) nounwind readnone
+ store float %call, float* %arrayidx, align 4
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, 1024
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body
+ ret void
+}
+
+; Make sure we don't replace calls to functions with standard library names but
+; different signatures.
+
+declare void @round(double %f)
+
+; CHECK-LABEL: wrong_signature
+; CHECK-NOT: load <4 x double>
+
+define void @wrong_signature(double* nocapture %x) nounwind {
+entry:
+ br label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %arrayidx = getelementptr inbounds double* %x, i64 %indvars.iv
+ %0 = load double* %arrayidx, align 4
+ store double %0, double* %arrayidx, align 4
+ tail call void @round(double %0) nounwind readnone
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, 1024
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body
+ ret void
+}
+
diff --git a/test/Transforms/LoopVectorize/lifetime.ll b/test/Transforms/LoopVectorize/lifetime.ll
new file mode 100644
index 000000000000..4f6f3b820a43
--- /dev/null
+++ b/test/Transforms/LoopVectorize/lifetime.ll
@@ -0,0 +1,96 @@
+; RUN: opt -S -loop-vectorize -force-vector-width=2 -force-vector-unroll=1 < %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-S128"
+
+; Make sure we can vectorize loops which contain lifetime markers.
+
+; CHECK-LABEL: @test(
+; CHECK: call void @llvm.lifetime.end
+; CHECK: store <2 x i32>
+; CHECK: call void @llvm.lifetime.start
+
+define void @test(i32 *%d) {
+entry:
+ %arr = alloca [1024 x i32], align 16
+ %0 = bitcast [1024 x i32]* %arr to i8*
+ call void @llvm.lifetime.start(i64 4096, i8* %0) #1
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ call void @llvm.lifetime.end(i64 4096, i8* %0) #1
+ %arrayidx = getelementptr inbounds i32* %d, i64 %indvars.iv
+ %1 = load i32* %arrayidx, align 8
+ store i32 100, i32* %arrayidx, align 8
+ call void @llvm.lifetime.start(i64 4096, i8* %0) #1
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, 128
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ call void @llvm.lifetime.end(i64 4096, i8* %0) #1
+ ret void
+}
+
+; CHECK-LABEL: @testbitcast(
+; CHECK: call void @llvm.lifetime.end
+; CHECK: store <2 x i32>
+; CHECK: call void @llvm.lifetime.start
+
+define void @testbitcast(i32 *%d) {
+entry:
+ %arr = alloca [1024 x i32], align 16
+ %0 = bitcast [1024 x i32]* %arr to i8*
+ call void @llvm.lifetime.start(i64 4096, i8* %0) #1
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %1 = bitcast [1024 x i32]* %arr to i8*
+ call void @llvm.lifetime.end(i64 4096, i8* %1) #1
+ %arrayidx = getelementptr inbounds i32* %d, i64 %indvars.iv
+ %2 = load i32* %arrayidx, align 8
+ store i32 100, i32* %arrayidx, align 8
+ call void @llvm.lifetime.start(i64 4096, i8* %1) #1
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, 128
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ call void @llvm.lifetime.end(i64 4096, i8* %0) #1
+ ret void
+}
+
+; CHECK-LABEL: @testloopvariant(
+; CHECK: call void @llvm.lifetime.end
+; CHECK: store <2 x i32>
+; CHECK: call void @llvm.lifetime.start
+
+define void @testloopvariant(i32 *%d) {
+entry:
+ %arr = alloca [1024 x i32], align 16
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %0 = getelementptr [1024 x i32]* %arr, i32 0, i64 %indvars.iv
+ %1 = bitcast [1024 x i32]* %arr to i8*
+ call void @llvm.lifetime.end(i64 4096, i8* %1) #1
+ %arrayidx = getelementptr inbounds i32* %d, i64 %indvars.iv
+ %2 = load i32* %arrayidx, align 8
+ store i32 100, i32* %arrayidx, align 8
+ call void @llvm.lifetime.start(i64 4096, i8* %1) #1
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, 128
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
+
+declare void @llvm.lifetime.start(i64, i8* nocapture) #1
+
+declare void @llvm.lifetime.end(i64, i8* nocapture) #1
diff --git a/test/Transforms/LoopVectorize/lit.local.cfg b/test/Transforms/LoopVectorize/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/LoopVectorize/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/LoopVectorize/memdep.ll b/test/Transforms/LoopVectorize/memdep.ll
new file mode 100644
index 000000000000..21cb703ba47c
--- /dev/null
+++ b/test/Transforms/LoopVectorize/memdep.ll
@@ -0,0 +1,222 @@
+; RUN: opt < %s -loop-vectorize -force-vector-width=2 -force-vector-unroll=1 -S | FileCheck %s
+; RUN: opt < %s -loop-vectorize -force-vector-width=4 -force-vector-unroll=1 -S | FileCheck %s -check-prefix=WIDTH
+
+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"
+
+; Vectorization with dependence checks.
+
+; No plausible dependence - can be vectorized.
+; for (i = 0; i < 1024; ++i)
+; A[i] = A[i + 1] + 1;
+
+; CHECK-LABEL: @f1_vec(
+; CHECK: <2 x i32>
+
+define void @f1_vec(i32* %A) {
+entry:
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i32 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %indvars.iv.next = add i32 %indvars.iv, 1
+ %arrayidx = getelementptr inbounds i32* %A, i32 %indvars.iv.next
+ %0 = load i32* %arrayidx, align 4
+ %add1 = add nsw i32 %0, 1
+ %arrayidx3 = getelementptr inbounds i32* %A, i32 %indvars.iv
+ store i32 %add1, i32* %arrayidx3, align 4
+ %exitcond = icmp ne i32 %indvars.iv.next, 1024
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
+
+; Plausible dependence of distance 1 - can't be vectorized.
+; for (i = 0; i < 1024; ++i)
+; A[i+1] = A[i] + 1;
+
+; CHECK-LABEL: @f2_novec(
+; CHECK-NOT: <2 x i32>
+
+define void @f2_novec(i32* %A) {
+entry:
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i32 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %arrayidx = getelementptr inbounds i32* %A, i32 %indvars.iv
+ %0 = load i32* %arrayidx, align 4
+ %add = add nsw i32 %0, 1
+ %indvars.iv.next = add i32 %indvars.iv, 1
+ %arrayidx3 = getelementptr inbounds i32* %A, i32 %indvars.iv.next
+ store i32 %add, i32* %arrayidx3, align 4
+ %exitcond = icmp ne i32 %indvars.iv.next, 1024
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
+
+; Plausible dependence of distance 2 - can be vectorized with a width of 2.
+; for (i = 0; i < 1024; ++i)
+; A[i+2] = A[i] + 1;
+
+; CHECK-LABEL: @f3_vec_len(
+; CHECK: <2 x i32>
+
+; WIDTH: f3_vec_len
+; WIDTH-NOT: <4 x i32>
+
+define void @f3_vec_len(i32* %A) {
+entry:
+ br label %for.body
+
+for.body:
+ %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+ %idxprom = sext i32 %i.01 to i64
+ %arrayidx = getelementptr inbounds i32* %A, i64 %idxprom
+ %0 = load i32* %arrayidx, align 4
+ %add = add nsw i32 %0, 1
+ %add1 = add nsw i32 %i.01, 2
+ %idxprom2 = sext i32 %add1 to i64
+ %arrayidx3 = getelementptr inbounds i32* %A, i64 %idxprom2
+ store i32 %add, i32* %arrayidx3, align 4
+ %inc = add nsw i32 %i.01, 1
+ %cmp = icmp slt i32 %inc, 1024
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
+
+; Plausible dependence of distance 1 - cannot be vectorized (without reordering
+; accesses).
+; for (i = 0; i < 1024; ++i) {
+; B[i] = A[i];
+; A[i] = B[i + 1];
+; }
+
+; CHECK-LABEL: @f5(
+; CHECK-NOT: <2 x i32>
+
+define void @f5(i32* %A, i32* %B) {
+entry:
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %arrayidx = getelementptr inbounds i32* %A, i64 %indvars.iv
+ %0 = load i32* %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds i32* %B, i64 %indvars.iv
+ store i32 %0, i32* %arrayidx2, align 4
+ %indvars.iv.next = add nsw i64 %indvars.iv, 1
+ %arrayidx4 = getelementptr inbounds i32* %B, i64 %indvars.iv.next
+ %1 = load i32* %arrayidx4, align 4
+ store i32 %1, i32* %arrayidx, align 4
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, 1024
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
+
+; Dependence through a phi node - must not vectorize.
+; for (i = 0; i < 1024; ++i) {
+; a[i+1] = tmp;
+; tmp = a[i];
+; }
+
+; CHECK-LABEL: @f6
+; CHECK-NOT: <2 x i32>
+
+define i32 @f6(i32* %a, i32 %tmp) {
+entry:
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %tmp.addr.08 = phi i32 [ %tmp, %entry ], [ %0, %for.body ]
+ %indvars.iv.next = add nsw i64 %indvars.iv, 1
+ %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv.next
+ store i32 %tmp.addr.08, i32* %arrayidx, align 4
+ %arrayidx3 = getelementptr inbounds i32* %a, i64 %indvars.iv
+ %0 = load i32* %arrayidx3, align 4
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, 1024
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ ret i32 undef
+}
+
+; Don't vectorize true loop carried dependencies that are not a multiple of the
+; vector width.
+; Example:
+; for (int i = ...; ++i) {
+; a[i] = a[i-3] + ...;
+; It is a bad idea to vectorize this loop because store-load forwarding will not
+; happen.
+;
+
+; CHECK-LABEL: @nostoreloadforward(
+; CHECK-NOT: <2 x i32>
+
+define void @nostoreloadforward(i32* %A) {
+entry:
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ 16, %entry ], [ %indvars.iv.next, %for.body ]
+ %0 = add nsw i64 %indvars.iv, -3
+ %arrayidx = getelementptr inbounds i32* %A, i64 %0
+ %1 = load i32* %arrayidx, align 4
+ %2 = add nsw i64 %indvars.iv, 4
+ %arrayidx2 = getelementptr inbounds i32* %A, i64 %2
+ %3 = load i32* %arrayidx2, align 4
+ %add3 = add nsw i32 %3, %1
+ %arrayidx5 = getelementptr inbounds i32* %A, i64 %indvars.iv
+ store i32 %add3, i32* %arrayidx5, align 4
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, 128
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
+
+; Example:
+; for (int i = ...; ++i) {
+; a[i] = b[i];
+; c[i] = a[i-3] + ...;
+; It is a bad idea to vectorize this loop because store-load forwarding will not
+; happen.
+;
+
+; CHECK-LABEL: @nostoreloadforward2(
+; CHECK-NOT: <2 x i32>
+
+define void @nostoreloadforward2(i32* noalias %A, i32* noalias %B, i32* noalias %C) {
+entry:
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ 16, %entry ], [ %indvars.iv.next, %for.body ]
+ %arrayidx = getelementptr inbounds i32* %B, i64 %indvars.iv
+ %0 = load i32* %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds i32* %A, i64 %indvars.iv
+ store i32 %0, i32* %arrayidx2, align 4
+ %1 = add nsw i64 %indvars.iv, -3
+ %arrayidx4 = getelementptr inbounds i32* %A, i64 %1
+ %2 = load i32* %arrayidx4, align 4
+ %arrayidx6 = getelementptr inbounds i32* %C, i64 %indvars.iv
+ store i32 %2, i32* %arrayidx6, align 4
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, 128
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
diff --git a/test/Transforms/LoopVectorize/metadata-unroll.ll b/test/Transforms/LoopVectorize/metadata-unroll.ll
new file mode 100644
index 000000000000..7f1037200659
--- /dev/null
+++ b/test/Transforms/LoopVectorize/metadata-unroll.ll
@@ -0,0 +1,41 @@
+; RUN: opt < %s -loop-vectorize -force-vector-width=4 -dce -instcombine -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-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+@a = common global [2048 x i32] zeroinitializer, align 16
+
+; This is the loop.
+; for (i=0; i<n; i++){
+; a[i] += i;
+; }
+;CHECK-LABEL: @inc(
+;CHECK: load <4 x i32>
+;CHECK: load <4 x i32>
+;CHECK: add nsw <4 x i32>
+;CHECK: add nsw <4 x i32>
+;CHECK: store <4 x i32>
+;CHECK: store <4 x i32>
+;CHECK: ret void
+define void @inc(i32 %n) nounwind uwtable noinline ssp {
+ %1 = icmp sgt i32 %n, 0
+ br i1 %1, label %.lr.ph, label %._crit_edge
+
+.lr.ph: ; preds = %0, %.lr.ph
+ %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
+ %2 = getelementptr inbounds [2048 x i32]* @a, i64 0, i64 %indvars.iv
+ %3 = load i32* %2, align 4
+ %4 = trunc i64 %indvars.iv to i32
+ %5 = add nsw i32 %3, %4
+ store i32 %5, i32* %2, align 4
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, %n
+ br i1 %exitcond, label %._crit_edge, label %.lr.ph, !llvm.loop !0
+
+._crit_edge: ; preds = %.lr.ph, %0
+ ret void
+}
+
+!0 = metadata !{metadata !0, metadata !1}
+!1 = metadata !{metadata !"llvm.vectorizer.unroll", i32 2}
diff --git a/test/Transforms/LoopVectorize/metadata-width.ll b/test/Transforms/LoopVectorize/metadata-width.ll
new file mode 100644
index 000000000000..1960c0bad6bc
--- /dev/null
+++ b/test/Transforms/LoopVectorize/metadata-width.ll
@@ -0,0 +1,31 @@
+; RUN: opt < %s -loop-vectorize -force-vector-unroll=1 -dce -instcombine -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-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; CHECK-LABEL: @test1(
+; CHECK: store <8 x i32>
+; CHECK: ret void
+define void @test1(i32* nocapture %a, i32 %n) #0 {
+entry:
+ %cmp4 = icmp sgt i32 %n, 0
+ br i1 %cmp4, label %for.body, label %for.end
+
+for.body: ; preds = %entry, %for.body
+ %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
+ %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv
+ %0 = trunc i64 %indvars.iv to i32
+ store i32 %0, i32* %arrayidx, align 4
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, %n
+ br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0
+
+for.end: ; preds = %for.body, %entry
+ ret void
+}
+
+attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
+
+!0 = metadata !{metadata !0, metadata !1}
+!1 = metadata !{metadata !"llvm.vectorizer.width", i32 8}
diff --git a/test/Transforms/LoopVectorize/minmax_reduction.ll b/test/Transforms/LoopVectorize/minmax_reduction.ll
index 502fd8b9383b..0e47260984f2 100644
--- a/test/Transforms/LoopVectorize/minmax_reduction.ll
+++ b/test/Transforms/LoopVectorize/minmax_reduction.ll
@@ -10,14 +10,14 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; Turn this into a max reduction. Make sure we use a splat to initialize the
; vector for the reduction.
-; CHECK: @max_red
+; CHECK-LABEL: @max_red(
; CHECK: %[[VAR:.*]] = insertelement <2 x i32> undef, i32 %max, i32 0
; CHECK: {{.*}} = shufflevector <2 x i32> %[[VAR]], <2 x i32> undef, <2 x i32> zeroinitializer
; CHECK: icmp sgt <2 x i32>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: icmp sgt <2 x i32>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define i32 @max_red(i32 %max) {
entry:
@@ -41,12 +41,12 @@ for.end:
; Turn this into a max reduction. The select has its inputs reversed therefore
; this is a max reduction.
-; CHECK: @max_red_inverse_select
+; CHECK-LABEL: @max_red_inverse_select(
; CHECK: icmp slt <2 x i32>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: icmp sgt <2 x i32>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define i32 @max_red_inverse_select(i32 %max) {
entry:
@@ -69,12 +69,12 @@ for.end:
}
; Turn this into a min reduction.
-; CHECK: @min_red
+; CHECK-LABEL: @min_red(
; CHECK: icmp slt <2 x i32>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: icmp slt <2 x i32>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define i32 @min_red(i32 %max) {
entry:
@@ -98,12 +98,12 @@ for.end:
; Turn this into a min reduction. The select has its inputs reversed therefore
; this is a min reduction.
-; CHECK: @min_red_inverse_select
+; CHECK-LABEL: @min_red_inverse_select(
; CHECK: icmp sgt <2 x i32>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: icmp slt <2 x i32>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define i32 @min_red_inverse_select(i32 %max) {
entry:
@@ -128,12 +128,12 @@ for.end:
; Unsigned tests.
; Turn this into a max reduction.
-; CHECK: @umax_red
+; CHECK-LABEL: @umax_red(
; CHECK: icmp ugt <2 x i32>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: icmp ugt <2 x i32>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define i32 @umax_red(i32 %max) {
entry:
@@ -157,12 +157,12 @@ for.end:
; Turn this into a max reduction. The select has its inputs reversed therefore
; this is a max reduction.
-; CHECK: @umax_red_inverse_select
+; CHECK-LABEL: @umax_red_inverse_select(
; CHECK: icmp ult <2 x i32>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: icmp ugt <2 x i32>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define i32 @umax_red_inverse_select(i32 %max) {
entry:
@@ -185,12 +185,12 @@ for.end:
}
; Turn this into a min reduction.
-; CHECK: @umin_red
+; CHECK-LABEL: @umin_red(
; CHECK: icmp ult <2 x i32>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: icmp ult <2 x i32>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define i32 @umin_red(i32 %max) {
entry:
@@ -214,12 +214,12 @@ for.end:
; Turn this into a min reduction. The select has its inputs reversed therefore
; this is a min reduction.
-; CHECK: @umin_red_inverse_select
+; CHECK-LABEL: @umin_red_inverse_select(
; CHECK: icmp ugt <2 x i32>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: icmp ult <2 x i32>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define i32 @umin_red_inverse_select(i32 %max) {
entry:
@@ -243,12 +243,12 @@ for.end:
; SGE -> SLT
; Turn this into a min reduction (select inputs are reversed).
-; CHECK: @sge_min_red
+; CHECK-LABEL: @sge_min_red(
; CHECK: icmp sge <2 x i32>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: icmp slt <2 x i32>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define i32 @sge_min_red(i32 %max) {
entry:
@@ -272,12 +272,12 @@ for.end:
; SLE -> SGT
; Turn this into a max reduction (select inputs are reversed).
-; CHECK: @sle_min_red
+; CHECK-LABEL: @sle_min_red(
; CHECK: icmp sle <2 x i32>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: icmp sgt <2 x i32>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define i32 @sle_min_red(i32 %max) {
entry:
@@ -301,12 +301,12 @@ for.end:
; UGE -> ULT
; Turn this into a min reduction (select inputs are reversed).
-; CHECK: @uge_min_red
+; CHECK-LABEL: @uge_min_red(
; CHECK: icmp uge <2 x i32>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: icmp ult <2 x i32>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define i32 @uge_min_red(i32 %max) {
entry:
@@ -330,12 +330,12 @@ for.end:
; ULE -> UGT
; Turn this into a max reduction (select inputs are reversed).
-; CHECK: @ule_min_red
+; CHECK-LABEL: @ule_min_red(
; CHECK: icmp ule <2 x i32>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: icmp ugt <2 x i32>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define i32 @ule_min_red(i32 %max) {
entry:
@@ -358,7 +358,7 @@ for.end:
}
; No reduction.
-; CHECK: @no_red_1
+; CHECK-LABEL: @no_red_1(
; CHECK-NOT: icmp <2 x i32>
define i32 @no_red_1(i32 %max) {
entry:
@@ -382,7 +382,7 @@ for.end:
ret i32 %max.red.0
}
-; CHECK: @no_red_2
+; CHECK-LABEL: @no_red_2(
; CHECK-NOT: icmp <2 x i32>
define i32 @no_red_2(i32 %max) {
entry:
@@ -411,12 +411,12 @@ for.end:
; Maximum.
; Turn this into a max reduction in the presence of a no-nans-fp-math attribute.
-; CHECK: @max_red_float
+; CHECK-LABEL: @max_red_float(
; CHECK: fcmp ogt <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp ogt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @max_red_float(float %max) #0 {
entry:
@@ -437,12 +437,12 @@ for.end:
ret float %max.red.0
}
-; CHECK: @max_red_float_ge
+; CHECK-LABEL: @max_red_float_ge(
; CHECK: fcmp oge <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp ogt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @max_red_float_ge(float %max) #0 {
entry:
@@ -463,12 +463,12 @@ for.end:
ret float %max.red.0
}
-; CHECK: @inverted_max_red_float
+; CHECK-LABEL: @inverted_max_red_float(
; CHECK: fcmp olt <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp ogt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @inverted_max_red_float(float %max) #0 {
entry:
@@ -489,12 +489,12 @@ for.end:
ret float %max.red.0
}
-; CHECK: @inverted_max_red_float_le
+; CHECK-LABEL: @inverted_max_red_float_le(
; CHECK: fcmp ole <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp ogt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @inverted_max_red_float_le(float %max) #0 {
entry:
@@ -515,12 +515,12 @@ for.end:
ret float %max.red.0
}
-; CHECK: @unordered_max_red
+; CHECK-LABEL: @unordered_max_red_float(
; CHECK: fcmp ugt <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp ogt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @unordered_max_red_float(float %max) #0 {
entry:
@@ -541,12 +541,12 @@ for.end:
ret float %max.red.0
}
-; CHECK: @unordered_max_red_float_ge
+; CHECK-LABEL: @unordered_max_red_float_ge(
; CHECK: fcmp uge <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp ogt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @unordered_max_red_float_ge(float %max) #0 {
entry:
@@ -567,12 +567,12 @@ for.end:
ret float %max.red.0
}
-; CHECK: @inverted_unordered_max_red
+; CHECK-LABEL: @inverted_unordered_max_red_float(
; CHECK: fcmp ult <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp ogt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @inverted_unordered_max_red_float(float %max) #0 {
entry:
@@ -593,12 +593,12 @@ for.end:
ret float %max.red.0
}
-; CHECK: @inverted_unordered_max_red_float_le
+; CHECK-LABEL: @inverted_unordered_max_red_float_le(
; CHECK: fcmp ule <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp ogt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @inverted_unordered_max_red_float_le(float %max) #0 {
entry:
@@ -622,12 +622,12 @@ for.end:
; Minimum.
; Turn this into a min reduction in the presence of a no-nans-fp-math attribute.
-; CHECK: @min_red_float
+; CHECK-LABEL: @min_red_float(
; CHECK: fcmp olt <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp olt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @min_red_float(float %min) #0 {
entry:
@@ -648,12 +648,12 @@ for.end:
ret float %min.red.0
}
-; CHECK: @min_red_float_le
+; CHECK-LABEL: @min_red_float_le(
; CHECK: fcmp ole <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp olt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @min_red_float_le(float %min) #0 {
entry:
@@ -674,12 +674,12 @@ for.end:
ret float %min.red.0
}
-; CHECK: @inverted_min_red_float
+; CHECK-LABEL: @inverted_min_red_float(
; CHECK: fcmp ogt <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp olt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @inverted_min_red_float(float %min) #0 {
entry:
@@ -700,12 +700,12 @@ for.end:
ret float %min.red.0
}
-; CHECK: @inverted_min_red_float_ge
+; CHECK-LABEL: @inverted_min_red_float_ge(
; CHECK: fcmp oge <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp olt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @inverted_min_red_float_ge(float %min) #0 {
entry:
@@ -726,12 +726,12 @@ for.end:
ret float %min.red.0
}
-; CHECK: @unordered_min_red
+; CHECK-LABEL: @unordered_min_red_float(
; CHECK: fcmp ult <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp olt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @unordered_min_red_float(float %min) #0 {
entry:
@@ -752,12 +752,12 @@ for.end:
ret float %min.red.0
}
-; CHECK: @unordered_min_red_float_le
+; CHECK-LABEL: @unordered_min_red_float_le(
; CHECK: fcmp ule <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp olt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @unordered_min_red_float_le(float %min) #0 {
entry:
@@ -778,12 +778,12 @@ for.end:
ret float %min.red.0
}
-; CHECK: @inverted_unordered_min_red
+; CHECK-LABEL: @inverted_unordered_min_red_float(
; CHECK: fcmp ugt <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp olt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @inverted_unordered_min_red_float(float %min) #0 {
entry:
@@ -804,12 +804,12 @@ for.end:
ret float %min.red.0
}
-; CHECK: @inverted_unordered_min_red_float_ge
+; CHECK-LABEL: @inverted_unordered_min_red_float_ge(
; CHECK: fcmp uge <2 x float>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp olt <2 x float>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define float @inverted_unordered_min_red_float_ge(float %min) #0 {
entry:
@@ -831,12 +831,12 @@ for.end:
}
; Make sure we handle doubles, too.
-; CHECK: @min_red_double
+; CHECK-LABEL: @min_red_double(
; CHECK: fcmp olt <2 x double>
; CHECK: select <2 x i1>
; CHECK: middle.block
; CHECK: fcmp olt <2 x double>
-; CHECK: select <2 x i1>
+; CHECK: select i1
define double @min_red_double(double %min) #0 {
entry:
@@ -859,7 +859,7 @@ for.end:
; Don't this into a max reduction. The no-nans-fp-math attribute is missing
-; CHECK: @max_red_float_nans
+; CHECK-LABEL: @max_red_float_nans(
; CHECK-NOT: <2 x float>
define float @max_red_float_nans(float %max) {
@@ -882,4 +882,4 @@ for.end:
}
-attributes #0 = { "no-nans-fp-math"="true" }
+attributes #0 = { "no-nans-fp-math"="true" }
diff --git a/test/Transforms/LoopVectorize/multiple-address-spaces.ll b/test/Transforms/LoopVectorize/multiple-address-spaces.ll
new file mode 100644
index 000000000000..7d836dedbdbb
--- /dev/null
+++ b/test/Transforms/LoopVectorize/multiple-address-spaces.ll
@@ -0,0 +1,44 @@
+; RUN: opt < %s -loop-vectorize -force-vector-unroll=1 -force-vector-width=4 -dce -instcombine -S | FileCheck %s
+
+; From a simple program with two address spaces:
+; char Y[4*10000] __attribute__((address_space(1)));
+; char X[4*10000];
+; int main() {
+; for (int i = 0; i < 4*10000; ++i)
+; X[i] = Y[i] + 1;
+; return 0;
+;}
+
+
+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-unknown-linux-gnu"
+
+@Y = common addrspace(1) global [40000 x i8] zeroinitializer, align 16
+@X = common global [40000 x i8] zeroinitializer, align 16
+
+;CHECK-LABEL: @main(
+;CHECK: bitcast i8 addrspace(1)* %{{.*}} to <4 x i8> addrspace(1)*
+;CHECK: bitcast i8* %{{.*}} to <4 x i8>*
+
+; Function Attrs: nounwind uwtable
+define i32 @main() #0 {
+entry:
+ br label %for.body
+
+for.body: ; preds = %for.body, %entry
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %arrayidx = getelementptr inbounds [40000 x i8] addrspace(1)* @Y, i64 0, i64 %indvars.iv
+ %0 = load i8 addrspace(1)* %arrayidx, align 1
+ %add = add i8 %0, 1
+ %arrayidx3 = getelementptr inbounds [40000 x i8]* @X, i64 0, i64 %indvars.iv
+ store i8 %add, i8* %arrayidx3, align 1
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, 40000
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body
+ ret i32 0
+}
+
+attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/test/Transforms/LoopVectorize/no_idiv_reduction.ll b/test/Transforms/LoopVectorize/no_idiv_reduction.ll
index cdfb3fd66f05..295fcabb0b29 100644
--- a/test/Transforms/LoopVectorize/no_idiv_reduction.ll
+++ b/test/Transforms/LoopVectorize/no_idiv_reduction.ll
@@ -7,7 +7,7 @@ entry:
br label %for.body
for.body:
- ; CHECK: @g
+ ; CHECK-LABEL: @g(
; CHECK-NOT: sdiv <2 x i32>
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
%r.05 = phi i32 [ 80, %entry ], [ %div, %for.body ]
diff --git a/test/Transforms/LoopVectorize/no_int_induction.ll b/test/Transforms/LoopVectorize/no_int_induction.ll
index 45aa8c7cd9be..e572d1a884ca 100644
--- a/test/Transforms/LoopVectorize/no_int_induction.ll
+++ b/test/Transforms/LoopVectorize/no_int_induction.ll
@@ -4,10 +4,10 @@
; return std::accumulate(A, A + n, 0);
; }
-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"
+target datalayout = "e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-n8:16:32:64-S128"
-;CHECK: @sum_array
+;CHECK-LABEL: @sum_array(
+;CHECK: phi i64
;CHECK: phi <4 x i32>
;CHECK: load <4 x i32>
;CHECK: add nsw <4 x i32>
@@ -31,3 +31,30 @@ _ZSt10accumulateIPiiET0_T_S2_S1_.exit: ; preds = %.lr.ph.i, %0
%.01.lcssa.i = phi i32 [ 0, %0 ], [ %5, %.lr.ph.i ]
ret i32 %.01.lcssa.i
}
+
+; Same, but use a pointer with a different size.
+;CHECK-LABEL: @sum_array_as1(
+;CHECK: phi i16
+;CHECK: phi <4 x i32>
+;CHECK: load <4 x i32>
+;CHECK: add nsw <4 x i32>
+;CHECK: ret i32
+define i32 @sum_array_as1(i32 addrspace(1)* %A, i32 %n) nounwind uwtable readonly noinline ssp {
+ %1 = sext i32 %n to i64
+ %2 = getelementptr inbounds i32 addrspace(1)* %A, i64 %1
+ %3 = icmp eq i32 %n, 0
+ br i1 %3, label %_ZSt10accumulateIPiiET0_T_S2_S1_.exit, label %.lr.ph.i
+
+.lr.ph.i: ; preds = %0, %.lr.ph.i
+ %.03.i = phi i32 addrspace(1)* [ %6, %.lr.ph.i ], [ %A, %0 ]
+ %.012.i = phi i32 [ %5, %.lr.ph.i ], [ 0, %0 ]
+ %4 = load i32 addrspace(1)* %.03.i, align 4
+ %5 = add nsw i32 %4, %.012.i
+ %6 = getelementptr inbounds i32 addrspace(1)* %.03.i, i64 1
+ %7 = icmp eq i32 addrspace(1)* %6, %2
+ br i1 %7, label %_ZSt10accumulateIPiiET0_T_S2_S1_.exit, label %.lr.ph.i
+
+_ZSt10accumulateIPiiET0_T_S2_S1_.exit: ; preds = %.lr.ph.i, %0
+ %.01.lcssa.i = phi i32 [ 0, %0 ], [ %5, %.lr.ph.i ]
+ ret i32 %.01.lcssa.i
+}
diff --git a/test/Transforms/LoopVectorize/no_outside_user.ll b/test/Transforms/LoopVectorize/no_outside_user.ll
index 6f0357c5e546..1f891ad2c4fa 100644
--- a/test/Transforms/LoopVectorize/no_outside_user.ll
+++ b/test/Transforms/LoopVectorize/no_outside_user.ll
@@ -12,6 +12,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
; We used to vectorize this loop. But it has a value that is used outside of the
; and is not a recognized reduction variable "tmp17".
+; CHECK-LABEL: @main(
; CHECK-NOT: <2 x i32>
define i32 @main() {
@@ -38,4 +39,33 @@ f1.exit.loopexit:
ret i32 %.lcssa
}
+; Don't vectorize this loop. Its phi node (induction variable) has an outside
+; loop user. We currently don't handle this case.
+; PR17179
+; CHECK-LABEL: @test2(
+; CHECK-NOT: <2 x
+
+@x1 = common global i32 0, align 4
+@x2 = common global i32 0, align 4
+@x0 = common global i32 0, align 4
+
+define i32 @test2() {
+entry:
+ store i32 0, i32* @x1, align 4
+ %0 = load i32* @x0, align 4
+ br label %for.cond1.preheader
+
+for.cond1.preheader:
+ %inc7 = phi i32 [ 0, %entry ], [ %inc, %for.cond1.preheader ]
+ %inc = add nsw i32 %inc7, 1
+ %cmp = icmp eq i32 %inc, 52
+ br i1 %cmp, label %for.end5, label %for.cond1.preheader
+
+for.end5:
+ %inc7.lcssa = phi i32 [ %inc7, %for.cond1.preheader ]
+ %xor = xor i32 %inc7.lcssa, %0
+ store i32 52, i32* @x1, align 4
+ store i32 1, i32* @x2, align 4
+ ret i32 %xor
+}
diff --git a/test/Transforms/LoopVectorize/nofloat.ll b/test/Transforms/LoopVectorize/nofloat.ll
index de23bf02b63a..c3c81b6f8450 100644
--- a/test/Transforms/LoopVectorize/nofloat.ll
+++ b/test/Transforms/LoopVectorize/nofloat.ll
@@ -7,7 +7,7 @@ target triple = "x86_64-apple-macosx10.8.0"
@a = common global [2048 x i32] zeroinitializer, align 16
-;CHECK: @example12
+;CHECK-LABEL: @example12(
;CHECK-NOT: store <4 x i32>
;CHECK: ret void
define void @example12() noimplicitfloat { ; <--------- "noimplicitfloat" attribute here!
diff --git a/test/Transforms/LoopVectorize/non-const-n.ll b/test/Transforms/LoopVectorize/non-const-n.ll
index 8262a18f1807..0c54a2b01226 100644
--- a/test/Transforms/LoopVectorize/non-const-n.ll
+++ b/test/Transforms/LoopVectorize/non-const-n.ll
@@ -7,7 +7,7 @@ target triple = "x86_64-apple-macosx10.8.0"
@c = common global [2048 x i32] zeroinitializer, align 16
@a = common global [2048 x i32] zeroinitializer, align 16
-;CHECK: @example1
+;CHECK-LABEL: @example1(
;CHECK: shl i32
;CHECK: zext i32
;CHECK: load <4 x i32>
diff --git a/test/Transforms/LoopVectorize/opt.ll b/test/Transforms/LoopVectorize/opt.ll
new file mode 100644
index 000000000000..27030a2ff2a9
--- /dev/null
+++ b/test/Transforms/LoopVectorize/opt.ll
@@ -0,0 +1,28 @@
+; RUN: opt -S -O3 -force-vector-width=2 -force-vector-unroll=1 < %s | FileCheck --check-prefix=LOOPVEC %s
+; RUN: opt -S -O3 -disable-loop-vectorization -force-vector-width=2 -force-vector-unroll=1 < %s | FileCheck --check-prefix=NOLOOPVEC %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-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+; Make sure we can disable vectorization in opt.
+
+; LOOPVEC: add <2 x i32>
+; NOLOOPVEC-NOT: add <2 x i32>
+
+define i32 @vect(i32* %a) {
+entry:
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %red.05 = phi i32 [ 0, %entry ], [ %add, %for.body ]
+ %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv
+ %0 = load i32* %arrayidx, align 4
+ %add = add nsw i32 %0, %red.05
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+ %exitcond = icmp eq i64 %indvars.iv.next, 255
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end:
+ ret i32 %add
+}
diff --git a/test/Transforms/LoopVectorize/ptr_loops.ll b/test/Transforms/LoopVectorize/ptr_loops.ll
index 25599f8f4c3c..15983f068556 100644
--- a/test/Transforms/LoopVectorize/ptr_loops.ll
+++ b/test/Transforms/LoopVectorize/ptr_loops.ll
@@ -6,7 +6,7 @@ target triple = "x86_64-apple-macosx10.8.0"
@A = global [36 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 34, i32 35], align 16
@B = global [36 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 34, i32 35], align 16
-;CHECK:_Z5test1v
+;CHECK-LABEL:@_Z5test1v(
;CHECK: load <4 x i32>
;CHECK: shufflevector <4 x i32>
;CHECK: store <4 x i32>
@@ -29,7 +29,7 @@ define i32 @_Z5test1v() nounwind uwtable ssp {
ret i32 0
}
-;CHECK:_Z5test2v
+;CHECK-LABEL: @_Z5test2v(
;CHECK: load <4 x i32>
;CHECK: shufflevector <4 x i32>
;CHECK: store <4 x i32>
diff --git a/test/Transforms/LoopVectorize/read-only.ll b/test/Transforms/LoopVectorize/read-only.ll
index bfaa6d452bce..fc8f0a5482f0 100644
--- a/test/Transforms/LoopVectorize/read-only.ll
+++ b/test/Transforms/LoopVectorize/read-only.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-;CHECK: @read_only_func
+;CHECK-LABEL: @read_only_func(
;CHECK: load <4 x i32>
;CHECK: ret i32
define i32 @read_only_func(i32* nocapture %A, i32* nocapture %B, i32 %n) nounwind uwtable readonly ssp {
diff --git a/test/Transforms/LoopVectorize/reduction.ll b/test/Transforms/LoopVectorize/reduction.ll
index 08b7b27e4257..791fce156220 100644
--- a/test/Transforms/LoopVectorize/reduction.ll
+++ b/test/Transforms/LoopVectorize/reduction.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-;CHECK: @reduction_sum
+;CHECK-LABEL: @reduction_sum(
;CHECK: phi <4 x i32>
;CHECK: load <4 x i32>
;CHECK: add <4 x i32>
@@ -38,7 +38,7 @@ define i32 @reduction_sum(i32 %n, i32* noalias nocapture %A, i32* noalias nocapt
ret i32 %sum.0.lcssa
}
-;CHECK: @reduction_prod
+;CHECK-LABEL: @reduction_prod(
;CHECK: phi <4 x i32>
;CHECK: load <4 x i32>
;CHECK: mul <4 x i32>
@@ -73,7 +73,7 @@ define i32 @reduction_prod(i32 %n, i32* noalias nocapture %A, i32* noalias nocap
ret i32 %prod.0.lcssa
}
-;CHECK: @reduction_mix
+;CHECK-LABEL: @reduction_mix(
;CHECK: phi <4 x i32>
;CHECK: load <4 x i32>
;CHECK: mul nsw <4 x i32>
@@ -108,7 +108,7 @@ define i32 @reduction_mix(i32 %n, i32* noalias nocapture %A, i32* noalias nocapt
ret i32 %sum.0.lcssa
}
-;CHECK: @reduction_mul
+;CHECK-LABEL: @reduction_mul(
;CHECK: mul <4 x i32>
;CHECK: shufflevector <4 x i32> %{{.*}}, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
;CHECK: mul <4 x i32>
@@ -141,7 +141,7 @@ define i32 @reduction_mul(i32 %n, i32* noalias nocapture %A, i32* noalias nocapt
ret i32 %sum.0.lcssa
}
-;CHECK: @start_at_non_zero
+;CHECK-LABEL: @start_at_non_zero(
;CHECK: phi <4 x i32>
;CHECK: <i32 120, i32 0, i32 0, i32 0>
;CHECK: shufflevector <4 x i32> %{{.*}}, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
@@ -174,7 +174,7 @@ for.end: ; preds = %for.body, %entry
ret i32 %sum.0.lcssa
}
-;CHECK: @reduction_and
+;CHECK-LABEL: @reduction_and(
;CHECK: and <4 x i32>
;CHECK: <i32 -1, i32 -1, i32 -1, i32 -1>
;CHECK: shufflevector <4 x i32> %{{.*}}, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
@@ -207,7 +207,7 @@ for.end: ; preds = %for.body, %entry
ret i32 %result.0.lcssa
}
-;CHECK: @reduction_or
+;CHECK-LABEL: @reduction_or(
;CHECK: or <4 x i32>
;CHECK: shufflevector <4 x i32> %{{.*}}, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
;CHECK: or <4 x i32>
@@ -239,7 +239,7 @@ for.end: ; preds = %for.body, %entry
ret i32 %result.0.lcssa
}
-;CHECK: @reduction_xor
+;CHECK-LABEL: @reduction_xor(
;CHECK: xor <4 x i32>
;CHECK: shufflevector <4 x i32> %{{.*}}, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
;CHECK: xor <4 x i32>
@@ -272,7 +272,7 @@ for.end: ; preds = %for.body, %entry
}
; In this code the subtracted variable is on the RHS and this is not an induction variable.
-;CHECK: @reduction_sub_rhs
+;CHECK-LABEL: @reduction_sub_rhs(
;CHECK-NOT: phi <4 x i32>
;CHECK-NOT: sub nsw <4 x i32>
;CHECK: ret i32
@@ -299,7 +299,7 @@ for.end: ; preds = %for.body, %entry
; In this test the reduction variable is on the LHS and we can vectorize it.
-;CHECK: @reduction_sub_lhs
+;CHECK-LABEL: @reduction_sub_lhs(
;CHECK: phi <4 x i32>
;CHECK: sub nsw <4 x i32>
;CHECK: ret i32
@@ -323,3 +323,174 @@ for.end: ; preds = %for.body, %entry
%x.0.lcssa = phi i32 [ 0, %entry ], [ %sub, %for.body ]
ret i32 %x.0.lcssa
}
+
+; We can vectorize conditional reductions with multi-input phis.
+; CHECK: reduction_conditional
+; CHECK: fadd <4 x float>
+
+define float @reduction_conditional(float* %A, float* %B, float* %C, float %S) {
+entry:
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc ]
+ %sum.033 = phi float [ %S, %entry ], [ %sum.1, %for.inc ]
+ %arrayidx = getelementptr inbounds float* %A, i64 %indvars.iv
+ %0 = load float* %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds float* %B, i64 %indvars.iv
+ %1 = load float* %arrayidx2, align 4
+ %cmp3 = fcmp ogt float %0, %1
+ br i1 %cmp3, label %if.then, label %for.inc
+
+if.then:
+ %cmp6 = fcmp ogt float %1, 1.000000e+00
+ br i1 %cmp6, label %if.then8, label %if.else
+
+if.then8:
+ %add = fadd fast float %sum.033, %0
+ br label %for.inc
+
+if.else:
+ %cmp14 = fcmp ogt float %0, 2.000000e+00
+ br i1 %cmp14, label %if.then16, label %for.inc
+
+if.then16:
+ %add19 = fadd fast float %sum.033, %1
+ br label %for.inc
+
+for.inc:
+ %sum.1 = phi float [ %add, %if.then8 ], [ %add19, %if.then16 ], [ %sum.033, %if.else ], [ %sum.033, %for.body ]
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, 128
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ %sum.1.lcssa = phi float [ %sum.1, %for.inc ]
+ ret float %sum.1.lcssa
+}
+
+; We can't vectorize reductions with phi inputs from outside the reduction.
+; CHECK: noreduction_phi
+; CHECK-NOT: fadd <4 x float>
+define float @noreduction_phi(float* %A, float* %B, float* %C, float %S) {
+entry:
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc ]
+ %sum.033 = phi float [ %S, %entry ], [ %sum.1, %for.inc ]
+ %arrayidx = getelementptr inbounds float* %A, i64 %indvars.iv
+ %0 = load float* %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds float* %B, i64 %indvars.iv
+ %1 = load float* %arrayidx2, align 4
+ %cmp3 = fcmp ogt float %0, %1
+ br i1 %cmp3, label %if.then, label %for.inc
+
+if.then:
+ %cmp6 = fcmp ogt float %1, 1.000000e+00
+ br i1 %cmp6, label %if.then8, label %if.else
+
+if.then8:
+ %add = fadd fast float %sum.033, %0
+ br label %for.inc
+
+if.else:
+ %cmp14 = fcmp ogt float %0, 2.000000e+00
+ br i1 %cmp14, label %if.then16, label %for.inc
+
+if.then16:
+ %add19 = fadd fast float %sum.033, %1
+ br label %for.inc
+
+for.inc:
+ %sum.1 = phi float [ %add, %if.then8 ], [ %add19, %if.then16 ], [ 0.000000e+00, %if.else ], [ %sum.033, %for.body ]
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, 128
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ %sum.1.lcssa = phi float [ %sum.1, %for.inc ]
+ ret float %sum.1.lcssa
+}
+
+; We can't vectorize reductions that feed another header PHI.
+; CHECK: noredux_header_phi
+; CHECK-NOT: fadd <4 x float>
+
+define float @noredux_header_phi(float* %A, float* %B, float* %C, float %S) {
+entry:
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %sum2.09 = phi float [ 0.000000e+00, %entry ], [ %add1, %for.body ]
+ %sum.08 = phi float [ %S, %entry ], [ %add, %for.body ]
+ %arrayidx = getelementptr inbounds float* %B, i64 %indvars.iv
+ %0 = load float* %arrayidx, align 4
+ %add = fadd fast float %sum.08, %0
+ %add1 = fadd fast float %sum2.09, %add
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, 128
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.end:
+ %add1.lcssa = phi float [ %add1, %for.body ]
+ %add.lcssa = phi float [ %add, %for.body ]
+ %add2 = fadd fast float %add.lcssa, %add1.lcssa
+ ret float %add2
+}
+
+
+; When vectorizing a reduction whose loop header phi value is used outside the
+; loop special care must be taken. Otherwise, the reduced value feeding into the
+; outside user misses a few iterations (VF-1) of the loop.
+; PR16522
+
+; CHECK-LABEL: @phivalueredux(
+; CHECK-NOT: x i32>
+
+define i32 @phivalueredux(i32 %p) {
+entry:
+ br label %for.body
+
+for.body:
+ %t.03 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+ %p.addr.02 = phi i32 [ %p, %entry ], [ %xor, %for.body ]
+ %xor = xor i32 %p.addr.02, -1
+ %inc = add nsw i32 %t.03, 1
+ %exitcond = icmp eq i32 %inc, 16
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end:
+ ret i32 %p.addr.02
+}
+
+; Don't vectorize a reduction value that is not the last in a reduction cyle. We
+; would loose iterations (VF-1) on the operations after that use.
+; PR17498
+
+; CHECK-LABEL: not_last_operation
+; CHECK-NOT: x i32>
+define i32 @not_last_operation(i32 %p, i32 %val) {
+entry:
+ %tobool = icmp eq i32 %p, 0
+ br label %for.body
+
+for.body:
+ %inc613.1 = phi i32 [ 0, %entry ], [ %inc6.1, %for.body ]
+ %inc511.1 = phi i32 [ %val, %entry ], [ %inc5.1, %for.body ]
+ %0 = zext i1 %tobool to i32
+ %inc4.1 = xor i32 %0, 1
+ %inc511.1.inc4.1 = add nsw i32 %inc511.1, %inc4.1
+ %inc5.1 = add nsw i32 %inc511.1.inc4.1, 1
+ %inc6.1 = add nsw i32 %inc613.1, 1
+ %exitcond.1 = icmp eq i32 %inc6.1, 22
+ br i1 %exitcond.1, label %exit, label %for.body
+
+exit:
+ %inc.2 = add nsw i32 %inc511.1.inc4.1, 2
+ ret i32 %inc.2
+}
diff --git a/test/Transforms/LoopVectorize/reverse_induction.ll b/test/Transforms/LoopVectorize/reverse_induction.ll
index f43f02bc3132..65ef95dcb121 100644
--- a/test/Transforms/LoopVectorize/reverse_induction.ll
+++ b/test/Transforms/LoopVectorize/reverse_induction.ll
@@ -5,7 +5,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; Make sure consecutive vector generates correct negative indices.
; PR15882
-; CHECK: reverse_induction_i64
+; CHECK-LABEL: @reverse_induction_i64(
; CHECK: add <4 x i64> %[[SPLAT:.*]], <i64 0, i64 -1, i64 -2, i64 -3>
; CHECK: add <4 x i64> %[[SPLAT]], <i64 -4, i64 -5, i64 -6, i64 -7>
@@ -29,7 +29,7 @@ loopend:
ret i32 %inc.redux
}
-; CHECK: reverse_induction_i128
+; CHECK-LABEL: @reverse_induction_i128(
; CHECK: add <4 x i128> %[[SPLAT:.*]], <i128 0, i128 -1, i128 -2, i128 -3>
; CHECK: add <4 x i128> %[[SPLAT]], <i128 -4, i128 -5, i128 -6, i128 -7>
define i32 @reverse_induction_i128(i128 %startval, i32 * %ptr) {
@@ -52,7 +52,7 @@ loopend:
ret i32 %inc.redux
}
-; CHECK: reverse_induction_i16
+; CHECK-LABEL: @reverse_induction_i16(
; CHECK: add <4 x i16> %[[SPLAT:.*]], <i16 0, i16 -1, i16 -2, i16 -3>
; CHECK: add <4 x i16> %[[SPLAT]], <i16 -4, i16 -5, i16 -6, i16 -7>
@@ -77,3 +77,72 @@ loopend:
}
+@a = common global [1024 x i32] zeroinitializer, align 16
+
+; We incorrectly transformed this loop into an empty one because we left the
+; induction variable in i8 type and truncated the exit value 1024 to 0.
+; int a[1024];
+;
+; void fail() {
+; int reverse_induction = 1023;
+; unsigned char forward_induction = 0;
+; while ((reverse_induction) >= 0) {
+; forward_induction++;
+; a[reverse_induction] = forward_induction;
+; --reverse_induction;
+; }
+; }
+
+; CHECK-LABEL: @reverse_forward_induction_i64_i8(
+; CHECK: vector.body
+; CHECK: %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
+; CHECK: %normalized.idx = sub i64 %index, 0
+; CHECK: %reverse.idx = sub i64 1023, %normalized.idx
+; CHECK: trunc i64 %index to i8
+
+define void @reverse_forward_induction_i64_i8() {
+entry:
+ br label %while.body
+
+while.body:
+ %indvars.iv = phi i64 [ 1023, %entry ], [ %indvars.iv.next, %while.body ]
+ %forward_induction.05 = phi i8 [ 0, %entry ], [ %inc, %while.body ]
+ %inc = add i8 %forward_induction.05, 1
+ %conv = zext i8 %inc to i32
+ %arrayidx = getelementptr inbounds [1024 x i32]* @a, i64 0, i64 %indvars.iv
+ store i32 %conv, i32* %arrayidx, align 4
+ %indvars.iv.next = add i64 %indvars.iv, -1
+ %0 = trunc i64 %indvars.iv to i32
+ %cmp = icmp sgt i32 %0, 0
+ br i1 %cmp, label %while.body, label %while.end
+
+while.end:
+ ret void
+}
+
+; CHECK-LABEL: @reverse_forward_induction_i64_i8_signed(
+; CHECK: vector.body:
+; CHECK: %index = phi i64 [ 129, %vector.ph ], [ %index.next, %vector.body ]
+; CHECK: %normalized.idx = sub i64 %index, 129
+; CHECK: %reverse.idx = sub i64 1023, %normalized.idx
+; CHECK: trunc i64 %index to i8
+
+define void @reverse_forward_induction_i64_i8_signed() {
+entry:
+ br label %while.body
+
+while.body:
+ %indvars.iv = phi i64 [ 1023, %entry ], [ %indvars.iv.next, %while.body ]
+ %forward_induction.05 = phi i8 [ -127, %entry ], [ %inc, %while.body ]
+ %inc = add i8 %forward_induction.05, 1
+ %conv = sext i8 %inc to i32
+ %arrayidx = getelementptr inbounds [1024 x i32]* @a, i64 0, i64 %indvars.iv
+ store i32 %conv, i32* %arrayidx, align 4
+ %indvars.iv.next = add i64 %indvars.iv, -1
+ %0 = trunc i64 %indvars.iv to i32
+ %cmp = icmp sgt i32 %0, 0
+ br i1 %cmp, label %while.body, label %while.end
+
+while.end:
+ ret void
+}
diff --git a/test/Transforms/LoopVectorize/reverse_iter.ll b/test/Transforms/LoopVectorize/reverse_iter.ll
new file mode 100644
index 000000000000..f803120c4d57
--- /dev/null
+++ b/test/Transforms/LoopVectorize/reverse_iter.ll
@@ -0,0 +1,45 @@
+; RUN: opt < %s -loop-vectorize -force-vector-unroll=1 -force-vector-width=4 -dce -instcombine -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-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+; Make sure that the reverse iterators are calculated using 64bit arithmetic, not 32.
+;
+; int foo(int n, int *A) {
+; int sum;
+; for (int i=n; i > 0; i--)
+; sum += A[i*2];
+; return sum;
+; }
+;
+
+;CHECK-LABEL: @foo(
+;CHECK: <i64 0, i64 -1, i64 -2, i64 -3>
+;CHECK: ret
+define i32 @foo(i32 %n, i32* nocapture %A) {
+ %1 = icmp sgt i32 %n, 0
+ br i1 %1, label %.lr.ph, label %._crit_edge
+
+.lr.ph: ; preds = %0
+ %2 = sext i32 %n to i64
+ br label %3
+
+; <label>:3 ; preds = %.lr.ph, %3
+ %indvars.iv = phi i64 [ %2, %.lr.ph ], [ %indvars.iv.next, %3 ]
+ %sum.01 = phi i32 [ undef, %.lr.ph ], [ %9, %3 ]
+ %4 = trunc i64 %indvars.iv to i32
+ %5 = shl nsw i32 %4, 1
+ %6 = sext i32 %5 to i64
+ %7 = getelementptr inbounds i32* %A, i64 %6
+ %8 = load i32* %7, align 4
+ %9 = add nsw i32 %8, %sum.01
+ %indvars.iv.next = add i64 %indvars.iv, -1
+ %10 = trunc i64 %indvars.iv.next to i32
+ %11 = icmp sgt i32 %10, 0
+ br i1 %11, label %3, label %._crit_edge
+
+._crit_edge: ; preds = %3, %0
+ %sum.0.lcssa = phi i32 [ undef, %0 ], [ %9, %3 ]
+ ret i32 %sum.0.lcssa
+}
+
diff --git a/test/Transforms/LoopVectorize/runtime-check-address-space.ll b/test/Transforms/LoopVectorize/runtime-check-address-space.ll
new file mode 100644
index 000000000000..6c86561a1c7e
--- /dev/null
+++ b/test/Transforms/LoopVectorize/runtime-check-address-space.ll
@@ -0,0 +1,235 @@
+; RUN: opt -S -march=r600 -mcpu=cayman -loop-vectorize -force-vector-unroll=1 -force-vector-width=4 -dce -instcombine < %s | FileCheck %s
+
+; Check vectorization that would ordinarily require a runtime bounds
+; check on the pointers when mixing address spaces. For now we cannot
+; assume address spaces do not alias, and we can't assume that
+; different pointers are directly comparable.
+;
+; These all test this basic loop for different combinations of address
+; spaces, and swapping in globals or adding noalias.
+;
+;void foo(int addrspace(N)* [noalias] a, int addrspace(M)* [noalias] b, int n)
+;{
+; for (int i = 0; i < n; ++i)
+; {
+; a[i] = 3 * b[i];
+; }
+;}
+
+; Artificial datalayout
+target datalayout = "e-p:32:32:32-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-v2048:2048:2048-n32:64"
+
+
+@g_as1 = common addrspace(1) global [1024 x i32] zeroinitializer, align 16
+@q_as2 = common addrspace(2) global [1024 x i32] zeroinitializer, align 16
+
+; Both parameters are unidentified objects with the same address
+; space, so this should vectorize normally.
+define void @foo(i32 addrspace(1)* %a, i32 addrspace(1)* %b, i32 %n) #0 {
+; CHECK-LABEL: @foo(
+; CHECK: <4 x i32>
+; CHECK: ret
+
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+ %cmp = icmp slt i32 %i.0, %n
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %idxprom = sext i32 %i.0 to i64
+ %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %idxprom
+ %0 = load i32 addrspace(1)* %arrayidx, align 4
+ %mul = mul nsw i32 %0, 3
+ %idxprom1 = sext i32 %i.0 to i64
+ %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %idxprom1
+ store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
+
+; Parameters are unidentified and different address spaces, so cannot vectorize.
+define void @bar0(i32* %a, i32 addrspace(1)* %b, i32 %n) #0 {
+; CHECK-LABEL: @bar0(
+; CHECK-NOT: <4 x i32>
+; CHECK: ret
+
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+ %cmp = icmp slt i32 %i.0, %n
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %idxprom = sext i32 %i.0 to i64
+ %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %idxprom
+ %0 = load i32 addrspace(1)* %arrayidx, align 4
+ %mul = mul nsw i32 %0, 3
+ %idxprom1 = sext i32 %i.0 to i64
+ %arrayidx2 = getelementptr inbounds i32* %a, i64 %idxprom1
+ store i32 %mul, i32* %arrayidx2, align 4
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
+
+; Swapped arguments should be the same
+define void @bar1(i32 addrspace(1)* %a, i32* %b, i32 %n) #0 {
+; CHECK-LABEL: @bar1(
+; CHECK-NOT: <4 x i32>
+; CHECK: ret
+
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+ %cmp = icmp slt i32 %i.0, %n
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %idxprom = sext i32 %i.0 to i64
+ %arrayidx = getelementptr inbounds i32* %b, i64 %idxprom
+ %0 = load i32* %arrayidx, align 4
+ %mul = mul nsw i32 %0, 3
+ %idxprom1 = sext i32 %i.0 to i64
+ %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %idxprom1
+ store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
+
+; We should still be able to vectorize with noalias even if the
+; address spaces are different.
+define void @bar2(i32* noalias %a, i32 addrspace(1)* noalias %b, i32 %n) #0 {
+; CHECK-LABEL: @bar2(
+; CHECK: <4 x i32>
+; CHECK: ret
+
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+ %cmp = icmp slt i32 %i.0, %n
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %idxprom = sext i32 %i.0 to i64
+ %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %idxprom
+ %0 = load i32 addrspace(1)* %arrayidx, align 4
+ %mul = mul nsw i32 %0, 3
+ %idxprom1 = sext i32 %i.0 to i64
+ %arrayidx2 = getelementptr inbounds i32* %a, i64 %idxprom1
+ store i32 %mul, i32* %arrayidx2, align 4
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
+
+; Store to identified global with different address space. This isn't
+; generally safe and shouldn't be vectorized.
+define void @arst0(i32* %b, i32 %n) #0 {
+; CHECK-LABEL: @arst0(
+; CHECK-NOT: <4 x i32>
+; CHECK: ret
+
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+ %cmp = icmp slt i32 %i.0, %n
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %idxprom = sext i32 %i.0 to i64
+ %arrayidx = getelementptr inbounds i32* %b, i64 %idxprom
+ %0 = load i32* %arrayidx, align 4
+ %mul = mul nsw i32 %0, 3
+ %idxprom1 = sext i32 %i.0 to i64
+ %arrayidx2 = getelementptr inbounds [1024 x i32] addrspace(1)* @g_as1, i64 0, i64 %idxprom1
+ store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
+
+
+; Load from identified global with different address space.
+; This isn't generally safe and shouldn't be vectorized.
+define void @arst1(i32* %b, i32 %n) #0 {
+; CHECK-LABEL: @arst1(
+; CHECK-NOT: <4 x i32>
+; CHECK: ret
+
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+ %cmp = icmp slt i32 %i.0, %n
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %idxprom = sext i32 %i.0 to i64
+ %arrayidx = getelementptr inbounds [1024 x i32] addrspace(1)* @g_as1, i64 0, i64 %idxprom
+ %0 = load i32 addrspace(1)* %arrayidx, align 4
+ %mul = mul nsw i32 %0, 3
+ %idxprom1 = sext i32 %i.0 to i64
+ %arrayidx2 = getelementptr inbounds i32* %b, i64 %idxprom1
+ store i32 %mul, i32* %arrayidx2, align 4
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
+
+; Read and write to 2 identified globals in different address
+; spaces. This should be vectorized.
+define void @aoeu(i32 %n) #0 {
+; CHECK-LABEL: @aoeu(
+; CHECK: <4 x i32>
+; CHECK: ret
+
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+ %cmp = icmp slt i32 %i.0, %n
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %idxprom = sext i32 %i.0 to i64
+ %arrayidx = getelementptr inbounds [1024 x i32] addrspace(2)* @q_as2, i64 0, i64 %idxprom
+ %0 = load i32 addrspace(2)* %arrayidx, align 4
+ %mul = mul nsw i32 %0, 3
+ %idxprom1 = sext i32 %i.0 to i64
+ %arrayidx2 = getelementptr inbounds [1024 x i32] addrspace(1)* @g_as1, i64 0, i64 %idxprom1
+ store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
+
+attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/test/Transforms/LoopVectorize/runtime-check-readonly-address-space.ll b/test/Transforms/LoopVectorize/runtime-check-readonly-address-space.ll
new file mode 100644
index 000000000000..212b37cceab3
--- /dev/null
+++ b/test/Transforms/LoopVectorize/runtime-check-readonly-address-space.ll
@@ -0,0 +1,142 @@
+; RUN: opt -S -march=r600 -mcpu=cayman -loop-vectorize -force-vector-unroll=1 -force-vector-width=4 -dce -instcombine < %s | FileCheck %s
+
+; Artificial datalayout
+target datalayout = "e-p:32:32:32-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-v2048:2048:2048-n32:64"
+
+
+define void @add_ints_1_1_1(i32 addrspace(1)* %a, i32 addrspace(1)* %b, i32 addrspace(1)* %c) #0 {
+; CHECK-LABEL: @add_ints_1_1_1(
+; CHECK: <4 x i32>
+; CHECK: ret
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
+ %cmp = icmp ult i64 %i.0, 200
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0
+ %0 = load i32 addrspace(1)* %arrayidx, align 4
+ %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.0
+ %1 = load i32 addrspace(1)* %arrayidx1, align 4
+ %add = add nsw i32 %0, %1
+ %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.0
+ store i32 %add, i32 addrspace(1)* %arrayidx2, align 4
+ %inc = add i64 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
+
+define void @add_ints_as_1_0_0(i32 addrspace(1)* %a, i32* %b, i32* %c) #0 {
+; CHECK-LABEL: @add_ints_as_1_0_0(
+; CHECK-NOT: <4 x i32>
+; CHECK: ret
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
+ %cmp = icmp ult i64 %i.0, 200
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %arrayidx = getelementptr inbounds i32* %b, i64 %i.0
+ %0 = load i32* %arrayidx, align 4
+ %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.0
+ %1 = load i32* %arrayidx1, align 4
+ %add = add nsw i32 %0, %1
+ %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.0
+ store i32 %add, i32 addrspace(1)* %arrayidx2, align 4
+ %inc = add i64 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
+
+define void @add_ints_as_0_1_0(i32* %a, i32 addrspace(1)* %b, i32* %c) #0 {
+; CHECK-LABEL: @add_ints_as_0_1_0(
+; CHECK-NOT: <4 x i32>
+; CHECK: ret
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
+ %cmp = icmp ult i64 %i.0, 200
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0
+ %0 = load i32 addrspace(1)* %arrayidx, align 4
+ %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.0
+ %1 = load i32* %arrayidx1, align 4
+ %add = add nsw i32 %0, %1
+ %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0
+ store i32 %add, i32* %arrayidx2, align 4
+ %inc = add i64 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
+
+define void @add_ints_as_0_1_1(i32* %a, i32 addrspace(1)* %b, i32 addrspace(1)* %c) #0 {
+; CHECK-LABEL: @add_ints_as_0_1_1(
+; CHECK-NOT: <4 x i32>
+; CHECK: ret
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
+ %cmp = icmp ult i64 %i.0, 200
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0
+ %0 = load i32 addrspace(1)* %arrayidx, align 4
+ %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.0
+ %1 = load i32 addrspace(1)* %arrayidx1, align 4
+ %add = add nsw i32 %0, %1
+ %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0
+ store i32 %add, i32* %arrayidx2, align 4
+ %inc = add i64 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
+
+define void @add_ints_as_0_1_2(i32* %a, i32 addrspace(1)* %b, i32 addrspace(2)* %c) #0 {
+; CHECK-LABEL: @add_ints_as_0_1_2(
+; CHECK-NOT: <4 x i32>
+; CHECK: ret
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
+ %cmp = icmp ult i64 %i.0, 200
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0
+ %0 = load i32 addrspace(1)* %arrayidx, align 4
+ %arrayidx1 = getelementptr inbounds i32 addrspace(2)* %c, i64 %i.0
+ %1 = load i32 addrspace(2)* %arrayidx1, align 4
+ %add = add nsw i32 %0, %1
+ %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0
+ store i32 %add, i32* %arrayidx2, align 4
+ %inc = add i64 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
+
+attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/test/Transforms/LoopVectorize/runtime-check-readonly.ll b/test/Transforms/LoopVectorize/runtime-check-readonly.ll
index 4145d134fd70..a2b9ad94c837 100644
--- a/test/Transforms/LoopVectorize/runtime-check-readonly.ll
+++ b/test/Transforms/LoopVectorize/runtime-check-readonly.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-;CHECK: add_ints
+;CHECK-LABEL: @add_ints(
;CHECK: br
;CHECK: getelementptr
;CHECK-NEXT: getelementptr
diff --git a/test/Transforms/LoopVectorize/runtime-check.ll b/test/Transforms/LoopVectorize/runtime-check.ll
index 014c4fc48f87..d15479d202b7 100644
--- a/test/Transforms/LoopVectorize/runtime-check.ll
+++ b/test/Transforms/LoopVectorize/runtime-check.ll
@@ -12,7 +12,7 @@ target triple = "x86_64-apple-macosx10.9.0"
;CHECK: for.body.preheader:
;CHECK: br i1 %cmp.zero, label %middle.block, label %vector.memcheck
;CHECK: vector.memcheck:
-;CHECK: br i1 %found.conflict, label %middle.block, label %vector.ph
+;CHECK: br i1 %memcheck.conflict, label %middle.block, label %vector.ph
;CHECK: load <4 x float>
define i32 @foo(float* nocapture %a, float* nocapture %b, i32 %n) nounwind uwtable ssp {
entry:
@@ -34,3 +34,31 @@ for.body: ; preds = %entry, %for.body
for.end: ; preds = %for.body, %entry
ret i32 undef
}
+
+; Make sure that we try to vectorize loops with a runtime check if the
+; dependency check fails.
+
+; CHECK-LABEL: test_runtime_check
+; CHECK: <4 x float>
+define void @test_runtime_check(float* %a, float %b, i64 %offset, i64 %offset2, i64 %n) {
+entry:
+ br label %for.body
+
+for.body:
+ %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
+ %ind.sum = add i64 %iv, %offset
+ %arr.idx = getelementptr inbounds float* %a, i64 %ind.sum
+ %l1 = load float* %arr.idx, align 4
+ %ind.sum2 = add i64 %iv, %offset2
+ %arr.idx2 = getelementptr inbounds float* %a, i64 %ind.sum2
+ %l2 = load float* %arr.idx2, align 4
+ %m = fmul fast float %b, %l2
+ %ad = fadd fast float %l1, %m
+ store float %ad, float* %arr.idx, align 4
+ %iv.next = add nuw nsw i64 %iv, 1
+ %exitcond = icmp eq i64 %iv.next, %n
+ br i1 %exitcond, label %loopexit, label %for.body
+
+loopexit:
+ ret void
+}
diff --git a/test/Transforms/LoopVectorize/runtime-limit.ll b/test/Transforms/LoopVectorize/runtime-limit.ll
index d7839746f0e1..7370a6fb93c5 100644
--- a/test/Transforms/LoopVectorize/runtime-limit.ll
+++ b/test/Transforms/LoopVectorize/runtime-limit.ll
@@ -4,7 +4,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-apple-macosx10.8.0"
; We are vectorizing with 6 runtime checks.
-;CHECK: func1x6
+;CHECK-LABEL: func1x6(
;CHECK: <4 x i32>
;CHECK: ret
define i32 @func1x6(i32* nocapture %out, i32* nocapture %A, i32* nocapture %B, i32* nocapture %C, i32* nocapture %D, i32* nocapture %E, i32* nocapture %F) {
@@ -38,7 +38,7 @@ for.end: ; preds = %for.body
}
; We are not vectorizing with 12 runtime checks.
-;CHECK: func2x6
+;CHECK-LABEL: func2x6(
;CHECK-NOT: <4 x i32>
;CHECK: ret
define i32 @func2x6(i32* nocapture %out, i32* nocapture %out2, i32* nocapture %A, i32* nocapture %B, i32* nocapture %C, i32* nocapture %D, i32* nocapture %E, i32* nocapture %F) {
diff --git a/test/Transforms/LoopVectorize/safegep.ll b/test/Transforms/LoopVectorize/safegep.ll
new file mode 100644
index 000000000000..c9508601e2c1
--- /dev/null
+++ b/test/Transforms/LoopVectorize/safegep.ll
@@ -0,0 +1,61 @@
+; RUN: opt -S -loop-vectorize -force-vector-width=4 -force-vector-unroll=1 < %s | FileCheck %s
+target datalayout = "e-p:32:32:32-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f16:16:16-f32:32:32-f64:32:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
+
+
+; We can vectorize this code because if the address computation would wrap then
+; a load from 0 would take place which is undefined behaviour in address space 0
+; according to LLVM IR semantics.
+
+; PR16592
+
+; CHECK-LABEL: @safe(
+; CHECK: <4 x float>
+
+define void @safe(float* %A, float* %B, float %K) {
+entry:
+ br label %"<bb 3>"
+
+"<bb 3>":
+ %i_15 = phi i32 [ 0, %entry ], [ %i_19, %"<bb 3>" ]
+ %pp3 = getelementptr float* %A, i32 %i_15
+ %D.1396_10 = load float* %pp3, align 4
+ %pp24 = getelementptr float* %B, i32 %i_15
+ %D.1398_15 = load float* %pp24, align 4
+ %D.1399_17 = fadd float %D.1398_15, %K
+ %D.1400_18 = fmul float %D.1396_10, %D.1399_17
+ store float %D.1400_18, float* %pp3, align 4
+ %i_19 = add nsw i32 %i_15, 1
+ %exitcond = icmp ne i32 %i_19, 64
+ br i1 %exitcond, label %"<bb 3>", label %return
+
+return:
+ ret void
+}
+
+; In a non-default address space we don't have this rule.
+
+; CHECK-LABEL: @notsafe(
+; CHECK-NOT: <4 x float>
+
+define void @notsafe(float addrspace(5) * %A, float* %B, float %K) {
+entry:
+ br label %"<bb 3>"
+
+"<bb 3>":
+ %i_15 = phi i32 [ 0, %entry ], [ %i_19, %"<bb 3>" ]
+ %pp3 = getelementptr float addrspace(5) * %A, i32 %i_15
+ %D.1396_10 = load float addrspace(5) * %pp3, align 4
+ %pp24 = getelementptr float* %B, i32 %i_15
+ %D.1398_15 = load float* %pp24, align 4
+ %D.1399_17 = fadd float %D.1398_15, %K
+ %D.1400_18 = fmul float %D.1396_10, %D.1399_17
+ store float %D.1400_18, float addrspace(5) * %pp3, align 4
+ %i_19 = add nsw i32 %i_15, 1
+ %exitcond = icmp ne i32 %i_19, 64
+ br i1 %exitcond, label %"<bb 3>", label %return
+
+return:
+ ret void
+}
+
+
diff --git a/test/Transforms/LoopVectorize/same-base-access.ll b/test/Transforms/LoopVectorize/same-base-access.ll
index 15738936457a..d623a3469096 100644
--- a/test/Transforms/LoopVectorize/same-base-access.ll
+++ b/test/Transforms/LoopVectorize/same-base-access.ll
@@ -11,7 +11,7 @@ target triple = "x86_64-apple-macosx10.9.0"
; x[k] = x[k-1] + y[k];
; }
-; CHECK: @kernel11
+; CHECK-LABEL: @kernel11(
; CHECK-NOT: <4 x double>
; CHECK: ret
define i32 @kernel11(double* %x, double* %y, i32 %n) nounwind uwtable ssp {
@@ -77,7 +77,7 @@ define i32 @kernel11(double* %x, double* %y, i32 %n) nounwind uwtable ssp {
; }
; }
-; CHECK: @func2
+; CHECK-LABEL: @func2(
; CHECK-NOT: <4 x i32>
; CHECK: ret
define i32 @func2(i32* nocapture %a) nounwind uwtable ssp {
diff --git a/test/Transforms/LoopVectorize/scalar-select.ll b/test/Transforms/LoopVectorize/scalar-select.ll
index 7a14d247c9b4..257c7bebe4d5 100644
--- a/test/Transforms/LoopVectorize/scalar-select.ll
+++ b/test/Transforms/LoopVectorize/scalar-select.ll
@@ -7,7 +7,7 @@ target triple = "x86_64-apple-macosx10.8.0"
@b = common global [2048 x i32] zeroinitializer, align 16
@c = common global [2048 x i32] zeroinitializer, align 16
-;CHECK: @example1
+;CHECK-LABEL: @example1(
;CHECK: load <4 x i32>
; make sure that we have a scalar condition and a vector operand.
;CHECK: select i1 %cond, <4 x i32>
diff --git a/test/Transforms/LoopVectorize/scev-exitlim-crash.ll b/test/Transforms/LoopVectorize/scev-exitlim-crash.ll
new file mode 100644
index 000000000000..683621a6f69b
--- /dev/null
+++ b/test/Transforms/LoopVectorize/scev-exitlim-crash.ll
@@ -0,0 +1,114 @@
+; RUN: opt < %s -loop-vectorize -force-vector-unroll=2 -force-vector-width=8 -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-S128"
+target triple = "x86_64-apple-macosx"
+
+@b = common global i32 0, align 4
+@f = common global i32 0, align 4
+@a = common global i32 0, align 4
+@d = common global i32* null, align 8
+@e = common global i32* null, align 8
+@c = common global i32 0, align 4
+
+; CHECK-LABEL: @fn1(
+; CHECK: vector.body
+define void @fn1() #0 {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.cond, %entry
+ %i.0 = phi i32 [ undef, %entry ], [ %inc, %for.cond ]
+ %cmp = icmp slt i32 %i.0, 0
+ %call = tail call i32 @fn2(double fadd (double fsub (double undef, double undef), double 1.000000e+00)) #2
+ %inc = add nsw i32 %i.0, 1
+ br i1 %cmp, label %for.cond, label %for.cond4.preheader
+
+for.cond4.preheader: ; preds = %for.cond
+ %call.lcssa = phi i32 [ %call, %for.cond ]
+ %cmp514 = icmp sgt i32 %call.lcssa, 0
+ br i1 %cmp514, label %for.cond7.preheader.lr.ph, label %for.end26
+
+for.cond7.preheader.lr.ph: ; preds = %for.cond4.preheader
+ %0 = load i32** @e, align 8, !tbaa !4
+ br label %for.cond7.preheader
+
+for.cond7.preheader: ; preds = %for.cond7.preheader.lr.ph, %for.inc23
+ %y.017 = phi i32 [ 0, %for.cond7.preheader.lr.ph ], [ %inc24, %for.inc23 ]
+ %i.116 = phi i32 [ 0, %for.cond7.preheader.lr.ph ], [ %i.2.lcssa, %for.inc23 ]
+ %n.015 = phi i32 [ undef, %for.cond7.preheader.lr.ph ], [ %inc25, %for.inc23 ]
+ %1 = load i32* @b, align 4, !tbaa !5
+ %tobool11 = icmp eq i32 %1, 0
+ br i1 %tobool11, label %for.inc23, label %for.body8.lr.ph
+
+for.body8.lr.ph: ; preds = %for.cond7.preheader
+ %add9 = add i32 %n.015, 1
+ br label %for.body8
+
+for.body8: ; preds = %for.body8.lr.ph, %for.inc19
+ %indvars.iv19 = phi i64 [ 0, %for.body8.lr.ph ], [ %indvars.iv.next20, %for.inc19 ]
+ %i.213 = phi i32 [ %i.116, %for.body8.lr.ph ], [ 0, %for.inc19 ]
+ %2 = trunc i64 %indvars.iv19 to i32
+ %add10 = add i32 %add9, %2
+ store i32 %add10, i32* @f, align 4, !tbaa !5
+ %idx.ext = sext i32 %add10 to i64
+ %add.ptr = getelementptr inbounds i32* @a, i64 %idx.ext
+ %tobool129 = icmp eq i32 %i.213, 0
+ br i1 %tobool129, label %for.inc19, label %for.body13.lr.ph
+
+for.body13.lr.ph: ; preds = %for.body8
+ %3 = sext i32 %i.213 to i64
+ br label %for.body13
+
+for.body13: ; preds = %for.body13.lr.ph, %for.body13
+ %indvars.iv = phi i64 [ %3, %for.body13.lr.ph ], [ %indvars.iv.next, %for.body13 ]
+ %add.ptr.sum = add i64 %idx.ext, %indvars.iv
+ %arrayidx = getelementptr inbounds i32* @a, i64 %add.ptr.sum
+ %4 = load i32* %arrayidx, align 4, !tbaa !5
+ %arrayidx15 = getelementptr inbounds i32* %0, i64 %indvars.iv
+ store i32 %4, i32* %arrayidx15, align 4, !tbaa !5
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %5 = trunc i64 %indvars.iv.next to i32
+ %tobool12 = icmp eq i32 %5, 0
+ br i1 %tobool12, label %for.cond11.for.inc19_crit_edge, label %for.body13
+
+for.cond11.for.inc19_crit_edge: ; preds = %for.body13
+ br label %for.inc19
+
+for.inc19: ; preds = %for.cond11.for.inc19_crit_edge, %for.body8
+ %6 = load i32* @c, align 4, !tbaa !5
+ %inc20 = add nsw i32 %6, 1
+ store i32 %inc20, i32* @c, align 4, !tbaa !5
+ %indvars.iv.next20 = add i64 %indvars.iv19, 1
+ %7 = load i32* @b, align 4, !tbaa !5
+ %tobool = icmp eq i32 %7, 0
+ br i1 %tobool, label %for.cond7.for.inc23_crit_edge, label %for.body8
+
+for.cond7.for.inc23_crit_edge: ; preds = %for.inc19
+ %add.ptr.lcssa = phi i32* [ %add.ptr, %for.inc19 ]
+ store i32* %add.ptr.lcssa, i32** @d, align 8, !tbaa !4
+ br label %for.inc23
+
+for.inc23: ; preds = %for.cond7.for.inc23_crit_edge, %for.cond7.preheader
+ %i.2.lcssa = phi i32 [ 0, %for.cond7.for.inc23_crit_edge ], [ %i.116, %for.cond7.preheader ]
+ %inc24 = add nsw i32 %y.017, 1
+ %inc25 = add nsw i32 %n.015, 1
+ %exitcond = icmp ne i32 %inc24, %call.lcssa
+ br i1 %exitcond, label %for.cond7.preheader, label %for.cond4.for.end26_crit_edge
+
+for.cond4.for.end26_crit_edge: ; preds = %for.inc23
+ br label %for.end26
+
+for.end26: ; preds = %for.cond4.for.end26_crit_edge, %for.cond4.preheader
+ ret void
+}
+declare i32 @fn2(double) #1
+
+attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
+
+!0 = metadata !{metadata !"int", metadata !1}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA"}
+!3 = metadata !{metadata !"double", metadata !1}
+!4 = metadata !{metadata !0, metadata !0, i64 0}
+!5 = metadata !{metadata !3, metadata !3, i64 0}
diff --git a/test/Transforms/LoopVectorize/simple-unroll.ll b/test/Transforms/LoopVectorize/simple-unroll.ll
index 7e2dd5fc0fcf..83f35ffb609b 100644
--- a/test/Transforms/LoopVectorize/simple-unroll.ll
+++ b/test/Transforms/LoopVectorize/simple-unroll.ll
@@ -9,7 +9,7 @@ target triple = "x86_64-apple-macosx10.8.0"
; for (i=0; i<n; i++){
; a[i] += i;
; }
-;CHECK: @inc
+;CHECK-LABEL: @inc(
;CHECK: load <4 x i32>
;CHECK: load <4 x i32>
;CHECK: add nsw <4 x i32>
diff --git a/test/Transforms/LoopVectorize/small-loop.ll b/test/Transforms/LoopVectorize/small-loop.ll
index fa83dba3d367..49ce5c539727 100644
--- a/test/Transforms/LoopVectorize/small-loop.ll
+++ b/test/Transforms/LoopVectorize/small-loop.ll
@@ -7,7 +7,7 @@ target triple = "x86_64-apple-macosx10.8.0"
@b = common global [2048 x i32] zeroinitializer, align 16
@c = common global [2048 x i32] zeroinitializer, align 16
-;CHECK: @example1
+;CHECK-LABEL: @example1(
;CHECK-NOT: load <4 x i32>
;CHECK: ret void
define void @example1() nounwind uwtable ssp {
diff --git a/test/Transforms/LoopVectorize/start-non-zero.ll b/test/Transforms/LoopVectorize/start-non-zero.ll
index e8a089a98120..8f675afd80cb 100644
--- a/test/Transforms/LoopVectorize/start-non-zero.ll
+++ b/test/Transforms/LoopVectorize/start-non-zero.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-;CHECK: @start_at_nonzero
+;CHECK-LABEL: @start_at_nonzero(
;CHECK: mul nuw <4 x i32>
;CHECK: ret i32
define i32 @start_at_nonzero(i32* nocapture %a, i32 %start, i32 %end) nounwind uwtable ssp {
diff --git a/test/Transforms/LoopVectorize/store-shuffle-bug.ll b/test/Transforms/LoopVectorize/store-shuffle-bug.ll
new file mode 100644
index 000000000000..0ec8010756d1
--- /dev/null
+++ b/test/Transforms/LoopVectorize/store-shuffle-bug.ll
@@ -0,0 +1,55 @@
+; RUN: opt -S -loop-vectorize -force-vector-unroll=1 -force-vector-width=4 -dce -instcombine < %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-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+@uf = common global [100 x i32] zeroinitializer, align 16
+@xi = common global [100 x i32] zeroinitializer, align 16
+@q = common global [100 x i32] zeroinitializer, align 16
+
+; PR16455
+
+
+; Due to a bug in the way we handled reverse induction stores we would generate
+; a shuffle too many.
+
+define void @t() {
+entry:
+ br label %for.body
+
+; CHECK-LABEL: @t(
+; CHECK: vector.body:
+; CHECK: load <4 x i32>
+; CHECK: [[VAR1:%[a-zA-Z0-9]+]] = shufflevector
+; CHECK: load <4 x i32>
+; CHECK: [[VAR2:%[a-zA-Z0-9]+]] = shufflevector
+; CHECK: [[VAR3:%[a-zA-Z0-9]+]] = add nsw <4 x i32> [[VAR2]], [[VAR1]]
+; CHECK: [[VAR4:%[a-zA-Z0-9]+]] = shufflevector <4 x i32> [[VAR3]]
+; CHECK: store <4 x i32> [[VAR4]]
+; CHECK: load <4 x i32>
+; CHECK: [[VAR5:%[a-zA-Z0-9]+]] = shufflevector
+; CHECK-NOT: add nsw <4 x i32> [[VAR4]], [[VAR5]]
+; CHECK-NOT: add nsw <4 x i32> [[VAR5]], [[VAR4]]
+; CHECK: add nsw <4 x i32> [[VAR3]], [[VAR5]]
+
+for.body:
+ %indvars.iv = phi i64 [ 93, %entry ], [ %indvars.iv.next, %for.body ]
+ %0 = add i64 %indvars.iv, 1
+ %arrayidx = getelementptr inbounds [100 x i32]* @uf, i64 0, i64 %0
+ %arrayidx3 = getelementptr inbounds [100 x i32]* @xi, i64 0, i64 %0
+ %1 = load i32* %arrayidx3, align 4
+ %2 = load i32* %arrayidx, align 4
+ %add4 = add nsw i32 %2, %1
+ store i32 %add4, i32* %arrayidx, align 4
+ %arrayidx7 = getelementptr inbounds [100 x i32]* @q, i64 0, i64 %0
+ %3 = load i32* %arrayidx7, align 4
+ %add8 = add nsw i32 %add4, %3
+ store i32 %add8, i32* %arrayidx, align 4
+ %indvars.iv.next = add i64 %indvars.iv, -1
+ %4 = trunc i64 %indvars.iv.next to i32
+ %cmp = icmp ugt i32 %4, 2
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
diff --git a/test/Transforms/LoopVectorize/struct_access.ll b/test/Transforms/LoopVectorize/struct_access.ll
index 573480d77cdd..75beae82f170 100644
--- a/test/Transforms/LoopVectorize/struct_access.ll
+++ b/test/Transforms/LoopVectorize/struct_access.ll
@@ -21,7 +21,7 @@ target triple = "x86_64-apple-macosx10.9.0"
; return sum;
; }
-;CHECK: @foo
+;CHECK-LABEL: @foo(
;CHECK-NOT: load <4 x i32>
;CHECK: ret
define i32 @foo(%struct.coordinate* nocapture %A, i32 %n) nounwind uwtable readonly ssp {
@@ -44,3 +44,45 @@ for.end: ; preds = %for.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
ret i32 %sum.0.lcssa
}
+
+%struct.lit = type { i32 }
+
+; Verify that we still vectorize the access if the struct has the same size as
+; the loaded element.
+; struct lit {
+; int x;
+; };
+;
+;
+; int bar(struct lit *A, int n) {
+;
+; int sum = 0;
+; for (int i = 0; i < n; ++i)
+; sum += A[i].x;
+;
+; return sum;
+; }
+
+;CHECK-LABEL: @bar(
+;CHECK: load <4 x i32>
+;CHECK: ret
+define i32 @bar(%struct.lit* nocapture %A, i32 %n) nounwind uwtable readonly ssp {
+entry:
+ %cmp4 = icmp sgt i32 %n, 0
+ br i1 %cmp4, label %for.body, label %for.end
+
+for.body: ; preds = %entry, %for.body
+ %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
+ %sum.05 = phi i32 [ %add, %for.body ], [ 0, %entry ]
+ %x = getelementptr inbounds %struct.lit* %A, i64 %indvars.iv, i32 0
+ %0 = load i32* %x, align 4
+ %add = add nsw i32 %0, %sum.05
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, %n
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
+ ret i32 %sum.0.lcssa
+}
diff --git a/test/Transforms/LoopVectorize/undef-inst-bug.ll b/test/Transforms/LoopVectorize/undef-inst-bug.ll
new file mode 100644
index 000000000000..ed60e801afde
--- /dev/null
+++ b/test/Transforms/LoopVectorize/undef-inst-bug.ll
@@ -0,0 +1,36 @@
+; RUN: opt -S -loop-vectorize -force-vector-width=4 -force-vector-unroll=1 < %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-S128"
+
+; We use to fail on this loop because we did not properly handle the loop
+; invariant instruction anchored in the loop when used as a getelementptr index.
+; We would use the index from the original loop resulting in a use not dominated
+; by the definition.
+
+; PR16452
+
+; Verify that we don't miscompile this loop.
+
+; CHECK-LABEL: @t(
+; CHECK: <4 x i32>
+
+define void @t() {
+entry:
+ br label %for.body
+
+for.body:
+ %indvars.iv17 = phi i64 [ %indvars.next, %for.body ], [ 128, %entry ]
+
+ ; Loop invariant anchored in loop.
+ %idxprom21 = zext i32 undef to i64
+
+ %arrayidx23 = getelementptr inbounds [100 x [100 x i32]]* undef, i64 0, i64 %idxprom21, i64 %indvars.iv17
+ store i32 undef, i32* %arrayidx23, align 4
+ %indvars.next= add i64 %indvars.iv17, -1
+ %0 = trunc i64 %indvars.next to i32
+ %cmp15 = icmp ugt i32 %0, undef
+ br i1 %cmp15, label %for.body, label %loopexit
+
+loopexit:
+ ret void
+}
diff --git a/test/Transforms/LoopVectorize/unroll_novec.ll b/test/Transforms/LoopVectorize/unroll_novec.ll
new file mode 100644
index 000000000000..33f128da905d
--- /dev/null
+++ b/test/Transforms/LoopVectorize/unroll_novec.ll
@@ -0,0 +1,39 @@
+; RUN: opt < %s -loop-vectorize -force-vector-width=1 -force-vector-unroll=2 -dce -instcombine -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-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+@a = common global [2048 x i32] zeroinitializer, align 16
+
+; This is the loop.
+; for (i=0; i<n; i++){
+; a[i] += i;
+; }
+;CHECK-LABEL: @inc(
+;CHECK: load i32*
+;CHECK: load i32*
+;CHECK: add nsw i32
+;CHECK: add nsw i32
+;CHECK: store i32
+;CHECK: store i32
+;CHECK: ret void
+define void @inc(i32 %n) nounwind uwtable noinline ssp {
+ %1 = icmp sgt i32 %n, 0
+ br i1 %1, label %.lr.ph, label %._crit_edge
+
+.lr.ph: ; preds = %0, %.lr.ph
+ %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
+ %2 = getelementptr inbounds [2048 x i32]* @a, i64 0, i64 %indvars.iv
+ %3 = load i32* %2, align 4
+ %4 = trunc i64 %indvars.iv to i32
+ %5 = add nsw i32 %3, %4
+ store i32 %5, i32* %2, align 4
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, %n
+ br i1 %exitcond, label %._crit_edge, label %.lr.ph
+
+._crit_edge: ; preds = %.lr.ph, %0
+ ret void
+}
+
diff --git a/test/Transforms/LoopVectorize/value-ptr-bug.ll b/test/Transforms/LoopVectorize/value-ptr-bug.ll
index f376656f0754..e8d37285f803 100644
--- a/test/Transforms/LoopVectorize/value-ptr-bug.ll
+++ b/test/Transforms/LoopVectorize/value-ptr-bug.ll
@@ -9,7 +9,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; SCEVExpander::expandCodeFor would change a value (the start value of an
; induction) that we cached in the induction variable list.
-; CHECK: test_vh
+; CHECK-LABEL: @test_vh(
; CHECK-NOT: store <4 x i8> undef
define void @test_vh(i32* %ptr265, i32* %ptr266, i32 %sub267) {
diff --git a/test/Transforms/LoopVectorize/vectorize-once.ll b/test/Transforms/LoopVectorize/vectorize-once.ll
index f289ded25de1..780046930e1b 100644
--- a/test/Transforms/LoopVectorize/vectorize-once.ll
+++ b/test/Transforms/LoopVectorize/vectorize-once.ll
@@ -9,9 +9,9 @@ target triple = "x86_64-apple-macosx10.8.0"
; This test checks that we add metadata to vectorized loops
-; CHECK: _Z4foo1Pii
+; CHECK-LABEL: @_Z4foo1Pii(
; CHECK: <4 x i32>
-; CHECK: llvm.vectorizer.already_vectorized
+; CHECK: llvm.loop
; CHECK: ret
; This test comes from the loop:
@@ -40,10 +40,10 @@ _ZSt10accumulateIPiiET0_T_S2_S1_.exit: ; preds = %for.body.i, %entry
ret i32 %__init.addr.0.lcssa.i
}
-; This test checks that we don't vectorize loops that are marked with the "already vectorized" metadata.
-; CHECK: _Z4foo2Pii
+; This test checks that we don't vectorize loops that are marked with the "width" == 1 metadata.
+; CHECK-LABEL: @_Z4foo2Pii(
; CHECK-NOT: <4 x i32>
-; CHECK: llvm.vectorizer.already_vectorized
+; CHECK: llvm.loop
; CHECK: ret
define i32 @_Z4foo2Pii(i32* %A, i32 %n) #0 {
entry:
@@ -59,7 +59,7 @@ for.body.i: ; preds = %entry, %for.body.i
%add.i = add nsw i32 %0, %__init.addr.05.i
%incdec.ptr.i = getelementptr inbounds i32* %__first.addr.04.i, i64 1
%cmp.i = icmp eq i32* %incdec.ptr.i, %add.ptr
- br i1 %cmp.i, label %_ZSt10accumulateIPiiET0_T_S2_S1_.exit, label %for.body.i, !llvm.vectorizer.already_vectorized !3
+ br i1 %cmp.i, label %_ZSt10accumulateIPiiET0_T_S2_S1_.exit, label %for.body.i, !llvm.loop !0
_ZSt10accumulateIPiiET0_T_S2_S1_.exit: ; preds = %for.body.i, %entry
%__init.addr.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i, %for.body.i ]
@@ -68,5 +68,10 @@ _ZSt10accumulateIPiiET0_T_S2_S1_.exit: ; preds = %for.body.i, %entry
attributes #0 = { nounwind readonly ssp uwtable "fp-contract-model"="standard" "no-frame-pointer-elim" "no-frame-pointer-elim-non-leaf" "realign-stack" "relocation-model"="pic" "ssp-buffers-size"="8" }
-!3 = metadata !{}
+; CHECK: !0 = metadata !{metadata !0, metadata !1, metadata !2}
+; CHECK: !1 = metadata !{metadata !"llvm.vectorizer.width", i32 1}
+; CHECK: !2 = metadata !{metadata !"llvm.vectorizer.unroll", i32 1}
+; CHECK: !3 = metadata !{metadata !3, metadata !1, metadata !2}
+!0 = metadata !{metadata !0, metadata !1}
+!1 = metadata !{metadata !"llvm.vectorizer.width", i32 1}
diff --git a/test/Transforms/LoopVectorize/write-only.ll b/test/Transforms/LoopVectorize/write-only.ll
index 54cbe8df46b0..71a9cd0dc5be 100644
--- a/test/Transforms/LoopVectorize/write-only.ll
+++ b/test/Transforms/LoopVectorize/write-only.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-;CHECK: @read_mod_write_single_ptr
+;CHECK-LABEL: @read_mod_write_single_ptr(
;CHECK: load <4 x float>
;CHECK: ret i32
define i32 @read_mod_write_single_ptr(float* nocapture %a, i32 %n) nounwind uwtable ssp {
diff --git a/test/Transforms/LowerAtomic/atomic-load.ll b/test/Transforms/LowerAtomic/atomic-load.ll
index bc04e88344ef..1279bf72201c 100644
--- a/test/Transforms/LowerAtomic/atomic-load.ll
+++ b/test/Transforms/LowerAtomic/atomic-load.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -loweratomic -S | FileCheck %s
define i8 @add() {
-; CHECK: @add
+; CHECK-LABEL: @add(
%i = alloca i8
%j = atomicrmw add i8* %i, i8 42 monotonic
; CHECK: [[INST:%[a-z0-9]+]] = load
@@ -12,7 +12,7 @@ define i8 @add() {
}
define i8 @nand() {
-; CHECK: @nand
+; CHECK-LABEL: @nand(
%i = alloca i8
%j = atomicrmw nand i8* %i, i8 42 monotonic
; CHECK: [[INST:%[a-z0-9]+]] = load
@@ -24,7 +24,7 @@ define i8 @nand() {
}
define i8 @min() {
-; CHECK: @min
+; CHECK-LABEL: @min(
%i = alloca i8
%j = atomicrmw min i8* %i, i8 42 monotonic
; CHECK: [[INST:%[a-z0-9]+]] = load
diff --git a/test/Transforms/LowerAtomic/atomic-swap.ll b/test/Transforms/LowerAtomic/atomic-swap.ll
index 5e2f034a5177..4331677764ba 100644
--- a/test/Transforms/LowerAtomic/atomic-swap.ll
+++ b/test/Transforms/LowerAtomic/atomic-swap.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -loweratomic -S | FileCheck %s
define i8 @cmpswap() {
-; CHECK: @cmpswap
+; CHECK-LABEL: @cmpswap(
%i = alloca i8
%j = cmpxchg i8* %i, i8 0, i8 42 monotonic
; CHECK: [[INST:%[a-z0-9]+]] = load
@@ -13,7 +13,7 @@ define i8 @cmpswap() {
}
define i8 @swap() {
-; CHECK: @swap
+; CHECK-LABEL: @swap(
%i = alloca i8
%j = atomicrmw xchg i8* %i, i8 42 monotonic
; CHECK: [[INST:%[a-z0-9]+]] = load
diff --git a/test/Transforms/LowerAtomic/barrier.ll b/test/Transforms/LowerAtomic/barrier.ll
index 814d7afb5ff9..665f9d756d34 100644
--- a/test/Transforms/LowerAtomic/barrier.ll
+++ b/test/Transforms/LowerAtomic/barrier.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -loweratomic -S | FileCheck %s
define void @barrier() {
-; CHECK: @barrier
+; CHECK-LABEL: @barrier(
fence seq_cst
; CHECK-NEXT: ret
ret void
diff --git a/test/Transforms/LowerAtomic/lit.local.cfg b/test/Transforms/LowerAtomic/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/LowerAtomic/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/LowerExpectIntrinsic/basic.ll b/test/Transforms/LowerExpectIntrinsic/basic.ll
index c00127e1ed24..955209af14a6 100644
--- a/test/Transforms/LowerExpectIntrinsic/basic.ll
+++ b/test/Transforms/LowerExpectIntrinsic/basic.ll
@@ -1,6 +1,6 @@
; RUN: opt -lower-expect -strip-dead-prototypes -S -o - < %s | FileCheck %s
-; CHECK: @test1
+; CHECK-LABEL: @test1(
define i32 @test1(i32 %x) nounwind uwtable ssp {
entry:
%retval = alloca i32, align 4
@@ -34,7 +34,7 @@ declare i64 @llvm.expect.i64(i64, i64) nounwind readnone
declare i32 @f(...)
-; CHECK: @test2
+; CHECK-LABEL: @test2(
define i32 @test2(i32 %x) nounwind uwtable ssp {
entry:
%retval = alloca i32, align 4
@@ -62,7 +62,7 @@ return: ; preds = %if.end, %if.then
ret i32 %0
}
-; CHECK: @test3
+; CHECK-LABEL: @test3(
define i32 @test3(i32 %x) nounwind uwtable ssp {
entry:
%retval = alloca i32, align 4
@@ -93,7 +93,7 @@ return: ; preds = %if.end, %if.then
ret i32 %0
}
-; CHECK: @test4
+; CHECK-LABEL: @test4(
define i32 @test4(i32 %x) nounwind uwtable ssp {
entry:
%retval = alloca i32, align 4
@@ -125,7 +125,7 @@ return: ; preds = %if.end, %if.then
ret i32 %0
}
-; CHECK: @test5
+; CHECK-LABEL: @test5(
define i32 @test5(i32 %x) nounwind uwtable ssp {
entry:
%retval = alloca i32, align 4
@@ -155,7 +155,7 @@ return: ; preds = %if.end, %if.then
ret i32 %0
}
-; CHECK: @test6
+; CHECK-LABEL: @test6(
define i32 @test6(i32 %x) nounwind uwtable ssp {
entry:
%retval = alloca i32, align 4
@@ -184,7 +184,7 @@ return: ; preds = %sw.epilog, %sw.bb
ret i32 %0
}
-; CHECK: @test7
+; CHECK-LABEL: @test7(
define i32 @test7(i32 %x) nounwind uwtable ssp {
entry:
%retval = alloca i32, align 4
@@ -214,7 +214,7 @@ return: ; preds = %sw.epilog, %sw.bb
ret i32 %0
}
-; CHECK: @test8
+; CHECK-LABEL: @test8(
define i32 @test8(i32 %x) nounwind uwtable ssp {
entry:
%retval = alloca i32, align 4
diff --git a/test/Transforms/LowerExpectIntrinsic/lit.local.cfg b/test/Transforms/LowerExpectIntrinsic/lit.local.cfg
deleted file mode 100644
index c6106e4746f2..000000000000
--- a/test/Transforms/LowerExpectIntrinsic/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll']
diff --git a/test/Transforms/LowerInvoke/lit.local.cfg b/test/Transforms/LowerInvoke/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/LowerInvoke/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/LowerSwitch/feature.ll b/test/Transforms/LowerSwitch/feature.ll
index cc77d3c44d56..e85f03ee5c78 100644
--- a/test/Transforms/LowerSwitch/feature.ll
+++ b/test/Transforms/LowerSwitch/feature.ll
@@ -7,88 +7,88 @@
;CHECK-NEXT: br label %NodeBlock37
;CHECK: NodeBlock37: ; preds = %entry
-;CHECK-NEXT: %Pivot38 = icmp ult i32 %tmp158, 11
+;CHECK-NEXT: %Pivot38 = icmp slt i32 %tmp158, 10
;CHECK-NEXT: br i1 %Pivot38, label %NodeBlock13, label %NodeBlock35
;CHECK: NodeBlock35: ; preds = %NodeBlock37
-;CHECK-NEXT: %Pivot36 = icmp ult i32 %tmp158, 14
+;CHECK-NEXT: %Pivot36 = icmp slt i32 %tmp158, 13
;CHECK-NEXT: br i1 %Pivot36, label %NodeBlock23, label %NodeBlock33
;CHECK: NodeBlock33: ; preds = %NodeBlock35
-;CHECK-NEXT: %Pivot34 = icmp ult i32 %tmp158, 15
+;CHECK-NEXT: %Pivot34 = icmp slt i32 %tmp158, 14
;CHECK-NEXT: br i1 %Pivot34, label %LeafBlock25, label %NodeBlock31
;CHECK: NodeBlock31: ; preds = %NodeBlock33
-;CHECK-NEXT: %Pivot32 = icmp ult i32 %tmp158, -6
+;CHECK-NEXT: %Pivot32 = icmp slt i32 %tmp158, 15
;CHECK-NEXT: br i1 %Pivot32, label %LeafBlock27, label %LeafBlock29
;CHECK: LeafBlock29: ; preds = %NodeBlock31
-;CHECK-NEXT: %tmp158.off = add i32 %tmp158, 6
-;CHECK-NEXT: %SwitchLeaf30 = icmp ule i32 %tmp158.off, 4
-;CHECK-NEXT: br i1 %SwitchLeaf30, label %bb338, label %NewDefault
+;CHECK-NEXT: %SwitchLeaf30 = icmp eq i32 %tmp158, 15
+;CHECK-NEXT: br i1 %SwitchLeaf30, label %bb334, label %NewDefault
;CHECK: LeafBlock27: ; preds = %NodeBlock31
-;CHECK-NEXT: %SwitchLeaf28 = icmp eq i32 %tmp158, 15
-;CHECK-NEXT: br i1 %SwitchLeaf28, label %bb334, label %NewDefault
+;CHECK-NEXT: %SwitchLeaf28 = icmp eq i32 %tmp158, 14
+;CHECK-NEXT: br i1 %SwitchLeaf28, label %bb332, label %NewDefault
;CHECK: LeafBlock25: ; preds = %NodeBlock33
-;CHECK-NEXT: %SwitchLeaf26 = icmp eq i32 %tmp158, 14
-;CHECK-NEXT: br i1 %SwitchLeaf26, label %bb332, label %NewDefault
+;CHECK-NEXT: %SwitchLeaf26 = icmp eq i32 %tmp158, 13
+;CHECK-NEXT: br i1 %SwitchLeaf26, label %bb330, label %NewDefault
;CHECK: NodeBlock23: ; preds = %NodeBlock35
-;CHECK-NEXT: %Pivot24 = icmp ult i32 %tmp158, 12
+;CHECK-NEXT: %Pivot24 = icmp slt i32 %tmp158, 11
;CHECK-NEXT: br i1 %Pivot24, label %LeafBlock15, label %NodeBlock21
;CHECK: NodeBlock21: ; preds = %NodeBlock23
-;CHECK-NEXT: %Pivot22 = icmp ult i32 %tmp158, 13
+;CHECK-NEXT: %Pivot22 = icmp slt i32 %tmp158, 12
;CHECK-NEXT: br i1 %Pivot22, label %LeafBlock17, label %LeafBlock19
;CHECK: LeafBlock19: ; preds = %NodeBlock21
-;CHECK-NEXT: %SwitchLeaf20 = icmp eq i32 %tmp158, 13
-;CHECK-NEXT: br i1 %SwitchLeaf20, label %bb330, label %NewDefault
+;CHECK-NEXT: %SwitchLeaf20 = icmp eq i32 %tmp158, 12
+;CHECK-NEXT: br i1 %SwitchLeaf20, label %bb328, label %NewDefault
;CHECK: LeafBlock17: ; preds = %NodeBlock21
-;CHECK-NEXT: %SwitchLeaf18 = icmp eq i32 %tmp158, 12
-;CHECK-NEXT: br i1 %SwitchLeaf18, label %bb328, label %NewDefault
+;CHECK-NEXT: %SwitchLeaf18 = icmp eq i32 %tmp158, 11
+;CHECK-NEXT: br i1 %SwitchLeaf18, label %bb326, label %NewDefault
;CHECK: LeafBlock15: ; preds = %NodeBlock23
-;CHECK-NEXT: %SwitchLeaf16 = icmp eq i32 %tmp158, 11
-;CHECK-NEXT: br i1 %SwitchLeaf16, label %bb326, label %NewDefault
+;CHECK-NEXT: %SwitchLeaf16 = icmp eq i32 %tmp158, 10
+;CHECK-NEXT: br i1 %SwitchLeaf16, label %bb324, label %NewDefault
;CHECK: NodeBlock13: ; preds = %NodeBlock37
-;CHECK-NEXT: %Pivot14 = icmp ult i32 %tmp158, 8
+;CHECK-NEXT: %Pivot14 = icmp slt i32 %tmp158, 7
;CHECK-NEXT: br i1 %Pivot14, label %NodeBlock, label %NodeBlock11
;CHECK: NodeBlock11: ; preds = %NodeBlock13
-;CHECK-NEXT: %Pivot12 = icmp ult i32 %tmp158, 9
+;CHECK-NEXT: %Pivot12 = icmp slt i32 %tmp158, 8
;CHECK-NEXT: br i1 %Pivot12, label %LeafBlock3, label %NodeBlock9
;CHECK: NodeBlock9: ; preds = %NodeBlock11
-;CHECK-NEXT: %Pivot10 = icmp ult i32 %tmp158, 10
+;CHECK-NEXT: %Pivot10 = icmp slt i32 %tmp158, 9
;CHECK-NEXT: br i1 %Pivot10, label %LeafBlock5, label %LeafBlock7
;CHECK: LeafBlock7: ; preds = %NodeBlock9
-;CHECK-NEXT: %SwitchLeaf8 = icmp eq i32 %tmp158, 10
-;CHECK-NEXT: br i1 %SwitchLeaf8, label %bb324, label %NewDefault
+;CHECK-NEXT: %SwitchLeaf8 = icmp eq i32 %tmp158, 9
+;CHECK-NEXT: br i1 %SwitchLeaf8, label %bb322, label %NewDefault
;CHECK: LeafBlock5: ; preds = %NodeBlock9
-;CHECK-NEXT: %SwitchLeaf6 = icmp eq i32 %tmp158, 9
-;CHECK-NEXT: br i1 %SwitchLeaf6, label %bb322, label %NewDefault
+;CHECK-NEXT: %SwitchLeaf6 = icmp eq i32 %tmp158, 8
+;CHECK-NEXT: br i1 %SwitchLeaf6, label %bb338, label %NewDefault
;CHECK: LeafBlock3: ; preds = %NodeBlock11
-;CHECK-NEXT: %SwitchLeaf4 = icmp eq i32 %tmp158, 8
-;CHECK-NEXT: br i1 %SwitchLeaf4, label %bb338, label %NewDefault
+;CHECK-NEXT: %SwitchLeaf4 = icmp eq i32 %tmp158, 7
+;CHECK-NEXT: br i1 %SwitchLeaf4, label %bb, label %NewDefault
;CHECK: NodeBlock: ; preds = %NodeBlock13
-;CHECK-NEXT: %Pivot = icmp ult i32 %tmp158, 7
+;CHECK-NEXT: %Pivot = icmp slt i32 %tmp158, 0
;CHECK-NEXT: br i1 %Pivot, label %LeafBlock, label %LeafBlock1
;CHECK: LeafBlock1: ; preds = %NodeBlock
-;CHECK-NEXT: %SwitchLeaf2 = icmp eq i32 %tmp158, 7
-;CHECK-NEXT: br i1 %SwitchLeaf2, label %bb, label %NewDefault
+;CHECK-NEXT: %SwitchLeaf2 = icmp ule i32 %tmp158, 6
+;CHECK-NEXT: br i1 %SwitchLeaf2, label %bb338, label %NewDefault
;CHECK: LeafBlock: ; preds = %NodeBlock
-;CHECK-NEXT: %SwitchLeaf = icmp ule i32 %tmp158, 6
+;CHECK-NEXT: %tmp158.off = add i32 %tmp158, 6
+;CHECK-NEXT: %SwitchLeaf = icmp ule i32 %tmp158.off, 4
;CHECK-NEXT: br i1 %SwitchLeaf, label %bb338, label %NewDefault
define i32 @main(i32 %tmp158) {
diff --git a/test/Transforms/LowerSwitch/lit.local.cfg b/test/Transforms/LowerSwitch/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/LowerSwitch/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/Mem2Reg/ConvertDebugInfo.ll b/test/Transforms/Mem2Reg/ConvertDebugInfo.ll
index c0eaaa40154b..33eaed60fe58 100644
--- a/test/Transforms/Mem2Reg/ConvertDebugInfo.ll
+++ b/test/Transforms/Mem2Reg/ConvertDebugInfo.ll
@@ -33,17 +33,20 @@ return: ; preds = %entry
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
!llvm.dbg.cu = !{!3}
+!llvm.module.flags = !{!14}
!0 = metadata !{i32 786689, metadata !1, metadata !"i", metadata !2, i32 2, metadata !7, i32 0, null} ; [ DW_TAG_arg_variable ]
-!1 = metadata !{i32 786478, metadata !2, metadata !"testfunc", metadata !"testfunc", metadata !"testfunc", metadata !2, i32 2, metadata !4, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 false, double (i32, double)* @testfunc, null, null, null, i32 2} ; [ DW_TAG_subprogram ]
+!1 = metadata !{i32 786478, metadata !12, metadata !2, metadata !"testfunc", metadata !"testfunc", metadata !"testfunc", i32 2, metadata !4, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 false, double (i32, double)* @testfunc, null, null, null, i32 2} ; [ DW_TAG_subprogram ]
!2 = metadata !{i32 786473, metadata !12} ; [ DW_TAG_file_type ]
-!3 = metadata !{i32 786449, i32 0, i32 1, metadata !"testfunc.c", metadata !"/tmp", metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
-!4 = metadata !{i32 786453, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !5, i32 0, null} ; [ DW_TAG_subroutine_type ]
+!3 = metadata !{i32 786449, metadata !12, i32 1, metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, metadata !"", i32 0, metadata !13, metadata !13, null, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
+!4 = metadata !{i32 786453, metadata !12, metadata !2, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !5, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!5 = metadata !{metadata !6, metadata !7, metadata !6}
-!6 = metadata !{i32 786468, metadata !2, metadata !"double", metadata !2, i32 0, i64 64, i64 64, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ]
-!7 = metadata !{i32 786468, metadata !2, metadata !"int", metadata !2, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
+!6 = metadata !{i32 786468, metadata !12, metadata !2, metadata !"double", i32 0, i64 64, i64 64, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ]
+!7 = metadata !{i32 786468, metadata !12, metadata !2, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!8 = metadata !{i32 2, i32 0, metadata !1, null}
!9 = metadata !{i32 786689, metadata !1, metadata !"j", metadata !2, i32 2, metadata !6, i32 0, null} ; [ DW_TAG_arg_variable ]
!10 = metadata !{i32 3, i32 0, metadata !11, null}
-!11 = metadata !{i32 786443, metadata !1, i32 2, i32 0} ; [ DW_TAG_lexical_block ]
+!11 = metadata !{i32 786443, metadata !12, metadata !1, i32 2, i32 0, i32 0} ; [ DW_TAG_lexical_block ]
!12 = metadata !{metadata !"testfunc.c", metadata !"/tmp"}
+!13 = metadata !{i32 0}
+!14 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/Mem2Reg/ConvertDebugInfo2.ll b/test/Transforms/Mem2Reg/ConvertDebugInfo2.ll
index f6119f8bbd85..32acdd696ecf 100644
--- a/test/Transforms/Mem2Reg/ConvertDebugInfo2.ll
+++ b/test/Transforms/Mem2Reg/ConvertDebugInfo2.ll
@@ -30,24 +30,28 @@ return: ; preds = %entry
ret void, !dbg !19
}
+!llvm.dbg.cu = !{!3}
+!llvm.module.flags = !{!22}
!0 = metadata !{i32 786689, metadata !1, metadata !"a", metadata !2, i32 8, metadata !6, i32 0, null} ; [ DW_TAG_arg_variable ]
-!1 = metadata !{i32 786478, metadata !2, metadata !"baz", metadata !"baz", metadata !"baz", metadata !2, i32 8, metadata !4, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 false, void (i32)* @baz, null, null, null, i32 8} ; [ DW_TAG_subprogram ]
+!1 = metadata !{i32 786478, metadata !20, metadata !2, metadata !"baz", metadata !"baz", metadata !"baz", i32 8, metadata !4, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 false, void (i32)* @baz, null, null, null, i32 8} ; [ DW_TAG_subprogram ]
!2 = metadata !{i32 786473, metadata !20} ; [ DW_TAG_file_type ]
-!3 = metadata !{i32 786449, i32 0, i32 1, metadata !"bar.c", metadata !"/tmp/", metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
-!4 = metadata !{i32 786453, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !5, i32 0, null} ; [ DW_TAG_subroutine_type ]
+!3 = metadata !{i32 786449, metadata !20, i32 1, metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, metadata !"", i32 0, metadata !21, metadata !21, null, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
+!4 = metadata !{i32 786453, metadata !20, metadata !2, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !5, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!5 = metadata !{null, metadata !6}
-!6 = metadata !{i32 786468, metadata !2, metadata !"int", metadata !2, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
+!6 = metadata !{i32 786468, metadata !20, metadata !2, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!7 = metadata !{i32 8, i32 0, metadata !1, null}
!8 = metadata !{i32 9, i32 0, metadata !1, null}
!9 = metadata !{i32 786689, metadata !10, metadata !"x", metadata !2, i32 4, metadata !6, i32 0, null} ; [ DW_TAG_arg_variable ]
-!10 = metadata !{i32 786478, metadata !2, metadata !"bar", metadata !"bar", metadata !"bar", metadata !2, i32 4, metadata !11, i1 true, i1 true, i32 0, i32 0, null, i1 false, i1 false, null, null, null, null, i32 4} ; [ DW_TAG_subprogram ]
-!11 = metadata !{i32 786453, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !12, i32 0, null} ; [ DW_TAG_subroutine_type ]
+!10 = metadata !{i32 786478, metadata !20, metadata !2, metadata !"bar", metadata !"bar", metadata !"bar", i32 4, metadata !11, i1 true, i1 true, i32 0, i32 0, null, i1 false, i1 false, null, null, null, null, i32 4} ; [ DW_TAG_subprogram ]
+!11 = metadata !{i32 786453, metadata !20, metadata !2, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !12, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!12 = metadata !{null, metadata !6, metadata !13, metadata !14}
-!13 = metadata !{i32 786468, metadata !2, metadata !"long int", metadata !2, i32 0, i64 64, i64 64, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
-!14 = metadata !{i32 786447, metadata !2, metadata !"", metadata !2, i32 0, i64 64, i64 64, i64 0, i32 0, null} ; [ DW_TAG_pointer_type ]
+!13 = metadata !{i32 786468, metadata !20, metadata !2, metadata !"long int", i32 0, i64 64, i64 64, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
+!14 = metadata !{i32 786447, metadata !20, metadata !2, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, null} ; [ DW_TAG_pointer_type ]
!15 = metadata !{i32 4, i32 0, metadata !10, metadata !8}
!16 = metadata !{i32 786689, metadata !10, metadata !"y", metadata !2, i32 4, metadata !13, i32 0, null} ; [ DW_TAG_arg_variable ]
!17 = metadata !{i32 786689, metadata !10, metadata !"z", metadata !2, i32 4, metadata !14, i32 0, null} ; [ DW_TAG_arg_variable ]
!18 = metadata !{i32 5, i32 0, metadata !10, metadata !8}
!19 = metadata !{i32 10, i32 0, metadata !1, null}
!20 = metadata !{metadata !"bar.c", metadata !"/tmp/"}
+!21 = metadata !{i32 0}
+!22 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/Mem2Reg/atomic.ll b/test/Transforms/Mem2Reg/atomic.ll
index 982c41318b10..5bc9e9281b27 100644
--- a/test/Transforms/Mem2Reg/atomic.ll
+++ b/test/Transforms/Mem2Reg/atomic.ll
@@ -3,7 +3,7 @@
; mem2reg is allowed with arbitrary atomic operations (although we only support
; it for atomic load and store at the moment).
define i32 @test1(i32 %x) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret i32 %x
%a = alloca i32
store atomic i32 %x, i32* %a seq_cst, align 4
diff --git a/test/Transforms/Mem2Reg/lit.local.cfg b/test/Transforms/Mem2Reg/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/Mem2Reg/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/MemCpyOpt/align.ll b/test/Transforms/MemCpyOpt/align.ll
index 1b98f6ad383f..5d5bfbdafc5b 100644
--- a/test/Transforms/MemCpyOpt/align.ll
+++ b/test/Transforms/MemCpyOpt/align.ll
@@ -8,7 +8,7 @@ declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind
; a 16-byte aligned store in the middle.
define void @foo(i32* %p) {
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK: call void @llvm.memset.p0i8.i64(i8* {{.*}}, i8 0, i64 16, i32 4, i1 false)
%a0 = getelementptr i32* %p, i64 0
store i32 0, i32* %a0, align 4
@@ -24,7 +24,7 @@ define void @foo(i32* %p) {
; Replacing %a8 with %a4 in the memset requires boosting the alignment of %a4.
define void @bar() {
-; CHECK: @bar
+; CHECK-LABEL: @bar(
; CHECK: %a4 = alloca i32, align 8
; CHECK-NOT: memcpy
%a4 = alloca i32, align 4
diff --git a/test/Transforms/MemCpyOpt/form-memset.ll b/test/Transforms/MemCpyOpt/form-memset.ll
index f63b1dcfdd5f..7c7b4fc08809 100644
--- a/test/Transforms/MemCpyOpt/form-memset.ll
+++ b/test/Transforms/MemCpyOpt/form-memset.ll
@@ -48,7 +48,7 @@ entry:
store i8 %c, i8* %tmp73, align 1
%tmp76 = call i32 (...)* @bar( [19 x i8]* %x ) nounwind
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NOT: store
; CHECK: call void @llvm.memset.p0i8.i64
; CHECK-NOT: store
@@ -150,7 +150,7 @@ entry:
call void @foo( %struct.MV* %up_mvd252, %struct.MV* %left_mvd253, i8* %tmp41 ) nounwind
ret void
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NOT: store
; CHECK: call void @llvm.memset.p0i8.i64(i8* %tmp41, i8 -1, i64 8, i32 1, i1 false)
; CHECK-NOT: store
@@ -173,7 +173,7 @@ entry:
%0 = bitcast i32* %add.ptr to i8*
tail call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 11, i32 1, i1 false)
ret void
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NOT: store
; CHECK: call void @llvm.memset.p0i8.i64(i8* %1, i8 0, i64 15, i32 4, i1 false)
}
@@ -186,7 +186,7 @@ entry:
%0 = bitcast i32* %add.ptr to i8*
tail call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 11, i32 1, i1 false)
ret void
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NOT: store
; CHECK: call void @llvm.memset.p0i8.i64(i8* %1, i8 0, i64 15, i32 4, i1 false)
}
@@ -202,7 +202,7 @@ entry:
%arrayidx = getelementptr inbounds i32* %P, i64 1
store i32 0, i32* %arrayidx, align 4
ret void
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NOT: store
; CHECK: call void @llvm.memset.p0i8.i64(i8* %1, i8 0, i64 15, i32 4, i1 false)
}
@@ -216,7 +216,7 @@ entry:
%1 = bitcast i32* %add.ptr to i8*
tail call void @llvm.memset.p0i8.i64(i8* %1, i8 0, i64 12, i32 1, i1 false)
ret void
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: call void @llvm.memset.p0i8.i64(i8* %2, i8 0, i64 24, i32 1, i1 false)
}
@@ -232,7 +232,7 @@ define void @test7(i32* nocapture %c) nounwind optsize {
store i32 -1, i32* %3, align 4
%4 = getelementptr inbounds i32* %c, i32 4
store i32 -1, i32* %4, align 4
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: call void @llvm.memset.p0i8.i64(i8* %5, i8 -1, i64 20, i32 4, i1 false)
ret void
}
@@ -245,7 +245,7 @@ entry:
%0 = bitcast %struct.test8* %memtmp to <4 x i32>*
store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, <4 x i32>* %0, align 16
ret void
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, <4 x i32>* %0, align 16
}
@@ -269,6 +269,6 @@ define void @test9() nounwind {
store i8 -1, i8* getelementptr (i8* bitcast ([16 x i64]* @test9buf to i8*), i64 14), align 2
store i8 -1, i8* getelementptr (i8* bitcast ([16 x i64]* @test9buf to i8*), i64 15), align 1
ret void
-; CHECK: @test9(
+; CHECK-LABEL: @test9(
; CHECK: call void @llvm.memset.p0i8.i64(i8* bitcast ([16 x i64]* @test9buf to i8*), i8 -1, i64 16, i32 16, i1 false)
}
diff --git a/test/Transforms/MemCpyOpt/lit.local.cfg b/test/Transforms/MemCpyOpt/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/MemCpyOpt/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/MemCpyOpt/loadstore-sret.ll b/test/Transforms/MemCpyOpt/loadstore-sret.ll
index 67e7137e7e49..89eabca21bf9 100644
--- a/test/Transforms/MemCpyOpt/loadstore-sret.ll
+++ b/test/Transforms/MemCpyOpt/loadstore-sret.ll
@@ -6,7 +6,7 @@ target triple = "x86_64-apple-darwin10.0.0"
%"class.std::auto_ptr" = type { i32* }
-; CHECK: @_Z3foov
+; CHECK-LABEL: @_Z3foov(
define void @_Z3foov(%"class.std::auto_ptr"* noalias nocapture sret %agg.result) ssp {
_ZNSt8auto_ptrIiED1Ev.exit:
%temp.lvalue = alloca %"class.std::auto_ptr", align 8
diff --git a/test/Transforms/MemCpyOpt/memcpy-to-memset.ll b/test/Transforms/MemCpyOpt/memcpy-to-memset.ll
index b18d176f0030..8409de7ad206 100644
--- a/test/Transforms/MemCpyOpt/memcpy-to-memset.ll
+++ b/test/Transforms/MemCpyOpt/memcpy-to-memset.ll
@@ -12,7 +12,7 @@ define void @test1() nounwind {
%arraydecay = getelementptr inbounds [3 x i32]* %arr, i64 0, i64 0
call void @foo(i32* %arraydecay) nounwind
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: call void @llvm.memset
; CHECK-NOT: call void @llvm.memcpy
; CHECK: ret void
diff --git a/test/Transforms/MemCpyOpt/memcpy.ll b/test/Transforms/MemCpyOpt/memcpy.ll
index 582a57b5d39c..2417cd11f7ff 100644
--- a/test/Transforms/MemCpyOpt/memcpy.ll
+++ b/test/Transforms/MemCpyOpt/memcpy.ll
@@ -22,7 +22,7 @@ entry:
; Check that one of the memcpy's are removed.
;; FIXME: PR 8643 We should be able to eliminate the last memcpy here.
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: call void @ccoshl
; CHECK: call void @llvm.memcpy
; CHECK-NOT: llvm.memcpy
@@ -41,7 +41,7 @@ define void @test2(i8* %P, i8* %Q) nounwind {
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %Q, i8* %R, i32 32, i32 16, i1 false)
ret void
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: call void @llvm.memmove{{.*}}(i8* %Q, i8* %P
; CHECK-NEXT: ret void
}
@@ -58,7 +58,7 @@ define void @test3(%0* noalias sret %agg.result) nounwind {
%agg.result2 = bitcast %0* %agg.result to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %agg.result2, i8* %x.01, i32 32, i32 16, i1 false)
ret void
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: %agg.result1 = bitcast
; CHECK-NEXT: call void @llvm.memcpy
; CHECK-NEXT: ret void
@@ -72,7 +72,7 @@ define void @test4(i8 *%P) {
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* %P, i64 8, i32 4, i1 false)
call void @test4a(i8* align 1 byval %a)
ret void
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NEXT: call void @test4a(
}
@@ -96,7 +96,7 @@ entry:
store i8 4, i8* %a
call void @test5a(%struct.S* align 16 byval %y)
ret i32 0
- ; CHECK: @test5(
+ ; CHECK-LABEL: @test5(
; CHECK: store i8 4
; CHECK: call void @test5a(%struct.S* byval align 16 %y)
}
@@ -105,7 +105,7 @@ entry:
define void @test6(i8 *%P) {
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %P, i64 8, i32 4, i1 false)
ret void
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NEXT: ret void
}
@@ -122,7 +122,7 @@ entry:
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp, i8* %tmp1, i64 48, i32 4, i1 false)
%call = call i32 @g(%struct.p* align 8 byval %agg.tmp) nounwind
ret i32 %call
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: call i32 @g(%struct.p* byval align 8 %q) [[NUW:#[0-9]+]]
}
@@ -168,6 +168,23 @@ entry:
ret void
}
+; rdar://14073661.
+; Test10 triggered assertion when the compiler try to get the size of the
+; opaque type of *x, where the x is the formal argument with attribute 'sret'.
+
+%opaque = type opaque
+declare void @foo(i32* noalias nocapture)
+
+define void @test10(%opaque* noalias nocapture sret %x, i32 %y) {
+ %a = alloca i32, align 4
+ store i32 %y, i32* %a
+ call void @foo(i32* noalias nocapture %a)
+ %c = load i32* %a
+ %d = bitcast %opaque* %x to i32*
+ store i32 %c, i32* %d
+ ret void
+}
+
declare void @f1(%struct.big* sret)
declare void @f2(%struct.big*)
diff --git a/test/Transforms/MemCpyOpt/memmove.ll b/test/Transforms/MemCpyOpt/memmove.ll
index 7f1667a45559..2057760efa01 100644
--- a/test/Transforms/MemCpyOpt/memmove.ll
+++ b/test/Transforms/MemCpyOpt/memmove.ll
@@ -8,7 +8,7 @@ declare void @llvm.memmove.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32,
define i8* @test1(i8* nocapture %src) nounwind {
entry:
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: call void @llvm.memcpy
%malloccall = tail call i8* @malloc(i32 trunc (i64 mul nuw (i64 ptrtoint (i8* getelementptr (i8* null, i32 1) to i64), i64 13) to i32))
@@ -22,7 +22,7 @@ declare noalias i8* @malloc(i32)
define void @test2(i8* %P) nounwind {
entry:
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: call void @llvm.memcpy
%add.ptr = getelementptr i8* %P, i64 16
tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %P, i8* %add.ptr, i64 16, i32 1, i1 false)
@@ -32,7 +32,7 @@ entry:
; This cannot be optimize because the src/dst really do overlap.
define void @test3(i8* %P) nounwind {
entry:
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: call void @llvm.memmove
%add.ptr = getelementptr i8* %P, i64 16
tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %P, i8* %add.ptr, i64 17, i32 1, i1 false)
diff --git a/test/Transforms/MergeFunc/address-spaces.ll b/test/Transforms/MergeFunc/address-spaces.ll
new file mode 100644
index 000000000000..0d66b8281fb2
--- /dev/null
+++ b/test/Transforms/MergeFunc/address-spaces.ll
@@ -0,0 +1,35 @@
+; RUN: opt -S -mergefunc < %s | FileCheck %s
+
+target datalayout = "p:32:32:32-p1:32:32:32-p2:16:16:16"
+
+declare void @foo(i32) nounwind
+
+; None of these functions should be merged
+
+define i32 @store_as0(i32* %x) {
+; CHECK-LABEL: @store_as0(
+; CHECK: call void @foo(
+ %gep = getelementptr i32* %x, i32 4
+ %y = load i32* %gep
+ call void @foo(i32 %y) nounwind
+ ret i32 %y
+}
+
+define i32 @store_as1(i32 addrspace(1)* %x) {
+; CHECK-LABEL: @store_as1(
+; CHECK: call void @foo(
+ %gep = getelementptr i32 addrspace(1)* %x, i32 4
+ %y = load i32 addrspace(1)* %gep
+ call void @foo(i32 %y) nounwind
+ ret i32 %y
+}
+
+define i32 @store_as2(i32 addrspace(2)* %x) {
+; CHECK-LABEL: @store_as2(
+; CHECK: call void @foo(
+ %gep = getelementptr i32 addrspace(2)* %x, i32 4
+ %y = load i32 addrspace(2)* %gep
+ call void @foo(i32 %y) nounwind
+ ret i32 %y
+}
+
diff --git a/test/Transforms/MergeFunc/inttoptr-address-space.ll b/test/Transforms/MergeFunc/inttoptr-address-space.ll
new file mode 100644
index 000000000000..0d834bc3b437
--- /dev/null
+++ b/test/Transforms/MergeFunc/inttoptr-address-space.ll
@@ -0,0 +1,29 @@
+; RUN: opt -mergefunc -S < %s | FileCheck %s
+target datalayout = "e-p:32:32:32-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-n8:16:32-S128"
+
+%.qux.2496 = type { i32, %.qux.2497 }
+%.qux.2497 = type { i8, i32 }
+%.qux.2585 = type { i32, i32, i8* }
+
+@g2 = external addrspace(1) constant [9 x i8], align 1
+@g3 = internal hidden unnamed_addr constant [1 x i8*] [i8* bitcast (i8* (%.qux.2585 addrspace(1)*)* @func35 to i8*)]
+
+
+define internal hidden i32 @func10(%.qux.2496 addrspace(1)* nocapture %this) align 2 {
+bb:
+ %tmp = getelementptr inbounds %.qux.2496 addrspace(1)* %this, i32 0, i32 1, i32 1
+ %tmp1 = load i32 addrspace(1)* %tmp, align 4
+ ret i32 %tmp1
+}
+
+; Check for pointer bitwidth equal assertion failure
+define internal hidden i8* @func35(%.qux.2585 addrspace(1)* nocapture %this) align 2 {
+bb:
+; CHECK-LABEL: @func35(
+; CHECK: %[[V2:.+]] = bitcast %.qux.2585 addrspace(1)* %{{.*}} to %.qux.2496 addrspace(1)*
+; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496 addrspace(1)* %[[V2]])
+; CHECK: %{{.*}} = inttoptr i32 %[[V3]] to i8*
+ %tmp = getelementptr inbounds %.qux.2585 addrspace(1)* %this, i32 0, i32 2
+ %tmp1 = load i8* addrspace(1)* %tmp, align 4
+ ret i8* %tmp1
+}
diff --git a/test/Transforms/MergeFunc/inttoptr.ll b/test/Transforms/MergeFunc/inttoptr.ll
index 93250fa8ed1a..6a69e3fcfd86 100644
--- a/test/Transforms/MergeFunc/inttoptr.ll
+++ b/test/Transforms/MergeFunc/inttoptr.ll
@@ -46,6 +46,7 @@ bb:
define internal hidden i8* @func35(%.qux.2585* nocapture %this) align 2 {
bb:
+; CHECK-LABEL: @func35(
; CHECK: %[[V2:.+]] = bitcast %.qux.2585* %{{.*}} to %.qux.2496*
; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496* %[[V2]])
; CHECK: %{{.*}} = inttoptr i32 %[[V3]] to i8*
diff --git a/test/Transforms/MergeFunc/lit.local.cfg b/test/Transforms/MergeFunc/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/MergeFunc/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/MergeFunc/merge-ptr-and-int.ll b/test/Transforms/MergeFunc/merge-ptr-and-int.ll
new file mode 100644
index 000000000000..4e887cec9065
--- /dev/null
+++ b/test/Transforms/MergeFunc/merge-ptr-and-int.ll
@@ -0,0 +1,27 @@
+; RUN: opt -S -mergefunc < %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-S128"
+
+
+declare void @stuff()
+
+; CHECK-LABEL: @f0(
+define void @f0(i64 %p0) {
+entry:
+ call void @stuff()
+ call void @stuff()
+ call void @stuff()
+ ret void
+}
+
+; CHECK-LABEL: @f1(
+; CHECK: ptrtoint i64*
+; CHECK: tail call void @f0(i64
+
+define void @f1(i64* %p0) {
+entry:
+ call void @stuff()
+ call void @stuff()
+ call void @stuff()
+ ret void
+}
+
diff --git a/test/Transforms/MergeFunc/ptr-int-transitivity-1.ll b/test/Transforms/MergeFunc/ptr-int-transitivity-1.ll
new file mode 100644
index 000000000000..d6ff10f82578
--- /dev/null
+++ b/test/Transforms/MergeFunc/ptr-int-transitivity-1.ll
@@ -0,0 +1,21 @@
+; RUN: opt -S -mergefunc < %s | not grep "functions merged"
+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"
+
+declare void @stuff()
+
+define void @f0(i64 %p0) {
+entry:
+ call void @stuff()
+ call void @stuff()
+ call void @stuff()
+ ret void
+}
+
+define void @f2(i64 addrspace(1)* %p0) {
+entry:
+ call void @stuff()
+ call void @stuff()
+ call void @stuff()
+ ret void
+}
+
diff --git a/test/Transforms/MergeFunc/ptr-int-transitivity-2.ll b/test/Transforms/MergeFunc/ptr-int-transitivity-2.ll
new file mode 100644
index 000000000000..c9fb6a6ea353
--- /dev/null
+++ b/test/Transforms/MergeFunc/ptr-int-transitivity-2.ll
@@ -0,0 +1,25 @@
+; RUN: opt -S -mergefunc < %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-S128"
+
+declare void @stuff()
+
+define void @f0(i64 %p0) {
+entry:
+ call void @stuff()
+ call void @stuff()
+ call void @stuff()
+ ret void
+}
+
+; CHECK-LABEL: @f0
+; CHECK: %2 = ptrtoint i64* %0 to i64
+; CHECK: tail call void @f0(i64 %2)
+; CHECK: ret void
+define void @f1(i64 addrspace(0)* %p0) {
+entry:
+ call void @stuff()
+ call void @stuff()
+ call void @stuff()
+ ret void
+}
+
diff --git a/test/Transforms/MergeFunc/ptr-int-transitivity-3.ll b/test/Transforms/MergeFunc/ptr-int-transitivity-3.ll
new file mode 100644
index 000000000000..8f00f033396b
--- /dev/null
+++ b/test/Transforms/MergeFunc/ptr-int-transitivity-3.ll
@@ -0,0 +1,21 @@
+; RUN: opt -S -mergefunc < %s | not grep "functions merged"
+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"
+
+declare void @stuff()
+
+define void @f0(i64 addrspace(0)* %p0) {
+entry:
+ call void @stuff()
+ call void @stuff()
+ call void @stuff()
+ ret void
+}
+
+define void @f2(i64 addrspace(1)* %p0) {
+entry:
+ call void @stuff()
+ call void @stuff()
+ call void @stuff()
+ ret void
+}
+
diff --git a/test/Transforms/MergeFunc/too-small.ll b/test/Transforms/MergeFunc/too-small.ll
new file mode 100644
index 000000000000..1a526ffd50a6
--- /dev/null
+++ b/test/Transforms/MergeFunc/too-small.ll
@@ -0,0 +1,14 @@
+; RUN: opt -S -mergefunc < %s | FileCheck %s
+
+define void @foo(i32 %x) {
+; CHECK-LABEL: @foo(
+; CHECK-NOT: call
+ ret void
+}
+
+define void @bar(i32 %x) {
+; CHECK-LABEL: @bar(
+; CHECK-NOT: call
+ ret void
+}
+
diff --git a/test/Transforms/MetaRenamer/lit.local.cfg b/test/Transforms/MetaRenamer/lit.local.cfg
deleted file mode 100644
index c6106e4746f2..000000000000
--- a/test/Transforms/MetaRenamer/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll']
diff --git a/test/Transforms/ObjCARC/allocas.ll b/test/Transforms/ObjCARC/allocas.ll
new file mode 100644
index 000000000000..50656739ae71
--- /dev/null
+++ b/test/Transforms/ObjCARC/allocas.ll
@@ -0,0 +1,500 @@
+; RUN: opt -objc-arc -S < %s | FileCheck %s
+
+declare i8* @objc_retain(i8*)
+declare i8* @objc_retainAutoreleasedReturnValue(i8*)
+declare void @objc_release(i8*)
+declare i8* @objc_autorelease(i8*)
+declare i8* @objc_autoreleaseReturnValue(i8*)
+declare void @objc_autoreleasePoolPop(i8*)
+declare i8* @objc_autoreleasePoolPush()
+declare i8* @objc_retainBlock(i8*)
+
+declare i8* @objc_retainedObject(i8*)
+declare i8* @objc_unretainedObject(i8*)
+declare i8* @objc_unretainedPointer(i8*)
+
+declare void @use_pointer(i8*)
+declare void @callee()
+declare void @callee_fnptr(void ()*)
+declare void @invokee()
+declare i8* @returner()
+declare i8* @returner1()
+declare i8* @returner2()
+declare void @bar(i32 ()*)
+declare void @use_alloca(i8**)
+
+declare void @llvm.dbg.value(metadata, i64, metadata)
+
+declare i8* @objc_msgSend(i8*, i8*, ...)
+
+
+; In the presense of allocas, unconditionally remove retain/release pairs only
+; if they are known safe in both directions. This prevents matching up an inner
+; retain with the boundary guarding release in the following situation:
+;
+; %A = alloca
+; retain(%x)
+; retain(%x) <--- Inner Retain
+; store %x, %A
+; %y = load %A
+; ... DO STUFF ...
+; release(%y)
+; release(%x) <--- Guarding Release
+;
+; rdar://13750319
+
+; CHECK: define void @test1a(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_release(i8* %y)
+; CHECK: @objc_release(i8* %x)
+; CHECK: ret void
+; CHECK: }
+define void @test1a(i8* %x) {
+entry:
+ %A = alloca i8*
+ tail call i8* @objc_retain(i8* %x)
+ tail call i8* @objc_retain(i8* %x)
+ store i8* %x, i8** %A, align 8
+ %y = load i8** %A
+ call void @use_alloca(i8** %A)
+ call void @objc_release(i8* %y), !clang.imprecise_release !0
+ call void @use_pointer(i8* %x)
+ call void @objc_release(i8* %x), !clang.imprecise_release !0
+ ret void
+}
+
+; CHECK: define void @test1b(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_release(i8* %y)
+; CHECK: @objc_release(i8* %x)
+; CHECK: ret void
+; CHECK: }
+define void @test1b(i8* %x) {
+entry:
+ %A = alloca i8*
+ %gep = getelementptr i8** %A, i32 0
+ tail call i8* @objc_retain(i8* %x)
+ tail call i8* @objc_retain(i8* %x)
+ store i8* %x, i8** %gep, align 8
+ %y = load i8** %A
+ call void @use_alloca(i8** %A)
+ call void @objc_release(i8* %y), !clang.imprecise_release !0
+ call void @use_pointer(i8* %x)
+ call void @objc_release(i8* %x), !clang.imprecise_release !0
+ ret void
+}
+
+
+; CHECK: define void @test1c(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_release(i8* %y)
+; CHECK: @objc_release(i8* %x)
+; CHECK: ret void
+; CHECK: }
+define void @test1c(i8* %x) {
+entry:
+ %A = alloca i8*, i32 3
+ %gep = getelementptr i8** %A, i32 2
+ tail call i8* @objc_retain(i8* %x)
+ tail call i8* @objc_retain(i8* %x)
+ store i8* %x, i8** %gep, align 8
+ %y = load i8** %gep
+ call void @use_alloca(i8** %A)
+ call void @objc_release(i8* %y), !clang.imprecise_release !0
+ call void @use_pointer(i8* %x)
+ call void @objc_release(i8* %x), !clang.imprecise_release !0
+ ret void
+}
+
+
+; CHECK: define void @test1d(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_release(i8* %y)
+; CHECK: @objc_release(i8* %x)
+; CHECK: ret void
+; CHECK: }
+define void @test1d(i8* %x) {
+entry:
+ br i1 undef, label %use_allocaA, label %use_allocaB
+
+use_allocaA:
+ %allocaA = alloca i8*
+ br label %exit
+
+use_allocaB:
+ %allocaB = alloca i8*
+ br label %exit
+
+exit:
+ %A = phi i8** [ %allocaA, %use_allocaA ], [ %allocaB, %use_allocaB ]
+ %gep = getelementptr i8** %A, i32 0
+ tail call i8* @objc_retain(i8* %x)
+ tail call i8* @objc_retain(i8* %x)
+ store i8* %x, i8** %gep, align 8
+ %y = load i8** %gep
+ call void @use_alloca(i8** %A)
+ call void @objc_release(i8* %y), !clang.imprecise_release !0
+ call void @use_pointer(i8* %x)
+ call void @objc_release(i8* %x), !clang.imprecise_release !0
+ ret void
+}
+
+; CHECK: define void @test1e(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_release(i8* %y)
+; CHECK: @objc_release(i8* %x)
+; CHECK: ret void
+; CHECK: }
+define void @test1e(i8* %x) {
+entry:
+ br i1 undef, label %use_allocaA, label %use_allocaB
+
+use_allocaA:
+ %allocaA = alloca i8*, i32 4
+ br label %exit
+
+use_allocaB:
+ %allocaB = alloca i8*, i32 4
+ br label %exit
+
+exit:
+ %A = phi i8** [ %allocaA, %use_allocaA ], [ %allocaB, %use_allocaB ]
+ %gep = getelementptr i8** %A, i32 2
+ tail call i8* @objc_retain(i8* %x)
+ tail call i8* @objc_retain(i8* %x)
+ store i8* %x, i8** %gep, align 8
+ %y = load i8** %gep
+ call void @use_alloca(i8** %A)
+ call void @objc_release(i8* %y), !clang.imprecise_release !0
+ call void @use_pointer(i8* %x)
+ call void @objc_release(i8* %x), !clang.imprecise_release !0
+ ret void
+}
+
+; CHECK: define void @test1f(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_release(i8* %y)
+; CHECK: @objc_release(i8* %x)
+; CHECK: ret void
+; CHECK: }
+define void @test1f(i8* %x) {
+entry:
+ %allocaOne = alloca i8*
+ %allocaTwo = alloca i8*
+ %A = select i1 undef, i8** %allocaOne, i8** %allocaTwo
+ tail call i8* @objc_retain(i8* %x)
+ tail call i8* @objc_retain(i8* %x)
+ store i8* %x, i8** %A, align 8
+ %y = load i8** %A
+ call void @use_alloca(i8** %A)
+ call void @objc_release(i8* %y), !clang.imprecise_release !0
+ call void @use_pointer(i8* %x)
+ call void @objc_release(i8* %x), !clang.imprecise_release !0
+ ret void
+}
+
+; Make sure that if a store is in a different basic block we handle known safe
+; conservatively.
+
+
+; CHECK: define void @test2a(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_release(i8* %y)
+; CHECK: @objc_release(i8* %x)
+; CHECK: ret void
+; CHECK: }
+define void @test2a(i8* %x) {
+entry:
+ %A = alloca i8*
+ store i8* %x, i8** %A, align 8
+ %y = load i8** %A
+ br label %bb1
+
+bb1:
+ br label %bb2
+
+bb2:
+ br label %bb3
+
+bb3:
+ tail call i8* @objc_retain(i8* %x)
+ tail call i8* @objc_retain(i8* %x)
+ call void @use_alloca(i8** %A)
+ call void @objc_release(i8* %y), !clang.imprecise_release !0
+ call void @use_pointer(i8* %x)
+ call void @objc_release(i8* %x), !clang.imprecise_release !0
+ ret void
+}
+
+; CHECK: define void @test2b(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_release(i8* %y)
+; CHECK: @objc_release(i8* %x)
+; CHECK: ret void
+; CHECK: }
+define void @test2b(i8* %x) {
+entry:
+ %A = alloca i8*
+ %gep1 = getelementptr i8** %A, i32 0
+ store i8* %x, i8** %gep1, align 8
+ %gep2 = getelementptr i8** %A, i32 0
+ %y = load i8** %gep2
+ br label %bb1
+
+bb1:
+ br label %bb2
+
+bb2:
+ br label %bb3
+
+bb3:
+ tail call i8* @objc_retain(i8* %x)
+ tail call i8* @objc_retain(i8* %x)
+ call void @use_alloca(i8** %A)
+ call void @objc_release(i8* %y), !clang.imprecise_release !0
+ call void @use_pointer(i8* %x)
+ call void @objc_release(i8* %x), !clang.imprecise_release !0
+ ret void
+}
+
+; CHECK: define void @test2c(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_release(i8* %y)
+; CHECK: @objc_release(i8* %x)
+; CHECK: ret void
+; CHECK: }
+define void @test2c(i8* %x) {
+entry:
+ %A = alloca i8*, i32 3
+ %gep1 = getelementptr i8** %A, i32 2
+ store i8* %x, i8** %gep1, align 8
+ %gep2 = getelementptr i8** %A, i32 2
+ %y = load i8** %gep2
+ tail call i8* @objc_retain(i8* %x)
+ br label %bb1
+
+bb1:
+ br label %bb2
+
+bb2:
+ br label %bb3
+
+bb3:
+ tail call i8* @objc_retain(i8* %x)
+ call void @use_alloca(i8** %A)
+ call void @objc_release(i8* %y), !clang.imprecise_release !0
+ call void @use_pointer(i8* %x)
+ call void @objc_release(i8* %x), !clang.imprecise_release !0
+ ret void
+}
+
+; CHECK: define void @test2d(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_release(i8* %y)
+; CHECK: @objc_release(i8* %x)
+; CHECK: ret void
+; CHECK: }
+define void @test2d(i8* %x) {
+entry:
+ tail call i8* @objc_retain(i8* %x)
+ br label %bb1
+
+bb1:
+ %Abb1 = alloca i8*, i32 3
+ %gepbb11 = getelementptr i8** %Abb1, i32 2
+ store i8* %x, i8** %gepbb11, align 8
+ %gepbb12 = getelementptr i8** %Abb1, i32 2
+ %ybb1 = load i8** %gepbb12
+ br label %bb3
+
+bb2:
+ %Abb2 = alloca i8*, i32 4
+ %gepbb21 = getelementptr i8** %Abb2, i32 2
+ store i8* %x, i8** %gepbb21, align 8
+ %gepbb22 = getelementptr i8** %Abb2, i32 2
+ %ybb2 = load i8** %gepbb22
+ br label %bb3
+
+bb3:
+ %A = phi i8** [ %Abb1, %bb1 ], [ %Abb2, %bb2 ]
+ %y = phi i8* [ %ybb1, %bb1 ], [ %ybb2, %bb2 ]
+ tail call i8* @objc_retain(i8* %x)
+ call void @use_alloca(i8** %A)
+ call void @objc_release(i8* %y), !clang.imprecise_release !0
+ call void @use_pointer(i8* %x)
+ call void @objc_release(i8* %x), !clang.imprecise_release !0
+ ret void
+}
+
+; Make sure in the presense of allocas, if we find a cfghazard we do not perform
+; code motion even if we are known safe. These two concepts are separate and
+; should be treated as such.
+;
+; rdar://13949644
+
+; CHECK: define void @test3a() {
+; CHECK: entry:
+; CHECK: @objc_retainAutoreleasedReturnValue
+; CHECK: @objc_retain
+; CHECK: @objc_retain
+; CHECK: @objc_retain
+; CHECK: @objc_retain
+; CHECK: arraydestroy.body:
+; CHECK: @objc_release
+; CHECK-NOT: @objc_release
+; CHECK: arraydestroy.done:
+; CHECK-NOT: @objc_release
+; CHECK: arraydestroy.body1:
+; CHECK: @objc_release
+; CHECK-NOT: @objc_release
+; CHECK: arraydestroy.done1:
+; CHECK: @objc_release
+; CHECK: ret void
+; CHECK: }
+define void @test3a() {
+entry:
+ %keys = alloca [2 x i8*], align 16
+ %objs = alloca [2 x i8*], align 16
+
+ %call1 = call i8* @returner()
+ %tmp0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %call1)
+
+ %objs.begin = getelementptr inbounds [2 x i8*]* %objs, i64 0, i64 0
+ tail call i8* @objc_retain(i8* %call1)
+ store i8* %call1, i8** %objs.begin, align 8
+ %objs.elt = getelementptr inbounds [2 x i8*]* %objs, i64 0, i64 1
+ tail call i8* @objc_retain(i8* %call1)
+ store i8* %call1, i8** %objs.elt
+
+ %call2 = call i8* @returner1()
+ %call3 = call i8* @returner2()
+ %keys.begin = getelementptr inbounds [2 x i8*]* %keys, i64 0, i64 0
+ tail call i8* @objc_retain(i8* %call2)
+ store i8* %call2, i8** %keys.begin, align 8
+ %keys.elt = getelementptr inbounds [2 x i8*]* %keys, i64 0, i64 1
+ tail call i8* @objc_retain(i8* %call3)
+ store i8* %call3, i8** %keys.elt
+
+ %gep = getelementptr inbounds [2 x i8*]* %objs, i64 0, i64 2
+ br label %arraydestroy.body
+
+arraydestroy.body:
+ %arraydestroy.elementPast = phi i8** [ %gep, %entry ], [ %arraydestroy.element, %arraydestroy.body ]
+ %arraydestroy.element = getelementptr inbounds i8** %arraydestroy.elementPast, i64 -1
+ %destroy_tmp = load i8** %arraydestroy.element, align 8
+ call void @objc_release(i8* %destroy_tmp), !clang.imprecise_release !0
+ %objs_ptr = getelementptr inbounds [2 x i8*]* %objs, i64 0, i64 0
+ %arraydestroy.cmp = icmp eq i8** %arraydestroy.element, %objs_ptr
+ br i1 %arraydestroy.cmp, label %arraydestroy.done, label %arraydestroy.body
+
+arraydestroy.done:
+ %gep1 = getelementptr inbounds [2 x i8*]* %keys, i64 0, i64 2
+ br label %arraydestroy.body1
+
+arraydestroy.body1:
+ %arraydestroy.elementPast1 = phi i8** [ %gep1, %arraydestroy.done ], [ %arraydestroy.element1, %arraydestroy.body1 ]
+ %arraydestroy.element1 = getelementptr inbounds i8** %arraydestroy.elementPast1, i64 -1
+ %destroy_tmp1 = load i8** %arraydestroy.element1, align 8
+ call void @objc_release(i8* %destroy_tmp1), !clang.imprecise_release !0
+ %keys_ptr = getelementptr inbounds [2 x i8*]* %keys, i64 0, i64 0
+ %arraydestroy.cmp1 = icmp eq i8** %arraydestroy.element1, %keys_ptr
+ br i1 %arraydestroy.cmp1, label %arraydestroy.done1, label %arraydestroy.body1
+
+arraydestroy.done1:
+ call void @objc_release(i8* %call1), !clang.imprecise_release !0
+ ret void
+}
+
+; Make sure that even though we stop said code motion we still allow for
+; pointers to be removed if we are known safe in both directions.
+;
+; rdar://13949644
+
+; CHECK: define void @test3b() {
+; CHECK: entry:
+; CHECK: @objc_retainAutoreleasedReturnValue
+; CHECK: @objc_retain
+; CHECK: @objc_retain
+; CHECK: @objc_retain
+; CHECK: @objc_retain
+; CHECK: arraydestroy.body:
+; CHECK: @objc_release
+; CHECK-NOT: @objc_release
+; CHECK: arraydestroy.done:
+; CHECK-NOT: @objc_release
+; CHECK: arraydestroy.body1:
+; CHECK: @objc_release
+; CHECK-NOT: @objc_release
+; CHECK: arraydestroy.done1:
+; CHECK: @objc_release
+; CHECK: ret void
+; CHECK: }
+define void @test3b() {
+entry:
+ %keys = alloca [2 x i8*], align 16
+ %objs = alloca [2 x i8*], align 16
+
+ %call1 = call i8* @returner()
+ %tmp0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %call1)
+ %tmp1 = tail call i8* @objc_retain(i8* %call1)
+
+ %objs.begin = getelementptr inbounds [2 x i8*]* %objs, i64 0, i64 0
+ tail call i8* @objc_retain(i8* %call1)
+ store i8* %call1, i8** %objs.begin, align 8
+ %objs.elt = getelementptr inbounds [2 x i8*]* %objs, i64 0, i64 1
+ tail call i8* @objc_retain(i8* %call1)
+ store i8* %call1, i8** %objs.elt
+
+ %call2 = call i8* @returner1()
+ %call3 = call i8* @returner2()
+ %keys.begin = getelementptr inbounds [2 x i8*]* %keys, i64 0, i64 0
+ tail call i8* @objc_retain(i8* %call2)
+ store i8* %call2, i8** %keys.begin, align 8
+ %keys.elt = getelementptr inbounds [2 x i8*]* %keys, i64 0, i64 1
+ tail call i8* @objc_retain(i8* %call3)
+ store i8* %call3, i8** %keys.elt
+
+ %gep = getelementptr inbounds [2 x i8*]* %objs, i64 0, i64 2
+ br label %arraydestroy.body
+
+arraydestroy.body:
+ %arraydestroy.elementPast = phi i8** [ %gep, %entry ], [ %arraydestroy.element, %arraydestroy.body ]
+ %arraydestroy.element = getelementptr inbounds i8** %arraydestroy.elementPast, i64 -1
+ %destroy_tmp = load i8** %arraydestroy.element, align 8
+ call void @objc_release(i8* %destroy_tmp), !clang.imprecise_release !0
+ %objs_ptr = getelementptr inbounds [2 x i8*]* %objs, i64 0, i64 0
+ %arraydestroy.cmp = icmp eq i8** %arraydestroy.element, %objs_ptr
+ br i1 %arraydestroy.cmp, label %arraydestroy.done, label %arraydestroy.body
+
+arraydestroy.done:
+ %gep1 = getelementptr inbounds [2 x i8*]* %keys, i64 0, i64 2
+ br label %arraydestroy.body1
+
+arraydestroy.body1:
+ %arraydestroy.elementPast1 = phi i8** [ %gep1, %arraydestroy.done ], [ %arraydestroy.element1, %arraydestroy.body1 ]
+ %arraydestroy.element1 = getelementptr inbounds i8** %arraydestroy.elementPast1, i64 -1
+ %destroy_tmp1 = load i8** %arraydestroy.element1, align 8
+ call void @objc_release(i8* %destroy_tmp1), !clang.imprecise_release !0
+ %keys_ptr = getelementptr inbounds [2 x i8*]* %keys, i64 0, i64 0
+ %arraydestroy.cmp1 = icmp eq i8** %arraydestroy.element1, %keys_ptr
+ br i1 %arraydestroy.cmp1, label %arraydestroy.done1, label %arraydestroy.body1
+
+arraydestroy.done1:
+ call void @objc_release(i8* %call1), !clang.imprecise_release !0
+ call void @objc_release(i8* %call1), !clang.imprecise_release !0
+ ret void
+}
+
+!0 = metadata !{}
+
+declare i32 @__gxx_personality_v0(...)
diff --git a/test/Transforms/ObjCARC/arc-annotations.ll b/test/Transforms/ObjCARC/arc-annotations.ll
index c0dea4b1b6a0..f76ba3b80b06 100644
--- a/test/Transforms/ObjCARC/arc-annotations.ll
+++ b/test/Transforms/ObjCARC/arc-annotations.ll
@@ -27,7 +27,7 @@ declare i8* @returner()
; Simple retain+release pair deletion, with some intervening control
; flow and harmless instructions.
-; CHECK: define void @test0(
+; CHECK-LABEL: define void @test0(
; CHECK: entry:
; CHECK: call void @llvm.arc.annotation.bottomup.bbstart(i8** @x, i8** @S_None)
; CHECK: %0 = tail call i8* @objc_retain(i8* %a) #0, !llvm.arc.annotation.bottomup ![[ANN0:[0-9]+]], !llvm.arc.annotation.topdown ![[ANN1:[0-9]+]]
diff --git a/test/Transforms/ObjCARC/basic.ll b/test/Transforms/ObjCARC/basic.ll
index ca1279206591..885935c51533 100644
--- a/test/Transforms/ObjCARC/basic.ll
+++ b/test/Transforms/ObjCARC/basic.ll
@@ -177,12 +177,12 @@ if.end5: ; preds = %if.then3, %if.end
ret void
}
-; CHECK: define void @test1b_imprecise(
+; CHECK-LABEL: define void @test1b_imprecise(
; CHECK: entry:
; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW:#[0-9]+]]
; CHECK-NOT: @objc_
; CHECK: if.end5:
-; CHECK: tail call void @objc_release(i8* %x) [[NUW]], !clang.imprecise_release !0
+; CHECK: tail call void @objc_release(i8* %x) [[NUW]], !clang.imprecise_release ![[RELEASE:[0-9]+]]
; CHECK-NOT: @objc_
; CHECK: }
define void @test1b_imprecise(i8* %x, i1 %p, i1 %q) {
@@ -210,7 +210,7 @@ if.end5: ; preds = %if.then3, %if.end
; Like test0 but the pointer is passed to an intervening call,
; so the optimization is not safe.
-; CHECK: define void @test2_precise(
+; CHECK-LABEL: define void @test2_precise(
; CHECK: @objc_retain(i8* %a)
; CHECK: @objc_release
; CHECK: }
@@ -239,7 +239,7 @@ return:
ret void
}
-; CHECK: define void @test2_imprecise(
+; CHECK-LABEL: define void @test2_imprecise(
; CHECK: @objc_retain(i8* %a)
; CHECK: @objc_release
; CHECK: }
@@ -273,7 +273,7 @@ return:
; TODO: For now, assume this can't happen.
-; CHECK: define void @test3_precise(
+; CHECK-LABEL: define void @test3_precise(
; TODO: @objc_retain(i8* %a)
; TODO: @objc_release
; CHECK: }
@@ -293,7 +293,7 @@ return:
ret void
}
-; CHECK: define void @test3_imprecise(
+; CHECK-LABEL: define void @test3_imprecise(
; TODO: @objc_retain(i8* %a)
; TODO: @objc_release
; CHECK: }
@@ -319,7 +319,7 @@ return:
; Like test0 but the retain is in a loop,
; so the optimization is not safe.
-; CHECK: define void @test4_precise(
+; CHECK-LABEL: define void @test4_precise(
; TODO: @objc_retain(i8* %a)
; TODO: @objc_release
; CHECK: }
@@ -339,7 +339,7 @@ return:
ret void
}
-; CHECK: define void @test4_imprecise(
+; CHECK-LABEL: define void @test4_imprecise(
; TODO: @objc_retain(i8* %a)
; TODO: @objc_release
; CHECK: }
@@ -363,7 +363,7 @@ return:
; Like test0 but the pointer is conditionally passed to an intervening call,
; so the optimization is not safe.
-; CHECK: define void @test5a(
+; CHECK-LABEL: define void @test5a(
; CHECK: @objc_retain(i8*
; CHECK: @objc_release
; CHECK: }
@@ -379,7 +379,7 @@ entry:
ret void
}
-; CHECK: define void @test5b(
+; CHECK-LABEL: define void @test5b(
; CHECK: @objc_retain(i8*
; CHECK: @objc_release
; CHECK: }
@@ -399,7 +399,7 @@ entry:
; retain+release pair deletion, where the release happens on two different
; flow paths.
-; CHECK: define void @test6a(
+; CHECK-LABEL: define void @test6a(
; CHECK: entry:
; CHECK: tail call i8* @objc_retain(
; CHECK: t:
@@ -433,7 +433,7 @@ return:
ret void
}
-; CHECK: define void @test6b(
+; CHECK-LABEL: define void @test6b(
; CHECK-NOT: @objc_
; CHECK: }
define void @test6b(i32* %x, i1 %p) nounwind {
@@ -461,7 +461,7 @@ return:
ret void
}
-; CHECK: define void @test6c(
+; CHECK-LABEL: define void @test6c(
; CHECK: entry:
; CHECK: tail call i8* @objc_retain(
; CHECK: t:
@@ -495,7 +495,7 @@ return:
ret void
}
-; CHECK: define void @test6d(
+; CHECK-LABEL: define void @test6d(
; CHECK: entry:
; CHECK: tail call i8* @objc_retain(
; CHECK: t:
@@ -533,7 +533,7 @@ return:
; retain+release pair deletion, where the retain happens on two different
; flow paths.
-; CHECK: define void @test7(
+; CHECK-LABEL: define void @test7(
; CHECK: entry:
; CHECK-NOT: objc_
; CHECK: t:
@@ -567,7 +567,7 @@ return:
ret void
}
-; CHECK: define void @test7b(
+; CHECK-LABEL: define void @test7b(
; CHECK-NOT: @objc_
; CHECK: }
define void @test7b(i32* %x, i1 %p) nounwind {
@@ -596,7 +596,7 @@ return:
; Like test7, but there's a retain/retainBlock mismatch. Don't delete!
-; CHECK: define void @test7c
+; CHECK-LABEL: define void @test7c(
; CHECK: t:
; CHECK: call i8* @objc_retainBlock
; CHECK: f:
@@ -631,7 +631,7 @@ return:
; retain+release pair deletion, where the retain and release both happen on
; different flow paths. Wild!
-; CHECK: define void @test8a(
+; CHECK-LABEL: define void @test8a(
; CHECK: entry:
; CHECK: t:
; CHECK: @objc_retain
@@ -679,7 +679,7 @@ return:
ret void
}
-; CHECK: define void @test8b(
+; CHECK-LABEL: define void @test8b(
; CHECK-NOT: @objc_
; CHECK: }
define void @test8b(i32* %x, i1 %p, i1 %q) nounwind {
@@ -717,7 +717,7 @@ return:
ret void
}
-; CHECK: define void @test8c(
+; CHECK-LABEL: define void @test8c(
; CHECK: entry:
; CHECK: t:
; CHECK: @objc_retain
@@ -765,7 +765,7 @@ return:
ret void
}
-; CHECK: define void @test8d(
+; CHECK-LABEL: define void @test8d(
; CHECK: entry:
; CHECK: t:
; CHECK: @objc_retain
@@ -815,7 +815,7 @@ return:
; Trivial retain+release pair deletion.
-; CHECK: define void @test9(
+; CHECK-LABEL: define void @test9(
; CHECK-NOT: @objc_
; CHECK: }
define void @test9(i8* %x) nounwind {
@@ -827,7 +827,7 @@ entry:
; Retain+release pair, but on an unknown pointer relationship. Don't delete!
-; CHECK: define void @test9b
+; CHECK-LABEL: define void @test9b(
; CHECK: @objc_retain(i8* %x)
; CHECK: @objc_release(i8* %s)
; CHECK: }
@@ -841,7 +841,7 @@ entry:
; Trivial retain+release pair with intervening calls - don't delete!
-; CHECK: define void @test10(
+; CHECK-LABEL: define void @test10(
; CHECK: @objc_retain(i8* %x)
; CHECK: @callee
; CHECK: @use_pointer
@@ -860,7 +860,7 @@ entry:
; Also, add a tail keyword, since objc_retain can never be passed
; a stack argument.
-; CHECK: define void @test11(
+; CHECK-LABEL: define void @test11(
; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW]]
; CHECK: call i8* @objc_autorelease(i8* %0) [[NUW]]
; CHECK: }
@@ -874,7 +874,7 @@ entry:
; Same as test11 but with no use_pointer call. Delete the pair!
-; CHECK: define void @test11a(
+; CHECK-LABEL: define void @test11a(
; CHECK: entry:
; CHECK-NEXT: ret void
; CHECK: }
@@ -889,7 +889,7 @@ entry:
; since if the frontend emitted code for an __autoreleasing variable, we may
; want it to be in the autorelease pool.
-; CHECK: define i8* @test11b(
+; CHECK-LABEL: define i8* @test11b(
; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW]]
; CHECK: call i8* @objc_autorelease(i8* %0) [[NUW]]
; CHECK: }
@@ -903,7 +903,7 @@ entry:
; Trivial retain,release pair with intervening call, but it's dominated
; by another retain - delete!
-; CHECK: define void @test12(
+; CHECK-LABEL: define void @test12(
; CHECK-NEXT: entry:
; CHECK-NEXT: @objc_retain(i8* %x)
; CHECK-NOT: @objc_
@@ -920,7 +920,7 @@ entry:
; Trivial retain,autorelease pair. Don't delete!
-; CHECK: define void @test13(
+; CHECK-LABEL: define void @test13(
; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW]]
; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW]]
; CHECK: @use_pointer(i8* %x)
@@ -937,7 +937,7 @@ entry:
; Delete the retain+release pair.
-; CHECK: define void @test13b
+; CHECK-LABEL: define void @test13b(
; CHECK-NEXT: entry:
; CHECK-NEXT: @objc_retain(i8* %x)
; CHECK-NEXT: @use_pointer
@@ -957,7 +957,7 @@ entry:
; Don't delete the retain+release pair because there's an
; autoreleasePoolPop in the way.
-; CHECK: define void @test13c
+; CHECK-LABEL: define void @test13c(
; CHECK: @objc_retain(i8* %x)
; CHECK: @objc_autoreleasePoolPop
; CHECK: @objc_retain(i8* %x)
@@ -978,7 +978,7 @@ entry:
; Like test13c, but there's an autoreleasePoolPush in the way, but that
; doesn't matter.
-; CHECK: define void @test13d
+; CHECK-LABEL: define void @test13d(
; CHECK-NEXT: entry:
; CHECK-NEXT: @objc_retain(i8* %x)
; CHECK-NEXT: @objc_autoreleasePoolPush
@@ -1000,7 +1000,7 @@ entry:
; Trivial retain,release pair with intervening call, but it's post-dominated
; by another release - delete!
-; CHECK: define void @test14(
+; CHECK-LABEL: define void @test14(
; CHECK-NEXT: entry:
; CHECK-NEXT: @use_pointer
; CHECK-NEXT: @use_pointer
@@ -1020,7 +1020,7 @@ entry:
; Trivial retain,autorelease pair with intervening call, but it's post-dominated
; by another release. Don't delete anything.
-; CHECK: define void @test15(
+; CHECK-LABEL: define void @test15(
; CHECK-NEXT: entry:
; CHECK-NEXT: @objc_retain(i8* %x)
; CHECK-NEXT: @use_pointer
@@ -1040,7 +1040,7 @@ entry:
; Trivial retain,autorelease pair, post-dominated
; by another release. Delete the retain and release.
-; CHECK: define void @test15b
+; CHECK-LABEL: define void @test15b(
; CHECK-NEXT: entry:
; CHECK-NEXT: @objc_retain
; CHECK-NEXT: @objc_autorelease
@@ -1055,7 +1055,7 @@ entry:
ret void
}
-; CHECK: define void @test15c
+; CHECK-LABEL: define void @test15c(
; CHECK-NEXT: entry:
; CHECK-NEXT: @objc_autorelease
; CHECK-NEXT: ret void
@@ -1070,7 +1070,7 @@ entry:
; Retain+release pairs in diamonds, all dominated by a retain.
-; CHECK: define void @test16a(
+; CHECK-LABEL: define void @test16a(
; CHECK: @objc_retain(i8* %x)
; CHECK-NOT: @objc
; CHECK: }
@@ -1104,7 +1104,7 @@ purple:
ret void
}
-; CHECK: define void @test16b(
+; CHECK-LABEL: define void @test16b(
; CHECK: @objc_retain(i8* %x)
; CHECK-NOT: @objc
; CHECK: }
@@ -1138,7 +1138,7 @@ purple:
ret void
}
-; CHECK: define void @test16c(
+; CHECK-LABEL: define void @test16c(
; CHECK: @objc_retain(i8* %x)
; CHECK-NOT: @objc
; CHECK: }
@@ -1172,7 +1172,7 @@ purple:
ret void
}
-; CHECK: define void @test16d(
+; CHECK-LABEL: define void @test16d(
; CHECK: @objc_retain(i8* %x)
; CHECK-NOT: @objc
; CHECK: }
@@ -1209,7 +1209,7 @@ purple:
; Retain+release pairs in diamonds, all post-dominated by a release.
-; CHECK: define void @test17(
+; CHECK-LABEL: define void @test17(
; CHECK-NOT: @objc_
; CHECK: purple:
; CHECK: @objc_release
@@ -1246,7 +1246,7 @@ purple:
; Delete no-ops.
-; CHECK: define void @test18(
+; CHECK-LABEL: define void @test18(
; CHECK-NOT: @objc_
; CHECK: }
define void @test18() {
@@ -1258,7 +1258,7 @@ define void @test18() {
; Delete no-ops where undef can be assumed to be null.
-; CHECK: define void @test18b
+; CHECK-LABEL: define void @test18b(
; CHECK-NOT: @objc_
; CHECK: }
define void @test18b() {
@@ -1294,7 +1294,7 @@ entry:
; Bitcast insertion
-; CHECK: define void @test20(
+; CHECK-LABEL: define void @test20(
; CHECK: %tmp1 = tail call i8* @objc_retain(i8* %tmp) [[NUW]]
; CHECK-NEXT: invoke
; CHECK: }
@@ -1322,7 +1322,7 @@ if.end: ; preds = %invoke.cont23
; Delete a redundant retain,autorelease when forwaring a call result
; directly to a return value.
-; CHECK: define i8* @test21(
+; CHECK-LABEL: define i8* @test21(
; CHECK: call i8* @returner()
; CHECK-NEXT: ret i8* %call
; CHECK-NEXT: }
@@ -1336,7 +1336,7 @@ entry:
; Move an objc call up through a phi that has null operands.
-; CHECK: define void @test22(
+; CHECK-LABEL: define void @test22(
; CHECK: B:
; CHECK: %1 = bitcast double* %p to i8*
; CHECK: call void @objc_release(i8* %1)
@@ -1357,58 +1357,9 @@ C:
ret void
}
-; Optimize objc_retainBlock.
-
-; CHECK: define void @test23(
-; CHECK-NOT: @objc_
-; CHECK: }
-%block0 = type { i64, i64, i8*, i8* }
-%block1 = type { i8**, i32, i32, i32 (%struct.__block_literal_1*)*, %block0* }
-%struct.__block_descriptor = type { i64, i64 }
-%struct.__block_literal_1 = type { i8**, i32, i32, i8**, %struct.__block_descriptor* }
-@__block_holder_tmp_1 = external constant %block1
-define void @test23() {
-entry:
- %0 = call i8* @objc_retainBlock(i8* bitcast (%block1* @__block_holder_tmp_1 to i8*)) nounwind, !clang.arc.copy_on_escape !0
- call void @bar(i32 ()* bitcast (%block1* @__block_holder_tmp_1 to i32 ()*))
- call void @bar(i32 ()* bitcast (%block1* @__block_holder_tmp_1 to i32 ()*))
- call void @objc_release(i8* bitcast (%block1* @__block_holder_tmp_1 to i8*)) nounwind
- ret void
-}
-
-; Don't optimize objc_retainBlock, but do strength reduce it.
-
-; CHECK: define void @test23b(i8* %p) {
-; CHECK: @objc_retain
-; CHECK: @objc_release
-; CHECK: }
-define void @test23b(i8* %p) {
-entry:
- %0 = call i8* @objc_retainBlock(i8* %p) nounwind, !clang.arc.copy_on_escape !0
- call void @callee()
- call void @use_pointer(i8* %p)
- call void @objc_release(i8* %p) nounwind
- ret void
-}
-
-; Don't optimize objc_retainBlock, because there's no copy_on_escape metadata.
-
-; CHECK: define void @test23c(
-; CHECK: @objc_retainBlock
-; CHECK: @objc_release
-; CHECK: }
-define void @test23c() {
-entry:
- %0 = call i8* @objc_retainBlock(i8* bitcast (%block1* @__block_holder_tmp_1 to i8*)) nounwind
- call void @bar(i32 ()* bitcast (%block1* @__block_holder_tmp_1 to i32 ()*))
- call void @bar(i32 ()* bitcast (%block1* @__block_holder_tmp_1 to i32 ()*))
- call void @objc_release(i8* bitcast (%block1* @__block_holder_tmp_1 to i8*)) nounwind
- ret void
-}
-
; Any call can decrement a retain count.
-; CHECK: define void @test24(
+; CHECK-LABEL: define void @test24(
; CHECK: @objc_retain(i8* %a)
; CHECK: @objc_release
; CHECK: }
@@ -1423,7 +1374,7 @@ define void @test24(i8* %r, i8* %a) {
; Don't move a retain/release pair if the release can be moved
; but the retain can't be moved to balance it.
-; CHECK: define void @test25(
+; CHECK-LABEL: define void @test25(
; CHECK: entry:
; CHECK: call i8* @objc_retain(i8* %p)
; CHECK: true:
@@ -1448,7 +1399,7 @@ done:
; Don't move a retain/release pair if the retain can be moved
; but the release can't be moved to balance it.
-; CHECK: define void @test26(
+; CHECK-LABEL: define void @test26(
; CHECK: entry:
; CHECK: call i8* @objc_retain(i8* %p)
; CHECK: true:
@@ -1472,7 +1423,7 @@ done:
; Don't sink the retain,release into the loop.
-; CHECK: define void @test27(
+; CHECK-LABEL: define void @test27(
; CHECK: entry:
; CHECK: call i8* @objc_retain(i8* %p)
; CHECK: loop:
@@ -1497,7 +1448,7 @@ done:
; Trivial code motion case: Triangle.
-; CHECK: define void @test28(
+; CHECK-LABEL: define void @test28(
; CHECK-NOT: @objc_
; CHECK: true:
; CHECK: call i8* @objc_retain(
@@ -1525,7 +1476,7 @@ done:
; Trivial code motion case: Triangle, but no metadata. Don't move past
; unrelated memory references!
-; CHECK: define void @test28b
+; CHECK-LABEL: define void @test28b(
; CHECK: call i8* @objc_retain(
; CHECK: true:
; CHECK-NOT: @objc_
@@ -1555,7 +1506,7 @@ done:
; Trivial code motion case: Triangle, with metadata. Do move past
; unrelated memory references! And preserve the metadata.
-; CHECK: define void @test28c
+; CHECK-LABEL: define void @test28c(
; CHECK-NOT: @objc_
; CHECK: true:
; CHECK: call i8* @objc_retain(
@@ -1583,7 +1534,7 @@ done:
; Like test28. but with two releases.
-; CHECK: define void @test29(
+; CHECK-LABEL: define void @test29(
; CHECK-NOT: @objc_
; CHECK: true:
; CHECK: call i8* @objc_retain(
@@ -1618,7 +1569,7 @@ ohno:
; Basic case with the use and call in a diamond
; with an extra release.
-; CHECK: define void @test30(
+; CHECK-LABEL: define void @test30(
; CHECK-NOT: @objc_
; CHECK: true:
; CHECK: call i8* @objc_retain(
@@ -1657,7 +1608,7 @@ ohno:
; Basic case with a mergeable release.
-; CHECK: define void @test31(
+; CHECK-LABEL: define void @test31(
; CHECK: call i8* @objc_retain(i8* %p)
; CHECK: call void @callee()
; CHECK: store
@@ -1686,7 +1637,7 @@ false:
; Don't consider bitcasts or getelementptrs direct uses.
-; CHECK: define void @test32(
+; CHECK-LABEL: define void @test32(
; CHECK-NOT: @objc_
; CHECK: true:
; CHECK: call i8* @objc_retain(
@@ -1715,7 +1666,7 @@ done:
; Do consider icmps to be direct uses.
-; CHECK: define void @test33(
+; CHECK-LABEL: define void @test33(
; CHECK-NOT: @objc_
; CHECK: true:
; CHECK: call i8* @objc_retain(
@@ -1745,7 +1696,7 @@ done:
; Delete retain,release if there's just a possible dec and we have imprecise
; releases.
-; CHECK: define void @test34a(
+; CHECK-LABEL: define void @test34a(
; CHECK: call i8* @objc_retain
; CHECK: true:
; CHECK: done:
@@ -1767,7 +1718,7 @@ done:
ret void
}
-; CHECK: define void @test34b(
+; CHECK-LABEL: define void @test34b(
; CHECK-NOT: @objc_
; CHECK: }
define void @test34b(i8* %p, i1 %x, i8* %y) {
@@ -1791,7 +1742,7 @@ done:
; release.
; Precise.
-; CHECK: define void @test35a(
+; CHECK-LABEL: define void @test35a(
; CHECK: entry:
; CHECK: call i8* @objc_retain
; CHECK: true:
@@ -1815,7 +1766,7 @@ done:
}
; Imprecise.
-; CHECK: define void @test35b(
+; CHECK-LABEL: define void @test35b(
; CHECK-NOT: @objc_
; CHECK: }
define void @test35b(i8* %p, i1 %x, i8* %y) {
@@ -1836,7 +1787,7 @@ done:
; Delete a retain,release if there's no actual use and we have precise release.
-; CHECK: define void @test36a(
+; CHECK-LABEL: define void @test36a(
; CHECK: @objc_retain
; CHECK: call void @callee()
; CHECK-NOT: @objc_
@@ -1854,7 +1805,7 @@ entry:
; Like test36, but with metadata.
-; CHECK: define void @test36b(
+; CHECK-LABEL: define void @test36b(
; CHECK-NOT: @objc_
; CHECK: }
define void @test36b(i8* %p) {
@@ -1868,7 +1819,7 @@ entry:
; Be aggressive about analyzing phis to eliminate possible uses.
-; CHECK: define void @test38(
+; CHECK-LABEL: define void @test38(
; CHECK-NOT: @objc_
; CHECK: }
define void @test38(i8* %p, i1 %u, i1 %m, i8* %z, i8* %y, i8* %x, i8* %w) {
@@ -1902,7 +1853,7 @@ g:
; Delete retain,release pairs around loops.
-; CHECK: define void @test39(
+; CHECK-LABEL: define void @test39(
; CHECK-NOT: @objc_
; CHECK: }
define void @test39(i8* %p) {
@@ -1920,7 +1871,7 @@ exit: ; preds = %loop
; Delete retain,release pairs around loops containing uses.
-; CHECK: define void @test39b(
+; CHECK-LABEL: define void @test39b(
; CHECK-NOT: @objc_
; CHECK: }
define void @test39b(i8* %p) {
@@ -1939,7 +1890,7 @@ exit: ; preds = %loop
; Delete retain,release pairs around loops containing potential decrements.
-; CHECK: define void @test39c(
+; CHECK-LABEL: define void @test39c(
; CHECK-NOT: @objc_
; CHECK: }
define void @test39c(i8* %p) {
@@ -1959,7 +1910,7 @@ exit: ; preds = %loop
; Delete retain,release pairs around loops even if
; the successors are in a different order.
-; CHECK: define void @test40(
+; CHECK-LABEL: define void @test40(
; CHECK-NOT: @objc_
; CHECK: }
define void @test40(i8* %p) {
@@ -1979,7 +1930,7 @@ exit: ; preds = %loop
; Do the known-incremented retain+release elimination even if the pointer
; is also autoreleased.
-; CHECK: define void @test42(
+; CHECK-LABEL: define void @test42(
; CHECK-NEXT: entry:
; CHECK-NEXT: call i8* @objc_retain(i8* %p)
; CHECK-NEXT: call i8* @objc_autorelease(i8* %p)
@@ -2001,7 +1952,7 @@ entry:
; Don't the known-incremented retain+release elimination if the pointer is
; autoreleased and there's an autoreleasePoolPop.
-; CHECK: define void @test43(
+; CHECK-LABEL: define void @test43(
; CHECK-NEXT: entry:
; CHECK-NEXT: call i8* @objc_retain(i8* %p)
; CHECK-NEXT: call i8* @objc_autorelease(i8* %p)
@@ -2027,7 +1978,7 @@ entry:
; Do the known-incremented retain+release elimination if the pointer is
; autoreleased and there's an autoreleasePoolPush.
-; CHECK: define void @test43b
+; CHECK-LABEL: define void @test43b(
; CHECK-NEXT: entry:
; CHECK-NEXT: call i8* @objc_retain(i8* %p)
; CHECK-NEXT: call i8* @objc_autorelease(i8* %p)
@@ -2050,7 +2001,7 @@ entry:
; Do retain+release elimination for non-provenance pointers.
-; CHECK: define void @test44(
+; CHECK-LABEL: define void @test44(
; CHECK-NOT: objc_
; CHECK: }
define void @test44(i8** %pp) {
@@ -2063,7 +2014,7 @@ define void @test44(i8** %pp) {
; Don't delete retain+release with an unknown-provenance
; may-alias objc_release between them.
-; CHECK: define void @test45(
+; CHECK-LABEL: define void @test45(
; CHECK: call i8* @objc_retain(i8* %p)
; CHECK: call void @objc_release(i8* %q)
; CHECK: call void @use_pointer(i8* %p)
@@ -2081,7 +2032,7 @@ define void @test45(i8** %pp, i8** %qq) {
; Don't delete retain and autorelease here.
-; CHECK: define void @test46(
+; CHECK-LABEL: define void @test46(
; CHECK: tail call i8* @objc_retain(i8* %p) [[NUW]]
; CHECK: true:
; CHECK: call i8* @objc_autorelease(i8* %p) [[NUW]]
@@ -2102,7 +2053,7 @@ false:
; Delete no-op cast calls.
-; CHECK: define i8* @test47(
+; CHECK-LABEL: define i8* @test47(
; CHECK-NOT: call
; CHECK: ret i8* %p
; CHECK: }
@@ -2113,7 +2064,7 @@ define i8* @test47(i8* %p) nounwind {
; Delete no-op cast calls.
-; CHECK: define i8* @test48(
+; CHECK-LABEL: define i8* @test48(
; CHECK-NOT: call
; CHECK: ret i8* %p
; CHECK: }
@@ -2124,7 +2075,7 @@ define i8* @test48(i8* %p) nounwind {
; Delete no-op cast calls.
-; CHECK: define i8* @test49(
+; CHECK-LABEL: define i8* @test49(
; CHECK-NOT: call
; CHECK: ret i8* %p
; CHECK: }
@@ -2136,7 +2087,7 @@ define i8* @test49(i8* %p) nounwind {
; Do delete retain+release with intervening stores of the address value if we
; have imprecise release attached to objc_release.
-; CHECK: define void @test50a(
+; CHECK-LABEL: define void @test50a(
; CHECK-NEXT: call i8* @objc_retain
; CHECK-NEXT: call void @callee
; CHECK-NEXT: store
@@ -2151,7 +2102,7 @@ define void @test50a(i8* %p, i8** %pp) {
ret void
}
-; CHECK: define void @test50b(
+; CHECK-LABEL: define void @test50b(
; CHECK-NOT: @objc_
; CHECK: }
define void @test50b(i8* %p, i8** %pp) {
@@ -2166,7 +2117,7 @@ define void @test50b(i8* %p, i8** %pp) {
; Don't delete retain+release with intervening stores through the
; address value.
-; CHECK: define void @test51a(
+; CHECK-LABEL: define void @test51a(
; CHECK: call i8* @objc_retain(i8* %p)
; CHECK: call void @objc_release(i8* %p)
; CHECK: ret void
@@ -2179,7 +2130,7 @@ define void @test51a(i8* %p) {
ret void
}
-; CHECK: define void @test51b(
+; CHECK-LABEL: define void @test51b(
; CHECK: call i8* @objc_retain(i8* %p)
; CHECK: call void @objc_release(i8* %p)
; CHECK: ret void
@@ -2195,7 +2146,7 @@ define void @test51b(i8* %p) {
; Don't delete retain+release with intervening use of a pointer of
; unknown provenance.
-; CHECK: define void @test52a(
+; CHECK-LABEL: define void @test52a(
; CHECK: call i8* @objc_retain
; CHECK: call void @callee()
; CHECK: call void @use_pointer(i8* %z)
@@ -2212,7 +2163,7 @@ define void @test52a(i8** %zz, i8** %pp) {
ret void
}
-; CHECK: define void @test52b(
+; CHECK-LABEL: define void @test52b(
; CHECK: call i8* @objc_retain
; CHECK: call void @callee()
; CHECK: call void @use_pointer(i8* %z)
@@ -2234,7 +2185,7 @@ define void @test52b(i8** %zz, i8** %pp) {
; Oops. That's wrong. Clang sometimes uses function types gratuitously.
; See rdar://10551239.
-; CHECK: define void @test53(
+; CHECK-LABEL: define void @test53(
; CHECK: @objc_
; CHECK: }
define void @test53(void ()** %zz, i8** %pp) {
@@ -2249,9 +2200,9 @@ define void @test53(void ()** %zz, i8** %pp) {
; Convert autorelease to release if the value is unused.
-; CHECK: define void @test54(
+; CHECK-LABEL: define void @test54(
; CHECK: call i8* @returner()
-; CHECK-NEXT: call void @objc_release(i8* %t) [[NUW]], !clang.imprecise_release !0
+; CHECK-NEXT: call void @objc_release(i8* %t) [[NUW]], !clang.imprecise_release ![[RELEASE]]
; CHECK-NEXT: ret void
; CHECK: }
define void @test54() {
@@ -2262,7 +2213,7 @@ define void @test54() {
; Nested retain+release pairs. Delete them both.
-; CHECK: define void @test55(
+; CHECK-LABEL: define void @test55(
; CHECK-NOT: @objc
; CHECK: }
define void @test55(i8* %x) {
@@ -2279,13 +2230,13 @@ entry:
; can be partially eliminated. Plus an extra outer pair to
; eliminate, for fun.
-; CHECK: define void @test56(
+; CHECK-LABEL: define void @test56(
; CHECK-NOT: @objc
; CHECK: if.then:
; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %x) [[NUW]]
; CHECK-NEXT: tail call void @use_pointer(i8* %x)
; CHECK-NEXT: tail call void @use_pointer(i8* %x)
-; CHECK-NEXT: tail call void @objc_release(i8* %x) [[NUW]], !clang.imprecise_release !0
+; CHECK-NEXT: tail call void @objc_release(i8* %x) [[NUW]], !clang.imprecise_release ![[RELEASE]]
; CHECK-NEXT: br label %if.end
; CHECK-NOT: @objc
; CHECK: }
@@ -2313,7 +2264,7 @@ if.end: ; preds = %entry, %if.then
; known unnecessary because the presence of the second one means that
; the first one won't be deleting the object.
-; CHECK: define void @test57(
+; CHECK-LABEL: define void @test57(
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @use_pointer(i8* %x)
; CHECK-NEXT: call void @use_pointer(i8* %x)
@@ -2339,7 +2290,7 @@ entry:
; An adjacent retain+release pair is sufficient even if it will be
; removed itself.
-; CHECK: define void @test58(
+; CHECK-LABEL: define void @test58(
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @use_pointer(i8* %x)
; CHECK-NEXT: call void @use_pointer(i8* %x)
@@ -2358,7 +2309,7 @@ entry:
; Don't delete the second retain+release pair in an adjacent set.
-; CHECK: define void @test59(
+; CHECK-LABEL: define void @test59(
; CHECK-NEXT: entry:
; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %x) [[NUW]]
; CHECK-NEXT: call void @use_pointer(i8* %x)
@@ -2385,7 +2336,7 @@ entry:
; We have a precise lifetime retain/release here. We can not remove them since
; @something is not constant.
-; CHECK: define void @test60a(
+; CHECK-LABEL: define void @test60a(
; CHECK: call i8* @objc_retain
; CHECK: call void @objc_release
; CHECK: }
@@ -2399,7 +2350,7 @@ define void @test60a() {
ret void
}
-; CHECK: define void @test60b(
+; CHECK-LABEL: define void @test60b(
; CHECK: call i8* @objc_retain
; CHECK-NOT: call i8* @objc_retain
; CHECK-NOT: call i8* @objc_rrelease
@@ -2415,7 +2366,7 @@ define void @test60b() {
ret void
}
-; CHECK: define void @test60c(
+; CHECK-LABEL: define void @test60c(
; CHECK-NOT: @objc_
; CHECK: }
define void @test60c() {
@@ -2428,7 +2379,7 @@ define void @test60c() {
ret void
}
-; CHECK: define void @test60d(
+; CHECK-LABEL: define void @test60d(
; CHECK-NOT: @objc_
; CHECK: }
define void @test60d() {
@@ -2441,7 +2392,7 @@ define void @test60d() {
ret void
}
-; CHECK: define void @test60e(
+; CHECK-LABEL: define void @test60e(
; CHECK-NOT: @objc_
; CHECK: }
define void @test60e() {
@@ -2457,7 +2408,7 @@ define void @test60e() {
; Constant pointers to objects don't need to be considered related to other
; pointers.
-; CHECK: define void @test61(
+; CHECK-LABEL: define void @test61(
; CHECK-NOT: @objc_
; CHECK: }
define void @test61() {
@@ -2472,7 +2423,7 @@ define void @test61() {
; Delete a retain matched by releases when one is inside the loop and the
; other is outside the loop.
-; CHECK: define void @test62(
+; CHECK-LABEL: define void @test62(
; CHECK-NOT: @objc_
; CHECK: }
define void @test62(i8* %x, i1* %p) nounwind {
@@ -2496,7 +2447,7 @@ exit:
; Like test62 but with no release in exit.
; Don't delete anything!
-; CHECK: define void @test63(
+; CHECK-LABEL: define void @test63(
; CHECK: loop:
; CHECK: tail call i8* @objc_retain(i8* %x)
; CHECK: loop.more:
@@ -2522,7 +2473,7 @@ exit:
; Like test62 but with no release in loop.more.
; Don't delete anything!
-; CHECK: define void @test64(
+; CHECK-LABEL: define void @test64(
; CHECK: loop:
; CHECK: tail call i8* @objc_retain(i8* %x)
; CHECK: exit:
@@ -2547,7 +2498,7 @@ exit:
; Move an autorelease past a phi with a null.
-; CHECK: define i8* @test65(
+; CHECK-LABEL: define i8* @test65(
; CHECK: if.then:
; CHECK: call i8* @objc_autorelease(
; CHECK: return:
@@ -2570,7 +2521,7 @@ return: ; preds = %if.then, %entry
; Don't move an autorelease past an autorelease pool boundary.
-; CHECK: define i8* @test65b(
+; CHECK-LABEL: define i8* @test65b(
; CHECK: if.then:
; CHECK-NOT: @objc_autorelease
; CHECK: return:
@@ -2596,7 +2547,7 @@ return: ; preds = %if.then, %entry
; Don't move an autoreleaseReuturnValue, which would break
; the RV optimization.
-; CHECK: define i8* @test65c(
+; CHECK-LABEL: define i8* @test65c(
; CHECK: if.then:
; CHECK-NOT: @objc_autorelease
; CHECK: return:
@@ -2620,7 +2571,7 @@ return: ; preds = %if.then, %entry
; An objc_retain can serve as a may-use for a different pointer.
; rdar://11931823
-; CHECK: define void @test66a(
+; CHECK-LABEL: define void @test66a(
; CHECK: tail call i8* @objc_retain(i8* %cond) [[NUW]]
; CHECK: tail call void @objc_release(i8* %call) [[NUW]]
; CHECK: tail call i8* @objc_retain(i8* %tmp8) [[NUW]]
@@ -2643,7 +2594,7 @@ cond.end: ; preds = %cond.true, %entry
ret void
}
-; CHECK: define void @test66b(
+; CHECK-LABEL: define void @test66b(
; CHECK: tail call i8* @objc_retain(i8* %cond) [[NUW]]
; CHECK: tail call void @objc_release(i8* %call) [[NUW]]
; CHECK: tail call i8* @objc_retain(i8* %tmp8) [[NUW]]
@@ -2666,7 +2617,7 @@ cond.end: ; preds = %cond.true, %entry
ret void
}
-; CHECK: define void @test66c(
+; CHECK-LABEL: define void @test66c(
; CHECK: tail call i8* @objc_retain(i8* %cond) [[NUW]]
; CHECK: tail call void @objc_release(i8* %call) [[NUW]]
; CHECK: tail call i8* @objc_retain(i8* %tmp8) [[NUW]]
@@ -2689,7 +2640,7 @@ cond.end: ; preds = %cond.true, %entry
ret void
}
-; CHECK: define void @test66d(
+; CHECK-LABEL: define void @test66d(
; CHECK: tail call i8* @objc_retain(i8* %cond) [[NUW]]
; CHECK: tail call void @objc_release(i8* %call) [[NUW]]
; CHECK: tail call i8* @objc_retain(i8* %tmp8) [[NUW]]
@@ -3037,9 +2988,32 @@ end: ; preds = %if.end125, %if.end1
ret void
}
-!0 = metadata !{}
-
declare i32 @__gxx_personality_v0(...)
+declare i32 @objc_sync_enter(i8*)
+declare i32 @objc_sync_exit(i8*)
+
+; Make sure that we understand that objc_sync_{enter,exit} are IC_User not
+; IC_Call/IC_CallOrUser.
+
+; CHECK-LABEL: define void @test67(
+; CHECK-NEXT: call i32 @objc_sync_enter(i8* %x)
+; CHECK-NEXT: call i32 @objc_sync_exit(i8* %x)
+; CHECK-NEXT: ret void
+; CHECK-NEXT: }
+define void @test67(i8* %x) {
+ call i8* @objc_retain(i8* %x)
+ call i32 @objc_sync_enter(i8* %x)
+ call i32 @objc_sync_exit(i8* %x)
+ call void @objc_release(i8* %x), !clang.imprecise_release !0
+ ret void
+}
+
+!llvm.module.flags = !{!1}
+
+!0 = metadata !{}
+!1 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
+
; CHECK: attributes #0 = { nounwind readnone }
; CHECK: attributes [[NUW]] = { nounwind }
+; CHECK: ![[RELEASE]] = metadata !{}
diff --git a/test/Transforms/ObjCARC/cfg-hazards.ll b/test/Transforms/ObjCARC/cfg-hazards.ll
index 0156d5bfb464..61e5a3b1dccb 100644
--- a/test/Transforms/ObjCARC/cfg-hazards.ll
+++ b/test/Transforms/ObjCARC/cfg-hazards.ll
@@ -10,7 +10,7 @@ declare void @objc_release(i8*)
declare void @callee()
declare void @block_callee(void ()*)
-; CHECK: define void @test0(
+; CHECK-LABEL: define void @test0(
; CHECK: call i8* @objc_retain(
; CHECK: for.body:
; CHECK-NOT: @objc
@@ -35,7 +35,7 @@ for.end: ; preds = %for.body
ret void
}
-; CHECK: define void @test1(
+; CHECK-LABEL: define void @test1(
; CHECK: call i8* @objc_retain(
; CHECK: for.body:
; CHECK-NOT: @objc
@@ -60,7 +60,7 @@ for.end: ; preds = %for.body
ret void
}
-; CHECK: define void @test2(
+; CHECK-LABEL: define void @test2(
; CHECK: call i8* @objc_retain(
; CHECK: for.body:
; CHECK-NOT: @objc
diff --git a/test/Transforms/ObjCARC/contract-storestrong.ll b/test/Transforms/ObjCARC/contract-storestrong.ll
index 023604e105b0..50a2d9756648 100644
--- a/test/Transforms/ObjCARC/contract-storestrong.ll
+++ b/test/Transforms/ObjCARC/contract-storestrong.ll
@@ -8,7 +8,7 @@ declare void @use_pointer(i8*)
@x = external global i8*
-; CHECK: define void @test0(
+; CHECK-LABEL: define void @test0(
; CHECK: entry:
; CHECK-NEXT: tail call void @objc_storeStrong(i8** @x, i8* %p) [[NUW:#[0-9]+]]
; CHECK-NEXT: ret void
@@ -137,7 +137,7 @@ entry:
; Like test0, but there's no store, so don't form an objc_storeStrong.
-; CHECK: define void @test7(
+; CHECK-LABEL: define void @test7(
; CHECK-NEXT: entry:
; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %p) [[NUW]]
; CHECK-NEXT: %tmp = load i8** @x, align 8
@@ -154,7 +154,7 @@ entry:
; Like test0, but there's no retain, so don't form an objc_storeStrong.
-; CHECK: define void @test8(
+; CHECK-LABEL: define void @test8(
; CHECK-NEXT: entry:
; CHECK-NEXT: %tmp = load i8** @x, align 8
; CHECK-NEXT: store i8* %p, i8** @x, align 8
diff --git a/test/Transforms/ObjCARC/contract-testcases.ll b/test/Transforms/ObjCARC/contract-testcases.ll
index fc023f898198..0bf63a6e5174 100644
--- a/test/Transforms/ObjCARC/contract-testcases.ll
+++ b/test/Transforms/ObjCARC/contract-testcases.ll
@@ -18,7 +18,7 @@ declare i32 @__gxx_personality_sj0(...)
; Don't get in trouble on bugpointed code.
-; CHECK: define void @test0(
+; CHECK-LABEL: define void @test0(
define void @test0() {
bb:
%tmp = bitcast %4* undef to i8*
@@ -45,7 +45,7 @@ bb6: ; preds = %bb5, %bb4, %bb4, %b
; When rewriting operands for a phi which has multiple operands
; for the same block, use the exactly same value in each block.
-; CHECK: define void @test1(
+; CHECK-LABEL: define void @test1(
; CHECK: %0 = bitcast i8* %tmp3 to %0*
; CHECK: br i1 undef, label %bb7, label %bb7
; CHECK: bb7:
diff --git a/test/Transforms/ObjCARC/contract.ll b/test/Transforms/ObjCARC/contract.ll
index 3544f885528b..2259e17ec58c 100644
--- a/test/Transforms/ObjCARC/contract.ll
+++ b/test/Transforms/ObjCARC/contract.ll
@@ -12,7 +12,7 @@ declare void @use_pointer(i8*)
declare i8* @returner()
declare void @callee()
-; CHECK: define void @test0
+; CHECK-LABEL: define void @test0(
; CHECK: call void @use_pointer(i8* %0)
; CHECK: }
define void @test0(i8* %x) nounwind {
@@ -22,7 +22,7 @@ entry:
ret void
}
-; CHECK: define void @test1
+; CHECK-LABEL: define void @test1(
; CHECK: call void @use_pointer(i8* %0)
; CHECK: }
define void @test1(i8* %x) nounwind {
@@ -34,7 +34,7 @@ entry:
; Merge objc_retain and objc_autorelease into objc_retainAutorelease.
-; CHECK: define void @test2(
+; CHECK-LABEL: define void @test2(
; CHECK: tail call i8* @objc_retainAutorelease(i8* %x) [[NUW:#[0-9]+]]
; CHECK: }
define void @test2(i8* %x) nounwind {
@@ -47,7 +47,7 @@ entry:
; Same as test2 but the value is returned. Do an RV optimization.
-; CHECK: define i8* @test2b(
+; CHECK-LABEL: define i8* @test2b(
; CHECK: tail call i8* @objc_retainAutoreleaseReturnValue(i8* %x) [[NUW]]
; CHECK: }
define i8* @test2b(i8* %x) nounwind {
@@ -59,7 +59,7 @@ entry:
; Merge a retain,autorelease pair around a call.
-; CHECK: define void @test3(
+; CHECK-LABEL: define void @test3(
; CHECK: tail call i8* @objc_retainAutorelease(i8* %x) [[NUW]]
; CHECK: @use_pointer(i8* %0)
; CHECK: }
@@ -74,7 +74,7 @@ entry:
; Trivial retain,autorelease pair with intervening call, but it's post-dominated
; by another release. The retain and autorelease can be merged.
-; CHECK: define void @test4(
+; CHECK-LABEL: define void @test4(
; CHECK-NEXT: entry:
; CHECK-NEXT: @objc_retainAutorelease(i8* %x) [[NUW]]
; CHECK-NEXT: @use_pointer
@@ -92,7 +92,7 @@ entry:
; Don't merge retain and autorelease if they're not control-equivalent.
-; CHECK: define void @test5(
+; CHECK-LABEL: define void @test5(
; CHECK: tail call i8* @objc_retain(i8* %p) [[NUW]]
; CHECK: true:
; CHECK: call i8* @objc_autorelease(i8* %0) [[NUW]]
@@ -119,7 +119,7 @@ false:
; into objc_retainAutoreleasedReturnValueAutoreleaseReturnValue?
; Those entrypoints don't exist yet though.
-; CHECK: define i8* @test6(
+; CHECK-LABEL: define i8* @test6(
; CHECK: call i8* @objc_retainAutoreleasedReturnValue(i8* %p) [[NUW]]
; CHECK: %t = tail call i8* @objc_autoreleaseReturnValue(i8* %1) [[NUW]]
; CHECK: }
@@ -148,7 +148,7 @@ define i8* @test7(i8* %p) {
; Do the return value substitution for PHI nodes too.
-; CHECK: define i8* @test8(
+; CHECK-LABEL: define i8* @test8(
; CHECK: %retval = phi i8* [ %p, %if.then ], [ null, %entry ]
; CHECK: }
define i8* @test8(i1 %x, i8* %c) {
@@ -165,7 +165,7 @@ return: ; preds = %if.then, %entry
}
; Kill calls to @clang.arc.use(...)
-; CHECK: define void @test9(
+; CHECK-LABEL: define void @test9(
; CHECK-NOT: clang.arc.use
; CHECK: }
define void @test9(i8* %a, i8* %b) {
@@ -188,7 +188,7 @@ define void @test10() {
; Convert objc_retain to objc_retainAutoreleasedReturnValue if its
; argument is a return value.
-; CHECK: define void @test11(
+; CHECK-LABEL: define void @test11(
; CHECK-NEXT: %y = call i8* @returner()
; CHECK-NEXT: tail call i8* @objc_retainAutoreleasedReturnValue(i8* %y) [[NUW]]
; CHECK-NEXT: ret void
@@ -201,7 +201,7 @@ define void @test11() {
; Don't convert objc_retain to objc_retainAutoreleasedReturnValue if its
; argument is not a return value.
-; CHECK: define void @test12(
+; CHECK-LABEL: define void @test12(
; CHECK-NEXT: tail call i8* @objc_retain(i8* %y) [[NUW]]
; CHECK-NEXT: ret void
; CHECK-NEXT: }
@@ -213,7 +213,7 @@ define void @test12(i8* %y) {
; Don't Convert objc_retain to objc_retainAutoreleasedReturnValue if it
; isn't next to the call providing its return value.
-; CHECK: define void @test13(
+; CHECK-LABEL: define void @test13(
; CHECK-NEXT: %y = call i8* @returner()
; CHECK-NEXT: call void @callee()
; CHECK-NEXT: tail call i8* @objc_retain(i8* %y) [[NUW]]
diff --git a/test/Transforms/ObjCARC/empty-block.ll b/test/Transforms/ObjCARC/empty-block.ll
index ca5541365a4e..0440ab8f7c07 100644
--- a/test/Transforms/ObjCARC/empty-block.ll
+++ b/test/Transforms/ObjCARC/empty-block.ll
@@ -11,7 +11,7 @@ declare i8* @objc_autoreleaseReturnValue(i8*)
; Don't delete the autorelease.
-; CHECK: define %0* @test0(
+; CHECK-LABEL: define %0* @test0(
; CHECK: @objc_retain
; CHECK: .lr.ph:
; CHECK-NOT: @objc_r
@@ -35,7 +35,7 @@ define %0* @test0(%0* %buffer) nounwind {
; Do delete the autorelease, even with the retain in a different block.
-; CHECK: define %0* @test1(
+; CHECK-LABEL: define %0* @test1(
; CHECK-NOT: @objc
; CHECK: }
define %0* @test1() nounwind {
diff --git a/test/Transforms/ObjCARC/ensure-that-exception-unwind-path-is-visited.ll b/test/Transforms/ObjCARC/ensure-that-exception-unwind-path-is-visited.ll
index 05257d1d5cf8..072861720e63 100644
--- a/test/Transforms/ObjCARC/ensure-that-exception-unwind-path-is-visited.ll
+++ b/test/Transforms/ObjCARC/ensure-that-exception-unwind-path-is-visited.ll
@@ -111,37 +111,35 @@ declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
; CHECK: attributes [[NUW]] = { nounwind }
!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!33, !34, !35, !36}
-
-!0 = metadata !{i32 786449, i32 0, i32 16, metadata !"test.m", metadata !"/Volumes/Files/gottesmmcab/Radar/12906997", metadata !"clang version 3.3 ", i1 true, i1 true, metadata !"", i32 2, metadata !1, metadata !1, metadata !3, metadata !1} ; [ DW_TAG_compile_unit ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m] [DW_LANG_ObjC]
-!1 = metadata !{metadata !2}
-!2 = metadata !{i32 0}
-!3 = metadata !{metadata !4}
-!4 = metadata !{metadata !5, metadata !27}
-!5 = metadata !{i32 786478, i32 0, metadata !6, metadata !"main", metadata !"main", metadata !"", metadata !6, i32 9, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 true, i32 ()* @main, null, null, metadata !10, i32 10} ; [ DW_TAG_subprogram ] [line 9] [def] [scope 10] [main]
-!6 = metadata !{i32 786473, metadata !"test.m", metadata !"/Volumes/Files/gottesmmcab/Radar/12906997", null} ; [ DW_TAG_file_type ]
-!7 = metadata !{i32 786453, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
+!llvm.module.flags = !{!33, !34, !35, !36, !61}
+
+!0 = metadata !{i32 786449, metadata !60, i32 16, metadata !"clang version 3.3 ", i1 true, metadata !"", i32 2, metadata !1, metadata !1, metadata !3, metadata !1, null, metadata !""} ; [ DW_TAG_compile_unit ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m] [DW_LANG_ObjC]
+!1 = metadata !{i32 0}
+!3 = metadata !{metadata !5, metadata !27}
+!5 = metadata !{i32 786478, metadata !60, metadata !6, metadata !"main", metadata !"main", metadata !"", i32 9, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 true, i32 ()* @main, null, null, metadata !10, i32 10} ; [ DW_TAG_subprogram ] [line 9] [def] [scope 10] [main]
+!6 = metadata !{i32 786473, metadata !60} ; [ DW_TAG_file_type ]
+!7 = metadata !{i32 786453, i32 0, null, i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !8, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!8 = metadata !{metadata !9}
-!9 = metadata !{i32 786468, null, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
+!9 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
!10 = metadata !{metadata !11}
!11 = metadata !{metadata !12, metadata !21, metadata !25}
!12 = metadata !{i32 786688, metadata !13, metadata !"obj", metadata !6, i32 11, metadata !14, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [obj] [line 11]
-!13 = metadata !{i32 786443, metadata !5, i32 10, i32 0, metadata !6, i32 0} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
-!14 = metadata !{i32 786454, null, metadata !"id", metadata !6, i32 11, i64 0, i64 0, i64 0, i32 0, metadata !15} ; [ DW_TAG_typedef ] [id] [line 11, size 0, align 0, offset 0] [from ]
-!15 = metadata !{i32 786447, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !16} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from objc_object]
-!16 = metadata !{i32 786451, null, metadata !"objc_object", metadata !6, i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !17, i32 0, i32 0, i32 0} ; [ DW_TAG_structure_type ] [objc_object] [line 0, size 0, align 0, offset 0] [from ]
+!13 = metadata !{i32 786443, metadata !60, metadata !5, i32 10, i32 0, i32 0} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
+!14 = metadata !{i32 786454, metadata !60, null, metadata !"id", i32 11, i64 0, i64 0, i64 0, i32 0, metadata !15} ; [ DW_TAG_typedef ] [id] [line 11, size 0, align 0, offset 0] [from ]
+!15 = metadata !{i32 786447, metadata !60, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !16} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from objc_object]
+!16 = metadata !{i32 786451, metadata !60, null, metadata !"objc_object", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !17, i32 0, null, i32 0, null} ; [ DW_TAG_structure_type ] [objc_object] [line 0, size 0, align 0, offset 0] [def] [from ]
!17 = metadata !{metadata !18}
-!18 = metadata !{i32 786445, metadata !16, metadata !"isa", metadata !6, i32 0, i64 64, i64 0, i64 0, i32 0, metadata !19} ; [ DW_TAG_member ] [isa] [line 0, size 64, align 0, offset 0] [from ]
-!19 = metadata !{i32 786447, null, metadata !"", null, i32 0, i64 64, i64 0, i64 0, i32 0, metadata !20} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 0, offset 0] [from objc_class]
-!20 = metadata !{i32 786451, null, metadata !"objc_class", metadata !6, i32 0, i64 0, i64 0, i32 0, i32 4, null, null, i32 0} ; [ DW_TAG_structure_type ] [objc_class] [line 0, size 0, align 0, offset 0] [fwd] [from ]
+!18 = metadata !{i32 786445, metadata !60, metadata !16, metadata !"isa", i32 0, i64 64, i64 0, i64 0, i32 0, metadata !19} ; [ DW_TAG_member ] [isa] [line 0, size 64, align 0, offset 0] [from ]
+!19 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 0, i64 0, i32 0, metadata !20} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 0, offset 0] [from objc_class]
+!20 = metadata !{i32 786451, metadata !60, null, metadata !"objc_class", i32 0, i64 0, i64 0, i32 0, i32 4, null, null, i32 0, null, null, null} ; [ DW_TAG_structure_type ] [objc_class] [line 0, size 0, align 0, offset 0] [decl] [from ]
!21 = metadata !{i32 786688, metadata !22, metadata !"ok", metadata !6, i32 13, metadata !23, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [ok] [line 13]
-!22 = metadata !{i32 786443, metadata !13, i32 12, i32 0, metadata !6, i32 1} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
-!23 = metadata !{i32 786454, null, metadata !"BOOL", metadata !6, i32 62, i64 0, i64 0, i64 0, i32 0, metadata !24} ; [ DW_TAG_typedef ] [BOOL] [line 62, size 0, align 0, offset 0] [from signed char]
-!24 = metadata !{i32 786468, null, metadata !"signed char", null, i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ] [signed char] [line 0, size 8, align 8, offset 0, enc DW_ATE_signed_char]
+!22 = metadata !{i32 786443, metadata !60, metadata !13, i32 12, i32 0, i32 1} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
+!23 = metadata !{i32 786454, metadata !60, null, metadata !"BOOL", i32 62, i64 0, i64 0, i64 0, i32 0, metadata !24} ; [ DW_TAG_typedef ] [BOOL] [line 62, size 0, align 0, offset 0] [from signed char]
+!24 = metadata !{i32 786468, null, null, metadata !"signed char", i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ] [signed char] [line 0, size 8, align 8, offset 0, enc DW_ATE_signed_char]
!25 = metadata !{i32 786688, metadata !26, metadata !"obj2", metadata !6, i32 15, metadata !14, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [obj2] [line 15]
-!26 = metadata !{i32 786443, metadata !22, i32 14, i32 0, metadata !6, i32 2} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
-!27 = metadata !{i32 786478, i32 0, metadata !6, metadata !"ThrowFunc", metadata !"ThrowFunc", metadata !"", metadata !6, i32 4, metadata !28, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 true, void (i8*)* @ThrowFunc, null, null, metadata !30, i32 5} ; [ DW_TAG_subprogram ] [line 4] [local] [def] [scope 5] [ThrowFunc]
-!28 = metadata !{i32 786453, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !29, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
+!26 = metadata !{i32 786443, metadata !60, metadata !22, i32 14, i32 0, i32 2} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
+!27 = metadata !{i32 786478, metadata !60, metadata !6, metadata !"ThrowFunc", metadata !"ThrowFunc", metadata !"", i32 4, metadata !28, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 true, void (i8*)* @ThrowFunc, null, null, metadata !30, i32 5} ; [ DW_TAG_subprogram ] [line 4] [local] [def] [scope 5] [ThrowFunc]
+!28 = metadata !{i32 786453, i32 0, null, i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !29, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!29 = metadata !{null, metadata !14}
!30 = metadata !{metadata !31}
!31 = metadata !{metadata !32}
@@ -154,21 +152,23 @@ declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
!38 = metadata !{}
!39 = metadata !{i32 15, i32 0, metadata !26, null}
!40 = metadata !{i32 17, i32 0, metadata !41, null}
-!41 = metadata !{i32 786443, metadata !26, i32 16, i32 0, metadata !6, i32 3} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
+!41 = metadata !{i32 786443, metadata !60, metadata !26, i32 16, i32 0, i32 3} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
!42 = metadata !{i32 22, i32 0, metadata !26, null}
!43 = metadata !{i32 23, i32 0, metadata !22, null}
!44 = metadata !{i32 19, i32 0, metadata !41, null}
!45 = metadata !{i8 0}
!46 = metadata !{i32 20, i32 0, metadata !47, null}
-!47 = metadata !{i32 786443, metadata !48, i32 19, i32 0, metadata !6, i32 5} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
-!48 = metadata !{i32 786443, metadata !26, i32 19, i32 0, metadata !6, i32 4} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
+!47 = metadata !{i32 786443, metadata !60, metadata !48, i32 19, i32 0, i32 5} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
+!48 = metadata !{i32 786443, metadata !60, metadata !26, i32 19, i32 0, i32 4} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
!49 = metadata !{i32 21, i32 0, metadata !47, null}
!50 = metadata !{i32 24, i32 0, metadata !51, null}
-!51 = metadata !{i32 786443, metadata !22, i32 23, i32 0, metadata !6, i32 6} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
+!51 = metadata !{i32 786443, metadata !60, metadata !22, i32 23, i32 0, i32 6} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
!52 = metadata !{i32 25, i32 0, metadata !51, null}
!53 = metadata !{i32 27, i32 0, metadata !13, null}
!54 = metadata !{i32 28, i32 0, metadata !13, null}
!55 = metadata !{i32 4, i32 0, metadata !27, null}
!56 = metadata !{i32 6, i32 0, metadata !57, null}
-!57 = metadata !{i32 786443, metadata !27, i32 5, i32 0, metadata !6, i32 7} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
+!57 = metadata !{i32 786443, metadata !60, metadata !27, i32 5, i32 0, i32 7} ; [ DW_TAG_lexical_block ] [/Volumes/Files/gottesmmcab/Radar/12906997/test.m]
!58 = metadata !{i32 7, i32 0, metadata !57, null}
+!60 = metadata !{metadata !"test.m", metadata !"/Volumes/Files/gottesmmcab/Radar/12906997"}
+!61 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/ObjCARC/escape.ll b/test/Transforms/ObjCARC/escape.ll
index 8f252a0d343a..28f2e807798a 100644
--- a/test/Transforms/ObjCARC/escape.ll
+++ b/test/Transforms/ObjCARC/escape.ll
@@ -9,7 +9,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; Don't optimize away the retainBlock, because the object's address "escapes"
; with the objc_storeWeak call.
-; CHECK: define void @test0(
+; CHECK-LABEL: define void @test0(
; CHECK: %tmp7 = call i8* @objc_retainBlock(i8* %tmp6) [[NUW:#[0-9]+]], !clang.arc.copy_on_escape !0
; CHECK: call void @objc_release(i8* %tmp7) [[NUW]], !clang.imprecise_release !0
; CHECK: }
@@ -65,7 +65,7 @@ entry:
; Like test0, but it makes a regular call instead of a storeWeak call,
; so the optimization is valid.
-; CHECK: define void @test1(
+; CHECK-LABEL: define void @test1(
; CHECK-NOT: @objc_retainBlock
; CHECK: }
define void @test1() nounwind {
diff --git a/test/Transforms/ObjCARC/gvn.ll b/test/Transforms/ObjCARC/gvn.ll
index a828b5485f4c..2d120e7345a5 100644
--- a/test/Transforms/ObjCARC/gvn.ll
+++ b/test/Transforms/ObjCARC/gvn.ll
@@ -3,20 +3,39 @@
@x = common global i8* null, align 8
declare i8* @objc_retain(i8*)
+declare i32 @objc_sync_enter(i8*)
+declare i32 @objc_sync_exit(i8*)
; GVN should be able to eliminate this redundant load, with ARC-specific
; alias analysis.
-; CHECK: define i8* @foo(i32 %n)
+; CHECK: define i8* @test0(i32 %n)
; CHECK-NEXT: entry:
; CHECK-NEXT: %s = load i8** @x
; CHECK-NOT: load
; CHECK: ret i8* %s
; CHECK-NEXT: }
-define i8* @foo(i32 %n) nounwind {
+define i8* @test0(i32 %n) nounwind {
entry:
%s = load i8** @x
%0 = tail call i8* @objc_retain(i8* %s) nounwind
%t = load i8** @x
- ret i8* %s
+ ret i8* %t
+}
+
+; GVN should not be able to eliminate this redundant load, with ARC-specific
+; alias analysis.
+
+; CHECK-LABEL: define i8* @test1(
+; CHECK: load
+; CHECK: load
+; CHECK: ret i8* %t
+; CHECK: }
+define i8* @test1(i32 %n) nounwind {
+entry:
+ %s = load i8** @x
+ %0 = call i32 @objc_sync_enter(i8* %s)
+ %t = load i8** @x
+ %1 = call i32 @objc_sync_exit(i8* %s)
+ ret i8* %t
}
diff --git a/test/Transforms/ObjCARC/intrinsic-use-isolated.ll b/test/Transforms/ObjCARC/intrinsic-use-isolated.ll
index 4215b5c36465..f5c31fd82ecb 100644
--- a/test/Transforms/ObjCARC/intrinsic-use-isolated.ll
+++ b/test/Transforms/ObjCARC/intrinsic-use-isolated.ll
@@ -6,7 +6,7 @@
declare void @clang.arc.use(...) nounwind
; Kill calls to @clang.arc.use(...)
-; CHECK: define void @test0(
+; CHECK-LABEL: define void @test0(
; CHECK-NOT: clang.arc.use
; CHECK: }
define void @test0(i8* %a, i8* %b) {
diff --git a/test/Transforms/ObjCARC/intrinsic-use.ll b/test/Transforms/ObjCARC/intrinsic-use.ll
index 60370c1f4405..f3833cb54297 100644
--- a/test/Transforms/ObjCARC/intrinsic-use.ll
+++ b/test/Transforms/ObjCARC/intrinsic-use.ll
@@ -17,7 +17,7 @@ declare void @test0_helper(i8*, i8**)
; FIXME: the fact that we re-order retains w.r.t. @clang.arc.use could
; be problematic if we get run twice, e.g. under LTO.
;
-; CHECK: define void @test0(
+; CHECK-LABEL: define void @test0(
; CHECK: @objc_retain(i8* %x)
; CHECK-NEXT: store i8* %y, i8** %temp0
; CHECK-NEXT: @objc_retain(i8* %y)
@@ -65,7 +65,7 @@ entry:
ret void
}
-; CHECK: define void @test0a(
+; CHECK-LABEL: define void @test0a(
; CHECK: @objc_retain(i8* %x)
; CHECK-NEXT: store i8* %y, i8** %temp0
; CHECK-NEXT: @objc_retain(i8* %y)
diff --git a/test/Transforms/ObjCARC/invoke.ll b/test/Transforms/ObjCARC/invoke.ll
index 9510f2e7ddec..04d057b9d496 100644
--- a/test/Transforms/ObjCARC/invoke.ll
+++ b/test/Transforms/ObjCARC/invoke.ll
@@ -10,7 +10,7 @@ declare i8* @returner()
; ARCOpt shouldn't try to move the releases to the block containing the invoke.
-; CHECK: define void @test0(
+; CHECK-LABEL: define void @test0(
; CHECK: invoke.cont:
; CHECK: call void @objc_release(i8* %zipFile) [[NUW:#[0-9]+]], !clang.imprecise_release !0
; CHECK: ret void
@@ -38,7 +38,7 @@ lpad: ; preds = %entry
; ARCOpt should move the release before the callee calls.
-; CHECK: define void @test1(
+; CHECK-LABEL: define void @test1(
; CHECK: invoke.cont:
; CHECK: call void @objc_release(i8* %zipFile) [[NUW]], !clang.imprecise_release !0
; CHECK: call void @callee()
@@ -108,7 +108,7 @@ finally.rethrow: ; preds = %invoke.cont, %entry
; Don't try to place code on invoke critical edges.
-; CHECK: define void @test3(
+; CHECK-LABEL: define void @test3(
; CHECK: if.end:
; CHECK-NEXT: call void @objc_release(i8* %p) [[NUW]]
; CHECK-NEXT: ret void
@@ -139,7 +139,7 @@ if.end:
; Like test3, but with ARC-relevant exception handling.
-; CHECK: define void @test4(
+; CHECK-LABEL: define void @test4(
; CHECK: lpad:
; CHECK-NEXT: %r = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*)
; CHECK-NEXT: cleanup
@@ -177,7 +177,7 @@ if.end:
; Don't turn the retainAutoreleaseReturnValue into retain, because it's
; for an invoke which we can assume codegen will put immediately prior.
-; CHECK: define void @test5(
+; CHECK-LABEL: define void @test5(
; CHECK: call i8* @objc_retainAutoreleasedReturnValue(i8* %z)
; CHECK: }
define void @test5() {
@@ -197,7 +197,7 @@ if.end:
; Like test5, but there's intervening code.
-; CHECK: define void @test6(
+; CHECK-LABEL: define void @test6(
; CHECK: call i8* @objc_retain(i8* %z)
; CHECK: }
define void @test6() {
diff --git a/test/Transforms/ObjCARC/lit.local.cfg b/test/Transforms/ObjCARC/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/ObjCARC/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/ObjCARC/nested.ll b/test/Transforms/ObjCARC/nested.ll
index ca9c58bcb3e3..2eeb4fc25873 100644
--- a/test/Transforms/ObjCARC/nested.ll
+++ b/test/Transforms/ObjCARC/nested.ll
@@ -25,7 +25,7 @@ declare void @__crasher_block_invoke1(i8* nocapture)
; Delete a nested retain+release pair.
-; CHECK: define void @test0(
+; CHECK-LABEL: define void @test0(
; CHECK: call i8* @objc_retain
; CHECK-NOT: @objc_retain
; CHECK: }
@@ -89,7 +89,7 @@ forcoll.empty:
; Delete a nested retain+release pair.
-; CHECK: define void @test2(
+; CHECK-LABEL: define void @test2(
; CHECK: call i8* @objc_retain
; CHECK-NOT: @objc_retain
; CHECK: }
@@ -154,7 +154,7 @@ forcoll.empty:
; Delete a nested retain+release pair.
-; CHECK: define void @test4(
+; CHECK-LABEL: define void @test4(
; CHECK: call i8* @objc_retain
; CHECK-NOT: @objc_retain
; CHECK: }
@@ -219,7 +219,7 @@ forcoll.empty:
; Delete a nested retain+release pair.
-; CHECK: define void @test5(
+; CHECK-LABEL: define void @test5(
; CHECK: call i8* @objc_retain
; CHECK-NOT: @objc_retain
; CHECK: }
@@ -287,7 +287,7 @@ forcoll.empty:
; The optimizer currently can't do this, because isn't isn't sophisticated enough in
; reasnoning about nesting.
-; CHECK: define void @test6(
+; CHECK-LABEL: define void @test6(
; CHECK: call i8* @objc_retain
; CHECK: @objc_retain
; CHECK: }
@@ -355,7 +355,7 @@ forcoll.empty:
; The optimizer currently can't do this, because isn't isn't sophisticated enough in
; reasnoning about nesting.
-; CHECK: define void @test7(
+; CHECK-LABEL: define void @test7(
; CHECK: call i8* @objc_retain
; CHECK: @objc_retain
; CHECK: }
@@ -422,7 +422,7 @@ forcoll.empty:
; Delete a nested retain+release pair.
-; CHECK: define void @test8(
+; CHECK-LABEL: define void @test8(
; CHECK: call i8* @objc_retain
; CHECK-NOT: @objc_retain
; CHECK: }
@@ -496,7 +496,7 @@ forcoll.empty:
; The optimizer currently can't do this, because of a split loop backedge.
; See test9b for the same testcase without a split backedge.
-; CHECK: define void @test9(
+; CHECK-LABEL: define void @test9(
; CHECK: call i8* @objc_retain
; CHECK: call i8* @objc_retain
; CHECK: call i8* @objc_retain
@@ -563,7 +563,7 @@ forcoll.empty:
; Like test9, but without a split backedge. TODO: optimize this.
-; CHECK: define void @test9b(
+; CHECK-LABEL: define void @test9b(
; CHECK: call i8* @objc_retain
; CHECK: call i8* @objc_retain
; CHECK: @objc_retain
@@ -629,7 +629,7 @@ forcoll.empty:
; The optimizer currently can't do this, because of a split loop backedge.
; See test10b for the same testcase without a split backedge.
-; CHECK: define void @test10(
+; CHECK-LABEL: define void @test10(
; CHECK: call i8* @objc_retain
; CHECK: call i8* @objc_retain
; CHECK: call i8* @objc_retain
@@ -697,7 +697,7 @@ forcoll.empty:
; Like test10, but without a split backedge. TODO: optimize this.
-; CHECK: define void @test10b(
+; CHECK-LABEL: define void @test10b(
; CHECK: call i8* @objc_retain
; CHECK: call i8* @objc_retain
; CHECK: @objc_retain
@@ -769,7 +769,7 @@ forcoll.empty:
@__block_d_tmp = external hidden constant { i64, i64, i8*, i8*, i8*, i8* }
@__block_d_tmp5 = external hidden constant { i64, i64, i8*, i8*, i8*, i8* }
-; CHECK: define void @test11(
+; CHECK-LABEL: define void @test11(
; CHECK: tail call i8* @objc_retain(i8* %call) [[NUW:#[0-9]+]]
; CHECK: tail call i8* @objc_retain(i8* %call) [[NUW]]
; CHECK: call void @objc_release(i8* %call) [[NUW]], !clang.imprecise_release !0
diff --git a/test/Transforms/ObjCARC/no-objc-arc-exceptions.ll b/test/Transforms/ObjCARC/no-objc-arc-exceptions.ll
deleted file mode 100644
index 58b5bbe9c7e9..000000000000
--- a/test/Transforms/ObjCARC/no-objc-arc-exceptions.ll
+++ /dev/null
@@ -1,123 +0,0 @@
-; RUN: opt -S -objc-arc < %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-S128"
-%struct.__block_byref_x = type { i8*, %struct.__block_byref_x*, i32, i32, i32 }
-%struct.__block_descriptor = type { i64, i64 }
-@_NSConcreteStackBlock = external global i8*
-@__block_descriptor_tmp = external hidden constant { i64, i64, i8*, i8*, i8*, i8* }
-
-; The optimizer should make use of the !clang.arc.no_objc_arc_exceptions
-; metadata and eliminate the retainBlock+release pair here.
-; rdar://10803830.
-
-; CHECK: define void @test0(
-; CHECK-NOT: @objc
-; CHECK: }
-define void @test0() {
-entry:
- %x = alloca %struct.__block_byref_x, align 8
- %block = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>, align 8
- %byref.isa = getelementptr inbounds %struct.__block_byref_x* %x, i64 0, i32 0
- store i8* null, i8** %byref.isa, align 8
- %byref.forwarding = getelementptr inbounds %struct.__block_byref_x* %x, i64 0, i32 1
- store %struct.__block_byref_x* %x, %struct.__block_byref_x** %byref.forwarding, align 8
- %byref.flags = getelementptr inbounds %struct.__block_byref_x* %x, i64 0, i32 2
- store i32 0, i32* %byref.flags, align 8
- %byref.size = getelementptr inbounds %struct.__block_byref_x* %x, i64 0, i32 3
- store i32 32, i32* %byref.size, align 4
- %block.isa = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>* %block, i64 0, i32 0
- store i8* bitcast (i8** @_NSConcreteStackBlock to i8*), i8** %block.isa, align 8
- %block.flags = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>* %block, i64 0, i32 1
- store i32 1107296256, i32* %block.flags, align 8
- %block.reserved = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>* %block, i64 0, i32 2
- store i32 0, i32* %block.reserved, align 4
- %block.invoke = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>* %block, i64 0, i32 3
- store i8* bitcast (void (i8*)* @__foo_block_invoke_0 to i8*), i8** %block.invoke, align 8
- %block.descriptor = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>* %block, i64 0, i32 4
- store %struct.__block_descriptor* bitcast ({ i64, i64, i8*, i8*, i8*, i8* }* @__block_descriptor_tmp to %struct.__block_descriptor*), %struct.__block_descriptor** %block.descriptor, align 8
- %block.captured = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>* %block, i64 0, i32 5
- %t1 = bitcast %struct.__block_byref_x* %x to i8*
- store i8* %t1, i8** %block.captured, align 8
- %t2 = bitcast <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>* %block to i8*
- %t3 = call i8* @objc_retainBlock(i8* %t2) nounwind, !clang.arc.copy_on_escape !4
- %t4 = getelementptr inbounds i8* %t3, i64 16
- %t5 = bitcast i8* %t4 to i8**
- %t6 = load i8** %t5, align 8
- %t7 = bitcast i8* %t6 to void (i8*)*
- invoke void %t7(i8* %t3)
- to label %invoke.cont unwind label %lpad, !clang.arc.no_objc_arc_exceptions !4
-
-invoke.cont: ; preds = %entry
- call void @objc_release(i8* %t3) nounwind, !clang.imprecise_release !4
- call void @_Block_object_dispose(i8* %t1, i32 8)
- ret void
-
-lpad: ; preds = %entry
- %t8 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*)
- cleanup
- call void @_Block_object_dispose(i8* %t1, i32 8)
- resume { i8*, i32 } %t8
-}
-
-; There is no !clang.arc.no_objc_arc_exceptions metadata here, so the optimizer
-; shouldn't eliminate anything, but *CAN* strength reduce the objc_retainBlock
-; to an objc_retain.
-
-; CHECK: define void @test0_no_metadata(
-; CHECK: call i8* @objc_retain(
-; CHECK: invoke
-; CHECK: call void @objc_release(
-; CHECK: }
-define void @test0_no_metadata() {
-entry:
- %x = alloca %struct.__block_byref_x, align 8
- %block = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>, align 8
- %byref.isa = getelementptr inbounds %struct.__block_byref_x* %x, i64 0, i32 0
- store i8* null, i8** %byref.isa, align 8
- %byref.forwarding = getelementptr inbounds %struct.__block_byref_x* %x, i64 0, i32 1
- store %struct.__block_byref_x* %x, %struct.__block_byref_x** %byref.forwarding, align 8
- %byref.flags = getelementptr inbounds %struct.__block_byref_x* %x, i64 0, i32 2
- store i32 0, i32* %byref.flags, align 8
- %byref.size = getelementptr inbounds %struct.__block_byref_x* %x, i64 0, i32 3
- store i32 32, i32* %byref.size, align 4
- %block.isa = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>* %block, i64 0, i32 0
- store i8* bitcast (i8** @_NSConcreteStackBlock to i8*), i8** %block.isa, align 8
- %block.flags = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>* %block, i64 0, i32 1
- store i32 1107296256, i32* %block.flags, align 8
- %block.reserved = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>* %block, i64 0, i32 2
- store i32 0, i32* %block.reserved, align 4
- %block.invoke = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>* %block, i64 0, i32 3
- store i8* bitcast (void (i8*)* @__foo_block_invoke_0 to i8*), i8** %block.invoke, align 8
- %block.descriptor = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>* %block, i64 0, i32 4
- store %struct.__block_descriptor* bitcast ({ i64, i64, i8*, i8*, i8*, i8* }* @__block_descriptor_tmp to %struct.__block_descriptor*), %struct.__block_descriptor** %block.descriptor, align 8
- %block.captured = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>* %block, i64 0, i32 5
- %t1 = bitcast %struct.__block_byref_x* %x to i8*
- store i8* %t1, i8** %block.captured, align 8
- %t2 = bitcast <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>* %block to i8*
- %t3 = call i8* @objc_retainBlock(i8* %t2) nounwind, !clang.arc.copy_on_escape !4
- %t4 = getelementptr inbounds i8* %t3, i64 16
- %t5 = bitcast i8* %t4 to i8**
- %t6 = load i8** %t5, align 8
- %t7 = bitcast i8* %t6 to void (i8*)*
- invoke void %t7(i8* %t3)
- to label %invoke.cont unwind label %lpad
-
-invoke.cont: ; preds = %entry
- call void @objc_release(i8* %t3) nounwind, !clang.imprecise_release !4
- call void @_Block_object_dispose(i8* %t1, i32 8)
- ret void
-
-lpad: ; preds = %entry
- %t8 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*)
- cleanup
- call void @_Block_object_dispose(i8* %t1, i32 8)
- resume { i8*, i32 } %t8
-}
-
-declare i8* @objc_retainBlock(i8*)
-declare void @objc_release(i8*)
-declare void @_Block_object_dispose(i8*, i32)
-declare i32 @__objc_personality_v0(...)
-declare void @__foo_block_invoke_0(i8* nocapture) uwtable ssp
-
-!4 = metadata !{}
diff --git a/test/Transforms/ObjCARC/path-overflow.ll b/test/Transforms/ObjCARC/path-overflow.ll
index e7866ed1b442..3c14353947ae 100644
--- a/test/Transforms/ObjCARC/path-overflow.ll
+++ b/test/Transforms/ObjCARC/path-overflow.ll
@@ -1,21 +1,35 @@
; RUN: opt -objc-arc -S < %s
; rdar://12277446
+; rdar://12480535
+; rdar://14590914
+; rdar://15377890
; The total number of paths grows exponentially with the number of branches, and a
-; computation of this number can overflow any reasonable fixed-sized integer.
+; computation of this number can overflow any reasonable fixed-sized
+; integer. This can occur in both the addition phase when we are adding up the
+; total bottomup/topdown paths and when we multiply them together at the end.
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
target triple = "thumbv7-apple-ios5.0.0"
-%struct.NSConstantString.11.33.55.77.99.121.143.332.1130.1340.2768 = type { i32*, i32, i8*, i32 }
+%struct.NSConstantString = type { i32*, i32, i8*, i32 }
+%struct.CGPoint = type { float, float }
-@_unnamed_cfstring_591 = external constant %struct.NSConstantString.11.33.55.77.99.121.143.332.1130.1340.2768, section "__DATA,__cfstring"
+@_unnamed_cfstring = external constant %struct.NSConstantString, section "__DATA,__cfstring"
+@_unnamed_cfstring_2 = external constant %struct.NSConstantString, section "__DATA,__cfstring"
declare i8* @objc_retain(i8*) nonlazybind
-
+declare i8* @objc_retainAutoreleasedReturnValue(i8*) nonlazybind
declare void @objc_release(i8*) nonlazybind
+declare i8* @returner()
+declare i8* @objc_msgSend(i8*, i8*, ...) nonlazybind
+declare void @NSLog(i8*, ...)
+declare void @objc_msgSend_stret(i8*, i8*, ...)
+declare i32 @__gxx_personality_sj0(...)
+declare i32 @__objc_personality_v0(...)
+
-define hidden void @foo() {
+define hidden void @test1() {
entry:
br i1 undef, label %msgSend.nullinit, label %msgSend.call
@@ -26,7 +40,7 @@ msgSend.nullinit: ; preds = %entry
br label %msgSend.cont
msgSend.cont: ; preds = %msgSend.nullinit, %msgSend.call
- %0 = bitcast %struct.NSConstantString.11.33.55.77.99.121.143.332.1130.1340.2768* @_unnamed_cfstring_591 to i8*
+ %0 = bitcast %struct.NSConstantString* @_unnamed_cfstring to i8*
%1 = call i8* @objc_retain(i8* %0) nounwind
br i1 undef, label %msgSend.nullinit33, label %msgSend.call32
@@ -326,4 +340,1854 @@ msgSend.cont507: ; preds = %msgSend.nullinit506
ret void
}
+; Function Attrs: optsize ssp uwtable
+define void @test2() unnamed_addr align 2 {
+bb:
+ br i1 undef, label %bb3, label %bb2
+
+bb2: ; preds = %bb
+ br label %bb3
+
+bb3: ; preds = %bb2, %bb
+ br i1 undef, label %bb5, label %bb4
+
+bb4: ; preds = %bb3
+ br label %bb5
+
+bb5: ; preds = %bb4, %bb3
+ br i1 undef, label %bb7, label %bb6
+
+bb6: ; preds = %bb5
+ br label %bb7
+
+bb7: ; preds = %bb6, %bb5
+ br i1 undef, label %bb9, label %bb8
+
+bb8: ; preds = %bb7
+ unreachable
+
+bb9: ; preds = %bb7
+ br i1 undef, label %bb11, label %bb10
+
+bb10: ; preds = %bb9
+ br label %bb11
+
+bb11: ; preds = %bb10, %bb9
+ br i1 undef, label %bb13, label %bb12
+
+bb12: ; preds = %bb11
+ br label %bb13
+
+bb13: ; preds = %bb12, %bb11
+ br i1 undef, label %bb15, label %bb14
+
+bb14: ; preds = %bb13
+ br label %bb15
+
+bb15: ; preds = %bb14, %bb13
+ br i1 undef, label %bb17, label %bb16
+
+bb16: ; preds = %bb15
+ br label %bb17
+
+bb17: ; preds = %bb16, %bb15
+ br i1 undef, label %bb19, label %bb18
+
+bb18: ; preds = %bb17
+ br label %bb19
+
+bb19: ; preds = %bb18, %bb17
+ br i1 undef, label %bb222, label %bb20
+
+bb20: ; preds = %bb19
+ br i1 undef, label %bb222, label %bb21
+
+bb21: ; preds = %bb20
+ br i1 undef, label %bb22, label %bb30
+
+bb22: ; preds = %bb21
+ br i1 undef, label %bb23, label %bb32
+
+bb23: ; preds = %bb22
+ br i1 undef, label %bb24, label %bb34
+
+bb24: ; preds = %bb23
+ br i1 undef, label %bb26, label %bb25
+
+bb25: ; preds = %bb24
+ br label %bb27
+
+bb26: ; preds = %bb24
+ br label %bb27
+
+bb27: ; preds = %bb26, %bb25
+ br i1 undef, label %bb28, label %bb42
+
+bb28: ; preds = %bb27
+ br i1 undef, label %bb36, label %bb29
+
+bb29: ; preds = %bb28
+ br label %bb36
+
+bb30: ; preds = %bb210, %bb207, %bb203, %bb199, %bb182, %bb176, %bb174, %bb171, %bb136, %bb132, %bb21
+ br label %bb213
+
+bb32: ; preds = %bb22
+ unreachable
+
+bb34: ; preds = %bb23
+ unreachable
+
+bb36: ; preds = %bb29, %bb28
+ br i1 undef, label %bb38, label %bb37
+
+bb37: ; preds = %bb36
+ br label %bb39
+
+bb38: ; preds = %bb36
+ br label %bb39
+
+bb39: ; preds = %bb38, %bb37
+ br i1 undef, label %bb41, label %bb40
+
+bb40: ; preds = %bb39
+ unreachable
+
+bb41: ; preds = %bb39
+ br label %bb42
+
+bb42: ; preds = %bb41, %bb27
+ br i1 undef, label %bb43, label %bb214
+
+bb43: ; preds = %bb42
+ br i1 undef, label %bb47, label %bb45
+
+bb45: ; preds = %bb130, %bb128, %bb126, %bb124, %bb122, %bb120, %bb118, %bb116, %bb114, %bb112, %bb110, %bb108, %bb105, %bb102, %bb100, %bb96, %bb94, %bb90, %bb88, %bb84, %bb82, %bb78, %bb76, %bb72, %bb70, %bb66, %bb64, %bb60, %bb58, %bb54, %bb51, %bb43
+ unreachable
+
+bb47: ; preds = %bb43
+ br i1 undef, label %bb48, label %bb106
+
+bb48: ; preds = %bb47
+ br i1 undef, label %bb50, label %bb49
+
+bb49: ; preds = %bb48
+ br label %bb51
+
+bb50: ; preds = %bb48
+ br label %bb51
+
+bb51: ; preds = %bb50, %bb49
+ br i1 undef, label %bb53, label %bb45
+
+bb53: ; preds = %bb51
+ br i1 undef, label %bb54, label %bb134
+
+bb54: ; preds = %bb53
+ br i1 undef, label %bb55, label %bb45
+
+bb55: ; preds = %bb54
+ br i1 undef, label %bb57, label %bb56
+
+bb56: ; preds = %bb55
+ br label %bb58
+
+bb57: ; preds = %bb55
+ br label %bb58
+
+bb58: ; preds = %bb57, %bb56
+ br i1 undef, label %bb60, label %bb45
+
+bb60: ; preds = %bb58
+ br i1 undef, label %bb61, label %bb45
+
+bb61: ; preds = %bb60
+ br i1 undef, label %bb63, label %bb62
+
+bb62: ; preds = %bb61
+ br label %bb64
+
+bb63: ; preds = %bb61
+ br label %bb64
+
+bb64: ; preds = %bb63, %bb62
+ br i1 undef, label %bb66, label %bb45
+
+bb66: ; preds = %bb64
+ br i1 undef, label %bb67, label %bb45
+
+bb67: ; preds = %bb66
+ br i1 undef, label %bb69, label %bb68
+
+bb68: ; preds = %bb67
+ br label %bb70
+
+bb69: ; preds = %bb67
+ br label %bb70
+
+bb70: ; preds = %bb69, %bb68
+ br i1 undef, label %bb72, label %bb45
+
+bb72: ; preds = %bb70
+ br i1 undef, label %bb73, label %bb45
+
+bb73: ; preds = %bb72
+ br i1 undef, label %bb75, label %bb74
+
+bb74: ; preds = %bb73
+ br label %bb76
+
+bb75: ; preds = %bb73
+ br label %bb76
+
+bb76: ; preds = %bb75, %bb74
+ br i1 undef, label %bb78, label %bb45
+
+bb78: ; preds = %bb76
+ br i1 undef, label %bb79, label %bb45
+
+bb79: ; preds = %bb78
+ br i1 undef, label %bb81, label %bb80
+
+bb80: ; preds = %bb79
+ br label %bb82
+
+bb81: ; preds = %bb79
+ br label %bb82
+
+bb82: ; preds = %bb81, %bb80
+ br i1 undef, label %bb84, label %bb45
+
+bb84: ; preds = %bb82
+ br i1 undef, label %bb85, label %bb45
+
+bb85: ; preds = %bb84
+ br i1 undef, label %bb87, label %bb86
+
+bb86: ; preds = %bb85
+ br label %bb88
+
+bb87: ; preds = %bb85
+ br label %bb88
+
+bb88: ; preds = %bb87, %bb86
+ br i1 undef, label %bb90, label %bb45
+
+bb90: ; preds = %bb88
+ br i1 undef, label %bb91, label %bb45
+
+bb91: ; preds = %bb90
+ br i1 undef, label %bb93, label %bb92
+
+bb92: ; preds = %bb91
+ br label %bb94
+
+bb93: ; preds = %bb91
+ br label %bb94
+
+bb94: ; preds = %bb93, %bb92
+ br i1 undef, label %bb96, label %bb45
+
+bb96: ; preds = %bb94
+ br i1 undef, label %bb97, label %bb45
+
+bb97: ; preds = %bb96
+ br i1 undef, label %bb99, label %bb98
+
+bb98: ; preds = %bb97
+ br label %bb100
+
+bb99: ; preds = %bb97
+ br label %bb100
+
+bb100: ; preds = %bb99, %bb98
+ br i1 undef, label %bb102, label %bb45
+
+bb102: ; preds = %bb100
+ br i1 undef, label %bb104, label %bb45
+
+bb104: ; preds = %bb102
+ br i1 undef, label %bb108, label %bb105
+
+bb105: ; preds = %bb104
+ br i1 undef, label %bb108, label %bb45
+
+bb106: ; preds = %bb47
+ unreachable
+
+bb108: ; preds = %bb105, %bb104
+ br i1 undef, label %bb110, label %bb45
+
+bb110: ; preds = %bb108
+ br i1 undef, label %bb112, label %bb45
+
+bb112: ; preds = %bb110
+ br i1 undef, label %bb114, label %bb45
+
+bb114: ; preds = %bb112
+ br i1 undef, label %bb116, label %bb45
+
+bb116: ; preds = %bb114
+ br i1 undef, label %bb118, label %bb45
+
+bb118: ; preds = %bb116
+ br i1 undef, label %bb120, label %bb45
+
+bb120: ; preds = %bb118
+ br i1 undef, label %bb122, label %bb45
+
+bb122: ; preds = %bb120
+ br i1 undef, label %bb124, label %bb45
+
+bb124: ; preds = %bb122
+ br i1 undef, label %bb126, label %bb45
+
+bb126: ; preds = %bb124
+ br i1 undef, label %bb128, label %bb45
+
+bb128: ; preds = %bb126
+ br i1 undef, label %bb130, label %bb45
+
+bb130: ; preds = %bb128
+ br i1 undef, label %bb132, label %bb45
+
+bb132: ; preds = %bb130
+ br i1 undef, label %bb135, label %bb30
+
+bb134: ; preds = %bb53
+ unreachable
+
+bb135: ; preds = %bb132
+ br i1 undef, label %bb139, label %bb136
+
+bb136: ; preds = %bb135
+ br i1 undef, label %bb138, label %bb30
+
+bb138: ; preds = %bb136
+ br label %bb139
+
+bb139: ; preds = %bb138, %bb135
+ br i1 undef, label %bb140, label %bb141
+
+bb140: ; preds = %bb139
+ unreachable
+
+bb141: ; preds = %bb139
+ br i1 undef, label %bb142, label %bb215
+
+bb142: ; preds = %bb141
+ br i1 undef, label %bb144, label %bb143
+
+bb143: ; preds = %bb142
+ br label %bb145
+
+bb144: ; preds = %bb142
+ br label %bb145
+
+bb145: ; preds = %bb144, %bb143
+ br i1 undef, label %bb146, label %bb151
+
+bb146: ; preds = %bb145
+ br i1 undef, label %bb148, label %bb153
+
+bb148: ; preds = %bb146
+ br i1 undef, label %bb155, label %bb149
+
+bb149: ; preds = %bb148
+ br i1 undef, label %bb150, label %bb153
+
+bb150: ; preds = %bb149
+ br label %bb155
+
+bb151: ; preds = %bb145
+ unreachable
+
+bb153: ; preds = %bb158, %bb149, %bb146
+ unreachable
+
+bb155: ; preds = %bb150, %bb148
+ br i1 undef, label %bb157, label %bb156
+
+bb156: ; preds = %bb155
+ br label %bb158
+
+bb157: ; preds = %bb155
+ br label %bb158
+
+bb158: ; preds = %bb157, %bb156
+ br i1 undef, label %bb160, label %bb153
+
+bb160: ; preds = %bb158
+ br i1 undef, label %bb162, label %bb161
+
+bb161: ; preds = %bb160
+ br label %bb163
+
+bb162: ; preds = %bb160
+ br label %bb163
+
+bb163: ; preds = %bb162, %bb161
+ br i1 undef, label %bb165, label %bb164
+
+bb164: ; preds = %bb163
+ br label %bb165
+
+bb165: ; preds = %bb164, %bb163
+ br i1 undef, label %bb170, label %bb166
+
+bb166: ; preds = %bb165
+ br i1 undef, label %bb167, label %bb168
+
+bb167: ; preds = %bb166
+ unreachable
+
+bb168: ; preds = %bb166
+ unreachable
+
+bb170: ; preds = %bb165
+ br i1 undef, label %bb215, label %bb171
+
+bb171: ; preds = %bb170
+ br i1 undef, label %bb173, label %bb30
+
+bb173: ; preds = %bb171
+ br i1 undef, label %bb174, label %bb215
+
+bb174: ; preds = %bb173
+ br i1 undef, label %bb176, label %bb30
+
+bb176: ; preds = %bb174
+ br i1 undef, label %bb178, label %bb30
+
+bb178: ; preds = %bb176
+ br i1 undef, label %bb179, label %bb193
+
+bb179: ; preds = %bb178
+ br i1 undef, label %bb181, label %bb180
+
+bb180: ; preds = %bb179
+ br label %bb182
+
+bb181: ; preds = %bb179
+ br label %bb182
+
+bb182: ; preds = %bb181, %bb180
+ br i1 undef, label %bb184, label %bb30
+
+bb184: ; preds = %bb182
+ %tmp185 = call i8* @returner()
+ br i1 undef, label %bb186, label %bb195
+
+bb186: ; preds = %bb184
+ %tmp188 = call i8* @objc_retainAutoreleasedReturnValue(i8* %tmp185)
+ %tmp189 = call i8* @objc_retain(i8* %tmp188)
+ call void @objc_release(i8* %tmp189), !clang.imprecise_release !0
+ br i1 undef, label %bb197, label %bb190
+
+bb190: ; preds = %bb186
+ br i1 undef, label %bb192, label %bb195
+
+bb192: ; preds = %bb190
+ br i1 undef, label %bb197, label %bb195
+
+bb193: ; preds = %bb178
+ br label %bb213
+
+bb195: ; preds = %bb192, %bb190, %bb184
+ unreachable
+
+bb197: ; preds = %bb192, %bb186
+ br i1 undef, label %bb198, label %bb215
+
+bb198: ; preds = %bb197
+ br i1 undef, label %bb202, label %bb199
+
+bb199: ; preds = %bb198
+ br i1 undef, label %bb201, label %bb30
+
+bb201: ; preds = %bb199
+ br label %bb202
+
+bb202: ; preds = %bb201, %bb198
+ br i1 undef, label %bb206, label %bb203
+
+bb203: ; preds = %bb202
+ br i1 undef, label %bb205, label %bb30
+
+bb205: ; preds = %bb203
+ br label %bb206
+
+bb206: ; preds = %bb205, %bb202
+ br i1 undef, label %bb210, label %bb207
+
+bb207: ; preds = %bb206
+ br i1 undef, label %bb209, label %bb30
+
+bb209: ; preds = %bb207
+ br label %bb210
+
+bb210: ; preds = %bb209, %bb206
+ br i1 undef, label %bb212, label %bb30
+
+bb212: ; preds = %bb210
+ unreachable
+
+bb213: ; preds = %bb193, %bb30
+ resume { i8*, i32 } undef
+
+bb214: ; preds = %bb42
+ br label %bb219
+
+bb215: ; preds = %bb197, %bb173, %bb170, %bb141
+ br i1 undef, label %bb217, label %bb216
+
+bb216: ; preds = %bb215
+ br label %bb217
+
+bb217: ; preds = %bb216, %bb215
+ br i1 undef, label %bb219, label %bb218
+
+bb218: ; preds = %bb217
+ br label %bb219
+
+bb219: ; preds = %bb218, %bb217, %bb214
+ br i1 undef, label %bb221, label %bb220
+
+bb220: ; preds = %bb219
+ unreachable
+
+bb221: ; preds = %bb219
+ unreachable
+
+bb222: ; preds = %bb20, %bb19
+ ret void
+}
+
+; Function Attrs: ssp
+define void @test3() #1 {
+entry:
+ %call2 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont unwind label %lpad
+
+invoke.cont: ; preds = %entry
+ %call5 = invoke signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %invoke.cont4 unwind label %lpad3
+
+invoke.cont4: ; preds = %invoke.cont
+ br i1 undef, label %land.end, label %land.rhs
+
+land.rhs: ; preds = %invoke.cont4
+ %call7 = invoke i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %land.end unwind label %lpad3
+
+land.end: ; preds = %land.rhs, %invoke.cont4
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i unwind label %lpad.i
+
+invoke.cont.i: ; preds = %land.end
+ br i1 undef, label %invoke.cont8, label %if.then.i
+
+if.then.i: ; preds = %invoke.cont.i
+ br label %invoke.cont8
+
+lpad.i: ; preds = %land.end
+ %tmp13 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont8: ; preds = %if.then.i, %invoke.cont.i
+ %call18 = invoke i8* (i8*, i8*, i8*, ...)* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*, ...)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef)
+ to label %invoke.cont17 unwind label %lpad16
+
+invoke.cont17: ; preds = %invoke.cont8
+ %call22 = invoke signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont21 unwind label %lpad20
+
+invoke.cont21: ; preds = %invoke.cont17
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i1980 unwind label %lpad.i1982
+
+invoke.cont.i1980: ; preds = %invoke.cont21
+ br i1 undef, label %invoke.cont24, label %if.then.i1981
+
+if.then.i1981: ; preds = %invoke.cont.i1980
+ br label %invoke.cont24
+
+lpad.i1982: ; preds = %invoke.cont21
+ %tmp28 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont24: ; preds = %if.then.i1981, %invoke.cont.i1980
+ %call37 = invoke signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %invoke.cont36 unwind label %lpad35
+
+invoke.cont36: ; preds = %invoke.cont24
+ br i1 undef, label %land.end43, label %land.rhs39
+
+land.rhs39: ; preds = %invoke.cont36
+ %call41 = invoke signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %land.end43 unwind label %lpad35
+
+land.end43: ; preds = %land.rhs39, %invoke.cont36
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i1986 unwind label %lpad.i1988
+
+invoke.cont.i1986: ; preds = %land.end43
+ br i1 undef, label %invoke.cont44, label %if.then.i1987
+
+if.then.i1987: ; preds = %invoke.cont.i1986
+ br label %invoke.cont44
+
+lpad.i1988: ; preds = %land.end43
+ %tmp42 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont44: ; preds = %if.then.i1987, %invoke.cont.i1986
+ %call53 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont52 unwind label %lpad51
+
+invoke.cont52: ; preds = %invoke.cont44
+ br i1 undef, label %land.end70, label %land.rhs58
+
+land.rhs58: ; preds = %invoke.cont52
+ %call63 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* undef, i8* undef, i32 42)
+ to label %invoke.cont62 unwind label %lpad61
+
+invoke.cont62: ; preds = %land.rhs58
+ %call68 = invoke signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* undef)
+ to label %land.end70 unwind label %lpad66.body.thread
+
+land.end70: ; preds = %invoke.cont62, %invoke.cont52
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i1992 unwind label %lpad66.body
+
+invoke.cont.i1992: ; preds = %land.end70
+ br i1 undef, label %invoke.cont71, label %if.then.i1993
+
+if.then.i1993: ; preds = %invoke.cont.i1992
+ br label %invoke.cont71
+
+invoke.cont71: ; preds = %if.then.i1993, %invoke.cont.i1992
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i1998 unwind label %lpad.i2000
+
+invoke.cont.i1998: ; preds = %invoke.cont71
+ br i1 undef, label %invoke.cont91, label %if.then.i1999
+
+if.then.i1999: ; preds = %invoke.cont.i1998
+ br label %invoke.cont91
+
+lpad.i2000: ; preds = %invoke.cont71
+ %tmp74 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup102
+
+invoke.cont91: ; preds = %if.then.i1999, %invoke.cont.i1998
+ %call96 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %invoke.cont95 unwind label %lpad94
+
+invoke.cont95: ; preds = %invoke.cont91
+ %call98 = invoke signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* %call96)
+ to label %invoke.cont97 unwind label %lpad94
+
+invoke.cont97: ; preds = %invoke.cont95
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2004 unwind label %lpad.i2006
+
+invoke.cont.i2004: ; preds = %invoke.cont97
+ br i1 undef, label %invoke.cont100, label %if.then.i2005
+
+if.then.i2005: ; preds = %invoke.cont.i2004
+ br label %invoke.cont100
+
+lpad.i2006: ; preds = %invoke.cont97
+ %tmp82 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont100: ; preds = %if.then.i2005, %invoke.cont.i2004
+ invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont110 unwind label %lpad109
+
+invoke.cont110: ; preds = %invoke.cont100
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2010 unwind label %lpad.i2012
+
+invoke.cont.i2010: ; preds = %invoke.cont110
+ br i1 undef, label %invoke.cont117, label %if.then.i2011
+
+if.then.i2011: ; preds = %invoke.cont.i2010
+ br label %invoke.cont117
+
+lpad.i2012: ; preds = %invoke.cont110
+ %tmp98 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont117: ; preds = %if.then.i2011, %invoke.cont.i2010
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2022 unwind label %lpad156.body
+
+lpad: ; preds = %entry
+ %tmp118 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup
+
+lpad3: ; preds = %land.rhs, %invoke.cont
+ %tmp119 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup
+
+ehcleanup: ; preds = %lpad3, %lpad
+ unreachable
+
+lpad16: ; preds = %invoke.cont8
+ %tmp121 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup26
+
+lpad20: ; preds = %invoke.cont17
+ %tmp122 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup26
+
+ehcleanup26: ; preds = %lpad20, %lpad16
+ unreachable
+
+lpad35: ; preds = %land.rhs39, %invoke.cont24
+ %tmp124 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad51: ; preds = %invoke.cont44
+ %tmp125 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad61: ; preds = %land.rhs58
+ %tmp127 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad66.body.thread: ; preds = %invoke.cont62
+ %tmp128 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad66.body: ; preds = %land.end70
+ %tmp129 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad94: ; preds = %invoke.cont95, %invoke.cont91
+ %tmp133 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup102
+
+ehcleanup102: ; preds = %lpad94, %lpad.i2000
+ unreachable
+
+lpad109: ; preds = %invoke.cont100
+ %tmp134 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont.i2022: ; preds = %invoke.cont117
+ br i1 undef, label %invoke.cont157, label %if.then.i2023
+
+if.then.i2023: ; preds = %invoke.cont.i2022
+ br label %invoke.cont157
+
+invoke.cont157: ; preds = %if.then.i2023, %invoke.cont.i2022
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2028 unwind label %lpad164.body
+
+invoke.cont.i2028: ; preds = %invoke.cont157
+ br i1 undef, label %invoke.cont165, label %if.then.i2029
+
+if.then.i2029: ; preds = %invoke.cont.i2028
+ br label %invoke.cont165
+
+invoke.cont165: ; preds = %if.then.i2029, %invoke.cont.i2028
+ invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, void (i8*, i8*)*)*)(i8* undef, i8* undef, void (i8*, i8*)* undef)
+ to label %invoke.cont184 unwind label %lpad183
+
+invoke.cont184: ; preds = %invoke.cont165
+ %call186 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont185 unwind label %lpad183
+
+invoke.cont185: ; preds = %invoke.cont184
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2034 unwind label %lpad.i2036
+
+invoke.cont.i2034: ; preds = %invoke.cont185
+ br i1 undef, label %invoke.cont190, label %if.then.i2035
+
+if.then.i2035: ; preds = %invoke.cont.i2034
+ br label %invoke.cont190
+
+lpad.i2036: ; preds = %invoke.cont185
+ %tmp168 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %lpad183.body
+
+invoke.cont190: ; preds = %if.then.i2035, %invoke.cont.i2034
+ invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont197 unwind label %lpad196
+
+invoke.cont197: ; preds = %invoke.cont190
+ %call202 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont201 unwind label %lpad200
+
+invoke.cont201: ; preds = %invoke.cont197
+ %call205 = invoke signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont204 unwind label %lpad203
+
+invoke.cont204: ; preds = %invoke.cont201
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2040 unwind label %lpad.i2042
+
+invoke.cont.i2040: ; preds = %invoke.cont204
+ br i1 undef, label %invoke.cont207, label %if.then.i2041
+
+if.then.i2041: ; preds = %invoke.cont.i2040
+ br label %invoke.cont207
+
+lpad.i2042: ; preds = %invoke.cont204
+ %tmp181 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont207: ; preds = %if.then.i2041, %invoke.cont.i2040
+ %call209 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %invoke.cont208 unwind label %lpad203
+
+invoke.cont208: ; preds = %invoke.cont207
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2046 unwind label %lpad212.body
+
+invoke.cont.i2046: ; preds = %invoke.cont208
+ br i1 undef, label %invoke.cont213, label %if.then.i2047
+
+if.then.i2047: ; preds = %invoke.cont.i2046
+ br label %invoke.cont213
+
+invoke.cont213: ; preds = %if.then.i2047, %invoke.cont.i2046
+ invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont221 unwind label %lpad220
+
+invoke.cont221: ; preds = %invoke.cont213
+ %call229 = invoke signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont228 unwind label %lpad227
+
+invoke.cont228: ; preds = %invoke.cont221
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2052 unwind label %lpad.i2054
+
+invoke.cont.i2052: ; preds = %invoke.cont228
+ br i1 undef, label %invoke.cont231, label %if.then.i2053
+
+if.then.i2053: ; preds = %invoke.cont.i2052
+ br label %invoke.cont231
+
+lpad.i2054: ; preds = %invoke.cont228
+ %tmp198 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont231: ; preds = %if.then.i2053, %invoke.cont.i2052
+ %call233 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %invoke.cont232 unwind label %lpad227
+
+invoke.cont232: ; preds = %invoke.cont231
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2058 unwind label %lpad236.body
+
+invoke.cont.i2058: ; preds = %invoke.cont232
+ br i1 undef, label %invoke.cont237, label %if.then.i2059
+
+if.then.i2059: ; preds = %invoke.cont.i2058
+ br label %invoke.cont237
+
+invoke.cont237: ; preds = %if.then.i2059, %invoke.cont.i2058
+ %call246 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont245 unwind label %lpad244
+
+invoke.cont245: ; preds = %invoke.cont237
+ %call248 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* undef, i8* undef, i32 13)
+ to label %invoke.cont247 unwind label %lpad244
+
+invoke.cont247: ; preds = %invoke.cont245
+ %call251 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* undef, i8* undef, i32 2)
+ to label %invoke.cont250 unwind label %lpad249
+
+invoke.cont250: ; preds = %invoke.cont247
+ %call254 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* undef, i8* undef, i32 7)
+ to label %invoke.cont253 unwind label %lpad252
+
+invoke.cont253: ; preds = %invoke.cont250
+ %call257 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8**, i32)*)(i8* undef, i8* undef, i8** undef, i32 3)
+ to label %invoke.cont256 unwind label %lpad255
+
+invoke.cont256: ; preds = %invoke.cont253
+ %call260 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* undef, i8* undef)
+ to label %invoke.cont259 unwind label %lpad258
+
+invoke.cont259: ; preds = %invoke.cont256
+ %call267 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont266 unwind label %lpad265
+
+invoke.cont266: ; preds = %invoke.cont259
+ %call275 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* undef)
+ to label %invoke.cont274 unwind label %lpad273
+
+invoke.cont274: ; preds = %invoke.cont266
+ %call279 = invoke i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %invoke.cont278 unwind label %lpad277
+
+invoke.cont278: ; preds = %invoke.cont274
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2064 unwind label %lpad.i2066
+
+invoke.cont.i2064: ; preds = %invoke.cont278
+ br i1 undef, label %invoke.cont281, label %if.then.i2065
+
+if.then.i2065: ; preds = %invoke.cont.i2064
+ br label %invoke.cont281
+
+lpad.i2066: ; preds = %invoke.cont278
+ %tmp253 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont281: ; preds = %if.then.i2065, %invoke.cont.i2064
+ %call291 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont290 unwind label %lpad289
+
+invoke.cont290: ; preds = %invoke.cont281
+ %call303 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* undef, i8* undef, i32 8)
+ to label %invoke.cont302 unwind label %lpad301
+
+invoke.cont302: ; preds = %invoke.cont290
+ %call310 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, double)*)(i8* undef, i8* undef, double 5.000000e-01)
+ to label %invoke.cont309 unwind label %lpad308
+
+invoke.cont309: ; preds = %invoke.cont302
+ %call313 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* undef, i8* undef, i32 42)
+ to label %invoke.cont312 unwind label %lpad311
+
+invoke.cont312: ; preds = %invoke.cont309
+ %call316 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8**, i8**, i32)*)(i8* undef, i8* undef, i8** undef, i8** undef, i32 2)
+ to label %invoke.cont315 unwind label %lpad314
+
+invoke.cont315: ; preds = %invoke.cont312
+ %call322 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* undef)
+ to label %invoke.cont321 unwind label %lpad320
+
+invoke.cont321: ; preds = %invoke.cont315
+ br i1 undef, label %land.end344, label %land.rhs335
+
+land.rhs335: ; preds = %invoke.cont321
+ %call342 = invoke signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %land.end344 unwind label %lpad340.body.thread
+
+land.end344: ; preds = %land.rhs335, %invoke.cont321
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2070 unwind label %lpad340.body
+
+invoke.cont.i2070: ; preds = %land.end344
+ br i1 undef, label %invoke.cont345, label %if.then.i2071
+
+if.then.i2071: ; preds = %invoke.cont.i2070
+ br label %invoke.cont345
+
+invoke.cont345: ; preds = %if.then.i2071, %invoke.cont.i2070
+ %call362 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* undef)
+ to label %invoke.cont361 unwind label %lpad360
+
+invoke.cont361: ; preds = %invoke.cont345
+ %call365 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont364 unwind label %lpad363
+
+invoke.cont364: ; preds = %invoke.cont361
+ %call371 = invoke i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %invoke.cont370 unwind label %lpad369
+
+invoke.cont370: ; preds = %invoke.cont364
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2076 unwind label %lpad.i2078
+
+invoke.cont.i2076: ; preds = %invoke.cont370
+ br i1 undef, label %invoke.cont373, label %if.then.i2077
+
+if.then.i2077: ; preds = %invoke.cont.i2076
+ br label %invoke.cont373
+
+lpad.i2078: ; preds = %invoke.cont370
+ %tmp340 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont373: ; preds = %if.then.i2077, %invoke.cont.i2076
+ %call377 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32, i8*)*)(i8* undef, i8* undef, i32 42, i8* undef)
+ to label %invoke.cont376 unwind label %lpad363
+
+invoke.cont376: ; preds = %invoke.cont373
+ invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i32)*)(i8* undef, i8* undef, i8* undef, i32 5)
+ to label %invoke.cont382 unwind label %lpad381
+
+invoke.cont382: ; preds = %invoke.cont376
+ %call384 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont383 unwind label %lpad381
+
+invoke.cont383: ; preds = %invoke.cont382
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2082 unwind label %lpad.i2084
+
+invoke.cont.i2082: ; preds = %invoke.cont383
+ br i1 undef, label %invoke.cont392, label %if.then.i2083
+
+if.then.i2083: ; preds = %invoke.cont.i2082
+ br label %invoke.cont392
+
+lpad.i2084: ; preds = %invoke.cont383
+ %tmp360 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont392: ; preds = %if.then.i2083, %invoke.cont.i2082
+ invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i32)*)(i8* undef, i8* undef, i8* undef, i32 -2)
+ to label %invoke.cont395 unwind label %lpad381
+
+invoke.cont395: ; preds = %invoke.cont392
+ %call397 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont396 unwind label %lpad381
+
+invoke.cont396: ; preds = %invoke.cont395
+ %call400 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %invoke.cont399 unwind label %lpad398
+
+invoke.cont399: ; preds = %invoke.cont396
+ %call403 = invoke i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %invoke.cont402 unwind label %lpad401
+
+invoke.cont402: ; preds = %invoke.cont399
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2088 unwind label %lpad.i2090
+
+invoke.cont.i2088: ; preds = %invoke.cont402
+ br i1 undef, label %invoke.cont405, label %if.then.i2089
+
+if.then.i2089: ; preds = %invoke.cont.i2088
+ br label %invoke.cont405
+
+lpad.i2090: ; preds = %invoke.cont402
+ %tmp370 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont405: ; preds = %if.then.i2089, %invoke.cont.i2088
+ invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i32)*)(i8* undef, i8* undef, i8* undef, i32 -1)
+ to label %invoke.cont408 unwind label %lpad381
+
+invoke.cont408: ; preds = %invoke.cont405
+ %call410 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont409 unwind label %lpad381
+
+invoke.cont409: ; preds = %invoke.cont408
+ %call413 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %invoke.cont412 unwind label %lpad411
+
+invoke.cont412: ; preds = %invoke.cont409
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2094 unwind label %lpad.i2096
+
+invoke.cont.i2094: ; preds = %invoke.cont412
+ br i1 undef, label %invoke.cont418, label %if.then.i2095
+
+if.then.i2095: ; preds = %invoke.cont.i2094
+ br label %invoke.cont418
+
+lpad.i2096: ; preds = %invoke.cont412
+ %tmp380 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont418: ; preds = %if.then.i2095, %invoke.cont.i2094
+ invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i32)*)(i8* undef, i8* undef, i8* undef, i32 0)
+ to label %invoke.cont422 unwind label %lpad381
+
+invoke.cont422: ; preds = %invoke.cont418
+ %call424 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont423 unwind label %lpad381
+
+invoke.cont423: ; preds = %invoke.cont422
+ %call427 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %invoke.cont426 unwind label %lpad425
+
+invoke.cont426: ; preds = %invoke.cont423
+ %call430 = invoke i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %invoke.cont429 unwind label %lpad428
+
+invoke.cont429: ; preds = %invoke.cont426
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2100 unwind label %lpad.i2102
+
+invoke.cont.i2100: ; preds = %invoke.cont429
+ br i1 undef, label %invoke.cont432, label %if.then.i2101
+
+if.then.i2101: ; preds = %invoke.cont.i2100
+ br label %invoke.cont432
+
+lpad.i2102: ; preds = %invoke.cont429
+ %tmp390 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont432: ; preds = %if.then.i2101, %invoke.cont.i2100
+ %call436 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* undef, i8* undef, i32 0)
+ to label %invoke.cont435 unwind label %lpad381
+
+invoke.cont435: ; preds = %invoke.cont432
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2106 unwind label %lpad.i2108
+
+invoke.cont.i2106: ; preds = %invoke.cont435
+ %call444 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* undef, i8* undef, i32 5)
+ to label %invoke.cont443 unwind label %lpad381
+
+lpad.i2108: ; preds = %invoke.cont435
+ %tmp396 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont443: ; preds = %invoke.cont.i2106
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2112 unwind label %lpad.i2114
+
+invoke.cont.i2112: ; preds = %invoke.cont443
+ br i1 undef, label %invoke.cont449, label %if.then.i2113
+
+if.then.i2113: ; preds = %invoke.cont.i2112
+ br label %invoke.cont449
+
+lpad.i2114: ; preds = %invoke.cont443
+ %tmp402 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont449: ; preds = %if.then.i2113, %invoke.cont.i2112
+ %call453 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* undef, i8* undef, i32 -2)
+ to label %invoke.cont452 unwind label %lpad381
+
+invoke.cont452: ; preds = %invoke.cont449
+ %call456 = invoke i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %invoke.cont455 unwind label %lpad454
+
+invoke.cont455: ; preds = %invoke.cont452
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2118 unwind label %lpad.i2120
+
+invoke.cont.i2118: ; preds = %invoke.cont455
+ br i1 undef, label %invoke.cont458, label %if.then.i2119
+
+if.then.i2119: ; preds = %invoke.cont.i2118
+ br label %invoke.cont458
+
+lpad.i2120: ; preds = %invoke.cont455
+ %tmp408 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont458: ; preds = %if.then.i2119, %invoke.cont.i2118
+ %call461 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* undef, i8* undef, i32 -1)
+ to label %invoke.cont460 unwind label %lpad381
+
+invoke.cont460: ; preds = %invoke.cont458
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2124 unwind label %lpad.i2126
+
+invoke.cont.i2124: ; preds = %invoke.cont460
+ br i1 undef, label %invoke.cont466, label %if.then.i2125
+
+if.then.i2125: ; preds = %invoke.cont.i2124
+ br label %invoke.cont466
+
+lpad.i2126: ; preds = %invoke.cont460
+ %tmp414 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup477
+
+invoke.cont466: ; preds = %if.then.i2125, %invoke.cont.i2124
+ %call470 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* undef, i8* undef, i32 0)
+ to label %invoke.cont469 unwind label %lpad381
+
+invoke.cont469: ; preds = %invoke.cont466
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2130 unwind label %lpad.i2132
+
+invoke.cont.i2130: ; preds = %invoke.cont469
+ br i1 undef, label %invoke.cont475, label %if.then.i2131
+
+if.then.i2131: ; preds = %invoke.cont.i2130
+ br label %invoke.cont475
+
+lpad.i2132: ; preds = %invoke.cont469
+ %tmp420 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup477
+
+invoke.cont475: ; preds = %if.then.i2131, %invoke.cont.i2130
+ %call491 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* undef, i8* undef, i32 1)
+ to label %invoke.cont490 unwind label %lpad489
+
+invoke.cont490: ; preds = %invoke.cont475
+ invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont499 unwind label %lpad498
+
+invoke.cont499: ; preds = %invoke.cont490
+ %call504 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont503 unwind label %lpad489
+
+invoke.cont503: ; preds = %invoke.cont499
+ %call507 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* undef, i8* undef, i32 3)
+ to label %invoke.cont506 unwind label %lpad505
+
+invoke.cont506: ; preds = %invoke.cont503
+ invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont509 unwind label %lpad508
+
+invoke.cont509: ; preds = %invoke.cont506
+ %call513 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont512 unwind label %lpad489
+
+invoke.cont512: ; preds = %invoke.cont509
+ br i1 undef, label %msgSend.null-receiver, label %msgSend.call
+
+msgSend.call: ; preds = %invoke.cont512
+ invoke void bitcast (void (i8*, i8*, ...)* @objc_msgSend_stret to void (%struct.CGPoint*, i8*, i8*)*)(%struct.CGPoint* sret undef, i8* undef, i8* undef)
+ to label %msgSend.cont unwind label %lpad514
+
+msgSend.null-receiver: ; preds = %invoke.cont512
+ br label %msgSend.cont
+
+msgSend.cont: ; preds = %msgSend.null-receiver, %msgSend.call
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2136 unwind label %lpad.i2138
+
+invoke.cont.i2136: ; preds = %msgSend.cont
+ br i1 undef, label %invoke.cont521, label %if.then.i2137
+
+if.then.i2137: ; preds = %invoke.cont.i2136
+ br label %invoke.cont521
+
+lpad.i2138: ; preds = %msgSend.cont
+ %tmp468 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont521: ; preds = %if.then.i2137, %invoke.cont.i2136
+ invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef)
+ to label %invoke.cont528 unwind label %lpad527
+
+invoke.cont528: ; preds = %invoke.cont521
+ %call532 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont531 unwind label %lpad489
+
+invoke.cont531: ; preds = %invoke.cont528
+ %call535 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %invoke.cont534 unwind label %lpad533
+
+invoke.cont534: ; preds = %invoke.cont531
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2142 unwind label %lpad.i2144
+
+invoke.cont.i2142: ; preds = %invoke.cont534
+ br i1 undef, label %invoke.cont540, label %if.then.i2143
+
+if.then.i2143: ; preds = %invoke.cont.i2142
+ br label %invoke.cont540
+
+lpad.i2144: ; preds = %invoke.cont534
+ %tmp486 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+invoke.cont540: ; preds = %if.then.i2143, %invoke.cont.i2142
+ %call544 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef, i32 3)
+ to label %invoke.cont543 unwind label %lpad489
+
+invoke.cont543: ; preds = %invoke.cont540
+ invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* undef)
+ to label %invoke.cont546 unwind label %lpad545
+
+invoke.cont546: ; preds = %invoke.cont543
+ %call549 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont548 unwind label %lpad489
+
+invoke.cont548: ; preds = %invoke.cont546
+ %call555 = invoke signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont554 unwind label %lpad553
+
+invoke.cont554: ; preds = %invoke.cont548
+ %tmp499 = call i8* @objc_retain(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*)) #3
+ invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i8* %tmp499, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont.i2148 unwind label %lpad.i2150
+
+invoke.cont.i2148: ; preds = %invoke.cont554
+ call void @objc_release(i8* %tmp499) #3, !clang.imprecise_release !0
+ invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont566 unwind label %lpad565
+
+lpad.i2150: ; preds = %invoke.cont554
+ %tmp500 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ call void @objc_release(i8* %tmp499) #3, !clang.imprecise_release !0
+ unreachable
+
+invoke.cont566: ; preds = %invoke.cont.i2148
+ invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i8*)*)(i8* undef, i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*))
+ to label %invoke.cont572 unwind label %lpad571
+
+invoke.cont572: ; preds = %invoke.cont566
+ %call582 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %invoke.cont581 unwind label %lpad580
+
+invoke.cont581: ; preds = %invoke.cont572
+ unreachable
+
+lpad156.body: ; preds = %invoke.cont117
+ %tmp1157 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad164.body: ; preds = %invoke.cont157
+ %tmp1158 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad183: ; preds = %invoke.cont184, %invoke.cont165
+ %tmp1159 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %lpad183.body
+
+lpad183.body: ; preds = %lpad183, %lpad.i2036
+ unreachable
+
+lpad196: ; preds = %invoke.cont190
+ %tmp1160 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad200: ; preds = %invoke.cont197
+ %tmp1161 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad203: ; preds = %invoke.cont207, %invoke.cont201
+ %tmp1162 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad212.body: ; preds = %invoke.cont208
+ %tmp1163 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad220: ; preds = %invoke.cont213
+ %tmp1164 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %eh.resume
+
+lpad227: ; preds = %invoke.cont231, %invoke.cont221
+ %tmp1166 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup239
+
+lpad236.body: ; preds = %invoke.cont232
+ %tmp1167 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup239
+
+ehcleanup239: ; preds = %lpad236.body, %lpad227
+ unreachable
+
+lpad244: ; preds = %invoke.cont245, %invoke.cont237
+ %tmp1168 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad249: ; preds = %invoke.cont247
+ %tmp1169 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad252: ; preds = %invoke.cont250
+ %tmp1170 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup263
+
+lpad255: ; preds = %invoke.cont253
+ %tmp1171 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup263
+
+lpad258: ; preds = %invoke.cont256
+ %tmp1172 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+ehcleanup263: ; preds = %lpad255, %lpad252
+ unreachable
+
+lpad265: ; preds = %invoke.cont259
+ %tmp1173 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad273: ; preds = %invoke.cont266
+ %tmp1175 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad277: ; preds = %invoke.cont274
+ %tmp1176 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad289: ; preds = %invoke.cont281
+ %tmp1177 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad301: ; preds = %invoke.cont290
+ %tmp1180 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad308: ; preds = %invoke.cont302
+ %tmp1182 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad311: ; preds = %invoke.cont309
+ %tmp1183 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad314: ; preds = %invoke.cont312
+ %tmp1184 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad320: ; preds = %invoke.cont315
+ %tmp1186 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad340.body.thread: ; preds = %land.rhs335
+ %tmp1188 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad340.body: ; preds = %land.end344
+ %tmp1189 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad360: ; preds = %invoke.cont345
+ %tmp1191 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %eh.resume
+
+lpad363: ; preds = %invoke.cont373, %invoke.cont361
+ %tmp1192 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad369: ; preds = %invoke.cont364
+ %tmp1194 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad381: ; preds = %invoke.cont466, %invoke.cont458, %invoke.cont449, %invoke.cont.i2106, %invoke.cont432, %invoke.cont422, %invoke.cont418, %invoke.cont408, %invoke.cont405, %invoke.cont395, %invoke.cont392, %invoke.cont382, %invoke.cont376
+ %tmp1196 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup477
+
+lpad398: ; preds = %invoke.cont396
+ %tmp1199 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad401: ; preds = %invoke.cont399
+ %tmp1200 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad411: ; preds = %invoke.cont409
+ %tmp1201 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad425: ; preds = %invoke.cont423
+ %tmp1203 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup477
+
+lpad428: ; preds = %invoke.cont426
+ %tmp1204 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad454: ; preds = %invoke.cont452
+ %tmp1207 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+ehcleanup477: ; preds = %lpad425, %lpad381, %lpad.i2132, %lpad.i2126
+ unreachable
+
+lpad489: ; preds = %invoke.cont546, %invoke.cont540, %invoke.cont528, %invoke.cont509, %invoke.cont499, %invoke.cont475
+ %tmp1211 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup560
+
+lpad498: ; preds = %invoke.cont490
+ %tmp1214 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad505: ; preds = %invoke.cont503
+ %tmp1215 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad508: ; preds = %invoke.cont506
+ %tmp1216 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad514: ; preds = %msgSend.call
+ %tmp1217 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad527: ; preds = %invoke.cont521
+ %tmp1219 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %ehcleanup560
+
+lpad533: ; preds = %invoke.cont531
+ %tmp1220 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad545: ; preds = %invoke.cont543
+ %tmp1222 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad553: ; preds = %invoke.cont548
+ %tmp1224 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+ehcleanup560: ; preds = %lpad527, %lpad489
+ br label %eh.resume
+
+lpad565: ; preds = %invoke.cont.i2148
+ %tmp1225 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad571: ; preds = %invoke.cont566
+ %tmp1227 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ unreachable
+
+lpad580: ; preds = %invoke.cont572
+ %tmp1228 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %eh.resume
+
+eh.resume: ; preds = %lpad580, %ehcleanup560, %lpad360, %lpad220
+ resume { i8*, i32 } undef
+}
+
+@"OBJC_EHTYPE_$_NSException" = external global i8
+
+define void @test4() {
+entry:
+ br i1 undef, label %if.end13, label %if.then10
+
+if.then10: ; preds = %entry
+ br label %if.end13
+
+if.end13: ; preds = %if.then10, %entry
+ %0 = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*, i64, i8*, i8)*)(i8* undef, i8* undef, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring to i8*), i64 2, i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring_2 to i8*), i8 signext 0), !clang.arc.no_objc_arc_exceptions !0
+ br i1 undef, label %if.then17, label %if.end18
+
+if.then17: ; preds = %if.end13
+ br label %if.end18
+
+if.end18: ; preds = %if.then17, %if.end13
+ br i1 undef, label %if.then64, label %if.end73
+
+if.then64: ; preds = %if.end18
+ br i1 undef, label %cond.end71, label %cond.true68
+
+cond.true68: ; preds = %if.then64
+ br label %cond.end71
+
+cond.end71: ; preds = %cond.true68, %if.then64
+ br i1 undef, label %cleanup.action, label %cleanup.done
+
+cleanup.action: ; preds = %cond.end71
+ br label %cleanup.done
+
+cleanup.done: ; preds = %cleanup.action, %cond.end71
+ br label %if.end73
+
+if.end73: ; preds = %cleanup.done, %if.end18
+ br i1 undef, label %forcoll.empty, label %forcoll.loopinit
+
+forcoll.loopinit: ; preds = %if.end73
+ br label %forcoll.loopbody.outer
+
+forcoll.loopbody.outer: ; preds = %forcoll.refetch, %forcoll.loopinit
+ br label %forcoll.loopbody
+
+forcoll.loopbody: ; preds = %forcoll.notmutated, %forcoll.loopbody.outer
+ br i1 undef, label %forcoll.notmutated, label %forcoll.mutated
+
+forcoll.mutated: ; preds = %forcoll.loopbody
+ br label %forcoll.notmutated
+
+forcoll.notmutated: ; preds = %forcoll.mutated, %forcoll.loopbody
+ br i1 undef, label %forcoll.loopbody, label %forcoll.refetch
+
+forcoll.refetch: ; preds = %forcoll.notmutated
+ br i1 undef, label %forcoll.empty, label %forcoll.loopbody.outer
+
+forcoll.empty: ; preds = %forcoll.refetch, %if.end73
+ br i1 undef, label %if.end85, label %if.then82
+
+if.then82: ; preds = %forcoll.empty
+ br label %if.end85
+
+if.end85: ; preds = %if.then82, %forcoll.empty
+ br i1 undef, label %if.then87, label %if.end102
+
+if.then87: ; preds = %if.end85
+ br i1 undef, label %if.end94, label %if.then91
+
+if.then91: ; preds = %if.then87
+ br label %if.end94
+
+if.end94: ; preds = %if.then91, %if.then87
+ br i1 undef, label %if.end101, label %if.then98
+
+if.then98: ; preds = %if.end94
+ br label %if.end101
+
+if.end101: ; preds = %if.then98, %if.end94
+ br label %if.end102
+
+if.end102: ; preds = %if.end101, %if.end85
+ br i1 undef, label %do.body113, label %if.then107
+
+if.then107: ; preds = %if.end102
+ br label %do.body113
+
+do.body113: ; preds = %if.then107, %if.end102
+ br i1 undef, label %if.then116, label %if.end117
+
+if.then116: ; preds = %do.body113
+ br label %if.end117
+
+if.end117: ; preds = %if.then116, %do.body113
+ br i1 undef, label %if.then125, label %if.end126
+
+if.then125: ; preds = %if.end117
+ br label %if.end126
+
+if.end126: ; preds = %if.then125, %if.end117
+ br i1 undef, label %do.end166, label %cond.true132
+
+cond.true132: ; preds = %if.end126
+ br i1 undef, label %do.body148, label %cond.true151
+
+do.body148: ; preds = %cond.true132
+ br i1 undef, label %do.end166, label %cond.true151
+
+cond.true151: ; preds = %do.body148, %cond.true132
+ br i1 undef, label %if.then162, label %do.end166
+
+if.then162: ; preds = %cond.true151
+ br label %do.end166
+
+do.end166: ; preds = %if.then162, %cond.true151, %do.body148, %if.end126
+ br i1 undef, label %if.then304, label %if.then170
+
+if.then170: ; preds = %do.end166
+ br i1 undef, label %do.end193, label %cond.true179
+
+cond.true179: ; preds = %if.then170
+ br i1 undef, label %if.then190, label %do.end193
+
+if.then190: ; preds = %cond.true179
+ br label %do.end193
+
+do.end193: ; preds = %if.then190, %cond.true179, %if.then170
+ br i1 undef, label %do.body200, label %do.body283
+
+do.body200: ; preds = %do.end193
+ br i1 undef, label %do.end254, label %cond.true203
+
+cond.true203: ; preds = %do.body200
+ br i1 undef, label %do.body218, label %cond.true221
+
+do.body218: ; preds = %cond.true203
+ br i1 undef, label %do.end254, label %cond.true221
+
+cond.true221: ; preds = %do.body218, %cond.true203
+ br i1 undef, label %if.then232, label %do.body236
+
+if.then232: ; preds = %cond.true221
+ br label %do.body236
+
+do.body236: ; preds = %if.then232, %cond.true221
+ br i1 undef, label %do.end254, label %cond.true239
+
+cond.true239: ; preds = %do.body236
+ br i1 undef, label %if.then250, label %do.end254
+
+if.then250: ; preds = %cond.true239
+ br label %do.end254
+
+do.end254: ; preds = %if.then250, %cond.true239, %do.body236, %do.body218, %do.body200
+ br i1 undef, label %do.end277, label %cond.true263
+
+cond.true263: ; preds = %do.end254
+ br i1 undef, label %if.then274, label %do.end277
+
+if.then274: ; preds = %cond.true263
+ unreachable
+
+do.end277: ; preds = %cond.true263, %do.end254
+ br i1 undef, label %if.then280, label %do.body283
+
+if.then280: ; preds = %do.end277
+ br label %do.body283
+
+do.body283: ; preds = %if.then280, %do.end277, %do.end193
+ br i1 undef, label %if.end301, label %cond.true286
+
+cond.true286: ; preds = %do.body283
+ br i1 undef, label %if.then297, label %if.end301
+
+if.then297: ; preds = %cond.true286
+ br label %if.end301
+
+if.end301: ; preds = %if.then297, %cond.true286, %do.body283
+ br i1 undef, label %if.then304, label %do.body351
+
+if.then304: ; preds = %if.end301, %do.end166
+ br i1 undef, label %do.body309.lr.ph, label %do.body351
+
+do.body309.lr.ph: ; preds = %if.then304
+ br label %do.body309
+
+do.body309: ; preds = %for.cond.backedge, %do.body309.lr.ph
+ br i1 undef, label %do.end328, label %cond.true312
+
+cond.true312: ; preds = %do.body309
+ br i1 undef, label %if.then323, label %do.end328
+
+if.then323: ; preds = %cond.true312
+ br label %do.end328
+
+do.end328: ; preds = %if.then323, %cond.true312, %do.body309
+ br i1 undef, label %for.cond.backedge, label %cond.true335
+
+for.cond.backedge: ; preds = %if.then346, %cond.true335, %do.end328
+ br i1 undef, label %do.body309, label %do.body351
+
+cond.true335: ; preds = %do.end328
+ br i1 undef, label %if.then346, label %for.cond.backedge
+
+if.then346: ; preds = %cond.true335
+ br label %for.cond.backedge
+
+do.body351: ; preds = %for.cond.backedge, %if.then304, %if.end301
+ br i1 undef, label %if.then354, label %if.end355
+
+if.then354: ; preds = %do.body351
+ br label %if.end355
+
+if.end355: ; preds = %if.then354, %do.body351
+ br i1 undef, label %if.else, label %if.then364
+
+if.then364: ; preds = %if.end355
+ br label %do.body366
+
+if.else: ; preds = %if.end355
+ br label %do.body366
+
+do.body366: ; preds = %if.else, %if.then364
+ br i1 undef, label %if.then369, label %if.end377.critedge
+
+if.then369: ; preds = %do.body366
+ br label %if.end377
+
+if.end377.critedge: ; preds = %do.body366
+ br label %if.end377
+
+if.end377: ; preds = %if.end377.critedge, %if.then369
+ br i1 undef, label %if.then383, label %if.end392.critedge
+
+if.then383: ; preds = %if.end377
+ br label %if.end392
+
+if.end392.critedge: ; preds = %if.end377
+ br label %if.end392
+
+if.end392: ; preds = %if.end392.critedge, %if.then383
+ br i1 undef, label %if.then398, label %if.end399
+
+if.then398: ; preds = %if.end392
+ br label %if.end399
+
+if.end399: ; preds = %if.then398, %if.end392
+ invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %eh.cont unwind label %lpad, !clang.arc.no_objc_arc_exceptions !0
+
+eh.cont: ; preds = %if.end399
+ br i1 undef, label %if.then430, label %if.end439.critedge
+
+if.then430: ; preds = %eh.cont
+ %1 = call i8* @objc_retain(i8* %0)
+ br label %if.end439
+
+lpad: ; preds = %if.end399
+ %2 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*)
+ catch i8* @"OBJC_EHTYPE_$_NSException"
+ unreachable
+
+if.end439.critedge: ; preds = %eh.cont
+ %3 = call i8* @objc_retain(i8* %0)
+ br label %if.end439
+
+if.end439: ; preds = %if.end439.critedge, %if.then430
+ call void @objc_release(i8* %0), !clang.imprecise_release !0
+ unreachable
+
+return: ; No predecessors!
+ ret void
+}
+
+
!0 = metadata !{}
diff --git a/test/Transforms/ObjCARC/pointer-types.ll b/test/Transforms/ObjCARC/pointer-types.ll
index 6abc93986434..257560d9f7b2 100644
--- a/test/Transforms/ObjCARC/pointer-types.ll
+++ b/test/Transforms/ObjCARC/pointer-types.ll
@@ -5,7 +5,7 @@
; in dubious ways.
; rdar://10551239
-; CHECK: define void @test0(
+; CHECK-LABEL: define void @test0(
; CHECK: %otherBlock = phi void ()* [ %b1, %if.then ], [ null, %entry ]
; CHECK-NEXT: call void @use_fptr(void ()* %otherBlock)
; CHECK-NEXT: %tmp11 = bitcast void ()* %otherBlock to i8*
diff --git a/test/Transforms/ObjCARC/post-inlining.ll b/test/Transforms/ObjCARC/post-inlining.ll
index ad69ccdd794d..b2d6112cf4d9 100644
--- a/test/Transforms/ObjCARC/post-inlining.ll
+++ b/test/Transforms/ObjCARC/post-inlining.ll
@@ -8,7 +8,7 @@ declare i8* @objc_retainAutoreleasedReturnValue(i8*)
; Clean up residue left behind after inlining.
-; CHECK: define void @test0(
+; CHECK-LABEL: define void @test0(
; CHECK: entry:
; CHECK-NEXT: ret void
; CHECK-NEXT: }
@@ -21,7 +21,7 @@ entry:
; Same as test0, but with slightly different use arrangements.
-; CHECK: define void @test1(
+; CHECK-LABEL: define void @test1(
; CHECK: entry:
; CHECK-NEXT: ret void
; CHECK-NEXT: }
@@ -34,7 +34,7 @@ entry:
; Delete a retainRV+autoreleaseRV even if the pointer is used.
-; CHECK: define void @test24(
+; CHECK-LABEL: define void @test24(
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @use_pointer(i8* %p)
; CHECK-NEXT: ret void
diff --git a/test/Transforms/ObjCARC/retain-block-alloca.ll b/test/Transforms/ObjCARC/retain-block-alloca.ll
deleted file mode 100644
index f40be238baf3..000000000000
--- a/test/Transforms/ObjCARC/retain-block-alloca.ll
+++ /dev/null
@@ -1,94 +0,0 @@
-; RUN: opt -S -objc-arc < %s | FileCheck %s
-; rdar://10209613
-
-%0 = type opaque
-%struct.__block_descriptor = type { i64, i64 }
-
-@_NSConcreteStackBlock = external global i8*
-@__block_descriptor_tmp = external hidden constant { i64, i64, i8*, i8*, i8*, i8* }
-@"\01L_OBJC_SELECTOR_REFERENCES_" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip"
-
-; CHECK: define void @test(
-; CHECK: %3 = call i8* @objc_retainBlock(i8* %2) [[NUW:#[0-9]+]]
-; CHECK: @objc_msgSend
-; CHECK-NEXT: @objc_release(i8* %3)
-define void @test(%0* %array) uwtable {
-entry:
- %block = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>, align 8
- %0 = bitcast %0* %array to i8*
- %1 = tail call i8* @objc_retain(i8* %0) nounwind
- %block.isa = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, i64 0, i32 0
- store i8* bitcast (i8** @_NSConcreteStackBlock to i8*), i8** %block.isa, align 8
- %block.flags = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, i64 0, i32 1
- store i32 1107296256, i32* %block.flags, align 8
- %block.reserved = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, i64 0, i32 2
- store i32 0, i32* %block.reserved, align 4
- %block.invoke = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, i64 0, i32 3
- store i8* bitcast (void (i8*)* @__test_block_invoke_0 to i8*), i8** %block.invoke, align 8
- %block.descriptor = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, i64 0, i32 4
- store %struct.__block_descriptor* bitcast ({ i64, i64, i8*, i8*, i8*, i8* }* @__block_descriptor_tmp to %struct.__block_descriptor*), %struct.__block_descriptor** %block.descriptor, align 8
- %block.captured = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, i64 0, i32 5
- store %0* %array, %0** %block.captured, align 8
- %2 = bitcast <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block to i8*
- %3 = call i8* @objc_retainBlock(i8* %2) nounwind
- %tmp2 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8
- call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*)*)(i8* %0, i8* %tmp2, i8* %3)
- call void @objc_release(i8* %3) nounwind
- %strongdestroy = load %0** %block.captured, align 8
- %4 = bitcast %0* %strongdestroy to i8*
- call void @objc_release(i8* %4) nounwind, !clang.imprecise_release !0
- ret void
-}
-
-; Same as test, but the objc_retainBlock has a clang.arc.copy_on_escape
-; tag so it's safe to delete.
-
-; CHECK: define void @test_with_COE(
-; CHECK-NOT: @objc_retainBlock
-; CHECK: @objc_msgSend
-; CHECK: @objc_release
-; CHECK-NOT: @objc_release
-; CHECK: }
-define void @test_with_COE(%0* %array) uwtable {
-entry:
- %block = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>, align 8
- %0 = bitcast %0* %array to i8*
- %1 = tail call i8* @objc_retain(i8* %0) nounwind
- %block.isa = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, i64 0, i32 0
- store i8* bitcast (i8** @_NSConcreteStackBlock to i8*), i8** %block.isa, align 8
- %block.flags = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, i64 0, i32 1
- store i32 1107296256, i32* %block.flags, align 8
- %block.reserved = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, i64 0, i32 2
- store i32 0, i32* %block.reserved, align 4
- %block.invoke = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, i64 0, i32 3
- store i8* bitcast (void (i8*)* @__test_block_invoke_0 to i8*), i8** %block.invoke, align 8
- %block.descriptor = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, i64 0, i32 4
- store %struct.__block_descriptor* bitcast ({ i64, i64, i8*, i8*, i8*, i8* }* @__block_descriptor_tmp to %struct.__block_descriptor*), %struct.__block_descriptor** %block.descriptor, align 8
- %block.captured = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, i64 0, i32 5
- store %0* %array, %0** %block.captured, align 8
- %2 = bitcast <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block to i8*
- %3 = call i8* @objc_retainBlock(i8* %2) nounwind, !clang.arc.copy_on_escape !0
- %tmp2 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8
- call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*)*)(i8* %0, i8* %tmp2, i8* %3)
- call void @objc_release(i8* %3) nounwind
- %strongdestroy = load %0** %block.captured, align 8
- %4 = bitcast %0* %strongdestroy to i8*
- call void @objc_release(i8* %4) nounwind, !clang.imprecise_release !0
- ret void
-}
-
-declare i8* @objc_retain(i8*)
-
-declare void @__test_block_invoke_0(i8* nocapture) uwtable
-
-declare i8* @objc_retainBlock(i8*)
-
-declare i8* @objc_msgSend(i8*, i8*, ...) nonlazybind
-
-declare void @objc_release(i8*)
-
-; CHECK: attributes #0 = { uwtable }
-; CHECK: attributes #1 = { nonlazybind }
-; CHECK: attributes [[NUW]] = { nounwind }
-
-!0 = metadata !{}
diff --git a/test/Transforms/ObjCARC/retain-block-escape-analysis.ll b/test/Transforms/ObjCARC/retain-block-escape-analysis.ll
deleted file mode 100644
index 8df05ad22666..000000000000
--- a/test/Transforms/ObjCARC/retain-block-escape-analysis.ll
+++ /dev/null
@@ -1,215 +0,0 @@
-; RUN: opt -S -objc-arc < %s | FileCheck %s
-
-declare i8* @objc_retain(i8*) nonlazybind
-declare void @objc_release(i8*) nonlazybind
-declare i8* @objc_retainBlock(i8*)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; Use by an instruction which copies the value is an escape if the ;
-; result is an escape. The current instructions with this property are: ;
-; ;
-; 1. BitCast. ;
-; 2. GEP. ;
-; 3. PhiNode. ;
-; 4. SelectInst. ;
-; ;
-; Make sure that such instructions do not confuse the optimizer into removing ;
-; an objc_retainBlock that is needed. ;
-; ;
-; rdar://13273675. (With extra test cases to handle bitcast, phi, and select. ;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-define void @bitcasttest(i8* %storage, void (...)* %block) {
-; CHECK: define void @bitcasttest
-entry:
- %t1 = bitcast void (...)* %block to i8*
-; CHECK: tail call i8* @objc_retain
- %t2 = tail call i8* @objc_retain(i8* %t1)
-; CHECK: tail call i8* @objc_retainBlock
- %t3 = tail call i8* @objc_retainBlock(i8* %t1), !clang.arc.copy_on_escape !0
- %t4 = bitcast i8* %storage to void (...)**
- %t5 = bitcast i8* %t3 to void (...)*
- store void (...)* %t5, void (...)** %t4, align 8
-; CHECK: call void @objc_release
- call void @objc_release(i8* %t1)
- ret void
-; CHECK: }
-}
-
-define void @bitcasttest_a(i8* %storage, void (...)* %block) {
-; CHECK: define void @bitcasttest_a
-entry:
- %t1 = bitcast void (...)* %block to i8*
-; CHECK-NOT: tail call i8* @objc_retain
- %t2 = tail call i8* @objc_retain(i8* %t1)
-; CHECK: tail call i8* @objc_retainBlock
- %t3 = tail call i8* @objc_retainBlock(i8* %t1), !clang.arc.copy_on_escape !0
- %t4 = bitcast i8* %storage to void (...)**
- %t5 = bitcast i8* %t3 to void (...)*
- store void (...)* %t5, void (...)** %t4, align 8
-; CHECK-NOT: call void @objc_release
- call void @objc_release(i8* %t1), !clang.imprecise_release !0
- ret void
-; CHECK: }
-}
-
-define void @geptest(void (...)** %storage_array, void (...)* %block) {
-; CHECK: define void @geptest
-entry:
- %t1 = bitcast void (...)* %block to i8*
-; CHECK: tail call i8* @objc_retain
- %t2 = tail call i8* @objc_retain(i8* %t1)
-; CHECK: tail call i8* @objc_retainBlock
- %t3 = tail call i8* @objc_retainBlock(i8* %t1), !clang.arc.copy_on_escape !0
- %t4 = bitcast i8* %t3 to void (...)*
-
- %storage = getelementptr inbounds void (...)** %storage_array, i64 0
-
- store void (...)* %t4, void (...)** %storage, align 8
-; CHECK: call void @objc_release
- call void @objc_release(i8* %t1)
- ret void
-; CHECK: }
-}
-
-define void @geptest_a(void (...)** %storage_array, void (...)* %block) {
-; CHECK: define void @geptest_a
-entry:
- %t1 = bitcast void (...)* %block to i8*
-; CHECK-NOT: tail call i8* @objc_retain
- %t2 = tail call i8* @objc_retain(i8* %t1)
-; CHECK: tail call i8* @objc_retainBlock
- %t3 = tail call i8* @objc_retainBlock(i8* %t1), !clang.arc.copy_on_escape !0
- %t4 = bitcast i8* %t3 to void (...)*
-
- %storage = getelementptr inbounds void (...)** %storage_array, i64 0
-
- store void (...)* %t4, void (...)** %storage, align 8
-; CHECK-NOT: call void @objc_release
- call void @objc_release(i8* %t1), !clang.imprecise_release !0
- ret void
-; CHECK: }
-}
-
-define void @selecttest(void (...)** %store1, void (...)** %store2,
- void (...)* %block) {
-; CHECK: define void @selecttest
-entry:
- %t1 = bitcast void (...)* %block to i8*
-; CHECK: tail call i8* @objc_retain
- %t2 = tail call i8* @objc_retain(i8* %t1)
-; CHECK: tail call i8* @objc_retainBlock
- %t3 = tail call i8* @objc_retainBlock(i8* %t1), !clang.arc.copy_on_escape !0
- %t4 = bitcast i8* %t3 to void (...)*
- %store = select i1 undef, void (...)** %store1, void (...)** %store2
- store void (...)* %t4, void (...)** %store, align 8
-; CHECK: call void @objc_release
- call void @objc_release(i8* %t1)
- ret void
-; CHECK: }
-}
-
-define void @selecttest_a(void (...)** %store1, void (...)** %store2,
- void (...)* %block) {
-; CHECK: define void @selecttest_a
-entry:
- %t1 = bitcast void (...)* %block to i8*
-; CHECK-NOT: tail call i8* @objc_retain
- %t2 = tail call i8* @objc_retain(i8* %t1)
-; CHECK: tail call i8* @objc_retainBlock
- %t3 = tail call i8* @objc_retainBlock(i8* %t1), !clang.arc.copy_on_escape !0
- %t4 = bitcast i8* %t3 to void (...)*
- %store = select i1 undef, void (...)** %store1, void (...)** %store2
- store void (...)* %t4, void (...)** %store, align 8
-; CHECK-NOT: call void @objc_release
- call void @objc_release(i8* %t1), !clang.imprecise_release !0
- ret void
-; CHECK: }
-}
-
-define void @phinodetest(void (...)** %storage1,
- void (...)** %storage2,
- void (...)* %block) {
-; CHECK: define void @phinodetest
-entry:
- %t1 = bitcast void (...)* %block to i8*
-; CHECK: tail call i8* @objc_retain
- %t2 = tail call i8* @objc_retain(i8* %t1)
-; CHECK: tail call i8* @objc_retainBlock
- %t3 = tail call i8* @objc_retainBlock(i8* %t1), !clang.arc.copy_on_escape !0
- %t4 = bitcast i8* %t3 to void (...)*
- br i1 undef, label %store1_set, label %store2_set
-; CHECK: store1_set:
-
-store1_set:
- br label %end
-
-store2_set:
- br label %end
-
-end:
-; CHECK: end:
- %storage = phi void (...)** [ %storage1, %store1_set ], [ %storage2, %store2_set]
- store void (...)* %t4, void (...)** %storage, align 8
-; CHECK: call void @objc_release
- call void @objc_release(i8* %t1)
- ret void
-; CHECK: }
-}
-
-define void @phinodetest_a(void (...)** %storage1,
- void (...)** %storage2,
- void (...)* %block) {
-; CHECK: define void @phinodetest_a
-entry:
- %t1 = bitcast void (...)* %block to i8*
-; CHECK-NOT: tail call i8* @objc_retain
- %t2 = tail call i8* @objc_retain(i8* %t1)
-; CHECK: tail call i8* @objc_retainBlock
- %t3 = tail call i8* @objc_retainBlock(i8* %t1), !clang.arc.copy_on_escape !0
- %t4 = bitcast i8* %t3 to void (...)*
- br i1 undef, label %store1_set, label %store2_set
-
-store1_set:
- br label %end
-
-store2_set:
- br label %end
-
-end:
- %storage = phi void (...)** [ %storage1, %store1_set ], [ %storage2, %store2_set]
- store void (...)* %t4, void (...)** %storage, align 8
-; CHECK-NOT: call void @objc_release
- call void @objc_release(i8* %t1), !clang.imprecise_release !0
- ret void
-}
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; This test makes sure that we do not hang clang when visiting a use ;
-; cycle caused by phi nodes during objc-arc analysis. *NOTE* This ;
-; test case looks a little convoluted since it was produced by ;
-; bugpoint. ;
-; ;
-; bugzilla://14551 ;
-; rdar://12851911 ;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-define void @phinode_use_cycle(i8* %block) uwtable optsize ssp {
-; CHECK: define void @phinode_use_cycle(i8* %block)
-entry:
- br label %for.body
-
-for.body: ; preds = %if.then, %for.body, %entry
- %block.05 = phi void (...)* [ null, %entry ], [ %1, %if.then ], [ %block.05, %for.body ]
- br i1 undef, label %for.body, label %if.then
-
-if.then: ; preds = %for.body
- %0 = call i8* @objc_retainBlock(i8* %block), !clang.arc.copy_on_escape !0
- %1 = bitcast i8* %0 to void (...)*
- %2 = bitcast void (...)* %block.05 to i8*
- call void @objc_release(i8* %2) nounwind, !clang.imprecise_release !0
- br label %for.body
-}
-
-!0 = metadata !{}
diff --git a/test/Transforms/ObjCARC/retain-block-load.ll b/test/Transforms/ObjCARC/retain-block-load.ll
deleted file mode 100644
index a5170e323653..000000000000
--- a/test/Transforms/ObjCARC/retain-block-load.ll
+++ /dev/null
@@ -1,51 +0,0 @@
-; RUN: opt -objc-arc -S < %s | FileCheck %s
-
-; rdar://10803830
-; The optimizer should be able to prove that the block does not
-; "escape", so the retainBlock+release pair can be eliminated.
-
-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"
-
-%struct.__block_descriptor = type { i64, i64 }
-
-@_NSConcreteStackBlock = external global i8*
-@__block_descriptor_tmp = external global { i64, i64, i8*, i8* }
-
-; CHECK: define void @test() {
-; CHECK-NOT: @objc
-; CHECK: declare i8* @objc_retainBlock(i8*)
-; CHECK: declare void @objc_release(i8*)
-
-define void @test() {
-entry:
- %block = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32 }>, align 8
- %block.isa = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32 }>* %block, i64 0, i32 0
- store i8* bitcast (i8** @_NSConcreteStackBlock to i8*), i8** %block.isa, align 8
- %block.flags = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32 }>* %block, i64 0, i32 1
- store i32 1073741824, i32* %block.flags, align 8
- %block.reserved = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32 }>* %block, i64 0, i32 2
- store i32 0, i32* %block.reserved, align 4
- %block.invoke = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32 }>* %block, i64 0, i32 3
- store i8* bitcast (i32 (i8*)* @__test_block_invoke_0 to i8*), i8** %block.invoke, align 8
- %block.descriptor = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32 }>* %block, i64 0, i32 4
- store %struct.__block_descriptor* bitcast ({ i64, i64, i8*, i8* }* @__block_descriptor_tmp to %struct.__block_descriptor*), %struct.__block_descriptor** %block.descriptor, align 8
- %block.captured = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32 }>* %block, i64 0, i32 5
- store i32 4, i32* %block.captured, align 8
- %tmp = bitcast <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32 }>* %block to i8*
- %tmp1 = call i8* @objc_retainBlock(i8* %tmp) nounwind, !clang.arc.copy_on_escape !0
- %tmp2 = getelementptr inbounds i8* %tmp1, i64 16
- %tmp3 = bitcast i8* %tmp2 to i8**
- %tmp4 = load i8** %tmp3, align 8
- %tmp5 = bitcast i8* %tmp4 to i32 (i8*)*
- %call = call i32 %tmp5(i8* %tmp1)
- call void @objc_release(i8* %tmp1) nounwind, !clang.imprecise_release !0
- ret void
-}
-
-declare i32 @__test_block_invoke_0(i8* nocapture %.block_descriptor) nounwind readonly
-
-declare i8* @objc_retainBlock(i8*)
-
-declare void @objc_release(i8*)
-
-!0 = metadata !{}
diff --git a/test/Transforms/ObjCARC/retain-block.ll b/test/Transforms/ObjCARC/retain-block.ll
deleted file mode 100644
index 1bb3f0276adf..000000000000
--- a/test/Transforms/ObjCARC/retain-block.ll
+++ /dev/null
@@ -1,140 +0,0 @@
-; RUN: opt -objc-arc -S < %s | FileCheck %s
-
-target datalayout = "e-p:64:64:64"
-
-!0 = metadata !{}
-
-declare i8* @objc_retain(i8*)
-declare void @callee(i8)
-declare void @use_pointer(i8*)
-declare void @objc_release(i8*)
-declare i8* @objc_retainBlock(i8*)
-declare i8* @objc_autorelease(i8*)
-
-; Basic retainBlock+release elimination.
-
-; CHECK: define void @test0(i8* %tmp) {
-; CHECK-NOT: @objc
-; CHECK: }
-define void @test0(i8* %tmp) {
-entry:
- %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) nounwind, !clang.arc.copy_on_escape !0
- tail call void @use_pointer(i8* %tmp2)
- tail call void @objc_release(i8* %tmp2) nounwind, !clang.imprecise_release !0
- ret void
-}
-
-; Same as test0, but there's no copy_on_escape metadata, so there's no
-; optimization possible.
-
-; CHECK: define void @test0_no_metadata(i8* %tmp) {
-; CHECK: %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) [[NUW:#[0-9]+]]
-; CHECK: tail call void @objc_release(i8* %tmp2) [[NUW]], !clang.imprecise_release !0
-; CHECK: }
-define void @test0_no_metadata(i8* %tmp) {
-entry:
- %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) nounwind
- tail call void @use_pointer(i8* %tmp2)
- tail call void @objc_release(i8* %tmp2) nounwind, !clang.imprecise_release !0
- ret void
-}
-
-; Same as test0, but the pointer escapes, so there's no
-; optimization possible.
-
-; CHECK: define void @test0_escape(i8* %tmp, i8** %z) {
-; CHECK: %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) [[NUW]], !clang.arc.copy_on_escape !0
-; CHECK: tail call void @objc_release(i8* %tmp2) [[NUW]], !clang.imprecise_release !0
-; CHECK: }
-define void @test0_escape(i8* %tmp, i8** %z) {
-entry:
- %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) nounwind, !clang.arc.copy_on_escape !0
- store i8* %tmp2, i8** %z
- tail call void @use_pointer(i8* %tmp2)
- tail call void @objc_release(i8* %tmp2) nounwind, !clang.imprecise_release !0
- ret void
-}
-
-; Same as test0_escape, but there's no intervening call.
-
-; CHECK: define void @test0_just_escape(i8* %tmp, i8** %z) {
-; CHECK: %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) [[NUW]], !clang.arc.copy_on_escape !0
-; CHECK: tail call void @objc_release(i8* %tmp2) [[NUW]], !clang.imprecise_release !0
-; CHECK: }
-define void @test0_just_escape(i8* %tmp, i8** %z) {
-entry:
- %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) nounwind, !clang.arc.copy_on_escape !0
- store i8* %tmp2, i8** %z
- tail call void @objc_release(i8* %tmp2) nounwind, !clang.imprecise_release !0
- ret void
-}
-
-; Basic nested retainBlock+release elimination.
-
-; CHECK: define void @test1(i8* %tmp) {
-; CHECK-NOT: @objc
-; CHECK: tail call i8* @objc_retain(i8* %tmp) [[NUW]]
-; CHECK-NOT: @objc
-; CHECK: tail call void @objc_release(i8* %tmp) [[NUW]], !clang.imprecise_release !0
-; CHECK-NOT: @objc
-; CHECK: }
-define void @test1(i8* %tmp) {
-entry:
- %tmp1 = tail call i8* @objc_retain(i8* %tmp) nounwind
- %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) nounwind, !clang.arc.copy_on_escape !0
- tail call void @use_pointer(i8* %tmp2)
- tail call void @use_pointer(i8* %tmp2)
- tail call void @objc_release(i8* %tmp2) nounwind, !clang.imprecise_release !0
- tail call void @objc_release(i8* %tmp) nounwind, !clang.imprecise_release !0
- ret void
-}
-
-; Same as test1, but there's no copy_on_escape metadata, so there's no
-; retainBlock+release optimization possible. But we can still eliminate
-; the outer retain+release.
-
-; CHECK: define void @test1_no_metadata(i8* %tmp) {
-; CHECK-NEXT: entry:
-; CHECK-NEXT: tail call i8* @objc_retainBlock(i8* %tmp) [[NUW]]
-; CHECK-NEXT: @use_pointer(i8* %tmp2)
-; CHECK-NEXT: @use_pointer(i8* %tmp2)
-; CHECK-NEXT: tail call void @objc_release(i8* %tmp2) [[NUW]], !clang.imprecise_release !0
-; CHECK-NOT: @objc
-; CHECK: }
-define void @test1_no_metadata(i8* %tmp) {
-entry:
- %tmp1 = tail call i8* @objc_retain(i8* %tmp) nounwind
- %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) nounwind
- tail call void @use_pointer(i8* %tmp2)
- tail call void @use_pointer(i8* %tmp2)
- tail call void @objc_release(i8* %tmp2) nounwind, !clang.imprecise_release !0
- tail call void @objc_release(i8* %tmp) nounwind, !clang.imprecise_release !0
- ret void
-}
-
-; Same as test1, but the pointer escapes, so there's no
-; retainBlock+release optimization possible. But we can still eliminate
-; the outer retain+release
-
-; CHECK: define void @test1_escape(i8* %tmp, i8** %z) {
-; CHECK-NEXT: entry:
-; CHECK-NEXT: %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) [[NUW]], !clang.arc.copy_on_escape !0
-; CHECK-NEXT: store i8* %tmp2, i8** %z
-; CHECK-NEXT: @use_pointer(i8* %tmp2)
-; CHECK-NEXT: @use_pointer(i8* %tmp2)
-; CHECK-NEXT: tail call void @objc_release(i8* %tmp2) [[NUW]], !clang.imprecise_release !0
-; CHECK-NOT: @objc
-; CHECK: }
-define void @test1_escape(i8* %tmp, i8** %z) {
-entry:
- %tmp1 = tail call i8* @objc_retain(i8* %tmp) nounwind
- %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) nounwind, !clang.arc.copy_on_escape !0
- store i8* %tmp2, i8** %z
- tail call void @use_pointer(i8* %tmp2)
- tail call void @use_pointer(i8* %tmp2)
- tail call void @objc_release(i8* %tmp2) nounwind, !clang.imprecise_release !0
- tail call void @objc_release(i8* %tmp) nounwind, !clang.imprecise_release !0
- ret void
-}
-
-; CHECK: attributes [[NUW]] = { nounwind }
diff --git a/test/Transforms/ObjCARC/retain-not-declared.ll b/test/Transforms/ObjCARC/retain-not-declared.ll
index 165829f7c01f..3a2bd03692e1 100644
--- a/test/Transforms/ObjCARC/retain-not-declared.ll
+++ b/test/Transforms/ObjCARC/retain-not-declared.ll
@@ -28,7 +28,7 @@ entry:
; Properly create the @objc_retain declaration when it doesn't already exist.
; rdar://9825114
-; CHECK: @test1(
+; CHECK-LABEL: @test1(
; CHECK: @objc_retain(
; CHECK: @objc_retainAutoreleasedReturnValue(
; CHECK: @objc_release(
diff --git a/test/Transforms/ObjCARC/rv.ll b/test/Transforms/ObjCARC/rv.ll
index e857c9f41bb4..85a16127c6d9 100644
--- a/test/Transforms/ObjCARC/rv.ll
+++ b/test/Transforms/ObjCARC/rv.ll
@@ -26,7 +26,7 @@ declare i8* @returner()
; retain is an objc_retainAutoreleasedReturnValue, since it's
; better to do the RV optimization.
-; CHECK: define void @test0(
+; CHECK-LABEL: define void @test0(
; CHECK-NEXT: entry:
; CHECK-NEXT: %x = call i8* @returner
; CHECK-NEXT: %0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %x) [[NUW:#[0-9]+]]
@@ -54,7 +54,7 @@ return:
; Delete no-ops.
-; CHECK: define void @test2
+; CHECK-LABEL: define void @test2(
; CHECK-NOT: @objc_
; CHECK: }
define void @test2() {
@@ -67,7 +67,7 @@ define void @test2() {
; Delete a redundant retainRV,autoreleaseRV when forwaring a call result
; directly to a return value.
-; CHECK: define i8* @test3
+; CHECK-LABEL: define i8* @test3(
; CHECK: call i8* @returner()
; CHECK-NEXT: ret i8* %call
define i8* @test3() {
@@ -81,7 +81,7 @@ entry:
; Delete a redundant retain,autoreleaseRV when forwaring a call result
; directly to a return value.
-; CHECK: define i8* @test4
+; CHECK-LABEL: define i8* @test4(
; CHECK: call i8* @returner()
; CHECK-NEXT: ret i8* %call
define i8* @test4() {
@@ -114,7 +114,7 @@ entry:
; into objc_retainAutoreleasedReturnValueAutoreleaseReturnValue?
; Those entrypoints don't exist yet though.
-; CHECK: define i8* @test7(
+; CHECK-LABEL: define i8* @test7(
; CHECK: call i8* @objc_retainAutoreleasedReturnValue(i8* %p)
; CHECK: %t = tail call i8* @objc_autoreleaseReturnValue(i8* %p)
define i8* @test7() {
@@ -125,7 +125,7 @@ define i8* @test7() {
ret i8* %t
}
-; CHECK: define i8* @test7b(
+; CHECK-LABEL: define i8* @test7b(
; CHECK: call i8* @objc_retain(i8* %p)
; CHECK: %t = tail call i8* @objc_autoreleaseReturnValue(i8* %p)
define i8* @test7b() {
@@ -188,7 +188,7 @@ define i8* @test12(i8* %p) {
; Don't zap the objc_retainAutoreleasedReturnValue.
-; CHECK: define i8* @test13(
+; CHECK-LABEL: define i8* @test13(
; CHECK: tail call i8* @objc_retainAutoreleasedReturnValue(i8* %p)
; CHECK: call i8* @objc_autorelease(i8* %p)
; CHECK: ret i8* %p
@@ -203,7 +203,7 @@ define i8* @test13() {
; Convert objc_retainAutoreleasedReturnValue to objc_retain if its
; argument is not a return value.
-; CHECK: define void @test14(
+; CHECK-LABEL: define void @test14(
; CHECK-NEXT: tail call i8* @objc_retain(i8* %p) [[NUW]]
; CHECK-NEXT: ret void
define void @test14(i8* %p) {
@@ -214,7 +214,7 @@ define void @test14(i8* %p) {
; Don't convert objc_retainAutoreleasedReturnValue to objc_retain if its
; argument is a return value.
-; CHECK: define void @test15(
+; CHECK-LABEL: define void @test15(
; CHECK-NEXT: %y = call i8* @returner()
; CHECK-NEXT: tail call i8* @objc_retainAutoreleasedReturnValue(i8* %y) [[NUW]]
; CHECK-NEXT: ret void
@@ -272,7 +272,7 @@ define i8* @test22(i8* %p) {
; Convert autoreleaseRV to autorelease.
-; CHECK: define void @test23(
+; CHECK-LABEL: define void @test23(
; CHECK: call i8* @objc_autorelease(i8* %p) [[NUW]]
define void @test23(i8* %p) {
store i8 0, i8* %p
@@ -283,7 +283,7 @@ define void @test23(i8* %p) {
; Don't convert autoreleaseRV to autorelease if the result is returned,
; even through a bitcast.
-; CHECK: define {}* @test24(
+; CHECK-LABEL: define {}* @test24(
; CHECK: tail call i8* @objc_autoreleaseReturnValue(i8* %p)
define {}* @test24(i8* %p) {
%t = call i8* @objc_autoreleaseReturnValue(i8* %p)
diff --git a/test/Transforms/ObjCARC/split-backedge.ll b/test/Transforms/ObjCARC/split-backedge.ll
index 5ac278a45d50..1b7cf441a685 100644
--- a/test/Transforms/ObjCARC/split-backedge.ll
+++ b/test/Transforms/ObjCARC/split-backedge.ll
@@ -3,7 +3,7 @@
; Handle a retain+release pair entirely contained within a split loop backedge.
; rdar://11256239
-; CHECK: define void @test0
+; CHECK-LABEL: define void @test0(
; CHECK: call i8* @objc_retain(i8* %call) [[NUW:#[0-9]+]]
; CHECK: call i8* @objc_retain(i8* %call) [[NUW]]
; CHECK: call i8* @objc_retain(i8* %cond) [[NUW]]
diff --git a/test/Transforms/ObjCARC/weak.ll b/test/Transforms/ObjCARC/weak.ll
index 85a290c0981c..119aa8257866 100644
--- a/test/Transforms/ObjCARC/weak.ll
+++ b/test/Transforms/ObjCARC/weak.ll
@@ -10,7 +10,7 @@ declare void @objc_copyWeak(i8**, i8**)
; If the pointer-to-weak-pointer is null, it's undefined behavior.
-; CHECK: define void @test0(
+; CHECK-LABEL: define void @test0(
; CHECK: store i8* undef, i8** null
; CHECK: store i8* undef, i8** null
; CHECK: store i8* undef, i8** null
diff --git a/test/Transforms/PhaseOrdering/PR6627.ll b/test/Transforms/PhaseOrdering/PR6627.ll
index 58b762a7af49..cf95363e655a 100644
--- a/test/Transforms/PhaseOrdering/PR6627.ll
+++ b/test/Transforms/PhaseOrdering/PR6627.ll
@@ -42,7 +42,7 @@ if.then: ; preds = %land.lhs.true17
if.end:
ret void
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: %x1 = load i32* %xx, align 4
; CHECK-NEXT: icmp eq i32 %x1, 1179403647
; CHECK-NEXT: br i1 {{.*}}, label %if.then, label %if.end
@@ -86,7 +86,7 @@ if.then: ; preds = %land.lhs.true17
if.end:
ret void
-; CHECK: @test2a
+; CHECK-LABEL: @test2a(
; CHECK: %x1 = load i32* {{.*}}, align 4
; CHECK-NEXT: icmp eq i32 %x1, 1179403647
; CHECK-NEXT: br i1 {{.*}}, label %if.then, label %if.end
diff --git a/test/Transforms/PhaseOrdering/basic.ll b/test/Transforms/PhaseOrdering/basic.ll
index 8fbe8c58f451..2deefa618109 100644
--- a/test/Transforms/PhaseOrdering/basic.ll
+++ b/test/Transforms/PhaseOrdering/basic.ll
@@ -19,7 +19,7 @@ define void @test1() nounwind ssp {
call void @free(i8* %tmp1)
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: ret void
}
@@ -44,7 +44,7 @@ entry:
%sub = sub i32 %0, %mul
ret i32 %sub
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: %div = lshr i32 %a, 2
; CHECK: %add = shl nuw nsw i32 %div, 1
; CHECK: ret i32 0
diff --git a/test/Transforms/PhaseOrdering/lit.local.cfg b/test/Transforms/PhaseOrdering/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/PhaseOrdering/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/PruneEH/lit.local.cfg b/test/Transforms/PruneEH/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/PruneEH/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/Reassociate/2012-05-08-UndefLeak.ll b/test/Transforms/Reassociate/2012-05-08-UndefLeak.ll
index 2f5a53e0ce46..c563fe26c134 100644
--- a/test/Transforms/Reassociate/2012-05-08-UndefLeak.ll
+++ b/test/Transforms/Reassociate/2012-05-08-UndefLeak.ll
@@ -5,7 +5,7 @@
; Transform disabled until PR13021 is fixed.
define i64 @f(i64 %x0) {
-; CHECK: @f
+; CHECK-LABEL: @f(
; CHECK-NEXT: mul i64 %x0, 208
; CHECK-NEXT: add i64 %{{.*}}, 1617
; CHECK-NEXT: ret i64
diff --git a/test/Transforms/Reassociate/absorption.ll b/test/Transforms/Reassociate/absorption.ll
index 2ccc2b579496..40b3d80eee9d 100644
--- a/test/Transforms/Reassociate/absorption.ll
+++ b/test/Transforms/Reassociate/absorption.ll
@@ -6,6 +6,6 @@ define i8 @foo(i8 %x) {
%tmp1 = or i8 %x, 127
%tmp2 = or i8 %tmp1, 128
ret i8 %tmp2
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK: ret i8 -1
}
diff --git a/test/Transforms/Reassociate/basictest.ll b/test/Transforms/Reassociate/basictest.ll
index 086474066c56..fda0ca6be1aa 100644
--- a/test/Transforms/Reassociate/basictest.ll
+++ b/test/Transforms/Reassociate/basictest.ll
@@ -6,7 +6,7 @@ define i32 @test1(i32 %arg) {
%tmp1 = sub i32 -12, %arg
%tmp2 = add i32 %tmp1, 12
ret i32 %tmp2
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: sub i32 0, %arg
; CHECK-NEXT: ret i32
}
@@ -16,7 +16,7 @@ define i32 @test2(i32 %reg109, i32 %reg1111) {
%reg116 = add i32 %reg115, %reg1111 ; <i32> [#uses=1]
%reg117 = add i32 %reg116, 30 ; <i32> [#uses=1]
ret i32 %reg117
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: add i32 %reg1111, %reg109
; CHECK-NEXT: ret i32
}
@@ -40,7 +40,7 @@ define void @test3() {
; f = (a+c)+b
store i32 %t4, i32* @f
ret void
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: add i32
; CHECK: add i32
; CHECK-NOT: add i32
@@ -60,7 +60,7 @@ define void @test4() {
; f = (c+a)+b
store i32 %t4, i32* @f
ret void
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: add i32
; CHECK: add i32
; CHECK-NOT: add i32
@@ -80,7 +80,7 @@ define void @test5() {
; f = (c+a)+b
store i32 %t4, i32* @f
ret void
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: add i32
; CHECK: add i32
; CHECK-NOT: add i32
@@ -102,7 +102,7 @@ define i32 @test6() {
; X ^ X = 0
%RV = xor i32 %tmp.5, %tmp.11
ret i32 %RV
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: ret i32 0
}
@@ -115,7 +115,7 @@ define i32 @test7(i32 %A, i32 %B, i32 %C) {
%aac = mul i32 %ac, %A
%r = add i32 %aab, %aac
ret i32 %r
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NEXT: add i32 %C, %B
; CHECK-NEXT: mul i32
; CHECK-NEXT: mul i32
@@ -129,7 +129,7 @@ define i32 @test8(i32 %X, i32 %Y, i32 %Z) {
; (-X)*Y + Z -> Z-X*Y
%C = add i32 %B, %Z
ret i32 %C
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK-NEXT: %A = mul i32 %Y, %X
; CHECK-NEXT: %C = sub i32 %Z, %A
; CHECK-NEXT: ret i32 %C
@@ -141,7 +141,7 @@ define i32 @test9(i32 %X) {
%Y = mul i32 %X, 47
%Z = add i32 %Y, %Y
ret i32 %Z
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK-NEXT: mul i32 %X, 94
; CHECK-NEXT: ret i32
}
@@ -150,7 +150,7 @@ define i32 @test10(i32 %X) {
%Y = add i32 %X ,%X
%Z = add i32 %Y, %X
ret i32 %Z
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK-NEXT: mul i32 %X, 3
; CHECK-NEXT: ret i32
}
@@ -160,7 +160,7 @@ define i32 @test11(i32 %W) {
%Y = add i32 %X ,%X
%Z = add i32 %Y, %X
ret i32 %Z
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK-NEXT: mul i32 %W, 381
; CHECK-NEXT: ret i32
}
@@ -173,7 +173,7 @@ define i32 @test12(i32 %X) {
%Y = add i32 %A ,%B
%Z = add i32 %Y, %C
ret i32 %Z
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK-NEXT: mul i32 %X, -3
; CHECK-NEXT: add i32{{.*}}, 6
; CHECK-NEXT: ret i32
@@ -185,7 +185,7 @@ define i32 @test13(i32 %X1, i32 %X2, i32 %X3) {
%C = mul i32 %X1, %X3 ; X1*X3
%D = add i32 %B, %C ; -X1*X2 + X1*X3 -> X1*(X3-X2)
ret i32 %D
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; CHECK-NEXT: sub i32 %X3, %X2
; CHECK-NEXT: mul i32 {{.*}}, %X1
; CHECK-NEXT: ret i32
@@ -197,7 +197,7 @@ define i32 @test14(i32 %X1, i32 %X2) {
%C = mul i32 %X2, -47 ; X2*-47
%D = add i32 %B, %C ; X1*47 + X2*-47 -> 47*(X1-X2)
ret i32 %D
-; CHECK: @test14
+; CHECK-LABEL: @test14(
; CHECK-NEXT: sub i32 %X1, %X2
; CHECK-NEXT: mul i32 {{.*}}, 47
; CHECK-NEXT: ret i32
@@ -210,7 +210,7 @@ define i32 @test15(i32 %X1, i32 %X2, i32 %X3) {
%C = and i1 %A, %B
%D = select i1 %C, i32 %X1, i32 0
ret i32 %D
-; CHECK: @test15
+; CHECK-LABEL: @test15(
; CHECK: and i1 %A, %B
}
diff --git a/test/Transforms/Reassociate/inverses.ll b/test/Transforms/Reassociate/inverses.ll
index 34abdc7aae0d..afe076caea92 100644
--- a/test/Transforms/Reassociate/inverses.ll
+++ b/test/Transforms/Reassociate/inverses.ll
@@ -6,7 +6,7 @@ define i32 @test1(i32 %a, i32 %b) {
; (A&B)&~A == 0
%tmp.5 = and i32 %tmp.2, %tmp.4
ret i32 %tmp.5
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret i32 0
}
@@ -17,7 +17,7 @@ define i32 @test2(i32 %a, i32 %b) {
; A&~A == 0
%tmp.5 = and i32 %tmp.2, %tmp.4
ret i32 %tmp.5
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: ret i32 0
}
@@ -28,7 +28,7 @@ define i32 @test3(i32 %b, i32 %a) {
; (b+(a+1234))+-a -> b+1234
%tmp.5 = add i32 %tmp.2, %tmp.4
ret i32 %tmp.5
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: %tmp.5 = add i32 %b, 1234
; CHECK: ret i32 %tmp.5
}
diff --git a/test/Transforms/Reassociate/lit.local.cfg b/test/Transforms/Reassociate/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/Reassociate/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/Reassociate/mulfactor.ll b/test/Transforms/Reassociate/mulfactor.ll
index 6c099b43b363..951228ec3cc2 100644
--- a/test/Transforms/Reassociate/mulfactor.ll
+++ b/test/Transforms/Reassociate/mulfactor.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -reassociate -S | FileCheck %s
define i32 @test1(i32 %a, i32 %b) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: mul i32 %a, %a
; CHECK-NEXT: mul i32 %a, 2
; CHECK-NEXT: add
@@ -20,7 +20,7 @@ entry:
}
define i32 @test2(i32 %t) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: mul
; CHECK-NEXT: add
; CHECK-NEXT: ret
@@ -35,7 +35,7 @@ entry:
define i32 @test3(i32 %x) {
; (x^8)
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: mul
; CHECK-NEXT: mul
; CHECK-NEXT: mul
@@ -54,7 +54,7 @@ entry:
define i32 @test4(i32 %x) {
; (x^7)
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: mul
; CHECK-NEXT: mul
; CHECK-NEXT: mul
@@ -73,7 +73,7 @@ entry:
define i32 @test5(i32 %x, i32 %y) {
; (x^4) * (y^2)
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: mul
; CHECK-NEXT: mul
; CHECK-NEXT: mul
@@ -90,7 +90,7 @@ entry:
define i32 @test6(i32 %x, i32 %y, i32 %z) {
; (x^5) * (y^3) * z
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: mul
; CHECK-NEXT: mul
; CHECK-NEXT: mul
@@ -113,7 +113,7 @@ entry:
define i32 @test7(i32 %x, i32 %y, i32 %z) {
; (x^4) * (y^3) * (z^2)
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: mul
; CHECK-NEXT: mul
; CHECK-NEXT: mul
diff --git a/test/Transforms/Reassociate/multistep.ll b/test/Transforms/Reassociate/multistep.ll
index 7466d2e99d89..d79464753f12 100644
--- a/test/Transforms/Reassociate/multistep.ll
+++ b/test/Transforms/Reassociate/multistep.ll
@@ -2,7 +2,7 @@
define i64 @multistep1(i64 %a, i64 %b, i64 %c) {
; Check that a*a*b+a*a*c is turned into a*(a*(b+c)).
-; CHECK: @multistep1
+; CHECK-LABEL: @multistep1(
%t0 = mul i64 %a, %b
%t1 = mul i64 %a, %t0 ; a*(a*b)
%t2 = mul i64 %a, %c
@@ -17,7 +17,7 @@ define i64 @multistep1(i64 %a, i64 %b, i64 %c) {
define i64 @multistep2(i64 %a, i64 %b, i64 %c, i64 %d) {
; Check that a*b+a*c+d is turned into a*(b+c)+d.
-; CHECK: @multistep2
+; CHECK-LABEL: @multistep2(
%t0 = mul i64 %a, %b
%t1 = mul i64 %a, %c
%t2 = add i64 %t1, %d ; a*c+d
diff --git a/test/Transforms/Reassociate/no-op.ll b/test/Transforms/Reassociate/no-op.ll
index 0444cf082d0d..7b02df99464b 100644
--- a/test/Transforms/Reassociate/no-op.ll
+++ b/test/Transforms/Reassociate/no-op.ll
@@ -8,7 +8,7 @@ declare void @use(i32)
define void @test1(i32 %a, i32 %b) {
; Shouldn't change or move any of the add instructions. Should commute but
; otherwise not change or move any of the mul instructions.
-; CHECK: @test1
+; CHECK-LABEL: @test1(
%a0 = add nsw i32 %a, 1
; CHECK-NEXT: %a0 = add nsw i32 %a, 1
%m0 = mul nsw i32 3, %a
@@ -25,7 +25,7 @@ define void @test1(i32 %a, i32 %b) {
define void @test2(i32 %a, i32 %b, i32 %c, i32 %d) {
; The initial add doesn't change so should not lose the nsw flag.
-; CHECK: @test2
+; CHECK-LABEL: @test2(
%a0 = add nsw i32 %b, %a
; CHECK-NEXT: %a0 = add nsw i32 %b, %a
%a1 = add nsw i32 %a0, %d
diff --git a/test/Transforms/Reassociate/optional-flags.ll b/test/Transforms/Reassociate/optional-flags.ll
index 40f7d5bf5b80..bf599be78bc9 100644
--- a/test/Transforms/Reassociate/optional-flags.ll
+++ b/test/Transforms/Reassociate/optional-flags.ll
@@ -3,7 +3,7 @@
; Reassociate should clear optional flags like nsw when reassociating.
-; CHECK: @test0
+; CHECK-LABEL: @test0(
; CHECK: %y = add i64 %b, %a
; CHECK: %z = add i64 %y, %c
define i64 @test0(i64 %a, i64 %b, i64 %c) {
@@ -12,7 +12,7 @@ define i64 @test0(i64 %a, i64 %b, i64 %c) {
ret i64 %z
}
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %y = add i64 %b, %a
; CHECK: %z = add i64 %y, %c
define i64 @test1(i64 %a, i64 %b, i64 %c) {
diff --git a/test/Transforms/Reassociate/repeats.ll b/test/Transforms/Reassociate/repeats.ll
index 6a020470f379..547cb0ad72c1 100644
--- a/test/Transforms/Reassociate/repeats.ll
+++ b/test/Transforms/Reassociate/repeats.ll
@@ -3,14 +3,14 @@
; Tests involving repeated operations on the same value.
define i8 @nilpotent(i8 %x) {
-; CHECK: @nilpotent
+; CHECK-LABEL: @nilpotent(
%tmp = xor i8 %x, %x
ret i8 %tmp
; CHECK: ret i8 0
}
define i2 @idempotent(i2 %x) {
-; CHECK: @idempotent
+; CHECK-LABEL: @idempotent(
%tmp1 = and i2 %x, %x
%tmp2 = and i2 %tmp1, %x
%tmp3 = and i2 %tmp2, %x
@@ -19,7 +19,7 @@ define i2 @idempotent(i2 %x) {
}
define i2 @add(i2 %x) {
-; CHECK: @add
+; CHECK-LABEL: @add(
%tmp1 = add i2 %x, %x
%tmp2 = add i2 %tmp1, %x
%tmp3 = add i2 %tmp2, %x
@@ -28,7 +28,7 @@ define i2 @add(i2 %x) {
}
define i2 @cst_add() {
-; CHECK: @cst_add
+; CHECK-LABEL: @cst_add(
%tmp1 = add i2 1, 1
%tmp2 = add i2 %tmp1, 1
ret i2 %tmp2
@@ -36,7 +36,7 @@ define i2 @cst_add() {
}
define i8 @cst_mul() {
-; CHECK: @cst_mul
+; CHECK-LABEL: @cst_mul(
%tmp1 = mul i8 3, 3
%tmp2 = mul i8 %tmp1, 3
%tmp3 = mul i8 %tmp2, 3
@@ -47,7 +47,7 @@ define i8 @cst_mul() {
define i3 @foo3x5(i3 %x) {
; Can be done with two multiplies.
-; CHECK: @foo3x5
+; CHECK-LABEL: @foo3x5(
; CHECK-NEXT: mul
; CHECK-NEXT: mul
; CHECK-NEXT: ret
@@ -60,7 +60,7 @@ define i3 @foo3x5(i3 %x) {
define i3 @foo3x6(i3 %x) {
; Can be done with two multiplies.
-; CHECK: @foo3x6
+; CHECK-LABEL: @foo3x6(
; CHECK-NEXT: mul
; CHECK-NEXT: mul
; CHECK-NEXT: ret
@@ -74,7 +74,7 @@ define i3 @foo3x6(i3 %x) {
define i3 @foo3x7(i3 %x) {
; Can be done with two multiplies.
-; CHECK: @foo3x7
+; CHECK-LABEL: @foo3x7(
; CHECK-NEXT: mul
; CHECK-NEXT: mul
; CHECK-NEXT: ret
@@ -89,7 +89,7 @@ define i3 @foo3x7(i3 %x) {
define i4 @foo4x8(i4 %x) {
; Can be done with two multiplies.
-; CHECK: @foo4x8
+; CHECK-LABEL: @foo4x8(
; CHECK-NEXT: mul
; CHECK-NEXT: mul
; CHECK-NEXT: ret
@@ -105,7 +105,7 @@ define i4 @foo4x8(i4 %x) {
define i4 @foo4x9(i4 %x) {
; Can be done with three multiplies.
-; CHECK: @foo4x9
+; CHECK-LABEL: @foo4x9(
; CHECK-NEXT: mul
; CHECK-NEXT: mul
; CHECK-NEXT: mul
@@ -123,7 +123,7 @@ define i4 @foo4x9(i4 %x) {
define i4 @foo4x10(i4 %x) {
; Can be done with three multiplies.
-; CHECK: @foo4x10
+; CHECK-LABEL: @foo4x10(
; CHECK-NEXT: mul
; CHECK-NEXT: mul
; CHECK-NEXT: mul
@@ -142,7 +142,7 @@ define i4 @foo4x10(i4 %x) {
define i4 @foo4x11(i4 %x) {
; Can be done with four multiplies.
-; CHECK: @foo4x11
+; CHECK-LABEL: @foo4x11(
; CHECK-NEXT: mul
; CHECK-NEXT: mul
; CHECK-NEXT: mul
@@ -163,7 +163,7 @@ define i4 @foo4x11(i4 %x) {
define i4 @foo4x12(i4 %x) {
; Can be done with two multiplies.
-; CHECK: @foo4x12
+; CHECK-LABEL: @foo4x12(
; CHECK-NEXT: mul
; CHECK-NEXT: mul
; CHECK-NEXT: ret
@@ -183,7 +183,7 @@ define i4 @foo4x12(i4 %x) {
define i4 @foo4x13(i4 %x) {
; Can be done with three multiplies.
-; CHECK: @foo4x13
+; CHECK-LABEL: @foo4x13(
; CHECK-NEXT: mul
; CHECK-NEXT: mul
; CHECK-NEXT: mul
@@ -205,7 +205,7 @@ define i4 @foo4x13(i4 %x) {
define i4 @foo4x14(i4 %x) {
; Can be done with three multiplies.
-; CHECK: @foo4x14
+; CHECK-LABEL: @foo4x14(
; CHECK-NEXT: mul
; CHECK-NEXT: mul
; CHECK-NEXT: mul
@@ -228,7 +228,7 @@ define i4 @foo4x14(i4 %x) {
define i4 @foo4x15(i4 %x) {
; Can be done with four multiplies.
-; CHECK: @foo4x15
+; CHECK-LABEL: @foo4x15(
; CHECK-NEXT: mul
; CHECK-NEXT: mul
; CHECK-NEXT: mul
diff --git a/test/Transforms/Reassociate/xor_reassoc.ll b/test/Transforms/Reassociate/xor_reassoc.ll
index b9353c7f81fe..a22689805fb5 100644
--- a/test/Transforms/Reassociate/xor_reassoc.ll
+++ b/test/Transforms/Reassociate/xor_reassoc.ll
@@ -14,7 +14,7 @@ define i32 @xor1(i32 %x) {
%xor = xor i32 %or, %or1
ret i32 %xor
-;CHECK: @xor1
+;CHECK-LABEL: @xor1(
;CHECK: %and.ra = and i32 %x, 435
;CHECK: %xor = xor i32 %and.ra, 435
}
@@ -28,7 +28,7 @@ define i32 @xor2(i32 %x, i32 %y) {
%xor2 = xor i32 %xor, %and1
ret i32 %xor2
-;CHECK: @xor2
+;CHECK-LABEL: @xor2(
;CHECK: %and.ra = and i32 %x, 435
;CHECK: %xor2 = xor i32 %and.ra, %y
}
@@ -42,7 +42,7 @@ define i32 @xor3(i32 %x, i32 %y) {
%xor1 = xor i32 %xor, %and
ret i32 %xor1
-;CHECK: @xor3
+;CHECK-LABEL: @xor3(
;CHECK: %and.ra = and i32 %x, -436
;CHECK: %xor = xor i32 %y, 123
;CHECK: %xor1 = xor i32 %xor, %and.ra
@@ -54,7 +54,7 @@ define i32 @xor4(i32 %x, i32 %y) {
%xor = xor i32 %y, 435
%xor1 = xor i32 %xor, %and
ret i32 %xor1
-; CHECK: @xor4
+; CHECK-LABEL: @xor4(
; CHECK: %and = and i32 %x, -124
; CHECK: %xor = xor i32 %y, 435
; CHECK: %xor1 = xor i32 %xor, %and
@@ -74,7 +74,7 @@ define i32 @xor_special1(i32 %x, i32 %y) {
%and = and i32 %x, -124
%xor1 = xor i32 %xor, %and
ret i32 %xor1
-; CHECK: @xor_special1
+; CHECK-LABEL: @xor_special1(
; CHECK: %xor1 = xor i32 %y, 123
; CHECK: ret i32 %xor1
}
@@ -87,7 +87,7 @@ define i32 @xor_special2(i32 %x, i32 %y) {
%and = and i32 %x, 123
%xor1 = xor i32 %xor, %and
ret i32 %xor1
-; CHECK: @xor_special2
+; CHECK-LABEL: @xor_special2(
; CHECK: %xor = xor i32 %y, 123
; CHECK: %xor1 = xor i32 %xor, %x
; CHECK: ret i32 %xor1
@@ -99,7 +99,7 @@ define i32 @xor_special3(i32 %x) {
%or1 = or i32 %x, 123
%xor = xor i32 %or, %or1
ret i32 %xor
-;CHECK: @xor_special3
+;CHECK-LABEL: @xor_special3(
;CHECK: ret i32 0
}
@@ -109,7 +109,7 @@ define i32 @xor_special4(i32 %x) {
%or1 = and i32 123, %x
%xor = xor i32 %or, %or1
ret i32 %xor
-;CHECK: @xor_special4
+;CHECK-LABEL: @xor_special4(
;CHECK: ret i32 0
}
@@ -129,7 +129,7 @@ define i32 @xor_ra_size1(i32 %x) {
%add = add i32 %xor, %or
ret i32 %add
-;CHECK: @xor_ra_size1
+;CHECK-LABEL: @xor_ra_size1(
;CHECK: %xor = xor i32 %and.ra, 435
}
@@ -145,7 +145,7 @@ define i32 @xor_ra_size2(i32 %x) {
%add2 = add i32 %add, %or1
ret i32 %add2
-;CHECK: @xor_ra_size2
+;CHECK-LABEL: @xor_ra_size2(
;CHECK: %or1 = or i32 %x, 456
;CHECK: %xor = xor i32 %or, %or1
}
@@ -188,6 +188,6 @@ define i32 @xor_bug2(i32, i32, i32, i32) {
%19 = add i32 %18, %12
%20 = add i32 %19, %15
ret i32 %20
-;CHECK: @xor_bug2
+;CHECK-LABEL: @xor_bug2(
;CHECK: xor i32 %5, 891034567
}
diff --git a/test/Transforms/Reg2Mem/lit.local.cfg b/test/Transforms/Reg2Mem/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/Reg2Mem/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/SCCP/atomic-load-store.ll b/test/Transforms/SCCP/atomic-load-store.ll
index 09061f0a6fd5..53e4c10a720a 100644
--- a/test/Transforms/SCCP/atomic-load-store.ll
+++ b/test/Transforms/SCCP/atomic-load-store.ll
@@ -16,7 +16,7 @@ F:
store atomic i32 123, i32* @G seq_cst, align 4
ret i32 0
}
-; CHECK: define i32 @test1
+; CHECK-LABEL: define i32 @test1(
; CHECK-NOT: store
; CHECK: ret i32 17
@@ -25,6 +25,6 @@ define i32 @test2() {
ret i32 %V
}
-; CHECK: define i32 @test2
+; CHECK-LABEL: define i32 @test2(
; CHECK-NOT: load
; CHECK: ret i32 222
diff --git a/test/Transforms/SCCP/ipsccp-addr-taken.ll b/test/Transforms/SCCP/ipsccp-addr-taken.ll
index b49da97ab2c0..ca586a009b33 100644
--- a/test/Transforms/SCCP/ipsccp-addr-taken.ll
+++ b/test/Transforms/SCCP/ipsccp-addr-taken.ll
@@ -6,7 +6,7 @@ target triple = "x86_64-apple-darwin10.0.0"
define internal i32 @foo() nounwind noinline ssp {
entry:
ret i32 0
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK: entry:
; CHECK: ret i32 0
}
diff --git a/test/Transforms/SCCP/ipsccp-basic.ll b/test/Transforms/SCCP/ipsccp-basic.ll
index 8340f0c1e127..c1c6c926fd9b 100644
--- a/test/Transforms/SCCP/ipsccp-basic.ll
+++ b/test/Transforms/SCCP/ipsccp-basic.ll
@@ -6,14 +6,14 @@ define internal i32 @test1a(i32 %A) {
%X = add i32 1, 2
ret i32 %A
}
-; CHECK: define internal i32 @test1a
+; CHECK-LABEL: define internal i32 @test1a(
; CHECK: ret i32 undef
define i32 @test1b() {
%X = call i32 @test1a( i32 17 )
ret i32 %X
-; CHECK: define i32 @test1b
+; CHECK-LABEL: define i32 @test1b(
; CHECK: ret i32 17
}
@@ -31,7 +31,7 @@ F:
%C.upgrd.1 = call i32 @test2a(i32 1)
ret i32 %C.upgrd.1
}
-; CHECK: define internal i32 @test2a
+; CHECK-LABEL: define internal i32 @test2a(
; CHECK-NEXT: br label %T
; CHECK: ret i32 undef
@@ -40,7 +40,7 @@ define i32 @test2b() {
%X = call i32 @test2a(i32 0)
ret i32 %X
}
-; CHECK: define i32 @test2b
+; CHECK-LABEL: define i32 @test2b(
; CHECK-NEXT: %X = call i32 @test2a(i32 0)
; CHECK-NEXT: ret i32 0
@@ -54,7 +54,7 @@ define void @test3a() {
store i32 %X, i32* @G
ret void
}
-; CHECK: define void @test3a
+; CHECK-LABEL: define void @test3a(
; CHECK-NEXT: ret void
@@ -69,7 +69,7 @@ F:
store i32 123, i32* @G
ret i32 0
}
-; CHECK: define i32 @test3b
+; CHECK-LABEL: define i32 @test3b(
; CHECK-NOT: store
; CHECK: ret i32 0
@@ -102,7 +102,7 @@ B:
define internal i64 @test4c(i64 %a) {
ret i64 %a
}
-; CHECK: define internal i64 @test4c
+; CHECK-LABEL: define internal i64 @test4c(
; CHECK: ret i64 undef
@@ -149,7 +149,7 @@ define i64 @test6b() {
%a = call i64 @test6a()
ret i64 %a
}
-; CHECK: define i64 @test6b
+; CHECK-LABEL: define i64 @test6b(
; CHECK: ret i64 0
;;======================== test7
@@ -162,7 +162,7 @@ define internal %T @test7a(i32 %A) {
%mrv0 = insertvalue %T undef, i32 %X, 0
%mrv1 = insertvalue %T %mrv0, i32 %A, 1
ret %T %mrv1
-; CHECK: @test7a
+; CHECK-LABEL: @test7a(
; CHECK-NEXT: %mrv0 = insertvalue %T undef, i32 18, 0
; CHECK-NEXT: %mrv1 = insertvalue %T %mrv0, i32 17, 1
}
@@ -172,7 +172,7 @@ define i32 @test7b() {
%Y = extractvalue %T %X, 0
%Z = add i32 %Y, %Y
ret i32 %Z
-; CHECK: define i32 @test7b
+; CHECK-LABEL: define i32 @test7b(
; CHECK-NEXT: call %T @test7a(i32 17)
; CHECK-NEXT: ret i32 36
}
@@ -183,7 +183,7 @@ define i32 @test7b() {
define internal {} @test8a(i32 %A, i32* %P) {
store i32 %A, i32* %P
ret {} {}
-; CHECK: @test8a
+; CHECK-LABEL: @test8a(
; CHECK-NEXT: store i32 5,
; CHECK-NEXT: ret
}
@@ -191,7 +191,7 @@ define internal {} @test8a(i32 %A, i32* %P) {
define void @test8b(i32* %P) {
%X = call {} @test8a(i32 5, i32* %P)
ret void
-; CHECK: define void @test8b
+; CHECK-LABEL: define void @test8b(
; CHECK-NEXT: call {} @test8a
; CHECK-NEXT: ret void
}
@@ -216,7 +216,7 @@ define i32 @test10a() nounwind {
entry:
%call = call i32 @test10b(i32 undef)
ret i32 %call
-; CHECK: define i32 @test10a
+; CHECK-LABEL: define i32 @test10a(
; CHECK: ret i32 0
}
@@ -224,6 +224,6 @@ define internal i32 @test10b(i32 %x) nounwind {
entry:
%r = and i32 %x, 1
ret i32 %r
-; CHECK: define internal i32 @test10b
+; CHECK-LABEL: define internal i32 @test10b(
; CHECK: ret i32 undef
}
diff --git a/test/Transforms/SCCP/lit.local.cfg b/test/Transforms/SCCP/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/SCCP/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/SCCP/sccptest.ll b/test/Transforms/SCCP/sccptest.ll
index a719f6cfb48d..5cc5087b1010 100644
--- a/test/Transforms/SCCP/sccptest.ll
+++ b/test/Transforms/SCCP/sccptest.ll
@@ -14,7 +14,7 @@ BB3: ; preds = %BB2, %BB1
%Ret = phi i32 [ %Val, %BB1 ], [ 1, %BB2 ] ; <i32> [#uses=1]
ret i32 %Ret
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %Ret = phi i32 [ 0, %BB1 ], [ 1, %BB2 ]
}
@@ -22,7 +22,7 @@ BB3: ; preds = %BB2, %BB1
; that SCCP gets right.
;
define i32 @test2(i32 %i0, i32 %j0) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
BB1:
br label %BB2
BB2:
diff --git a/test/Transforms/SCCP/switch.ll b/test/Transforms/SCCP/switch.ll
index 9f934237e619..155faa5c6067 100644
--- a/test/Transforms/SCCP/switch.ll
+++ b/test/Transforms/SCCP/switch.ll
@@ -4,7 +4,7 @@
; with no cases.
declare void @foo()
define void @test1() {
-; CHECK: define void @test1
+; CHECK-LABEL: define void @test1(
; CHECK: call void @foo()
switch i32 undef, label %d []
d:
diff --git a/test/Transforms/SCCP/undef-resolve.ll b/test/Transforms/SCCP/undef-resolve.ll
index a1a600c9607a..2b40183c2cc5 100644
--- a/test/Transforms/SCCP/undef-resolve.ll
+++ b/test/Transforms/SCCP/undef-resolve.ll
@@ -5,7 +5,7 @@
define double @test1() {
%t = sitofp i32 undef to double
ret double %t
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: ret double 0.0
}
@@ -13,7 +13,7 @@ define double @test1() {
; rdar://7832370
; Check that lots of stuff doesn't get turned into undef.
define i32 @test2() nounwind readnone ssp {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
init:
br label %control.outer.outer
@@ -110,7 +110,7 @@ bb1: ; preds = %bb1.us-lcssa, %bb1.
define i32 @test3() {
%t = xor i32 undef, undef
ret i32 %t
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: ret i32 0
}
@@ -118,7 +118,7 @@ define i32 @test3() {
define double @test4(double %x) {
%t = fadd double %x, undef
ret double %t
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: fadd double %x, undef
}
@@ -126,7 +126,7 @@ define double @test4(double %x) {
define i32 @test5() {
%t = sext i8 undef to i32
ret i32 %t
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: ret i32 0
}
@@ -134,7 +134,7 @@ define i32 @test5() {
define i32 @test6() {
%t = ashr i32 undef, 31
ret i32 %t
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: ret i32 -1
}
@@ -142,7 +142,7 @@ define i32 @test6() {
define i32 @test7() {
%t = lshr i32 undef, 31
ret i32 %t
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: ret i32 0
}
@@ -150,7 +150,7 @@ define i32 @test7() {
define i1 @test8() {
%t = icmp eq i32 undef, -1
ret i1 %t
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK: ret i1 undef
}
@@ -158,7 +158,7 @@ define i1 @test8() {
define i1 @test9() {
%t = icmp ugt i32 undef, -1
ret i1 %t
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK: icmp ugt
}
@@ -167,6 +167,6 @@ define i64 @test10() {
entry:
%e = extractvalue { i64, i64 } undef, 1
ret i64 %e
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK: ret i64 undef
}
diff --git a/test/Transforms/SLPVectorizer/ARM/lit.local.cfg b/test/Transforms/SLPVectorizer/ARM/lit.local.cfg
new file mode 100644
index 000000000000..5fc35d80541d
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/ARM/lit.local.cfg
@@ -0,0 +1,3 @@
+targets = set(config.root.targets_to_build.split())
+if not 'ARM' in targets:
+ config.unsupported = True
diff --git a/test/Transforms/SLPVectorizer/ARM/memory.ll b/test/Transforms/SLPVectorizer/ARM/memory.ll
new file mode 100644
index 000000000000..383c808d21cf
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/ARM/memory.ll
@@ -0,0 +1,20 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -S -mtriple=thumbv7-apple-ios3.0.0 -mcpu=swift | FileCheck %s
+
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
+
+; On swift unaligned <2 x double> stores need 4uops and it is there for cheaper
+; to do this scalar.
+
+; CHECK-LABEL: expensive_double_store
+; CHECK-NOT: load <2 x double>
+; CHECK-NOT: store <2 x double>
+define void @expensive_double_store(double* noalias %dst, double* noalias %src, i64 %count) {
+entry:
+ %0 = load double* %src, align 8
+ store double %0, double* %dst, align 8
+ %arrayidx2 = getelementptr inbounds double* %src, i64 1
+ %1 = load double* %arrayidx2, align 8
+ %arrayidx3 = getelementptr inbounds double* %dst, i64 1
+ store double %1, double* %arrayidx3, align 8
+ ret void
+}
diff --git a/test/Transforms/SLPVectorizer/ARM/sroa.ll b/test/Transforms/SLPVectorizer/ARM/sroa.ll
new file mode 100644
index 000000000000..e0c75b147f6f
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/ARM/sroa.ll
@@ -0,0 +1,52 @@
+; RUN: opt -S -mcpu=swift -mtriple=thumbv7-apple-ios -basicaa -slp-vectorizer < %s | FileCheck %s
+
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
+
+%class.Complex = type { double, double }
+
+; Code like this is the result of SROA. Make sure we don't vectorize this
+; because the in the scalar version of this the shl/or are handled by the
+; backend and disappear, the vectorized code stays.
+
+; CHECK-LABEL: SROAed
+; CHECK-NOT: shl <2 x i64>
+; CHECK-NOT: or <2 x i64>
+
+define void @SROAed(%class.Complex* noalias nocapture sret %agg.result, [4 x i32] %a.coerce, [4 x i32] %b.coerce) {
+entry:
+ %a.coerce.fca.0.extract = extractvalue [4 x i32] %a.coerce, 0
+ %a.sroa.0.0.insert.ext = zext i32 %a.coerce.fca.0.extract to i64
+ %a.coerce.fca.1.extract = extractvalue [4 x i32] %a.coerce, 1
+ %a.sroa.0.4.insert.ext = zext i32 %a.coerce.fca.1.extract to i64
+ %a.sroa.0.4.insert.shift = shl nuw i64 %a.sroa.0.4.insert.ext, 32
+ %a.sroa.0.4.insert.insert = or i64 %a.sroa.0.4.insert.shift, %a.sroa.0.0.insert.ext
+ %0 = bitcast i64 %a.sroa.0.4.insert.insert to double
+ %a.coerce.fca.2.extract = extractvalue [4 x i32] %a.coerce, 2
+ %a.sroa.3.8.insert.ext = zext i32 %a.coerce.fca.2.extract to i64
+ %a.coerce.fca.3.extract = extractvalue [4 x i32] %a.coerce, 3
+ %a.sroa.3.12.insert.ext = zext i32 %a.coerce.fca.3.extract to i64
+ %a.sroa.3.12.insert.shift = shl nuw i64 %a.sroa.3.12.insert.ext, 32
+ %a.sroa.3.12.insert.insert = or i64 %a.sroa.3.12.insert.shift, %a.sroa.3.8.insert.ext
+ %1 = bitcast i64 %a.sroa.3.12.insert.insert to double
+ %b.coerce.fca.0.extract = extractvalue [4 x i32] %b.coerce, 0
+ %b.sroa.0.0.insert.ext = zext i32 %b.coerce.fca.0.extract to i64
+ %b.coerce.fca.1.extract = extractvalue [4 x i32] %b.coerce, 1
+ %b.sroa.0.4.insert.ext = zext i32 %b.coerce.fca.1.extract to i64
+ %b.sroa.0.4.insert.shift = shl nuw i64 %b.sroa.0.4.insert.ext, 32
+ %b.sroa.0.4.insert.insert = or i64 %b.sroa.0.4.insert.shift, %b.sroa.0.0.insert.ext
+ %2 = bitcast i64 %b.sroa.0.4.insert.insert to double
+ %b.coerce.fca.2.extract = extractvalue [4 x i32] %b.coerce, 2
+ %b.sroa.3.8.insert.ext = zext i32 %b.coerce.fca.2.extract to i64
+ %b.coerce.fca.3.extract = extractvalue [4 x i32] %b.coerce, 3
+ %b.sroa.3.12.insert.ext = zext i32 %b.coerce.fca.3.extract to i64
+ %b.sroa.3.12.insert.shift = shl nuw i64 %b.sroa.3.12.insert.ext, 32
+ %b.sroa.3.12.insert.insert = or i64 %b.sroa.3.12.insert.shift, %b.sroa.3.8.insert.ext
+ %3 = bitcast i64 %b.sroa.3.12.insert.insert to double
+ %add = fadd double %0, %2
+ %add3 = fadd double %1, %3
+ %re.i.i = getelementptr inbounds %class.Complex* %agg.result, i32 0, i32 0
+ store double %add, double* %re.i.i, align 4
+ %im.i.i = getelementptr inbounds %class.Complex* %agg.result, i32 0, i32 1
+ store double %add3, double* %im.i.i, align 4
+ ret void
+}
diff --git a/test/Transforms/SLPVectorizer/R600/lit.local.cfg b/test/Transforms/SLPVectorizer/R600/lit.local.cfg
new file mode 100644
index 000000000000..9e0ab99235e0
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/R600/lit.local.cfg
@@ -0,0 +1,4 @@
+targets = set(config.root.targets_to_build.split())
+if not 'R600' in targets:
+ config.unsupported = True
+
diff --git a/test/Transforms/SLPVectorizer/R600/simplebb.ll b/test/Transforms/SLPVectorizer/R600/simplebb.ll
new file mode 100644
index 000000000000..b6d794b994d4
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/R600/simplebb.ll
@@ -0,0 +1,65 @@
+; RUN: opt -S -march=r600 -mcpu=cayman -basicaa -slp-vectorizer -dce < %s | FileCheck %s
+
+target datalayout = "e-p:32:32:32-p3:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-v2048:2048:2048-n32:64"
+
+
+; Simple 3-pair chain with loads and stores
+define void @test1_as_3_3_3(double addrspace(3)* %a, double addrspace(3)* %b, double addrspace(3)* %c) {
+; CHECK-LABEL: @test1_as_3_3_3(
+; CHECK: load <2 x double> addrspace(3)*
+; CHECK: load <2 x double> addrspace(3)*
+; CHECK: store <2 x double> %{{.*}}, <2 x double> addrspace(3)* %
+; CHECK: ret
+ %i0 = load double addrspace(3)* %a, align 8
+ %i1 = load double addrspace(3)* %b, align 8
+ %mul = fmul double %i0, %i1
+ %arrayidx3 = getelementptr inbounds double addrspace(3)* %a, i64 1
+ %i3 = load double addrspace(3)* %arrayidx3, align 8
+ %arrayidx4 = getelementptr inbounds double addrspace(3)* %b, i64 1
+ %i4 = load double addrspace(3)* %arrayidx4, align 8
+ %mul5 = fmul double %i3, %i4
+ store double %mul, double addrspace(3)* %c, align 8
+ %arrayidx5 = getelementptr inbounds double addrspace(3)* %c, i64 1
+ store double %mul5, double addrspace(3)* %arrayidx5, align 8
+ ret void
+}
+
+define void @test1_as_3_0_0(double addrspace(3)* %a, double* %b, double* %c) {
+; CHECK-LABEL: @test1_as_3_0_0(
+; CHECK: load <2 x double> addrspace(3)*
+; CHECK: load <2 x double>*
+; CHECK: store <2 x double> %{{.*}}, <2 x double>* %
+; CHECK: ret
+ %i0 = load double addrspace(3)* %a, align 8
+ %i1 = load double* %b, align 8
+ %mul = fmul double %i0, %i1
+ %arrayidx3 = getelementptr inbounds double addrspace(3)* %a, i64 1
+ %i3 = load double addrspace(3)* %arrayidx3, align 8
+ %arrayidx4 = getelementptr inbounds double* %b, i64 1
+ %i4 = load double* %arrayidx4, align 8
+ %mul5 = fmul double %i3, %i4
+ store double %mul, double* %c, align 8
+ %arrayidx5 = getelementptr inbounds double* %c, i64 1
+ store double %mul5, double* %arrayidx5, align 8
+ ret void
+}
+
+define void @test1_as_0_0_3(double* %a, double* %b, double addrspace(3)* %c) {
+; CHECK-LABEL: @test1_as_0_0_3(
+; CHECK: load <2 x double>*
+; CHECK: load <2 x double>*
+; CHECK: store <2 x double> %{{.*}}, <2 x double> addrspace(3)* %
+; CHECK: ret
+ %i0 = load double* %a, align 8
+ %i1 = load double* %b, align 8
+ %mul = fmul double %i0, %i1
+ %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
+ store double %mul, double addrspace(3)* %c, align 8
+ %arrayidx5 = getelementptr inbounds double addrspace(3)* %c, i64 1
+ store double %mul5, double addrspace(3)* %arrayidx5, align 8
+ ret void
+}
diff --git a/test/Transforms/SLPVectorizer/X86/barriercall.ll b/test/Transforms/SLPVectorizer/X86/barriercall.ll
index 04eb8f919bc7..bba285526a4b 100644
--- a/test/Transforms/SLPVectorizer/X86/barriercall.ll
+++ b/test/Transforms/SLPVectorizer/X86/barriercall.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-;CHECK: @foo
+;CHECK-LABEL: @foo(
;CHECK: store <4 x i32>
;CHECK: ret
define i32 @foo(i32* nocapture %A, i32 %n) {
diff --git a/test/Transforms/SLPVectorizer/X86/cast.ll b/test/Transforms/SLPVectorizer/X86/cast.ll
index 344dbbca2c57..e340fba351a3 100644
--- a/test/Transforms/SLPVectorizer/X86/cast.ll
+++ b/test/Transforms/SLPVectorizer/X86/cast.ll
@@ -9,7 +9,7 @@ target triple = "x86_64-apple-macosx10.9.0"
; A[2] = B[2];
; A[3] = B[3];
; }
-;CHECK: @foo
+;CHECK-LABEL: @foo(
;CHECK: load <4 x i8>
;CHECK: sext
;CHECK: store <4 x i32>
diff --git a/test/Transforms/SLPVectorizer/X86/cmp_sel.ll b/test/Transforms/SLPVectorizer/X86/cmp_sel.ll
new file mode 100644
index 000000000000..0c124a75d417
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/cmp_sel.ll
@@ -0,0 +1,32 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | 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-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+; int foo(double * restrict A, double * restrict B, double G) {
+; A[0] = (B[10] ? G : 1);
+; A[1] = (B[11] ? G : 1);
+; }
+
+;CHECK-LABEL: @foo(
+;CHECK: load <2 x double>
+;CHECK: fcmp une <2 x double>
+;CHECK: select <2 x i1>
+;CHECK: store <2 x double>
+;CHECK: ret i32 undef
+define i32 @foo(double* noalias nocapture %A, double* noalias nocapture %B, double %G) {
+entry:
+ %arrayidx = getelementptr inbounds double* %B, i64 10
+ %0 = load double* %arrayidx, align 8
+ %tobool = fcmp une double %0, 0.000000e+00
+ %cond = select i1 %tobool, double %G, double 1.000000e+00
+ store double %cond, double* %A, align 8
+ %arrayidx2 = getelementptr inbounds double* %B, i64 11
+ %1 = load double* %arrayidx2, align 8
+ %tobool3 = fcmp une double %1, 0.000000e+00
+ %cond7 = select i1 %tobool3, double %G, double 1.000000e+00
+ %arrayidx8 = getelementptr inbounds double* %A, i64 1
+ store double %cond7, double* %arrayidx8, align 8
+ ret i32 undef
+}
+
diff --git a/test/Transforms/SLPVectorizer/X86/compare-reduce.ll b/test/Transforms/SLPVectorizer/X86/compare-reduce.ll
index 05f8e616bb8e..9653d18db566 100644
--- a/test/Transforms/SLPVectorizer/X86/compare-reduce.ll
+++ b/test/Transforms/SLPVectorizer/X86/compare-reduce.ll
@@ -5,7 +5,7 @@ target triple = "x86_64-apple-macosx10.7.0"
@.str = private unnamed_addr constant [6 x i8] c"bingo\00", align 1
-;CHECK: @reduce_compare
+;CHECK-LABEL: @reduce_compare(
;CHECK: load <2 x double>
;CHECK: fmul <2 x double>
;CHECK: fmul <2 x double>
diff --git a/test/Transforms/SLPVectorizer/X86/crash_7zip.ll b/test/Transforms/SLPVectorizer/X86/crash_7zip.ll
new file mode 100644
index 000000000000..51b1c08fb36f
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/crash_7zip.ll
@@ -0,0 +1,38 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
+
+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.CLzmaDec.1.28.55.82.103.124.145.166.181.196.229.259.334 = type { %struct._CLzmaProps.0.27.54.81.102.123.144.165.180.195.228.258.333, i16*, i8*, i8*, i32, i32, i64, i64, i32, i32, i32, [4 x i32], i32, i32, i32, i32, i32, [20 x i8] }
+%struct._CLzmaProps.0.27.54.81.102.123.144.165.180.195.228.258.333 = type { i32, i32, i32, i32 }
+
+define fastcc void @LzmaDec_DecodeReal2(%struct.CLzmaDec.1.28.55.82.103.124.145.166.181.196.229.259.334* %p) {
+entry:
+ %range20.i = getelementptr inbounds %struct.CLzmaDec.1.28.55.82.103.124.145.166.181.196.229.259.334* %p, i64 0, i32 4
+ %code21.i = getelementptr inbounds %struct.CLzmaDec.1.28.55.82.103.124.145.166.181.196.229.259.334* %p, i64 0, i32 5
+ br label %do.body66.i
+
+do.body66.i: ; preds = %do.cond.i, %entry
+ %range.2.i = phi i32 [ %range.4.i, %do.cond.i ], [ undef, %entry ]
+ %code.2.i = phi i32 [ %code.4.i, %do.cond.i ], [ undef, %entry ]
+ %.range.2.i = select i1 undef, i32 undef, i32 %range.2.i
+ %.code.2.i = select i1 undef, i32 undef, i32 %code.2.i
+ br i1 undef, label %do.cond.i, label %if.else.i
+
+if.else.i: ; preds = %do.body66.i
+ %sub91.i = sub i32 %.range.2.i, undef
+ %sub92.i = sub i32 %.code.2.i, undef
+ br label %do.cond.i
+
+do.cond.i: ; preds = %if.else.i, %do.body66.i
+ %range.4.i = phi i32 [ %sub91.i, %if.else.i ], [ undef, %do.body66.i ]
+ %code.4.i = phi i32 [ %sub92.i, %if.else.i ], [ %.code.2.i, %do.body66.i ]
+ br i1 undef, label %do.body66.i, label %do.end1006.i
+
+do.end1006.i: ; preds = %do.cond.i
+ %.range.4.i = select i1 undef, i32 undef, i32 %range.4.i
+ %.code.4.i = select i1 undef, i32 undef, i32 %code.4.i
+ store i32 %.range.4.i, i32* %range20.i, align 4
+ store i32 %.code.4.i, i32* %code21.i, align 4
+ ret void
+}
diff --git a/test/Transforms/SLPVectorizer/X86/crash_bullet.ll b/test/Transforms/SLPVectorizer/X86/crash_bullet.ll
new file mode 100644
index 000000000000..389892115ced
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/crash_bullet.ll
@@ -0,0 +1,128 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
+
+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.btTypedConstraint::btConstraintInfo1.17.157.357.417.477.960" = type { i32, i32 }
+
+define void @_ZN23btGeneric6DofConstraint8getInfo1EPN17btTypedConstraint17btConstraintInfo1E(%"struct.btTypedConstraint::btConstraintInfo1.17.157.357.417.477.960"* nocapture %info) {
+entry:
+ br i1 undef, label %if.else, label %if.then
+
+if.then: ; preds = %entry
+ ret void
+
+if.else: ; preds = %entry
+ %m_numConstraintRows4 = getelementptr inbounds %"struct.btTypedConstraint::btConstraintInfo1.17.157.357.417.477.960"* %info, i64 0, i32 0
+ %nub5 = getelementptr inbounds %"struct.btTypedConstraint::btConstraintInfo1.17.157.357.417.477.960"* %info, i64 0, i32 1
+ br i1 undef, label %land.lhs.true.i.1, label %if.then7.1
+
+land.lhs.true.i.1: ; preds = %if.else
+ br i1 undef, label %for.inc.1, label %if.then7.1
+
+if.then7.1: ; preds = %land.lhs.true.i.1, %if.else
+ %inc.1 = add nsw i32 0, 1
+ store i32 %inc.1, i32* %m_numConstraintRows4, align 4
+ %dec.1 = add nsw i32 6, -1
+ store i32 %dec.1, i32* %nub5, align 4
+ br label %for.inc.1
+
+for.inc.1: ; preds = %if.then7.1, %land.lhs.true.i.1
+ %0 = phi i32 [ %dec.1, %if.then7.1 ], [ 6, %land.lhs.true.i.1 ]
+ %1 = phi i32 [ %inc.1, %if.then7.1 ], [ 0, %land.lhs.true.i.1 ]
+ %inc.2 = add nsw i32 %1, 1
+ store i32 %inc.2, i32* %m_numConstraintRows4, align 4
+ %dec.2 = add nsw i32 %0, -1
+ store i32 %dec.2, i32* %nub5, align 4
+ unreachable
+}
+
+%class.GIM_TRIANGLE_CALCULATION_CACHE.9.34.69.94.119.144.179.189.264.284.332 = type { float, [3 x %class.btVector3.5.30.65.90.115.140.175.185.260.280.330], [3 x %class.btVector3.5.30.65.90.115.140.175.185.260.280.330], %class.btVector4.7.32.67.92.117.142.177.187.262.282.331, %class.btVector4.7.32.67.92.117.142.177.187.262.282.331, %class.btVector3.5.30.65.90.115.140.175.185.260.280.330, %class.btVector3.5.30.65.90.115.140.175.185.260.280.330, %class.btVector3.5.30.65.90.115.140.175.185.260.280.330, %class.btVector3.5.30.65.90.115.140.175.185.260.280.330, [4 x float], float, float, [4 x float], float, float, [16 x %class.btVector3.5.30.65.90.115.140.175.185.260.280.330], [16 x %class.btVector3.5.30.65.90.115.140.175.185.260.280.330], [16 x %class.btVector3.5.30.65.90.115.140.175.185.260.280.330] }
+%class.btVector3.5.30.65.90.115.140.175.185.260.280.330 = type { [4 x float] }
+%class.btVector4.7.32.67.92.117.142.177.187.262.282.331 = type { %class.btVector3.5.30.65.90.115.140.175.185.260.280.330 }
+
+define void @_ZN30GIM_TRIANGLE_CALCULATION_CACHE18triangle_collisionERK9btVector3S2_S2_fS2_S2_S2_fR25GIM_TRIANGLE_CONTACT_DATA(%class.GIM_TRIANGLE_CALCULATION_CACHE.9.34.69.94.119.144.179.189.264.284.332* %this) {
+entry:
+ %arrayidx26 = getelementptr inbounds %class.GIM_TRIANGLE_CALCULATION_CACHE.9.34.69.94.119.144.179.189.264.284.332* %this, i64 0, i32 2, i64 0, i32 0, i64 1
+ %arrayidx36 = getelementptr inbounds %class.GIM_TRIANGLE_CALCULATION_CACHE.9.34.69.94.119.144.179.189.264.284.332* %this, i64 0, i32 2, i64 0, i32 0, i64 2
+ %0 = load float* %arrayidx36, align 4
+ %add587 = fadd float undef, undef
+ %sub600 = fsub float %add587, undef
+ store float %sub600, float* undef, align 4
+ %sub613 = fsub float %add587, %sub600
+ store float %sub613, float* %arrayidx26, align 4
+ %add626 = fadd float %0, undef
+ %sub639 = fsub float %add626, undef
+ %sub652 = fsub float %add626, %sub639
+ store float %sub652, float* %arrayidx36, align 4
+ br i1 undef, label %if.else1609, label %if.then1595
+
+if.then1595: ; preds = %entry
+ br i1 undef, label %return, label %for.body.lr.ph.i.i1702
+
+for.body.lr.ph.i.i1702: ; preds = %if.then1595
+ unreachable
+
+if.else1609: ; preds = %entry
+ unreachable
+
+return: ; preds = %if.then1595
+ ret void
+}
+
+define void @_Z8dBoxBox2RK9btVector3PKfS1_S1_S3_S1_RS_PfPiiP12dContactGeomiRN36btDiscreteCollisionDetectorInterface6ResultE() {
+entry:
+ %add8.i2343 = fadd float undef, undef
+ %add8.i2381 = fadd float undef, undef
+ br i1 undef, label %return, label %if.end
+
+if.end: ; preds = %entry
+ br i1 undef, label %return, label %if.end111
+
+if.end111: ; preds = %if.end
+ br i1 undef, label %return, label %if.end136
+
+if.end136: ; preds = %if.end111
+ br i1 undef, label %return, label %if.end162
+
+if.end162: ; preds = %if.end136
+ br i1 undef, label %return, label %if.end189
+
+if.end189: ; preds = %if.end162
+ br i1 undef, label %return, label %if.end216
+
+if.end216: ; preds = %if.end189
+ br i1 undef, label %if.then218, label %if.end225
+
+if.then218: ; preds = %if.end216
+ br label %if.end225
+
+if.end225: ; preds = %if.then218, %if.end216
+ br i1 undef, label %return, label %if.end248
+
+if.end248: ; preds = %if.end225
+ br i1 undef, label %return, label %if.end304
+
+if.end304: ; preds = %if.end248
+ %mul341 = fmul float undef, %add8.i2343
+ %mul344 = fmul float undef, %add8.i2381
+ %sub345 = fsub float %mul341, %mul344
+ br i1 undef, label %return, label %if.end361
+
+if.end361: ; preds = %if.end304
+ %mul364 = fmul float %add8.i2381, %add8.i2381
+ br i1 undef, label %if.then370, label %if.end395
+
+if.then370: ; preds = %if.end361
+ br i1 undef, label %if.then374, label %if.end395
+
+if.then374: ; preds = %if.then370
+ %cmp392 = fcmp olt float %sub345, 0.000000e+00
+ br label %if.end395
+
+if.end395: ; preds = %if.then374, %if.then370, %if.end361
+ unreachable
+
+return: ; preds = %if.end304, %if.end248, %if.end225, %if.end189, %if.end162, %if.end136, %if.end111, %if.end, %entry
+ ret void
+}
diff --git a/test/Transforms/SLPVectorizer/X86/crash_bullet3.ll b/test/Transforms/SLPVectorizer/X86/crash_bullet3.ll
new file mode 100644
index 000000000000..25c65457946b
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/crash_bullet3.ll
@@ -0,0 +1,84 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
+
+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"
+
+%class.btVector3.23.221.463.485.507.573.595.683.727.749.815.837.991.1585.1607.1629.1651.1849.2047.2069.2091.2113 = type { [4 x float] }
+
+; Function Attrs: ssp uwtable
+define void @_ZN11HullLibrary15CleanupVerticesEjPK9btVector3jRjPS0_fRS0_(%class.btVector3.23.221.463.485.507.573.595.683.727.749.815.837.991.1585.1607.1629.1651.1849.2047.2069.2091.2113* %vertices) #0 align 2 {
+entry:
+ br i1 undef, label %return, label %if.end
+
+if.end: ; preds = %entry
+ br label %for.body
+
+for.body: ; preds = %if.end22.2, %if.end
+ br i1 undef, label %if.then17.1, label %if.end22.1
+
+for.end36: ; preds = %if.end22.2
+ br label %for.body144
+
+for.body144: ; preds = %for.body144, %for.end36
+ br i1 undef, label %for.end227, label %for.body144
+
+for.end227: ; preds = %for.body144
+ br i1 undef, label %for.end271, label %for.body233
+
+for.body233: ; preds = %for.body233, %for.end227
+ br i1 undef, label %for.body233, label %for.end271
+
+for.end271: ; preds = %for.body233, %for.end227
+ %0 = phi float [ 0x47EFFFFFE0000000, %for.end227 ], [ undef, %for.body233 ]
+ %1 = phi float [ 0x47EFFFFFE0000000, %for.end227 ], [ undef, %for.body233 ]
+ %sub275 = fsub float undef, %1
+ %sub279 = fsub float undef, %0
+ br i1 undef, label %if.then291, label %return
+
+if.then291: ; preds = %for.end271
+ %mul292 = fmul float %sub275, 5.000000e-01
+ %add294 = fadd float %1, %mul292
+ %mul295 = fmul float %sub279, 5.000000e-01
+ %add297 = fadd float %0, %mul295
+ br i1 undef, label %if.end332, label %if.else319
+
+if.else319: ; preds = %if.then291
+ br i1 undef, label %if.then325, label %if.end327
+
+if.then325: ; preds = %if.else319
+ br label %if.end327
+
+if.end327: ; preds = %if.then325, %if.else319
+ br i1 undef, label %if.then329, label %if.end332
+
+if.then329: ; preds = %if.end327
+ br label %if.end332
+
+if.end332: ; preds = %if.then329, %if.end327, %if.then291
+ %dx272.1 = phi float [ %sub275, %if.then329 ], [ %sub275, %if.end327 ], [ 0x3F847AE140000000, %if.then291 ]
+ %dy276.1 = phi float [ undef, %if.then329 ], [ undef, %if.end327 ], [ 0x3F847AE140000000, %if.then291 ]
+ %sub334 = fsub float %add294, %dx272.1
+ %sub338 = fsub float %add297, %dy276.1
+ %arrayidx.i.i606 = getelementptr inbounds %class.btVector3.23.221.463.485.507.573.595.683.727.749.815.837.991.1585.1607.1629.1651.1849.2047.2069.2091.2113* %vertices, i64 0, i32 0, i64 0
+ store float %sub334, float* %arrayidx.i.i606, align 4
+ %arrayidx3.i607 = getelementptr inbounds %class.btVector3.23.221.463.485.507.573.595.683.727.749.815.837.991.1585.1607.1629.1651.1849.2047.2069.2091.2113* %vertices, i64 0, i32 0, i64 1
+ store float %sub338, float* %arrayidx3.i607, align 4
+ br label %return
+
+return: ; preds = %if.end332, %for.end271, %entry
+ ret void
+
+if.then17.1: ; preds = %for.body
+ br label %if.end22.1
+
+if.end22.1: ; preds = %if.then17.1, %for.body
+ br i1 undef, label %if.then17.2, label %if.end22.2
+
+if.then17.2: ; preds = %if.end22.1
+ br label %if.end22.2
+
+if.end22.2: ; preds = %if.then17.2, %if.end22.1
+ br i1 undef, label %for.end36, label %for.body
+}
+
+attributes #0 = { ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/test/Transforms/SLPVectorizer/X86/crash_dequeue.ll b/test/Transforms/SLPVectorizer/X86/crash_dequeue.ll
new file mode 100644
index 000000000000..ce0159071c60
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/crash_dequeue.ll
@@ -0,0 +1,40 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
+
+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.std::_Deque_iterator.4.157.174.208.259.276.344.731" = type { double*, double*, double*, double** }
+
+; Function Attrs: nounwind ssp uwtable
+define void @_ZSt6uniqueISt15_Deque_iteratorIdRdPdEET_S4_S4_(%"struct.std::_Deque_iterator.4.157.174.208.259.276.344.731"* %__first, %"struct.std::_Deque_iterator.4.157.174.208.259.276.344.731"* nocapture %__last) {
+entry:
+ %_M_cur2.i.i = getelementptr inbounds %"struct.std::_Deque_iterator.4.157.174.208.259.276.344.731"* %__first, i64 0, i32 0
+ %0 = load double** %_M_cur2.i.i, align 8
+ %_M_first3.i.i = getelementptr inbounds %"struct.std::_Deque_iterator.4.157.174.208.259.276.344.731"* %__first, i64 0, i32 1
+ %_M_cur2.i.i81 = getelementptr inbounds %"struct.std::_Deque_iterator.4.157.174.208.259.276.344.731"* %__last, i64 0, i32 0
+ %1 = load double** %_M_cur2.i.i81, align 8
+ %_M_first3.i.i83 = getelementptr inbounds %"struct.std::_Deque_iterator.4.157.174.208.259.276.344.731"* %__last, i64 0, i32 1
+ %2 = load double** %_M_first3.i.i83, align 8
+ br i1 undef, label %_ZSt13adjacent_findISt15_Deque_iteratorIdRdPdEET_S4_S4_.exit, label %while.cond.i.preheader
+
+while.cond.i.preheader: ; preds = %entry
+ br label %while.cond.i
+
+while.cond.i: ; preds = %while.body.i, %while.cond.i.preheader
+ br i1 undef, label %_ZSt13adjacent_findISt15_Deque_iteratorIdRdPdEET_S4_S4_.exit, label %while.body.i
+
+while.body.i: ; preds = %while.cond.i
+ br i1 undef, label %_ZSt13adjacent_findISt15_Deque_iteratorIdRdPdEET_S4_S4_.exit, label %while.cond.i
+
+_ZSt13adjacent_findISt15_Deque_iteratorIdRdPdEET_S4_S4_.exit: ; preds = %while.body.i, %while.cond.i, %entry
+ %3 = phi double* [ %2, %entry ], [ %2, %while.cond.i ], [ undef, %while.body.i ]
+ %4 = phi double* [ %0, %entry ], [ %1, %while.cond.i ], [ undef, %while.body.i ]
+ store double* %4, double** %_M_cur2.i.i, align 8
+ store double* %3, double** %_M_first3.i.i, align 8
+ br i1 undef, label %if.then.i55, label %while.cond
+
+if.then.i55: ; preds = %_ZSt13adjacent_findISt15_Deque_iteratorIdRdPdEET_S4_S4_.exit
+ br label %while.cond
+
+while.cond: ; preds = %while.cond, %if.then.i55, %_ZSt13adjacent_findISt15_Deque_iteratorIdRdPdEET_S4_S4_.exit
+ br label %while.cond
+}
diff --git a/test/Transforms/SLPVectorizer/X86/crash_flop7.ll b/test/Transforms/SLPVectorizer/X86/crash_flop7.ll
new file mode 100644
index 000000000000..e11be488f795
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/crash_flop7.ll
@@ -0,0 +1,46 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
+
+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"
+
+; Function Attrs: nounwind ssp uwtable
+define void @main() #0 {
+entry:
+ br i1 undef, label %while.body, label %while.end
+
+while.body: ; preds = %entry
+ unreachable
+
+while.end: ; preds = %entry
+ br i1 undef, label %for.end80, label %for.body75.lr.ph
+
+for.body75.lr.ph: ; preds = %while.end
+ br label %for.body75
+
+for.body75: ; preds = %for.body75, %for.body75.lr.ph
+ br label %for.body75
+
+for.end80: ; preds = %while.end
+ br i1 undef, label %for.end300, label %for.body267.lr.ph
+
+for.body267.lr.ph: ; preds = %for.end80
+ br label %for.body267
+
+for.body267: ; preds = %for.body267, %for.body267.lr.ph
+ %s.71010 = phi double [ 0.000000e+00, %for.body267.lr.ph ], [ %add297, %for.body267 ]
+ %mul269 = fmul double undef, undef
+ %mul270 = fmul double %mul269, %mul269
+ %add282 = fadd double undef, undef
+ %mul283 = fmul double %mul269, %add282
+ %add293 = fadd double undef, undef
+ %mul294 = fmul double %mul270, %add293
+ %add295 = fadd double undef, %mul294
+ %div296 = fdiv double %mul283, %add295
+ %add297 = fadd double %s.71010, %div296
+ br i1 undef, label %for.body267, label %for.end300
+
+for.end300: ; preds = %for.body267, %for.end80
+ unreachable
+}
+
+attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/test/Transforms/SLPVectorizer/X86/crash_lencod.ll b/test/Transforms/SLPVectorizer/X86/crash_lencod.ll
new file mode 100644
index 000000000000..c02e1fa607d5
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/crash_lencod.ll
@@ -0,0 +1,91 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
+
+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"
+
+; Function Attrs: nounwind ssp uwtable
+define void @RCModelEstimator() {
+entry:
+ br i1 undef, label %for.body.lr.ph, label %for.end.thread
+
+for.end.thread: ; preds = %entry
+ unreachable
+
+for.body.lr.ph: ; preds = %entry
+ br i1 undef, label %for.end, label %for.body
+
+for.body: ; preds = %for.body, %for.body.lr.ph
+ br i1 undef, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %for.body.lr.ph
+ br i1 undef, label %for.body3, label %if.end103
+
+for.cond14.preheader: ; preds = %for.inc11
+ br i1 undef, label %for.body16.lr.ph, label %if.end103
+
+for.body16.lr.ph: ; preds = %for.cond14.preheader
+ br label %for.body16
+
+for.body3: ; preds = %for.inc11, %for.end
+ br i1 undef, label %if.then7, label %for.inc11
+
+if.then7: ; preds = %for.body3
+ br label %for.inc11
+
+for.inc11: ; preds = %if.then7, %for.body3
+ br i1 false, label %for.cond14.preheader, label %for.body3
+
+for.body16: ; preds = %for.body16, %for.body16.lr.ph
+ br i1 undef, label %for.end39, label %for.body16
+
+for.end39: ; preds = %for.body16
+ br i1 undef, label %if.end103, label %for.cond45.preheader
+
+for.cond45.preheader: ; preds = %for.end39
+ br i1 undef, label %if.then88, label %if.else
+
+if.then88: ; preds = %for.cond45.preheader
+ %mul89 = fmul double 0.000000e+00, 0.000000e+00
+ %mul90 = fmul double 0.000000e+00, 0.000000e+00
+ %sub91 = fsub double %mul89, %mul90
+ %div92 = fdiv double %sub91, undef
+ %mul94 = fmul double 0.000000e+00, 0.000000e+00
+ %mul95 = fmul double 0.000000e+00, 0.000000e+00
+ %sub96 = fsub double %mul94, %mul95
+ %div97 = fdiv double %sub96, undef
+ br label %if.end103
+
+if.else: ; preds = %for.cond45.preheader
+ br label %if.end103
+
+if.end103: ; preds = %if.else, %if.then88, %for.end39, %for.cond14.preheader, %for.end
+ %0 = phi double [ 0.000000e+00, %for.end39 ], [ %div97, %if.then88 ], [ 0.000000e+00, %if.else ], [ 0.000000e+00, %for.cond14.preheader ], [ 0.000000e+00, %for.end ]
+ %1 = phi double [ undef, %for.end39 ], [ %div92, %if.then88 ], [ undef, %if.else ], [ 0.000000e+00, %for.cond14.preheader ], [ 0.000000e+00, %for.end ]
+ ret void
+}
+
+
+define void @intrapred_luma() {
+entry:
+ %conv153 = trunc i32 undef to i16
+ %arrayidx154 = getelementptr inbounds [13 x i16]* undef, i64 0, i64 12
+ store i16 %conv153, i16* %arrayidx154, align 8
+ %arrayidx155 = getelementptr inbounds [13 x i16]* undef, i64 0, i64 11
+ store i16 %conv153, i16* %arrayidx155, align 2
+ %arrayidx156 = getelementptr inbounds [13 x i16]* undef, i64 0, i64 10
+ store i16 %conv153, i16* %arrayidx156, align 4
+ ret void
+}
+
+define fastcc void @dct36(double* %inbuf) {
+entry:
+ %arrayidx41 = getelementptr inbounds double* %inbuf, i64 2
+ %arrayidx44 = getelementptr inbounds double* %inbuf, i64 1
+ %0 = load double* %arrayidx44, align 8
+ %add46 = fadd double %0, undef
+ store double %add46, double* %arrayidx41, align 8
+ %1 = load double* %inbuf, align 8
+ %add49 = fadd double %1, %0
+ store double %add49, double* %arrayidx44, align 8
+ ret void
+}
diff --git a/test/Transforms/SLPVectorizer/X86/crash_mandeltext.ll b/test/Transforms/SLPVectorizer/X86/crash_mandeltext.ll
new file mode 100644
index 000000000000..d6915e2dc5d6
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/crash_mandeltext.ll
@@ -0,0 +1,107 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
+
+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"
+
+define void @main() {
+entry:
+ br label %for.body
+
+for.body: ; preds = %for.end44, %entry
+ br label %for.cond4.preheader
+
+for.cond4.preheader: ; preds = %if.then25, %for.body
+ br label %for.body6
+
+for.body6: ; preds = %for.inc21, %for.cond4.preheader
+ br label %for.body12
+
+for.body12: ; preds = %if.end, %for.body6
+ %fZImg.069 = phi double [ undef, %for.body6 ], [ %add19, %if.end ]
+ %fZReal.068 = phi double [ undef, %for.body6 ], [ %add20, %if.end ]
+ %mul13 = fmul double %fZReal.068, %fZReal.068
+ %mul14 = fmul double %fZImg.069, %fZImg.069
+ %add15 = fadd double %mul13, %mul14
+ %cmp16 = fcmp ogt double %add15, 4.000000e+00
+ br i1 %cmp16, label %for.inc21, label %if.end
+
+if.end: ; preds = %for.body12
+ %mul18 = fmul double undef, %fZImg.069
+ %add19 = fadd double undef, %mul18
+ %sub = fsub double %mul13, %mul14
+ %add20 = fadd double undef, %sub
+ br i1 undef, label %for.body12, label %for.inc21
+
+for.inc21: ; preds = %if.end, %for.body12
+ br i1 undef, label %for.end23, label %for.body6
+
+for.end23: ; preds = %for.inc21
+ br i1 undef, label %if.then25, label %if.then26
+
+if.then25: ; preds = %for.end23
+ br i1 undef, label %for.end44, label %for.cond4.preheader
+
+if.then26: ; preds = %for.end23
+ unreachable
+
+for.end44: ; preds = %if.then25
+ br i1 undef, label %for.end48, label %for.body
+
+for.end48: ; preds = %for.end44
+ ret void
+}
+
+%struct.hoge = type { double, double, double}
+
+define void @zot(%struct.hoge* %arg) {
+bb:
+ %tmp = load double* undef, align 8
+ %tmp1 = fsub double %tmp, undef
+ %tmp2 = load double* undef, align 8
+ %tmp3 = fsub double %tmp2, undef
+ %tmp4 = fmul double %tmp3, undef
+ %tmp5 = fmul double %tmp3, undef
+ %tmp6 = fsub double %tmp5, undef
+ %tmp7 = getelementptr inbounds %struct.hoge* %arg, i64 0, i32 1
+ store double %tmp6, double* %tmp7, align 8
+ %tmp8 = fmul double %tmp1, undef
+ %tmp9 = fsub double %tmp8, undef
+ %tmp10 = getelementptr inbounds %struct.hoge* %arg, i64 0, i32 2
+ store double %tmp9, double* %tmp10, align 8
+ br i1 undef, label %bb11, label %bb12
+
+bb11: ; preds = %bb
+ br label %bb14
+
+bb12: ; preds = %bb
+ %tmp13 = fmul double undef, %tmp2
+ br label %bb14
+
+bb14: ; preds = %bb12, %bb11
+ ret void
+}
+
+
+%struct.rc4_state.0.24 = type { i32, i32, [256 x i32] }
+
+define void @rc4_crypt(%struct.rc4_state.0.24* nocapture %s) {
+entry:
+ %x1 = getelementptr inbounds %struct.rc4_state.0.24* %s, i64 0, i32 0
+ %y2 = getelementptr inbounds %struct.rc4_state.0.24* %s, i64 0, i32 1
+ br i1 undef, label %for.body, label %for.end
+
+for.body: ; preds = %for.body, %entry
+ %x.045 = phi i32 [ %conv4, %for.body ], [ undef, %entry ]
+ %conv4 = and i32 undef, 255
+ %conv7 = and i32 undef, 255
+ %idxprom842 = zext i32 %conv7 to i64
+ br i1 undef, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ %x.0.lcssa = phi i32 [ undef, %entry ], [ %conv4, %for.body ]
+ %y.0.lcssa = phi i32 [ undef, %entry ], [ %conv7, %for.body ]
+ store i32 %x.0.lcssa, i32* %x1, align 4
+ store i32 %y.0.lcssa, i32* %y2, align 4
+ ret void
+}
+
diff --git a/test/Transforms/SLPVectorizer/X86/crash_netbsd_decompress.ll b/test/Transforms/SLPVectorizer/X86/crash_netbsd_decompress.ll
new file mode 100644
index 000000000000..8da3c34a0279
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/crash_netbsd_decompress.ll
@@ -0,0 +1,41 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
+
+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.DState = type { i32, i32 }
+
+@b = common global %struct.DState zeroinitializer, align 4
+@d = common global i32 0, align 4
+@c = common global i32 0, align 4
+@a = common global i32 0, align 4
+@e = common global i32 0, align 4
+
+define i32 @fn1() {
+entry:
+ %0 = load i32* getelementptr inbounds (%struct.DState* @b, i32 0, i32 0), align 4
+ %1 = load i32* getelementptr inbounds (%struct.DState* @b, i32 0, i32 1), align 4
+ %2 = load i32* @d, align 4
+ %cond = icmp eq i32 %2, 0
+ br i1 %cond, label %sw.bb, label %save_state_and_return
+
+sw.bb: ; preds = %entry
+ %3 = load i32* @c, align 4
+ %and = and i32 %3, 7
+ store i32 %and, i32* @a, align 4
+ switch i32 %and, label %if.end [
+ i32 7, label %save_state_and_return
+ i32 0, label %save_state_and_return
+ ]
+
+if.end: ; preds = %sw.bb
+ br label %save_state_and_return
+
+save_state_and_return: ; preds = %sw.bb, %sw.bb, %if.end, %entry
+ %t.0 = phi i32 [ 0, %if.end ], [ %0, %entry ], [ %0, %sw.bb ], [ %0, %sw.bb ]
+ %f.0 = phi i32 [ 0, %if.end ], [ %1, %entry ], [ 0, %sw.bb ], [ 0, %sw.bb ]
+ store i32 %t.0, i32* getelementptr inbounds (%struct.DState* @b, i32 0, i32 0), align 4
+ store i32 %f.0, i32* getelementptr inbounds (%struct.DState* @b, i32 0, i32 1), align 4
+ ret i32 undef
+}
+
diff --git a/test/Transforms/SLPVectorizer/X86/crash_sim4b1.ll b/test/Transforms/SLPVectorizer/X86/crash_sim4b1.ll
new file mode 100644
index 000000000000..05415456cf0f
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/crash_sim4b1.ll
@@ -0,0 +1,113 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
+
+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._exon_t.12.103.220.363.480.649.740.857.1039.1065.1078.1091.1117.1130.1156.1169.1195.1221.1234.1286.1299.1312.1338.1429.1455.1468.1494.1520.1884.1897.1975.2066.2105.2170.2171 = type { i32, i32, i32, i32, i32, i32, [8 x i8] }
+
+define void @SIM4() {
+entry:
+ br i1 undef, label %return, label %lor.lhs.false
+
+lor.lhs.false: ; preds = %entry
+ br i1 undef, label %return, label %if.end
+
+if.end: ; preds = %lor.lhs.false
+ br i1 undef, label %for.end605, label %for.body.lr.ph
+
+for.body.lr.ph: ; preds = %if.end
+ br label %for.body
+
+for.body: ; preds = %for.inc603, %for.body.lr.ph
+ br i1 undef, label %for.inc603, label %if.end12
+
+if.end12: ; preds = %for.body
+ br i1 undef, label %land.lhs.true, label %land.lhs.true167
+
+land.lhs.true: ; preds = %if.end12
+ br i1 undef, label %if.then17, label %land.lhs.true167
+
+if.then17: ; preds = %land.lhs.true
+ br i1 undef, label %if.end98, label %land.rhs.lr.ph
+
+land.rhs.lr.ph: ; preds = %if.then17
+ unreachable
+
+if.end98: ; preds = %if.then17
+ %from299 = getelementptr inbounds %struct._exon_t.12.103.220.363.480.649.740.857.1039.1065.1078.1091.1117.1130.1156.1169.1195.1221.1234.1286.1299.1312.1338.1429.1455.1468.1494.1520.1884.1897.1975.2066.2105.2170.2171* undef, i64 0, i32 1
+ br i1 undef, label %land.lhs.true167, label %if.then103
+
+if.then103: ; preds = %if.end98
+ %.sub100 = select i1 undef, i32 250, i32 undef
+ %mul114 = shl nsw i32 %.sub100, 2
+ %from1115 = getelementptr inbounds %struct._exon_t.12.103.220.363.480.649.740.857.1039.1065.1078.1091.1117.1130.1156.1169.1195.1221.1234.1286.1299.1312.1338.1429.1455.1468.1494.1520.1884.1897.1975.2066.2105.2170.2171* undef, i64 0, i32 0
+ %cond125 = select i1 undef, i32 undef, i32 %mul114
+ br label %for.cond.i
+
+for.cond.i: ; preds = %land.rhs.i874, %if.then103
+ %row.0.i = phi i32 [ undef, %land.rhs.i874 ], [ %.sub100, %if.then103 ]
+ %col.0.i = phi i32 [ undef, %land.rhs.i874 ], [ %cond125, %if.then103 ]
+ br i1 undef, label %land.rhs.i874, label %for.end.i
+
+land.rhs.i874: ; preds = %for.cond.i
+ br i1 undef, label %for.cond.i, label %for.end.i
+
+for.end.i: ; preds = %land.rhs.i874, %for.cond.i
+ br i1 undef, label %if.then.i, label %if.end.i
+
+if.then.i: ; preds = %for.end.i
+ %add14.i = add nsw i32 %row.0.i, undef
+ %add15.i = add nsw i32 %col.0.i, undef
+ br label %extend_bw.exit
+
+if.end.i: ; preds = %for.end.i
+ %add16.i = add i32 %cond125, %.sub100
+ %cmp26514.i = icmp slt i32 %add16.i, 0
+ br i1 %cmp26514.i, label %for.end33.i, label %for.body28.lr.ph.i
+
+for.body28.lr.ph.i: ; preds = %if.end.i
+ br label %for.end33.i
+
+for.end33.i: ; preds = %for.body28.lr.ph.i, %if.end.i
+ br i1 undef, label %for.end58.i, label %for.body52.lr.ph.i
+
+for.body52.lr.ph.i: ; preds = %for.end33.i
+ br label %for.end58.i
+
+for.end58.i: ; preds = %for.body52.lr.ph.i, %for.end33.i
+ br label %while.cond260.i
+
+while.cond260.i: ; preds = %land.rhs263.i, %for.end58.i
+ br i1 undef, label %land.rhs263.i, label %while.end275.i
+
+land.rhs263.i: ; preds = %while.cond260.i
+ br i1 undef, label %while.cond260.i, label %while.end275.i
+
+while.end275.i: ; preds = %land.rhs263.i, %while.cond260.i
+ br label %extend_bw.exit
+
+extend_bw.exit: ; preds = %while.end275.i, %if.then.i
+ %add14.i1262 = phi i32 [ %add14.i, %if.then.i ], [ undef, %while.end275.i ]
+ %add15.i1261 = phi i32 [ %add15.i, %if.then.i ], [ undef, %while.end275.i ]
+ br i1 false, label %if.then157, label %land.lhs.true167
+
+if.then157: ; preds = %extend_bw.exit
+ %add158 = add nsw i32 %add14.i1262, 1
+ store i32 %add158, i32* %from299, align 4
+ %add160 = add nsw i32 %add15.i1261, 1
+ store i32 %add160, i32* %from1115, align 4
+ br label %land.lhs.true167
+
+land.lhs.true167: ; preds = %if.then157, %extend_bw.exit, %if.end98, %land.lhs.true, %if.end12
+ unreachable
+
+for.inc603: ; preds = %for.body
+ br i1 undef, label %for.body, label %for.end605
+
+for.end605: ; preds = %for.inc603, %if.end
+ unreachable
+
+return: ; preds = %lor.lhs.false, %entry
+ ret void
+}
+
diff --git a/test/Transforms/SLPVectorizer/X86/crash_smallpt.ll b/test/Transforms/SLPVectorizer/X86/crash_smallpt.ll
new file mode 100644
index 000000000000..915c41bb9c59
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/crash_smallpt.ll
@@ -0,0 +1,105 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
+
+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.Ray.5.11.53.113.119.137.149.185.329.389.416 = type { %struct.Vec.0.6.48.108.114.132.144.180.324.384.414, %struct.Vec.0.6.48.108.114.132.144.180.324.384.414 }
+%struct.Vec.0.6.48.108.114.132.144.180.324.384.414 = type { double, double, double }
+
+; Function Attrs: ssp uwtable
+define void @main() #0 {
+entry:
+ br i1 undef, label %cond.true, label %cond.end
+
+cond.true: ; preds = %entry
+ unreachable
+
+cond.end: ; preds = %entry
+ br label %invoke.cont
+
+invoke.cont: ; preds = %invoke.cont, %cond.end
+ br i1 undef, label %arrayctor.cont, label %invoke.cont
+
+arrayctor.cont: ; preds = %invoke.cont
+ %agg.tmp99208.sroa.0.0.idx = getelementptr inbounds %struct.Ray.5.11.53.113.119.137.149.185.329.389.416* undef, i64 0, i32 0, i32 0
+ %agg.tmp99208.sroa.1.8.idx388 = getelementptr inbounds %struct.Ray.5.11.53.113.119.137.149.185.329.389.416* undef, i64 0, i32 0, i32 1
+ %agg.tmp101211.sroa.0.0.idx = getelementptr inbounds %struct.Ray.5.11.53.113.119.137.149.185.329.389.416* undef, i64 0, i32 1, i32 0
+ %agg.tmp101211.sroa.1.8.idx390 = getelementptr inbounds %struct.Ray.5.11.53.113.119.137.149.185.329.389.416* undef, i64 0, i32 1, i32 1
+ br label %for.cond36.preheader
+
+for.cond36.preheader: ; preds = %_Z5clampd.exit.1, %arrayctor.cont
+ br i1 undef, label %for.body42.lr.ph.us, label %_Z5clampd.exit.1
+
+cond.false51.us: ; preds = %for.body42.lr.ph.us
+ unreachable
+
+cond.true48.us: ; preds = %for.body42.lr.ph.us
+ br i1 undef, label %cond.true63.us, label %cond.false66.us
+
+cond.false66.us: ; preds = %cond.true48.us
+ %add.i276.us = fadd double 0.000000e+00, undef
+ %add.i264.us = fadd double %add.i276.us, 0.000000e+00
+ %add4.i267.us = fadd double undef, 0xBFA5CC2D1960285F
+ %mul.i254.us = fmul double %add.i264.us, 1.400000e+02
+ %mul2.i256.us = fmul double %add4.i267.us, 1.400000e+02
+ %add.i243.us = fadd double %mul.i254.us, 5.000000e+01
+ %add4.i246.us = fadd double %mul2.i256.us, 5.200000e+01
+ %mul.i.i.us = fmul double undef, %add.i264.us
+ %mul2.i.i.us = fmul double undef, %add4.i267.us
+ store double %add.i243.us, double* %agg.tmp99208.sroa.0.0.idx, align 8
+ store double %add4.i246.us, double* %agg.tmp99208.sroa.1.8.idx388, align 8
+ store double %mul.i.i.us, double* %agg.tmp101211.sroa.0.0.idx, align 8
+ store double %mul2.i.i.us, double* %agg.tmp101211.sroa.1.8.idx390, align 8
+ unreachable
+
+cond.true63.us: ; preds = %cond.true48.us
+ unreachable
+
+for.body42.lr.ph.us: ; preds = %for.cond36.preheader
+ br i1 undef, label %cond.true48.us, label %cond.false51.us
+
+_Z5clampd.exit.1: ; preds = %for.cond36.preheader
+ br label %for.cond36.preheader
+}
+
+
+%struct.Ray.5.11.53.95.137.191.197.203.239.257.263.269.275.281.287.293.383.437.443.455.461.599.601 = type { %struct.Vec.0.6.48.90.132.186.192.198.234.252.258.264.270.276.282.288.378.432.438.450.456.594.600, %struct.Vec.0.6.48.90.132.186.192.198.234.252.258.264.270.276.282.288.378.432.438.450.456.594.600 }
+%struct.Vec.0.6.48.90.132.186.192.198.234.252.258.264.270.276.282.288.378.432.438.450.456.594.600 = type { double, double, double }
+
+define void @_Z8radianceRK3RayiPt() #0 {
+entry:
+ br i1 undef, label %if.then78, label %if.then38
+
+if.then38: ; preds = %entry
+ %mul.i.i790 = fmul double undef, undef
+ %mul3.i.i792 = fmul double undef, undef
+ %mul.i764 = fmul double undef, %mul3.i.i792
+ %mul4.i767 = fmul double undef, undef
+ %sub.i768 = fsub double %mul.i764, %mul4.i767
+ %mul6.i770 = fmul double undef, %mul.i.i790
+ %mul9.i772 = fmul double undef, %mul3.i.i792
+ %sub10.i773 = fsub double %mul6.i770, %mul9.i772
+ %mul.i736 = fmul double undef, %sub.i768
+ %mul2.i738 = fmul double undef, %sub10.i773
+ %mul.i727 = fmul double undef, %mul.i736
+ %mul2.i729 = fmul double undef, %mul2.i738
+ %add.i716 = fadd double undef, %mul.i727
+ %add4.i719 = fadd double undef, %mul2.i729
+ %add.i695 = fadd double undef, %add.i716
+ %add4.i698 = fadd double undef, %add4.i719
+ %mul.i.i679 = fmul double undef, %add.i695
+ %mul2.i.i680 = fmul double undef, %add4.i698
+ %agg.tmp74663.sroa.0.0.idx = getelementptr inbounds %struct.Ray.5.11.53.95.137.191.197.203.239.257.263.269.275.281.287.293.383.437.443.455.461.599.601* undef, i64 0, i32 1, i32 0
+ store double %mul.i.i679, double* %agg.tmp74663.sroa.0.0.idx, align 8
+ %agg.tmp74663.sroa.1.8.idx943 = getelementptr inbounds %struct.Ray.5.11.53.95.137.191.197.203.239.257.263.269.275.281.287.293.383.437.443.455.461.599.601* undef, i64 0, i32 1, i32 1
+ store double %mul2.i.i680, double* %agg.tmp74663.sroa.1.8.idx943, align 8
+ br label %return
+
+if.then78: ; preds = %entry
+ br label %return
+
+return: ; preds = %if.then78, %if.then38
+ ret void
+}
+
+attributes #0 = { ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/test/Transforms/SLPVectorizer/X86/cross_block_slp.ll b/test/Transforms/SLPVectorizer/X86/cross_block_slp.ll
new file mode 100644
index 000000000000..06c4b524ee95
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/cross_block_slp.ll
@@ -0,0 +1,54 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | 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-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+; int foo(double *A, float *B, int g) {
+; float B0 = B[0];
+; float B1 = B[1]; <----- BasicBlock #1
+; B0 += 5;
+; B1 += 8;
+;
+; if (g) bar();
+;
+; A[0] += B0; <------- BasicBlock #3
+; A[1] += B1;
+; }
+
+
+;CHECK-LABEL: @foo(
+;CHECK: load <2 x float>
+;CHECK: fadd <2 x float>
+;CHECK: call i32
+;CHECK: load <2 x double>
+;CHECK: fadd <2 x double>
+;CHECK: store <2 x double>
+;CHECK: ret
+define i32 @foo(double* nocapture %A, float* nocapture %B, i32 %g) {
+entry:
+ %0 = load float* %B, align 4
+ %arrayidx1 = getelementptr inbounds float* %B, i64 1
+ %1 = load float* %arrayidx1, align 4
+ %add = fadd float %0, 5.000000e+00
+ %add2 = fadd float %1, 8.000000e+00
+ %tobool = icmp eq i32 %g, 0
+ br i1 %tobool, label %if.end, label %if.then
+
+if.then:
+ %call = tail call i32 (...)* @bar()
+ br label %if.end
+
+if.end:
+ %conv = fpext float %add to double
+ %2 = load double* %A, align 8
+ %add4 = fadd double %conv, %2
+ store double %add4, double* %A, align 8
+ %conv5 = fpext float %add2 to double
+ %arrayidx6 = getelementptr inbounds double* %A, i64 1
+ %3 = load double* %arrayidx6, align 8
+ %add7 = fadd double %conv5, %3
+ store double %add7, double* %arrayidx6, align 8
+ ret i32 undef
+}
+
+declare i32 @bar(...)
diff --git a/test/Transforms/SLPVectorizer/X86/cse.ll b/test/Transforms/SLPVectorizer/X86/cse.ll
new file mode 100644
index 000000000000..bbfd6f28ea97
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/cse.ll
@@ -0,0 +1,219 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -S -mtriple=i386-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+
+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-S128"
+target triple = "i386-apple-macosx10.8.0"
+
+;int test(double *G) {
+; G[0] = 1+G[5]*4;
+; G[1] = 6+G[6]*3;
+; G[2] = 7+G[5]*4;
+; G[3] = 8+G[6]*4;
+;}
+
+;CHECK-LABEL: @test(
+;CHECK: load <2 x double>
+;CHECK: fadd <2 x double>
+;CHECK: store <2 x double>
+;CHECK: insertelement <2 x double>
+;CHECK: fadd <2 x double>
+;CHECK: store <2 x double>
+;CHECK: ret i32
+
+define i32 @test(double* nocapture %G) {
+entry:
+ %arrayidx = getelementptr inbounds double* %G, i64 5
+ %0 = load double* %arrayidx, align 8
+ %mul = fmul double %0, 4.000000e+00
+ %add = fadd double %mul, 1.000000e+00
+ store double %add, double* %G, align 8
+ %arrayidx2 = getelementptr inbounds double* %G, i64 6
+ %1 = load double* %arrayidx2, align 8
+ %mul3 = fmul double %1, 3.000000e+00
+ %add4 = fadd double %mul3, 6.000000e+00
+ %arrayidx5 = getelementptr inbounds double* %G, i64 1
+ store double %add4, double* %arrayidx5, align 8
+ %add8 = fadd double %mul, 7.000000e+00
+ %arrayidx9 = getelementptr inbounds double* %G, i64 2
+ store double %add8, double* %arrayidx9, align 8
+ %mul11 = fmul double %1, 4.000000e+00
+ %add12 = fadd double %mul11, 8.000000e+00
+ %arrayidx13 = getelementptr inbounds double* %G, i64 3
+ store double %add12, double* %arrayidx13, align 8
+ ret i32 undef
+}
+
+;int foo(double *A, int n) {
+; A[0] = A[0] * 7.9 * n + 6.0;
+; A[1] = A[1] * 7.7 * n + 2.0;
+; A[2] = A[2] * 7.6 * n + 3.0;
+; A[3] = A[3] * 7.4 * n + 4.0;
+;}
+;CHECK-LABEL: @foo(
+;CHECK: insertelement <2 x double>
+;CHECK: insertelement <2 x double>
+;CHECK-NOT: insertelement <2 x double>
+;CHECK: ret
+define i32 @foo(double* nocapture %A, i32 %n) {
+entry:
+ %0 = load double* %A, align 8
+ %mul = fmul double %0, 7.900000e+00
+ %conv = sitofp i32 %n to double
+ %mul1 = fmul double %conv, %mul
+ %add = fadd double %mul1, 6.000000e+00
+ store double %add, double* %A, align 8
+ %arrayidx3 = getelementptr inbounds double* %A, i64 1
+ %1 = load double* %arrayidx3, align 8
+ %mul4 = fmul double %1, 7.700000e+00
+ %mul6 = fmul double %conv, %mul4
+ %add7 = fadd double %mul6, 2.000000e+00
+ store double %add7, double* %arrayidx3, align 8
+ %arrayidx9 = getelementptr inbounds double* %A, i64 2
+ %2 = load double* %arrayidx9, align 8
+ %mul10 = fmul double %2, 7.600000e+00
+ %mul12 = fmul double %conv, %mul10
+ %add13 = fadd double %mul12, 3.000000e+00
+ store double %add13, double* %arrayidx9, align 8
+ %arrayidx15 = getelementptr inbounds double* %A, i64 3
+ %3 = load double* %arrayidx15, align 8
+ %mul16 = fmul double %3, 7.400000e+00
+ %mul18 = fmul double %conv, %mul16
+ %add19 = fadd double %mul18, 4.000000e+00
+ store double %add19, double* %arrayidx15, align 8
+ ret i32 undef
+}
+
+; int test2(double *G, int k) {
+; if (k) {
+; G[0] = 1+G[5]*4;
+; G[1] = 6+G[6]*3;
+; } else {
+; G[2] = 7+G[5]*4;
+; G[3] = 8+G[6]*3;
+; }
+; }
+
+; We can't merge the gather sequences because one does not dominate the other.
+; CHECK: test2
+; CHECK: insertelement
+; CHECK: insertelement
+; CHECK: insertelement
+; CHECK: insertelement
+; CHECK: ret
+define i32 @test2(double* nocapture %G, i32 %k) {
+ %1 = icmp eq i32 %k, 0
+ %2 = getelementptr inbounds double* %G, i64 5
+ %3 = load double* %2, align 8
+ %4 = fmul double %3, 4.000000e+00
+ br i1 %1, label %12, label %5
+
+; <label>:5 ; preds = %0
+ %6 = fadd double %4, 1.000000e+00
+ store double %6, double* %G, align 8
+ %7 = getelementptr inbounds double* %G, i64 6
+ %8 = load double* %7, align 8
+ %9 = fmul double %8, 3.000000e+00
+ %10 = fadd double %9, 6.000000e+00
+ %11 = getelementptr inbounds double* %G, i64 1
+ store double %10, double* %11, align 8
+ br label %20
+
+; <label>:12 ; preds = %0
+ %13 = fadd double %4, 7.000000e+00
+ %14 = getelementptr inbounds double* %G, i64 2
+ store double %13, double* %14, align 8
+ %15 = getelementptr inbounds double* %G, i64 6
+ %16 = load double* %15, align 8
+ %17 = fmul double %16, 3.000000e+00
+ %18 = fadd double %17, 8.000000e+00
+ %19 = getelementptr inbounds double* %G, i64 3
+ store double %18, double* %19, align 8
+ br label %20
+
+; <label>:20 ; preds = %12, %5
+ ret i32 undef
+}
+
+
+;int foo(double *A, int n) {
+; A[0] = A[0] * 7.9 * n + 6.0;
+; A[1] = A[1] * 7.9 * n + 6.0;
+; A[2] = A[2] * 7.9 * n + 6.0;
+; A[3] = A[3] * 7.9 * n + 6.0;
+;}
+;CHECK-LABEL: @foo4(
+;CHECK: insertelement <2 x double>
+;CHECK: insertelement <2 x double>
+;CHECK-NOT: insertelement <2 x double>
+;CHECK: ret
+define i32 @foo4(double* nocapture %A, i32 %n) {
+entry:
+ %0 = load double* %A, align 8
+ %mul = fmul double %0, 7.900000e+00
+ %conv = sitofp i32 %n to double
+ %mul1 = fmul double %conv, %mul
+ %add = fadd double %mul1, 6.000000e+00
+ store double %add, double* %A, align 8
+ %arrayidx3 = getelementptr inbounds double* %A, i64 1
+ %1 = load double* %arrayidx3, align 8
+ %mul4 = fmul double %1, 7.900000e+00
+ %mul6 = fmul double %conv, %mul4
+ %add7 = fadd double %mul6, 6.000000e+00
+ store double %add7, double* %arrayidx3, align 8
+ %arrayidx9 = getelementptr inbounds double* %A, i64 2
+ %2 = load double* %arrayidx9, align 8
+ %mul10 = fmul double %2, 7.900000e+00
+ %mul12 = fmul double %conv, %mul10
+ %add13 = fadd double %mul12, 6.000000e+00
+ store double %add13, double* %arrayidx9, align 8
+ %arrayidx15 = getelementptr inbounds double* %A, i64 3
+ %3 = load double* %arrayidx15, align 8
+ %mul16 = fmul double %3, 7.900000e+00
+ %mul18 = fmul double %conv, %mul16
+ %add19 = fadd double %mul18, 6.000000e+00
+ store double %add19, double* %arrayidx15, align 8
+ ret i32 undef
+}
+
+;int partial_mrg(double *A, int n) {
+; A[0] = A[0] * n;
+; A[1] = A[1] * n;
+; if (n < 4) return 0;
+; A[2] = A[2] * n;
+; A[3] = A[3] * (n+4);
+;}
+;CHECK-LABEL: @partial_mrg(
+;CHECK: insertelement <2 x double>
+;CHECK: insertelement <2 x double>
+;CHECK: insertelement <2 x double>
+;CHECK-NOT: insertelement <2 x double>
+;CHECK: ret
+define i32 @partial_mrg(double* nocapture %A, i32 %n) {
+entry:
+ %0 = load double* %A, align 8
+ %conv = sitofp i32 %n to double
+ %mul = fmul double %conv, %0
+ store double %mul, double* %A, align 8
+ %arrayidx2 = getelementptr inbounds double* %A, i64 1
+ %1 = load double* %arrayidx2, align 8
+ %mul4 = fmul double %conv, %1
+ store double %mul4, double* %arrayidx2, align 8
+ %cmp = icmp slt i32 %n, 4
+ br i1 %cmp, label %return, label %if.end
+
+if.end: ; preds = %entry
+ %arrayidx7 = getelementptr inbounds double* %A, i64 2
+ %2 = load double* %arrayidx7, align 8
+ %mul9 = fmul double %conv, %2
+ store double %mul9, double* %arrayidx7, align 8
+ %arrayidx11 = getelementptr inbounds double* %A, i64 3
+ %3 = load double* %arrayidx11, align 8
+ %add = add nsw i32 %n, 4
+ %conv12 = sitofp i32 %add to double
+ %mul13 = fmul double %conv12, %3
+ store double %mul13, double* %arrayidx11, align 8
+ br label %return
+
+return: ; preds = %entry, %if.end
+ ret i32 0
+}
+
diff --git a/test/Transforms/SLPVectorizer/X86/cycle_dup.ll b/test/Transforms/SLPVectorizer/X86/cycle_dup.ll
new file mode 100644
index 000000000000..fba35499fb7d
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/cycle_dup.ll
@@ -0,0 +1,64 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | 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-S128"
+target triple = "x86_64-apple-macosx10.9.0"
+
+; int foo(int *A) {
+; int r = A[0], g = A[1], b = A[2], a = A[3];
+; for (int i=0; i < A[13]; i++) {
+; r*=18; g*=19; b*=12; a *=9;
+; }
+; A[0] = r; A[1] = g; A[2] = b; A[3] = a;
+; }
+
+;CHECK-LABEL: @foo
+;CHECK: bitcast i32* %A to <4 x i32>*
+;CHECK-NEXT: load <4 x i32>
+;CHECK: phi <4 x i32>
+;CHECK-NEXT: mul <4 x i32>
+;CHECK-NOT: mul
+;CHECK: phi <4 x i32>
+;CHECK: bitcast i32* %A to <4 x i32>*
+;CHECK-NEXT: store <4 x i32>
+;CHECK-NEXT:ret i32 undef
+define i32 @foo(i32* nocapture %A) #0 {
+entry:
+ %0 = load i32* %A, align 4
+ %arrayidx1 = getelementptr inbounds i32* %A, i64 1
+ %1 = load i32* %arrayidx1, align 4
+ %arrayidx2 = getelementptr inbounds i32* %A, i64 2
+ %2 = load i32* %arrayidx2, align 4
+ %arrayidx3 = getelementptr inbounds i32* %A, i64 3
+ %3 = load i32* %arrayidx3, align 4
+ %arrayidx4 = getelementptr inbounds i32* %A, i64 13
+ %4 = load i32* %arrayidx4, align 4
+ %cmp24 = icmp sgt i32 %4, 0
+ br i1 %cmp24, label %for.body, label %for.end
+
+for.body: ; preds = %entry, %for.body
+ %i.029 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
+ %a.028 = phi i32 [ %mul7, %for.body ], [ %3, %entry ]
+ %b.027 = phi i32 [ %mul6, %for.body ], [ %2, %entry ]
+ %g.026 = phi i32 [ %mul5, %for.body ], [ %1, %entry ]
+ %r.025 = phi i32 [ %mul, %for.body ], [ %0, %entry ]
+ %mul = mul nsw i32 %r.025, 18
+ %mul5 = mul nsw i32 %g.026, 19
+ %mul6 = mul nsw i32 %b.027, 12
+ %mul7 = mul nsw i32 %a.028, 9
+ %inc = add nsw i32 %i.029, 1
+ %cmp = icmp slt i32 %inc, %4
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end: ; preds = %for.body, %entry
+ %a.0.lcssa = phi i32 [ %3, %entry ], [ %mul7, %for.body ]
+ %b.0.lcssa = phi i32 [ %2, %entry ], [ %mul6, %for.body ]
+ %g.0.lcssa = phi i32 [ %1, %entry ], [ %mul5, %for.body ]
+ %r.0.lcssa = phi i32 [ %0, %entry ], [ %mul, %for.body ]
+ store i32 %r.0.lcssa, i32* %A, align 4
+ store i32 %g.0.lcssa, i32* %arrayidx1, align 4
+ store i32 %b.0.lcssa, i32* %arrayidx2, align 4
+ store i32 %a.0.lcssa, i32* %arrayidx3, align 4
+ ret i32 undef
+}
+
+
diff --git a/test/Transforms/SLPVectorizer/X86/debug_info.ll b/test/Transforms/SLPVectorizer/X86/debug_info.ll
new file mode 100644
index 000000000000..f4e68f217f25
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/debug_info.ll
@@ -0,0 +1,89 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | 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-S128"
+target triple = "x86_64-apple-macosx10.7.0"
+
+; int depth(double *A, int m) {
+; double y0 = 0; double y1 = 1;
+; for (int i=0; i < m; i++) {
+; y0 = A[4];
+; y1 = A[5];
+; }
+; A[8] = y0; A[8+1] = y1;
+; }
+
+;CHECK: @depth
+;CHECK: getelementptr inbounds {{.*}}, !dbg ![[LOC:[0-9]+]]
+;CHECK: bitcast double* {{.*}}, !dbg ![[LOC]]
+;CHECK: load <2 x double>* {{.*}}, !dbg ![[LOC]]
+;CHECK: store <2 x double> {{.*}}, !dbg ![[LOC2:[0-9]+]]
+;CHECK: ret
+;CHECK: ![[LOC]] = metadata !{i32 4, i32 0,
+;CHECK: ![[LOC2]] = metadata !{i32 7, i32 0,
+
+define i32 @depth(double* nocapture %A, i32 %m) #0 {
+entry:
+ tail call void @llvm.dbg.value(metadata !{double* %A}, i64 0, metadata !12), !dbg !19
+ tail call void @llvm.dbg.value(metadata !{i32 %m}, i64 0, metadata !13), !dbg !19
+ tail call void @llvm.dbg.value(metadata !20, i64 0, metadata !14), !dbg !21
+ tail call void @llvm.dbg.value(metadata !22, i64 0, metadata !15), !dbg !21
+ tail call void @llvm.dbg.value(metadata !2, i64 0, metadata !16), !dbg !23
+ %cmp8 = icmp sgt i32 %m, 0, !dbg !23
+ br i1 %cmp8, label %for.body.lr.ph, label %for.end, !dbg !23
+
+for.body.lr.ph: ; preds = %entry
+ %arrayidx = getelementptr inbounds double* %A, i64 4, !dbg !24
+ %0 = load double* %arrayidx, align 8, !dbg !24
+ %arrayidx1 = getelementptr inbounds double* %A, i64 5, !dbg !29
+ %1 = load double* %arrayidx1, align 8, !dbg !29
+ br label %for.end, !dbg !23
+
+for.end: ; preds = %for.body.lr.ph, %entry
+ %y1.0.lcssa = phi double [ %1, %for.body.lr.ph ], [ 1.000000e+00, %entry ]
+ %y0.0.lcssa = phi double [ %0, %for.body.lr.ph ], [ 0.000000e+00, %entry ]
+ %arrayidx2 = getelementptr inbounds double* %A, i64 8, !dbg !30
+ store double %y0.0.lcssa, double* %arrayidx2, align 8, !dbg !30
+ %arrayidx3 = getelementptr inbounds double* %A, i64 9, !dbg !30
+ store double %y1.0.lcssa, double* %arrayidx3, align 8, !dbg !30
+ ret i32 undef, !dbg !31
+}
+
+; Function Attrs: nounwind readnone
+declare void @llvm.dbg.value(metadata, i64, metadata) #1
+
+attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nounwind readnone }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!18, !32}
+
+!0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.4 (trunk 187335) (llvm/trunk 187335:187340M)", i1 true, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [/Users/nadav/file.c] [DW_LANG_C99]
+!1 = metadata !{metadata !"file.c", metadata !"/Users/nadav"}
+!2 = metadata !{i32 0}
+!3 = metadata !{metadata !4}
+!4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"depth", metadata !"depth", metadata !"", i32 1, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i32 (double*, i32)* @depth, null, null, metadata !11, i32 1} ; [ DW_TAG_subprogram ] [line 1] [def] [depth]
+!5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/Users/nadav/file.c]
+!6 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
+!7 = metadata !{metadata !8, metadata !9, metadata !8}
+!8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
+!9 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !10} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from double]
+!10 = metadata !{i32 786468, null, null, metadata !"double", i32 0, i64 64, i64 64, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ] [double] [line 0, size 64, align 64, offset 0, enc DW_ATE_float]
+!11 = metadata !{metadata !12, metadata !13, metadata !14, metadata !15, metadata !16}
+!12 = metadata !{i32 786689, metadata !4, metadata !"A", metadata !5, i32 16777217, metadata !9, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [A] [line 1]
+!13 = metadata !{i32 786689, metadata !4, metadata !"m", metadata !5, i32 33554433, metadata !8, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [m] [line 1]
+!14 = metadata !{i32 786688, metadata !4, metadata !"y0", metadata !5, i32 2, metadata !10, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [y0] [line 2]
+!15 = metadata !{i32 786688, metadata !4, metadata !"y1", metadata !5, i32 2, metadata !10, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [y1] [line 2]
+!16 = metadata !{i32 786688, metadata !17, metadata !"i", metadata !5, i32 3, metadata !8, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [i] [line 3]
+!17 = metadata !{i32 786443, metadata !1, metadata !4, i32 3, i32 0, i32 0} ; [ DW_TAG_lexical_block ] [/Users/nadav/file.c]
+!18 = metadata !{i32 2, metadata !"Dwarf Version", i32 2}
+!19 = metadata !{i32 1, i32 0, metadata !4, null}
+!20 = metadata !{double 0.000000e+00}
+!21 = metadata !{i32 2, i32 0, metadata !4, null}
+!22 = metadata !{double 1.000000e+00}
+!23 = metadata !{i32 3, i32 0, metadata !17, null}
+!24 = metadata !{i32 4, i32 0, metadata !25, null}
+!25 = metadata !{i32 786443, metadata !1, metadata !17, i32 3, i32 0, i32 1} ; [ DW_TAG_lexical_block ] [/Users/nadav/file.c]
+!29 = metadata !{i32 5, i32 0, metadata !25, null}
+!30 = metadata !{i32 7, i32 0, metadata !4, null}
+!31 = metadata !{i32 8, i32 0, metadata !4, null} ; [ DW_TAG_imported_declaration ]
+!32 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/SLPVectorizer/X86/diamond.ll b/test/Transforms/SLPVectorizer/X86/diamond.ll
index 8e85cb6c9b8f..5135a92a7bdb 100644
--- a/test/Transforms/SLPVectorizer/X86/diamond.ll
+++ b/test/Transforms/SLPVectorizer/X86/diamond.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+; RUN: opt < %s -basicaa -slp-vectorizer -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | 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-S128"
target triple = "x86_64-apple-macosx10.8.0"
@@ -11,7 +11,7 @@ target triple = "x86_64-apple-macosx10.8.0"
; return 0;
; }
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK: load <4 x i32>
; CHECK: mul <4 x i32>
; CHECK: store <4 x i32>
@@ -41,7 +41,7 @@ entry:
}
-; int foo_fail(int * restrict B, int * restrict A, int n, int m) {
+; int extr_user(int * restrict B, int * restrict A, int n, int m) {
; B[0] = n * A[0] + m * A[0];
; B[1] = n * A[1] + m * A[1];
; B[2] = n * A[2] + m * A[2];
@@ -49,10 +49,12 @@ entry:
; return A[0];
; }
-; CHECK: @foo_fail
-; CHECK-NOT: load <4 x i32>
-; CHECK: ret
-define i32 @foo_fail(i32* noalias nocapture %B, i32* noalias nocapture %A, i32 %n, i32 %m) {
+; CHECK-LABEL: @extr_user(
+; CHECK: load <4 x i32>
+; CHECK: store <4 x i32>
+; CHECK: extractelement <4 x i32>
+; CHECK-NEXT: ret
+define i32 @extr_user(i32* noalias nocapture %B, i32* noalias nocapture %A, i32 %n, i32 %m) {
entry:
%0 = load i32* %A, align 4
%mul238 = add i32 %m, %n
@@ -73,6 +75,35 @@ entry:
%add20 = mul i32 %3, %mul238
%arrayidx21 = getelementptr inbounds i32* %B, i64 3
store i32 %add20, i32* %arrayidx21, align 4
- ret i32 %0 ;<--------- This value has multiple users and can't be vectorized.
+ ret i32 %0 ;<--------- This value has multiple users
}
+; In this example we have an external user that is not the first element in the vector.
+; CHECK-LABEL: @extr_user1(
+; CHECK: load <4 x i32>
+; CHECK: store <4 x i32>
+; CHECK: extractelement <4 x i32>
+; CHECK-NEXT: ret
+define i32 @extr_user1(i32* noalias nocapture %B, i32* noalias nocapture %A, i32 %n, i32 %m) {
+entry:
+ %0 = load i32* %A, align 4
+ %mul238 = add i32 %m, %n
+ %add = mul i32 %0, %mul238
+ store i32 %add, i32* %B, align 4
+ %arrayidx4 = getelementptr inbounds i32* %A, i64 1
+ %1 = load i32* %arrayidx4, align 4
+ %add8 = mul i32 %1, %mul238
+ %arrayidx9 = getelementptr inbounds i32* %B, i64 1
+ store i32 %add8, i32* %arrayidx9, align 4
+ %arrayidx10 = getelementptr inbounds i32* %A, i64 2
+ %2 = load i32* %arrayidx10, align 4
+ %add14 = mul i32 %2, %mul238
+ %arrayidx15 = getelementptr inbounds i32* %B, i64 2
+ store i32 %add14, i32* %arrayidx15, align 4
+ %arrayidx16 = getelementptr inbounds i32* %A, i64 3
+ %3 = load i32* %arrayidx16, align 4
+ %add20 = mul i32 %3, %mul238
+ %arrayidx21 = getelementptr inbounds i32* %B, i64 3
+ store i32 %add20, i32* %arrayidx21, align 4
+ ret i32 %1 ;<--------- This value has multiple users
+}
diff --git a/test/Transforms/SLPVectorizer/X86/external_user.ll b/test/Transforms/SLPVectorizer/X86/external_user.ll
new file mode 100644
index 000000000000..6d09aa61bf35
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/external_user.ll
@@ -0,0 +1,96 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | 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-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+; double foo(double * restrict b, double * restrict a, int n, int m) {
+; double r=a[1];
+; double g=a[0];
+; double x;
+; for (int i=0; i < 100; i++) {
+; r += 10;
+; g += 10;
+; r *= 4;
+; g *= 4;
+; x = g; <----- external user!
+; r += 4;
+; g += 4;
+; }
+; b[0] = g;
+; b[1] = r;
+;
+; return x; <-- must extract here!
+; }
+
+;CHECK: ext_user
+;CHECK: phi <2 x double>
+;CHECK: fadd <2 x double>
+;CHECK: fmul <2 x double>
+;CHECK: br
+;CHECK: store <2 x double>
+;CHECK: extractelement <2 x double>
+;CHECK: ret double
+
+define double @ext_user(double* noalias nocapture %B, double* noalias nocapture %A, i32 %n, i32 %m) {
+entry:
+ %arrayidx = getelementptr inbounds double* %A, i64 1
+ %0 = load double* %arrayidx, align 8
+ %1 = load double* %A, align 8
+ br label %for.body
+
+for.body: ; preds = %for.body, %entry
+ %i.020 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+ %G.019 = phi double [ %1, %entry ], [ %add5, %for.body ]
+ %R.018 = phi double [ %0, %entry ], [ %add4, %for.body ]
+ %add = fadd double %R.018, 1.000000e+01
+ %add2 = fadd double %G.019, 1.000000e+01
+ %mul = fmul double %add, 4.000000e+00
+ %mul3 = fmul double %add2, 4.000000e+00
+ %add4 = fadd double %mul, 4.000000e+00
+ %add5 = fadd double %mul3, 4.000000e+00
+ %inc = add nsw i32 %i.020, 1
+ %exitcond = icmp eq i32 %inc, 100
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body
+ store double %add5, double* %B, align 8
+ %arrayidx7 = getelementptr inbounds double* %B, i64 1
+ store double %add4, double* %arrayidx7, align 8
+ ret double %mul3
+}
+
+; A need-to-gather entry cannot be an external use of the scalar element.
+; Instead the insertelement instructions of the need-to-gather entry are the
+; external users.
+; This test would assert because we would keep the scalar fpext and fadd alive.
+; PR18129
+
+; CHECK-LABEL: needtogather
+define i32 @needtogather(double *noalias %a, i32 *noalias %b, float * noalias %c,
+ i32 * noalias %d) {
+entry:
+ %0 = load i32* %d, align 4
+ %conv = sitofp i32 %0 to float
+ %1 = load float* %c
+ %sub = fsub float 0.000000e+00, %1
+ %mul = fmul float %sub, 0.000000e+00
+ %add = fadd float %conv, %mul
+ %conv1 = fpext float %add to double
+ %sub3 = fsub float 1.000000e+00, %1
+ %mul4 = fmul float %sub3, 0.000000e+00
+ %add5 = fadd float %conv, %mul4
+ %conv6 = fpext float %add5 to double
+ %tobool = fcmp une float %add, 0.000000e+00
+ br i1 %tobool, label %if.then, label %if.end
+
+if.then:
+ br label %if.end
+
+if.end:
+ %storemerge = phi double [ %conv6, %if.then ], [ %conv1, %entry ]
+ %e.0 = phi double [ %conv1, %if.then ], [ %conv6, %entry ]
+ store double %storemerge, double* %a, align 8
+ %conv7 = fptosi double %e.0 to i32
+ store i32 %conv7, i32* %b, align 4
+ ret i32 undef
+}
diff --git a/test/Transforms/SLPVectorizer/X86/extract.ll b/test/Transforms/SLPVectorizer/X86/extract.ll
new file mode 100644
index 000000000000..f611fd4ec24f
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/extract.ll
@@ -0,0 +1,59 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | 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-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+;CHECK: fextr
+;CHECK-NOT: insertelement
+;CHECK-NOT: extractelement
+;CHECK: fadd <2 x double>
+;CHECK: ret void
+define void @fextr(double* %ptr) {
+entry:
+ %LD = load <2 x double>* undef
+ %V0 = extractelement <2 x double> %LD, i32 0
+ %V1 = extractelement <2 x double> %LD, i32 1
+ %P0 = getelementptr inbounds double* %ptr, i64 0
+ %P1 = getelementptr inbounds double* %ptr, i64 1
+ %A0 = fadd double %V0, 0.0
+ %A1 = fadd double %V1, 1.1
+ store double %A0, double* %P0, align 4
+ store double %A1, double* %P1, align 4
+ ret void
+}
+
+;CHECK: fextr1
+;CHECK: insertelement
+;CHECK: insertelement
+;CHECK: ret void
+define void @fextr1(double* %ptr) {
+entry:
+ %LD = load <2 x double>* undef
+ %V0 = extractelement <2 x double> %LD, i32 0
+ %V1 = extractelement <2 x double> %LD, i32 1
+ %P0 = getelementptr inbounds double* %ptr, i64 1 ; <--- incorrect order
+ %P1 = getelementptr inbounds double* %ptr, i64 0
+ %A0 = fadd double %V0, 1.2
+ %A1 = fadd double %V1, 3.4
+ store double %A0, double* %P0, align 4
+ store double %A1, double* %P1, align 4
+ ret void
+}
+
+;CHECK: fextr2
+;CHECK: insertelement
+;CHECK: insertelement
+;CHECK: ret void
+define void @fextr2(double* %ptr) {
+entry:
+ %LD = load <4 x double>* undef
+ %V0 = extractelement <4 x double> %LD, i32 0 ; <--- invalid size.
+ %V1 = extractelement <4 x double> %LD, i32 1
+ %P0 = getelementptr inbounds double* %ptr, i64 0
+ %P1 = getelementptr inbounds double* %ptr, i64 1
+ %A0 = fadd double %V0, 5.5
+ %A1 = fadd double %V1, 6.6
+ store double %A0, double* %P0, align 4
+ store double %A1, double* %P1, align 4
+ ret void
+}
+
diff --git a/test/Transforms/SLPVectorizer/X86/horizontal.ll b/test/Transforms/SLPVectorizer/X86/horizontal.ll
new file mode 100644
index 000000000000..8f919512ff8d
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/horizontal.ll
@@ -0,0 +1,417 @@
+; RUN: opt -slp-vectorizer -slp-vectorize-hor -S < %s -mtriple=x86_64-apple-macosx -mcpu=corei7-avx | FileCheck %s --check-prefix=NOSTORE
+
+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"
+
+; #include <stdint.h>
+;
+; int foo(float *A, int n) {
+; float sum = 0;
+; for (intptr_t i=0; i < n; ++i) {
+; sum += 7*A[i*4 ] +
+; 7*A[i*4+1] +
+; 7*A[i*4+2] +
+; 7*A[i*4+3];
+; }
+; return sum;
+; }
+
+; NOSTORE-LABEL: add_red
+; NOSTORE: fmul <4 x float>
+; NOSTORE: shufflevector <4 x float>
+
+define i32 @add_red(float* %A, i32 %n) {
+entry:
+ %cmp31 = icmp sgt i32 %n, 0
+ br i1 %cmp31, label %for.body.lr.ph, label %for.end
+
+for.body.lr.ph:
+ %0 = sext i32 %n to i64
+ br label %for.body
+
+for.body:
+ %i.033 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
+ %sum.032 = phi float [ 0.000000e+00, %for.body.lr.ph ], [ %add17, %for.body ]
+ %mul = shl nsw i64 %i.033, 2
+ %arrayidx = getelementptr inbounds float* %A, i64 %mul
+ %1 = load float* %arrayidx, align 4
+ %mul2 = fmul float %1, 7.000000e+00
+ %add28 = or i64 %mul, 1
+ %arrayidx4 = getelementptr inbounds float* %A, i64 %add28
+ %2 = load float* %arrayidx4, align 4
+ %mul5 = fmul float %2, 7.000000e+00
+ %add6 = fadd fast float %mul2, %mul5
+ %add829 = or i64 %mul, 2
+ %arrayidx9 = getelementptr inbounds float* %A, i64 %add829
+ %3 = load float* %arrayidx9, align 4
+ %mul10 = fmul float %3, 7.000000e+00
+ %add11 = fadd fast float %add6, %mul10
+ %add1330 = or i64 %mul, 3
+ %arrayidx14 = getelementptr inbounds float* %A, i64 %add1330
+ %4 = load float* %arrayidx14, align 4
+ %mul15 = fmul float %4, 7.000000e+00
+ %add16 = fadd fast float %add11, %mul15
+ %add17 = fadd fast float %sum.032, %add16
+ %inc = add nsw i64 %i.033, 1
+ %exitcond = icmp eq i64 %inc, %0
+ br i1 %exitcond, label %for.cond.for.end_crit_edge, label %for.body
+
+for.cond.for.end_crit_edge:
+ %phitmp = fptosi float %add17 to i32
+ br label %for.end
+
+for.end:
+ %sum.0.lcssa = phi i32 [ %phitmp, %for.cond.for.end_crit_edge ], [ 0, %entry ]
+ ret i32 %sum.0.lcssa
+}
+
+; int foo(float * restrict A, float * restrict B, int n) {
+; float sum = 0;
+; for (intptr_t i=0; i < n; ++i) {
+; sum *= B[0]*A[i*4 ] +
+; B[1]*A[i*4+1] +
+; B[2]*A[i*4+2] +
+; B[3]*A[i*4+3];
+; }
+; return sum;
+; }
+
+; CHECK-LABEL: mul_red
+; CHECK: fmul <4 x float>
+; CHECK: shufflevector <4 x float>
+
+define i32 @mul_red(float* noalias %A, float* noalias %B, i32 %n) {
+entry:
+ %cmp38 = icmp sgt i32 %n, 0
+ br i1 %cmp38, label %for.body.lr.ph, label %for.end
+
+for.body.lr.ph:
+ %0 = load float* %B, align 4
+ %arrayidx4 = getelementptr inbounds float* %B, i64 1
+ %1 = load float* %arrayidx4, align 4
+ %arrayidx9 = getelementptr inbounds float* %B, i64 2
+ %2 = load float* %arrayidx9, align 4
+ %arrayidx15 = getelementptr inbounds float* %B, i64 3
+ %3 = load float* %arrayidx15, align 4
+ %4 = sext i32 %n to i64
+ br label %for.body
+
+for.body:
+ %i.040 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
+ %sum.039 = phi float [ 0.000000e+00, %for.body.lr.ph ], [ %mul21, %for.body ]
+ %mul = shl nsw i64 %i.040, 2
+ %arrayidx2 = getelementptr inbounds float* %A, i64 %mul
+ %5 = load float* %arrayidx2, align 4
+ %mul3 = fmul float %0, %5
+ %add35 = or i64 %mul, 1
+ %arrayidx6 = getelementptr inbounds float* %A, i64 %add35
+ %6 = load float* %arrayidx6, align 4
+ %mul7 = fmul float %1, %6
+ %add8 = fadd fast float %mul3, %mul7
+ %add1136 = or i64 %mul, 2
+ %arrayidx12 = getelementptr inbounds float* %A, i64 %add1136
+ %7 = load float* %arrayidx12, align 4
+ %mul13 = fmul float %2, %7
+ %add14 = fadd fast float %add8, %mul13
+ %add1737 = or i64 %mul, 3
+ %arrayidx18 = getelementptr inbounds float* %A, i64 %add1737
+ %8 = load float* %arrayidx18, align 4
+ %mul19 = fmul float %3, %8
+ %add20 = fadd fast float %add14, %mul19
+ %mul21 = fmul float %sum.039, %add20
+ %inc = add nsw i64 %i.040, 1
+ %exitcond = icmp eq i64 %inc, %4
+ br i1 %exitcond, label %for.cond.for.end_crit_edge, label %for.body
+
+for.cond.for.end_crit_edge:
+ %phitmp = fptosi float %mul21 to i32
+ br label %for.end
+
+for.end:
+ %sum.0.lcssa = phi i32 [ %phitmp, %for.cond.for.end_crit_edge ], [ 0, %entry ]
+ ret i32 %sum.0.lcssa
+}
+
+; int foo(float * restrict A, float * restrict B, int n) {
+; float sum = 0;
+; for (intptr_t i=0; i < n; ++i) {
+; sum += B[0]*A[i*6 ] +
+; B[1]*A[i*6+1] +
+; B[2]*A[i*6+2] +
+; B[3]*A[i*6+3] +
+; B[4]*A[i*6+4] +
+; B[5]*A[i*6+5] +
+; B[6]*A[i*6+6] +
+; B[7]*A[i*6+7] +
+; B[8]*A[i*6+8];
+; }
+; return sum;
+; }
+
+; CHECK-LABEL: long_red
+; CHECK: fmul <4 x float>
+; CHECK: shufflevector <4 x float>
+
+define i32 @long_red(float* noalias %A, float* noalias %B, i32 %n) {
+entry:
+ %cmp81 = icmp sgt i32 %n, 0
+ br i1 %cmp81, label %for.body.lr.ph, label %for.end
+
+for.body.lr.ph:
+ %0 = load float* %B, align 4
+ %arrayidx4 = getelementptr inbounds float* %B, i64 1
+ %1 = load float* %arrayidx4, align 4
+ %arrayidx9 = getelementptr inbounds float* %B, i64 2
+ %2 = load float* %arrayidx9, align 4
+ %arrayidx15 = getelementptr inbounds float* %B, i64 3
+ %3 = load float* %arrayidx15, align 4
+ %arrayidx21 = getelementptr inbounds float* %B, i64 4
+ %4 = load float* %arrayidx21, align 4
+ %arrayidx27 = getelementptr inbounds float* %B, i64 5
+ %5 = load float* %arrayidx27, align 4
+ %arrayidx33 = getelementptr inbounds float* %B, i64 6
+ %6 = load float* %arrayidx33, align 4
+ %arrayidx39 = getelementptr inbounds float* %B, i64 7
+ %7 = load float* %arrayidx39, align 4
+ %arrayidx45 = getelementptr inbounds float* %B, i64 8
+ %8 = load float* %arrayidx45, align 4
+ %9 = sext i32 %n to i64
+ br label %for.body
+
+for.body:
+ %i.083 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
+ %sum.082 = phi float [ 0.000000e+00, %for.body.lr.ph ], [ %add51, %for.body ]
+ %mul = mul nsw i64 %i.083, 6
+ %arrayidx2 = getelementptr inbounds float* %A, i64 %mul
+ %10 = load float* %arrayidx2, align 4
+ %mul3 = fmul fast float %0, %10
+ %add80 = or i64 %mul, 1
+ %arrayidx6 = getelementptr inbounds float* %A, i64 %add80
+ %11 = load float* %arrayidx6, align 4
+ %mul7 = fmul fast float %1, %11
+ %add8 = fadd fast float %mul3, %mul7
+ %add11 = add nsw i64 %mul, 2
+ %arrayidx12 = getelementptr inbounds float* %A, i64 %add11
+ %12 = load float* %arrayidx12, align 4
+ %mul13 = fmul fast float %2, %12
+ %add14 = fadd fast float %add8, %mul13
+ %add17 = add nsw i64 %mul, 3
+ %arrayidx18 = getelementptr inbounds float* %A, i64 %add17
+ %13 = load float* %arrayidx18, align 4
+ %mul19 = fmul fast float %3, %13
+ %add20 = fadd fast float %add14, %mul19
+ %add23 = add nsw i64 %mul, 4
+ %arrayidx24 = getelementptr inbounds float* %A, i64 %add23
+ %14 = load float* %arrayidx24, align 4
+ %mul25 = fmul fast float %4, %14
+ %add26 = fadd fast float %add20, %mul25
+ %add29 = add nsw i64 %mul, 5
+ %arrayidx30 = getelementptr inbounds float* %A, i64 %add29
+ %15 = load float* %arrayidx30, align 4
+ %mul31 = fmul fast float %5, %15
+ %add32 = fadd fast float %add26, %mul31
+ %add35 = add nsw i64 %mul, 6
+ %arrayidx36 = getelementptr inbounds float* %A, i64 %add35
+ %16 = load float* %arrayidx36, align 4
+ %mul37 = fmul fast float %6, %16
+ %add38 = fadd fast float %add32, %mul37
+ %add41 = add nsw i64 %mul, 7
+ %arrayidx42 = getelementptr inbounds float* %A, i64 %add41
+ %17 = load float* %arrayidx42, align 4
+ %mul43 = fmul fast float %7, %17
+ %add44 = fadd fast float %add38, %mul43
+ %add47 = add nsw i64 %mul, 8
+ %arrayidx48 = getelementptr inbounds float* %A, i64 %add47
+ %18 = load float* %arrayidx48, align 4
+ %mul49 = fmul fast float %8, %18
+ %add50 = fadd fast float %add44, %mul49
+ %add51 = fadd fast float %sum.082, %add50
+ %inc = add nsw i64 %i.083, 1
+ %exitcond = icmp eq i64 %inc, %9
+ br i1 %exitcond, label %for.cond.for.end_crit_edge, label %for.body
+
+for.cond.for.end_crit_edge:
+ %phitmp = fptosi float %add51 to i32
+ br label %for.end
+
+for.end:
+ %sum.0.lcssa = phi i32 [ %phitmp, %for.cond.for.end_crit_edge ], [ 0, %entry ]
+ ret i32 %sum.0.lcssa
+}
+
+; int foo(float * restrict A, float * restrict B, int n) {
+; float sum = 0;
+; for (intptr_t i=0; i < n; ++i) {
+; sum += B[0]*A[i*4 ];
+; sum += B[1]*A[i*4+1];
+; sum += B[2]*A[i*4+2];
+; sum += B[3]*A[i*4+3];
+; }
+; return sum;
+; }
+
+; CHECK-LABEL: chain_red
+; CHECK: fmul <4 x float>
+; CHECK: shufflevector <4 x float>
+
+define i32 @chain_red(float* noalias %A, float* noalias %B, i32 %n) {
+entry:
+ %cmp41 = icmp sgt i32 %n, 0
+ br i1 %cmp41, label %for.body.lr.ph, label %for.end
+
+for.body.lr.ph:
+ %0 = load float* %B, align 4
+ %arrayidx4 = getelementptr inbounds float* %B, i64 1
+ %1 = load float* %arrayidx4, align 4
+ %arrayidx10 = getelementptr inbounds float* %B, i64 2
+ %2 = load float* %arrayidx10, align 4
+ %arrayidx16 = getelementptr inbounds float* %B, i64 3
+ %3 = load float* %arrayidx16, align 4
+ %4 = sext i32 %n to i64
+ br label %for.body
+
+for.body:
+ %i.043 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
+ %sum.042 = phi float [ 0.000000e+00, %for.body.lr.ph ], [ %add21, %for.body ]
+ %mul = shl nsw i64 %i.043, 2
+ %arrayidx2 = getelementptr inbounds float* %A, i64 %mul
+ %5 = load float* %arrayidx2, align 4
+ %mul3 = fmul fast float %0, %5
+ %add = fadd fast float %sum.042, %mul3
+ %add638 = or i64 %mul, 1
+ %arrayidx7 = getelementptr inbounds float* %A, i64 %add638
+ %6 = load float* %arrayidx7, align 4
+ %mul8 = fmul fast float %1, %6
+ %add9 = fadd fast float %add, %mul8
+ %add1239 = or i64 %mul, 2
+ %arrayidx13 = getelementptr inbounds float* %A, i64 %add1239
+ %7 = load float* %arrayidx13, align 4
+ %mul14 = fmul fast float %2, %7
+ %add15 = fadd fast float %add9, %mul14
+ %add1840 = or i64 %mul, 3
+ %arrayidx19 = getelementptr inbounds float* %A, i64 %add1840
+ %8 = load float* %arrayidx19, align 4
+ %mul20 = fmul fast float %3, %8
+ %add21 = fadd fast float %add15, %mul20
+ %inc = add nsw i64 %i.043, 1
+ %exitcond = icmp eq i64 %inc, %4
+ br i1 %exitcond, label %for.cond.for.end_crit_edge, label %for.body
+
+for.cond.for.end_crit_edge:
+ %phitmp = fptosi float %add21 to i32
+ br label %for.end
+
+for.end:
+ %sum.0.lcssa = phi i32 [ %phitmp, %for.cond.for.end_crit_edge ], [ 0, %entry ]
+ ret i32 %sum.0.lcssa
+}
+
+; int foo(float * restrict A, float * restrict B, float * restrict C, int n) {
+; float sum = 0;
+; for (intptr_t i=0; i < n; ++i) {
+; C[i] = B[0] *A[i*4 ] +
+; B[1] *A[i*4+1] +
+; B[2] *A[i*4+2] +
+; B[3] *A[i*4+3];
+; }
+; return sum;
+; }
+
+; CHECK-LABEL: store_red
+; CHECK: fmul <4 x float>
+; CHECK: shufflevector <4 x float>
+
+define i32 @store_red(float* noalias %A, float* noalias %B, float* noalias %C, i32 %n) {
+entry:
+ %cmp37 = icmp sgt i32 %n, 0
+ br i1 %cmp37, label %for.body.lr.ph, label %for.end
+
+for.body.lr.ph:
+ %arrayidx4 = getelementptr inbounds float* %B, i64 1
+ %arrayidx9 = getelementptr inbounds float* %B, i64 2
+ %arrayidx15 = getelementptr inbounds float* %B, i64 3
+ %0 = sext i32 %n to i64
+ br label %for.body
+
+for.body:
+ %i.039 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
+ %C.addr.038 = phi float* [ %C, %for.body.lr.ph ], [ %incdec.ptr, %for.body ]
+ %1 = load float* %B, align 4
+ %mul = shl nsw i64 %i.039, 2
+ %arrayidx2 = getelementptr inbounds float* %A, i64 %mul
+ %2 = load float* %arrayidx2, align 4
+ %mul3 = fmul fast float %1, %2
+ %3 = load float* %arrayidx4, align 4
+ %add34 = or i64 %mul, 1
+ %arrayidx6 = getelementptr inbounds float* %A, i64 %add34
+ %4 = load float* %arrayidx6, align 4
+ %mul7 = fmul fast float %3, %4
+ %add8 = fadd fast float %mul3, %mul7
+ %5 = load float* %arrayidx9, align 4
+ %add1135 = or i64 %mul, 2
+ %arrayidx12 = getelementptr inbounds float* %A, i64 %add1135
+ %6 = load float* %arrayidx12, align 4
+ %mul13 = fmul fast float %5, %6
+ %add14 = fadd fast float %add8, %mul13
+ %7 = load float* %arrayidx15, align 4
+ %add1736 = or i64 %mul, 3
+ %arrayidx18 = getelementptr inbounds float* %A, i64 %add1736
+ %8 = load float* %arrayidx18, align 4
+ %mul19 = fmul fast float %7, %8
+ %add20 = fadd fast float %add14, %mul19
+ store float %add20, float* %C.addr.038, align 4
+ %incdec.ptr = getelementptr inbounds float* %C.addr.038, i64 1
+ %inc = add nsw i64 %i.039, 1
+ %exitcond = icmp eq i64 %inc, %0
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end:
+ ret i32 0
+}
+
+
+; RUN: opt -slp-vectorizer -slp-vectorize-hor -slp-vectorize-hor-store -S < %s -mtriple=x86_64-apple-macosx -mcpu=corei7-avx | FileCheck %s --check-prefix=STORE
+
+; void foo(double * restrict A, double * restrict B, double * restrict C,
+; int n) {
+; for (intptr_t i=0; i < n; ++i) {
+; C[i] = B[0] *A[i*4 ] + B[1] *A[i*4+1];
+; }
+; }
+
+; STORE-LABEL: store_red_double
+; STORE: fmul <2 x double>
+; STORE: extractelement <2 x double>
+; STORE: extractelement <2 x double>
+
+define void @store_red_double(double* noalias %A, double* noalias %B, double* noalias %C, i32 %n) {
+entry:
+ %cmp17 = icmp sgt i32 %n, 0
+ br i1 %cmp17, label %for.body.lr.ph, label %for.end
+
+for.body.lr.ph:
+ %0 = load double* %B, align 8
+ %arrayidx4 = getelementptr inbounds double* %B, i64 1
+ %1 = load double* %arrayidx4, align 8
+ %2 = sext i32 %n to i64
+ br label %for.body
+
+for.body:
+ %i.018 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
+ %mul = shl nsw i64 %i.018, 2
+ %arrayidx2 = getelementptr inbounds double* %A, i64 %mul
+ %3 = load double* %arrayidx2, align 8
+ %mul3 = fmul fast double %0, %3
+ %add16 = or i64 %mul, 1
+ %arrayidx6 = getelementptr inbounds double* %A, i64 %add16
+ %4 = load double* %arrayidx6, align 8
+ %mul7 = fmul fast double %1, %4
+ %add8 = fadd fast double %mul3, %mul7
+ %arrayidx9 = getelementptr inbounds double* %C, i64 %i.018
+ store double %add8, double* %arrayidx9, align 8
+ %inc = add nsw i64 %i.018, 1
+ %exitcond = icmp eq i64 %inc, %2
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end:
+ ret void
+}
diff --git a/test/Transforms/SLPVectorizer/X86/implicitfloat.ll b/test/Transforms/SLPVectorizer/X86/implicitfloat.ll
new file mode 100644
index 000000000000..f63f2683b10e
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/implicitfloat.ll
@@ -0,0 +1,25 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | 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-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+; Don't vectorize when noimplicitfloat is used.
+; CHECK: test1
+; CHECK-NOT: store <2 x double>
+; CHECK: ret
+define void @test1(double* %a, double* %b, double* %c) noimplicitfloat { ; <------ noimplicitfloat attribute here!
+entry:
+ %i0 = load double* %a, align 8
+ %i1 = load double* %b, align 8
+ %mul = fmul double %i0, %i1
+ %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
+ store double %mul, double* %c, align 8
+ %arrayidx5 = getelementptr inbounds double* %c, i64 1
+ store double %mul5, double* %arrayidx5, align 8
+ ret void
+}
+
diff --git a/test/Transforms/SLPVectorizer/X86/in-tree-user.ll b/test/Transforms/SLPVectorizer/X86/in-tree-user.ll
new file mode 100644
index 000000000000..3115232887bd
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/in-tree-user.ll
@@ -0,0 +1,50 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | 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-S128"
+target triple = "x86_64-apple-macosx10.7.0"
+
+@.str = private unnamed_addr constant [6 x i8] c"bingo\00", align 1
+
+; We can't vectorize when the roots are used inside the tree.
+;CHECK-LABEL: @in_tree_user(
+;CHECK-NOT: load <2 x double>
+;CHECK: ret
+define void @in_tree_user(double* nocapture %A, i32 %n) {
+entry:
+ %conv = sitofp i32 %n to double
+ br label %for.body
+
+for.body: ; preds = %for.inc, %entry
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc ]
+ %0 = shl nsw i64 %indvars.iv, 1
+ %arrayidx = getelementptr inbounds double* %A, i64 %0
+ %1 = load double* %arrayidx, align 8
+ %mul1 = fmul double %conv, %1
+ %mul2 = fmul double %mul1, 7.000000e+00
+ %add = fadd double %mul2, 5.000000e+00
+ %BadValue = fadd double %add, %add ; <------------------ In tree user.
+ %2 = or i64 %0, 1
+ %arrayidx6 = getelementptr inbounds double* %A, i64 %2
+ %3 = load double* %arrayidx6, align 8
+ %mul8 = fmul double %conv, %3
+ %mul9 = fmul double %mul8, 4.000000e+00
+ %add10 = fadd double %mul9, 9.000000e+00
+ %cmp11 = fcmp ogt double %add, %add10
+ br i1 %cmp11, label %if.then, label %for.inc
+
+if.then: ; preds = %for.body
+ %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str, i64 0, i64 0))
+ br label %for.inc
+
+for.inc: ; preds = %for.body, %if.then
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, 100
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.inc
+ ret void
+}
+
+declare i32 @printf(i8* nocapture, ...)
+
diff --git a/test/Transforms/SLPVectorizer/X86/insert-element-build-vector.ll b/test/Transforms/SLPVectorizer/X86/insert-element-build-vector.ll
new file mode 100644
index 000000000000..43f7aed9f519
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/insert-element-build-vector.ll
@@ -0,0 +1,197 @@
+; RUN: opt -S -slp-vectorizer -slp-threshold=-10000 < %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-n8:16:32:64-S128"
+
+target triple = "x86_64-apple-macosx10.8.0"
+
+define <4 x float> @simple_select(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
+; CHECK-LABEL: @simple_select(
+; CHECK-NEXT: %1 = icmp ne <4 x i32> %c, zeroinitializer
+; CHECK-NEXT: select <4 x i1> %1, <4 x float> %a, <4 x float> %b
+ %c0 = extractelement <4 x i32> %c, i32 0
+ %c1 = extractelement <4 x i32> %c, i32 1
+ %c2 = extractelement <4 x i32> %c, i32 2
+ %c3 = extractelement <4 x i32> %c, i32 3
+ %a0 = extractelement <4 x float> %a, i32 0
+ %a1 = extractelement <4 x float> %a, i32 1
+ %a2 = extractelement <4 x float> %a, i32 2
+ %a3 = extractelement <4 x float> %a, i32 3
+ %b0 = extractelement <4 x float> %b, i32 0
+ %b1 = extractelement <4 x float> %b, i32 1
+ %b2 = extractelement <4 x float> %b, i32 2
+ %b3 = extractelement <4 x float> %b, i32 3
+ %cmp0 = icmp ne i32 %c0, 0
+ %cmp1 = icmp ne i32 %c1, 0
+ %cmp2 = icmp ne i32 %c2, 0
+ %cmp3 = icmp ne i32 %c3, 0
+ %s0 = select i1 %cmp0, float %a0, float %b0
+ %s1 = select i1 %cmp1, float %a1, float %b1
+ %s2 = select i1 %cmp2, float %a2, float %b2
+ %s3 = select i1 %cmp3, float %a3, float %b3
+ %ra = insertelement <4 x float> undef, float %s0, i32 0
+ %rb = insertelement <4 x float> %ra, float %s1, i32 1
+ %rc = insertelement <4 x float> %rb, float %s2, i32 2
+ %rd = insertelement <4 x float> %rc, float %s3, i32 3
+ ret <4 x float> %rd
+}
+
+; Insert in an order different from the vector indices to make sure it
+; doesn't matter
+define <4 x float> @simple_select_insert_out_of_order(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
+; CHECK-LABEL: @simple_select_insert_out_of_order(
+; CHECK-NEXT: %1 = icmp ne <4 x i32> %c, zeroinitializer
+; CHECK-NEXT: select <4 x i1> %1, <4 x float> %a, <4 x float> %b
+ %c0 = extractelement <4 x i32> %c, i32 0
+ %c1 = extractelement <4 x i32> %c, i32 1
+ %c2 = extractelement <4 x i32> %c, i32 2
+ %c3 = extractelement <4 x i32> %c, i32 3
+ %a0 = extractelement <4 x float> %a, i32 0
+ %a1 = extractelement <4 x float> %a, i32 1
+ %a2 = extractelement <4 x float> %a, i32 2
+ %a3 = extractelement <4 x float> %a, i32 3
+ %b0 = extractelement <4 x float> %b, i32 0
+ %b1 = extractelement <4 x float> %b, i32 1
+ %b2 = extractelement <4 x float> %b, i32 2
+ %b3 = extractelement <4 x float> %b, i32 3
+ %cmp0 = icmp ne i32 %c0, 0
+ %cmp1 = icmp ne i32 %c1, 0
+ %cmp2 = icmp ne i32 %c2, 0
+ %cmp3 = icmp ne i32 %c3, 0
+ %s0 = select i1 %cmp0, float %a0, float %b0
+ %s1 = select i1 %cmp1, float %a1, float %b1
+ %s2 = select i1 %cmp2, float %a2, float %b2
+ %s3 = select i1 %cmp3, float %a3, float %b3
+ %ra = insertelement <4 x float> undef, float %s0, i32 2
+ %rb = insertelement <4 x float> %ra, float %s1, i32 1
+ %rc = insertelement <4 x float> %rb, float %s2, i32 0
+ %rd = insertelement <4 x float> %rc, float %s3, i32 3
+ ret <4 x float> %rd
+}
+
+declare void @v4f32_user(<4 x float>) #0
+declare void @f32_user(float) #0
+
+; Multiple users of the final constructed vector
+define <4 x float> @simple_select_users(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
+; CHECK-LABEL: @simple_select_users(
+; CHECK-NEXT: %1 = icmp ne <4 x i32> %c, zeroinitializer
+; CHECK-NEXT: select <4 x i1> %1, <4 x float> %a, <4 x float> %b
+ %c0 = extractelement <4 x i32> %c, i32 0
+ %c1 = extractelement <4 x i32> %c, i32 1
+ %c2 = extractelement <4 x i32> %c, i32 2
+ %c3 = extractelement <4 x i32> %c, i32 3
+ %a0 = extractelement <4 x float> %a, i32 0
+ %a1 = extractelement <4 x float> %a, i32 1
+ %a2 = extractelement <4 x float> %a, i32 2
+ %a3 = extractelement <4 x float> %a, i32 3
+ %b0 = extractelement <4 x float> %b, i32 0
+ %b1 = extractelement <4 x float> %b, i32 1
+ %b2 = extractelement <4 x float> %b, i32 2
+ %b3 = extractelement <4 x float> %b, i32 3
+ %cmp0 = icmp ne i32 %c0, 0
+ %cmp1 = icmp ne i32 %c1, 0
+ %cmp2 = icmp ne i32 %c2, 0
+ %cmp3 = icmp ne i32 %c3, 0
+ %s0 = select i1 %cmp0, float %a0, float %b0
+ %s1 = select i1 %cmp1, float %a1, float %b1
+ %s2 = select i1 %cmp2, float %a2, float %b2
+ %s3 = select i1 %cmp3, float %a3, float %b3
+ %ra = insertelement <4 x float> undef, float %s0, i32 0
+ %rb = insertelement <4 x float> %ra, float %s1, i32 1
+ %rc = insertelement <4 x float> %rb, float %s2, i32 2
+ %rd = insertelement <4 x float> %rc, float %s3, i32 3
+ call void @v4f32_user(<4 x float> %rd) #0
+ ret <4 x float> %rd
+}
+
+; Unused insertelement
+define <4 x float> @simple_select_no_users(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
+; CHECK-LABEL: @simple_select_no_users(
+; CHECK-NOT: icmp ne <4 x i32>
+; CHECK-NOT: select <4 x i1>
+ %c0 = extractelement <4 x i32> %c, i32 0
+ %c1 = extractelement <4 x i32> %c, i32 1
+ %c2 = extractelement <4 x i32> %c, i32 2
+ %c3 = extractelement <4 x i32> %c, i32 3
+ %a0 = extractelement <4 x float> %a, i32 0
+ %a1 = extractelement <4 x float> %a, i32 1
+ %a2 = extractelement <4 x float> %a, i32 2
+ %a3 = extractelement <4 x float> %a, i32 3
+ %b0 = extractelement <4 x float> %b, i32 0
+ %b1 = extractelement <4 x float> %b, i32 1
+ %b2 = extractelement <4 x float> %b, i32 2
+ %b3 = extractelement <4 x float> %b, i32 3
+ %cmp0 = icmp ne i32 %c0, 0
+ %cmp1 = icmp ne i32 %c1, 0
+ %cmp2 = icmp ne i32 %c2, 0
+ %cmp3 = icmp ne i32 %c3, 0
+ %s0 = select i1 %cmp0, float %a0, float %b0
+ %s1 = select i1 %cmp1, float %a1, float %b1
+ %s2 = select i1 %cmp2, float %a2, float %b2
+ %s3 = select i1 %cmp3, float %a3, float %b3
+ %ra = insertelement <4 x float> undef, float %s0, i32 0
+ %rb = insertelement <4 x float> %ra, float %s1, i32 1
+ %rc = insertelement <4 x float> undef, float %s2, i32 2
+ %rd = insertelement <4 x float> %rc, float %s3, i32 3
+ ret <4 x float> %rd
+}
+
+; Make sure infinite loop doesn't happen which I ran into when trying
+; to do this backwards this backwards
+define <4 x i32> @reconstruct(<4 x i32> %c) #0 {
+; CHECK-LABEL: @reconstruct(
+ %c0 = extractelement <4 x i32> %c, i32 0
+ %c1 = extractelement <4 x i32> %c, i32 1
+ %c2 = extractelement <4 x i32> %c, i32 2
+ %c3 = extractelement <4 x i32> %c, i32 3
+ %ra = insertelement <4 x i32> undef, i32 %c0, i32 0
+ %rb = insertelement <4 x i32> %ra, i32 %c1, i32 1
+ %rc = insertelement <4 x i32> %rb, i32 %c2, i32 2
+ %rd = insertelement <4 x i32> %rc, i32 %c3, i32 3
+ ret <4 x i32> %rd
+}
+
+define <2 x float> @simple_select_v2(<2 x float> %a, <2 x float> %b, <2 x i32> %c) #0 {
+; CHECK-LABEL: @simple_select_v2(
+; CHECK: icmp ne <2 x i32>
+; CHECK: select <2 x i1>
+ %c0 = extractelement <2 x i32> %c, i32 0
+ %c1 = extractelement <2 x i32> %c, i32 1
+ %a0 = extractelement <2 x float> %a, i32 0
+ %a1 = extractelement <2 x float> %a, i32 1
+ %b0 = extractelement <2 x float> %b, i32 0
+ %b1 = extractelement <2 x float> %b, i32 1
+ %cmp0 = icmp ne i32 %c0, 0
+ %cmp1 = icmp ne i32 %c1, 0
+ %s0 = select i1 %cmp0, float %a0, float %b0
+ %s1 = select i1 %cmp1, float %a1, float %b1
+ %ra = insertelement <2 x float> undef, float %s0, i32 0
+ %rb = insertelement <2 x float> %ra, float %s1, i32 1
+ ret <2 x float> %rb
+}
+
+; Make sure when we construct partial vectors, we don't keep
+; re-visiting the insertelement chains starting with undef
+; (low cost threshold needed to force this to happen)
+define <4 x float> @simple_select_partial_vector(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
+ %c0 = extractelement <4 x i32> %c, i32 0
+ %c1 = extractelement <4 x i32> %c, i32 1
+ %a0 = extractelement <4 x float> %a, i32 0
+ %a1 = extractelement <4 x float> %a, i32 1
+ %b0 = extractelement <4 x float> %b, i32 0
+ %b1 = extractelement <4 x float> %b, i32 1
+ %1 = insertelement <2 x i32> undef, i32 %c0, i32 0
+ %2 = insertelement <2 x i32> %1, i32 %c1, i32 1
+ %3 = icmp ne <2 x i32> %2, zeroinitializer
+ %4 = insertelement <2 x float> undef, float %a0, i32 0
+ %5 = insertelement <2 x float> %4, float %a1, i32 1
+ %6 = insertelement <2 x float> undef, float %b0, i32 0
+ %7 = insertelement <2 x float> %6, float %b1, i32 1
+ %8 = select <2 x i1> %3, <2 x float> %5, <2 x float> %7
+ %9 = extractelement <2 x float> %8, i32 0
+ %ra = insertelement <4 x float> undef, float %9, i32 0
+ %10 = extractelement <2 x float> %8, i32 1
+ %rb = insertelement <4 x float> %ra, float %10, i32 1
+ ret <4 x float> %rb
+}
+
+attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/test/Transforms/SLPVectorizer/X86/lit.local.cfg b/test/Transforms/SLPVectorizer/X86/lit.local.cfg
index a8ad0f1a28b2..ba763cf03ffc 100644
--- a/test/Transforms/SLPVectorizer/X86/lit.local.cfg
+++ b/test/Transforms/SLPVectorizer/X86/lit.local.cfg
@@ -1,5 +1,3 @@
-config.suffixes = ['.ll', '.c', '.cpp']
-
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True
diff --git a/test/Transforms/SLPVectorizer/X86/long_chains.ll b/test/Transforms/SLPVectorizer/X86/long_chains.ll
new file mode 100644
index 000000000000..5af3e6d6e903
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/long_chains.ll
@@ -0,0 +1,47 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | 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-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+; At this point we can't vectorize only parts of the tree.
+
+; CHECK: test
+; CHECK: insertelement <2 x i8>
+; CHECK: insertelement <2 x i8>
+; CHECK: sitofp <2 x i8>
+; CHECK: fmul <2 x double>
+; CHECK: ret
+define i32 @test(double* nocapture %A, i8* nocapture %B) {
+entry:
+ %0 = load i8* %B, align 1
+ %arrayidx1 = getelementptr inbounds i8* %B, i64 1
+ %1 = load i8* %arrayidx1, align 1
+ %add = add i8 %0, 3
+ %add4 = add i8 %1, 3
+ %conv6 = sitofp i8 %add to double
+ %conv7 = sitofp i8 %add4 to double
+ %mul = fmul double %conv6, %conv6
+ %add8 = fadd double %mul, 1.000000e+00
+ %mul9 = fmul double %conv7, %conv7
+ %add10 = fadd double %mul9, 1.000000e+00
+ %mul11 = fmul double %add8, %add8
+ %add12 = fadd double %mul11, 1.000000e+00
+ %mul13 = fmul double %add10, %add10
+ %add14 = fadd double %mul13, 1.000000e+00
+ %mul15 = fmul double %add12, %add12
+ %add16 = fadd double %mul15, 1.000000e+00
+ %mul17 = fmul double %add14, %add14
+ %add18 = fadd double %mul17, 1.000000e+00
+ %mul19 = fmul double %add16, %add16
+ %add20 = fadd double %mul19, 1.000000e+00
+ %mul21 = fmul double %add18, %add18
+ %add22 = fadd double %mul21, 1.000000e+00
+ %mul23 = fmul double %add20, %add20
+ %add24 = fadd double %mul23, 1.000000e+00
+ %mul25 = fmul double %add22, %add22
+ %add26 = fadd double %mul25, 1.000000e+00
+ store double %add24, double* %A, align 8
+ %arrayidx28 = getelementptr inbounds double* %A, i64 1
+ store double %add26, double* %arrayidx28, align 8
+ ret i32 undef
+}
diff --git a/test/Transforms/SLPVectorizer/X86/loopinvariant.ll b/test/Transforms/SLPVectorizer/X86/loopinvariant.ll
index 4a37fce2ff24..aef2479dd524 100644
--- a/test/Transforms/SLPVectorizer/X86/loopinvariant.ll
+++ b/test/Transforms/SLPVectorizer/X86/loopinvariant.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-;CHECK: @foo
+;CHECK-LABEL: @foo(
;CHECK: load <4 x i32>
;CHECK: add <4 x i32>
;CHECK: store <4 x i32>
diff --git a/test/Transforms/SLPVectorizer/X86/multi_block.ll b/test/Transforms/SLPVectorizer/X86/multi_block.ll
new file mode 100644
index 000000000000..2f1cc74d05ff
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/multi_block.ll
@@ -0,0 +1,55 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | 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-S128"
+target triple = "x86_64-apple-macosx10.7.0"
+
+; int bar(double *A, int d) {
+; double A0 = A[0];
+; double A1 = A[1];
+; float F0 = A0;
+; float F1 = A1;
+; if (d) foo(); <----- This splits the blocks
+; F0+=4.0;
+; F1+=5.0;
+; A[8] = 9.0 + F0;
+; A[9] = 5.0 + F1;
+; }
+
+
+;CHECK-LABEL: @bar(
+;CHECK: load <2 x double>
+;CHECK: fptrunc <2 x double>
+;CHECK: call i32
+;CHECK: fadd <2 x float>
+;CHECK: fpext <2 x float>
+;CHECK: store <2 x double>
+;CHECK: ret
+define i32 @bar(double* nocapture %A, i32 %d) {
+ %1 = load double* %A, align 8
+ %2 = getelementptr inbounds double* %A, i64 1
+ %3 = load double* %2, align 8
+ %4 = fptrunc double %1 to float
+ %5 = fptrunc double %3 to float
+ %6 = icmp eq i32 %d, 0
+ br i1 %6, label %9, label %7
+
+; <label>:7 ; preds = %0
+ %8 = tail call i32 (...)* @foo()
+ br label %9
+
+; <label>:9 ; preds = %0, %7
+ %10 = fadd float %4, 4.000000e+00
+ %11 = fadd float %5, 5.000000e+00
+ %12 = fpext float %10 to double
+ %13 = fadd double %12, 9.000000e+00
+ %14 = getelementptr inbounds double* %A, i64 8
+ store double %13, double* %14, align 8
+ %15 = fpext float %11 to double
+ %16 = fadd double %15, 5.000000e+00
+ %17 = getelementptr inbounds double* %A, i64 9
+ store double %16, double* %17, align 8
+ ret i32 undef
+}
+
+declare i32 @foo(...)
+
diff --git a/test/Transforms/SLPVectorizer/X86/multi_user.ll b/test/Transforms/SLPVectorizer/X86/multi_user.ll
index aaa6063fdeda..cab99945e29e 100644
--- a/test/Transforms/SLPVectorizer/X86/multi_user.ll
+++ b/test/Transforms/SLPVectorizer/X86/multi_user.ll
@@ -11,7 +11,7 @@ target triple = "x86_64-apple-macosx10.7.0"
; A[4] += n * 5 + 11;
;}
-;CHECK: @foo
+;CHECK-LABEL: @foo(
;CHECK: insertelement <4 x i32>
;CHECK: load <4 x i32>
;CHECK: add <4 x i32>
diff --git a/test/Transforms/SLPVectorizer/X86/odd_store.ll b/test/Transforms/SLPVectorizer/X86/odd_store.ll
new file mode 100644
index 000000000000..027f6016e2b9
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/odd_store.ll
@@ -0,0 +1,46 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | 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-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+;int foo(char * restrict A, float * restrict B, float T) {
+; A[0] = (T * B[10] + 4.0);
+; A[1] = (T * B[11] + 5.0);
+; A[2] = (T * B[12] + 6.0);
+;}
+
+;CHECK-LABEL: @foo(
+;CHECK-NOT: load <3 x float>
+;CHECK-NOT: fmul <3 x float>
+;CHECK-NOT: fpext <3 x float>
+;CHECK-NOT: fadd <3 x double>
+;CHECK-NOT: fptosi <3 x double>
+;CHECK-NOT: store <3 x i8>
+;CHECK: ret
+define i32 @foo(i8* noalias nocapture %A, float* noalias nocapture %B, float %T) {
+ %1 = getelementptr inbounds float* %B, i64 10
+ %2 = load float* %1, align 4
+ %3 = fmul float %2, %T
+ %4 = fpext float %3 to double
+ %5 = fadd double %4, 4.000000e+00
+ %6 = fptosi double %5 to i8
+ store i8 %6, i8* %A, align 1
+ %7 = getelementptr inbounds float* %B, i64 11
+ %8 = load float* %7, align 4
+ %9 = fmul float %8, %T
+ %10 = fpext float %9 to double
+ %11 = fadd double %10, 5.000000e+00
+ %12 = fptosi double %11 to i8
+ %13 = getelementptr inbounds i8* %A, i64 1
+ store i8 %12, i8* %13, align 1
+ %14 = getelementptr inbounds float* %B, i64 12
+ %15 = load float* %14, align 4
+ %16 = fmul float %15, %T
+ %17 = fpext float %16 to double
+ %18 = fadd double %17, 6.000000e+00
+ %19 = fptosi double %18 to i8
+ %20 = getelementptr inbounds i8* %A, i64 2
+ store i8 %19, i8* %20, align 1
+ ret i32 undef
+}
+
diff --git a/test/Transforms/SLPVectorizer/X86/operandorder.ll b/test/Transforms/SLPVectorizer/X86/operandorder.ll
new file mode 100644
index 000000000000..c5322a839ed1
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/operandorder.ll
@@ -0,0 +1,234 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -slp-threshold=-100 -instcombine -dce -S -mtriple=i386-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+
+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-S128"
+
+
+
+; Make sure we order the operands of commutative operations so that we get
+; bigger vectorizable trees.
+
+; CHECK-LABEL: shuffle_operands1
+; CHECK: load <2 x double>
+; CHECK: fadd <2 x double>
+
+define void @shuffle_operands1(double * noalias %from, double * noalias %to,
+ double %v1, double %v2) {
+ %from_1 = getelementptr double *%from, i64 1
+ %v0_1 = load double * %from
+ %v0_2 = load double * %from_1
+ %v1_1 = fadd double %v0_1, %v1
+ %v1_2 = fadd double %v2, %v0_2
+ %to_2 = getelementptr double * %to, i64 1
+ store double %v1_1, double *%to
+ store double %v1_2, double *%to_2
+ ret void
+}
+
+; CHECK-LABEL: shuffle_preserve_broadcast
+; CHECK: %[[BCAST:[a-z0-9]+]] = insertelement <2 x double> undef, double %v0_1
+; CHECK: = insertelement <2 x double> %[[BCAST]], double %v0_1
+define void @shuffle_preserve_broadcast(double * noalias %from,
+ double * noalias %to,
+ double %v1, double %v2) {
+entry:
+br label %lp
+
+lp:
+ %p = phi double [ 1.000000e+00, %lp ], [ 0.000000e+00, %entry ]
+ %from_1 = getelementptr double *%from, i64 1
+ %v0_1 = load double * %from
+ %v0_2 = load double * %from_1
+ %v1_1 = fadd double %v0_1, %p
+ %v1_2 = fadd double %v0_1, %v0_2
+ %to_2 = getelementptr double * %to, i64 1
+ store double %v1_1, double *%to
+ store double %v1_2, double *%to_2
+br i1 undef, label %lp, label %ext
+
+ext:
+ ret void
+}
+
+; CHECK-LABEL: shuffle_preserve_broadcast2
+; CHECK: %[[BCAST:[a-z0-9]+]] = insertelement <2 x double> undef, double %v0_1
+; CHECK: = insertelement <2 x double> %[[BCAST]], double %v0_1
+define void @shuffle_preserve_broadcast2(double * noalias %from,
+ double * noalias %to,
+ double %v1, double %v2) {
+entry:
+br label %lp
+
+lp:
+ %p = phi double [ 1.000000e+00, %lp ], [ 0.000000e+00, %entry ]
+ %from_1 = getelementptr double *%from, i64 1
+ %v0_1 = load double * %from
+ %v0_2 = load double * %from_1
+ %v1_1 = fadd double %p, %v0_1
+ %v1_2 = fadd double %v0_2, %v0_1
+ %to_2 = getelementptr double * %to, i64 1
+ store double %v1_1, double *%to
+ store double %v1_2, double *%to_2
+br i1 undef, label %lp, label %ext
+
+ext:
+ ret void
+}
+
+; CHECK-LABEL: shuffle_preserve_broadcast3
+; CHECK: %[[BCAST:[a-z0-9]+]] = insertelement <2 x double> undef, double %v0_1
+; CHECK: = insertelement <2 x double> %[[BCAST]], double %v0_1
+define void @shuffle_preserve_broadcast3(double * noalias %from,
+ double * noalias %to,
+ double %v1, double %v2) {
+entry:
+br label %lp
+
+lp:
+ %p = phi double [ 1.000000e+00, %lp ], [ 0.000000e+00, %entry ]
+ %from_1 = getelementptr double *%from, i64 1
+ %v0_1 = load double * %from
+ %v0_2 = load double * %from_1
+ %v1_1 = fadd double %p, %v0_1
+ %v1_2 = fadd double %v0_1, %v0_2
+ %to_2 = getelementptr double * %to, i64 1
+ store double %v1_1, double *%to
+ store double %v1_2, double *%to_2
+br i1 undef, label %lp, label %ext
+
+ext:
+ ret void
+}
+
+
+; CHECK-LABEL: shuffle_preserve_broadcast4
+; CHECK: %[[BCAST:[a-z0-9]+]] = insertelement <2 x double> undef, double %v0_1
+; CHECK: = insertelement <2 x double> %[[BCAST]], double %v0_1
+define void @shuffle_preserve_broadcast4(double * noalias %from,
+ double * noalias %to,
+ double %v1, double %v2) {
+entry:
+br label %lp
+
+lp:
+ %p = phi double [ 1.000000e+00, %lp ], [ 0.000000e+00, %entry ]
+ %from_1 = getelementptr double *%from, i64 1
+ %v0_1 = load double * %from
+ %v0_2 = load double * %from_1
+ %v1_1 = fadd double %v0_2, %v0_1
+ %v1_2 = fadd double %p, %v0_1
+ %to_2 = getelementptr double * %to, i64 1
+ store double %v1_1, double *%to
+ store double %v1_2, double *%to_2
+br i1 undef, label %lp, label %ext
+
+ext:
+ ret void
+}
+
+; CHECK-LABEL: shuffle_preserve_broadcast5
+; CHECK: %[[BCAST:[a-z0-9]+]] = insertelement <2 x double> undef, double %v0_1
+; CHECK: = insertelement <2 x double> %[[BCAST]], double %v0_1
+define void @shuffle_preserve_broadcast5(double * noalias %from,
+ double * noalias %to,
+ double %v1, double %v2) {
+entry:
+br label %lp
+
+lp:
+ %p = phi double [ 1.000000e+00, %lp ], [ 0.000000e+00, %entry ]
+ %from_1 = getelementptr double *%from, i64 1
+ %v0_1 = load double * %from
+ %v0_2 = load double * %from_1
+ %v1_1 = fadd double %v0_1, %v0_2
+ %v1_2 = fadd double %p, %v0_1
+ %to_2 = getelementptr double * %to, i64 1
+ store double %v1_1, double *%to
+ store double %v1_2, double *%to_2
+br i1 undef, label %lp, label %ext
+
+ext:
+ ret void
+}
+
+
+; CHECK-LABEL: shuffle_preserve_broadcast6
+; CHECK: %[[BCAST:[a-z0-9]+]] = insertelement <2 x double> undef, double %v0_1
+; CHECK: = insertelement <2 x double> %[[BCAST]], double %v0_1
+define void @shuffle_preserve_broadcast6(double * noalias %from,
+ double * noalias %to,
+ double %v1, double %v2) {
+entry:
+br label %lp
+
+lp:
+ %p = phi double [ 1.000000e+00, %lp ], [ 0.000000e+00, %entry ]
+ %from_1 = getelementptr double *%from, i64 1
+ %v0_1 = load double * %from
+ %v0_2 = load double * %from_1
+ %v1_1 = fadd double %v0_1, %v0_2
+ %v1_2 = fadd double %v0_1, %p
+ %to_2 = getelementptr double * %to, i64 1
+ store double %v1_1, double *%to
+ store double %v1_2, double *%to_2
+br i1 undef, label %lp, label %ext
+
+ext:
+ ret void
+}
+
+; Make sure we don't scramble operands when we reorder them and destroy
+; 'good' source order.
+
+; CHECK-LABEL: good_load_order
+
+; CHECK: %[[V1:[0-9]+]] = load <4 x float>*
+; CHECK: %[[V2:[0-9]+]] = insertelement <4 x float> undef, float %1, i32 0
+; CHECK: %[[V3:[0-9]+]] = shufflevector <4 x float> %[[V2]], <4 x float> %[[V1]], <4 x i32> <i32 0, i32 4, i32 5, i32 6>
+; CHECK: = fmul <4 x float> %[[V1]], %[[V3]]
+
+@a = common global [32000 x float] zeroinitializer, align 16
+
+define void @good_load_order() {
+entry:
+ br label %for.cond1.preheader
+
+for.cond1.preheader:
+ %0 = load float* getelementptr inbounds ([32000 x float]* @a, i64 0, i64 0), align 16
+ br label %for.body3
+
+for.body3:
+ %1 = phi float [ %0, %for.cond1.preheader ], [ %10, %for.body3 ]
+ %indvars.iv = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next, %for.body3 ]
+ %2 = add nsw i64 %indvars.iv, 1
+ %arrayidx = getelementptr inbounds [32000 x float]* @a, i64 0, i64 %2
+ %3 = load float* %arrayidx, align 4
+ %arrayidx5 = getelementptr inbounds [32000 x float]* @a, i64 0, i64 %indvars.iv
+ %mul6 = fmul float %3, %1
+ store float %mul6, float* %arrayidx5, align 4
+ %4 = add nsw i64 %indvars.iv, 2
+ %arrayidx11 = getelementptr inbounds [32000 x float]* @a, i64 0, i64 %4
+ %5 = load float* %arrayidx11, align 4
+ %mul15 = fmul float %5, %3
+ store float %mul15, float* %arrayidx, align 4
+ %6 = add nsw i64 %indvars.iv, 3
+ %arrayidx21 = getelementptr inbounds [32000 x float]* @a, i64 0, i64 %6
+ %7 = load float* %arrayidx21, align 4
+ %mul25 = fmul float %7, %5
+ store float %mul25, float* %arrayidx11, align 4
+ %8 = add nsw i64 %indvars.iv, 4
+ %arrayidx31 = getelementptr inbounds [32000 x float]* @a, i64 0, i64 %8
+ %9 = load float* %arrayidx31, align 4
+ %mul35 = fmul float %9, %7
+ store float %mul35, float* %arrayidx21, align 4
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 5
+ %arrayidx41 = getelementptr inbounds [32000 x float]* @a, i64 0, i64 %indvars.iv.next
+ %10 = load float* %arrayidx41, align 4
+ %mul45 = fmul float %10, %9
+ store float %mul45, float* %arrayidx31, align 4
+ %11 = trunc i64 %indvars.iv.next to i32
+ %cmp2 = icmp slt i32 %11, 31995
+ br i1 %cmp2, label %for.body3, label %for.end
+
+for.end:
+ ret void
+}
diff --git a/test/Transforms/SLPVectorizer/X86/opt.ll b/test/Transforms/SLPVectorizer/X86/opt.ll
new file mode 100644
index 000000000000..14137c11ee41
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/opt.ll
@@ -0,0 +1,30 @@
+; RUN: opt < %s -O3 -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s --check-prefix=SLP
+; RUN: opt < %s -O3 -disable-slp-vectorization -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s --check-prefix=NOSLP
+
+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"
+
+; Make sure we can disable slp vectorization in opt.
+
+; SLP-LABEL: test1
+; SLP: store <2 x double>
+
+; NOSLP-LABEL: test1
+; NOSLP-NOT: store <2 x double>
+
+
+define void @test1(double* %a, double* %b, double* %c) {
+entry:
+ %i0 = load double* %a, align 8
+ %i1 = load double* %b, align 8
+ %mul = fmul double %i0, %i1
+ %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
+ store double %mul, double* %c, align 8
+ %arrayidx5 = getelementptr inbounds double* %c, i64 1
+ store double %mul5, double* %arrayidx5, align 8
+ ret void
+}
diff --git a/test/Transforms/SLPVectorizer/X86/ordering.ll b/test/Transforms/SLPVectorizer/X86/ordering.ll
new file mode 100644
index 000000000000..d2ecd4546ddb
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/ordering.ll
@@ -0,0 +1,81 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
+
+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"
+
+define void @updateModelQPFrame(i32 %m_Bits) {
+entry:
+ %0 = load double* undef, align 8
+ %mul = fmul double undef, %0
+ %mul2 = fmul double undef, %mul
+ %mul4 = fmul double %0, %mul2
+ %mul5 = fmul double undef, 4.000000e+00
+ %mul7 = fmul double undef, %mul5
+ %conv = sitofp i32 %m_Bits to double
+ %mul8 = fmul double %conv, %mul7
+ %add = fadd double %mul4, %mul8
+ %cmp11 = fcmp olt double %add, 0.000000e+00
+ ret void
+}
+
+declare i8* @objc_msgSend(i8*, i8*, ...)
+declare i32 @personality_v0(...)
+
+define void @invoketest() {
+entry:
+ br i1 undef, label %cond.true, label %cond.false
+
+cond.true:
+ %call49 = invoke double bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to double (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %cond.true54 unwind label %lpad
+
+cond.false:
+ %call51 = invoke double bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to double (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %cond.false57 unwind label %lpad
+
+cond.true54:
+ %call56 = invoke double bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to double (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %cond.end60 unwind label %lpad
+
+cond.false57:
+ %call59 = invoke double bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to double (i8*, i8*)*)(i8* undef, i8* undef)
+ to label %cond.end60 unwind label %lpad
+
+; Make sure we don't vectorize these phis - they have invokes as inputs.
+
+; RUN: opt < %s -slp-vectorizer -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7 | FileCheck %s
+
+; CHECK-LABEL: invoketest
+
+; CHECK-LABEL: cond.end60
+; CHECK-NEXT-NOT: phi <2 x double>
+; CHECK: insertelement
+; CHECK-LABEL: if.then63
+
+cond.end60:
+ %cond126 = phi double [ %call49, %cond.true54 ], [ %call51, %cond.false57 ]
+ %cond61 = phi double [ %call56, %cond.true54 ], [ %call59, %cond.false57 ]
+ br i1 undef, label %if.end98, label %if.then63
+
+if.then63:
+ %conv69 = fptrunc double undef to float
+ %conv70 = fpext float %conv69 to double
+ %div71 = fdiv double %cond126, %conv70
+ %conv78 = fptrunc double undef to float
+ %conv79 = fpext float %conv78 to double
+ %div80 = fdiv double %cond61, %conv79
+ br label %if.end98
+
+lpad:
+ %l = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @personality_v0 to i8*)
+ cleanup
+ resume { i8*, i32 } %l
+
+if.end98:
+ %dimensionsResult.sroa.0.0 = phi double [ %div71, %if.then63 ], [ %cond126, %cond.end60 ]
+ %dimensionsResult.sroa.6.0 = phi double [ %div80, %if.then63 ], [ %cond61, %cond.end60 ]
+ br label %if.end99
+
+if.end99:
+ ret void
+}
diff --git a/test/Transforms/SLPVectorizer/X86/phi.ll b/test/Transforms/SLPVectorizer/X86/phi.ll
new file mode 100644
index 000000000000..964e0e4efee7
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/phi.ll
@@ -0,0 +1,248 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -slp-threshold=-100 -dce -S -mtriple=i386-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+
+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-S128"
+target triple = "i386-apple-macosx10.9.0"
+
+;int foo(double *A, int k) {
+; double A0;
+; double A1;
+; if (k) {
+; A0 = 3;
+; A1 = 5;
+; } else {
+; A0 = A[10];
+; A1 = A[11];
+; }
+; A[0] = A0;
+; A[1] = A1;
+;}
+
+
+;CHECK: i32 @foo
+;CHECK: load <2 x double>
+;CHECK: phi <2 x double>
+;CHECK: store <2 x double>
+;CHECK: ret i32 undef
+define i32 @foo(double* nocapture %A, i32 %k) {
+entry:
+ %tobool = icmp eq i32 %k, 0
+ br i1 %tobool, label %if.else, label %if.end
+
+if.else: ; preds = %entry
+ %arrayidx = getelementptr inbounds double* %A, i64 10
+ %0 = load double* %arrayidx, align 8
+ %arrayidx1 = getelementptr inbounds double* %A, i64 11
+ %1 = load double* %arrayidx1, align 8
+ br label %if.end
+
+if.end: ; preds = %entry, %if.else
+ %A0.0 = phi double [ %0, %if.else ], [ 3.000000e+00, %entry ]
+ %A1.0 = phi double [ %1, %if.else ], [ 5.000000e+00, %entry ]
+ store double %A0.0, double* %A, align 8
+ %arrayidx3 = getelementptr inbounds double* %A, i64 1
+ store double %A1.0, double* %arrayidx3, align 8
+ ret i32 undef
+}
+
+
+;int foo(double * restrict B, double * restrict A, int n, int m) {
+; double R=A[1];
+; double G=A[0];
+; for (int i=0; i < 100; i++) {
+; R += 10;
+; G += 10;
+; R *= 4;
+; G *= 4;
+; R += 4;
+; G += 4;
+; }
+; B[0] = G;
+; B[1] = R;
+; return 0;
+;}
+
+;CHECK: foo2
+;CHECK: load <2 x double>
+;CHECK: phi <2 x double>
+;CHECK: fmul <2 x double>
+;CHECK: store <2 x double>
+;CHECK: ret
+define i32 @foo2(double* noalias nocapture %B, double* noalias nocapture %A, i32 %n, i32 %m) #0 {
+entry:
+ %arrayidx = getelementptr inbounds double* %A, i64 1
+ %0 = load double* %arrayidx, align 8
+ %1 = load double* %A, align 8
+ br label %for.body
+
+for.body: ; preds = %for.body, %entry
+ %i.019 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+ %G.018 = phi double [ %1, %entry ], [ %add5, %for.body ]
+ %R.017 = phi double [ %0, %entry ], [ %add4, %for.body ]
+ %add = fadd double %R.017, 1.000000e+01
+ %add2 = fadd double %G.018, 1.000000e+01
+ %mul = fmul double %add, 4.000000e+00
+ %mul3 = fmul double %add2, 4.000000e+00
+ %add4 = fadd double %mul, 4.000000e+00
+ %add5 = fadd double %mul3, 4.000000e+00
+ %inc = add nsw i32 %i.019, 1
+ %exitcond = icmp eq i32 %inc, 100
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body
+ store double %add5, double* %B, align 8
+ %arrayidx7 = getelementptr inbounds double* %B, i64 1
+ store double %add4, double* %arrayidx7, align 8
+ ret i32 0
+}
+
+; float foo3(float *A) {
+;
+; float R = A[0];
+; float G = A[1];
+; float B = A[2];
+; float Y = A[3];
+; float P = A[4];
+; for (int i=0; i < 121; i+=3) {
+; R+=A[i+0]*7;
+; G+=A[i+1]*8;
+; B+=A[i+2]*9;
+; Y+=A[i+3]*10;
+; P+=A[i+4]*11;
+; }
+;
+; return R+G+B+Y+P;
+; }
+
+;CHECK: foo3
+;CHECK: phi <4 x float>
+;CHECK: fmul <4 x float>
+;CHECK: fadd <4 x float>
+;CHECK-NOT: phi <5 x float>
+;CHECK-NOT: fmul <5 x float>
+;CHECK-NOT: fadd <5 x float>
+
+define float @foo3(float* nocapture readonly %A) #0 {
+entry:
+ %0 = load float* %A, align 4
+ %arrayidx1 = getelementptr inbounds float* %A, i64 1
+ %1 = load float* %arrayidx1, align 4
+ %arrayidx2 = getelementptr inbounds float* %A, i64 2
+ %2 = load float* %arrayidx2, align 4
+ %arrayidx3 = getelementptr inbounds float* %A, i64 3
+ %3 = load float* %arrayidx3, align 4
+ %arrayidx4 = getelementptr inbounds float* %A, i64 4
+ %4 = load float* %arrayidx4, align 4
+ br label %for.body
+
+for.body: ; preds = %for.body, %entry
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %P.056 = phi float [ %4, %entry ], [ %add26, %for.body ]
+ %Y.055 = phi float [ %3, %entry ], [ %add21, %for.body ]
+ %B.054 = phi float [ %2, %entry ], [ %add16, %for.body ]
+ %G.053 = phi float [ %1, %entry ], [ %add11, %for.body ]
+ %R.052 = phi float [ %0, %entry ], [ %add6, %for.body ]
+ %5 = phi float [ %1, %entry ], [ %11, %for.body ]
+ %6 = phi float [ %0, %entry ], [ %9, %for.body ]
+ %mul = fmul float %6, 7.000000e+00
+ %add6 = fadd float %R.052, %mul
+ %mul10 = fmul float %5, 8.000000e+00
+ %add11 = fadd float %G.053, %mul10
+ %7 = add nsw i64 %indvars.iv, 2
+ %arrayidx14 = getelementptr inbounds float* %A, i64 %7
+ %8 = load float* %arrayidx14, align 4
+ %mul15 = fmul float %8, 9.000000e+00
+ %add16 = fadd float %B.054, %mul15
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 3
+ %arrayidx19 = getelementptr inbounds float* %A, i64 %indvars.iv.next
+ %9 = load float* %arrayidx19, align 4
+ %mul20 = fmul float %9, 1.000000e+01
+ %add21 = fadd float %Y.055, %mul20
+ %10 = add nsw i64 %indvars.iv, 4
+ %arrayidx24 = getelementptr inbounds float* %A, i64 %10
+ %11 = load float* %arrayidx24, align 4
+ %mul25 = fmul float %11, 1.100000e+01
+ %add26 = fadd float %P.056, %mul25
+ %12 = trunc i64 %indvars.iv.next to i32
+ %cmp = icmp slt i32 %12, 121
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end: ; preds = %for.body
+ %add28 = fadd float %add6, %add11
+ %add29 = fadd float %add28, %add16
+ %add30 = fadd float %add29, %add21
+ %add31 = fadd float %add30, %add26
+ ret float %add31
+}
+
+; Make sure the order of phi nodes of different types does not prevent
+; vectorization of same typed phi nodes.
+; CHECK-LABEL: sort_phi_type
+; CHECK: phi <4 x float>
+; CHECK: fmul <4 x float>
+
+define float @sort_phi_type(float* nocapture readonly %A) {
+entry:
+ br label %for.body
+
+for.body: ; preds = %for.body, %entry
+ %Y = phi float [ 1.000000e+01, %entry ], [ %mul10, %for.body ]
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %B = phi float [ 1.000000e+01, %entry ], [ %mul15, %for.body ]
+ %G = phi float [ 1.000000e+01, %entry ], [ %mul20, %for.body ]
+ %R = phi float [ 1.000000e+01, %entry ], [ %mul25, %for.body ]
+ %mul10 = fmul float %Y, 8.000000e+00
+ %mul15 = fmul float %B, 9.000000e+00
+ %mul20 = fmul float %R, 10.000000e+01
+ %mul25 = fmul float %G, 11.100000e+01
+ %indvars.iv.next = add nsw i64 %indvars.iv, 4
+ %cmp = icmp slt i64 %indvars.iv.next, 128
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end: ; preds = %for.body
+ %add28 = fadd float 1.000000e+01, %mul10
+ %add29 = fadd float %mul10, %mul15
+ %add30 = fadd float %add29, %mul20
+ %add31 = fadd float %add30, %mul25
+ ret float %add31
+}
+
+define void @test(x86_fp80* %i1, x86_fp80* %i2, x86_fp80* %o) {
+; CHECK-LABEL: @test(
+;
+; Test that we correctly recognize the discontiguous memory in arrays where the
+; size is less than the alignment, and through various different GEP formations.
+;
+; We disable the vectorization of x86_fp80 for now.
+
+entry:
+ %i1.0 = load x86_fp80* %i1, align 16
+ %i1.gep1 = getelementptr x86_fp80* %i1, i64 1
+ %i1.1 = load x86_fp80* %i1.gep1, align 16
+; CHECK: load x86_fp80*
+; CHECK: load x86_fp80*
+; CHECK-NOT: insertelement <2 x x86_fp80>
+; CHECK_NOT: insertelement <2 x x86_fp80>
+ br i1 undef, label %then, label %end
+
+then:
+ %i2.gep0 = getelementptr inbounds x86_fp80* %i2, i64 0
+ %i2.0 = load x86_fp80* %i2.gep0, align 16
+ %i2.gep1 = getelementptr inbounds x86_fp80* %i2, i64 1
+ %i2.1 = load x86_fp80* %i2.gep1, align 16
+; CHECK: load x86_fp80*
+; CHECK: load x86_fp80*
+; CHECK-NOT: insertelement <2 x x86_fp80>
+; CHECK-NOT: insertelement <2 x x86_fp80>
+ br label %end
+
+end:
+ %phi0 = phi x86_fp80 [ %i1.0, %entry ], [ %i2.0, %then ]
+ %phi1 = phi x86_fp80 [ %i1.1, %entry ], [ %i2.1, %then ]
+; CHECK-NOT: phi <2 x x86_fp80>
+; CHECK-NOT: extractelement <2 x x86_fp80>
+; CHECK-NOT: extractelement <2 x x86_fp80>
+ store x86_fp80 %phi0, x86_fp80* %o, align 16
+ %o.gep1 = getelementptr inbounds x86_fp80* %o, i64 1
+ store x86_fp80 %phi1, x86_fp80* %o.gep1, align 16
+ ret void
+}
diff --git a/test/Transforms/SLPVectorizer/X86/phi3.ll b/test/Transforms/SLPVectorizer/X86/phi3.ll
new file mode 100644
index 000000000000..fd8d36137201
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/phi3.ll
@@ -0,0 +1,35 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
+
+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.GPar.0.16.26 = type { [0 x double], double }
+
+@d = external global double, align 8
+
+declare %struct.GPar.0.16.26* @Rf_gpptr(...)
+
+define void @Rf_GReset() {
+entry:
+ %sub = fsub double -0.000000e+00, undef
+ %0 = load double* @d, align 8
+ %sub1 = fsub double -0.000000e+00, %0
+ br i1 icmp eq (%struct.GPar.0.16.26* (...)* inttoptr (i64 115 to %struct.GPar.0.16.26* (...)*), %struct.GPar.0.16.26* (...)* @Rf_gpptr), label %if.then, label %if.end7
+
+if.then: ; preds = %entry
+ %sub2 = fsub double %sub, undef
+ %div.i = fdiv double %sub2, undef
+ %sub4 = fsub double %sub1, undef
+ %div.i16 = fdiv double %sub4, undef
+ %cmp = fcmp ogt double %div.i, %div.i16
+ br i1 %cmp, label %if.then6, label %if.end7
+
+if.then6: ; preds = %if.then
+ br label %if.end7
+
+if.end7: ; preds = %if.then6, %if.then, %entry
+ %g.0 = phi double [ 0.000000e+00, %if.then6 ], [ %sub, %if.then ], [ %sub, %entry ]
+ ret void
+}
+
+
diff --git a/test/Transforms/SLPVectorizer/X86/phi_landingpad.ll b/test/Transforms/SLPVectorizer/X86/phi_landingpad.ll
new file mode 100644
index 000000000000..6d2d5e3540c7
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/phi_landingpad.ll
@@ -0,0 +1,31 @@
+; RUN: opt < %s -slp-vectorizer -mtriple=x86_64-apple-macosx10.9.0 -disable-output
+
+target datalayout = "f64:64:64-v64:64:64"
+
+define void @test_phi_in_landingpad() {
+entry:
+ invoke void @foo()
+ to label %inner unwind label %lpad
+
+inner:
+ %x0 = fsub double undef, undef
+ %y0 = fsub double undef, undef
+ invoke void @foo()
+ to label %done unwind label %lpad
+
+lpad:
+ %x1 = phi double [ undef, %entry ], [ undef, %inner ]
+ %y1 = phi double [ undef, %entry ], [ undef, %inner ]
+ landingpad { i8*, i32 } personality i8*
+ bitcast (i32 (...)* @__gxx_personality_v0 to i8*) catch i8* null
+ br label %done
+
+done:
+ phi double [ %x0, %inner ], [ %x1, %lpad ]
+ phi double [ %y0, %inner ], [ %y1, %lpad ]
+ ret void
+}
+
+declare void @foo()
+
+declare i32 @__gxx_personality_v0(...)
diff --git a/test/Transforms/SLPVectorizer/X86/phi_overalignedtype.ll b/test/Transforms/SLPVectorizer/X86/phi_overalignedtype.ll
new file mode 100644
index 000000000000..520e6729de0c
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/phi_overalignedtype.ll
@@ -0,0 +1,45 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -slp-threshold=-100 -dce -S -mtriple=i386-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+
+; We purposely over-align f64 to 128bit here.
+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:128:128-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128"
+target triple = "i386-apple-macosx10.9.0"
+
+
+define void @test(double* %i1, double* %i2, double* %o) {
+; CHECK-LABEL: @test(
+;
+; Test that we correctly recognize the discontiguous memory in arrays where the
+; size is less than the alignment, and through various different GEP formations.
+
+entry:
+ %i1.0 = load double* %i1, align 16
+ %i1.gep1 = getelementptr double* %i1, i64 1
+ %i1.1 = load double* %i1.gep1, align 16
+; CHECK: load double*
+; CHECK: load double*
+; CHECK: insertelement <2 x double>
+; CHECK: insertelement <2 x double>
+ br i1 undef, label %then, label %end
+
+then:
+ %i2.gep0 = getelementptr inbounds double* %i2, i64 0
+ %i2.0 = load double* %i2.gep0, align 16
+ %i2.gep1 = getelementptr inbounds double* %i2, i64 1
+ %i2.1 = load double* %i2.gep1, align 16
+; CHECK: load double*
+; CHECK: load double*
+; CHECK: insertelement <2 x double>
+; CHECK: insertelement <2 x double>
+ br label %end
+
+end:
+ %phi0 = phi double [ %i1.0, %entry ], [ %i2.0, %then ]
+ %phi1 = phi double [ %i1.1, %entry ], [ %i2.1, %then ]
+; CHECK: phi <2 x double>
+; CHECK: extractelement <2 x double>
+; CHECK: extractelement <2 x double>
+ store double %phi0, double* %o, align 16
+ %o.gep1 = getelementptr inbounds double* %o, i64 1
+ store double %phi1, double* %o.gep1, align 16
+ ret void
+}
diff --git a/test/Transforms/SLPVectorizer/X86/pr16571.ll b/test/Transforms/SLPVectorizer/X86/pr16571.ll
new file mode 100644
index 000000000000..13d82149c0c5
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/pr16571.ll
@@ -0,0 +1,22 @@
+; RUN: opt < %s -slp-vectorizer -S -mtriple=i686-pc-win32 -mcpu=corei7-avx
+
+target datalayout = "e-p:32:32:32-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-f80:32:32-n8:16:32-S32"
+target triple = "i686-pc-win32"
+
+define hidden fastcc void @"System.PrimitiveTypesParser.TryParseIEEE754<char>(char*,uint,double&)"() unnamed_addr {
+"@0":
+ br i1 undef, label %"@38.lr.ph", label %"@37"
+
+"@37": ; preds = %"@38.lr.ph", %"@44", %"@0"
+ ret void
+
+"@44": ; preds = %"@38.lr.ph"
+ %0 = add i64 undef, undef
+ %1 = add i32 %mainPartDigits.loc.0.ph45, 1
+ br i1 undef, label %"@38.lr.ph", label %"@37"
+
+"@38.lr.ph": ; preds = %"@44", %"@0"
+ %mainDoublePart.loc.0.ph46 = phi i64 [ %0, %"@44" ], [ 0, %"@0" ]
+ %mainPartDigits.loc.0.ph45 = phi i32 [ %1, %"@44" ], [ 0, %"@0" ]
+ br i1 undef, label %"@44", label %"@37"
+}
diff --git a/test/Transforms/SLPVectorizer/X86/pr16628.ll b/test/Transforms/SLPVectorizer/X86/pr16628.ll
new file mode 100644
index 000000000000..3f9d775eeeb6
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/pr16628.ll
@@ -0,0 +1,27 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
+
+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.9.0"
+
+@c = common global i32 0, align 4
+@a = common global i16 0, align 2
+@b = common global i16 0, align 2
+
+; Function Attrs: nounwind ssp uwtable
+define void @f() {
+entry:
+ %call = tail call i32 (...)* @g()
+ %0 = load i32* @c, align 4
+ %lnot = icmp eq i32 %0, 0
+ %lnot.ext = zext i1 %lnot to i32
+ %1 = load i16* @a, align 2
+ %lnot2 = icmp eq i16 %1, 0
+ %lnot.ext3 = zext i1 %lnot2 to i32
+ %or = or i32 %lnot.ext3, %lnot.ext
+ %cmp = icmp eq i32 %call, %or
+ %conv4 = zext i1 %cmp to i16
+ store i16 %conv4, i16* @b, align 2
+ ret void
+}
+
+declare i32 @g(...)
diff --git a/test/Transforms/SLPVectorizer/X86/pr16899.ll b/test/Transforms/SLPVectorizer/X86/pr16899.ll
new file mode 100644
index 000000000000..8631bc9125df
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/pr16899.ll
@@ -0,0 +1,31 @@
+; RUN: opt < %s -slp-vectorizer -S -mtriple=i386--netbsd -mcpu=i486
+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:32:32-n8:16:32-S128"
+target triple = "i386--netbsd"
+
+@a = common global i32* null, align 4
+
+; Function Attrs: noreturn nounwind readonly
+define i32 @fn1() #0 {
+entry:
+ %0 = load i32** @a, align 4, !tbaa !4
+ %1 = load i32* %0, align 4, !tbaa !5
+ %arrayidx1 = getelementptr inbounds i32* %0, i32 1
+ %2 = load i32* %arrayidx1, align 4, !tbaa !5
+ br label %do.body
+
+do.body: ; preds = %do.body, %entry
+ %c.0 = phi i32 [ %2, %entry ], [ %add2, %do.body ]
+ %b.0 = phi i32 [ %1, %entry ], [ %add, %do.body ]
+ %add = add nsw i32 %b.0, %c.0
+ %add2 = add nsw i32 %add, 1
+ br label %do.body
+}
+
+attributes #0 = { noreturn nounwind readonly "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+
+!0 = metadata !{metadata !"any pointer", metadata !1}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA"}
+!3 = metadata !{metadata !"int", metadata !1}
+!4 = metadata !{metadata !0, metadata !0, i64 0}
+!5 = metadata !{metadata !3, metadata !3, i64 0}
diff --git a/test/Transforms/SLPVectorizer/X86/pr18060.ll b/test/Transforms/SLPVectorizer/X86/pr18060.ll
new file mode 100644
index 000000000000..e6813f3b315d
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/pr18060.ll
@@ -0,0 +1,47 @@
+; RUN: opt < %s -slp-vectorizer -S -mtriple=i386-pc-linux
+
+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:32:32-n8:16:32-S128"
+target triple = "i386-pc-linux"
+
+; Function Attrs: nounwind
+define i32 @_Z16adjustFixupValueyj(i64 %Value, i32 %Kind) {
+entry:
+ %extract.t = trunc i64 %Value to i32
+ %extract = lshr i64 %Value, 12
+ %extract.t6 = trunc i64 %extract to i32
+ switch i32 %Kind, label %sw.default [
+ i32 0, label %return
+ i32 1, label %return
+ i32 129, label %sw.bb1
+ i32 130, label %sw.bb2
+ ]
+
+sw.default: ; preds = %entry
+ call void @_Z25llvm_unreachable_internalv()
+ unreachable
+
+sw.bb1: ; preds = %entry
+ %shr = lshr i64 %Value, 16
+ %extract.t5 = trunc i64 %shr to i32
+ %extract7 = lshr i64 %Value, 28
+ %extract.t8 = trunc i64 %extract7 to i32
+ br label %sw.bb2
+
+sw.bb2: ; preds = %sw.bb1, %entry
+ %Value.addr.0.off0 = phi i32 [ %extract.t, %entry ], [ %extract.t5, %sw.bb1 ]
+ %Value.addr.0.off12 = phi i32 [ %extract.t6, %entry ], [ %extract.t8, %sw.bb1 ]
+ %conv6 = and i32 %Value.addr.0.off0, 4095
+ %conv4 = shl i32 %Value.addr.0.off12, 16
+ %shl = and i32 %conv4, 983040
+ %or = or i32 %shl, %conv6
+ %or11 = or i32 %or, 8388608
+ br label %return
+
+return: ; preds = %sw.bb2, %entry, %entry
+ %retval.0 = phi i32 [ %or11, %sw.bb2 ], [ %extract.t, %entry ], [ %extract.t, %entry ]
+ ret i32 %retval.0
+}
+
+; Function Attrs: noreturn
+declare void @_Z25llvm_unreachable_internalv()
+
diff --git a/test/Transforms/SLPVectorizer/X86/reduction2.ll b/test/Transforms/SLPVectorizer/X86/reduction2.ll
index 7aa7d7e243d0..f21e86c5646c 100644
--- a/test/Transforms/SLPVectorizer/X86/reduction2.ll
+++ b/test/Transforms/SLPVectorizer/X86/reduction2.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128"
target triple = "i386-apple-macosx10.8.0"
-;CHECK: @foo
+;CHECK-LABEL: @foo(
;CHECK: load <2 x double>
;CHECK: ret
define double @foo(double* nocapture %D) {
@@ -16,11 +16,13 @@ define double @foo(double* nocapture %D) {
%3 = getelementptr inbounds double* %D, i32 %2
%4 = load double* %3, align 4
%A4 = fmul double %4, %4
+ %A42 = fmul double %A4, %A4
%5 = or i32 %2, 1
%6 = getelementptr inbounds double* %D, i32 %5
%7 = load double* %6, align 4
%A7 = fmul double %7, %7
- %8 = fadd double %A4, %A7
+ %A72 = fmul double %A7, %A7
+ %8 = fadd double %A42, %A72
%9 = fadd double %sum.01, %8
%10 = add nsw i32 %i.02, 1
%exitcond = icmp eq i32 %10, 100
diff --git a/test/Transforms/SLPVectorizer/X86/rgb_phi.ll b/test/Transforms/SLPVectorizer/X86/rgb_phi.ll
new file mode 100644
index 000000000000..6aea5d3c6f6b
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/rgb_phi.ll
@@ -0,0 +1,76 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=i386-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+
+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-S128"
+target triple = "i386-apple-macosx10.9.0"
+
+; We disable the vectorization of <3 x float> for now
+
+; float foo(float *A) {
+;
+; float R = A[0];
+; float G = A[1];
+; float B = A[2];
+; for (int i=0; i < 121; i+=3) {
+; R+=A[i+0]*7;
+; G+=A[i+1]*8;
+; B+=A[i+2]*9;
+; }
+;
+; return R+G+B;
+; }
+
+;CHECK-LABEL: @foo(
+;CHECK: br
+;CHECK-NOT: phi <3 x float>
+;CHECK-NOT: fmul <3 x float>
+;CHECK-NOT: fadd <3 x float>
+; At the moment we don't sink extractelements.
+;CHECK: br
+;CHECK-NOT: extractelement
+;CHECK-NOT: extractelement
+;CHECK-NOT: extractelement
+;CHECK: ret
+
+define float @foo(float* nocapture readonly %A) {
+entry:
+ %0 = load float* %A, align 4
+ %arrayidx1 = getelementptr inbounds float* %A, i64 1
+ %1 = load float* %arrayidx1, align 4
+ %arrayidx2 = getelementptr inbounds float* %A, i64 2
+ %2 = load float* %arrayidx2, align 4
+ br label %for.body
+
+for.body: ; preds = %for.body.for.body_crit_edge, %entry
+ %3 = phi float [ %0, %entry ], [ %.pre, %for.body.for.body_crit_edge ]
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body.for.body_crit_edge ]
+ %B.032 = phi float [ %2, %entry ], [ %add14, %for.body.for.body_crit_edge ]
+ %G.031 = phi float [ %1, %entry ], [ %add9, %for.body.for.body_crit_edge ]
+ %R.030 = phi float [ %0, %entry ], [ %add4, %for.body.for.body_crit_edge ]
+ %mul = fmul float %3, 7.000000e+00
+ %add4 = fadd float %R.030, %mul
+ %4 = add nsw i64 %indvars.iv, 1
+ %arrayidx7 = getelementptr inbounds float* %A, i64 %4
+ %5 = load float* %arrayidx7, align 4
+ %mul8 = fmul float %5, 8.000000e+00
+ %add9 = fadd float %G.031, %mul8
+ %6 = add nsw i64 %indvars.iv, 2
+ %arrayidx12 = getelementptr inbounds float* %A, i64 %6
+ %7 = load float* %arrayidx12, align 4
+ %mul13 = fmul float %7, 9.000000e+00
+ %add14 = fadd float %B.032, %mul13
+ %indvars.iv.next = add i64 %indvars.iv, 3
+ %8 = trunc i64 %indvars.iv.next to i32
+ %cmp = icmp slt i32 %8, 121
+ br i1 %cmp, label %for.body.for.body_crit_edge, label %for.end
+
+for.body.for.body_crit_edge: ; preds = %for.body
+ %arrayidx3.phi.trans.insert = getelementptr inbounds float* %A, i64 %indvars.iv.next
+ %.pre = load float* %arrayidx3.phi.trans.insert, align 4
+ br label %for.body
+
+for.end: ; preds = %for.body
+ %add16 = fadd float %add4, %add9
+ %add17 = fadd float %add16, %add14
+ ret float %add17
+}
+
diff --git a/test/Transforms/SLPVectorizer/X86/saxpy.ll b/test/Transforms/SLPVectorizer/X86/saxpy.ll
index b520913a398d..46263416a90b 100644
--- a/test/Transforms/SLPVectorizer/X86/saxpy.ll
+++ b/test/Transforms/SLPVectorizer/X86/saxpy.ll
@@ -43,3 +43,19 @@ define void @SAXPY(i32* noalias nocapture %x, i32* noalias nocapture %y, i32 %a,
ret void
}
+; Make sure we don't crash on this one.
+define void @SAXPY_crash(i32* noalias nocapture %x, i32* noalias nocapture %y, i64 %i) {
+ %1 = add i64 %i, 1
+ %2 = getelementptr inbounds i32* %x, i64 %1
+ %3 = getelementptr inbounds i32* %y, i64 %1
+ %4 = load i32* %3, align 4
+ %5 = add nsw i32 undef, %4
+ store i32 %5, i32* %2, align 4
+ %6 = add i64 %i, 2
+ %7 = getelementptr inbounds i32* %x, i64 %6
+ %8 = getelementptr inbounds i32* %y, i64 %6
+ %9 = load i32* %8, align 4
+ %10 = add nsw i32 undef, %9
+ store i32 %10, i32* %7, align 4
+ ret void
+}
diff --git a/test/Transforms/SLPVectorizer/X86/simplebb.ll b/test/Transforms/SLPVectorizer/X86/simplebb.ll
index cd0b99e64677..7d682e5e4676 100644
--- a/test/Transforms/SLPVectorizer/X86/simplebb.ll
+++ b/test/Transforms/SLPVectorizer/X86/simplebb.ll
@@ -23,3 +23,67 @@ entry:
ret void
}
+; Simple 3-pair chain with loads and stores, obfuscated with bitcasts
+; CHECK: test2
+; CHECK: store <2 x double>
+; CHECK: ret
+define void @test2(double* %a, double* %b, i8* %e) {
+entry:
+ %i0 = load double* %a, align 8
+ %i1 = load double* %b, align 8
+ %mul = fmul double %i0, %i1
+ %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
+ %c = bitcast i8* %e to double*
+ store double %mul, double* %c, align 8
+ %carrayidx5 = getelementptr inbounds i8* %e, i64 8
+ %arrayidx5 = bitcast i8* %carrayidx5 to double*
+ store double %mul5, double* %arrayidx5, align 8
+ ret void
+}
+
+; Don't vectorize volatile loads.
+; CHECK: test_volatile_load
+; CHECK-NOT: load <2 x double>
+; CHECK: store <2 x double>
+; CHECK: ret
+define void @test_volatile_load(double* %a, double* %b, double* %c) {
+entry:
+ %i0 = load volatile double* %a, align 8
+ %i1 = load volatile double* %b, align 8
+ %mul = fmul double %i0, %i1
+ %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
+ store double %mul, double* %c, align 8
+ %arrayidx5 = getelementptr inbounds double* %c, i64 1
+ store double %mul5, double* %arrayidx5, align 8
+ ret void
+}
+
+; Don't vectorize volatile stores.
+; CHECK: test_volatile_store
+; CHECK-NOT: store <2 x double>
+; CHECK: ret
+define void @test_volatile_store(double* %a, double* %b, double* %c) {
+entry:
+ %i0 = load double* %a, align 8
+ %i1 = load double* %b, align 8
+ %mul = fmul double %i0, %i1
+ %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
+ store volatile double %mul, double* %c, align 8
+ %arrayidx5 = getelementptr inbounds double* %c, i64 1
+ store volatile double %mul5, double* %arrayidx5, align 8
+ ret void
+}
+
+
diff --git a/test/Transforms/SLPVectorizer/X86/tiny-tree.ll b/test/Transforms/SLPVectorizer/X86/tiny-tree.ll
new file mode 100644
index 000000000000..2747a1f48997
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/X86/tiny-tree.ll
@@ -0,0 +1,140 @@
+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"
+; RUN: opt < %s -basicaa -slp-vectorizer -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7 | FileCheck %s
+
+
+; CHECK: tiny_tree_fully_vectorizable
+; CHECK: load <2 x double>
+; CHECK: store <2 x double>
+; CHECK: ret
+
+define void @tiny_tree_fully_vectorizable(double* noalias nocapture %dst, double* noalias nocapture readonly %src, i64 %count) #0 {
+entry:
+ %cmp12 = icmp eq i64 %count, 0
+ br i1 %cmp12, label %for.end, label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %i.015 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
+ %dst.addr.014 = phi double* [ %add.ptr4, %for.body ], [ %dst, %entry ]
+ %src.addr.013 = phi double* [ %add.ptr, %for.body ], [ %src, %entry ]
+ %0 = load double* %src.addr.013, align 8
+ store double %0, double* %dst.addr.014, align 8
+ %arrayidx2 = getelementptr inbounds double* %src.addr.013, i64 1
+ %1 = load double* %arrayidx2, align 8
+ %arrayidx3 = getelementptr inbounds double* %dst.addr.014, i64 1
+ store double %1, double* %arrayidx3, align 8
+ %add.ptr = getelementptr inbounds double* %src.addr.013, i64 %i.015
+ %add.ptr4 = getelementptr inbounds double* %dst.addr.014, i64 %i.015
+ %inc = add i64 %i.015, 1
+ %exitcond = icmp eq i64 %inc, %count
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ ret void
+}
+
+; CHECK: tiny_tree_fully_vectorizable2
+; CHECK: load <4 x float>
+; CHECK: store <4 x float>
+; CHECK: ret
+
+define void @tiny_tree_fully_vectorizable2(float* noalias nocapture %dst, float* noalias nocapture readonly %src, i64 %count) #0 {
+entry:
+ %cmp20 = icmp eq i64 %count, 0
+ br i1 %cmp20, label %for.end, label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %i.023 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
+ %dst.addr.022 = phi float* [ %add.ptr8, %for.body ], [ %dst, %entry ]
+ %src.addr.021 = phi float* [ %add.ptr, %for.body ], [ %src, %entry ]
+ %0 = load float* %src.addr.021, align 4
+ store float %0, float* %dst.addr.022, align 4
+ %arrayidx2 = getelementptr inbounds float* %src.addr.021, i64 1
+ %1 = load float* %arrayidx2, align 4
+ %arrayidx3 = getelementptr inbounds float* %dst.addr.022, i64 1
+ store float %1, float* %arrayidx3, align 4
+ %arrayidx4 = getelementptr inbounds float* %src.addr.021, i64 2
+ %2 = load float* %arrayidx4, align 4
+ %arrayidx5 = getelementptr inbounds float* %dst.addr.022, i64 2
+ store float %2, float* %arrayidx5, align 4
+ %arrayidx6 = getelementptr inbounds float* %src.addr.021, i64 3
+ %3 = load float* %arrayidx6, align 4
+ %arrayidx7 = getelementptr inbounds float* %dst.addr.022, i64 3
+ store float %3, float* %arrayidx7, align 4
+ %add.ptr = getelementptr inbounds float* %src.addr.021, i64 %i.023
+ %add.ptr8 = getelementptr inbounds float* %dst.addr.022, i64 %i.023
+ %inc = add i64 %i.023, 1
+ %exitcond = icmp eq i64 %inc, %count
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ ret void
+}
+
+; We do not vectorize the tiny tree which is not fully vectorizable.
+; CHECK: tiny_tree_not_fully_vectorizable
+; CHECK-NOT: <2 x double>
+; CHECK: ret
+
+define void @tiny_tree_not_fully_vectorizable(double* noalias nocapture %dst, double* noalias nocapture readonly %src, i64 %count) #0 {
+entry:
+ %cmp12 = icmp eq i64 %count, 0
+ br i1 %cmp12, label %for.end, label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %i.015 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
+ %dst.addr.014 = phi double* [ %add.ptr4, %for.body ], [ %dst, %entry ]
+ %src.addr.013 = phi double* [ %add.ptr, %for.body ], [ %src, %entry ]
+ %0 = load double* %src.addr.013, align 8
+ store double %0, double* %dst.addr.014, align 8
+ %arrayidx2 = getelementptr inbounds double* %src.addr.013, i64 2
+ %1 = load double* %arrayidx2, align 8
+ %arrayidx3 = getelementptr inbounds double* %dst.addr.014, i64 1
+ store double %1, double* %arrayidx3, align 8
+ %add.ptr = getelementptr inbounds double* %src.addr.013, i64 %i.015
+ %add.ptr4 = getelementptr inbounds double* %dst.addr.014, i64 %i.015
+ %inc = add i64 %i.015, 1
+ %exitcond = icmp eq i64 %inc, %count
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ ret void
+}
+
+
+; CHECK: tiny_tree_not_fully_vectorizable2
+; CHECK-NOT: <2 x double>
+; CHECK: ret
+
+define void @tiny_tree_not_fully_vectorizable2(float* noalias nocapture %dst, float* noalias nocapture readonly %src, i64 %count) #0 {
+entry:
+ %cmp20 = icmp eq i64 %count, 0
+ br i1 %cmp20, label %for.end, label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %i.023 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
+ %dst.addr.022 = phi float* [ %add.ptr8, %for.body ], [ %dst, %entry ]
+ %src.addr.021 = phi float* [ %add.ptr, %for.body ], [ %src, %entry ]
+ %0 = load float* %src.addr.021, align 4
+ store float %0, float* %dst.addr.022, align 4
+ %arrayidx2 = getelementptr inbounds float* %src.addr.021, i64 4
+ %1 = load float* %arrayidx2, align 4
+ %arrayidx3 = getelementptr inbounds float* %dst.addr.022, i64 1
+ store float %1, float* %arrayidx3, align 4
+ %arrayidx4 = getelementptr inbounds float* %src.addr.021, i64 2
+ %2 = load float* %arrayidx4, align 4
+ %arrayidx5 = getelementptr inbounds float* %dst.addr.022, i64 2
+ store float %2, float* %arrayidx5, align 4
+ %arrayidx6 = getelementptr inbounds float* %src.addr.021, i64 3
+ %3 = load float* %arrayidx6, align 4
+ %arrayidx7 = getelementptr inbounds float* %dst.addr.022, i64 3
+ store float %3, float* %arrayidx7, align 4
+ %add.ptr = getelementptr inbounds float* %src.addr.021, i64 %i.023
+ %add.ptr8 = getelementptr inbounds float* %dst.addr.022, i64 %i.023
+ %inc = add i64 %i.023, 1
+ %exitcond = icmp eq i64 %inc, %count
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ ret void
+}
diff --git a/test/Transforms/SLPVectorizer/XCore/lit.local.cfg b/test/Transforms/SLPVectorizer/XCore/lit.local.cfg
new file mode 100644
index 000000000000..4d17d4642045
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/XCore/lit.local.cfg
@@ -0,0 +1,3 @@
+targets = set(config.root.targets_to_build.split())
+if not 'XCore' in targets:
+ config.unsupported = True
diff --git a/test/Transforms/SLPVectorizer/XCore/no-vector-registers.ll b/test/Transforms/SLPVectorizer/XCore/no-vector-registers.ll
new file mode 100644
index 000000000000..66392e74cb31
--- /dev/null
+++ b/test/Transforms/SLPVectorizer/XCore/no-vector-registers.ll
@@ -0,0 +1,24 @@
+; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=xcore | FileCheck %s
+
+target datalayout = "e-p:32:32:32-a0:0:32-n32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f16:16:32-f32:32:32-f64:32:32"
+target triple = "xcore"
+
+; Simple 3-pair chain with loads and stores
+; CHECK: test1
+; CHECK-NOT: <2 x double>
+define void @test1(double* %a, double* %b, double* %c) {
+entry:
+ %i0 = load double* %a, align 8
+ %i1 = load double* %b, align 8
+ %mul = fmul double %i0, %i1
+ %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
+ store double %mul, double* %c, align 8
+ %arrayidx5 = getelementptr inbounds double* %c, i64 1
+ store double %mul5, double* %arrayidx5, align 8
+ ret void
+}
+
diff --git a/test/Transforms/SLPVectorizer/lit.local.cfg b/test/Transforms/SLPVectorizer/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/SLPVectorizer/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/SROA/alignment.ll b/test/Transforms/SROA/alignment.ll
index ad5fb6c4a5d8..5fa78766ed0f 100644
--- a/test/Transforms/SROA/alignment.ll
+++ b/test/Transforms/SROA/alignment.ll
@@ -4,7 +4,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
define void @test1({ i8, i8 }* %a, { i8, i8 }* %b) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %[[gep_a0:.*]] = getelementptr inbounds { i8, i8 }* %a, i64 0, i32 0
; CHECK: %[[a0:.*]] = load i8* %[[gep_a0]], align 16
; CHECK: %[[gep_a1:.*]] = getelementptr inbounds { i8, i8 }* %a, i64 0, i32 1
@@ -29,7 +29,7 @@ entry:
}
define void @test2() {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: alloca i16
; CHECK: load i8* %{{.*}}
; CHECK: store i8 42, i8* %{{.*}}
@@ -48,7 +48,7 @@ entry:
define void @PR13920(<2 x i64>* %a, i16* %b) {
; Test that alignments on memcpy intrinsics get propagated to loads and stores.
-; CHECK: @PR13920
+; CHECK-LABEL: @PR13920(
; CHECK: load <2 x i64>* %a, align 2
; CHECK: store <2 x i64> {{.*}}, <2 x i64>* {{.*}}, align 2
; CHECK: ret void
@@ -68,7 +68,7 @@ define void @test3(i8* %x) {
; provide the needed explicit alignment that code using the alloca may be
; expecting. However, also check that any offset within an alloca can in turn
; reduce the alignment.
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: alloca [22 x i8], align 8
; CHECK: alloca [18 x i8], align 2
; CHECK: ret void
@@ -86,7 +86,7 @@ entry:
define void @test5() {
; Test that we preserve underaligned loads and stores when splitting.
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: alloca [9 x i8]
; CHECK: alloca [9 x i8]
; CHECK: store volatile double 0.0{{.*}}, double* %{{.*}}, align 1
@@ -119,7 +119,7 @@ entry:
define void @test6() {
; Test that we promote alignment when the underlying alloca switches to one
; that innately provides it.
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: alloca double
; CHECK: alloca double
; CHECK-NOT: align
@@ -142,7 +142,7 @@ entry:
define void @test7(i8* %out) {
; Test that we properly compute the destination alignment when rewriting
; memcpys as direct loads or stores.
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NOT: alloca
entry:
diff --git a/test/Transforms/SROA/basictest.ll b/test/Transforms/SROA/basictest.ll
index 834032246f9a..5d3e4b5d8b2c 100644
--- a/test/Transforms/SROA/basictest.ll
+++ b/test/Transforms/SROA/basictest.ll
@@ -7,7 +7,7 @@ declare void @llvm.lifetime.start(i64, i8* nocapture)
declare void @llvm.lifetime.end(i64, i8* nocapture)
define i32 @test0() {
-; CHECK: @test0
+; CHECK-LABEL: @test0(
; CHECK-NOT: alloca
; CHECK: ret i32
@@ -37,7 +37,7 @@ entry:
}
define i32 @test1() {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NOT: alloca
; CHECK: ret i32 0
@@ -50,7 +50,7 @@ entry:
}
define i64 @test2(i64 %X) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NOT: alloca
; CHECK: ret i64 %X
@@ -66,7 +66,7 @@ L2:
}
define void @test3(i8* %dst, i8* %src) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
entry:
%a = alloca [300 x i8]
@@ -302,7 +302,7 @@ entry:
}
define void @test4(i8* %dst, i8* %src) {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
entry:
%a = alloca [100 x i8]
@@ -408,7 +408,7 @@ declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32,
declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind
define i16 @test5() {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NOT: alloca float
; CHECK: %[[cast:.*]] = bitcast float 0.0{{.*}} to i32
; CHECK-NEXT: %[[shr:.*]] = lshr i32 %[[cast]], 16
@@ -426,7 +426,7 @@ entry:
}
define i32 @test6() {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: alloca i32
; CHECK-NEXT: store volatile i32
; CHECK-NEXT: load i32*
@@ -442,7 +442,7 @@ entry:
}
define void @test7(i8* %src, i8* %dst) {
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: alloca i32
; CHECK-NEXT: bitcast i8* %src to i32*
; CHECK-NEXT: load volatile i32*
@@ -465,7 +465,7 @@ entry:
%S2 = type { %S1*, %S2* }
define %S2 @test8(%S2* %s2) {
-; CHECK: @test8
+; CHECK-LABEL: @test8(
entry:
%new = alloca %S2
; CHECK-NOT: alloca
@@ -503,7 +503,7 @@ define i64 @test9() {
; weird bit casts and types. This is valid IR due to the alignment and masking
; off the bits past the end of the alloca.
;
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK-NOT: alloca
; CHECK: %[[b2:.*]] = zext i8 26 to i64
; CHECK-NEXT: %[[s2:.*]] = shl i64 %[[b2]], 16
@@ -535,7 +535,7 @@ entry:
}
define %S2* @test10() {
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK-NOT: alloca %S2*
; CHECK: ret %S2* null
@@ -549,7 +549,7 @@ entry:
}
define i32 @test11() {
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK-NOT: alloca
; CHECK: ret i32 0
@@ -574,7 +574,7 @@ define i8 @test12() {
; We fully promote these to the i24 load or store size, resulting in just masks
; and other operations that instcombine will fold, but no alloca.
;
-; CHECK: @test12
+; CHECK-LABEL: @test12(
entry:
%a = alloca [3 x i8]
@@ -630,7 +630,7 @@ entry:
define i32 @test13() {
; Ensure we don't crash and handle undefined loads that straddle the end of the
; allocation.
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; CHECK: %[[value:.*]] = zext i8 0 to i16
; CHECK-NEXT: %[[ret:.*]] = zext i16 %[[value]] to i32
; CHECK-NEXT: ret i32 %[[ret]]
@@ -657,7 +657,7 @@ define void @test14(...) nounwind uwtable {
; also gain enough data to prove they must be dead allocas due to GEPs that walk
; across two adjacent allocas. Test that we don't try to promote or otherwise
; do bad things to these dead allocas, they should just be removed.
-; CHECK: @test14
+; CHECK-LABEL: @test14(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret void
@@ -688,7 +688,7 @@ define i32 @test15(i1 %flag) nounwind uwtable {
; Ensure that when there are dead instructions using an alloca that are not
; loads or stores we still delete them during partitioning and rewriting.
; Otherwise we'll go to promote them while thy still have unpromotable uses.
-; CHECK: @test15
+; CHECK-LABEL: @test15(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label %loop
; CHECK: loop:
@@ -731,7 +731,7 @@ loop:
define void @test16(i8* %src, i8* %dst) {
; Ensure that we can promote an alloca of [3 x i8] to an i24 SSA value.
-; CHECK: @test16
+; CHECK-LABEL: @test16(
; CHECK-NOT: alloca
; CHECK: %[[srccast:.*]] = bitcast i8* %src to i24*
; CHECK-NEXT: load i24* %[[srccast]]
@@ -752,7 +752,7 @@ entry:
define void @test17(i8* %src, i8* %dst) {
; Ensure that we can rewrite unpromotable memcpys which extend past the end of
; the alloca.
-; CHECK: @test17
+; CHECK-LABEL: @test17(
; CHECK: %[[a:.*]] = alloca [3 x i8]
; CHECK-NEXT: %[[ptr:.*]] = getelementptr [3 x i8]* %[[a]], i32 0, i32 0
; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %[[ptr]], i8* %src,
@@ -771,7 +771,7 @@ define void @test18(i8* %src, i8* %dst, i32 %size) {
; Preserve transfer instrinsics with a variable size, even if they overlap with
; fixed size operations. Further, continue to split and promote allocas preceding
; the variable sized intrinsic.
-; CHECK: @test18
+; CHECK-LABEL: @test18(
; CHECK: %[[a:.*]] = alloca [34 x i8]
; CHECK: %[[srcgep1:.*]] = getelementptr inbounds i8* %src, i64 4
; CHECK-NEXT: %[[srccast1:.*]] = bitcast i8* %[[srcgep1]] to i32*
@@ -810,7 +810,7 @@ define i32 @test19(%opaque* %x) {
; pointers in such a way that we try to GEP through the opaque type. Previously,
; a check for an unsized type was missing and this crashed. Ensure it behaves
; reasonably now.
-; CHECK: @test19
+; CHECK-LABEL: @test19(
; CHECK-NOT: alloca
; CHECK: ret i32 undef
@@ -827,7 +827,7 @@ entry:
define i32 @test20() {
; Ensure we can track negative offsets (before the beginning of the alloca) and
; negative relative offsets from offsets starting past the end of the alloca.
-; CHECK: @test20
+; CHECK-LABEL: @test20(
; CHECK-NOT: alloca
; CHECK: %[[sum1:.*]] = add i32 1, 2
; CHECK: %[[sum2:.*]] = add i32 %[[sum1]], 3
@@ -858,7 +858,7 @@ define i8 @test21() {
; Test allocations and offsets which border on overflow of the int64_t used
; internally. This is really awkward to really test as LLVM doesn't really
; support such extreme constructs cleanly.
-; CHECK: @test21
+; CHECK-LABEL: @test21(
; CHECK-NOT: alloca
; CHECK: or i8 -1, -1
@@ -926,7 +926,7 @@ define void @PR13990() {
; Ensure we can handle cases where processing one alloca causes the other
; alloca to become dead and get deleted. This might crash or fail under
; Valgrind if we regress.
-; CHECK: @PR13990
+; CHECK-LABEL: @PR13990(
; CHECK-NOT: alloca
; CHECK: unreachable
; CHECK: unreachable
@@ -955,7 +955,7 @@ define double @PR13969(double %x) {
; Check that we detect when promotion will un-escape an alloca and iterate to
; re-try running SROA over that alloca. Without that, the two allocas that are
; stored into a dead alloca don't get rewritten and promoted.
-; CHECK: @PR13969
+; CHECK-LABEL: @PR13969(
entry:
%a = alloca double
@@ -982,7 +982,7 @@ define void @PR14034() {
; This test case tries to form GEPs into the empty leading struct members, and
; subsequently crashed (under valgrind) before we fixed the PR. The important
; thing is to handle empty structs gracefully.
-; CHECK: @PR14034
+; CHECK-LABEL: @PR14034(
entry:
%a = alloca %PR14034.struct
@@ -998,7 +998,7 @@ entry:
define i32 @test22(i32 %x) {
; Test that SROA and promotion is not confused by a grab bax mixture of pointer
; types involving wrapper aggregates and zero-length aggregate members.
-; CHECK: @test22
+; CHECK-LABEL: @test22(
entry:
%a1 = alloca { { [1 x { i32 }] } }
@@ -1134,7 +1134,7 @@ define void @PR14105({ [16 x i8] }* %ptr) {
; Ensure that when rewriting the GEP index '-1' for this alloca we preserve is
; sign as negative. We use a volatile memcpy to ensure promotion never actually
; occurs.
-; CHECK: @PR14105
+; CHECK-LABEL: @PR14105(
entry:
%a = alloca { [16 x i8] }, align 8
@@ -1153,7 +1153,7 @@ entry:
define void @PR14465() {
; Ensure that we don't crash when analyzing a alloca larger than the maximum
; integer type width (MAX_INT_BITS) supported by llvm (1048576*32 > (1<<23)-1).
-; CHECK: @PR14465
+; CHECK-LABEL: @PR14465(
%stack = alloca [1048576 x i32], align 16
; CHECK: alloca [1048576 x i32]
@@ -1170,7 +1170,7 @@ define void @PR14548(i1 %x) {
; iteratively.
; Note that we don't do a particularly good *job* of handling these mixtures,
; but the hope is that this is very rare.
-; CHECK: @PR14548
+; CHECK-LABEL: @PR14548(
entry:
%a = alloca <{ i1 }>, align 8
@@ -1181,7 +1181,6 @@ entry:
store i1 %x, i1* %b.i1, align 8
%b.i8 = bitcast <{ i1 }>* %b to i8*
%foo = load i8* %b.i8, align 1
-; CHECK-NEXT: {{.*}} = zext i1 %x to i8
; CHECK-NEXT: %[[ext:.*]] = zext i1 %x to i8
; CHECK-NEXT: store i8 %[[ext]], i8* %[[a]], align 8
; CHECK-NEXT: {{.*}} = load i8* %[[a]], align 8
@@ -1232,7 +1231,7 @@ entry:
define i32 @PR14601(i32 %x) {
; Don't try to form a promotable integer alloca when there is a variable length
; memory intrinsic.
-; CHECK: @PR14601
+; CHECK-LABEL: @PR14601(
entry:
%a = alloca i32
@@ -1250,7 +1249,7 @@ define void @PR15674(i8* %data, i8* %src, i32 %size) {
; beginning of the array. Ensure that the final integer store, despite being
; convertable to the integer type that we end up promoting this alloca toward,
; doesn't get widened to a full alloca store.
-; CHECK: @PR15674
+; CHECK-LABEL: @PR15674(
entry:
%tmp = alloca [4 x i8], align 1
@@ -1307,8 +1306,8 @@ end:
}
define void @PR15805(i1 %a, i1 %b) {
-; CHECK: @PR15805
-; CHECK: select i1 undef, i64* %c, i64* %c
+; CHECK-LABEL: @PR15805(
+; CHECK-NOT: alloca
; CHECK: ret void
%c = alloca i64, align 8
@@ -1317,3 +1316,43 @@ define void @PR15805(i1 %a, i1 %b) {
%cond = load i64* %cond.in, align 8
ret void
}
+
+define void @PR16651.1(i8* %a) {
+; This test case caused a crash due to the volatile memcpy in combination with
+; lowering to integer loads and stores of a width other than that of the original
+; memcpy.
+;
+; CHECK-LABEL: @PR16651.1(
+; CHECK: alloca i16
+; CHECK: alloca i8
+; CHECK: alloca i8
+; CHECK: unreachable
+
+entry:
+ %b = alloca i32, align 4
+ %b.cast = bitcast i32* %b to i8*
+ call void @llvm.memcpy.p0i8.p0i8.i32(i8* %b.cast, i8* %a, i32 4, i32 4, i1 true)
+ %b.gep = getelementptr inbounds i8* %b.cast, i32 2
+ load i8* %b.gep, align 2
+ unreachable
+}
+
+define void @PR16651.2() {
+; This test case caused a crash due to failing to promote given a select that
+; can't be speculated. It shouldn't be promoted, but we missed that fact when
+; analyzing whether we could form a vector promotion because that code didn't
+; bail on select instructions.
+;
+; CHECK-LABEL: @PR16651.2(
+; CHECK: alloca <2 x float>
+; CHECK: ret void
+
+entry:
+ %tv1 = alloca { <2 x float>, <2 x float> }, align 8
+ %0 = getelementptr { <2 x float>, <2 x float> }* %tv1, i64 0, i32 1
+ store <2 x float> undef, <2 x float>* %0, align 8
+ %1 = getelementptr inbounds { <2 x float>, <2 x float> }* %tv1, i64 0, i32 1, i64 0
+ %cond105.in.i.i = select i1 undef, float* null, float* %1
+ %cond105.i.i = load float* %cond105.in.i.i, align 8
+ ret void
+}
diff --git a/test/Transforms/SROA/big-endian.ll b/test/Transforms/SROA/big-endian.ll
index 64a0cc743974..9e87a9f073c5 100644
--- a/test/Transforms/SROA/big-endian.ll
+++ b/test/Transforms/SROA/big-endian.ll
@@ -9,7 +9,7 @@ define i8 @test1() {
; the same as test12 in basictest.ll, but here we assert big-endian byte
; ordering.
;
-; CHECK: @test1
+; CHECK-LABEL: @test1(
entry:
%a = alloca [3 x i8]
@@ -66,7 +66,7 @@ define i64 @test2() {
; Test for various mixed sizes of integer loads and stores all getting
; promoted.
;
-; CHECK: @test2
+; CHECK-LABEL: @test2(
entry:
%a = alloca [7 x i8]
diff --git a/test/Transforms/SROA/fca.ll b/test/Transforms/SROA/fca.ll
index c30a5cc974fc..e8b4c6c13c88 100644
--- a/test/Transforms/SROA/fca.ll
+++ b/test/Transforms/SROA/fca.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n8:16:32:64"
define { i32, i32 } @test0(i32 %x, i32 %y) {
-; CHECK: @test0
+; CHECK-LABEL: @test0(
; CHECK-NOT: alloca
; CHECK: insertvalue { i32, i32 }
; CHECK: insertvalue { i32, i32 }
@@ -27,7 +27,7 @@ define { i32, i32 } @test1(i32 %x, i32 %y) {
; FIXME: This may be too conservative. Duncan argues that we are allowed to
; split the volatile load and store here but must produce volatile scalar loads
; and stores from them.
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: alloca
; CHECK: alloca
; CHECK: load volatile { i32, i32 }*
diff --git a/test/Transforms/SROA/lit.local.cfg b/test/Transforms/SROA/lit.local.cfg
deleted file mode 100644
index c6106e4746f2..000000000000
--- a/test/Transforms/SROA/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll']
diff --git a/test/Transforms/SROA/phi-and-select.ll b/test/Transforms/SROA/phi-and-select.ll
index b9931800e7f4..8d82964dcbd1 100644
--- a/test/Transforms/SROA/phi-and-select.ll
+++ b/test/Transforms/SROA/phi-and-select.ll
@@ -2,7 +2,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n8:16:32:64"
define i32 @test1() {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
entry:
%a = alloca [2 x i32]
; CHECK-NOT: alloca
@@ -31,7 +31,7 @@ exit:
}
define i32 @test2() {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
entry:
%a = alloca [2 x i32]
; CHECK-NOT: alloca
@@ -54,7 +54,7 @@ entry:
}
define i32 @test3(i32 %x) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
entry:
%a = alloca [2 x i32]
; CHECK-NOT: alloca
@@ -105,7 +105,7 @@ exit:
}
define i32 @test4() {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
entry:
%a = alloca [2 x i32]
; CHECK-NOT: alloca
@@ -129,7 +129,7 @@ entry:
}
define i32 @test5(i32* %b) {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
entry:
%a = alloca [2 x i32]
; CHECK-NOT: alloca
@@ -151,7 +151,7 @@ entry:
declare void @f(i32*, i32*)
define i32 @test6(i32* %b) {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
entry:
%a = alloca [2 x i32]
%c = alloca i32
@@ -182,7 +182,7 @@ entry:
}
define i32 @test7() {
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NOT: alloca
entry:
@@ -210,7 +210,7 @@ exit:
define i32 @test8(i32 %b, i32* %ptr) {
; Ensure that we rewrite allocas to the used type when that use is hidden by
; a PHI that can be speculated.
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK-NOT: alloca
; CHECK-NOT: load
; CHECK: %[[value:.*]] = load i32* %ptr
@@ -238,7 +238,7 @@ exit:
define i32 @test9(i32 %b, i32* %ptr) {
; Same as @test8 but for a select rather than a PHI node.
-; CHECK: @test9
+; CHECK-LABEL: @test9(
; CHECK-NOT: alloca
; CHECK-NOT: load
; CHECK: %[[value:.*]] = load i32* %ptr
@@ -260,7 +260,7 @@ define float @test10(i32 %b, float* %ptr) {
; Don't try to promote allocas which are not elligible for it even after
; rewriting due to the necessity of inserting bitcasts when speculating a PHI
; node.
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK: %[[alloca:.*]] = alloca
; CHECK: %[[argvalue:.*]] = load float* %ptr
; CHECK: %[[cast:.*]] = bitcast double* %[[alloca]] to float*
@@ -289,7 +289,7 @@ exit:
define float @test11(i32 %b, float* %ptr) {
; Same as @test10 but for a select rather than a PHI node.
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK: %[[alloca:.*]] = alloca
; CHECK: %[[cast:.*]] = bitcast double* %[[alloca]] to float*
; CHECK: %[[allocavalue:.*]] = load float* %[[cast]]
@@ -311,7 +311,7 @@ entry:
define i32 @test12(i32 %x, i32* %p) {
; Ensure we don't crash or fail to nuke dead selects of allocas if no load is
; never found.
-; CHECK: @test12
+; CHECK-LABEL: @test12(
; CHECK-NOT: alloca
; CHECK-NOT: select
; CHECK: ret i32 %x
@@ -327,7 +327,7 @@ entry:
define i32 @test13(i32 %x, i32* %p) {
; Ensure we don't crash or fail to nuke dead phis of allocas if no load is ever
; found.
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; CHECK-NOT: alloca
; CHECK-NOT: phi
; CHECK: ret i32 %x
@@ -346,10 +346,47 @@ exit:
ret i32 %load
}
+define i32 @test14(i1 %b1, i1 %b2, i32* %ptr) {
+; Check for problems when there are both selects and phis and one is
+; speculatable toward promotion but the other is not. That should block all of
+; the speculation.
+; CHECK-LABEL: @test14(
+; CHECK: alloca
+; CHECK: alloca
+; CHECK: select
+; CHECK: phi
+; CHECK: phi
+; CHECK: select
+; CHECK: ret i32
+
+entry:
+ %f = alloca i32
+ %g = alloca i32
+ store i32 0, i32* %f
+ store i32 0, i32* %g
+ %f.select = select i1 %b1, i32* %f, i32* %ptr
+ br i1 %b2, label %then, label %else
+
+then:
+ br label %exit
+
+else:
+ br label %exit
+
+exit:
+ %f.phi = phi i32* [ %f, %then ], [ %f.select, %else ]
+ %g.phi = phi i32* [ %g, %then ], [ %ptr, %else ]
+ %f.loaded = load i32* %f.phi
+ %g.select = select i1 %b1, i32* %g, i32* %g.phi
+ %g.loaded = load i32* %g.select
+ %result = add i32 %f.loaded, %g.loaded
+ ret i32 %result
+}
+
define i32 @PR13905() {
; Check a pattern where we have a chain of dead phi nodes to ensure they are
; deleted and promotion can proceed.
-; CHECK: @PR13905
+; CHECK-LABEL: @PR13905(
; CHECK-NOT: alloca i32
; CHECK: ret i32 undef
@@ -374,7 +411,7 @@ define i32 @PR13906() {
; Another pattern which can lead to crashes due to failing to clear out dead
; PHI nodes or select nodes. This triggers subtly differently from the above
; cases because the PHI node is (recursively) alive, but the select is dead.
-; CHECK: @PR13906
+; CHECK-LABEL: @PR13906(
; CHECK-NOT: alloca
entry:
@@ -392,7 +429,7 @@ if.then:
}
define i64 @PR14132(i1 %flag) {
-; CHECK: @PR14132
+; CHECK-LABEL: @PR14132(
; Here we form a PHI-node by promoting the pointer alloca first, and then in
; order to promote the other two allocas, we speculate the load of the
; now-phi-node-pointer. In doing so we end up loading a 64-bit value from an i8
@@ -427,3 +464,40 @@ if.end:
ret i64 %result
; CHECK-NEXT: ret i64 %[[result]]
}
+
+define float @PR16687(i64 %x, i1 %flag) {
+; CHECK-LABEL: @PR16687(
+; Check that even when we try to speculate the same phi twice (in two slices)
+; on an otherwise promotable construct, we don't get ahead of ourselves and try
+; to promote one of the slices prior to speculating it.
+
+entry:
+ %a = alloca i64, align 8
+ store i64 %x, i64* %a
+ br i1 %flag, label %then, label %else
+; CHECK-NOT: alloca
+; CHECK-NOT: store
+; CHECK: %[[lo:.*]] = trunc i64 %x to i32
+; CHECK: %[[shift:.*]] = lshr i64 %x, 32
+; CHECK: %[[hi:.*]] = trunc i64 %[[shift]] to i32
+
+then:
+ %a.f = bitcast i64* %a to float*
+ br label %end
+; CHECK: %[[lo_cast:.*]] = bitcast i32 %[[lo]] to float
+
+else:
+ %a.raw = bitcast i64* %a to i8*
+ %a.raw.4 = getelementptr i8* %a.raw, i64 4
+ %a.raw.4.f = bitcast i8* %a.raw.4 to float*
+ br label %end
+; CHECK: %[[hi_cast:.*]] = bitcast i32 %[[hi]] to float
+
+end:
+ %a.phi.f = phi float* [ %a.f, %then ], [ %a.raw.4.f, %else ]
+ %f = load float* %a.phi.f
+ ret float %f
+; CHECK: %[[phi:.*]] = phi float [ %[[lo_cast]], %then ], [ %[[hi_cast]], %else ]
+; CHECK-NOT: load
+; CHECK: ret float %[[phi]]
+}
diff --git a/test/Transforms/SROA/vector-conversion.ll b/test/Transforms/SROA/vector-conversion.ll
new file mode 100644
index 000000000000..08d796087317
--- /dev/null
+++ b/test/Transforms/SROA/vector-conversion.ll
@@ -0,0 +1,53 @@
+; RUN: opt < %s -sroa -S | FileCheck %s
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n8:16:32:64"
+
+define <4 x i64> @vector_ptrtoint({<2 x i32*>, <2 x i32*>} %x) {
+; CHECK-LABEL: @vector_ptrtoint
+ %a = alloca {<2 x i32*>, <2 x i32*>}
+; CHECK-NOT: alloca
+
+ store {<2 x i32*>, <2 x i32*>} %x, {<2 x i32*>, <2 x i32*>}* %a
+; CHECK-NOT: store
+
+ %cast = bitcast {<2 x i32*>, <2 x i32*>}* %a to <4 x i64>*
+ %vec = load <4 x i64>* %cast
+; CHECK-NOT: load
+; CHECK: ptrtoint
+
+ ret <4 x i64> %vec
+}
+
+define <4 x i32*> @vector_inttoptr({<2 x i64>, <2 x i64>} %x) {
+; CHECK-LABEL: @vector_inttoptr
+ %a = alloca {<2 x i64>, <2 x i64>}
+; CHECK-NOT: alloca
+
+ store {<2 x i64>, <2 x i64>} %x, {<2 x i64>, <2 x i64>}* %a
+; CHECK-NOT: store
+
+ %cast = bitcast {<2 x i64>, <2 x i64>}* %a to <4 x i32*>*
+ %vec = load <4 x i32*>* %cast
+; CHECK-NOT: load
+; CHECK: inttoptr
+
+ ret <4 x i32*> %vec
+}
+
+define <2 x i64> @vector_ptrtointbitcast({<1 x i32*>, <1 x i32*>} %x) {
+; CHECK-LABEL: @vector_ptrtointbitcast
+ %a = alloca {<1 x i32*>, <1 x i32*>}
+; CHECK-NOT: alloca
+
+ store {<1 x i32*>, <1 x i32*>} %x, {<1 x i32*>, <1 x i32*>}* %a
+; CHECK-NOT: store
+
+ %cast = bitcast {<1 x i32*>, <1 x i32*>}* %a to <2 x i64>*
+ %vec = load <2 x i64>* %cast
+; CHECK-NOT: load
+; CHECK: ptrtoint
+; CHECK: bitcast
+; CHECK: ptrtoint
+; CHECK: bitcast
+
+ ret <2 x i64> %vec
+}
diff --git a/test/Transforms/SROA/vector-promotion.ll b/test/Transforms/SROA/vector-promotion.ll
index 3336515770a3..4f084214d396 100644
--- a/test/Transforms/SROA/vector-promotion.ll
+++ b/test/Transforms/SROA/vector-promotion.ll
@@ -4,7 +4,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
%S1 = type { i64, [42 x float] }
define i32 @test1(<4 x i32> %x, <4 x i32> %y) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
entry:
%a = alloca [2 x <4 x i32>]
; CHECK-NOT: alloca
@@ -35,7 +35,7 @@ entry:
}
define i32 @test2(<4 x i32> %x, <4 x i32> %y) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
entry:
%a = alloca [2 x <4 x i32>]
; CHECK-NOT: alloca
@@ -69,7 +69,7 @@ entry:
}
define i32 @test3(<4 x i32> %x, <4 x i32> %y) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
entry:
%a = alloca [2 x <4 x i32>]
; CHECK-NOT: alloca
@@ -107,7 +107,7 @@ entry:
}
define i32 @test4(<4 x i32> %x, <4 x i32> %y, <4 x i32>* %z) {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
entry:
%a = alloca [2 x <4 x i32>]
; CHECK-NOT: alloca
@@ -151,7 +151,7 @@ entry:
}
define i32 @test5(<4 x i32> %x, <4 x i32> %y, <4 x i32>* %z) {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; The same as the above, but with reversed source and destination for the
; element memcpy, and a self copy.
entry:
@@ -199,7 +199,7 @@ declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32,
declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind
define i64 @test6(<4 x i64> %x, <4 x i64> %y, i64 %n) {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; The old scalarrepl pass would wrongly drop the store to the second alloca.
; PR13254
%tmp = alloca { <4 x i64>, <4 x i64> }
@@ -215,7 +215,7 @@ define i64 @test6(<4 x i64> %x, <4 x i64> %y, i64 %n) {
}
define <4 x i32> @test_subvec_store() {
-; CHECK: @test_subvec_store
+; CHECK-LABEL: @test_subvec_store(
entry:
%a = alloca <4 x i32>
; CHECK-NOT: alloca
@@ -247,7 +247,7 @@ entry:
}
define <4 x i32> @test_subvec_load() {
-; CHECK: @test_subvec_load
+; CHECK-LABEL: @test_subvec_load(
entry:
%a = alloca <4 x i32>
; CHECK-NOT: alloca
@@ -282,7 +282,7 @@ entry:
declare void @llvm.memset.p0i32.i32(i32* nocapture, i32, i32, i32, i1) nounwind
define <4 x float> @test_subvec_memset() {
-; CHECK: @test_subvec_memset
+; CHECK-LABEL: @test_subvec_memset(
entry:
%a = alloca <4 x float>
; CHECK-NOT: alloca
@@ -315,7 +315,7 @@ entry:
}
define <4 x float> @test_subvec_memcpy(i8* %x, i8* %y, i8* %z, i8* %f, i8* %out) {
-; CHECK: @test_subvec_memcpy
+; CHECK-LABEL: @test_subvec_memcpy(
entry:
%a = alloca <4 x float>
; CHECK-NOT: alloca
@@ -363,7 +363,7 @@ entry:
}
define i32 @PR14212() {
-; CHECK: @PR14212
+; CHECK-LABEL: @PR14212(
; This caused a crash when "splitting" the load of the i32 in order to promote
; the store of <3 x i8> properly. Heavily reduced from an OpenCL test case.
entry:
diff --git a/test/Transforms/SampleProfile/Inputs/branch.prof b/test/Transforms/SampleProfile/Inputs/branch.prof
new file mode 100644
index 000000000000..d19894d428ce
--- /dev/null
+++ b/test/Transforms/SampleProfile/Inputs/branch.prof
@@ -0,0 +1,11 @@
+symbol table
+1
+main
+main:15680:0:7
+0: 0
+4: 0
+7: 0
+9: 10226
+10: 2243
+16: 0
+18: 0
diff --git a/test/Transforms/SampleProfile/branch.ll b/test/Transforms/SampleProfile/branch.ll
new file mode 100644
index 000000000000..516762763d7b
--- /dev/null
+++ b/test/Transforms/SampleProfile/branch.ll
@@ -0,0 +1,143 @@
+; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/branch.prof | opt -analyze -branch-prob | FileCheck %s
+
+; Original C++ code for this test case:
+;
+; #include <stdio.h>
+; #include <stdlib.h>
+;
+; int main(int argc, char *argv[]) {
+; if (argc < 2)
+; return 1;
+; double result;
+; int limit = atoi(argv[1]);
+; if (limit > 100) {
+; double s = 23.041968;
+; for (int u = 0; u < limit; u++) {
+; double x = s;
+; s = x + 3.049 + (double)u;
+; s -= s + 3.94 / x * 0.32;
+; }
+; result = s;
+; } else {
+; result = 0;
+; }
+; printf("result is %lf\n", result);
+; return 0;
+; }
+
+@.str = private unnamed_addr constant [15 x i8] c"result is %lf\0A\00", align 1
+
+; Function Attrs: nounwind uwtable
+define i32 @main(i32 %argc, i8** nocapture readonly %argv) #0 {
+; CHECK: Printing analysis 'Branch Probability Analysis' for function 'main':
+
+entry:
+ tail call void @llvm.dbg.value(metadata !{i32 %argc}, i64 0, metadata !13), !dbg !27
+ tail call void @llvm.dbg.value(metadata !{i8** %argv}, i64 0, metadata !14), !dbg !27
+ %cmp = icmp slt i32 %argc, 2, !dbg !28
+ br i1 %cmp, label %return, label %if.end, !dbg !28
+; CHECK: edge entry -> return probability is 1 / 2 = 50%
+; CHECK: edge entry -> if.end probability is 1 / 2 = 50%
+
+if.end: ; preds = %entry
+ %arrayidx = getelementptr inbounds i8** %argv, i64 1, !dbg !30
+ %0 = load i8** %arrayidx, align 8, !dbg !30, !tbaa !31
+ %call = tail call i32 @atoi(i8* %0) #4, !dbg !30
+ tail call void @llvm.dbg.value(metadata !{i32 %call}, i64 0, metadata !17), !dbg !30
+ %cmp1 = icmp sgt i32 %call, 100, !dbg !35
+ br i1 %cmp1, label %for.body, label %if.end6, !dbg !35
+; CHECK: edge if.end -> for.body probability is 2243 / 2244 = 99.9554% [HOT edge]
+; CHECK: edge if.end -> if.end6 probability is 1 / 2244 = 0.0445633%
+
+for.body: ; preds = %if.end, %for.body
+ %u.016 = phi i32 [ %inc, %for.body ], [ 0, %if.end ]
+ %s.015 = phi double [ %sub, %for.body ], [ 0x40370ABE6A337A81, %if.end ]
+ %add = fadd double %s.015, 3.049000e+00, !dbg !36
+ %conv = sitofp i32 %u.016 to double, !dbg !36
+ %add4 = fadd double %add, %conv, !dbg !36
+ tail call void @llvm.dbg.value(metadata !{double %add4}, i64 0, metadata !18), !dbg !36
+ %div = fdiv double 3.940000e+00, %s.015, !dbg !37
+ %mul = fmul double %div, 3.200000e-01, !dbg !37
+ %add5 = fadd double %add4, %mul, !dbg !37
+ %sub = fsub double %add4, %add5, !dbg !37
+ tail call void @llvm.dbg.value(metadata !{double %sub}, i64 0, metadata !18), !dbg !37
+ %inc = add nsw i32 %u.016, 1, !dbg !38
+ tail call void @llvm.dbg.value(metadata !{i32 %inc}, i64 0, metadata !21), !dbg !38
+ %exitcond = icmp eq i32 %inc, %call, !dbg !38
+ br i1 %exitcond, label %if.end6, label %for.body, !dbg !38
+; CHECK: edge for.body -> if.end6 probability is 1 / 2244 = 0.0445633%
+; CHECK: edge for.body -> for.body probability is 2243 / 2244 = 99.9554% [HOT edge]
+
+if.end6: ; preds = %for.body, %if.end
+ %result.0 = phi double [ 0.000000e+00, %if.end ], [ %sub, %for.body ]
+ %call7 = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i64 0, i64 0), double %result.0), !dbg !39
+ br label %return, !dbg !40
+; CHECK: edge if.end6 -> return probability is 16 / 16 = 100% [HOT edge]
+
+return: ; preds = %entry, %if.end6
+ %retval.0 = phi i32 [ 0, %if.end6 ], [ 1, %entry ]
+ ret i32 %retval.0, !dbg !41
+}
+
+; Function Attrs: nounwind readonly
+declare i32 @atoi(i8* nocapture) #1
+
+; Function Attrs: nounwind
+declare i32 @printf(i8* nocapture readonly, ...) #2
+
+; Function Attrs: nounwind readnone
+declare void @llvm.dbg.value(metadata, i64, metadata) #3
+
+attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nounwind readonly "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #2 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #3 = { nounwind readnone }
+attributes #4 = { nounwind readonly }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!25, !42}
+!llvm.ident = !{!26}
+
+!0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.4 (trunk 192896) (llvm/trunk 192895)", i1 true, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [./branch.cc] [DW_LANG_C_plus_plus]
+!1 = metadata !{metadata !"branch.cc", metadata !"."}
+!2 = metadata !{i32 0}
+!3 = metadata !{metadata !4}
+!4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"main", metadata !"main", metadata !"", i32 4, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i32 (i32, i8**)* @main, null, null, metadata !12, i32 4} ; [ DW_TAG_subprogram ] [line 4] [def] [main]
+!5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [./branch.cc]
+!6 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
+!7 = metadata !{metadata !8, metadata !8, metadata !9}
+!8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
+!9 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !10} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from ]
+!10 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !11} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from char]
+!11 = metadata !{i32 786468, null, null, metadata !"char", i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ] [char] [line 0, size 8, align 8, offset 0, enc DW_ATE_signed_char]
+!12 = metadata !{metadata !13, metadata !14, metadata !15, metadata !17, metadata !18, metadata !21, metadata !23}
+!13 = metadata !{i32 786689, metadata !4, metadata !"argc", metadata !5, i32 16777220, metadata !8, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [argc] [line 4]
+!14 = metadata !{i32 786689, metadata !4, metadata !"argv", metadata !5, i32 33554436, metadata !9, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [argv] [line 4]
+!15 = metadata !{i32 786688, metadata !4, metadata !"result", metadata !5, i32 7, metadata !16, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [result] [line 7]
+!16 = metadata !{i32 786468, null, null, metadata !"double", i32 0, i64 64, i64 64, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ] [double] [line 0, size 64, align 64, offset 0, enc DW_ATE_float]
+!17 = metadata !{i32 786688, metadata !4, metadata !"limit", metadata !5, i32 8, metadata !8, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [limit] [line 8]
+!18 = metadata !{i32 786688, metadata !19, metadata !"s", metadata !5, i32 10, metadata !16, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [s] [line 10]
+!19 = metadata !{i32 786443, metadata !1, metadata !20, i32 9, i32 0, i32 2} ; [ DW_TAG_lexical_block ] [./branch.cc]
+!20 = metadata !{i32 786443, metadata !1, metadata !4, i32 9, i32 0, i32 1} ; [ DW_TAG_lexical_block ] [./branch.cc]
+!21 = metadata !{i32 786688, metadata !22, metadata !"u", metadata !5, i32 11, metadata !8, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [u] [line 11]
+!22 = metadata !{i32 786443, metadata !1, metadata !19, i32 11, i32 0, i32 3} ; [ DW_TAG_lexical_block ] [./branch.cc]
+!23 = metadata !{i32 786688, metadata !24, metadata !"x", metadata !5, i32 12, metadata !16, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [x] [line 12]
+!24 = metadata !{i32 786443, metadata !1, metadata !22, i32 11, i32 0, i32 4} ; [ DW_TAG_lexical_block ] [./branch.cc]
+!25 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
+!26 = metadata !{metadata !"clang version 3.4 (trunk 192896) (llvm/trunk 192895)"}
+!27 = metadata !{i32 4, i32 0, metadata !4, null}
+!28 = metadata !{i32 5, i32 0, metadata !29, null}
+!29 = metadata !{i32 786443, metadata !1, metadata !4, i32 5, i32 0, i32 0} ; [ DW_TAG_lexical_block ] [./branch.cc]
+!30 = metadata !{i32 8, i32 0, metadata !4, null} ; [ DW_TAG_imported_declaration ]
+!31 = metadata !{metadata !32, metadata !32, i64 0}
+!32 = metadata !{metadata !"any pointer", metadata !33, i64 0}
+!33 = metadata !{metadata !"omnipotent char", metadata !34, i64 0}
+!34 = metadata !{metadata !"Simple C/C++ TBAA"}
+!35 = metadata !{i32 9, i32 0, metadata !20, null}
+!36 = metadata !{i32 13, i32 0, metadata !24, null}
+!37 = metadata !{i32 14, i32 0, metadata !24, null}
+!38 = metadata !{i32 11, i32 0, metadata !22, null}
+!39 = metadata !{i32 20, i32 0, metadata !4, null}
+!40 = metadata !{i32 21, i32 0, metadata !4, null}
+!41 = metadata !{i32 22, i32 0, metadata !4, null}
+!42 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/ScalarRepl/2008-09-22-vector-gep.ll b/test/Transforms/ScalarRepl/2008-09-22-vector-gep.ll
index e7a58f16e227..7554b7f2b0b8 100644
--- a/test/Transforms/ScalarRepl/2008-09-22-vector-gep.ll
+++ b/test/Transforms/ScalarRepl/2008-09-22-vector-gep.ll
@@ -22,4 +22,4 @@ entry:
ret void
}
-declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind \ No newline at end of file
+declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
diff --git a/test/Transforms/ScalarRepl/2009-12-11-NeonTypes.ll b/test/Transforms/ScalarRepl/2009-12-11-NeonTypes.ll
index 1993e4f526d1..1f921914fcb0 100644
--- a/test/Transforms/ScalarRepl/2009-12-11-NeonTypes.ll
+++ b/test/Transforms/ScalarRepl/2009-12-11-NeonTypes.ll
@@ -10,7 +10,7 @@ target triple = "thumbv7-apple-darwin10"
%union..0anon = type { %struct.int16x8x2_t }
define void @test(<8 x i16> %tmp.0, %struct.int16x8x2_t* %dst) nounwind {
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK-NOT: alloca
; CHECK: "alloca point"
; CHECK: store <8 x i16>
@@ -82,7 +82,7 @@ cond.true: ; preds = %entry
cond.false: ; preds = %entry
ret void
-; CHECK: @test_memcpy_self
+; CHECK-LABEL: @test_memcpy_self(
; CHECK-NOT: alloca
; CHECK: br i1
}
diff --git a/test/Transforms/ScalarRepl/2010-01-18-SelfCopy.ll b/test/Transforms/ScalarRepl/2010-01-18-SelfCopy.ll
index 52df6d5c5967..b926b021caf1 100644
--- a/test/Transforms/ScalarRepl/2010-01-18-SelfCopy.ll
+++ b/test/Transforms/ScalarRepl/2010-01-18-SelfCopy.ll
@@ -6,7 +6,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
%struct.test = type { [3 x double] }
define void @test_memcpy_self() nounwind {
-; CHECK: @test_memcpy_self
+; CHECK-LABEL: @test_memcpy_self(
; CHECK-NOT: alloca
; CHECK: ret void
%1 = alloca %struct.test
diff --git a/test/Transforms/ScalarRepl/2011-09-22-PHISpeculateInvoke.ll b/test/Transforms/ScalarRepl/2011-09-22-PHISpeculateInvoke.ll
index f98f3e8fc458..5f4d0fc7e1c8 100644
--- a/test/Transforms/ScalarRepl/2011-09-22-PHISpeculateInvoke.ll
+++ b/test/Transforms/ScalarRepl/2011-09-22-PHISpeculateInvoke.ll
@@ -36,5 +36,5 @@ unwind: ; preds = %then
unreachable
}
-; CHECK: define void @odd_fn
+; CHECK-LABEL: define void @odd_fn(
; CHECK: %storemerge.in = phi i32* [ %retptr2, %else ], [ %retptr1, %then ]
diff --git a/test/Transforms/ScalarRepl/2011-10-22-VectorCrash.ll b/test/Transforms/ScalarRepl/2011-10-22-VectorCrash.ll
index cd21ff5f0b51..e4456361a66d 100644
--- a/test/Transforms/ScalarRepl/2011-10-22-VectorCrash.ll
+++ b/test/Transforms/ScalarRepl/2011-10-22-VectorCrash.ll
@@ -4,7 +4,7 @@ target triple = "thumbv7-apple-ios5.0.0"
%union.anon = type { <4 x float> }
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK-NOT: alloca
define void @test() nounwind {
diff --git a/test/Transforms/ScalarRepl/address-space.ll b/test/Transforms/ScalarRepl/address-space.ll
index 318d4e759061..d8efc1774b7e 100644
--- a/test/Transforms/ScalarRepl/address-space.ll
+++ b/test/Transforms/ScalarRepl/address-space.ll
@@ -6,7 +6,7 @@ target triple = "x86_64-apple-darwin10"
%struct.anon = type { [1 x float] }
-; CHECK: define void @Test(
+; CHECK-LABEL: define void @Test(
; CHECK: load float addrspace(2)*
; CHECK-NEXT: fsub float
; CHECK: store float {{.*}}, float addrspace(2)*
diff --git a/test/Transforms/ScalarRepl/badarray.ll b/test/Transforms/ScalarRepl/badarray.ll
index 768fec630629..480e12b8d445 100644
--- a/test/Transforms/ScalarRepl/badarray.ll
+++ b/test/Transforms/ScalarRepl/badarray.ll
@@ -7,7 +7,7 @@ target triple = "i386-pc-linux-gnu"
; PR3466
; Off end of array, don't transform.
define i32 @test1() {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NOT: = alloca
%X = alloca [4 x i32]
%Y = getelementptr [4 x i32]* %X, i64 0, i64 6 ; <i32*> [#uses=2]
@@ -20,7 +20,7 @@ define i32 @test1() {
; Off end of array, don't transform.
define i32 @test2() nounwind {
entry:
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NOT: = alloca
%yx2.i = alloca float, align 4 ; <float*> [#uses=1]
%yx26.i = bitcast float* %yx2.i to i64* ; <i64*> [#uses=1]
@@ -34,7 +34,7 @@ entry:
; PR5436
define void @test3() {
entry:
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NOT: = alloca
; CHECK: store i64
%var_1 = alloca %padded, align 8 ; <%padded*> [#uses=3]
diff --git a/test/Transforms/ScalarRepl/basictest.ll b/test/Transforms/ScalarRepl/basictest.ll
index 9676873c30c0..af3c237d4914 100644
--- a/test/Transforms/ScalarRepl/basictest.ll
+++ b/test/Transforms/ScalarRepl/basictest.ll
@@ -7,7 +7,7 @@ define i32 @test1() {
store i32 0, i32* %Y
%Z = load i32* %Y ; <i32> [#uses=1]
ret i32 %Z
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NOT: alloca
; CHECK: ret i32 0
}
@@ -23,7 +23,7 @@ define i64 @test2(i64 %X) {
L2:
%Z = load i64* %B ; <i32> [#uses=1]
ret i64 %Z
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NOT: alloca
; CHECK: ret i64 %X
}
diff --git a/test/Transforms/ScalarRepl/debuginfo-preserved.ll b/test/Transforms/ScalarRepl/debuginfo-preserved.ll
index 7d3bcea8b857..71bf22a61cd2 100644
--- a/test/Transforms/ScalarRepl/debuginfo-preserved.ll
+++ b/test/Transforms/ScalarRepl/debuginfo-preserved.ll
@@ -40,19 +40,20 @@ entry:
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!20}
-!0 = metadata !{i32 786449, i32 0, i32 12, metadata !2, metadata !"clang version 3.0 (trunk 131941)", i1 false, metadata !"", i32 0, null, null, metadata !17, null, null} ; [ DW_TAG_compile_unit ]
-!1 = metadata !{i32 786478, metadata !2, metadata !"f", metadata !"f", metadata !"", metadata !2, i32 1, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, i32 (i32, i32)* @f, null, null, null, i32 1} ; [ DW_TAG_subprogram ]
+!0 = metadata !{i32 786449, metadata !18, i32 12, metadata !"clang version 3.0 (trunk 131941)", i1 false, metadata !"", i32 0, metadata !19, metadata !19, metadata !17, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
+!1 = metadata !{i32 786478, metadata !18, metadata !2, metadata !"f", metadata !"f", metadata !"", i32 1, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32, i32)* @f, null, null, null, i32 1} ; [ DW_TAG_subprogram ] [line 1] [def] [f]
!2 = metadata !{i32 786473, metadata !18} ; [ DW_TAG_file_type ]
-!3 = metadata !{i32 786453, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
+!3 = metadata !{i32 786453, metadata !18, metadata !2, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!4 = metadata !{metadata !5}
-!5 = metadata !{i32 786468, metadata !0, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
+!5 = metadata !{i32 786468, null, metadata !0, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!6 = metadata !{i32 786689, metadata !1, metadata !"a", metadata !2, i32 16777217, metadata !5, i32 0, null} ; [ DW_TAG_arg_variable ]
!7 = metadata !{i32 1, i32 11, metadata !1, null}
!8 = metadata !{i32 786689, metadata !1, metadata !"b", metadata !2, i32 33554433, metadata !5, i32 0, null} ; [ DW_TAG_arg_variable ]
!9 = metadata !{i32 1, i32 18, metadata !1, null}
!10 = metadata !{i32 786688, metadata !11, metadata !"c", metadata !2, i32 2, metadata !5, i32 0, null} ; [ DW_TAG_auto_variable ]
-!11 = metadata !{i32 786443, metadata !1, i32 1, i32 21, metadata !2, i32 0} ; [ DW_TAG_lexical_block ]
+!11 = metadata !{i32 786443, metadata !18, metadata !1, i32 1, i32 21, i32 0} ; [ DW_TAG_lexical_block ]
!12 = metadata !{i32 2, i32 9, metadata !11, null}
!13 = metadata !{i32 2, i32 14, metadata !11, null}
!14 = metadata !{i32 3, i32 5, metadata !11, null}
@@ -60,3 +61,5 @@ declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
!16 = metadata !{i32 5, i32 5, metadata !11, null}
!17 = metadata !{metadata !1}
!18 = metadata !{metadata !"/d/j/debug-test.c", metadata !"/Volumes/Data/b"}
+!19 = metadata !{i32 0}
+!20 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/ScalarRepl/inline-vector.ll b/test/Transforms/ScalarRepl/inline-vector.ll
index 2f51cc7cf59c..f7c70dcd5575 100644
--- a/test/Transforms/ScalarRepl/inline-vector.ll
+++ b/test/Transforms/ScalarRepl/inline-vector.ll
@@ -6,7 +6,7 @@ target triple = "thumbv7-apple-darwin10.0.0"
%struct.Vector4 = type { float, float, float, float }
@f.vector = internal constant %struct.Vector4 { float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00 }, align 16
-; CHECK: define void @f
+; CHECK-LABEL: define void @f(
; CHECK-NOT: alloca
; CHECK: phi <4 x float>
diff --git a/test/Transforms/ScalarRepl/lifetime.ll b/test/Transforms/ScalarRepl/lifetime.ll
index 3f558a1c3737..47cb8549822b 100644
--- a/test/Transforms/ScalarRepl/lifetime.ll
+++ b/test/Transforms/ScalarRepl/lifetime.ll
@@ -9,7 +9,7 @@ declare void @llvm.lifetime.end(i64, i8*)
%t1 = type {i32, i32, i32}
define void @test1() {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
%A = alloca %t1
%A1 = getelementptr %t1* %A, i32 0, i32 0
%A2 = getelementptr %t1* %A, i32 0, i32 1
@@ -22,7 +22,7 @@ define void @test1() {
}
define void @test2() {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
%A = alloca %t1
%A1 = getelementptr %t1* %A, i32 0, i32 0
%A2 = getelementptr %t1* %A, i32 0, i32 1
@@ -36,7 +36,7 @@ define void @test2() {
}
define void @test3() {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
%A = alloca %t1
%A1 = getelementptr %t1* %A, i32 0, i32 0
%A2 = getelementptr %t1* %A, i32 0, i32 1
@@ -50,7 +50,7 @@ define void @test3() {
}
define void @test4() {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
%A = alloca %t1
%A1 = getelementptr %t1* %A, i32 0, i32 0
%A2 = getelementptr %t1* %A, i32 0, i32 1
@@ -66,7 +66,7 @@ define void @test4() {
%t2 = type {i32, [4 x i8], i32}
define void @test5() {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
%A = alloca %t2
; CHECK: alloca{{.*}}i8
; CHECK: alloca{{.*}}i8
@@ -97,7 +97,7 @@ define void @test5() {
%t3 = type {[4 x i16], [4 x i8]}
define void @test6() {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
%A = alloca %t3
; CHECK: alloca i8
; CHECK: alloca i8
diff --git a/test/Transforms/ScalarRepl/lit.local.cfg b/test/Transforms/ScalarRepl/lit.local.cfg
deleted file mode 100644
index c6106e4746f2..000000000000
--- a/test/Transforms/ScalarRepl/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll']
diff --git a/test/Transforms/ScalarRepl/memset-aggregate.ll b/test/Transforms/ScalarRepl/memset-aggregate.ll
index 95ecf175eed2..3a5c37c04673 100644
--- a/test/Transforms/ScalarRepl/memset-aggregate.ll
+++ b/test/Transforms/ScalarRepl/memset-aggregate.ll
@@ -64,4 +64,4 @@ entry:
}
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
-declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind \ No newline at end of file
+declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind
diff --git a/test/Transforms/ScalarRepl/nonzero-first-index.ll b/test/Transforms/ScalarRepl/nonzero-first-index.ll
index 60f414b71757..b2e93feb6cc2 100644
--- a/test/Transforms/ScalarRepl/nonzero-first-index.ll
+++ b/test/Transforms/ScalarRepl/nonzero-first-index.ll
@@ -8,7 +8,7 @@ target triple = "i386-pc-linux-gnu"
; Check that a GEP with a non-zero first index does not prevent SROA as long
; as the resulting offset corresponds to an element in the alloca.
define i32 @test1() {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NOT: = i160
; CHECK: ret i32 undef
%A = alloca %nested
@@ -20,7 +20,7 @@ define i32 @test1() {
; But, if the offset is out of range, then it should not be transformed.
define i32 @test2() {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: i160
%A = alloca %nested
%B = getelementptr %nested* %A, i32 0, i32 1, i32 0
@@ -31,7 +31,7 @@ define i32 @test2() {
; Try it with a bitcast and single GEP....
define i32 @test3() {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NOT: = i160
; CHECK: ret i32 undef
%A = alloca %nested
@@ -43,7 +43,7 @@ define i32 @test3() {
; ...and again make sure that out-of-range accesses are not transformed.
define i32 @test4() {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: i160
%A = alloca %nested
%B = bitcast %nested* %A to i32*
diff --git a/test/Transforms/ScalarRepl/only-memcpy-uses.ll b/test/Transforms/ScalarRepl/only-memcpy-uses.ll
index cfb88bd80d60..935c2895520c 100644
--- a/test/Transforms/ScalarRepl/only-memcpy-uses.ll
+++ b/test/Transforms/ScalarRepl/only-memcpy-uses.ll
@@ -4,7 +4,7 @@ target triple = "x86_64-apple-darwin10.0.0"
%struct.S = type { [12 x i32] }
-; CHECK: @bar4
+; CHECK-LABEL: @bar4(
define void @bar4(%struct.S* byval %s) nounwind ssp {
entry:
; CHECK: alloca
diff --git a/test/Transforms/ScalarRepl/phi-select.ll b/test/Transforms/ScalarRepl/phi-select.ll
index 5c21c3bd9f34..a5da2dcf49d1 100644
--- a/test/Transforms/ScalarRepl/phi-select.ll
+++ b/test/Transforms/ScalarRepl/phi-select.ll
@@ -6,7 +6,7 @@ target triple = "x86_64-apple-darwin10.2"
%struct.X = type { i32 }
%PairTy = type {i32, i32}
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %a.0 = alloca i32
; CHECK: %b.0 = alloca i32
define i32 @test1(i32 %x) nounwind readnone ssp {
@@ -24,7 +24,7 @@ entry:
ret i32 %4
}
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: %X.ld = phi i32 [ 1, %entry ], [ 2, %T ]
; CHECK-NEXT: ret i32 %X.ld
define i32 @test2(i1 %c) {
@@ -43,7 +43,7 @@ F:
ret i32 %Q
}
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: %Q = select i1 %c, i32 1, i32 2
; CHECK-NEXT: ret i32 %Q
; rdar://8904039
@@ -63,7 +63,7 @@ define i32 @test3(i1 %c) {
define i64 @test4(i1 %c) {
entry:
%A = alloca %PairTy
- ; CHECK: @test4
+ ; CHECK-LABEL: @test4(
; CHECK: %A = alloca %PairTy
%B = getelementptr %PairTy* %A, i32 0, i32 0
store i32 1, i32* %B
@@ -94,7 +94,7 @@ entry:
%r = load i32* %b, align 8
ret i32 %r
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: store i32 123, i32* %P
; CHECK: ret i32 2
}
@@ -107,7 +107,7 @@ define i32 @test6(i32 %x, i1 %c) nounwind readnone ssp {
%p.0 = select i1 %c, i32* %b, i32* %a
%r = load i32* %p.0, align 8
ret i32 %r
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK-NEXT: %r = select i1 %c, i32 2, i32 1
; CHECK-NEXT: ret i32 %r
}
@@ -124,7 +124,7 @@ define i32 @test7(i32 %x, i1 %c) nounwind readnone ssp {
%r = load i32* %p.0, align 8
ret i32 %r
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NOT: alloca i32
; CHECK: %r = select i1 %c, i32 2, i32 0
; CHECK: ret i32 %r
@@ -132,7 +132,7 @@ define i32 @test7(i32 %x, i1 %c) nounwind readnone ssp {
;; Promote allocs that are PHI'd together by moving the loads.
define i32 @test8(i32 %x) nounwind readnone ssp {
-; CHECK: @test8
+; CHECK-LABEL: @test8(
; CHECK-NOT: load i32
; CHECK-NOT: store i32
; CHECK: %p.0.ld = phi i32 [ 2, %entry ], [ 1, %T ]
diff --git a/test/Transforms/ScalarRepl/union-pointer.ll b/test/Transforms/ScalarRepl/union-pointer.ll
index 03d25ac7085e..f0dc141aca8d 100644
--- a/test/Transforms/ScalarRepl/union-pointer.ll
+++ b/test/Transforms/ScalarRepl/union-pointer.ll
@@ -1,13 +1,16 @@
; PR892
-; RUN: opt < %s -scalarrepl -S | \
-; RUN: not grep alloca
-; RUN: opt < %s -scalarrepl -S | grep "ret i8"
+; RUN: opt < %s -scalarrepl -S | FileCheck %s
-target datalayout = "e-p:32:32-n8:16:32"
+
+target datalayout = "e-p:32:32-p1:16:16-n8:16:32"
target triple = "i686-apple-darwin8.7.2"
- %struct.Val = type { i32*, i32 }
+
+%struct.Val = type { i32*, i32 }
define i8* @test(i16* %X) {
+; CHECK-LABEL: @test(
+; CHECK-NOT: alloca
+; CHECK: ret i8*
%X_addr = alloca i16* ; <i16**> [#uses=2]
store i16* %X, i16** %X_addr
%X_addr.upgrd.1 = bitcast i16** %X_addr to i8** ; <i8**> [#uses=1]
@@ -15,7 +18,37 @@ define i8* @test(i16* %X) {
ret i8* %tmp
}
+define i8 addrspace(1)* @test_as1(i16 addrspace(1)* %x) {
+; CHECK-LABEL: @test_as1(
+; CHECK-NEXT: %1 = ptrtoint i16 addrspace(1)* %x to i16
+; CHECK-NEXT: %2 = inttoptr i16 %1 to i8 addrspace(1)*
+; CHECK-NEXT: ret i8 addrspace(1)* %2
+ %x_addr = alloca i16 addrspace(1)*
+ store i16 addrspace(1)* %x, i16 addrspace(1)** %x_addr
+ %x_addr.upgrd.1 = bitcast i16 addrspace(1)** %x_addr to i8 addrspace(1)**
+ %tmp = load i8 addrspace(1)** %x_addr.upgrd.1
+ ret i8 addrspace(1)* %tmp
+}
+
+define i8 addrspace(1)* @test_as1_array(i16 addrspace(1)* %x) {
+; CHECK-LABEL: @test_as1_array(
+; CHECK-NEXT: %1 = ptrtoint i16 addrspace(1)* %x to i16
+; CHECK-NEXT: %2 = inttoptr i16 %1 to i8 addrspace(1)*
+; CHECK-NEXT: ret i8 addrspace(1)* %2
+ %as_ptr_array = alloca [4 x i16 addrspace(1)*]
+ %elem1 = getelementptr [4 x i16 addrspace(1)*]* %as_ptr_array, i32 0, i32 1
+ store i16 addrspace(1)* %x, i16 addrspace(1)** %elem1
+ %elem1.cast = bitcast i16 addrspace(1)** %elem1 to i8 addrspace(1)**
+ %tmp = load i8 addrspace(1)** %elem1.cast
+ ret i8 addrspace(1)* %tmp
+}
+
+
define void @test2(i64 %Op.0) {
+; CHECK-LABEL: @test2(
+; CHECK-NOT: alloca
+; CHECK: ret void
+
%tmp = alloca %struct.Val, align 8 ; <%struct.Val*> [#uses=3]
%tmp1 = alloca %struct.Val, align 8 ; <%struct.Val*> [#uses=3]
%tmp.upgrd.2 = call i64 @_Z3foov( ) ; <i64> [#uses=1]
diff --git a/test/Transforms/ScalarRepl/vector_promote.ll b/test/Transforms/ScalarRepl/vector_promote.ll
index 5c82ae4d196d..8ca1ed5005b3 100644
--- a/test/Transforms/ScalarRepl/vector_promote.ll
+++ b/test/Transforms/ScalarRepl/vector_promote.ll
@@ -14,7 +14,7 @@ entry:
%tmp6 = fadd <4 x float> %tmp4, %tmp4 ; <<4 x float>> [#uses=1]
store <4 x float> %tmp6, <4 x float>* %F
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NOT: alloca
; CHECK: %tmp = load <4 x float>* %F
; CHECK: fadd <4 x float> %tmp, %tmp
@@ -33,7 +33,7 @@ entry:
%tmp6 = fadd <4 x float> %tmp4, %tmp4 ; <<4 x float>> [#uses=1]
store <4 x float> %tmp6, <4 x float>* %F
ret void
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NOT: alloca
; CHECK: %tmp = load <4 x float>* %F
; CHECK: fadd <4 x float> %tmp, %tmp
@@ -50,7 +50,7 @@ entry:
%tmp.upgrd.4 = load float* %tmp.upgrd.3 ; <float> [#uses=1]
store float %tmp.upgrd.4, float* %f
ret void
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NOT: alloca
; CHECK: %tmp = load <4 x float>* %F
; CHECK: fadd <4 x float> %tmp, %tmp
@@ -67,7 +67,7 @@ entry:
%tmp.upgrd.6 = load float* %G.upgrd.5 ; <float> [#uses=1]
store float %tmp.upgrd.6, float* %f
ret void
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NOT: alloca
; CHECK: %tmp = load <4 x float>* %F
; CHECK: fadd <4 x float> %tmp, %tmp
@@ -81,7 +81,7 @@ define i32 @test5(float %X) { ;; should turn into bitcast.
%a = bitcast float* %X1 to i32*
%tmp = load i32* %a
ret i32 %tmp
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NEXT: bitcast float %X to i32
; CHECK-NEXT: ret i32
}
@@ -92,7 +92,7 @@ define i64 @test6(<2 x float> %X) {
%P = bitcast <2 x float>* %X_addr to i64*
%tmp = load i64* %P
ret i64 %tmp
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: bitcast <2 x float> %X to i64
; CHECK: ret i64
}
@@ -107,7 +107,31 @@ entry:
%1 = getelementptr inbounds %struct.test7* %memtmp, i64 0, i32 0, i64 5
store i32 0, i32* %1, align 4
ret void
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK-NOT: alloca
; CHECK: and i192
}
+
+; When promoting an alloca to a 1-element vector type, instructions that
+; produce that same vector type should not be changed to insert one element
+; into a new vector. <rdar://problem/14249078>
+define <1 x i64> @test8(<1 x i64> %a) {
+entry:
+ %a.addr = alloca <1 x i64>, align 8
+ %__a = alloca <1 x i64>, align 8
+ %tmp = alloca <1 x i64>, align 8
+ store <1 x i64> %a, <1 x i64>* %a.addr, align 8
+ %0 = load <1 x i64>* %a.addr, align 8
+ store <1 x i64> %0, <1 x i64>* %__a, align 8
+ %1 = load <1 x i64>* %__a, align 8
+ %2 = bitcast <1 x i64> %1 to <8 x i8>
+ %3 = bitcast <8 x i8> %2 to <1 x i64>
+ %vshl_n = shl <1 x i64> %3, <i64 4>
+ store <1 x i64> %vshl_n, <1 x i64>* %tmp
+ %4 = load <1 x i64>* %tmp
+ ret <1 x i64> %4
+; CHECK-LABEL: @test8(
+; CHECK-NOT: alloca
+; CHECK-NOT: insertelement
+; CHECK: ret <1 x i64>
+}
diff --git a/test/Transforms/SimplifyCFG/2009-01-19-UnconditionalTrappingConstantExpr.ll b/test/Transforms/SimplifyCFG/2009-01-19-UnconditionalTrappingConstantExpr.ll
index e2765e5f50e6..740ea25f93ae 100644
--- a/test/Transforms/SimplifyCFG/2009-01-19-UnconditionalTrappingConstantExpr.ll
+++ b/test/Transforms/SimplifyCFG/2009-01-19-UnconditionalTrappingConstantExpr.ll
@@ -4,7 +4,7 @@
@G = extern_weak global i32
-; CHECK: @test(
+; CHECK-LABEL: @test(
; CHECK: br i1 %tmp25
; CHECK: bb1:
; CHECK: sdiv
@@ -23,7 +23,7 @@ bb6:
ret i32 927
}
-; CHECK: @test2(
+; CHECK-LABEL: @test2(
; CHECK: br i1 %tmp34
; CHECK: bb5:
; CHECK: sdiv
diff --git a/test/Transforms/SimplifyCFG/CoveredLookupTable.ll b/test/Transforms/SimplifyCFG/CoveredLookupTable.ll
new file mode 100644
index 000000000000..8b45a590bb1f
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/CoveredLookupTable.ll
@@ -0,0 +1,48 @@
+; RUN: opt -simplifycfg -S %s | FileCheck %s
+; rdar://15268442
+
+target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-apple-darwin12.0.0"
+
+; CHECK-LABEL: define i3 @coveredswitch_test(
+; CHECK: entry:
+; CHECK-NEXT: sub i3 %input, -4
+; CHECK-NEXT: zext i3 %switch.tableidx to i24
+; CHECK-NEXT: mul i24 %switch.cast, 3
+; CHECK-NEXT: lshr i24 7507338, %switch.shiftamt
+; CHECK-NEXT: trunc i24 %switch.downshift to i3
+; CHECK-NEXT: ret i3 %switch.masked
+
+define i3 @coveredswitch_test(i3 %input) {
+entry:
+ switch i3 %input, label %bb8 [
+ i3 0, label %bb7
+ i3 1, label %bb
+ i3 2, label %bb3
+ i3 3, label %bb4
+ i3 4, label %bb5
+ i3 5, label %bb6
+ ]
+
+bb: ; preds = %entry
+ br label %bb8
+
+bb3: ; preds = %entry
+ br label %bb8
+
+bb4: ; preds = %entry
+ br label %bb8
+
+bb5: ; preds = %entry
+ br label %bb8
+
+bb6: ; preds = %entry
+ br label %bb8
+
+bb7: ; preds = %entry
+ br label %bb8
+
+bb8: ; preds = %bb7, %bb6, %bb5, %bb4, %bb3, %bb, %entry
+ %result = phi i3 [ 0, %bb7 ], [ 1, %bb6 ], [ 2, %bb5 ], [ 3, %bb4 ], [ 4, %bb3 ], [ 5, %bb ], [ 6, %entry ]
+ ret i3 %result
+}
diff --git a/test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll b/test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll
index 912c7556e006..b07ef970a20a 100644
--- a/test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll
+++ b/test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll
@@ -1,8 +1,18 @@
; Test merging of blocks with phi nodes.
;
-; RUN: opt < %s -simplifycfg -S | not grep N:
+; RUN: opt < %s -simplifycfg -S > %t
+; RUN: not grep N: %t
+; RUN: not grep X: %t
+; RUN: not grep 'switch i32[^U]+%U' %t
+; RUN: not grep "^BB.tomerge" %t
+; RUN: grep "^BB.nomerge" %t | count 2
;
+; ModuleID = '<stdin>'
+declare i1 @foo()
+
+declare i1 @bar(i32)
+
define i32 @test(i1 %a) {
Q:
br i1 %a, label %N, label %M
@@ -16,3 +26,231 @@ M: ; preds = %N, %Q
ret i32 %R
}
+; Test merging of blocks with phi nodes where at least one incoming value
+; in the successor is undef.
+define i8 @testundef(i32 %u) {
+R:
+ switch i32 %u, label %U [
+ i32 0, label %S
+ i32 1, label %T
+ i32 2, label %T
+ ]
+
+S: ; preds = %R
+ br label %U
+
+T: ; preds = %R, %R
+ br label %U
+
+U: ; preds = %T, %S, %R
+ ; We should be able to merge either the S or T block into U by rewriting
+ ; R's incoming value with the incoming value of that predecessor since
+ ; R's incoming value is undef and both of those predecessors are simple
+ ; unconditional branches.
+ %val.0 = phi i8 [ undef, %R ], [ 1, %T ], [ 0, %S ]
+ ret i8 %val.0
+}
+
+; Test merging of blocks with phi nodes where at least one incoming value
+; in the successor is undef.
+define i8 @testundef2(i32 %u, i32* %A) {
+V:
+ switch i32 %u, label %U [
+ i32 0, label %W
+ i32 1, label %X
+ i32 2, label %X
+ i32 3, label %Z
+ ]
+
+W: ; preds = %V
+ br label %U
+
+Z:
+ store i32 0, i32* %A, align 4
+ br label %X
+
+X: ; preds = %V, %V, %Z
+ br label %U
+
+U: ; preds = %X, %W, %V
+ ; We should be able to merge either the W or X block into U by rewriting
+ ; V's incoming value with the incoming value of that predecessor since
+ ; V's incoming value is undef and both of those predecessors are simple
+ ; unconditional branches. Note that X has predecessors beyond
+ ; the direct predecessors of U.
+ %val.0 = phi i8 [ undef, %V ], [ 1, %X ], [ 1, %W ]
+ ret i8 %val.0
+}
+
+define i8 @testmergesome(i32 %u, i32* %A) {
+V:
+ switch i32 %u, label %Y [
+ i32 0, label %W
+ i32 1, label %X
+ i32 2, label %X
+ i32 3, label %Z
+ ]
+
+W: ; preds = %V
+ store i32 1, i32* %A, align 4
+ br label %Y
+
+Z:
+ store i32 0, i32* %A, align 4
+ br label %X
+
+X: ; preds = %V, %Z
+ br label %Y
+
+Y: ; preds = %X, %W, %V
+ ; After merging X into Y, we should have 5 predecessors
+ ; and thus 5 incoming values to the phi.
+ %val.0 = phi i8 [ 1, %V ], [ 1, %X ], [ 2, %W ]
+ ret i8 %val.0
+}
+
+
+define i8 @testmergesome2(i32 %u, i32* %A) {
+V:
+ switch i32 %u, label %W [
+ i32 0, label %W
+ i32 1, label %Y
+ i32 2, label %X
+ i32 4, label %Y
+ ]
+
+W: ; preds = %V
+ store i32 1, i32* %A, align 4
+ br label %Y
+
+X: ; preds = %V, %Z
+ br label %Y
+
+Y: ; preds = %X, %W, %V
+ ; Ensure that we deal with both undef inputs for V when we merge in X.
+ %val.0 = phi i8 [ undef, %V ], [ 1, %X ], [ 2, %W ], [ undef, %V ]
+ ret i8 %val.0
+}
+
+; This function can't be merged
+define void @a() {
+entry:
+ br label %BB.nomerge
+
+BB.nomerge: ; preds = %Common, %entry
+ ; This phi has a conflicting value (0) with below phi (2), so blocks
+ ; can't be merged.
+ %a = phi i32 [ 1, %entry ], [ 0, %Common ] ; <i32> [#uses=1]
+ br label %Succ
+
+Succ: ; preds = %Common, %BB.nomerge
+ %b = phi i32 [ %a, %BB.nomerge ], [ 2, %Common ] ; <i32> [#uses=0]
+ %conde = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %conde, label %Common, label %Exit
+
+Common: ; preds = %Succ
+ %cond = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %cond, label %BB.nomerge, label %Succ
+
+Exit: ; preds = %Succ
+ ret void
+}
+
+; This function can't be merged
+define void @b() {
+entry:
+ br label %BB.nomerge
+
+BB.nomerge: ; preds = %Common, %entry
+ br label %Succ
+
+Succ: ; preds = %Common, %BB.nomerge
+ ; This phi has confliction values for Common and (through BB) Common,
+ ; blocks can't be merged
+ %b = phi i32 [ 1, %BB.nomerge ], [ 2, %Common ] ; <i32> [#uses=0]
+ %conde = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %conde, label %Common, label %Exit
+
+Common: ; preds = %Succ
+ %cond = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %cond, label %BB.nomerge, label %Succ
+
+Exit: ; preds = %Succ
+ ret void
+}
+
+; This function can be merged
+define void @c() {
+entry:
+ br label %BB.tomerge
+
+BB.tomerge: ; preds = %Common, %entry
+ br label %Succ
+
+Succ: ; preds = %Common, %BB.tomerge, %Pre-Exit
+ ; This phi has identical values for Common and (through BB) Common,
+ ; blocks can't be merged
+ %b = phi i32 [ 1, %BB.tomerge ], [ 1, %Common ], [ 2, %Pre-Exit ]
+ %conde = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %conde, label %Common, label %Pre-Exit
+
+Common: ; preds = %Succ
+ %cond = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %cond, label %BB.tomerge, label %Succ
+
+Pre-Exit: ; preds = %Succ
+ ; This adds a backedge, so the %b phi node gets a third branch and is
+ ; not completely trivial
+ %cond2 = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %cond2, label %Succ, label %Exit
+
+Exit: ; preds = %Pre-Exit
+ ret void
+}
+
+; This function can be merged
+define void @d() {
+entry:
+ br label %BB.tomerge
+
+BB.tomerge: ; preds = %Common, %entry
+ ; This phi has a matching value (0) with below phi (0), so blocks
+ ; can be merged.
+ %a = phi i32 [ 1, %entry ], [ 0, %Common ] ; <i32> [#uses=1]
+ br label %Succ
+
+Succ: ; preds = %Common, %BB.tomerge
+ %b = phi i32 [ %a, %BB.tomerge ], [ 0, %Common ] ; <i32> [#uses=0]
+ %conde = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %conde, label %Common, label %Exit
+
+Common: ; preds = %Succ
+ %cond = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %cond, label %BB.tomerge, label %Succ
+
+Exit: ; preds = %Succ
+ ret void
+}
+
+; This function can be merged
+define void @e() {
+entry:
+ br label %BB.tomerge
+
+BB.tomerge: ; preds = %Use, %entry
+ ; This phi is used somewhere else than Succ, but this should not prevent
+ ; merging this block
+ %a = phi i32 [ 1, %entry ], [ 0, %Use ] ; <i32> [#uses=1]
+ br label %Succ
+
+Succ: ; preds = %BB.tomerge
+ %conde = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %conde, label %Use, label %Exit
+
+Use: ; preds = %Succ
+ %cond = call i1 @bar( i32 %a ) ; <i1> [#uses=1]
+ br i1 %cond, label %BB.tomerge, label %Exit
+
+Exit: ; preds = %Use, %Succ
+ ret void
+}
diff --git a/test/Transforms/SimplifyCFG/MagicPointer.ll b/test/Transforms/SimplifyCFG/MagicPointer.ll
index 93b9a276eac4..b8b8cbd9dc63 100644
--- a/test/Transforms/SimplifyCFG/MagicPointer.ll
+++ b/test/Transforms/SimplifyCFG/MagicPointer.ll
@@ -2,15 +2,7 @@
;
; RUN: opt < %s -simplifycfg -S | FileCheck %s
-; CHECK: switch i64 %magicptr
-; CHECK: i64 0, label
-; CHECK: i64 1, label
-; CHECK: i64 2, label
-; CHECK: i64 3, label
-; CHECK: i64 4, label
-; CHECK: }
-
-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 datalayout = "e-p:64:64:64-p1:16:16:16-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-darwin10.0.0"
@.str = private constant [5 x i8] c"null\00" ; <[5 x i8]*> [#uses=2]
@@ -18,7 +10,24 @@ target triple = "x86_64-apple-darwin10.0.0"
@.str2 = private constant [4 x i8] c"two\00" ; <[4 x i8]*> [#uses=2]
@.str3 = private constant [5 x i8] c"four\00" ; <[5 x i8]*> [#uses=2]
+@.str_as1 = private addrspace(1) constant [5 x i8] c"null\00" ; <[5 x i8]*> [#uses=2]
+@.str1_as1 = private addrspace(1) constant [4 x i8] c"one\00" ; <[4 x i8]*> [#uses=2]
+@.str2_as1 = private addrspace(1) constant [4 x i8] c"two\00" ; <[4 x i8]*> [#uses=2]
+@.str3_as1 = private addrspace(1) constant [5 x i8] c"four\00" ; <[5 x i8]*> [#uses=2]
+
+declare i32 @puts(i8*)
+declare i32 @puts_as1(i8 addrspace(1)*)
+
define void @f(i8* %x) nounwind ssp {
+; CHECK-LABEL: @f(
+; CHECK: switch i64 %magicptr
+; CHECK: i64 0, label
+; CHECK: i64 1, label
+; CHECK: i64 2, label
+; CHECK: i64 3, label
+; CHECK: i64 4, label
+; CHECK: }
+
entry:
%tobool = icmp eq i8* %x, null ; <i1> [#uses=1]
br i1 %tobool, label %if.then, label %if.else
@@ -72,4 +81,69 @@ if.end21: ; preds = %if.end20, %if.then
ret void
}
-declare i32 @puts(i8*)
+; Is it useful to test a version where the ptrtoints are to the same
+; size?
+define void @f_as1(i8 addrspace(1)* %x) nounwind ssp {
+; CHECK-LABEL: @f_as1(
+; CHECK: ptrtoint i8 addrspace(1)* %x to i16
+; CHECK: switch i16 %magicptr
+; CHECK: i16 0, label
+; CHECK: i16 1, label
+; CHECK: i16 2, label
+; CHECK: i16 3, label
+; CHECK: i16 4, label
+; CHECK: }
+
+entry:
+ %tobool = icmp eq i8 addrspace(1)* %x, null ; <i1> [#uses=1]
+ br i1 %tobool, label %if.then, label %if.else
+
+if.then: ; preds = %entry
+ %call = call i32 @puts_as1(i8 addrspace(1)* getelementptr inbounds ([5 x i8] addrspace(1)* @.str_as1, i64 0, i64 0)) nounwind ; <i32> [#uses=0]
+ br label %if.end21
+
+if.else: ; preds = %entry
+ %cmp = icmp eq i8 addrspace(1)* %x, inttoptr (i64 1 to i8 addrspace(1)*) ; <i1> [#uses=1]
+ br i1 %cmp, label %if.then2, label %if.else4
+
+if.then2: ; preds = %if.else
+ %call3 = call i32 @puts_as1(i8 addrspace(1)* getelementptr inbounds ([4 x i8] addrspace(1)* @.str1_as1, i64 0, i64 0)) nounwind ; <i32> [#uses=0]
+ br label %if.end20
+
+if.else4: ; preds = %if.else
+ %cmp6 = icmp eq i8 addrspace(1)* %x, inttoptr (i64 2 to i8 addrspace(1)*) ; <i1> [#uses=1]
+ br i1 %cmp6, label %if.then9, label %lor.lhs.false
+
+lor.lhs.false: ; preds = %if.else4
+ %cmp8 = icmp eq i8 addrspace(1)* %x, inttoptr (i64 3 to i8 addrspace(1)*) ; <i1> [#uses=1]
+ br i1 %cmp8, label %if.then9, label %if.else11
+
+if.then9: ; preds = %lor.lhs.false, %if.else4
+ %call10 = call i32 @puts_as1(i8 addrspace(1)* getelementptr inbounds ([4 x i8] addrspace(1)* @.str2_as1, i64 0, i64 0)) nounwind ; <i32> [#uses=0]
+ br label %if.end19
+
+if.else11: ; preds = %lor.lhs.false
+ %cmp13 = icmp eq i8 addrspace(1)* %x, inttoptr (i64 4 to i8 addrspace(1)*) ; <i1> [#uses=1]
+ br i1 %cmp13, label %if.then14, label %if.else16
+
+if.then14: ; preds = %if.else11
+ %call15 = call i32 @puts_as1(i8 addrspace(1)* getelementptr inbounds ([5 x i8] addrspace(1)* @.str3_as1, i64 0, i64 0)) nounwind ; <i32> [#uses=0]
+ br label %if.end
+
+if.else16: ; preds = %if.else11
+ %call18 = call i32 @puts_as1(i8 addrspace(1)* %x) nounwind ; <i32> [#uses=0]
+ br label %if.end
+
+if.end: ; preds = %if.else16, %if.then14
+ br label %if.end19
+
+if.end19: ; preds = %if.end, %if.then9
+ br label %if.end20
+
+if.end20: ; preds = %if.end19, %if.then2
+ br label %if.end21
+
+if.end21: ; preds = %if.end20, %if.then
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/PR16069.ll b/test/Transforms/SimplifyCFG/PR16069.ll
new file mode 100644
index 000000000000..0b3d67794513
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/PR16069.ll
@@ -0,0 +1,28 @@
+; RUN: opt < %s -simplifycfg -S | FileCheck %s
+
+@b = extern_weak global i32
+
+define i32 @foo(i1 %y) {
+; CHECK: define i32 @foo(i1 %y) {
+ br i1 %y, label %bb1, label %bb2
+bb1:
+ br label %bb3
+bb2:
+ br label %bb3
+bb3:
+ %cond.i = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb2 ]
+; CHECK: phi i32 {{.*}} srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb2
+ ret i32 %cond.i
+}
+
+define i32 @foo2(i1 %x) {
+; CHECK: define i32 @foo2(i1 %x) {
+bb0:
+ br i1 %x, label %bb1, label %bb2
+bb1:
+ br label %bb2
+bb2:
+ %cond = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb0 ]
+; CHECK: %cond = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb0 ]
+ ret i32 %cond
+}
diff --git a/test/Transforms/SimplifyCFG/SPARC/lit.local.cfg b/test/Transforms/SimplifyCFG/SPARC/lit.local.cfg
index 786fee9e6610..4d344fa91a9e 100644
--- a/test/Transforms/SimplifyCFG/SPARC/lit.local.cfg
+++ b/test/Transforms/SimplifyCFG/SPARC/lit.local.cfg
@@ -1,5 +1,3 @@
-config.suffixes = ['.ll', '.c', '.cpp']
-
targets = set(config.root.targets_to_build.split())
if not 'Sparc' in targets:
config.unsupported = True
diff --git a/test/Transforms/SimplifyCFG/SPARC/switch_to_lookup_table.ll b/test/Transforms/SimplifyCFG/SPARC/switch_to_lookup_table.ll
index 9d1568557f30..bb48c80268aa 100644
--- a/test/Transforms/SimplifyCFG/SPARC/switch_to_lookup_table.ll
+++ b/test/Transforms/SimplifyCFG/SPARC/switch_to_lookup_table.ll
@@ -26,7 +26,7 @@ return:
%retval.0 = phi i32 [ 15, %sw.default ], [ 1, %sw.bb6 ], [ 62, %sw.bb5 ], [ 27, %sw.bb4 ], [ -1, %sw.bb3 ], [ 0, %sw.bb2 ], [ 123, %sw.bb1 ], [ 55, %entry ]
ret i32 %retval.0
-; CHECK: @f
+; CHECK-LABEL: @f(
; CHECK-NOT: getelementptr
; CHECK: switch i32 %c
}
diff --git a/test/Transforms/SimplifyCFG/SpeculativeExec.ll b/test/Transforms/SimplifyCFG/SpeculativeExec.ll
index dd2e5d1c3a77..83fa41900035 100644
--- a/test/Transforms/SimplifyCFG/SpeculativeExec.ll
+++ b/test/Transforms/SimplifyCFG/SpeculativeExec.ll
@@ -4,7 +4,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-unknown-linux-gnu"
define i32 @test1(i32 %a, i32 %b, i32 %c) nounwind {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
entry:
%tmp1 = icmp eq i32 %b, 0
br i1 %tmp1, label %bb1, label %bb3
@@ -31,7 +31,7 @@ bb3: ; preds = %bb2, %entry
declare i8 @llvm.cttz.i8(i8, i1)
define i8 @test2(i8 %a) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
br i1 undef, label %bb_true, label %bb_false
bb_true:
%b = tail call i8 @llvm.cttz.i8(i8 %a, i1 false)
@@ -47,7 +47,7 @@ join:
define i8* @test4(i1* %dummy, i8* %a, i8* %b) {
; Test that we don't speculate an arbitrarily large number of unfolded constant
; expressions.
-; CHECK: @test4
+; CHECK-LABEL: @test4(
entry:
%cond1 = load volatile i1* %dummy
diff --git a/test/Transforms/SimplifyCFG/UnreachableEliminate.ll b/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
index 4a692f3622ec..e1635f491156 100644
--- a/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
+++ b/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -simplifycfg -S | FileCheck %s
define void @test1(i1 %C, i1* %BP) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: entry:
; CHECK-NEXT: ret void
entry:
@@ -14,7 +14,7 @@ F:
}
define void @test2() {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: entry:
; CHECK-NEXT: call void @test2()
; CHECK-NEXT: ret void
@@ -28,7 +28,7 @@ N:
}
define i32 @test3(i32 %v) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: entry:
; CHECK-NEXT: [[CMP:%[A-Za-z0-9]+]] = icmp eq i32 %v, 2
; CHECK-NEXT: select i1 [[CMP]], i32 2, i32 1
diff --git a/test/Transforms/SimplifyCFG/X86/lit.local.cfg b/test/Transforms/SimplifyCFG/X86/lit.local.cfg
index a8ad0f1a28b2..ba763cf03ffc 100644
--- a/test/Transforms/SimplifyCFG/X86/lit.local.cfg
+++ b/test/Transforms/SimplifyCFG/X86/lit.local.cfg
@@ -1,5 +1,3 @@
-config.suffixes = ['.ll', '.c', '.cpp']
-
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True
diff --git a/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll b/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll
index 5f70465c64d4..368732711a70 100644
--- a/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll
+++ b/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll
@@ -52,7 +52,7 @@ return:
%retval.0 = phi i32 [ 15, %sw.default ], [ 1, %sw.bb6 ], [ 62, %sw.bb5 ], [ 27, %sw.bb4 ], [ -1, %sw.bb3 ], [ 0, %sw.bb2 ], [ 123, %sw.bb1 ], [ 55, %entry ]
ret i32 %retval.0
-; CHECK: @f
+; CHECK-LABEL: @f(
; CHECK: entry:
; CHECK-NEXT: %switch.tableidx = sub i32 %c, 42
; CHECK-NEXT: %0 = icmp ult i32 %switch.tableidx, 7
@@ -88,7 +88,7 @@ sw.epilog:
call void @dummy(i8 signext %a.0, float %b.0)
ret void
-; CHECK: @h
+; CHECK-LABEL: @h(
; CHECK: entry:
; CHECK-NEXT: %switch.tableidx = sub i32 %x, 0
; CHECK-NEXT: %0 = icmp ult i32 %switch.tableidx, 4
@@ -138,7 +138,7 @@ return:
[ getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), %entry ]
ret i8* %retval.0
-; CHECK: @foostring
+; CHECK-LABEL: @foostring(
; CHECK: entry:
; CHECK-NEXT: %switch.tableidx = sub i32 %x, 0
; CHECK-NEXT: %0 = icmp ult i32 %switch.tableidx, 4
@@ -171,7 +171,7 @@ sw.epilog:
%b.0 = phi i32 [ 10, %sw.default ], [ 5, %sw.bb3 ], [ 1, %sw.bb2 ], [ 4, %sw.bb1 ], [ 3, %entry ]
ret i32 %a.0
-; CHECK: @earlyreturncrash
+; CHECK-LABEL: @earlyreturncrash(
; CHECK: switch.lookup:
; CHECK-NEXT: %switch.gep = getelementptr inbounds [4 x i32]* @switch.table3, i32 0, i32 %switch.tableidx
; CHECK-NEXT: %switch.load = load i32* %switch.gep
@@ -221,7 +221,7 @@ lor.end:
%lor.ext = zext i1 %0 to i32
ret i32 %lor.ext
-; CHECK: @crud
+; CHECK-LABEL: @crud(
; CHECK: entry:
; CHECK-NEXT: %cmp = icmp ult i8 %c, 33
; CHECK-NEXT: br i1 %cmp, label %lor.end, label %switch.early.test
@@ -263,7 +263,7 @@ if.else: br label %if.end
if.end:
%dirent_type.0 = phi i32 [ 3, %sw.default ], [ 6, %sw.bb3 ], [ 5, %sw.bb2 ], [ 0, %sw.bb1 ], [ 3, %sw.bb ], [ 0, %if.else ]
ret i32 %dirent_type.0
-; CHECK: define i32 @overflow
+; CHECK-LABEL: define i32 @overflow(
; CHECK: switch
; CHECK: phi
}
@@ -284,7 +284,7 @@ bb2: br label %bb3
bb3:
%tmp4 = phi i1 [ undef, %bb ], [ false, %bb2 ], [ true, %bb1 ]
ret i1 %tmp4
-; CHECK: define i1 @undef
+; CHECK-LABEL: define i1 @undef(
; CHECK: %switch.cast = trunc i32 %switch.tableidx to i9
; CHECK: %switch.downshift = lshr i9 3, %switch.shiftamt
}
@@ -711,7 +711,7 @@ return:
ret i32 %retval.0
}
-define i32 @cprop(i32 %x) {
+define i32 @cprop(i32 %x, i32 %y) {
entry:
switch i32 %x, label %sw.default [
i32 1, label %return
@@ -727,7 +727,8 @@ sw.bb1: br label %return
sw.bb2:
%and = and i32 %x, 1
- %tobool = icmp ne i32 %and, 0
+ %and.ptr = inttoptr i32 %and to i8*
+ %tobool = icmp ne i8* %and.ptr, null
%cond = select i1 %tobool, i32 -123, i32 456
%sub = sub nsw i32 %x, %cond
br label %return
@@ -735,16 +736,18 @@ sw.bb2:
sw.bb3:
%trunc = trunc i32 %x to i8
%sext = sext i8 %trunc to i32
+ %select.i = icmp sgt i32 %sext, 0
+ %select = select i1 %select.i, i32 %sext, i32 %y
br label %return
sw.default:
br label %return
return:
- %retval.0 = phi i32 [ 123, %sw.default ], [ %sext, %sw.bb3 ], [ %sub, %sw.bb2 ], [ 42, %sw.bb1 ], [ 5, %entry ]
+ %retval.0 = phi i32 [ 123, %sw.default ], [ %select, %sw.bb3 ], [ %sub, %sw.bb2 ], [ 42, %sw.bb1 ], [ 5, %entry ]
ret i32 %retval.0
-; CHECK: @cprop
+; CHECK-LABEL: @cprop(
; CHECK: switch.lookup:
; CHECK: %switch.gep = getelementptr inbounds [7 x i32]* @switch.table5, i32 0, i32 %switch.tableidx
}
@@ -773,7 +776,7 @@ return:
%retval.0 = phi i32 [ 1, %sw.bb3 ], [ -1, %sw.bb2 ], [ 0, %sw.bb ]
ret i32 %retval.0
-; CHECK: @unreachable
+; CHECK-LABEL: @unreachable(
; CHECK: switch.lookup:
; CHECK: getelementptr inbounds [5 x i32]* @switch.table6, i32 0, i32 %switch.tableidx
}
@@ -799,7 +802,7 @@ return:
%retval.0 = phi i96 [ 15, %sw.default ], [ 27, %sw.bb4 ], [ -1, %sw.bb3 ], [ 0, %sw.bb2 ], [ 123, %sw.bb1 ], [ 55, %entry ]
ret i96 %retval.0
-; CHECK: @illegaltype
+; CHECK-LABEL: @illegaltype(
; CHECK-NOT: @switch.table
; CHECK: switch i32 %c
}
diff --git a/test/Transforms/SimplifyCFG/attr-noduplicate.ll b/test/Transforms/SimplifyCFG/attr-noduplicate.ll
new file mode 100644
index 000000000000..523aa51bb84e
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/attr-noduplicate.ll
@@ -0,0 +1,37 @@
+; RUN: opt < %s -simplifycfg -S | FileCheck %s
+
+; This test checks that the SimplifyCFG pass won't duplicate a call to a
+; function marked noduplicate.
+;
+; CHECK-LABEL: @noduplicate
+; CHECK: call void @barrier
+; CHECK-NOT: call void @barrier
+define void @noduplicate(i32 %cond, i32* %out) {
+entry:
+ %out1 = getelementptr i32* %out, i32 1
+ %out2 = getelementptr i32* %out, i32 2
+ %cmp = icmp eq i32 %cond, 0
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then:
+ store i32 5, i32* %out
+ br label %if.end
+
+if.end:
+ call void @barrier() #0
+ br i1 %cmp, label %cond.end, label %cond.false
+
+cond.false:
+ store i32 5, i32* %out1
+ br label %cond.end
+
+cond.end:
+ %value = phi i32 [ 1, %cond.false ], [ 0, %if.end ]
+ store i32 %value, i32* %out2
+ ret void
+}
+
+; Function Attrs: noduplicate nounwind
+declare void @barrier() #0
+
+attributes #0 = { noduplicate nounwind }
diff --git a/test/Transforms/SimplifyCFG/basictest.ll b/test/Transforms/SimplifyCFG/basictest.ll
index 052e10667da5..9c4edd68b800 100644
--- a/test/Transforms/SimplifyCFG/basictest.ll
+++ b/test/Transforms/SimplifyCFG/basictest.ll
@@ -5,14 +5,14 @@
define void @test1() {
br label %1
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: ret void
}
define void @test2() {
ret void
ret void
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK-NEXT: ret void
; CHECK-NEXT: }
}
@@ -20,7 +20,7 @@ define void @test2() {
define void @test3(i1 %T) {
br i1 %T, label %1, label %1
ret void
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NEXT: ret void
}
@@ -38,6 +38,6 @@ define void @test5(i32 %A) {
return: ; preds = %entry
ret void
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK-NEXT: ret void
}
diff --git a/test/Transforms/SimplifyCFG/branch-fold-dbg.ll b/test/Transforms/SimplifyCFG/branch-fold-dbg.ll
index 0526883fe8f4..9d8086c29769 100644
--- a/test/Transforms/SimplifyCFG/branch-fold-dbg.ll
+++ b/test/Transforms/SimplifyCFG/branch-fold-dbg.ll
@@ -41,18 +41,19 @@ declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
!llvm.dbg.sp = !{!0}
-!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 231, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, void (i32)* @foo, null} ; [ DW_TAG_subprogram ]
-!1 = metadata !{i32 589865, metadata !"a.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ]
-!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"a.i", metadata !"/private/tmp", metadata !"clang (trunk 129006)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
-!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
+!0 = metadata !{i32 589870, metadata !15, metadata !1, metadata !"foo", metadata !"foo", metadata !"", i32 231, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (i32)* @foo, null, null, null, i32 0} ; [ DW_TAG_subprogram ] [line 231] [def] [scope 0] [foo]
+!1 = metadata !{i32 589865, metadata !15} ; [ DW_TAG_file_type ]
+!2 = metadata !{i32 589841, metadata !15, i32 12, metadata !"clang (trunk 129006)", i1 true, metadata !"", i32 0, metadata !4, metadata !4, null, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
+!3 = metadata !{i32 589845, metadata !15, metadata !1, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!4 = metadata !{null}
!5 = metadata !{i32 131, i32 2, metadata !0, null}
!6 = metadata !{i32 134, i32 2, metadata !0, null}
!7 = metadata !{i32 590080, metadata !8, metadata !"bar", metadata !1, i32 232, metadata !9, i32 0} ; [ DW_TAG_auto_variable ]
-!8 = metadata !{i32 589835, metadata !0, i32 231, i32 1, metadata !1, i32 3} ; [ DW_TAG_lexical_block ]
-!9 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 32, i64 32, i64 0, i32 0, metadata !10} ; [ DW_TAG_pointer_type ]
-!10 = metadata !{i32 589862, metadata !2, metadata !"", null, i32 0, i64 0, i64 0, i64 0, i32 0, metadata !11} ; [ DW_TAG_const_type ]
-!11 = metadata !{i32 589860, metadata !2, metadata !"unsigned int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ]
+!8 = metadata !{i32 589835, metadata !15, metadata !0, i32 231, i32 1, i32 3} ; [ DW_TAG_lexical_block ]
+!9 = metadata !{i32 589839, null, metadata !2, metadata !"", i32 0, i64 32, i64 32, i64 0, i32 0, metadata !10} ; [ DW_TAG_pointer_type ]
+!10 = metadata !{i32 589862, null, metadata !2, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, metadata !11} ; [ DW_TAG_const_type ]
+!11 = metadata !{i32 589860, null, metadata !2, metadata !"unsigned int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ]
!12 = metadata !{i32 232, i32 40, metadata !8, null}
!13 = metadata !{i32 234, i32 2, metadata !8, null}
!14 = metadata !{i32 274, i32 1, metadata !8, null}
+!15 = metadata !{metadata !"a.c", metadata !"/private/tmp"}
diff --git a/test/Transforms/SimplifyCFG/common-dest-folding.ll b/test/Transforms/SimplifyCFG/common-dest-folding.ll
new file mode 100644
index 000000000000..0aa3b2c560a5
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/common-dest-folding.ll
@@ -0,0 +1,57 @@
+; RUN: opt < %s -simplifycfg -S | FileCheck %s
+
+;CHECK: @foo
+;CHECK: and i32 %c1, %k
+;CHECK: icmp eq i32
+;CHECK: and i32 %c2, %k
+;CHECK: icmp eq i32
+;CHECK: or i1
+;CHECK: ret
+define i32 @foo(i32 %k, i32 %c1, i32 %c2) {
+ %1 = and i32 %c1, %k
+ %2 = icmp eq i32 %1, 0
+ br i1 %2, label %8, label %3
+
+; <label>:3 ; preds = %0
+ %4 = and i32 %c2, %k
+ %5 = icmp eq i32 %4, 0
+ br i1 %5, label %8, label %6
+
+; <label>:6 ; preds = %3
+ %7 = tail call i32 (...)* @bar() nounwind
+ br label %8
+
+; <label>:8 ; preds = %3, %0, %6
+ ret i32 undef
+}
+
+;CHECK: @conduse
+;CHECK: shl i32 1, %c1
+;CHECK-NEXT: shl i32 1, %c2
+;CHECK-NEXT: and i32
+;CHECK-NEXT: icmp eq i32
+;CHECK-NEXT: and i32
+;CHECK-NEXT: icmp eq i32
+;CHECK: ret
+define i32 @conduse(i32 %k, i32 %c1, i32 %c2) #0 {
+bb:
+ %tmp = shl i32 1, %c1
+ %tmp4 = shl i32 1, %c2
+ %tmp1 = and i32 %tmp, %k
+ %tmp2 = icmp eq i32 %tmp1, 0
+ br i1 %tmp2, label %bb9, label %bb3
+
+bb3: ; preds = %bb
+ %tmp5 = and i32 %tmp4, %k
+ %tmp6 = icmp eq i32 %tmp5, 0
+ br i1 %tmp6, label %bb9, label %bb7
+
+bb7: ; preds = %bb3
+ %tmp8 = tail call i32 (...)* @bar() #1
+ br label %bb9
+
+bb9: ; preds = %bb7, %bb3, %bb
+ ret i32 undef
+}
+
+declare i32 @bar(...)
diff --git a/test/Transforms/SimplifyCFG/dce-cond-after-folding-terminator.ll b/test/Transforms/SimplifyCFG/dce-cond-after-folding-terminator.ll
index 3996efd82b5f..036a615e7ff0 100644
--- a/test/Transforms/SimplifyCFG/dce-cond-after-folding-terminator.ll
+++ b/test/Transforms/SimplifyCFG/dce-cond-after-folding-terminator.ll
@@ -2,7 +2,7 @@
define void @test_br(i32 %x) {
entry:
-; CHECK: @test_br
+; CHECK-LABEL: @test_br(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret void
%cmp = icmp eq i32 %x, 10
@@ -17,7 +17,7 @@ if.end: ; preds = %if.else, %if.then
define void @test_switch(i32 %x) nounwind {
entry:
-; CHECK: @test_switch
+; CHECK-LABEL: @test_switch(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret void
%rem = srem i32 %x, 3
@@ -35,7 +35,7 @@ sw.epilog: ; preds = %sw.bb
define void @test_indirectbr(i32 %x) {
entry:
-; CHECK: @test_indirectbr
+; CHECK-LABEL: @test_indirectbr(
; CHECK-NEXT: entry:
; Ideally this should now check:
; CHK-NEXT: ret void
diff --git a/test/Transforms/SimplifyCFG/hoist-dbgvalue.ll b/test/Transforms/SimplifyCFG/hoist-dbgvalue.ll
index 03053f037d0a..0547fa972017 100644
--- a/test/Transforms/SimplifyCFG/hoist-dbgvalue.ll
+++ b/test/Transforms/SimplifyCFG/hoist-dbgvalue.ll
@@ -29,25 +29,28 @@ declare i32 @bar(...)
declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
+!llvm.module.flags = !{!21}
!llvm.dbg.sp = !{!0}
-!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, i32 (i32)* @foo} ; [ DW_TAG_subprogram ]
-!1 = metadata !{i32 589865, metadata !"b.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ]
-!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"b.c", metadata !"/private/tmp", metadata !"clang", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
-!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
+!0 = metadata !{i32 589870, metadata !20, metadata !1, metadata !"foo", metadata !"foo", metadata !"", i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32)* @foo, null, null, null, i32 0} ; [ DW_TAG_subprogram ] [line 2] [def] [scope 0] [foo]
+!1 = metadata !{i32 589865, metadata !20} ; [ DW_TAG_file_type ]
+!2 = metadata !{i32 589841, metadata !20, i32 12, metadata !"clang", i1 true, metadata !"", i32 0, metadata !8, metadata !8, null, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
+!3 = metadata !{i32 589845, metadata !20, metadata !1, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!4 = metadata !{metadata !5}
-!5 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
+!5 = metadata !{i32 589860, null, metadata !2, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!6 = metadata !{i32 590081, metadata !0, metadata !"i", metadata !1, i32 16777218, metadata !5, i32 0} ; [ DW_TAG_arg_variable ]
!7 = metadata !{i32 2, i32 13, metadata !0, null}
!8 = metadata !{i32 0}
!9 = metadata !{i32 590080, metadata !10, metadata !"k", metadata !1, i32 3, metadata !5, i32 0} ; [ DW_TAG_auto_variable ]
-!10 = metadata !{i32 589835, metadata !0, i32 2, i32 16, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
+!10 = metadata !{i32 589835, metadata !20, metadata !0, i32 2, i32 16, i32 0} ; [ DW_TAG_lexical_block ]
!11 = metadata !{i32 3, i32 12, metadata !10, null}
!12 = metadata !{i32 4, i32 3, metadata !10, null}
!13 = metadata !{i32 5, i32 5, metadata !14, null}
-!14 = metadata !{i32 589835, metadata !10, i32 4, i32 10, metadata !1, i32 1} ; [ DW_TAG_lexical_block ]
+!14 = metadata !{i32 589835, metadata !20, metadata !10, i32 4, i32 10, i32 1} ; [ DW_TAG_lexical_block ]
!15 = metadata !{i32 6, i32 3, metadata !14, null}
!16 = metadata !{i32 7, i32 5, metadata !17, null}
-!17 = metadata !{i32 589835, metadata !10, i32 6, i32 10, metadata !1, i32 2} ; [ DW_TAG_lexical_block ]
+!17 = metadata !{i32 589835, metadata !20, metadata !10, i32 6, i32 10, i32 2} ; [ DW_TAG_lexical_block ]
!18 = metadata !{i32 8, i32 3, metadata !17, null}
!19 = metadata !{i32 9, i32 3, metadata !10, null}
+!20 = metadata !{metadata !"b.c", metadata !"/private/tmp"}
+!21 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/SimplifyCFG/indirectbr.ll b/test/Transforms/SimplifyCFG/indirectbr.ll
index 7853e9abd2ea..d0020d001b03 100644
--- a/test/Transforms/SimplifyCFG/indirectbr.ll
+++ b/test/Transforms/SimplifyCFG/indirectbr.ll
@@ -77,7 +77,7 @@ BB0:
; SimplifyCFG should turn the indirectbr into a conditional branch on the
; condition of the select.
-; CHECK: @indbrtest3
+; CHECK-LABEL: @indbrtest3(
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 %cond, label %L1, label %L2
; CHECK-NOT: indirectbr
@@ -104,7 +104,7 @@ L3:
; As in @indbrtest1, it should really remove the branch entirely, but it doesn't
; because it's in the entry block.
-; CHECK: @indbrtest4
+; CHECK-LABEL: @indbrtest4(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label %L1
define void @indbrtest4(i1 %cond) nounwind {
@@ -126,7 +126,7 @@ L3:
; SimplifyCFG should turn the indirectbr into an unreachable because neither
; destination is listed as a successor.
-; CHECK: @indbrtest5
+; CHECK-LABEL: @indbrtest5(
; CHECK-NEXT: entry:
; CHECK-NEXT: unreachable
; CHECK-NEXT: }
@@ -156,7 +156,7 @@ L4:
; The same as above, except the selected addresses are equal.
-; CHECK: @indbrtest6
+; CHECK-LABEL: @indbrtest6(
; CHECK-NEXT: entry:
; CHECK-NEXT: unreachable
; CHECK-NEXT: }
diff --git a/test/Transforms/SimplifyCFG/invoke.ll b/test/Transforms/SimplifyCFG/invoke.ll
index 10dc41b44bc7..5f513ac3e6de 100644
--- a/test/Transforms/SimplifyCFG/invoke.ll
+++ b/test/Transforms/SimplifyCFG/invoke.ll
@@ -9,7 +9,7 @@ declare i32 @nounwind_fn() nounwind
declare i32 @fn()
-; CHECK: @f1
+; CHECK-LABEL: @f1(
define i8* @f1() nounwind uwtable ssp {
entry:
; CHECK: call void @llvm.trap()
@@ -28,7 +28,7 @@ lpad:
unreachable
}
-; CHECK: @f2
+; CHECK-LABEL: @f2(
define i8* @f2() nounwind uwtable ssp {
entry:
; CHECK: call void @llvm.trap()
@@ -47,7 +47,7 @@ lpad:
unreachable
}
-; CHECK: @f3
+; CHECK-LABEL: @f3(
define i32 @f3() nounwind uwtable ssp {
; CHECK-NEXT: entry
entry:
@@ -66,7 +66,7 @@ lpad:
unreachable
}
-; CHECK: @f4
+; CHECK-LABEL: @f4(
define i32 @f4() nounwind uwtable ssp {
; CHECK-NEXT: entry
entry:
@@ -86,7 +86,7 @@ lpad:
unreachable
}
-; CHECK: @f5
+; CHECK-LABEL: @f5(
define i32 @f5(i1 %cond, i8* %a, i8* %b) {
entry:
br i1 %cond, label %x, label %y
@@ -117,7 +117,7 @@ lpad:
unreachable
}
-; CHECK: @f6
+; CHECK-LABEL: @f6(
define void @f6() {
entry:
invoke void @purefn()
diff --git a/test/Transforms/SimplifyCFG/invoke_unwind.ll b/test/Transforms/SimplifyCFG/invoke_unwind.ll
index ed7ff8287f20..435bed0c2957 100644
--- a/test/Transforms/SimplifyCFG/invoke_unwind.ll
+++ b/test/Transforms/SimplifyCFG/invoke_unwind.ll
@@ -5,7 +5,7 @@ declare void @bar()
; This testcase checks to see if the simplifycfg pass is converting invoke
; instructions to call instructions if the handler just rethrows the exception.
define i32 @test1() {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NEXT: call void @bar()
; CHECK-NEXT: ret i32 0
invoke void @bar( )
diff --git a/test/Transforms/SimplifyCFG/lit.local.cfg b/test/Transforms/SimplifyCFG/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/SimplifyCFG/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/SimplifyCFG/phi-undef-loadstore.ll b/test/Transforms/SimplifyCFG/phi-undef-loadstore.ll
index 028fb0745631..f34aec525df8 100644
--- a/test/Transforms/SimplifyCFG/phi-undef-loadstore.ll
+++ b/test/Transforms/SimplifyCFG/phi-undef-loadstore.ll
@@ -24,7 +24,7 @@ if.end7: ; preds = %if.else, %if.then4,
%tmp9 = load i32* %x.0
ret i32 %tmp9
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: if.else:
; CHECK: br label %if.end7
@@ -52,7 +52,7 @@ if.end7: ; preds = %if.else, %if.then4,
%x.0 = phi i32* [ %a, %if.then ], [ null, %if.then4 ], [ null, %if.else ]
%tmp9 = load i32* %x.0
ret i32 %tmp9
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: if.else:
; CHECK: unreachable
@@ -81,7 +81,7 @@ if.end7: ; preds = %if.else, %if.then4,
tail call void @bar() nounwind
%tmp9 = load i32* %x.0
ret i32 %tmp9
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: if.end7:
; CHECK: phi i32* [ %a, %if.then ], [ null, %if.then4 ], [ null, %if.else ]
}
@@ -110,6 +110,6 @@ if.end7: ; preds = %if.else, %if.then4,
%tmp10 = or i32 %tmp9, 1
store i32 %tmp10, i32* %gep
ret i32 %tmp9
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NOT: phi
}
diff --git a/test/Transforms/SimplifyCFG/preserve-branchweights-partial.ll b/test/Transforms/SimplifyCFG/preserve-branchweights-partial.ll
index 53d5448372da..8cc07e39a180 100644
--- a/test/Transforms/SimplifyCFG/preserve-branchweights-partial.ll
+++ b/test/Transforms/SimplifyCFG/preserve-branchweights-partial.ll
@@ -13,7 +13,7 @@
declare void @foo() nounwind uwtable
define void @func(i32 %A) nounwind uwtable {
-; CHECK: define void @func
+; CHECK-LABEL: define void @func(
entry:
%cmp11 = icmp eq i32 %A, 1
br i1 %cmp11, label %if.then, label %if.else, !prof !0
diff --git a/test/Transforms/SimplifyCFG/preserve-branchweights.ll b/test/Transforms/SimplifyCFG/preserve-branchweights.ll
index beef52700820..4022ed6927ee 100644
--- a/test/Transforms/SimplifyCFG/preserve-branchweights.ll
+++ b/test/Transforms/SimplifyCFG/preserve-branchweights.ll
@@ -3,7 +3,7 @@
declare void @helper(i32)
define void @test1(i1 %a, i1 %b) {
-; CHECK: @test1
+; CHECK-LABEL: @test1(
entry:
br i1 %a, label %Y, label %X, !prof !0
; CHECK: br i1 %or.cond, label %Z, label %Y, !prof !0
@@ -22,7 +22,7 @@ Z:
}
define void @test2(i1 %a, i1 %b) {
-; CHECK: @test2
+; CHECK-LABEL: @test2(
entry:
br i1 %a, label %X, label %Y, !prof !1
; CHECK: br i1 %or.cond, label %Z, label %Y, !prof !1
@@ -42,7 +42,7 @@ Z:
}
define void @test3(i1 %a, i1 %b) {
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK-NOT: !prof
entry:
br i1 %a, label %X, label %Y, !prof !1
@@ -61,7 +61,7 @@ Z:
}
define void @test4(i1 %a, i1 %b) {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK-NOT: !prof
entry:
br i1 %a, label %X, label %Y
@@ -156,7 +156,7 @@ sw.epilog:
;; This test is based on test1 but swapped the targets of the second branch.
define void @test1_swap(i1 %a, i1 %b) {
-; CHECK: @test1_swap
+; CHECK-LABEL: @test1_swap(
entry:
br i1 %a, label %Y, label %X, !prof !0
; CHECK: br i1 %or.cond, label %Y, label %Z, !prof !4
@@ -175,7 +175,7 @@ Z:
}
define void @test7(i1 %a, i1 %b) {
-; CHECK: @test7
+; CHECK-LABEL: @test7(
entry:
%c = or i1 %b, false
br i1 %a, label %Y, label %X, !prof !0
@@ -195,7 +195,7 @@ Z:
; Test basic folding to a conditional branch.
define void @test8(i64 %x, i64 %y) nounwind {
-; CHECK: @test8
+; CHECK-LABEL: @test8(
entry:
%lt = icmp slt i64 %x, %y
; CHECK: br i1 %lt, label %a, label %b, !prof !6
@@ -219,7 +219,7 @@ bees:
; Test edge splitting when the default target has icmp and unconditinal
; branch
define i1 @test9(i32 %x, i32 %y) nounwind {
-; CHECK: @test9
+; CHECK-LABEL: @test9(
entry:
switch i32 %x, label %bees [
i32 0, label %a
diff --git a/test/Transforms/SimplifyCFG/select-gep.ll b/test/Transforms/SimplifyCFG/select-gep.ll
index 3e2a6237b275..96c214cbc81e 100644
--- a/test/Transforms/SimplifyCFG/select-gep.ll
+++ b/test/Transforms/SimplifyCFG/select-gep.ll
@@ -14,7 +14,7 @@ if.end:
%x.addr = phi i8* [ %incdec.ptr, %if.then ], [ %x, %entry ]
ret i8* %x.addr
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK-NOT: select
; CHECK: ret i8* %x.addr
}
@@ -34,7 +34,7 @@ if.end:
%x.addr = phi i8* [ %incdec.ptr, %if.then ], [ %y, %entry ]
ret i8* %x.addr
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: %incdec.ptr.y = select i1 %cmp, i8* %incdec.ptr, i8* %y
; CHECK: ret i8* %incdec.ptr.y
}
diff --git a/test/Transforms/SimplifyCFG/speculate-store.ll b/test/Transforms/SimplifyCFG/speculate-store.ll
index 8d7fe79dcd4e..e241901a8789 100644
--- a/test/Transforms/SimplifyCFG/speculate-store.ll
+++ b/test/Transforms/SimplifyCFG/speculate-store.ll
@@ -17,7 +17,7 @@ entry:
; Make sure we speculate stores like the following one. It is cheap compared to
; a mispredicated branch.
-; CHECK: @ifconvertstore
+; CHECK-LABEL: @ifconvertstore(
; CHECK: %add5.add = select i1 %cmp6, i32 %add5, i32 %add
; CHECK: store i32 %add5.add, i32* %arrayidx2, align 4
if.then:
@@ -43,7 +43,7 @@ entry:
%cmp6 = icmp sgt i32 %add5, %C
br i1 %cmp6, label %if.then, label %ret.end
-; CHECK: @noifconvertstore1
+; CHECK-LABEL: @noifconvertstore1(
; CHECK-NOT: select
if.then:
store i32 %add5, i32* %arrayidx2, align 4
@@ -71,7 +71,7 @@ entry:
%cmp6 = icmp sgt i32 %add5, %C
br i1 %cmp6, label %if.then, label %ret.end
-; CHECK: @noifconvertstore2
+; CHECK-LABEL: @noifconvertstore2(
; CHECK-NOT: select
if.then:
store i32 %add5, i32* %arrayidx2, align 4
@@ -97,7 +97,7 @@ entry:
br i1 %cmp6, label %if.then, label %ret.end
; Make sure we don't speculate volatile stores.
-; CHECK: @noifconvertstore_volatile
+; CHECK-LABEL: @noifconvertstore_volatile(
; CHECK-NOT: select
if.then:
store volatile i32 %add5, i32* %arrayidx2, align 4
diff --git a/test/Transforms/SimplifyCFG/speculate-with-offset.ll b/test/Transforms/SimplifyCFG/speculate-with-offset.ll
index a737d5602e84..64fed85c795c 100644
--- a/test/Transforms/SimplifyCFG/speculate-with-offset.ll
+++ b/test/Transforms/SimplifyCFG/speculate-with-offset.ll
@@ -3,7 +3,7 @@
; This load is safe to speculate, as it's from a safe offset
; within an alloca.
-; CHECK: @yes
+; CHECK-LABEL: @yes(
; CHECK-NOT: br
define void @yes(i1 %c) nounwind {
@@ -25,7 +25,7 @@ return: ; preds = %if.end, %if.then
ret void
}
-; CHECK: @no0
+; CHECK-LABEL: @no0(
; CHECK: br i1 %c
define void @no0(i1 %c) nounwind {
@@ -47,7 +47,7 @@ return: ; preds = %if.end, %if.then
ret void
}
-; CHECK: @no1
+; CHECK-LABEL: @no1(
; CHECK: br i1 %c
define void @no1(i1 %c, i64 %n) nounwind {
@@ -69,7 +69,7 @@ return: ; preds = %if.end, %if.then
ret void
}
-; CHECK: @no2
+; CHECK-LABEL: @no2(
; CHECK: br i1 %c
define void @no2(i1 %c, i64 %n) nounwind {
diff --git a/test/Transforms/SimplifyCFG/switch-masked-bits.ll b/test/Transforms/SimplifyCFG/switch-masked-bits.ll
index 3b0c48be6e2d..692973c362bf 100644
--- a/test/Transforms/SimplifyCFG/switch-masked-bits.ll
+++ b/test/Transforms/SimplifyCFG/switch-masked-bits.ll
@@ -13,7 +13,7 @@ b:
ret i32 3
c:
ret i32 5
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %cond = icmp eq i32 %i, 24
; CHECK: %. = select i1 %cond, i32 5, i32 0
; CHECK: ret i32 %.
@@ -33,6 +33,6 @@ b:
ret i32 3
c:
ret i32 5
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: ret i32 0
}
diff --git a/test/Transforms/SimplifyCFG/switch-on-const-select.ll b/test/Transforms/SimplifyCFG/switch-on-const-select.ll
index 9cd709ff8ecf..dec5f80ab98b 100644
--- a/test/Transforms/SimplifyCFG/switch-on-const-select.ll
+++ b/test/Transforms/SimplifyCFG/switch-on-const-select.ll
@@ -2,7 +2,7 @@
; Test basic folding to a conditional branch.
define i32 @foo(i64 %x, i64 %y) nounwind {
-; CHECK: @foo
+; CHECK-LABEL: @foo(
entry:
%eq = icmp eq i64 %x, %y
br i1 %eq, label %b, label %switch
@@ -32,7 +32,7 @@ bees:
; Test basic folding to an unconditional branch.
define i32 @bar(i64 %x, i64 %y) nounwind {
-; CHECK: @bar
+; CHECK-LABEL: @bar(
entry:
; CHECK-NEXT: entry:
; CHECK-NEXT: tail call void @bees.a() [[NUW:#[0-9]+]]
@@ -58,7 +58,7 @@ bees:
; Test the edge case where both values from the select are the default case.
define void @bazz(i64 %x, i64 %y) nounwind {
-; CHECK: @bazz
+; CHECK-LABEL: @bazz(
entry:
; CHECK-NEXT: entry:
; CHECK-NEXT: tail call void @bees.b() [[NUW]]
@@ -83,7 +83,7 @@ bees:
; Test the edge case where both values from the select are equal.
define void @quux(i64 %x, i64 %y) nounwind {
-; CHECK: @quux
+; CHECK-LABEL: @quux(
entry:
; CHECK-NEXT: entry:
; CHECK-NEXT: tail call void @bees.a() [[NUW]]
@@ -108,7 +108,7 @@ bees:
; A final test, for phi node munging.
define i32 @xyzzy(i64 %x, i64 %y) {
-; CHECK: @xyzzy
+; CHECK-LABEL: @xyzzy(
entry:
%eq = icmp eq i64 %x, %y
br i1 %eq, label %r, label %cont
diff --git a/test/Transforms/SimplifyCFG/switch-to-icmp.ll b/test/Transforms/SimplifyCFG/switch-to-icmp.ll
index e9a6db45cb00..bfacf25ca7f7 100644
--- a/test/Transforms/SimplifyCFG/switch-to-icmp.ll
+++ b/test/Transforms/SimplifyCFG/switch-to-icmp.ll
@@ -15,7 +15,7 @@ lor.end:
%0 = phi i1 [ true, %entry ], [ false, %lor.rhs ], [ true, %entry ], [ true, %entry ]
ret i1 %0
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: %x.off = add i32 %x, -1
; CHECK: %switch = icmp ult i32 %x.off, 3
}
@@ -34,7 +34,7 @@ lor.end:
%0 = phi i1 [ true, %entry ], [ false, %lor.rhs ], [ true, %entry ]
ret i1 %0
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: %switch = icmp ult i32 %x, 2
}
@@ -51,7 +51,7 @@ good:
bad:
ret i32 1
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: entry:
; CHECK-NEXT: ret i32 0
}
diff --git a/test/Transforms/SimplifyCFG/switch_create.ll b/test/Transforms/SimplifyCFG/switch_create.ll
index 546cc75f2973..e1e91570300c 100644
--- a/test/Transforms/SimplifyCFG/switch_create.ll
+++ b/test/Transforms/SimplifyCFG/switch_create.ll
@@ -1,4 +1,5 @@
-; RUN: opt < %s -simplifycfg -S | FileCheck %s
+; RUN: opt -S -simplifycfg < %s | FileCheck -check-prefix=CHECK %s
+; RUN: opt -S -default-data-layout="p:32:32-p1:16:16" -simplifycfg < %s | FileCheck -check-prefix=CHECK -check-prefix=DL %s
declare void @foo1()
@@ -15,13 +16,51 @@ T: ; preds = %0
F: ; preds = %0
call void @foo2( )
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: switch i32 %V, label %F [
; CHECK: i32 17, label %T
; CHECK: i32 4, label %T
; CHECK: ]
}
+define void @test1_ptr(i32* %V) {
+ %C1 = icmp eq i32* %V, inttoptr (i32 4 to i32*)
+ %C2 = icmp eq i32* %V, inttoptr (i32 17 to i32*)
+ %CN = or i1 %C1, %C2 ; <i1> [#uses=1]
+ br i1 %CN, label %T, label %F
+T: ; preds = %0
+ call void @foo1( )
+ ret void
+F: ; preds = %0
+ call void @foo2( )
+ ret void
+; CHECK-LABEL: @test1_ptr(
+; DL: %magicptr = ptrtoint i32* %V to i32
+; DL: switch i32 %magicptr, label %F [
+; DL: i32 17, label %T
+; DL: i32 4, label %T
+; DL: ]
+}
+
+define void @test1_ptr_as1(i32 addrspace(1)* %V) {
+ %C1 = icmp eq i32 addrspace(1)* %V, inttoptr (i32 4 to i32 addrspace(1)*)
+ %C2 = icmp eq i32 addrspace(1)* %V, inttoptr (i32 17 to i32 addrspace(1)*)
+ %CN = or i1 %C1, %C2 ; <i1> [#uses=1]
+ br i1 %CN, label %T, label %F
+T: ; preds = %0
+ call void @foo1( )
+ ret void
+F: ; preds = %0
+ call void @foo2( )
+ ret void
+; CHECK-LABEL: @test1_ptr_as1(
+; DL: %magicptr = ptrtoint i32 addrspace(1)* %V to i16
+; DL: switch i16 %magicptr, label %F [
+; DL: i16 17, label %T
+; DL: i16 4, label %T
+; DL: ]
+}
+
define void @test2(i32 %V) {
%C1 = icmp ne i32 %V, 4 ; <i1> [#uses=1]
%C2 = icmp ne i32 %V, 17 ; <i1> [#uses=1]
@@ -33,7 +72,7 @@ T: ; preds = %0
F: ; preds = %0
call void @foo2( )
ret void
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: switch i32 %V, label %T [
; CHECK: i32 17, label %F
; CHECK: i32 4, label %F
@@ -53,7 +92,7 @@ F: ; preds = %N
call void @foo2( )
ret void
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: switch i32 %V, label %F [
; CHECK: i32 4, label %T
; CHECK: i32 17, label %T
@@ -79,8 +118,8 @@ lor.end: ; preds = %lor.rhs, %lor.lhs.f
%0 = phi i1 [ true, %lor.lhs.false ], [ true, %entry ], [ %cmp8, %lor.rhs ]
%lor.ext = zext i1 %0 to i32
ret i32 %lor.ext
-
-; CHECK: @test4
+
+; CHECK-LABEL: @test4(
; CHECK: switch i8 %c, label %lor.rhs [
; CHECK: i8 62, label %lor.end
; CHECK: i8 34, label %lor.end
@@ -104,7 +143,7 @@ lor.end: ; preds = %entry, %entry, %ent
%0 = phi i1 [ true, %entry ], [ %V, %lor.rhs ], [ true, %entry ], [ true, %entry ]
%lor.ext = zext i1 %0 to i32
ret i32 %lor.ext
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: switch i8 %c, label %lor.rhs [
; CHECK: i8 62, label %lor.end
; CHECK: i8 34, label %lor.end
@@ -139,8 +178,8 @@ shortcirc_done.4: ; preds = %shortcirc_next.3, %shortcirc_next.2,
UnifiedReturnBlock: ; preds = %shortcirc_done.4, %shortcirc_next.4
%UnifiedRetVal = phi i1 [ %tmp.26, %shortcirc_next.4 ], [ true, %shortcirc_done.4 ] ; <i1> [#uses=1]
ret i1 %UnifiedRetVal
-
-; CHECK: @test6
+
+; CHECK-LABEL: @test6(
; CHECK: %tmp.2.i.off = add i32 %tmp.2.i, -14
; CHECK: %switch = icmp ult i32 %tmp.2.i.off, 6
}
@@ -160,8 +199,8 @@ if.then: ; preds = %entry
if.end: ; preds = %entry
ret void
-
-; CHECK: @test7
+
+; CHECK-LABEL: @test7(
; CHECK: %cmp = icmp ult i32 %x, 32
; CHECK: br i1 %cmp, label %if.then, label %switch.early.test
; CHECK: switch.early.test:
@@ -189,8 +228,8 @@ if.then: ; preds = %entry
if.end: ; preds = %entry
ret i32 0
-
-; CHECK: @test8
+
+; CHECK-LABEL: @test8(
; CHECK: switch.early.test:
; CHECK: switch i8 %c, label %if.end [
; CHECK: i8 99, label %if.then
@@ -245,8 +284,8 @@ lor.end: ; preds = %lor.rhs, %lor.lhs.f
%0 = phi i1 [ true, %lor.lhs.false36 ], [ true, %lor.lhs.false31 ], [ true, %lor.lhs.false26 ], [ true, %lor.lhs.false21 ], [ true, %lor.lhs.false16 ], [ true, %lor.lhs.false11 ], [ true, %lor.lhs.false6 ], [ true, %lor.lhs.false ], [ true, %entry ], [ %cmp43, %lor.rhs ]
%conv46 = zext i1 %0 to i32
ret i32 %conv46
-
-; CHECK: @test9
+
+; CHECK-LABEL: @test9(
; CHECK: %cmp = icmp ult i8 %c, 33
; CHECK: br i1 %cmp, label %lor.end, label %switch.early.test
@@ -275,7 +314,7 @@ T:
F:
ret i32 324
-; CHECK: @test10
+; CHECK-LABEL: @test10(
; CHECK: br i1 %Cond, label %switch.early.test, label %F
; CHECK:switch.early.test:
; CHECK: switch i32 %mode, label %T [
@@ -314,7 +353,7 @@ return: ; preds = %if.end, %if.then
%retval.0 = phi i32 [ 1, %if.then ], [ 0, %if.end ]
ret i32 %retval.0
-; CHECK: @test11
+; CHECK-LABEL: @test11(
; CHECK: switch i32 %bar, label %if.end [
; CHECK: i32 55, label %return
; CHECK: i32 53, label %return
@@ -343,7 +382,7 @@ bb55.us.us:
malformed:
ret void
-; CHECK: @test12
+; CHECK-LABEL: @test12(
}
@@ -371,7 +410,7 @@ if.then: ; preds = %lor.lhs.false9, %lo
if.end: ; preds = %if.then, %lor.lhs.false9
ret void
-; CHECK: @test13
+; CHECK-LABEL: @test13(
; CHECK: switch i32 %x, label %if.end [
; CHECK: i32 6, label %if.then
; CHECK: i32 4, label %if.then
@@ -405,7 +444,7 @@ if.then: ; preds = %lor.lhs.false9, %lo
if.end: ; preds = %if.then, %lor.lhs.false9
ret void
-; CHECK: @test14
+; CHECK-LABEL: @test14(
; CHECK: switch i32 %x, label %if.end [
; CHECK: i32 6, label %if.then
; CHECK: i32 4, label %if.then
@@ -431,7 +470,7 @@ if.then:
if.end:
ret void
-; CHECK: @test15
+; CHECK-LABEL: @test15(
; CHECK-NOT: switch
; CHECK: ret void
}
@@ -440,7 +479,7 @@ if.end:
; rdar://5134905
define zeroext i1 @test16(i32 %x) nounwind {
entry:
-; CHECK: @test16
+; CHECK-LABEL: @test16(
; CHECK: %x.off = add i32 %x, -1
; CHECK: %switch = icmp ult i32 %x.off, 3
%cmp.i = icmp eq i32 %x, 1
@@ -473,9 +512,45 @@ lor.lhs.false8:
return:
ret void
-; CHECK: @test17
+; CHECK-LABEL: @test17(
; CHECK-NOT: switch.early.test
; CHECK-NOT: switch i32
; CHECK: ret void
}
+define void @test18(i32 %arg) {
+bb:
+ %tmp = and i32 %arg, -2
+ %tmp1 = icmp eq i32 %tmp, 8
+ %tmp2 = icmp eq i32 %arg, 10
+ %tmp3 = or i1 %tmp1, %tmp2
+ %tmp4 = icmp eq i32 %arg, 11
+ %tmp5 = or i1 %tmp3, %tmp4
+ %tmp6 = icmp eq i32 %arg, 12
+ %tmp7 = or i1 %tmp5, %tmp6
+ br i1 %tmp7, label %bb19, label %bb8
+
+bb8: ; preds = %bb
+ %tmp9 = add i32 %arg, -13
+ %tmp10 = icmp ult i32 %tmp9, 2
+ %tmp11 = icmp eq i32 %arg, 16
+ %tmp12 = or i1 %tmp10, %tmp11
+ %tmp13 = icmp eq i32 %arg, 17
+ %tmp14 = or i1 %tmp12, %tmp13
+ %tmp15 = icmp eq i32 %arg, 18
+ %tmp16 = or i1 %tmp14, %tmp15
+ %tmp17 = icmp eq i32 %arg, 15
+ %tmp18 = or i1 %tmp16, %tmp17
+ br i1 %tmp18, label %bb19, label %bb20
+
+bb19: ; preds = %bb8, %bb
+ tail call void @foo1()
+ br label %bb20
+
+bb20: ; preds = %bb19, %bb8
+ ret void
+
+; CHECK-LABEL: @test18(
+; CHECK: %arg.off = add i32 %arg, -8
+; CHECK: icmp ult i32 %arg.off, 11
+}
diff --git a/test/Transforms/SimplifyCFG/trap-debugloc.ll b/test/Transforms/SimplifyCFG/trap-debugloc.ll
index 24540e5217b9..3b449cb000ab 100644
--- a/test/Transforms/SimplifyCFG/trap-debugloc.ll
+++ b/test/Transforms/SimplifyCFG/trap-debugloc.ll
@@ -7,13 +7,18 @@ define void @foo() nounwind ssp {
ret void, !dbg !7
}
+!llvm.dbg.cu = !{!2}
+!llvm.module.flags = !{!10}
!llvm.dbg.sp = !{!0}
-!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 3, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 false, void ()* @foo} ; [ DW_TAG_subprogram ]
-!1 = metadata !{i32 589865, metadata !"foo.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ]
-!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"foo.c", metadata !"/private/tmp", metadata !"Apple clang version 3.0 (tags/Apple/clang-206.1) (based on LLVM 3.0svn)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
-!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
+!0 = metadata !{i32 589870, metadata !8, metadata !1, metadata !"foo", metadata !"foo", metadata !"", i32 3, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 false, void ()* @foo, null, null, null, i32 0} ; [ DW_TAG_subprogram ] [line 3] [def] [scope 0] [foo]
+!1 = metadata !{i32 589865, metadata !8} ; [ DW_TAG_file_type ]
+!2 = metadata !{i32 589841, metadata !8, i32 12, metadata !"Apple clang version 3.0 (tags/Apple/clang-206.1) (based on LLVM 3.0svn)", i1 true, metadata !"", i32 0, metadata !4, metadata !4, metadata !9, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
+!3 = metadata !{i32 589845, metadata !8, metadata !1, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!4 = metadata !{null}
!5 = metadata !{i32 4, i32 2, metadata !6, null}
-!6 = metadata !{i32 589835, metadata !0, i32 3, i32 12, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
+!6 = metadata !{i32 589835, metadata !8, metadata !0, i32 3, i32 12, i32 0} ; [ DW_TAG_lexical_block ]
!7 = metadata !{i32 5, i32 1, metadata !6, null}
+!8 = metadata !{metadata !"foo.c", metadata !"/private/tmp"}
+!9 = metadata !{metadata !0}
+!10 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll b/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll
index 10d6981af0e6..e9d93e834a50 100644
--- a/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll
+++ b/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll
@@ -17,7 +17,7 @@ bb: ; preds = %entry
br label %return
return: ; preds = %entry
ret void
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: load volatile
}
@@ -27,7 +27,7 @@ entry:
store i32 4,i32* null
ret void
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: call void @llvm.trap
; CHECK: unreachable
}
@@ -38,14 +38,14 @@ entry:
store volatile i32 4, i32* null
ret void
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: store volatile i32 4, i32* null
; CHECK: ret
}
; Check store before unreachable.
define void @test4(i1 %C, i32* %P) {
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: entry:
; CHECK-NEXT: br i1 %C
entry:
@@ -59,7 +59,7 @@ F:
; Check cmpxchg before unreachable.
define void @test5(i1 %C, i32* %P) {
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: entry:
; CHECK-NEXT: br i1 %C
entry:
@@ -73,7 +73,7 @@ F:
; Check atomicrmw before unreachable.
define void @test6(i1 %C, i32* %P) {
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: entry:
; CHECK-NEXT: br i1 %C
entry:
diff --git a/test/Transforms/SimplifyCFG/volatile-phioper.ll b/test/Transforms/SimplifyCFG/volatile-phioper.ll
index 164898897eff..1ef3a7ce59b3 100644
--- a/test/Transforms/SimplifyCFG/volatile-phioper.ll
+++ b/test/Transforms/SimplifyCFG/volatile-phioper.ll
@@ -7,7 +7,7 @@
; it can no longer use language standard as an excuse. The compiler
; needs to expose the volatile access to the platform.
;
-; CHECK: @test
+; CHECK-LABEL: @test(
; CHECK: entry:
; CHECK: @Trace
; CHECK: while.body:
@@ -41,8 +41,8 @@ end:
}
declare i32 @Trace(...) #1
-attributes #0 = { nounwind ssp uwtable "fp-contract-model"="standard" "no-frame-pointer-elim" "no-frame-pointer-elim-non-leaf" "realign-stack" "relocation-model"="pic" "ssp-buffers-size"="8" }
-attributes #1 = { "fp-contract-model"="standard" "no-frame-pointer-elim" "no-frame-pointer-elim-non-leaf" "realign-stack" "relocation-model"="pic" "ssp-buffers-size"="8" }
+attributes #0 = { nounwind ssp uwtable "fp-contract-model"="standard" "no-frame-pointer-elim" "no-frame-pointer-elim-non-leaf" "relocation-model"="pic" "ssp-buffers-size"="8" }
+attributes #1 = { "fp-contract-model"="standard" "no-frame-pointer-elim" "no-frame-pointer-elim-non-leaf" "relocation-model"="pic" "ssp-buffers-size"="8" }
attributes #2 = { nounwind }
!0 = metadata !{i32 1039}
diff --git a/test/Transforms/SimplifyLibCalls/2005-05-20-sprintf-crash.ll b/test/Transforms/SimplifyLibCalls/2005-05-20-sprintf-crash.ll
deleted file mode 100644
index 8816579a42ff..000000000000
--- a/test/Transforms/SimplifyLibCalls/2005-05-20-sprintf-crash.ll
+++ /dev/null
@@ -1,11 +0,0 @@
-; RUN: opt < %s -simplify-libcalls -disable-output
-
-@G = constant [3 x i8] c"%s\00" ; <[3 x i8]*> [#uses=1]
-
-declare i32 @sprintf(i8*, i8*, ...)
-
-define void @foo(i8* %P, i32* %X) {
- call i32 (i8*, i8*, ...)* @sprintf( i8* %P, i8* getelementptr ([3 x i8]* @G, i32 0, i32 0), i32* %X ) ; <i32>:1 [#uses=0]
- ret void
-}
-
diff --git a/test/Transforms/SimplifyLibCalls/2007-04-06-strchr-miscompile.ll b/test/Transforms/SimplifyLibCalls/2007-04-06-strchr-miscompile.ll
deleted file mode 100644
index ae917f70f4f1..000000000000
--- a/test/Transforms/SimplifyLibCalls/2007-04-06-strchr-miscompile.ll
+++ /dev/null
@@ -1,29 +0,0 @@
-; PR1307
-; RUN: opt < %s -simplify-libcalls -instcombine -S > %t
-; RUN: grep "@str,.*i64 3" %t
-; RUN: grep "@str1,.*i64 7" %t
-; RUN: grep "ret i8.*null" %t
-; END.
-
-@str = internal constant [5 x i8] c"foog\00"
-@str1 = internal constant [8 x i8] c"blahhh!\00"
-@str2 = internal constant [5 x i8] c"Ponk\00"
-
-define i8* @test1() {
- %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str, i32 0, i32 2), i32 103 ) ; <i8*> [#uses=1]
- ret i8* %tmp3
-}
-
-declare i8* @strchr(i8*, i32)
-
-define i8* @test2() {
- %tmp3 = tail call i8* @strchr( i8* getelementptr ([8 x i8]* @str1, i32 0, i32 2), i32 0 ) ; <i8*> [#uses=1]
- ret i8* %tmp3
-}
-
-define i8* @test3() {
-entry:
- %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str2, i32 0, i32 1), i32 80 ) ; <i8*> [#uses=1]
- ret i8* %tmp3
-}
-
diff --git a/test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll b/test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll
deleted file mode 100644
index b6874322c4c7..000000000000
--- a/test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll
+++ /dev/null
@@ -1,14 +0,0 @@
-; RUN: opt < %s -simplify-libcalls -S | grep i32
-; PR2341
-
-@_2E_str = external constant [5 x i8] ; <[5 x i8]*> [#uses=1]
-
-declare i32 @memcmp(i8*, i8*, i32) nounwind readonly
-
-define i1 @f(i8** %start_addr) {
-entry:
- %tmp4 = load i8** %start_addr, align 4 ; <i8*> [#uses=1]
- %tmp5 = call i32 @memcmp( i8* %tmp4, i8* getelementptr ([5 x i8]* @_2E_str, i32 0, i32 0), i32 4 ) nounwind readonly ; <i32> [#uses=1]
- %tmp6 = icmp eq i32 %tmp5, 0 ; <i1> [#uses=1]
- ret i1 %tmp6
-}
diff --git a/test/Transforms/SimplifyLibCalls/2009-05-30-memcmp-byte.ll b/test/Transforms/SimplifyLibCalls/2009-05-30-memcmp-byte.ll
deleted file mode 100644
index f4c80ed13271..000000000000
--- a/test/Transforms/SimplifyLibCalls/2009-05-30-memcmp-byte.ll
+++ /dev/null
@@ -1,14 +0,0 @@
-; RUN: opt < %s -simplify-libcalls -instcombine -S | grep "ret i32 -65"
-; PR4284
-
-define i32 @test() nounwind {
-entry:
- %c0 = alloca i8, align 1 ; <i8*> [#uses=2]
- %c2 = alloca i8, align 1 ; <i8*> [#uses=2]
- store i8 64, i8* %c0
- store i8 -127, i8* %c2
- %call = call i32 @memcmp(i8* %c0, i8* %c2, i32 1) ; <i32> [#uses=1]
- ret i32 %call
-}
-
-declare i32 @memcmp(i8*, i8*, i32)
diff --git a/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll b/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll
deleted file mode 100644
index 7af0a261d436..000000000000
--- a/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll
+++ /dev/null
@@ -1,22 +0,0 @@
-; RUN: opt < %s -simplify-libcalls -disable-output
-; PR4641
-
- %struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, i8*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64, %struct.pthread_mutex*, %struct.pthread*, i32, i32, %union.anon }
- %struct.__sbuf = type { i8*, i32, [4 x i8] }
- %struct.pthread = type opaque
- %struct.pthread_mutex = type opaque
- %union.anon = type { i64, [120 x i8] }
-@.str13 = external constant [2 x i8] ; <[2 x i8]*> [#uses=1]
-@.str14 = external constant [2 x i8] ; <[2 x i8]*> [#uses=1]
-
-define i32 @main(i32 %argc, i8** %argv) nounwind {
-entry:
- call void @exit(i32 0) nounwind
- %cond392 = select i1 undef, i8* getelementptr ([2 x i8]* @.str13, i32 0, i32 0), i8* getelementptr ([2 x i8]* @.str14, i32 0, i32 0) ; <i8*> [#uses=1]
- %call393 = call %struct.__sFILE* @fopen(i8* undef, i8* %cond392) nounwind ; <%struct.__sFILE*> [#uses=0]
- unreachable
-}
-
-declare %struct.__sFILE* @fopen(i8*, i8*)
-
-declare void @exit(i32)
diff --git a/test/Transforms/SimplifyLibCalls/2009-07-29-Exit2.ll b/test/Transforms/SimplifyLibCalls/2009-07-29-Exit2.ll
deleted file mode 100644
index b5a788e09735..000000000000
--- a/test/Transforms/SimplifyLibCalls/2009-07-29-Exit2.ll
+++ /dev/null
@@ -1,24 +0,0 @@
-; RUN: opt < %s -simplify-libcalls -disable-output
-; PR4645
-
-define i32 @main() {
-entry:
- br label %if.then
-
-lor.lhs.false: ; preds = %while.body
- br i1 undef, label %if.then, label %for.cond
-
-if.then: ; preds = %lor.lhs.false, %while.body
- call void @exit(i32 1)
- br label %for.cond
-
-for.cond: ; preds = %for.end, %if.then, %lor.lhs.false
- %j.0 = phi i32 [ %inc47, %for.end ], [ 0, %if.then ], [ 0, %lor.lhs.false ] ; <i32> [#uses=1]
- unreachable
-
-for.end: ; preds = %for.cond20
- %inc47 = add i32 %j.0, 1 ; <i32> [#uses=1]
- br label %for.cond
-}
-
-declare void @exit(i32)
diff --git a/test/Transforms/SimplifyLibCalls/MemCpy.ll b/test/Transforms/SimplifyLibCalls/MemCpy.ll
deleted file mode 100644
index 1faad036a865..000000000000
--- a/test/Transforms/SimplifyLibCalls/MemCpy.ll
+++ /dev/null
@@ -1,19 +0,0 @@
-; RUN: opt < %s -constprop -instcombine -S | not grep "call.*llvm.memcpy.i32"
-
-@h = constant [2 x i8] c"h\00" ; <[2 x i8]*> [#uses=1]
-@hel = constant [4 x i8] c"hel\00" ; <[4 x i8]*> [#uses=1]
-@hello_u = constant [8 x i8] c"hello_u\00" ; <[8 x i8]*> [#uses=1]
-
-define i32 @main() {
- %h_p = getelementptr [2 x i8]* @h, i32 0, i32 0
- %hel_p = getelementptr [4 x i8]* @hel, i32 0, i32 0
- %hello_u_p = getelementptr [8 x i8]* @hello_u, i32 0, i32 0
- %target = alloca [1024 x i8]
- %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %target_p, i8* %h_p, i32 2, i32 2, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %target_p, i8* %hel_p, i32 4, i32 4, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %target_p, i8* %hello_u_p, i32 8, i32 8, i1 false)
- ret i32 0
-}
-
-declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
diff --git a/test/Transforms/SimplifyLibCalls/lit.local.cfg b/test/Transforms/SimplifyLibCalls/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/SimplifyLibCalls/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/Sink/basic.ll b/test/Transforms/Sink/basic.ll
index 1d0b6b529d56..85ab3766002d 100644
--- a/test/Transforms/Sink/basic.ll
+++ b/test/Transforms/Sink/basic.ll
@@ -6,7 +6,7 @@
; Sink should sink the load past the store (which doesn't overlap) into
; the block that uses it.
-; CHECK: @foo
+; CHECK-LABEL: @foo(
; CHECK: true:
; CHECK-NEXT: %l = load i32* @A
; CHECK-NEXT: ret i32 %l
@@ -23,7 +23,7 @@ false:
; But don't sink load volatiles...
-; CHECK: @foo2
+; CHECK-LABEL: @foo2(
; CHECK: load volatile
; CHECK-NEXT: store i32
@@ -39,7 +39,7 @@ false:
; Sink to the nearest post-dominator
-; CHECK: @diamond
+; CHECK-LABEL: @diamond(
; CHECK: X:
; CHECK-NEXT: phi
; CHECK-NEXT: mul nsw
diff --git a/test/Transforms/Sink/lit.local.cfg b/test/Transforms/Sink/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/Sink/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/StripSymbols/2007-01-15-llvm.used.ll b/test/Transforms/StripSymbols/2007-01-15-llvm.used.ll
index 69febc35df76..438fa96b41ef 100644
--- a/test/Transforms/StripSymbols/2007-01-15-llvm.used.ll
+++ b/test/Transforms/StripSymbols/2007-01-15-llvm.used.ll
@@ -1,5 +1,10 @@
-; RUN: opt < %s -strip -S | grep foo | count 2
-; RUN: opt < %s -strip -S | grep bar | count 2
+; RUN: opt < %s -strip -S | FileCheck %s
+
+; CHECK: foo
+; CHECK: bar
+; CHECK: foo
+; CHECK: bar
+
@llvm.used = appending global [2 x i8*] [ i8* bitcast (i32* @foo to i8*), i8* bitcast (i32 ()* @bar to i8*) ], section "llvm.metadata" ; <[2 x i8*]*> [#uses=0]
@foo = internal constant i32 41 ; <i32*> [#uses=1]
diff --git a/test/Transforms/StripSymbols/2010-06-30-StripDebug.ll b/test/Transforms/StripSymbols/2010-06-30-StripDebug.ll
index f5899d26189d..5353744824dc 100644
--- a/test/Transforms/StripSymbols/2010-06-30-StripDebug.ll
+++ b/test/Transforms/StripSymbols/2010-06-30-StripDebug.ll
@@ -1,4 +1,6 @@
-; RUN: opt -strip-debug < %s | llvm-dis | grep -v llvm.dbg
+; RUN: opt -strip-debug < %s -S | FileCheck %s
+
+; CHECK-NOT: llvm.dbg
@x = common global i32 0 ; <i32*> [#uses=0]
@@ -10,19 +12,23 @@ entry:
declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
+!llvm.dbg.cu = !{!2}
+!llvm.module.flags = !{!13}
!llvm.dbg.sp = !{!0}
!llvm.dbg.lv.foo = !{!5}
!llvm.dbg.gv = !{!8}
-!0 = metadata !{i32 524334, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"foo", metadata !1, i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 true, void ()* @foo} ; [ DW_TAG_subprogram ]
-!1 = metadata !{i32 524329, metadata !"b.c", metadata !"/tmp", metadata !2} ; [ DW_TAG_file_type ]
-!2 = metadata !{i32 524305, i32 0, i32 1, metadata !"b.c", metadata !"/tmp", metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
-!3 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
+!0 = metadata !{i32 524334, metadata !12, metadata !1, metadata !"foo", metadata !"foo", metadata !"foo", i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 true, void ()* @foo, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
+!1 = metadata !{i32 524329, metadata !12} ; [ DW_TAG_file_type ]
+!2 = metadata !{i32 524305, metadata !12, i32 1, metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, metadata !"", i32 0, metadata !4, metadata !4, null, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
+!3 = metadata !{i32 524309, metadata !12, metadata !1, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!4 = metadata !{null}
!5 = metadata !{i32 524544, metadata !6, metadata !"y", metadata !1, i32 3, metadata !7} ; [ DW_TAG_auto_variable ]
-!6 = metadata !{i32 524299, metadata !0, i32 2, i32 0} ; [ DW_TAG_lexical_block ]
-!7 = metadata !{i32 524324, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
+!6 = metadata !{i32 524299, metadata !12, metadata !0, i32 2, i32 0, i32 0} ; [ DW_TAG_lexical_block ]
+!7 = metadata !{i32 524324, metadata !12, metadata !1, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!8 = metadata !{i32 524340, i32 0, metadata !1, metadata !"x", metadata !"x", metadata !"", metadata !1, i32 1, metadata !7, i1 false, i1 true, i32* @x} ; [ DW_TAG_variable ]
!9 = metadata !{i32 0}
!10 = metadata !{i32 3, i32 0, metadata !6, null}
!11 = metadata !{i32 4, i32 0, metadata !6, null}
+!12 = metadata !{metadata !"b.c", metadata !"/tmp"}
+!13 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/StripSymbols/2010-07-01-DeadDbgInfo.ll b/test/Transforms/StripSymbols/2010-07-01-DeadDbgInfo.ll
deleted file mode 100644
index 1df0351c59ab..000000000000
--- a/test/Transforms/StripSymbols/2010-07-01-DeadDbgInfo.ll
+++ /dev/null
@@ -1,47 +0,0 @@
-; RUN: opt -strip-dead-debug-info < %s | llvm-dis -o %t.ll
-; RUN: grep -v bar %t.ll
-; RUN: grep -v abcd %t.ll
-
-@xyz = global i32 2 ; <i32*> [#uses=1]
-
-declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
-
-define i32 @fn() nounwind readnone ssp {
-entry:
- ret i32 0, !dbg !17
-}
-
-define i32 @foo(i32 %i) nounwind readonly ssp {
-entry:
- tail call void @llvm.dbg.value(metadata !{i32 %i}, i64 0, metadata !14), !dbg !19
- %.0 = load i32* @xyz, align 4 ; <i32> [#uses=1]
- ret i32 %.0, !dbg !20
-}
-
-!llvm.dbg.sp = !{!0, !5, !9}
-!llvm.dbg.lv.bar = !{!12}
-!llvm.dbg.lv.foo = !{!14}
-!llvm.dbg.gv = !{!15, !16}
-
-!0 = metadata !{i32 524334, i32 0, metadata !1, metadata !"bar", metadata !"bar", metadata !"", metadata !1, i32 5, metadata !3, i1 true, i1 true, i32 0, i32 0, null, i1 false, i1 true, null} ; [ DW_TAG_subprogram ]
-!1 = metadata !{i32 524329, metadata !"g.c", metadata !"/tmp/", metadata !2} ; [ DW_TAG_file_type ]
-!2 = metadata !{i32 524305, i32 0, i32 1, metadata !"g.c", metadata !"/tmp/", metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
-!3 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
-!4 = metadata !{null}
-!5 = metadata !{i32 524334, i32 0, metadata !1, metadata !"fn", metadata !"fn", metadata !"fn", metadata !1, i32 6, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 true, i32 ()* @fn} ; [ DW_TAG_subprogram ]
-!6 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, null} ; [ DW_TAG_subroutine_type ]
-!7 = metadata !{metadata !8}
-!8 = metadata !{i32 524324, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
-!9 = metadata !{i32 524334, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"foo", metadata !1, i32 7, metadata !10, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 true, i32 (i32)* @foo} ; [ DW_TAG_subprogram ]
-!10 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !11, i32 0, null} ; [ DW_TAG_subroutine_type ]
-!11 = metadata !{metadata !8, metadata !8}
-!12 = metadata !{i32 524544, metadata !13, metadata !"bb", metadata !1, i32 5, metadata !8} ; [ DW_TAG_auto_variable ]
-!13 = metadata !{i32 524299, metadata !0, i32 5, i32 0} ; [ DW_TAG_lexical_block ]
-!14 = metadata !{i32 524545, metadata !9, metadata !"i", metadata !1, i32 7, metadata !8} ; [ DW_TAG_arg_variable ]
-!15 = metadata !{i32 524340, i32 0, metadata !1, metadata !"abcd", metadata !"abcd", metadata !"", metadata !1, i32 2, metadata !8, i1 true, i1 true, null} ; [ DW_TAG_variable ]
-!16 = metadata !{i32 524340, i32 0, metadata !1, metadata !"xyz", metadata !"xyz", metadata !"", metadata !1, i32 3, metadata !8, i1 false, i1 true, i32* @xyz} ; [ DW_TAG_variable ]
-!17 = metadata !{i32 6, i32 0, metadata !18, null}
-!18 = metadata !{i32 524299, metadata !5, i32 6, i32 0} ; [ DW_TAG_lexical_block ]
-!19 = metadata !{i32 7, i32 0, metadata !9, null}
-!20 = metadata !{i32 10, i32 0, metadata !21, null}
-!21 = metadata !{i32 524299, metadata !9, i32 7, i32 0} ; [ DW_TAG_lexical_block ]
diff --git a/test/Transforms/StripSymbols/2010-08-25-crash.ll b/test/Transforms/StripSymbols/2010-08-25-crash.ll
index 7de5a028054a..28784686bb68 100644
--- a/test/Transforms/StripSymbols/2010-08-25-crash.ll
+++ b/test/Transforms/StripSymbols/2010-08-25-crash.ll
@@ -4,16 +4,21 @@ entry:
ret i32 0, !dbg !8
}
-!llvm.dbg.sp = !{!0}
-!llvm.dbg.gv = !{!6}
+!llvm.dbg.cu = !{!2}
+!llvm.module.flags = !{!14}
-!0 = metadata !{i32 524334, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"foo", metadata !1, i32 3, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @foo} ; [ DW_TAG_subprogram ]
-!1 = metadata !{i32 524329, metadata !"/tmp/a.c", metadata !"/Volumes/Lalgate/clean/D.CW", metadata !2} ; [ DW_TAG_file_type ]
-!2 = metadata !{i32 524305, i32 0, i32 12, metadata !"/tmp/a.c", metadata !"/Volumes/Lalgate/clean/D.CW", metadata !"clang version 2.8 (trunk 112062)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
-!3 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
+!0 = metadata !{i32 524334, metadata !10, metadata !1, metadata !"foo", metadata !"foo", metadata !"foo", i32 3, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @foo, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
+!1 = metadata !{i32 524329, metadata !10} ; [ DW_TAG_file_type ]
+!2 = metadata !{i32 524305, metadata !10, i32 12, metadata !"clang version 2.8 (trunk 112062)", i1 true, metadata !"", i32 0, metadata !11, metadata !11, metadata !12, metadata !13, null, metadata !""} ; [ DW_TAG_compile_unit ]
+!3 = metadata !{i32 524309, metadata !10, metadata !1, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!4 = metadata !{metadata !5}
-!5 = metadata !{i32 524324, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
-!6 = metadata !{i32 524340, i32 0, metadata !1, metadata !"i", metadata !"i", metadata !"i", metadata !1, i32 2, metadata !7, i1 true, i1 true, i32 0} ; [ DW_TAG_variable ]
-!7 = metadata !{i32 524326, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, metadata !5} ; [ DW_TAG_const_type ]
+!5 = metadata !{i32 524324, metadata !10, metadata !1, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
+!6 = metadata !{i32 524340, i32 0, metadata !1, metadata !"i", metadata !"i", metadata !"i", metadata !1, i32 2, metadata !7, i1 true, i1 true, i32 0, null} ; [ DW_TAG_variable ]
+!7 = metadata !{i32 524326, metadata !10, metadata !1, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, metadata !5} ; [ DW_TAG_const_type ]
!8 = metadata !{i32 3, i32 13, metadata !9, null}
-!9 = metadata !{i32 524299, metadata !0, i32 3, i32 11, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
+!9 = metadata !{i32 524299, metadata !10, metadata !0, i32 3, i32 11, i32 0} ; [ DW_TAG_lexical_block ]
+!10 = metadata !{metadata !"/tmp/a.c", metadata !"/Volumes/Lalgate/clean/D.CW"}
+!11 = metadata !{i32 0}
+!12 = metadata !{metadata !0}
+!13 = metadata !{metadata !6}
+!14 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/StripSymbols/lit.local.cfg b/test/Transforms/StripSymbols/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/StripSymbols/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/StripSymbols/strip-dead-debug-info.ll b/test/Transforms/StripSymbols/strip-dead-debug-info.ll
new file mode 100644
index 000000000000..2d687ae65470
--- /dev/null
+++ b/test/Transforms/StripSymbols/strip-dead-debug-info.ll
@@ -0,0 +1,58 @@
+; RUN: opt -strip-dead-debug-info -verify %s -S | FileCheck %s
+
+; CHECK: ModuleID = '{{.*}}'
+; CHECK-NOT: bar
+; CHECK-NOT: abcd
+
+@xyz = global i32 2
+
+; Function Attrs: nounwind readnone
+declare void @llvm.dbg.value(metadata, i64, metadata) #0
+
+; Function Attrs: nounwind readnone ssp
+define i32 @fn() #1 {
+entry:
+ ret i32 0, !dbg !18
+}
+
+; Function Attrs: nounwind readonly ssp
+define i32 @foo(i32 %i) #2 {
+entry:
+ tail call void @llvm.dbg.value(metadata !{i32 %i}, i64 0, metadata !15), !dbg !20
+ %.0 = load i32* @xyz, align 4
+ ret i32 %.0, !dbg !21
+}
+
+attributes #0 = { nounwind readnone }
+attributes #1 = { nounwind readnone ssp }
+attributes #2 = { nounwind readonly ssp }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!25}
+
+!0 = metadata !{i32 524305, metadata !1, i32 1, metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, metadata !"", i32 0, metadata !2, metadata !2, metadata !23, metadata !24, null, metadata !""} ; [ DW_TAG_compile_unit ] [/tmp//g.c] [DW_LANG_C89]
+!1 = metadata !{metadata !"g.c", metadata !"/tmp/"}
+!2 = metadata !{null}
+!3 = metadata !{i32 524334, metadata !1, null, metadata !"bar", metadata !"bar", metadata !"", i32 5, metadata !4, i1 true, i1 true, i32 0, i32 0, null, i1 false, i1 true, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ] [line 5] [local] [def] [scope 0] [bar]
+!4 = metadata !{i32 524309, metadata !1, metadata !5, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !2, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
+!5 = metadata !{i32 524329, metadata !1} ; [ DW_TAG_file_type ] [/tmp//g.c]
+!6 = metadata !{i32 524334, metadata !1, null, metadata !"fn", metadata !"fn", metadata !"fn", i32 6, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 true, i32 ()* @fn, null, null, null, i32 0} ; [ DW_TAG_subprogram ] [line 6] [def] [scope 0] [fn]
+!7 = metadata !{i32 524309, metadata !1, metadata !5, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !8, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
+!8 = metadata !{metadata !9}
+!9 = metadata !{i32 524324, metadata !1, metadata !5, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
+!10 = metadata !{i32 524334, metadata !1, null, metadata !"foo", metadata !"foo", metadata !"foo", i32 7, metadata !11, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 true, i32 (i32)* @foo, null, null, null, i32 0} ; [ DW_TAG_subprogram ] [line 7] [def] [scope 0] [foo]
+!11 = metadata !{i32 524309, metadata !1, metadata !5, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !12, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
+!12 = metadata !{metadata !9, metadata !9}
+!13 = metadata !{i32 524544, metadata !14, metadata !"bb", metadata !5, i32 5, metadata !9}
+!14 = metadata !{i32 524299, metadata !1, metadata !3, i32 5, i32 0, i32 0} ; [ DW_TAG_lexical_block ] [/tmp//g.c]
+!15 = metadata !{i32 524545, metadata !10, metadata !"i", metadata !5, i32 7, metadata !9}
+!16 = metadata !{i32 524340, i32 0, metadata !5, metadata !"abcd", metadata !"abcd", metadata !"", metadata !5, i32 2, metadata !9, i1 true, i1 true, null, null}
+!17 = metadata !{i32 524340, i32 0, metadata !5, metadata !"xyz", metadata !"xyz", metadata !"", metadata !5, i32 3, metadata !9, i1 false, i1 true, i32* @xyz, null}
+!18 = metadata !{i32 6, i32 0, metadata !19, null}
+!19 = metadata !{i32 524299, metadata !1, metadata !6, i32 6, i32 0, i32 0} ; [ DW_TAG_lexical_block ] [/tmp//g.c]
+!20 = metadata !{i32 7, i32 0, metadata !10, null}
+!21 = metadata !{i32 10, i32 0, metadata !22, null}
+!22 = metadata !{i32 524299, metadata !1, metadata !10, i32 7, i32 0, i32 0} ; [ DW_TAG_lexical_block ] [/tmp//g.c]
+!23 = metadata !{metadata !3, metadata !6, metadata !10}
+!24 = metadata !{metadata !16, metadata !17}
+!25 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
diff --git a/test/Transforms/StructurizeCFG/branch-on-argument.ll b/test/Transforms/StructurizeCFG/branch-on-argument.ll
new file mode 100644
index 000000000000..4eba0cd8fe15
--- /dev/null
+++ b/test/Transforms/StructurizeCFG/branch-on-argument.ll
@@ -0,0 +1,47 @@
+; RUN: opt -S -o - -structurizecfg < %s | FileCheck %s
+
+; CHECK-LABEL: @invert_branch_on_arg_inf_loop(
+; CHECK: entry:
+; CHECK: %arg.inv = xor i1 %arg, true
+; CHECK: phi i1 [ false, %Flow1 ], [ %arg.inv, %entry ]
+define void @invert_branch_on_arg_inf_loop(i32 addrspace(1)* %out, i1 %arg) {
+entry:
+ br i1 %arg, label %for.end, label %for.body
+
+for.body: ; preds = %entry, %for.body
+ store i32 999, i32 addrspace(1)* %out, align 4
+ br label %for.body
+
+for.end: ; preds = %Flow
+ ret void
+}
+
+
+; CHECK-LABEL: @invert_branch_on_arg_jump_into_loop(
+; CHECK: entry:
+; CHECK: %arg.inv = xor i1 %arg, true
+; CHECK: Flow:
+; CHECK: Flow1:
+define void @invert_branch_on_arg_jump_into_loop(i32 addrspace(1)* %out, i32 %n, i1 %arg) {
+entry:
+ br label %for.body
+
+for.body:
+ %i = phi i32 [0, %entry], [%i.inc, %end.loop]
+ %ptr = getelementptr i32 addrspace(1)* %out, i32 %i
+ store i32 %i, i32 addrspace(1)* %ptr, align 4
+ br i1 %arg, label %mid.loop, label %end.loop
+
+mid.loop:
+ store i32 333, i32 addrspace(1)* %out, align 4
+ br label %for.end
+
+end.loop:
+ %i.inc = add i32 %i, 1
+ %cmp = icmp ne i32 %i.inc, %n
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
+
diff --git a/test/Transforms/StructurizeCFG/loop-multiple-exits.ll b/test/Transforms/StructurizeCFG/loop-multiple-exits.ll
new file mode 100644
index 000000000000..45f3165671e1
--- /dev/null
+++ b/test/Transforms/StructurizeCFG/loop-multiple-exits.ll
@@ -0,0 +1,50 @@
+; RUN: opt -S -structurizecfg %s -o - | FileCheck %s
+;
+; void loop(int *out, int cond_a, int cond_b) {
+;
+; unsigned i;
+; for (i = 0; i < cond_a; i++) {
+; out[i] = i;
+; if (i > cond_b) {
+; break;
+; }
+; out[i + cond_a] = i;
+; }
+; }
+
+define void @loop(i32 addrspace(1)* %out, i32 %cond_a, i32 %cond_b) nounwind uwtable {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+ %cmp = icmp ult i32 %i.0, %cond_a
+ br i1 %cmp, label %for.body, label %for.end
+
+; CHECK: for.body:
+for.body: ; preds = %for.cond
+ %arrayidx = getelementptr inbounds i32 addrspace(1)* %out, i32 %i.0
+ store i32 %i.0, i32 addrspace(1)* %arrayidx, align 4
+ %cmp1 = icmp ugt i32 %i.0, %cond_b
+; CHECK: br i1 %{{[0-9a-zA-Z_]+}}, label %for.inc, label %[[FLOW1:[0-9a-zA-Z_]+]]
+ br i1 %cmp1, label %for.end, label %for.inc
+
+; CHECK: [[FLOW:[0-9a-zA-Z]+]]:
+; CHECK: br i1 %{{[0-9a-zA-Z_]+}}, label %for.end, label %for.cond
+
+; CHECK: for.inc:
+; CHECK: br label %[[FLOW1]]
+
+for.inc: ; preds = %for.body
+ %0 = add i32 %cond_a, %i.0
+ %arrayidx3 = getelementptr inbounds i32 addrspace(1)* %out, i32 %0
+ store i32 %i.0, i32 addrspace(1)* %arrayidx3, align 4
+ %inc = add i32 %i.0, 1
+ br label %for.cond
+
+; CHECK: [[FLOW1]]
+; CHECK: br label %[[FLOW]]
+
+for.end: ; preds = %for.cond, %for.body
+ ret void
+}
diff --git a/test/Transforms/StructurizeCFG/no-branch-to-entry.ll b/test/Transforms/StructurizeCFG/no-branch-to-entry.ll
new file mode 100644
index 000000000000..2e22c8715347
--- /dev/null
+++ b/test/Transforms/StructurizeCFG/no-branch-to-entry.ll
@@ -0,0 +1,31 @@
+; RUN: opt -S -o - -structurizecfg < %s | FileCheck %s
+
+; CHECK-LABEL: @no_branch_to_entry_undef(
+; CHECK: entry:
+; CHECK-NEXT: br label %entry.orig
+define void @no_branch_to_entry_undef(i32 addrspace(1)* %out) {
+entry:
+ br i1 undef, label %for.end, label %for.body
+
+for.body: ; preds = %entry, %for.body
+ store i32 999, i32 addrspace(1)* %out, align 4
+ br label %for.body
+
+for.end: ; preds = %Flow
+ ret void
+}
+
+; CHECK-LABEL: @no_branch_to_entry_true(
+; CHECK: entry:
+; CHECK-NEXT: br label %entry.orig
+define void @no_branch_to_entry_true(i32 addrspace(1)* %out) {
+entry:
+ br i1 true, label %for.end, label %for.body
+
+for.body: ; preds = %entry, %for.body
+ store i32 999, i32 addrspace(1)* %out, align 4
+ br label %for.body
+
+for.end: ; preds = %Flow
+ ret void
+}
diff --git a/test/Transforms/StructurizeCFG/switch.ll b/test/Transforms/StructurizeCFG/switch.ll
new file mode 100644
index 000000000000..316df57ea736
--- /dev/null
+++ b/test/Transforms/StructurizeCFG/switch.ll
@@ -0,0 +1,23 @@
+; RUN: opt -S -structurizecfg %s -o - | FileCheck %s
+
+; The structurizecfg pass cannot handle switch instructions, so we need to
+; make sure the lower switch pass is always run before structurizecfg.
+
+; CHECK-LABEL: @switch
+define void @switch(i32 addrspace(1)* %out, i32 %cond) nounwind {
+entry:
+; CHECK: icmp
+ switch i32 %cond, label %done [ i32 0, label %zero]
+
+; CHECK: zero:
+zero:
+; CHECK: store i32 7, i32 addrspace(1)* %out
+ store i32 7, i32 addrspace(1)* %out
+; CHECK: br label %done
+ br label %done
+
+; CHECK: done:
+done:
+; CHECK: ret void
+ ret void
+}
diff --git a/test/Transforms/TailCallElim/2010-06-26-MultipleReturnValues.ll b/test/Transforms/TailCallElim/2010-06-26-MultipleReturnValues.ll
index 06265926fa68..053fc9543611 100644
--- a/test/Transforms/TailCallElim/2010-06-26-MultipleReturnValues.ll
+++ b/test/Transforms/TailCallElim/2010-06-26-MultipleReturnValues.ll
@@ -2,7 +2,7 @@
; PR7328
; PR7506
define i32 @foo(i32 %x) {
-; CHECK: define i32 @foo
+; CHECK-LABEL: define i32 @foo(
; CHECK: %accumulator.tr = phi i32 [ 1, %entry ], [ 0, %body ]
entry:
%cond = icmp ugt i32 %x, 0 ; <i1> [#uses=1]
diff --git a/test/Transforms/TailCallElim/accum_recursion.ll b/test/Transforms/TailCallElim/accum_recursion.ll
index 9475f87e8f5b..c95bfe6aeed1 100644
--- a/test/Transforms/TailCallElim/accum_recursion.ll
+++ b/test/Transforms/TailCallElim/accum_recursion.ll
@@ -13,7 +13,7 @@ else: ; preds = %entry
ret i32 1
}
-; CHECK: define i32 @test1_factorial
+; CHECK-LABEL: define i32 @test1_factorial(
; CHECK: phi i32
; CHECK-NOT: call i32
; CHECK: else:
@@ -34,14 +34,14 @@ return: ; preds = %entry
ret i32 %x
}
-; CHECK: define i32 @test2_mul
+; CHECK-LABEL: define i32 @test2_mul(
; CHECK: phi i32
; CHECK-NOT: call i32
; CHECK: return:
define i64 @test3_fib(i64 %n) nounwind readnone {
-; CHECK: @test3_fib
+; CHECK-LABEL: @test3_fib(
entry:
; CHECK: tailrecurse:
; CHECK: %accumulator.tr = phi i64 [ %n, %entry ], [ %3, %bb1 ]
diff --git a/test/Transforms/TailCallElim/basic.ll b/test/Transforms/TailCallElim/basic.ll
new file mode 100644
index 000000000000..35420ab08c33
--- /dev/null
+++ b/test/Transforms/TailCallElim/basic.ll
@@ -0,0 +1,145 @@
+; RUN: opt < %s -tailcallelim -S | FileCheck %s
+
+declare void @noarg()
+declare void @use(i32*)
+declare void @use_nocapture(i32* nocapture)
+declare void @use2_nocapture(i32* nocapture, i32* nocapture)
+
+; Trivial case. Mark @noarg with tail call.
+define void @test0() {
+; CHECK: tail call void @noarg()
+ call void @noarg()
+ ret void
+}
+
+; PR615. Make sure that we do not move the alloca so that it interferes with the tail call.
+define i32 @test1() {
+; CHECK: i32 @test1()
+; CHECK-NEXT: alloca
+ %A = alloca i32 ; <i32*> [#uses=2]
+ store i32 5, i32* %A
+ call void @use(i32* %A)
+; CHECK: tail call i32 @test1
+ %X = tail call i32 @test1() ; <i32> [#uses=1]
+ ret i32 %X
+}
+
+; This function contains intervening instructions which should be moved out of the way
+define i32 @test2(i32 %X) {
+; CHECK: i32 @test2
+; CHECK-NOT: call
+; CHECK: ret i32
+entry:
+ %tmp.1 = icmp eq i32 %X, 0 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %then.0, label %endif.0
+then.0: ; preds = %entry
+ %tmp.4 = add i32 %X, 1 ; <i32> [#uses=1]
+ ret i32 %tmp.4
+endif.0: ; preds = %entry
+ %tmp.10 = add i32 %X, -1 ; <i32> [#uses=1]
+ %tmp.8 = call i32 @test2(i32 %tmp.10) ; <i32> [#uses=1]
+ %DUMMY = add i32 %X, 1 ; <i32> [#uses=0]
+ ret i32 %tmp.8
+}
+
+; Though this case seems to be fairly unlikely to occur in the wild, someone
+; plunked it into the demo script, so maybe they care about it.
+define i32 @test3(i32 %c) {
+; CHECK: i32 @test3
+; CHECK-NOT: call
+; CHECK: ret i32 0
+entry:
+ %tmp.1 = icmp eq i32 %c, 0 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %return, label %else
+else: ; preds = %entry
+ %tmp.5 = add i32 %c, -1 ; <i32> [#uses=1]
+ %tmp.3 = call i32 @test3(i32 %tmp.5) ; <i32> [#uses=0]
+ ret i32 0
+return: ; preds = %entry
+ ret i32 0
+}
+
+; Make sure that a nocapture pointer does not stop adding a tail call marker to
+; an unrelated call and additionally that we do not mark the nocapture call with
+; a tail call.
+;
+; rdar://14324281
+define void @test4() {
+; CHECK: void @test4
+; CHECK-NOT: tail call void @use_nocapture
+; CHECK: tail call void @noarg()
+; CHECK: ret void
+ %a = alloca i32
+ call void @use_nocapture(i32* %a)
+ call void @noarg()
+ ret void
+}
+
+; Make sure that we do not perform TRE even with a nocapture use. This is due to
+; bad codegen caused by PR962.
+;
+; rdar://14324281.
+define i32* @test5(i32* nocapture %A, i1 %cond) {
+; CHECK: i32* @test5
+; CHECK-NOT: tailrecurse:
+; CHECK: ret i32* null
+ %B = alloca i32
+ br i1 %cond, label %cond_true, label %cond_false
+cond_true:
+ call i32* @test5(i32* %B, i1 false)
+ ret i32* null
+cond_false:
+ call void @use2_nocapture(i32* %A, i32* %B)
+ call void @noarg()
+ ret i32* null
+}
+
+; PR14143: Make sure that we do not mark functions with nocapture allocas with tail.
+;
+; rdar://14324281.
+define void @test6(i32* %a, i32* %b) {
+; CHECK-LABEL: @test6(
+; CHECK-NOT: tail call
+; CHECK: ret void
+ %c = alloca [100 x i8], align 16
+ %tmp = bitcast [100 x i8]* %c to i32*
+ call void @use2_nocapture(i32* %b, i32* %tmp)
+ ret void
+}
+
+; PR14143: Make sure that we do not mark functions with nocapture allocas with tail.
+;
+; rdar://14324281
+define void @test7(i32* %a, i32* %b) nounwind uwtable {
+entry:
+; CHECK-LABEL: @test7(
+; CHECK-NOT: tail call
+; CHECK: ret void
+ %c = alloca [100 x i8], align 16
+ %0 = bitcast [100 x i8]* %c to i32*
+ call void @use2_nocapture(i32* %0, i32* %a)
+ call void @use2_nocapture(i32* %b, i32* %0)
+ ret void
+}
+
+; If we have a mix of escaping captured/non-captured allocas, ensure that we do
+; not do anything including marking callsites with the tail call marker.
+;
+; rdar://14324281.
+define i32* @test8(i32* nocapture %A, i1 %cond) {
+; CHECK: i32* @test8
+; CHECK-NOT: tailrecurse:
+; CHECK-NOT: tail call
+; CHECK: ret i32* null
+ %B = alloca i32
+ %B2 = alloca i32
+ br i1 %cond, label %cond_true, label %cond_false
+cond_true:
+ call void @use(i32* %B2)
+ call i32* @test8(i32* %B, i1 false)
+ ret i32* null
+cond_false:
+ call void @use2_nocapture(i32* %A, i32* %B)
+ call void @noarg()
+ ret i32* null
+}
diff --git a/test/Transforms/TailCallElim/dont-tce-tail-marked-call.ll b/test/Transforms/TailCallElim/dont-tce-tail-marked-call.ll
deleted file mode 100644
index 97e67b26424d..000000000000
--- a/test/Transforms/TailCallElim/dont-tce-tail-marked-call.ll
+++ /dev/null
@@ -1,13 +0,0 @@
-; RUN: opt < %s -tailcallelim -S | FileCheck %s
-
-declare void @bar(i32*)
-
-define i32 @foo(i32 %N) {
- %A = alloca i32, i32 %N ; <i32*> [#uses=2]
- store i32 17, i32* %A
- call void @bar( i32* %A )
-; CHECK: tail call i32 @foo
- %X = tail call i32 @foo( i32 %N ) ; <i32> [#uses=1]
- ret i32 %X
-}
-
diff --git a/test/Transforms/TailCallElim/inf-recursion.ll b/test/Transforms/TailCallElim/inf-recursion.ll
index c427869107c1..157226f93d3f 100644
--- a/test/Transforms/TailCallElim/inf-recursion.ll
+++ b/test/Transforms/TailCallElim/inf-recursion.ll
@@ -14,7 +14,7 @@ entry:
; Do turn other calls into infinite loops though.
-; CHECK: define double @foo
+; CHECK-LABEL: define double @foo(
; CHECK-NOT: call
; CHECK: }
define double @foo(double %f) {
@@ -22,7 +22,7 @@ define double @foo(double %f) {
ret double %t
}
-; CHECK: define float @fabsf
+; CHECK-LABEL: define float @fabsf(
; CHECK-NOT: call
; CHECK: }
define float @fabsf(float %f) {
diff --git a/test/Transforms/TailCallElim/intervening-inst.ll b/test/Transforms/TailCallElim/intervening-inst.ll
deleted file mode 100644
index 10dffbd69425..000000000000
--- a/test/Transforms/TailCallElim/intervening-inst.ll
+++ /dev/null
@@ -1,18 +0,0 @@
-; This function contains intervening instructions which should be moved out of the way
-; RUN: opt < %s -tailcallelim -S | FileCheck %s
-
-define i32 @Test(i32 %X) {
-entry:
- %tmp.1 = icmp eq i32 %X, 0 ; <i1> [#uses=1]
- br i1 %tmp.1, label %then.0, label %endif.0
-then.0: ; preds = %entry
- %tmp.4 = add i32 %X, 1 ; <i32> [#uses=1]
- ret i32 %tmp.4
-endif.0: ; preds = %entry
- %tmp.10 = add i32 %X, -1 ; <i32> [#uses=1]
-; CHECK-NOT: call
- %tmp.8 = call i32 @Test( i32 %tmp.10 ) ; <i32> [#uses=1]
- %DUMMY = add i32 %X, 1 ; <i32> [#uses=0]
- ret i32 %tmp.8
-}
-
diff --git a/test/Transforms/TailCallElim/lit.local.cfg b/test/Transforms/TailCallElim/lit.local.cfg
deleted file mode 100644
index 19eebc0ac7ac..000000000000
--- a/test/Transforms/TailCallElim/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = ['.ll', '.c', '.cpp']
diff --git a/test/Transforms/TailCallElim/move_alloca_for_tail_call.ll b/test/Transforms/TailCallElim/move_alloca_for_tail_call.ll
deleted file mode 100644
index 741f5848bc67..000000000000
--- a/test/Transforms/TailCallElim/move_alloca_for_tail_call.ll
+++ /dev/null
@@ -1,15 +0,0 @@
-; RUN: opt -tailcallelim -S < %s | FileCheck %s
-; PR615
-
-declare void @bar(i32*)
-
-define i32 @foo() {
-; CHECK: i32 @foo()
-; CHECK-NEXT: alloca
- %A = alloca i32 ; <i32*> [#uses=2]
- store i32 17, i32* %A
- call void @bar( i32* %A )
- %X = tail call i32 @foo( ) ; <i32> [#uses=1]
- ret i32 %X
-}
-
diff --git a/test/Transforms/TailCallElim/nocapture.ll b/test/Transforms/TailCallElim/nocapture.ll
deleted file mode 100644
index e49d87cc4b59..000000000000
--- a/test/Transforms/TailCallElim/nocapture.ll
+++ /dev/null
@@ -1,25 +0,0 @@
-; RUN: opt -tailcallelim -S < %s | FileCheck %s
-; XFAIL: *
-
-declare void @use(i8* nocapture, i8* nocapture)
-
-define i8* @foo(i8* nocapture %A, i1 %cond) {
-; CHECK: tailrecurse:
-; CHECK: %A.tr = phi i8* [ %A, %0 ], [ %B, %cond_true ]
-; CHECK: %cond.tr = phi i1 [ %cond, %0 ], [ false, %cond_true ]
- %B = alloca i8
-; CHECK: %B = alloca i8
- br i1 %cond, label %cond_true, label %cond_false
-; CHECK: br i1 %cond.tr, label %cond_true, label %cond_false
-cond_true:
-; CHECK: cond_true:
-; CHECK: br label %tailrecurse
- call i8* @foo(i8* %B, i1 false)
- ret i8* null
-cond_false:
-; CHECK: cond_false
- call void @use(i8* %A, i8* %B)
-; CHECK: tail call void @use(i8* %A.tr, i8* %B)
- ret i8* null
-; CHECK: ret i8* null
-}
diff --git a/test/Transforms/TailCallElim/return_constant.ll b/test/Transforms/TailCallElim/return_constant.ll
deleted file mode 100644
index e99e57e1457d..000000000000
--- a/test/Transforms/TailCallElim/return_constant.ll
+++ /dev/null
@@ -1,18 +0,0 @@
-; Though this case seems to be fairly unlikely to occur in the wild, someone
-; plunked it into the demo script, so maybe they care about it.
-;
-; RUN: opt < %s -tailcallelim -S | FileCheck %s
-
-define i32 @aaa(i32 %c) {
-entry:
- %tmp.1 = icmp eq i32 %c, 0 ; <i1> [#uses=1]
- br i1 %tmp.1, label %return, label %else
-else: ; preds = %entry
- %tmp.5 = add i32 %c, -1 ; <i32> [#uses=1]
-; CHECK-NOT: call
- %tmp.3 = call i32 @aaa( i32 %tmp.5 ) ; <i32> [#uses=0]
- ret i32 0
-return: ; preds = %entry
- ret i32 0
-}
-
diff --git a/test/Transforms/TailCallElim/trivial_codegen_tailcall.ll b/test/Transforms/TailCallElim/trivial_codegen_tailcall.ll
deleted file mode 100644
index 7049e4d588d4..000000000000
--- a/test/Transforms/TailCallElim/trivial_codegen_tailcall.ll
+++ /dev/null
@@ -1,11 +0,0 @@
-; RUN: opt < %s -tailcallelim -S | FileCheck %s
-
-
-declare void @foo()
-
-define void @bar() {
-; CHECK: tail call void @foo()
- call void @foo()
- ret void
-}
-
diff --git a/test/Transforms/TailDup/X86/lit.local.cfg b/test/Transforms/TailDup/X86/lit.local.cfg
index da2db5a45f9c..ba763cf03ffc 100644
--- a/test/Transforms/TailDup/X86/lit.local.cfg
+++ b/test/Transforms/TailDup/X86/lit.local.cfg
@@ -1,5 +1,3 @@
-config.suffixes = ['.ll']
-
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True
diff --git a/test/Transforms/TailDup/lit.local.cfg b/test/Transforms/TailDup/lit.local.cfg
index 18c604aba567..19840aa7574c 100644
--- a/test/Transforms/TailDup/lit.local.cfg
+++ b/test/Transforms/TailDup/lit.local.cfg
@@ -1,5 +1,3 @@
-config.suffixes = ['.ll', '.c', '.cpp']
-
targets = set(config.root.targets_to_build.split())
if not 'X86' in targets:
config.unsupported = True