summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/InstCombine')
-rw-r--r--test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll6
-rw-r--r--test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll2
-rw-r--r--test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll2
-rw-r--r--test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll2
-rw-r--r--test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll2
-rw-r--r--test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll2
-rw-r--r--test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll2
-rw-r--r--test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll2
-rw-r--r--test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll2
-rw-r--r--test/Transforms/InstCombine/2006-09-15-CastToBool.ll2
-rw-r--r--test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll18
-rw-r--r--test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll18
-rw-r--r--test/Transforms/InstCombine/2006-12-15-Range-Test.ll4
-rw-r--r--test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll4
-rw-r--r--test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll34
-rw-r--r--test/Transforms/InstCombine/2007-02-07-PointerCast.ll6
-rw-r--r--test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll8
-rw-r--r--test/Transforms/InstCombine/2007-05-14-Crash.ll2
-rw-r--r--test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll4
-rw-r--r--test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll2
-rw-r--r--test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll4
-rw-r--r--test/Transforms/InstCombine/2007-10-12-Crash.ll2
-rw-r--r--test/Transforms/InstCombine/2007-10-28-stacksave.ll2
-rw-r--r--test/Transforms/InstCombine/2007-10-31-RangeCrash.ll2
-rw-r--r--test/Transforms/InstCombine/2007-10-31-StringCrash.ll2
-rw-r--r--test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll4
-rw-r--r--test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll2
-rw-r--r--test/Transforms/InstCombine/2007-12-12-GEPScale.ll2
-rw-r--r--test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll16
-rw-r--r--test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll8
-rw-r--r--test/Transforms/InstCombine/2008-03-13-IntToPtr.ll2
-rw-r--r--test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll2
-rw-r--r--test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll4
-rw-r--r--test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll4
-rw-r--r--test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll8
-rw-r--r--test/Transforms/InstCombine/2008-05-08-StrLenSink.ll8
-rw-r--r--test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll4
-rw-r--r--test/Transforms/InstCombine/2008-05-17-InfLoop.ll6
-rw-r--r--test/Transforms/InstCombine/2008-05-23-CompareFold.ll2
-rw-r--r--test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll16
-rw-r--r--test/Transforms/InstCombine/2008-06-19-UncondLoad.ll6
-rw-r--r--test/Transforms/InstCombine/2008-06-24-StackRestore.ll2
-rw-r--r--test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll4
-rw-r--r--test/Transforms/InstCombine/2008-08-05-And.ll4
-rw-r--r--test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll12
-rw-r--r--test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll96
-rw-r--r--test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll16
-rw-r--r--test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll2
-rw-r--r--test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll204
-rw-r--r--test/Transforms/InstCombine/2009-02-21-LoadCST.ll2
-rw-r--r--test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll8
-rw-r--r--test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll4
-rw-r--r--test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll2
-rw-r--r--test/Transforms/InstCombine/2009-12-17-CmpSelectNull.ll4
-rw-r--r--test/Transforms/InstCombine/2010-03-03-ExtElim.ll8
-rw-r--r--test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll2
-rw-r--r--test/Transforms/InstCombine/2010-11-21-SizeZeroTypeGEP.ll4
-rw-r--r--test/Transforms/InstCombine/2011-05-02-VectorBoolean.ll4
-rw-r--r--test/Transforms/InstCombine/2011-05-13-InBoundsGEP.ll4
-rw-r--r--test/Transforms/InstCombine/2011-05-28-swapmulsub.ll14
-rw-r--r--test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll12
-rw-r--r--test/Transforms/InstCombine/2011-09-03-Trampoline.ll4
-rw-r--r--test/Transforms/InstCombine/2011-10-07-AlignPromotion.ll2
-rw-r--r--test/Transforms/InstCombine/2012-02-13-FCmp.ll4
-rw-r--r--test/Transforms/InstCombine/2012-05-27-Negative-Shift-Crash.ll6
-rw-r--r--test/Transforms/InstCombine/2012-05-28-select-hang.ll4
-rw-r--r--test/Transforms/InstCombine/2012-06-06-LoadOfPHIs.ll50
-rw-r--r--test/Transforms/InstCombine/2012-07-25-LoadPart.ll2
-rw-r--r--test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll2
-rw-r--r--test/Transforms/InstCombine/2012-09-17-ZeroSizedAlloca.ll4
-rw-r--r--test/Transforms/InstCombine/2012-09-24-MemcpyFromGlobalCrash.ll19
-rw-r--r--test/Transforms/InstCombine/2012-10-25-vector-of-pointers.ll4
-rw-r--r--test/Transforms/InstCombine/2012-12-14-simp-vgep.ll2
-rw-r--r--test/Transforms/InstCombine/2013-03-05-Combine-BitcastTy-Into-Alloca.ll10
-rw-r--r--test/Transforms/InstCombine/CPP_min_max.ll12
-rw-r--r--test/Transforms/InstCombine/LandingPadClauses.ll52
-rw-r--r--test/Transforms/InstCombine/PR7357.ll2
-rw-r--r--test/Transforms/InstCombine/add2.ll42
-rw-r--r--test/Transforms/InstCombine/add3.ll4
-rw-r--r--test/Transforms/InstCombine/addrspacecast.ll12
-rw-r--r--test/Transforms/InstCombine/alias-recursion.ll4
-rw-r--r--test/Transforms/InstCombine/align-2d-gep.ll4
-rw-r--r--test/Transforms/InstCombine/align-addr.ll12
-rw-r--r--test/Transforms/InstCombine/align-attr.ll4
-rw-r--r--test/Transforms/InstCombine/align-external.ll2
-rw-r--r--test/Transforms/InstCombine/aligned-altivec.ll131
-rw-r--r--test/Transforms/InstCombine/aligned-qpx.ll165
-rw-r--r--test/Transforms/InstCombine/alloca.ll51
-rw-r--r--test/Transforms/InstCombine/assume-loop-align.ll8
-rw-r--r--test/Transforms/InstCombine/assume-redundant.ll12
-rw-r--r--test/Transforms/InstCombine/assume.ll16
-rw-r--r--test/Transforms/InstCombine/atomic.ll6
-rw-r--r--test/Transforms/InstCombine/bitcast-alias-function.ll34
-rw-r--r--test/Transforms/InstCombine/bitcast.ll2
-rw-r--r--test/Transforms/InstCombine/bittest.ll2
-rw-r--r--test/Transforms/InstCombine/branch.ll16
-rw-r--r--test/Transforms/InstCombine/call-cast-target.ll15
-rw-r--r--test/Transforms/InstCombine/call-intrinsics.ll12
-rw-r--r--test/Transforms/InstCombine/call.ll2
-rw-r--r--test/Transforms/InstCombine/call2.ll6
-rw-r--r--test/Transforms/InstCombine/cast.ll205
-rw-r--r--test/Transforms/InstCombine/cast_ptr.ll29
-rw-r--r--test/Transforms/InstCombine/constant-expr-datalayout.ll2
-rw-r--r--test/Transforms/InstCombine/constant-fold-address-space-pointer.ll50
-rw-r--r--test/Transforms/InstCombine/constant-fold-alias.ll4
-rw-r--r--test/Transforms/InstCombine/constant-fold-gep.ll96
-rw-r--r--test/Transforms/InstCombine/constant-fold-hang.ll14
-rw-r--r--test/Transforms/InstCombine/crash.ll38
-rw-r--r--test/Transforms/InstCombine/debug-line.ll20
-rw-r--r--test/Transforms/InstCombine/debuginfo.ll60
-rw-r--r--test/Transforms/InstCombine/default-alignment.ll10
-rw-r--r--test/Transforms/InstCombine/demand_shrink_nsw.ll26
-rw-r--r--test/Transforms/InstCombine/descale-zero.ll20
-rw-r--r--test/Transforms/InstCombine/disable-simplify-libcalls.ll50
-rw-r--r--test/Transforms/InstCombine/div-shift-crash.ll4
-rw-r--r--test/Transforms/InstCombine/dom-conditions.ll152
-rw-r--r--test/Transforms/InstCombine/enforce-known-alignment.ll20
-rw-r--r--test/Transforms/InstCombine/err-rep-cold.ll18
-rw-r--r--test/Transforms/InstCombine/extractvalue.ll18
-rw-r--r--test/Transforms/InstCombine/fast-math.ll8
-rw-r--r--test/Transforms/InstCombine/fcmp.ll35
-rw-r--r--test/Transforms/InstCombine/fmul.ll2
-rw-r--r--test/Transforms/InstCombine/fold-vector-zero.ll2
-rw-r--r--test/Transforms/InstCombine/fp-ret-bitcast.ll8
-rw-r--r--test/Transforms/InstCombine/fpextend.ll12
-rw-r--r--test/Transforms/InstCombine/fprintf-1.ll42
-rw-r--r--test/Transforms/InstCombine/fputs-1.ll8
-rw-r--r--test/Transforms/InstCombine/fwrite-1.ll10
-rw-r--r--test/Transforms/InstCombine/gc.relocate.ll21
-rw-r--r--test/Transforms/InstCombine/gep-addrspace.ll12
-rw-r--r--test/Transforms/InstCombine/gep-sext.ll61
-rw-r--r--test/Transforms/InstCombine/gepgep.ll2
-rw-r--r--test/Transforms/InstCombine/gepphigep.ll124
-rw-r--r--test/Transforms/InstCombine/getelementptr.ll336
-rw-r--r--test/Transforms/InstCombine/icmp-range.ll12
-rw-r--r--test/Transforms/InstCombine/icmp.ll92
-rw-r--r--test/Transforms/InstCombine/inline-intrinsic-assert.ll30
-rw-r--r--test/Transforms/InstCombine/intrinsics.ll68
-rw-r--r--test/Transforms/InstCombine/invariant.ll2
-rw-r--r--test/Transforms/InstCombine/known_align.ll12
-rw-r--r--test/Transforms/InstCombine/load-cmp.ll349
-rw-r--r--test/Transforms/InstCombine/load-select.ll4
-rw-r--r--test/Transforms/InstCombine/load.ll99
-rw-r--r--test/Transforms/InstCombine/load3.ll16
-rw-r--r--test/Transforms/InstCombine/loadstore-alignment.ll34
-rw-r--r--test/Transforms/InstCombine/loadstore-metadata.ll53
-rw-r--r--test/Transforms/InstCombine/lshr-phi.ll10
-rw-r--r--test/Transforms/InstCombine/malloc-free-delete.ll31
-rw-r--r--test/Transforms/InstCombine/max-of-nots.ll85
-rw-r--r--test/Transforms/InstCombine/mem-gep-zidx.ll48
-rw-r--r--test/Transforms/InstCombine/memchr.ll200
-rw-r--r--test/Transforms/InstCombine/memcmp-1.ll16
-rw-r--r--test/Transforms/InstCombine/memcpy-from-global.ll42
-rw-r--r--test/Transforms/InstCombine/memmove.ll10
-rw-r--r--test/Transforms/InstCombine/memset.ll2
-rw-r--r--test/Transforms/InstCombine/memset2.ll2
-rw-r--r--test/Transforms/InstCombine/merge-icmp.ll4
-rw-r--r--test/Transforms/InstCombine/minmax-fold.ll112
-rw-r--r--test/Transforms/InstCombine/mul.ll18
-rw-r--r--test/Transforms/InstCombine/multi-size-address-space-pointer.ll52
-rw-r--r--test/Transforms/InstCombine/no-negzero.ll6
-rw-r--r--test/Transforms/InstCombine/not.ll6
-rw-r--r--test/Transforms/InstCombine/obfuscated_splat.ll2
-rw-r--r--test/Transforms/InstCombine/objsize-address-space.ll6
-rw-r--r--test/Transforms/InstCombine/objsize-noverify.ll43
-rw-r--r--test/Transforms/InstCombine/objsize.ll75
-rw-r--r--test/Transforms/InstCombine/odr-linkage.ll8
-rw-r--r--test/Transforms/InstCombine/or.ll4
-rw-r--r--test/Transforms/InstCombine/osx-names.ll4
-rw-r--r--test/Transforms/InstCombine/overflow-mul.ll11
-rw-r--r--test/Transforms/InstCombine/overflow.ll33
-rw-r--r--test/Transforms/InstCombine/phi-merge-gep.ll60
-rw-r--r--test/Transforms/InstCombine/phi.ll36
-rw-r--r--test/Transforms/InstCombine/pr12251.ll4
-rw-r--r--test/Transforms/InstCombine/pr21651.ll4
-rw-r--r--test/Transforms/InstCombine/pr2645-0.ll8
-rw-r--r--test/Transforms/InstCombine/pr2645-1.ll6
-rw-r--r--test/Transforms/InstCombine/pr2996.ll2
-rw-r--r--test/Transforms/InstCombine/pr8547.ll2
-rw-r--r--test/Transforms/InstCombine/printf-1.ll52
-rw-r--r--test/Transforms/InstCombine/printf-2.ll18
-rw-r--r--test/Transforms/InstCombine/puts-1.ll6
-rw-r--r--test/Transforms/InstCombine/select-cmp-br.ll58
-rw-r--r--test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll327
-rw-r--r--test/Transforms/InstCombine/select-crash-noverify.ll19
-rw-r--r--test/Transforms/InstCombine/select-crash.ll17
-rw-r--r--test/Transforms/InstCombine/select-load-call.ll2
-rw-r--r--test/Transforms/InstCombine/select-select.ll10
-rw-r--r--test/Transforms/InstCombine/select.ll132
-rw-r--r--test/Transforms/InstCombine/shift.ll4
-rw-r--r--test/Transforms/InstCombine/shufflemask-undef.ll4
-rw-r--r--test/Transforms/InstCombine/signed-comparison.ll4
-rw-r--r--test/Transforms/InstCombine/simplify-demanded-bits-pointer.ll2
-rw-r--r--test/Transforms/InstCombine/simplify-libcalls.ll27
-rw-r--r--test/Transforms/InstCombine/sincospi.ll12
-rw-r--r--test/Transforms/InstCombine/sitofp.ll169
-rw-r--r--test/Transforms/InstCombine/sprintf-1.ll40
-rw-r--r--test/Transforms/InstCombine/sqrt.ll6
-rw-r--r--test/Transforms/InstCombine/srem1.ll2
-rw-r--r--test/Transforms/InstCombine/stack-overalign.ll4
-rw-r--r--test/Transforms/InstCombine/stacksaverestore.ll2
-rw-r--r--test/Transforms/InstCombine/statepoint.ll26
-rw-r--r--test/Transforms/InstCombine/store.ll14
-rw-r--r--test/Transforms/InstCombine/stpcpy-1.ll14
-rw-r--r--test/Transforms/InstCombine/stpcpy-2.ll4
-rw-r--r--test/Transforms/InstCombine/stpcpy_chk-1.ll52
-rw-r--r--test/Transforms/InstCombine/stpcpy_chk-2.ll4
-rw-r--r--test/Transforms/InstCombine/strcat-1.ll8
-rw-r--r--test/Transforms/InstCombine/strcat-2.ll8
-rw-r--r--test/Transforms/InstCombine/strcat-3.ll4
-rw-r--r--test/Transforms/InstCombine/strchr-1.ll37
-rw-r--r--test/Transforms/InstCombine/strchr-2.ll2
-rw-r--r--test/Transforms/InstCombine/strcmp-1.ll24
-rw-r--r--test/Transforms/InstCombine/strcmp-2.ll4
-rw-r--r--test/Transforms/InstCombine/strcpy-1.ll12
-rw-r--r--test/Transforms/InstCombine/strcpy-2.ll4
-rw-r--r--test/Transforms/InstCombine/strcpy_chk-1.ll50
-rw-r--r--test/Transforms/InstCombine/strcpy_chk-2.ll4
-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.ll20
-rw-r--r--test/Transforms/InstCombine/strlen-2.ll2
-rw-r--r--test/Transforms/InstCombine/strncat-1.ll8
-rw-r--r--test/Transforms/InstCombine/strncat-2.ll16
-rw-r--r--test/Transforms/InstCombine/strncat-3.ll4
-rw-r--r--test/Transforms/InstCombine/strncmp-1.ll24
-rw-r--r--test/Transforms/InstCombine/strncmp-2.ll4
-rw-r--r--test/Transforms/InstCombine/strncpy-1.ll30
-rw-r--r--test/Transforms/InstCombine/strncpy-2.ll4
-rw-r--r--test/Transforms/InstCombine/strncpy_chk-1.ll34
-rw-r--r--test/Transforms/InstCombine/strncpy_chk-2.ll4
-rw-r--r--test/Transforms/InstCombine/strpbrk-1.ll12
-rw-r--r--test/Transforms/InstCombine/strpbrk-2.ll4
-rw-r--r--test/Transforms/InstCombine/strrchr-1.ll16
-rw-r--r--test/Transforms/InstCombine/strrchr-2.ll2
-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/struct-assign-tbaa.ll8
-rw-r--r--test/Transforms/InstCombine/sub.ll34
-rw-r--r--test/Transforms/InstCombine/switch-truncate-crash.ll7
-rw-r--r--test/Transforms/InstCombine/type_pun.ll141
-rw-r--r--test/Transforms/InstCombine/unpack-fca.ll114
-rw-r--r--test/Transforms/InstCombine/urem-simplify-bug.ll4
-rw-r--r--test/Transforms/InstCombine/vec_demanded_elts.ll18
-rw-r--r--test/Transforms/InstCombine/vec_extract_var_elt.ll2
-rw-r--r--test/Transforms/InstCombine/vec_phi_extract.ll2
-rw-r--r--test/Transforms/InstCombine/vec_shuffle.ll12
-rw-r--r--test/Transforms/InstCombine/vector-casts.ll2
-rw-r--r--test/Transforms/InstCombine/vector_gep1.ll12
-rw-r--r--test/Transforms/InstCombine/vector_gep2.ll4
-rw-r--r--test/Transforms/InstCombine/volatile_store.ll2
-rw-r--r--test/Transforms/InstCombine/vsx-unaligned.ll12
-rw-r--r--test/Transforms/InstCombine/weak-symbols.ll8
-rw-r--r--test/Transforms/InstCombine/x86-insertps.ll150
-rw-r--r--test/Transforms/InstCombine/x86-vperm2.ll283
-rw-r--r--test/Transforms/InstCombine/xor.ll8
-rw-r--r--test/Transforms/InstCombine/zext-or-icmp.ll16
259 files changed, 4765 insertions, 2099 deletions
diff --git a/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll b/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll
index f550c8349f84a..b381545808939 100644
--- a/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll
+++ b/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll
@@ -31,14 +31,14 @@ entry:
%a.0 = alloca i32 ; <i32*> [#uses=2]
%result = alloca i32 ; <i32*> [#uses=2]
store i32 %a.1, i32* %a.0
- %tmp.0 = load i32* %a.0 ; <i32> [#uses=1]
- %tmp.1 = load i32* @silly ; <i32> [#uses=1]
+ %tmp.0 = load i32, i32* %a.0 ; <i32> [#uses=1]
+ %tmp.1 = load i32, i32* @silly ; <i32> [#uses=1]
%tmp.2 = add i32 %tmp.0, %tmp.1 ; <i32> [#uses=1]
store i32 %tmp.2, i32* %result
br label %return
return: ; preds = %entry
- %tmp.3 = load i32* %result ; <i32> [#uses=1]
+ %tmp.3 = load i32, i32* %result ; <i32> [#uses=1]
ret i32 %tmp.3
}
diff --git a/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll b/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll
index bb9a8181ccd46..50b9fdb16458e 100644
--- a/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll
+++ b/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll
@@ -12,7 +12,7 @@ entry:
br i1 %tmp.1, label %then, label %UnifiedExitNode
then: ; preds = %entry
- %tmp.4 = call i32 (...)* @bitmap_clear( i32* %live_head ) ; <i32> [#uses=0]
+ %tmp.4 = call i32 (...) @bitmap_clear( i32* %live_head ) ; <i32> [#uses=0]
br label %UnifiedExitNode
UnifiedExitNode: ; preds = %then, %entry
diff --git a/test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll b/test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll
index 7f7390809c77a..3e0cf1247d90f 100644
--- a/test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll
+++ b/test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll
@@ -2,6 +2,6 @@
define void @test(i32* %P) {
; Dead but not deletable!
- %X = load volatile i32* %P ; <i32> [#uses=0]
+ %X = load volatile i32, i32* %P ; <i32> [#uses=0]
ret void
}
diff --git a/test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll b/test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll
index c1692f77abb21..aff39f8bf9791 100644
--- a/test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll
+++ b/test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll
@@ -7,7 +7,7 @@ declare void @foo(...)
define void @test(i64 %X) {
%Y = inttoptr i64 %X to i32* ; <i32*> [#uses=1]
- call void (...)* @foo( i32* %Y )
+ call void (...) @foo( i32* %Y )
ret void
}
diff --git a/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll b/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll
index 6df30c7e7fd14..a086c01565042 100644
--- a/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll
+++ b/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll
@@ -19,7 +19,7 @@ call: ; preds = %entry
cont: ; preds = %call, %entry
%P2 = phi i32* [ %P, %call ], [ null, %entry ] ; <i32*> [#uses=1]
- %V = load i32* %P2 ; <i32> [#uses=1]
+ %V = load i32, i32* %P2 ; <i32> [#uses=1]
ret i32 %V
N: ; preds = %call
diff --git a/test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll b/test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll
index 8b549374a70ca..ff855dc13e5bd 100644
--- a/test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll
+++ b/test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll
@@ -4,7 +4,7 @@
define i32 @test(%Ty* %X) {
%Y = bitcast %Ty* %X to i32* ; <i32*> [#uses=1]
- %Z = load i32* %Y ; <i32> [#uses=1]
+ %Z = load i32, i32* %Y ; <i32> [#uses=1]
ret i32 %Z
}
diff --git a/test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll b/test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll
index d17db8d7eac20..10122e48ab664 100644
--- a/test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll
+++ b/test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll
@@ -12,7 +12,7 @@ define i32 @test(i1 %C) {
store i32 2, i32* %X2
%Y = select i1 %C, i32* %X, i32* %X2 ; <i32*> [#uses=1]
store i32 3, i32* %X
- %Z = load i32* %Y ; <i32> [#uses=1]
+ %Z = load i32, i32* %Y ; <i32> [#uses=1]
ret i32 %Z
}
diff --git a/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll b/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll
index 0d5fc810a8ae1..981a4f301a999 100644
--- a/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll
+++ b/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll
@@ -18,7 +18,7 @@ cond_true.i: ; preds = %entry
cond_continue.i: ; preds = %cond_true.i, %entry
%mem_tmp.i.0 = phi i32* [ %X, %cond_true.i ], [ %X2, %entry ] ; <i32*> [#uses=1]
store i32 3, i32* %X
- %tmp.3 = load i32* %mem_tmp.i.0 ; <i32> [#uses=1]
+ %tmp.3 = load i32, i32* %mem_tmp.i.0 ; <i32> [#uses=1]
ret i32 %tmp.3
}
diff --git a/test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll b/test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll
index 0a513c647c127..9c989b9ecf8a4 100644
--- a/test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll
+++ b/test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll
@@ -5,7 +5,7 @@
@g_07918478 = external global i32 ; <i32*> [#uses=1]
define i1 @test() {
- %tmp.0 = load i32* @g_07918478 ; <i32> [#uses=2]
+ %tmp.0 = load i32, i32* @g_07918478 ; <i32> [#uses=2]
%tmp.1 = icmp ne i32 %tmp.0, 0 ; <i1> [#uses=1]
%tmp.4 = icmp ult i32 %tmp.0, 4111 ; <i1> [#uses=1]
%bothcond = or i1 %tmp.1, %tmp.4 ; <i1> [#uses=1]
diff --git a/test/Transforms/InstCombine/2006-09-15-CastToBool.ll b/test/Transforms/InstCombine/2006-09-15-CastToBool.ll
index ee261ced5869a..2eb28a3f6bb8f 100644
--- a/test/Transforms/InstCombine/2006-09-15-CastToBool.ll
+++ b/test/Transforms/InstCombine/2006-09-15-CastToBool.ll
@@ -2,7 +2,7 @@
; PR913
define i32 @test(i32* %tmp1) {
- %tmp.i = load i32* %tmp1 ; <i32> [#uses=1]
+ %tmp.i = load i32, i32* %tmp1 ; <i32> [#uses=1]
%tmp = bitcast i32 %tmp.i to i32 ; <i32> [#uses=1]
%tmp2.ui = lshr i32 %tmp, 5 ; <i32> [#uses=1]
%tmp2 = bitcast i32 %tmp2.ui to i32 ; <i32> [#uses=1]
diff --git a/test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll b/test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll
index 295006ca2318c..60113fb56206c 100644
--- a/test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll
+++ b/test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll
@@ -12,24 +12,24 @@ entry:
%p3_addr = alloca %struct.point ; <%struct.point*> [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
%tmp = bitcast %struct.point* %p1_addr to { i64 }* ; <{ i64 }*> [#uses=1]
- %tmp.upgrd.1 = getelementptr { i64 }* %tmp, i64 0, i32 0 ; <i64*> [#uses=1]
+ %tmp.upgrd.1 = getelementptr { i64 }, { i64 }* %tmp, i64 0, i32 0 ; <i64*> [#uses=1]
store i64 %p1.0, i64* %tmp.upgrd.1
%tmp1 = bitcast %struct.point* %p2_addr to { i64 }* ; <{ i64 }*> [#uses=1]
- %tmp2 = getelementptr { i64 }* %tmp1, i64 0, i32 0 ; <i64*> [#uses=1]
+ %tmp2 = getelementptr { i64 }, { i64 }* %tmp1, i64 0, i32 0 ; <i64*> [#uses=1]
store i64 %p2.0, i64* %tmp2
%tmp3 = bitcast %struct.point* %p3_addr to { i64 }* ; <{ i64 }*> [#uses=1]
- %tmp4 = getelementptr { i64 }* %tmp3, i64 0, i32 0 ; <i64*> [#uses=1]
+ %tmp4 = getelementptr { i64 }, { i64 }* %tmp3, i64 0, i32 0 ; <i64*> [#uses=1]
store i64 %p3.0, i64* %tmp4
%tmp.upgrd.2 = icmp eq i32 %direction, 0 ; <i1> [#uses=1]
%tmp5 = bitcast %struct.point* %p1_addr to { i64 }* ; <{ i64 }*> [#uses=1]
- %tmp6 = getelementptr { i64 }* %tmp5, i64 0, i32 0 ; <i64*> [#uses=1]
- %tmp.upgrd.3 = load i64* %tmp6 ; <i64> [#uses=1]
+ %tmp6 = getelementptr { i64 }, { i64 }* %tmp5, i64 0, i32 0 ; <i64*> [#uses=1]
+ %tmp.upgrd.3 = load i64, i64* %tmp6 ; <i64> [#uses=1]
%tmp7 = bitcast %struct.point* %p2_addr to { i64 }* ; <{ i64 }*> [#uses=1]
- %tmp8 = getelementptr { i64 }* %tmp7, i64 0, i32 0 ; <i64*> [#uses=1]
- %tmp9 = load i64* %tmp8 ; <i64> [#uses=1]
+ %tmp8 = getelementptr { i64 }, { i64 }* %tmp7, i64 0, i32 0 ; <i64*> [#uses=1]
+ %tmp9 = load i64, i64* %tmp8 ; <i64> [#uses=1]
%tmp10 = bitcast %struct.point* %p3_addr to { i64 }* ; <{ i64 }*> [#uses=1]
- %tmp11 = getelementptr { i64 }* %tmp10, i64 0, i32 0 ; <i64*> [#uses=1]
- %tmp12 = load i64* %tmp11 ; <i64> [#uses=1]
+ %tmp11 = getelementptr { i64 }, { i64 }* %tmp10, i64 0, i32 0 ; <i64*> [#uses=1]
+ %tmp12 = load i64, i64* %tmp11 ; <i64> [#uses=1]
%tmp13 = call i32 @determinant( i64 %tmp.upgrd.3, i64 %tmp9, i64 %tmp12 ) ; <i32> [#uses=2]
br i1 %tmp.upgrd.2, label %cond_true, label %cond_false
diff --git a/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll b/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll
index 272753cc98d66..f54416d14254c 100644
--- a/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll
+++ b/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll
@@ -12,24 +12,24 @@ entry:
%p2_addr = alloca %struct.point ; <%struct.point*> [#uses=2]
%p3_addr = alloca %struct.point ; <%struct.point*> [#uses=2]
%tmp = bitcast %struct.point* %p1_addr to { i64 }* ; <{ i64 }*> [#uses=1]
- %tmp.upgrd.1 = getelementptr { i64 }* %tmp, i32 0, i32 0 ; <i64*> [#uses=1]
+ %tmp.upgrd.1 = getelementptr { i64 }, { i64 }* %tmp, i32 0, i32 0 ; <i64*> [#uses=1]
store i64 %p1.0, i64* %tmp.upgrd.1
%tmp1 = bitcast %struct.point* %p2_addr to { i64 }* ; <{ i64 }*> [#uses=1]
- %tmp2 = getelementptr { i64 }* %tmp1, i32 0, i32 0 ; <i64*> [#uses=1]
+ %tmp2 = getelementptr { i64 }, { i64 }* %tmp1, i32 0, i32 0 ; <i64*> [#uses=1]
store i64 %p2.0, i64* %tmp2
%tmp3 = bitcast %struct.point* %p3_addr to { i64 }* ; <{ i64 }*> [#uses=1]
- %tmp4 = getelementptr { i64 }* %tmp3, i32 0, i32 0 ; <i64*> [#uses=1]
+ %tmp4 = getelementptr { i64 }, { i64 }* %tmp3, i32 0, i32 0 ; <i64*> [#uses=1]
store i64 %p3.0, i64* %tmp4
%tmp.upgrd.2 = icmp eq i32 %direction, 0 ; <i1> [#uses=1]
%tmp5 = bitcast %struct.point* %p1_addr to { i64 }* ; <{ i64 }*> [#uses=1]
- %tmp6 = getelementptr { i64 }* %tmp5, i32 0, i32 0 ; <i64*> [#uses=1]
- %tmp.upgrd.3 = load i64* %tmp6 ; <i64> [#uses=1]
+ %tmp6 = getelementptr { i64 }, { i64 }* %tmp5, i32 0, i32 0 ; <i64*> [#uses=1]
+ %tmp.upgrd.3 = load i64, i64* %tmp6 ; <i64> [#uses=1]
%tmp7 = bitcast %struct.point* %p2_addr to { i64 }* ; <{ i64 }*> [#uses=1]
- %tmp8 = getelementptr { i64 }* %tmp7, i32 0, i32 0 ; <i64*> [#uses=1]
- %tmp9 = load i64* %tmp8 ; <i64> [#uses=1]
+ %tmp8 = getelementptr { i64 }, { i64 }* %tmp7, i32 0, i32 0 ; <i64*> [#uses=1]
+ %tmp9 = load i64, i64* %tmp8 ; <i64> [#uses=1]
%tmp10 = bitcast %struct.point* %p3_addr to { i64 }* ; <{ i64 }*> [#uses=1]
- %tmp11 = getelementptr { i64 }* %tmp10, i32 0, i32 0 ; <i64*> [#uses=1]
- %tmp12 = load i64* %tmp11 ; <i64> [#uses=1]
+ %tmp11 = getelementptr { i64 }, { i64 }* %tmp10, i32 0, i32 0 ; <i64*> [#uses=1]
+ %tmp12 = load i64, i64* %tmp11 ; <i64> [#uses=1]
%tmp13 = call i32 @determinant( i64 %tmp.upgrd.3, i64 %tmp9, i64 %tmp12 ) ; <i32> [#uses=2]
%tmp14 = icmp slt i32 %tmp13, 0 ; <i1> [#uses=1]
%tmp26 = icmp sgt i32 %tmp13, 0 ; <i1> [#uses=1]
diff --git a/test/Transforms/InstCombine/2006-12-15-Range-Test.ll b/test/Transforms/InstCombine/2006-12-15-Range-Test.ll
index 0c8eeceec81c8..784b3e4fe6875 100644
--- a/test/Transforms/InstCombine/2006-12-15-Range-Test.ll
+++ b/test/Transforms/InstCombine/2006-12-15-Range-Test.ll
@@ -21,8 +21,8 @@ cond_next23.exitStub: ; preds = %cond_true
ret i1 false
cond_true: ; preds = %newFuncRoot
- %tmp15 = getelementptr [17 x i32]* @r, i32 0, i32 %tmp12.reload ; <i32*> [#uses=1]
- %tmp16 = load i32* %tmp15 ; <i32> [#uses=4]
+ %tmp15 = getelementptr [17 x i32], [17 x i32]* @r, i32 0, i32 %tmp12.reload ; <i32*> [#uses=1]
+ %tmp16 = load i32, i32* %tmp15 ; <i32> [#uses=4]
%tmp18 = icmp slt i32 %tmp16, -31 ; <i1> [#uses=1]
%tmp21 = icmp sgt i32 %tmp16, 31 ; <i1> [#uses=1]
%bothcond = or i1 %tmp18, %tmp21 ; <i1> [#uses=1]
diff --git a/test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll b/test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll
index eba1ac1298ce4..9251e9b455d6f 100644
--- a/test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll
+++ b/test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll
@@ -14,9 +14,9 @@ target triple = "i686-pc-linux-gnu"
define void @mng_write_basi() {
entry:
- %tmp = load i8* null ; <i8> [#uses=1]
+ %tmp = load i8, i8* null ; <i8> [#uses=1]
%tmp.upgrd.1 = icmp ugt i8 %tmp, 8 ; <i1> [#uses=1]
- %tmp.upgrd.2 = load i16* null ; <i16> [#uses=2]
+ %tmp.upgrd.2 = load i16, i16* null ; <i16> [#uses=2]
%tmp3 = icmp eq i16 %tmp.upgrd.2, 255 ; <i1> [#uses=1]
%tmp7 = icmp eq i16 %tmp.upgrd.2, -1 ; <i1> [#uses=1]
%bOpaque.0.in = select i1 %tmp.upgrd.1, i1 %tmp7, i1 %tmp3 ; <i1> [#uses=1]
diff --git a/test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll b/test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll
index e2bebecded528..113ada3df9d93 100644
--- a/test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll
+++ b/test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll
@@ -10,33 +10,33 @@ define i32 @test2(i32 %C) {
entry:
%A = alloca i32
%B = alloca i32
- %tmp = call i32 (...)* @bar( i32* %A ) ; <i32> [#uses=0]
- %T = load i32* %A ; <i32> [#uses=1]
+ %tmp = call i32 (...) @bar( i32* %A ) ; <i32> [#uses=0]
+ %T = load i32, i32* %A ; <i32> [#uses=1]
%tmp2 = icmp eq i32 %C, 0 ; <i1> [#uses=1]
br i1 %tmp2, label %cond_next, label %cond_true
cond_true: ; preds = %entry
store i32 123, i32* %B
call i32 @test2( i32 123 ) ; <i32>:0 [#uses=0]
- %T1 = load i32* %B ; <i32> [#uses=1]
+ %T1 = load i32, i32* %B ; <i32> [#uses=1]
br label %cond_next
cond_next: ; preds = %cond_true, %entry
%tmp1.0 = phi i32 [ %T1, %cond_true ], [ %T, %entry ] ; <i32> [#uses=1]
- %tmp7 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
- %tmp8 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
- %tmp9 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
- %tmp10 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
- %tmp11 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
- %tmp12 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
- %tmp13 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
- %tmp14 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
- %tmp15 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
- %tmp16 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
- %tmp17 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
- %tmp18 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
- %tmp19 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
- %tmp20 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
+ %tmp7 = call i32 (...) @baq( ) ; <i32> [#uses=0]
+ %tmp8 = call i32 (...) @baq( ) ; <i32> [#uses=0]
+ %tmp9 = call i32 (...) @baq( ) ; <i32> [#uses=0]
+ %tmp10 = call i32 (...) @baq( ) ; <i32> [#uses=0]
+ %tmp11 = call i32 (...) @baq( ) ; <i32> [#uses=0]
+ %tmp12 = call i32 (...) @baq( ) ; <i32> [#uses=0]
+ %tmp13 = call i32 (...) @baq( ) ; <i32> [#uses=0]
+ %tmp14 = call i32 (...) @baq( ) ; <i32> [#uses=0]
+ %tmp15 = call i32 (...) @baq( ) ; <i32> [#uses=0]
+ %tmp16 = call i32 (...) @baq( ) ; <i32> [#uses=0]
+ %tmp17 = call i32 (...) @baq( ) ; <i32> [#uses=0]
+ %tmp18 = call i32 (...) @baq( ) ; <i32> [#uses=0]
+ %tmp19 = call i32 (...) @baq( ) ; <i32> [#uses=0]
+ %tmp20 = call i32 (...) @baq( ) ; <i32> [#uses=0]
ret i32 %tmp1.0
}
diff --git a/test/Transforms/InstCombine/2007-02-07-PointerCast.ll b/test/Transforms/InstCombine/2007-02-07-PointerCast.ll
index bf60991f7dd94..ddc1e03ddd20f 100644
--- a/test/Transforms/InstCombine/2007-02-07-PointerCast.ll
+++ b/test/Transforms/InstCombine/2007-02-07-PointerCast.ll
@@ -12,11 +12,11 @@ declare i32 @printf(i8*, ...)
define i32 @main(i32 %x, i8** %a) {
entry:
- %tmp = getelementptr [6 x i8]* @str, i32 0, i64 0 ; <i8*> [#uses=1]
- %tmp1 = load i8** %a ; <i8*> [#uses=1]
+ %tmp = getelementptr [6 x i8], [6 x i8]* @str, i32 0, i64 0 ; <i8*> [#uses=1]
+ %tmp1 = load i8*, i8** %a ; <i8*> [#uses=1]
%tmp2 = ptrtoint i8* %tmp1 to i32 ; <i32> [#uses=1]
%tmp3 = zext i32 %tmp2 to i64 ; <i64> [#uses=1]
- %tmp.upgrd.1 = call i32 (i8*, ...)* @printf( i8* %tmp, i64 %tmp3 ) ; <i32> [#uses=0]
+ %tmp.upgrd.1 = call i32 (i8*, ...) @printf( i8* %tmp, i64 %tmp3 ) ; <i32> [#uses=0]
ret i32 0
}
diff --git a/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll b/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll
index 7e9c9e28c94bd..adaaf784ab6cc 100644
--- a/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll
+++ b/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll
@@ -7,12 +7,12 @@
define i32 @main() {
entry:
%u = alloca %struct..1anon, align 8 ; <%struct..1anon*> [#uses=4]
- %tmp1 = getelementptr %struct..1anon* %u, i32 0, i32 0 ; <double*> [#uses=1]
+ %tmp1 = getelementptr %struct..1anon, %struct..1anon* %u, i32 0, i32 0 ; <double*> [#uses=1]
store double 0x7FF0000000000000, double* %tmp1
- %tmp3 = getelementptr %struct..1anon* %u, i32 0, i32 0 ; <double*> [#uses=1]
+ %tmp3 = getelementptr %struct..1anon, %struct..1anon* %u, i32 0, i32 0 ; <double*> [#uses=1]
%tmp34 = bitcast double* %tmp3 to %struct..0anon* ; <%struct..0anon*> [#uses=1]
- %tmp5 = getelementptr %struct..0anon* %tmp34, i32 0, i32 1 ; <i32*> [#uses=1]
- %tmp6 = load i32* %tmp5 ; <i32> [#uses=1]
+ %tmp5 = getelementptr %struct..0anon, %struct..0anon* %tmp34, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp6 = load i32, i32* %tmp5 ; <i32> [#uses=1]
%tmp7 = shl i32 %tmp6, 1 ; <i32> [#uses=1]
%tmp8 = lshr i32 %tmp7, 21 ; <i32> [#uses=1]
%tmp89 = trunc i32 %tmp8 to i16 ; <i16> [#uses=1]
diff --git a/test/Transforms/InstCombine/2007-05-14-Crash.ll b/test/Transforms/InstCombine/2007-05-14-Crash.ll
index a3c010d2c4273..a3d2165914396 100644
--- a/test/Transforms/InstCombine/2007-05-14-Crash.ll
+++ b/test/Transforms/InstCombine/2007-05-14-Crash.ll
@@ -10,7 +10,7 @@ target triple = "powerpc-apple-darwin8.8.0"
define i8* @foo(%struct.anon* %deviceRef, %struct.abc* %pCap) {
entry:
%tmp1 = bitcast %struct.anon* %deviceRef to %struct.def*
- %tmp3 = getelementptr %struct.def* %tmp1, i32 0, i32 1
+ %tmp3 = getelementptr %struct.def, %struct.def* %tmp1, i32 0, i32 1
%tmp35 = bitcast %struct.abc* %tmp3 to i8*
ret i8* %tmp35
}
diff --git a/test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll b/test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll
index 082b2155a010f..2b89a9d721fba 100644
--- a/test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll
+++ b/test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll
@@ -9,13 +9,13 @@ return.exitStub: ; preds = %cond_true
ret void
cond_true: ; preds = %newFuncRoot
- %tmp30 = load i64* %tmp10 ; <i64> [#uses=1]
+ %tmp30 = load i64, i64* %tmp10 ; <i64> [#uses=1]
%.cast = zext i32 63 to i64 ; <i64> [#uses=1]
%tmp31 = ashr i64 %tmp30, %.cast ; <i64> [#uses=1]
%tmp3132 = trunc i64 %tmp31 to i32 ; <i32> [#uses=1]
%tmp33 = or i32 %tmp3132, 1 ; <i32> [#uses=1]
store i32 %tmp33, i32* %tmp9
- %tmp34 = load i32* %tmp9 ; <i32> [#uses=1]
+ %tmp34 = load i32, i32* %tmp9 ; <i32> [#uses=1]
store i32 %tmp34, i32* %retval
br label %return.exitStub
}
diff --git a/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll b/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll
index 625989384d701..7f06f009515f6 100644
--- a/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll
+++ b/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll
@@ -9,7 +9,7 @@ define weak i32 @pthread_cancel(i32) {
define i1 @__gthread_active_p() {
entry:
- %tmp1 = load i8** @__gthread_active_ptr.5335, align 4 ; <i8*> [#uses=1]
+ %tmp1 = load i8*, i8** @__gthread_active_ptr.5335, align 4 ; <i8*> [#uses=1]
%tmp2 = icmp ne i8* %tmp1, null ; <i1> [#uses=1]
ret i1 %tmp2
}
diff --git a/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll b/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll
index 656fb34061d99..67a94e5c8ccd1 100644
--- a/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll
+++ b/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll
@@ -8,8 +8,8 @@ define void @foo(i8* %P) {
entry:
%P_addr = alloca i8*
store i8* %P, i8** %P_addr
- %tmp = load i8** %P_addr, align 4
- %tmp1 = getelementptr [4 x i8]* @.str, i32 0, i32 0
+ %tmp = load i8*, i8** %P_addr, align 4
+ %tmp1 = getelementptr [4 x i8], [4 x i8]* @.str, i32 0, i32 0
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp, i8* %tmp1, i32 4, i32 1, i1 false)
br label %return
diff --git a/test/Transforms/InstCombine/2007-10-12-Crash.ll b/test/Transforms/InstCombine/2007-10-12-Crash.ll
index b3d9f02b68aa9..33d55e7e9e022 100644
--- a/test/Transforms/InstCombine/2007-10-12-Crash.ll
+++ b/test/Transforms/InstCombine/2007-10-12-Crash.ll
@@ -14,7 +14,7 @@ entry:
bb29: ; preds = %bb62
%tmp322 = bitcast %struct.Ray* %tmp3 to %struct.Vec* ; <%struct.Vec*> [#uses=1]
- %tmp322.0 = getelementptr %struct.Vec* %tmp322, i32 0, i32 0 ; <double*> [#uses=1]
+ %tmp322.0 = getelementptr %struct.Vec, %struct.Vec* %tmp322, i32 0, i32 0 ; <double*> [#uses=1]
store double 0.000000e+00, double* %tmp322.0
%tmp57 = call double @_Z9ray_traceRK3VecRK3RayRK5Scene( %struct.Vec* null, %struct.Ray* %tmp3, %struct.Scene* null ) ; <double> [#uses=0]
br label %bb62
diff --git a/test/Transforms/InstCombine/2007-10-28-stacksave.ll b/test/Transforms/InstCombine/2007-10-28-stacksave.ll
index 95a445c543570..48e876510a9de 100644
--- a/test/Transforms/InstCombine/2007-10-28-stacksave.ll
+++ b/test/Transforms/InstCombine/2007-10-28-stacksave.ll
@@ -23,7 +23,7 @@ lab: ; preds = %cleanup31, %entry
%tmp17 = mul i32 %tmp5, 4 ; <i32> [#uses=1]
%tmp18 = alloca i8, i32 %tmp17 ; <i8*> [#uses=1]
%tmp1819 = bitcast i8* %tmp18 to i32* ; <i32*> [#uses=2]
- %tmp21 = getelementptr i32* %tmp1819, i32 0 ; <i32*> [#uses=1]
+ %tmp21 = getelementptr i32, i32* %tmp1819, i32 0 ; <i32*> [#uses=1]
store i32 1, i32* %tmp21, align 4
%tmp2223 = bitcast i32* %tmp1819 to i8* ; <i8*> [#uses=1]
store volatile i8* %tmp2223, i8** @p, align 4
diff --git a/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll b/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll
index 8105b4ba5579a..8c2cb07af224c 100644
--- a/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll
+++ b/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll
@@ -11,7 +11,7 @@ bb.i: ; preds = %entry
br label %bb51.i.i
bb27.i.i: ; preds = %bb51.i.i
- %tmp31.i.i = load i16* null, align 2 ; <i16> [#uses=2]
+ %tmp31.i.i = load i16, i16* null, align 2 ; <i16> [#uses=2]
%tmp35.i.i = icmp ult i16 %tmp31.i.i, 1 ; <i1> [#uses=1]
%tmp41.i.i = icmp ugt i16 %tmp31.i.i, -1 ; <i1> [#uses=1]
%bothcond.i.i = or i1 %tmp35.i.i, %tmp41.i.i ; <i1> [#uses=1]
diff --git a/test/Transforms/InstCombine/2007-10-31-StringCrash.ll b/test/Transforms/InstCombine/2007-10-31-StringCrash.ll
index 220f3e22b9912..876cdd53f524e 100644
--- a/test/Transforms/InstCombine/2007-10-31-StringCrash.ll
+++ b/test/Transforms/InstCombine/2007-10-31-StringCrash.ll
@@ -7,7 +7,7 @@ declare void @__darwin_gcc3_preregister_frame_info()
define void @_start(i32 %argc, i8** %argv, i8** %envp) {
entry:
%tmp1 = bitcast void ()* @__darwin_gcc3_preregister_frame_info to i32* ; <i32*> [#uses=1]
- %tmp2 = load i32* %tmp1, align 4 ; <i32> [#uses=1]
+ %tmp2 = load i32, i32* %tmp1, align 4 ; <i32> [#uses=1]
%tmp3 = icmp ne i32 %tmp2, 0 ; <i1> [#uses=1]
%tmp34 = zext i1 %tmp3 to i8 ; <i8> [#uses=1]
%toBool = icmp ne i8 %tmp34, 0 ; <i1> [#uses=1]
diff --git a/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll b/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll
index e6c9bcd01e5c6..ff3107297a128 100644
--- a/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll
+++ b/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll
@@ -13,8 +13,8 @@ target triple = "i686-pc-linux-gnu"
define i32 @foo() {
entry:
- %x = load i8* bitcast (%opaque_t* @g to i8*)
- %y = load i32* bitcast (%op_ts* @h to i32*)
+ %x = load i8, i8* bitcast (%opaque_t* @g to i8*)
+ %y = load i32, i32* bitcast (%op_ts* @h to i32*)
%z = zext i8 %x to i32
%r = add i32 %y, %z
ret i32 %r
diff --git a/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll b/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll
index e3192a990ba08..1232005a5610b 100644
--- a/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll
+++ b/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll
@@ -5,7 +5,7 @@
define i32 @main(i32 %argc, i8** %argv) {
entry:
- %tmp32 = tail call i32 (i8* , ...) * bitcast (i32 (i8*, ...) * @printf to i32 (i8* , ...) *)( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0) , i32 0 ) nounwind ; <i32> [#uses=0]
+ %tmp32 = tail call i32 (i8* , ...) bitcast (i32 (i8*, ...) * @printf to i32 (i8* , ...) *)( i8* getelementptr ([4 x i8], [4 x i8]* @.str, i32 0, i32 0) , i32 0 ) nounwind ; <i32> [#uses=0]
ret i32 undef
}
diff --git a/test/Transforms/InstCombine/2007-12-12-GEPScale.ll b/test/Transforms/InstCombine/2007-12-12-GEPScale.ll
index cea87f2a4666c..60f715e2ef7df 100644
--- a/test/Transforms/InstCombine/2007-12-12-GEPScale.ll
+++ b/test/Transforms/InstCombine/2007-12-12-GEPScale.ll
@@ -5,6 +5,6 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
define i8* @foo([100 x {i8,i8,i8}]* %x) {
entry:
%p = bitcast [100 x {i8,i8,i8}]* %x to i8*
- %q = getelementptr i8* %p, i32 -4
+ %q = getelementptr i8, i8* %p, i32 -4
ret i8* %q
}
diff --git a/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll b/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll
index 8721c83521bfc..7260c001b0db6 100644
--- a/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll
+++ b/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll
@@ -4,7 +4,7 @@ define i32 @test1() {
entry:
%z = alloca i32
store i32 0, i32* %z
- %tmp = load i32* %z
+ %tmp = load i32, i32* %z
%sub = sub i32 %tmp, 1
%cmp = icmp ule i32 %sub, 0
%retval = select i1 %cmp, i32 0, i32 1
@@ -15,7 +15,7 @@ define i32 @test2() {
entry:
%z = alloca i32
store i32 0, i32* %z
- %tmp = load i32* %z
+ %tmp = load i32, i32* %z
%sub = sub i32 %tmp, 1
%cmp = icmp ugt i32 %sub, 0
%retval = select i1 %cmp, i32 1, i32 0
@@ -26,7 +26,7 @@ define i32 @test3() {
entry:
%z = alloca i32
store i32 0, i32* %z
- %tmp = load i32* %z
+ %tmp = load i32, i32* %z
%sub = sub i32 %tmp, 1
%cmp = icmp slt i32 %sub, 0
%retval = select i1 %cmp, i32 1, i32 0
@@ -37,7 +37,7 @@ define i32 @test4() {
entry:
%z = alloca i32
store i32 0, i32* %z
- %tmp = load i32* %z
+ %tmp = load i32, i32* %z
%sub = sub i32 %tmp, 1
%cmp = icmp sle i32 %sub, 0
%retval = select i1 %cmp, i32 1, i32 0
@@ -48,7 +48,7 @@ define i32 @test5() {
entry:
%z = alloca i32
store i32 0, i32* %z
- %tmp = load i32* %z
+ %tmp = load i32, i32* %z
%sub = sub i32 %tmp, 1
%cmp = icmp sge i32 %sub, 0
%retval = select i1 %cmp, i32 0, i32 1
@@ -59,7 +59,7 @@ define i32 @test6() {
entry:
%z = alloca i32
store i32 0, i32* %z
- %tmp = load i32* %z
+ %tmp = load i32, i32* %z
%sub = sub i32 %tmp, 1
%cmp = icmp sgt i32 %sub, 0
%retval = select i1 %cmp, i32 0, i32 1
@@ -70,7 +70,7 @@ define i32 @test7() {
entry:
%z = alloca i32
store i32 0, i32* %z
- %tmp = load i32* %z
+ %tmp = load i32, i32* %z
%sub = sub i32 %tmp, 1
%cmp = icmp eq i32 %sub, 0
%retval = select i1 %cmp, i32 0, i32 1
@@ -81,7 +81,7 @@ define i32 @test8() {
entry:
%z = alloca i32
store i32 0, i32* %z
- %tmp = load i32* %z
+ %tmp = load i32, i32* %z
%sub = sub i32 %tmp, 1
%cmp = icmp ne i32 %sub, 0
%retval = select i1 %cmp, i32 1, i32 0
diff --git a/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll b/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll
index aacea9df5b31e..b111b85d59f0a 100644
--- a/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll
+++ b/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll
@@ -12,15 +12,15 @@ define i32 @nest(i32 %n) {
entry:
%FRAME.0 = alloca %struct.FRAME.nest, align 8 ; <%struct.FRAME.nest*> [#uses=3]
%TRAMP.216 = alloca [10 x i8], align 16 ; <[10 x i8]*> [#uses=1]
- %TRAMP.216.sub = getelementptr [10 x i8]* %TRAMP.216, i32 0, i32 0 ; <i8*> [#uses=1]
- %tmp3 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 0 ; <i32*> [#uses=1]
+ %TRAMP.216.sub = getelementptr [10 x i8], [10 x i8]* %TRAMP.216, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp3 = getelementptr %struct.FRAME.nest, %struct.FRAME.nest* %FRAME.0, i32 0, i32 0 ; <i32*> [#uses=1]
store i32 %n, i32* %tmp3, align 8
%FRAME.06 = bitcast %struct.FRAME.nest* %FRAME.0 to i8* ; <i8*> [#uses=1]
call void @llvm.init.trampoline( i8* %TRAMP.216.sub, i8* bitcast (i32 (%struct.FRAME.nest*, ...)* @f to i8*), i8* %FRAME.06 ) ; <i8*> [#uses=1]
%tramp = call i8* @llvm.adjust.trampoline( i8* %TRAMP.216.sub)
- %tmp7 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 1 ; <i32 (...)**> [#uses=1]
+ %tmp7 = getelementptr %struct.FRAME.nest, %struct.FRAME.nest* %FRAME.0, i32 0, i32 1 ; <i32 (...)**> [#uses=1]
%tmp89 = bitcast i8* %tramp to i32 (...)* ; <i32 (...)*> [#uses=2]
store i32 (...)* %tmp89, i32 (...)** %tmp7, align 8
- %tmp2.i = call i32 (...)* %tmp89( i32 zeroext 0 ) ; <i32> [#uses=1]
+ %tmp2.i = call i32 (...) %tmp89( i32 zeroext 0 ) ; <i32> [#uses=1]
ret i32 %tmp2.i
}
diff --git a/test/Transforms/InstCombine/2008-03-13-IntToPtr.ll b/test/Transforms/InstCombine/2008-03-13-IntToPtr.ll
index 0fa4d715f2893..d086f4b63b712 100644
--- a/test/Transforms/InstCombine/2008-03-13-IntToPtr.ll
+++ b/test/Transforms/InstCombine/2008-03-13-IntToPtr.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -instcombine -S | grep "16" | count 1
define i8* @bork(i8** %qux) {
- %tmp275 = load i8** %qux, align 1
+ %tmp275 = load i8*, i8** %qux, align 1
%tmp275276 = ptrtoint i8* %tmp275 to i32
%tmp277 = add i32 %tmp275276, 16
%tmp277278 = inttoptr i32 %tmp277 to i8*
diff --git a/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll b/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll
index aa38065a71499..1ea0998bf70e7 100644
--- a/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll
+++ b/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll
@@ -8,7 +8,7 @@ target triple = "i386-apple-darwin9"
define void @foo(i8* %context) nounwind {
entry:
%tmp1 = bitcast i8* %context to %struct.NSRect* ; <%struct.NSRect*> [#uses=1]
- call void (i32, ...)* @bar( i32 3, %struct.NSRect* byval align 4 %tmp1 ) nounwind
+ call void (i32, ...) @bar( i32 3, %struct.NSRect* byval align 4 %tmp1 ) nounwind
ret void
}
diff --git a/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll b/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll
index fd0217e9f4d72..af662bda1e6e9 100644
--- a/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll
+++ b/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll
@@ -6,7 +6,7 @@ target triple = "i386-apple-darwin8"
define i32 @main() nounwind {
entry:
%tmp93 = icmp slt i32 0, 10 ; <i1> [#uses=0]
- %tmp34 = load volatile i32* @g_1, align 4 ; <i32> [#uses=1]
+ %tmp34 = load volatile i32, i32* @g_1, align 4 ; <i32> [#uses=1]
br label %bb
bb: ; preds = %bb, %entry
@@ -16,7 +16,7 @@ bb: ; preds = %bb, %entry
store volatile i32 %tmp4, i32* @g_1, align 4
%tmp6 = add i32 %b.0.reg2mem.0, 1 ; <i32> [#uses=2]
%tmp9 = icmp slt i32 %tmp6, 10 ; <i1> [#uses=1]
- %tmp3 = load volatile i32* @g_1, align 4 ; <i32> [#uses=1]
+ %tmp3 = load volatile i32, i32* @g_1, align 4 ; <i32> [#uses=1]
br i1 %tmp9, label %bb, label %bb11
bb11: ; preds = %bb
diff --git a/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll b/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll
index 8022414d6fc9d..3c67e513bcc1a 100644
--- a/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll
+++ b/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll
@@ -7,11 +7,11 @@ target triple = "i386-apple-darwin8"
define i32 @main(i32 %i) nounwind {
entry:
%tmp93 = icmp slt i32 %i, 10 ; <i1> [#uses=0]
- %tmp34 = load volatile i32* @g_1, align 4 ; <i32> [#uses=1]
+ %tmp34 = load volatile i32, i32* @g_1, align 4 ; <i32> [#uses=1]
br i1 %tmp93, label %bb11, label %bb
bb: ; preds = %bb, %entry
- %tmp3 = load volatile i32* @g_1, align 4 ; <i32> [#uses=1]
+ %tmp3 = load volatile i32, i32* @g_1, align 4 ; <i32> [#uses=1]
br label %bb11
bb11: ; preds = %bb
diff --git a/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll b/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll
index 7a1c844741536..907382093d116 100644
--- a/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll
+++ b/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll
@@ -7,14 +7,14 @@ define i32 @a() nounwind {
entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
%tmp1 = call i8* @malloc( i32 10 ) nounwind ; <i8*> [#uses=5]
- %tmp3 = getelementptr i8* %tmp1, i32 1 ; <i8*> [#uses=1]
+ %tmp3 = getelementptr i8, i8* %tmp1, i32 1 ; <i8*> [#uses=1]
store i8 0, i8* %tmp3, align 1
- %tmp5 = getelementptr i8* %tmp1, i32 0 ; <i8*> [#uses=1]
+ %tmp5 = getelementptr i8, i8* %tmp1, i32 0 ; <i8*> [#uses=1]
store i8 1, i8* %tmp5, align 1
%tmp7 = call i32 @strlen( i8* %tmp1 ) nounwind readonly ; <i32> [#uses=1]
- %tmp9 = getelementptr i8* %tmp1, i32 0 ; <i8*> [#uses=1]
+ %tmp9 = getelementptr i8, i8* %tmp1, i32 0 ; <i8*> [#uses=1]
store i8 0, i8* %tmp9, align 1
- %tmp11 = call i32 (...)* @b( i8* %tmp1 ) nounwind ; <i32> [#uses=0]
+ %tmp11 = call i32 (...) @b( i8* %tmp1 ) nounwind ; <i32> [#uses=0]
ret i32 %tmp7
}
diff --git a/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll b/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll
index d266164fd8707..ce1923338c6bb 100644
--- a/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll
+++ b/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll
@@ -7,18 +7,18 @@ define i32 @a() nounwind {
entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
%tmp1 = call i8* @malloc( i32 10 ) nounwind ; <i8*> [#uses=5]
- %tmp3 = getelementptr i8* %tmp1, i32 1 ; <i8*> [#uses=1]
+ %tmp3 = getelementptr i8, i8* %tmp1, i32 1 ; <i8*> [#uses=1]
store i8 0, i8* %tmp3, align 1
- %tmp5 = getelementptr i8* %tmp1, i32 0 ; <i8*> [#uses=1]
+ %tmp5 = getelementptr i8, i8* %tmp1, i32 0 ; <i8*> [#uses=1]
store i8 1, i8* %tmp5, align 1
; CHECK: store
; CHECK: store
; CHECK-NEXT: strlen
; CHECK-NEXT: store
%tmp7 = call i32 @strlen( i8* %tmp1 ) nounwind readonly ; <i32> [#uses=1]
- %tmp9 = getelementptr i8* %tmp1, i32 0 ; <i8*> [#uses=1]
+ %tmp9 = getelementptr i8, i8* %tmp1, i32 0 ; <i8*> [#uses=1]
store i8 0, i8* %tmp9, align 1
- %tmp11 = call i32 (...)* @b( i8* %tmp1 ) nounwind ; <i32> [#uses=0]
+ %tmp11 = call i32 (...) @b( i8* %tmp1 ) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
diff --git a/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll b/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll
index f6eb24843fb88..722f8f0fabbdb 100644
--- a/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll
+++ b/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll
@@ -23,8 +23,8 @@ invcont31: ; preds = %invcont
to label %invcont37 unwind label %lpad ; <i32**> [#uses=1]
invcont37: ; preds = %invcont31
- %tmp39 = load i32** %tmp38, align 8 ; <i32*> [#uses=1]
- %tmp41 = getelementptr %"struct.std::ctype<char>"* %this, i32 0, i32 4 ; <i32**> [#uses=1]
+ %tmp39 = load i32*, i32** %tmp38, align 8 ; <i32*> [#uses=1]
+ %tmp41 = getelementptr %"struct.std::ctype<char>", %"struct.std::ctype<char>"* %this, i32 0, i32 4 ; <i32**> [#uses=1]
store i32* %tmp39, i32** %tmp41, align 8
ret void
diff --git a/test/Transforms/InstCombine/2008-05-17-InfLoop.ll b/test/Transforms/InstCombine/2008-05-17-InfLoop.ll
index 2939a48216547..af0f2a45e7ec3 100644
--- a/test/Transforms/InstCombine/2008-05-17-InfLoop.ll
+++ b/test/Transforms/InstCombine/2008-05-17-InfLoop.ll
@@ -10,11 +10,11 @@ entry:
%blockSize100k = alloca i32 ; <i32*> [#uses=2]
store i32 %0, i32* %blockSize100k
%n = alloca i32 ; <i32*> [#uses=2]
- load i32* %blockSize100k ; <i32>:1 [#uses=1]
+ load i32, i32* %blockSize100k ; <i32>:1 [#uses=1]
store i32 %1, i32* %n
- load i32* %n ; <i32>:2 [#uses=1]
+ load i32, i32* %n ; <i32>:2 [#uses=1]
add i32 %2, 2 ; <i32>:3 [#uses=1]
- mul i32 %3, ptrtoint (i32* getelementptr (i32* null, i32 1) to i32) ; <i32>:4 [#uses=1]
+ mul i32 %3, ptrtoint (i32* getelementptr (i32, i32* null, i32 1) to i32) ; <i32>:4 [#uses=1]
call void @BZALLOC( i32 %4 )
br label %return
diff --git a/test/Transforms/InstCombine/2008-05-23-CompareFold.ll b/test/Transforms/InstCombine/2008-05-23-CompareFold.ll
index b729677675589..b10aac96599f9 100644
--- a/test/Transforms/InstCombine/2008-05-23-CompareFold.ll
+++ b/test/Transforms/InstCombine/2008-05-23-CompareFold.ll
@@ -5,7 +5,7 @@
; CHECK: ret i1 false
define i1 @f(i8* %x) {
entry:
- %tmp462 = load i8* %x, align 1 ; <i8> [#uses=1]
+ %tmp462 = load i8, i8* %x, align 1 ; <i8> [#uses=1]
%tmp462463 = sitofp i8 %tmp462 to float ; <float> [#uses=1]
%tmp464 = fcmp ugt float %tmp462463, 0x47EFFFFFE0000000 ; <i1>
ret i1 %tmp464
diff --git a/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll b/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll
index ec946238d8976..7e8341b99f783 100644
--- a/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll
+++ b/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll
@@ -7,28 +7,28 @@ entry:
bb: ; preds = %bb16, %entry
%i.0 = phi i32 [ 0, %entry ], [ %indvar.next, %somebb ] ; <i32> [#uses=1]
%x.0 = phi i32 [ 37, %entry ], [ %tmp17, %somebb ] ; <i32> [#uses=1]
- %tmp = tail call i32 (...)* @bork( ) nounwind ; <i32> [#uses=0]
- %tmp1 = tail call i32 (...)* @bork( ) nounwind ; <i32> [#uses=0]
- %tmp2 = tail call i32 (...)* @bork( ) nounwind ; <i32> [#uses=1]
+ %tmp = tail call i32 (...) @bork( ) nounwind ; <i32> [#uses=0]
+ %tmp1 = tail call i32 (...) @bork( ) nounwind ; <i32> [#uses=0]
+ %tmp2 = tail call i32 (...) @bork( ) nounwind ; <i32> [#uses=1]
%tmp3 = icmp eq i32 %tmp2, 0 ; <i1> [#uses=1]
br i1 %tmp3, label %bb7, label %bb5
bb5: ; preds = %bb
- %tmp6 = tail call i32 (...)* @bork( ) nounwind ; <i32> [#uses=0]
+ %tmp6 = tail call i32 (...) @bork( ) nounwind ; <i32> [#uses=0]
br label %bb7
bb7: ; preds = %bb5, %bb
- %tmp8 = tail call i32 (...)* @bork( ) nounwind ; <i32> [#uses=0]
- %tmp9 = tail call i32 (...)* @bork( ) nounwind ; <i32> [#uses=0]
+ %tmp8 = tail call i32 (...) @bork( ) nounwind ; <i32> [#uses=0]
+ %tmp9 = tail call i32 (...) @bork( ) nounwind ; <i32> [#uses=0]
%tmp11 = icmp eq i32 %x.0, 37 ; <i1> [#uses=1]
br i1 %tmp11, label %bb14, label %bb16
bb14: ; preds = %bb7
- %tmp15 = tail call i32 (...)* @bar( ) nounwind ; <i32> [#uses=0]
+ %tmp15 = tail call i32 (...) @bar( ) nounwind ; <i32> [#uses=0]
br label %bb16
bb16: ; preds = %bb14, %bb7
- %tmp17 = tail call i32 (...)* @zap( ) nounwind ; <i32> [#uses=1]
+ %tmp17 = tail call i32 (...) @zap( ) nounwind ; <i32> [#uses=1]
%indvar.next = add i32 %i.0, 1 ; <i32> [#uses=2]
%exitcond = icmp eq i32 %indvar.next, 42 ; <i1> [#uses=1]
br i1 %exitcond, label %return, label %somebb
diff --git a/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll b/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll
index 05f1c52000814..c3aab464b87ed 100644
--- a/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll
+++ b/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll
@@ -4,13 +4,13 @@
declare i32 @x(i32*)
define i32 @b(i32* %a, i32* %b) {
entry:
- %tmp1 = load i32* %a
- %tmp3 = load i32* %b
+ %tmp1 = load i32, i32* %a
+ %tmp3 = load i32, i32* %b
%add = add i32 %tmp1, %tmp3
%call = call i32 @x( i32* %a )
%tobool = icmp ne i32 %add, 0
; not safe to turn into an uncond load
%cond = select i1 %tobool, i32* %b, i32* %a
- %tmp8 = load i32* %cond
+ %tmp8 = load i32, i32* %cond
ret i32 %tmp8
}
diff --git a/test/Transforms/InstCombine/2008-06-24-StackRestore.ll b/test/Transforms/InstCombine/2008-06-24-StackRestore.ll
index 9c4c1b538c4b3..f963b009671b1 100644
--- a/test/Transforms/InstCombine/2008-06-24-StackRestore.ll
+++ b/test/Transforms/InstCombine/2008-06-24-StackRestore.ll
@@ -27,7 +27,7 @@ bb44: ; preds = %bb44, %entry
%tmp27 = alloca i32, i32 %tmp5 ; <i32*> [#uses=3]
%tmpcast = bitcast i32* %tmp27 to i8* ; <i8*> [#uses=1]
store i32 1, i32* %tmp27, align 4
- %tmp34 = getelementptr i32* %tmp27, i32 %tmp4 ; <i32*> [#uses=1]
+ %tmp34 = getelementptr i32, i32* %tmp27, i32 %tmp4 ; <i32*> [#uses=1]
store i32 2, i32* %tmp34, align 4
store volatile i8* %tmpcast, i8** @p, align 4
%exitcond = icmp eq i32 %tmp3857, 999999 ; <i1> [#uses=1]
diff --git a/test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll b/test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll
index dcf4befa86056..17ec9cd1d82bf 100644
--- a/test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll
+++ b/test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll
@@ -7,7 +7,7 @@ target triple = "i386-apple-darwin8"
define i32 @main() nounwind {
entry:
%tmp93 = icmp slt i32 0, 10 ; <i1> [#uses=0]
- %tmp34 = load volatile i32* @g_1, align 4 ; <i32> [#uses=1]
+ %tmp34 = load volatile i32, i32* @g_1, align 4 ; <i32> [#uses=1]
br label %bb
bb: ; preds = %bb, %entry
@@ -17,7 +17,7 @@ bb: ; preds = %bb, %entry
store volatile i32 %tmp4, i32* @g_1, align 4
%tmp6 = add i32 %b.0.reg2mem.0, 1 ; <i32> [#uses=2]
%tmp9 = icmp slt i32 %tmp6, 10 ; <i1> [#uses=1]
- %tmp3 = load volatile i32* @g_1, align 4 ; <i32> [#uses=1]
+ %tmp3 = load volatile i32, i32* @g_1, align 4 ; <i32> [#uses=1]
br i1 %tmp9, label %bb, label %bb11
bb11: ; preds = %bb
diff --git a/test/Transforms/InstCombine/2008-08-05-And.ll b/test/Transforms/InstCombine/2008-08-05-And.ll
index 9773c2d76249f..91f1c0b0a986b 100644
--- a/test/Transforms/InstCombine/2008-08-05-And.ll
+++ b/test/Transforms/InstCombine/2008-08-05-And.ll
@@ -6,8 +6,8 @@ entry:
br label %bb
bb:
- %g1 = getelementptr i8* %x, i32 0
- %l1 = load i8* %g1, align 1
+ %g1 = getelementptr i8, i8* %x, i32 0
+ %l1 = load i8, i8* %g1, align 1
%s1 = sub i8 %l1, 6
%c1 = icmp ugt i8 %s1, 2
%s2 = sub i8 %l1, 10
diff --git a/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll b/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll
index 50ea2f42b0ca8..9994b588b21c0 100644
--- a/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll
+++ b/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll
@@ -12,16 +12,16 @@ entry:
%iospec = alloca %struct.Key ; <%struct.Key*> [#uses=3]
%ret = alloca i32 ; <i32*> [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
- %0 = getelementptr %struct.Key* %iospec, i32 0, i32 0 ; <{ i32, i32 }*> [#uses=2]
- %1 = getelementptr { i32, i32 }* %0, i32 0, i32 0 ; <i32*> [#uses=1]
+ %0 = getelementptr %struct.Key, %struct.Key* %iospec, i32 0, i32 0 ; <{ i32, i32 }*> [#uses=2]
+ %1 = getelementptr { i32, i32 }, { i32, i32 }* %0, i32 0, i32 0 ; <i32*> [#uses=1]
store i32 0, i32* %1, align 4
- %2 = getelementptr { i32, i32 }* %0, i32 0, i32 1 ; <i32*> [#uses=1]
+ %2 = getelementptr { i32, i32 }, { i32, i32 }* %0, i32 0, i32 1 ; <i32*> [#uses=1]
store i32 0, i32* %2, align 4
- %3 = getelementptr %struct.Key* %iospec, i32 0, i32 0 ; <{ i32, i32 }*> [#uses=1]
+ %3 = getelementptr %struct.Key, %struct.Key* %iospec, i32 0, i32 0 ; <{ i32, i32 }*> [#uses=1]
%4 = bitcast { i32, i32 }* %3 to i64* ; <i64*> [#uses=1]
store i64 %key_token2, i64* %4, align 4
- %5 = call i32 (...)* @foo(%struct.Key* byval align 4 %iospec, i32* %ret) nounwind ; <i32> [#uses=0]
- %6 = load i32* %ret, align 4 ; <i32> [#uses=1]
+ %5 = call i32 (...) @foo(%struct.Key* byval align 4 %iospec, i32* %ret) nounwind ; <i32> [#uses=0]
+ %6 = load i32, i32* %ret, align 4 ; <i32> [#uses=1]
ret i32 %6
}
diff --git a/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll b/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll
index 68c51b43fc3ac..b9aa0a2549722 100644
--- a/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll
+++ b/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll
@@ -15,12 +15,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 0x7FF0000000000000, float* %x, align 4
store float 0x7FF8000000000000, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
@@ -36,12 +36,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 0x7FF0000000000000, float* %x, align 4
store float 0.000000e+00, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
@@ -55,12 +55,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 0x7FF0000000000000, float* %x, align 4
store float 3.500000e+00, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
@@ -74,12 +74,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 0x7FF0000000000000, float* %x, align 4
store float 0x7FF0000000000000, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
@@ -93,12 +93,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 0x7FF8000000000000, float* %x, align 4
store float 0x7FF0000000000000, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
@@ -112,12 +112,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 0x7FF8000000000000, float* %x, align 4
store float 0.000000e+00, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
@@ -131,12 +131,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 0x7FF8000000000000, float* %x, align 4
store float 3.500000e+00, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
@@ -150,12 +150,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 0x7FF8000000000000, float* %x, align 4
store float 0x7FF8000000000000, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
@@ -169,12 +169,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 0.000000e+00, float* %x, align 4
store float 0x7FF8000000000000, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
@@ -188,12 +188,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 0.000000e+00, float* %x, align 4
store float 0x7FF0000000000000, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
@@ -207,12 +207,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 0.000000e+00, float* %x, align 4
store float 0.000000e+00, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
@@ -226,12 +226,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 0.000000e+00, float* %x, align 4
store float 3.500000e+00, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
@@ -245,12 +245,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 3.500000e+00, float* %x, align 4
store float 0x7FF8000000000000, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
@@ -264,12 +264,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 3.500000e+00, float* %x, align 4
store float 0x7FF0000000000000, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
@@ -283,12 +283,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 3.500000e+00, float* %x, align 4
store float 0.000000e+00, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
@@ -302,12 +302,12 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store float 3.500000e+00, float* %x, align 4
store float 3.500000e+00, float* %y, align 4
- %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %0 = load float, float* %y, align 4 ; <float> [#uses=1]
%1 = fpext float %0 to double ; <double> [#uses=1]
- %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %2 = load float, float* %x, align 4 ; <float> [#uses=1]
%3 = fpext float %2 to double ; <double> [#uses=1]
%4 = frem double %3, %1 ; <double> [#uses=1]
- %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
diff --git a/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll b/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll
index 6bc7ce34d1c22..5adcb6bfa0710 100644
--- a/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll
+++ b/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll
@@ -14,12 +14,12 @@ entry:
%1 = frem double 1.000000e-01, 1.000000e+00 ; <double> [#uses=1]
%2 = fptrunc double %1 to float ; <float> [#uses=1]
store float %2, float* %0, align 4
- %3 = load float* %0, align 4 ; <float> [#uses=1]
+ %3 = load float, float* %0, align 4 ; <float> [#uses=1]
store float %3, float* %retval, align 4
br label %return
return: ; preds = %entry
- %retval1 = load float* %retval ; <float> [#uses=1]
+ %retval1 = load float, float* %retval ; <float> [#uses=1]
ret float %retval1
}
@@ -31,12 +31,12 @@ entry:
%1 = frem double -1.000000e-01, 1.000000e+00 ; <double> [#uses=1]
%2 = fptrunc double %1 to float ; <float> [#uses=1]
store float %2, float* %0, align 4
- %3 = load float* %0, align 4 ; <float> [#uses=1]
+ %3 = load float, float* %0, align 4 ; <float> [#uses=1]
store float %3, float* %retval, align 4
br label %return
return: ; preds = %entry
- %retval1 = load float* %retval ; <float> [#uses=1]
+ %retval1 = load float, float* %retval ; <float> [#uses=1]
ret float %retval1
}
@@ -48,12 +48,12 @@ entry:
%1 = frem double 1.000000e-01, -1.000000e+00 ; <double> [#uses=1]
%2 = fptrunc double %1 to float ; <float> [#uses=1]
store float %2, float* %0, align 4
- %3 = load float* %0, align 4 ; <float> [#uses=1]
+ %3 = load float, float* %0, align 4 ; <float> [#uses=1]
store float %3, float* %retval, align 4
br label %return
return: ; preds = %entry
- %retval1 = load float* %retval ; <float> [#uses=1]
+ %retval1 = load float, float* %retval ; <float> [#uses=1]
ret float %retval1
}
@@ -65,11 +65,11 @@ entry:
%1 = frem double -1.000000e-01, -1.000000e+00 ; <double> [#uses=1]
%2 = fptrunc double %1 to float ; <float> [#uses=1]
store float %2, float* %0, align 4
- %3 = load float* %0, align 4 ; <float> [#uses=1]
+ %3 = load float, float* %0, align 4 ; <float> [#uses=1]
store float %3, float* %retval, align 4
br label %return
return: ; preds = %entry
- %retval1 = load float* %retval ; <float> [#uses=1]
+ %retval1 = load float, float* %retval ; <float> [#uses=1]
ret float %retval1
}
diff --git a/test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll b/test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll
index 4b64b4872918e..3f3535b363d75 100644
--- a/test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll
+++ b/test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll
@@ -11,7 +11,7 @@ target triple = "x86_64-unknown-linux-gnu"
define void @handle_event(%struct.inode* %bar) nounwind {
entry:
- %0 = getelementptr %struct.inode* %bar, i64 -1, i32 1, i32 1 ; <%struct.rwlock_t*> [#uses=1]
+ %0 = getelementptr %struct.inode, %struct.inode* %bar, i64 -1, i32 1, i32 1 ; <%struct.rwlock_t*> [#uses=1]
%1 = bitcast %struct.rwlock_t* %0 to i32* ; <i32*> [#uses=1]
store i32 1, i32* %1, align 4
ret void
diff --git a/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll b/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll
index 9146a8ee01178..0f8b38c8e9c13 100644
--- a/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll
+++ b/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll
@@ -27,53 +27,53 @@ entry:
%4 = alloca i32
%"alloca point" = bitcast i32 0 to i32
store i32 42, i32* %4, align 4
- %5 = getelementptr %"struct.std::vector<int,std::allocator<int> >"* %X, i32 0, i32 0
- %6 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >"* %5, i32 0, i32 0
- %7 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"* %6, i32 0, i32 1
- %8 = load i32** %7, align 4
- %9 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %3, i32 0, i32 0
+ %5 = getelementptr %"struct.std::vector<int,std::allocator<int> >", %"struct.std::vector<int,std::allocator<int> >"* %X, i32 0, i32 0
+ %6 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >", %"struct.std::_Vector_base<int,std::allocator<int> >"* %5, i32 0, i32 0
+ %7 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl", %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"* %6, i32 0, i32 1
+ %8 = load i32*, i32** %7, align 4
+ %9 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %3, i32 0, i32 0
store i32* %8, i32** %9, align 4
- %10 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %3, i32 0, i32 0
- %11 = load i32** %10, align 4
+ %10 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %3, i32 0, i32 0
+ %11 = load i32*, i32** %10, align 4
%tmp2.i = ptrtoint i32* %11 to i32
%tmp1.i = inttoptr i32 %tmp2.i to i32*
%tmp3 = ptrtoint i32* %tmp1.i to i32
%tmp2 = inttoptr i32 %tmp3 to i32*
- %12 = getelementptr %"struct.std::vector<int,std::allocator<int> >"* %X, i32 0, i32 0
- %13 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >"* %12, i32 0, i32 0
- %14 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"* %13, i32 0, i32 0
- %15 = load i32** %14, align 4
- %16 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %0, i32 0, i32 0
+ %12 = getelementptr %"struct.std::vector<int,std::allocator<int> >", %"struct.std::vector<int,std::allocator<int> >"* %X, i32 0, i32 0
+ %13 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >", %"struct.std::_Vector_base<int,std::allocator<int> >"* %12, i32 0, i32 0
+ %14 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl", %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"* %13, i32 0, i32 0
+ %15 = load i32*, i32** %14, align 4
+ %16 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %0, i32 0, i32 0
store i32* %15, i32** %16, align 4
- %17 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %0, i32 0, i32 0
- %18 = load i32** %17, align 4
+ %17 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %0, i32 0, i32 0
+ %18 = load i32*, i32** %17, align 4
%tmp2.i17 = ptrtoint i32* %18 to i32
%tmp1.i18 = inttoptr i32 %tmp2.i17 to i32*
%tmp8 = ptrtoint i32* %tmp1.i18 to i32
%tmp6 = inttoptr i32 %tmp8 to i32*
- %19 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i, i32 0, i32 0
+ %19 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i, i32 0, i32 0
store i32* %tmp6, i32** %19
- %20 = getelementptr %"struct.std::bidirectional_iterator_tag"* %1, i32 0, i32 0
- %21 = load i8* %20, align 1
+ %20 = getelementptr %"struct.std::bidirectional_iterator_tag", %"struct.std::bidirectional_iterator_tag"* %1, i32 0, i32 0
+ %21 = load i8, i8* %20, align 1
%22 = or i8 %21, 0
%23 = or i8 %22, 0
%24 = or i8 %23, 0
- %25 = getelementptr %"struct.std::bidirectional_iterator_tag"* %2, i32 0, i32 0
+ %25 = getelementptr %"struct.std::bidirectional_iterator_tag", %"struct.std::bidirectional_iterator_tag"* %2, i32 0, i32 0
store i8 0, i8* %25, align 1
- %elt.i = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i, i32 0, i32 0
- %val.i = load i32** %elt.i
+ %elt.i = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i, i32 0, i32 0
+ %val.i = load i32*, i32** %elt.i
%tmp.i = bitcast %"struct.std::bidirectional_iterator_tag"* %unnamed_arg.i to i8*
%tmp9.i = bitcast %"struct.std::bidirectional_iterator_tag"* %2 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp.i, i8* %tmp9.i, i64 1, i32 1, i1 false)
- %26 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %26 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
store i32* %val.i, i32** %26
- %27 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0
+ %27 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0
store i32* %tmp2, i32** %27
- %28 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0
- %29 = load i32** %28, align 4
+ %28 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0
+ %29 = load i32*, i32** %28, align 4
%30 = ptrtoint i32* %29 to i32
- %31 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %32 = load i32** %31, align 4
+ %31 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %32 = load i32*, i32** %31, align 4
%33 = ptrtoint i32* %32 to i32
%34 = sub i32 %30, %33
%35 = ashr i32 %34, 2
@@ -81,85 +81,85 @@ entry:
br label %bb12.i.i
bb.i.i: ; preds = %bb12.i.i
- %37 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %38 = load i32** %37, align 4
- %39 = load i32* %38, align 4
- %40 = load i32* %4, align 4
+ %37 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %38 = load i32*, i32** %37, align 4
+ %39 = load i32, i32* %38, align 4
+ %40 = load i32, i32* %4, align 4
%41 = icmp eq i32 %39, %40
%42 = zext i1 %41 to i8
%toBool.i.i = icmp ne i8 %42, 0
br i1 %toBool.i.i, label %bb1.i.i, label %bb2.i.i
bb1.i.i: ; preds = %bb.i.i
- %43 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %44 = load i32** %43, align 4
+ %43 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %44 = load i32*, i32** %43, align 4
br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
bb2.i.i: ; preds = %bb.i.i
- %45 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %46 = load i32** %45, align 4
- %47 = getelementptr i32* %46, i64 1
- %48 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %45 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %46 = load i32*, i32** %45, align 4
+ %47 = getelementptr i32, i32* %46, i64 1
+ %48 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
store i32* %47, i32** %48, align 4
- %49 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %50 = load i32** %49, align 4
- %51 = load i32* %50, align 4
- %52 = load i32* %4, align 4
+ %49 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %50 = load i32*, i32** %49, align 4
+ %51 = load i32, i32* %50, align 4
+ %52 = load i32, i32* %4, align 4
%53 = icmp eq i32 %51, %52
%54 = zext i1 %53 to i8
%toBool3.i.i = icmp ne i8 %54, 0
br i1 %toBool3.i.i, label %bb4.i.i, label %bb5.i.i
bb4.i.i: ; preds = %bb2.i.i
- %55 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %56 = load i32** %55, align 4
+ %55 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %56 = load i32*, i32** %55, align 4
br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
bb5.i.i: ; preds = %bb2.i.i
- %57 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %58 = load i32** %57, align 4
- %59 = getelementptr i32* %58, i64 1
- %60 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %57 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %58 = load i32*, i32** %57, align 4
+ %59 = getelementptr i32, i32* %58, i64 1
+ %60 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
store i32* %59, i32** %60, align 4
- %61 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %62 = load i32** %61, align 4
- %63 = load i32* %62, align 4
- %64 = load i32* %4, align 4
+ %61 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %62 = load i32*, i32** %61, align 4
+ %63 = load i32, i32* %62, align 4
+ %64 = load i32, i32* %4, align 4
%65 = icmp eq i32 %63, %64
%66 = zext i1 %65 to i8
%toBool6.i.i = icmp ne i8 %66, 0
br i1 %toBool6.i.i, label %bb7.i.i, label %bb8.i.i
bb7.i.i: ; preds = %bb5.i.i
- %67 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %68 = load i32** %67, align 4
+ %67 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %68 = load i32*, i32** %67, align 4
br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
bb8.i.i: ; preds = %bb5.i.i
- %69 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %70 = load i32** %69, align 4
- %71 = getelementptr i32* %70, i64 1
- %72 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %69 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %70 = load i32*, i32** %69, align 4
+ %71 = getelementptr i32, i32* %70, i64 1
+ %72 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
store i32* %71, i32** %72, align 4
- %73 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %74 = load i32** %73, align 4
- %75 = load i32* %74, align 4
- %76 = load i32* %4, align 4
+ %73 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %74 = load i32*, i32** %73, align 4
+ %75 = load i32, i32* %74, align 4
+ %76 = load i32, i32* %4, align 4
%77 = icmp eq i32 %75, %76
%78 = zext i1 %77 to i8
%toBool9.i.i = icmp ne i8 %78, 0
br i1 %toBool9.i.i, label %bb10.i.i, label %bb11.i.i
bb10.i.i: ; preds = %bb8.i.i
- %79 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %80 = load i32** %79, align 4
+ %79 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %80 = load i32*, i32** %79, align 4
br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
bb11.i.i: ; preds = %bb8.i.i
- %81 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %82 = load i32** %81, align 4
- %83 = getelementptr i32* %82, i64 1
- %84 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %81 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %82 = load i32*, i32** %81, align 4
+ %83 = getelementptr i32, i32* %82, i64 1
+ %84 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
store i32* %83, i32** %84, align 4
%85 = sub i32 %__trip_count.0.i.i, 1
br label %bb12.i.i
@@ -170,11 +170,11 @@ bb12.i.i: ; preds = %bb11.i.i, %entry
br i1 %86, label %bb.i.i, label %bb13.i.i
bb13.i.i: ; preds = %bb12.i.i
- %87 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0
- %88 = load i32** %87, align 4
+ %87 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0
+ %88 = load i32*, i32** %87, align 4
%89 = ptrtoint i32* %88 to i32
- %90 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %91 = load i32** %90, align 4
+ %90 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %91 = load i32*, i32** %90, align 4
%92 = ptrtoint i32* %91 to i32
%93 = sub i32 %89, %92
%94 = ashr i32 %93, 2
@@ -185,77 +185,77 @@ bb13.i.i: ; preds = %bb12.i.i
]
bb14.i.i: ; preds = %bb13.i.i
- %95 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %96 = load i32** %95, align 4
- %97 = load i32* %96, align 4
- %98 = load i32* %4, align 4
+ %95 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %96 = load i32*, i32** %95, align 4
+ %97 = load i32, i32* %96, align 4
+ %98 = load i32, i32* %4, align 4
%99 = icmp eq i32 %97, %98
%100 = zext i1 %99 to i8
%toBool15.i.i = icmp ne i8 %100, 0
br i1 %toBool15.i.i, label %bb16.i.i, label %bb17.i.i
bb16.i.i: ; preds = %bb14.i.i
- %101 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %102 = load i32** %101, align 4
+ %101 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %102 = load i32*, i32** %101, align 4
br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
bb17.i.i: ; preds = %bb14.i.i
- %103 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %104 = load i32** %103, align 4
- %105 = getelementptr i32* %104, i64 1
- %106 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %103 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %104 = load i32*, i32** %103, align 4
+ %105 = getelementptr i32, i32* %104, i64 1
+ %106 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
store i32* %105, i32** %106, align 4
br label %bb18.i.i
bb18.i.i: ; preds = %bb17.i.i, %bb13.i.i
- %107 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %108 = load i32** %107, align 4
- %109 = load i32* %108, align 4
- %110 = load i32* %4, align 4
+ %107 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %108 = load i32*, i32** %107, align 4
+ %109 = load i32, i32* %108, align 4
+ %110 = load i32, i32* %4, align 4
%111 = icmp eq i32 %109, %110
%112 = zext i1 %111 to i8
%toBool19.i.i = icmp ne i8 %112, 0
br i1 %toBool19.i.i, label %bb20.i.i, label %bb21.i.i
bb20.i.i: ; preds = %bb18.i.i
- %113 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %114 = load i32** %113, align 4
+ %113 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %114 = load i32*, i32** %113, align 4
br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
bb21.i.i: ; preds = %bb18.i.i
- %115 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %116 = load i32** %115, align 4
- %117 = getelementptr i32* %116, i64 1
- %118 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %115 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %116 = load i32*, i32** %115, align 4
+ %117 = getelementptr i32, i32* %116, i64 1
+ %118 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
store i32* %117, i32** %118, align 4
br label %bb22.i.i
bb22.i.i: ; preds = %bb21.i.i, %bb13.i.i
- %119 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %120 = load i32** %119, align 4
- %121 = load i32* %120, align 4
- %122 = load i32* %4, align 4
+ %119 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %120 = load i32*, i32** %119, align 4
+ %121 = load i32, i32* %120, align 4
+ %122 = load i32, i32* %4, align 4
%123 = icmp eq i32 %121, %122
%124 = zext i1 %123 to i8
%toBool23.i.i = icmp ne i8 %124, 0
br i1 %toBool23.i.i, label %bb24.i.i, label %bb25.i.i
bb24.i.i: ; preds = %bb22.i.i
- %125 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %126 = load i32** %125, align 4
+ %125 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %126 = load i32*, i32** %125, align 4
br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
bb25.i.i: ; preds = %bb22.i.i
- %127 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
- %128 = load i32** %127, align 4
- %129 = getelementptr i32* %128, i64 1
- %130 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %127 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
+ %128 = load i32*, i32** %127, align 4
+ %129 = getelementptr i32, i32* %128, i64 1
+ %130 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0
store i32* %129, i32** %130, align 4
br label %bb26.i.i
bb26.i.i: ; preds = %bb25.i.i, %bb13.i.i
- %131 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0
- %132 = load i32** %131, align 4
+ %131 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >", %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0
+ %132 = load i32*, i32** %131, align 4
br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit: ; preds = %bb26.i.i, %bb24.i.i, %bb20.i.i, %bb16.i.i, %bb10.i.i, %bb7.i.i, %bb4.i.i, %bb1.i.i
diff --git a/test/Transforms/InstCombine/2009-02-21-LoadCST.ll b/test/Transforms/InstCombine/2009-02-21-LoadCST.ll
index cb8a77c23bacd..90ec6d540e9ce 100644
--- a/test/Transforms/InstCombine/2009-02-21-LoadCST.ll
+++ b/test/Transforms/InstCombine/2009-02-21-LoadCST.ll
@@ -7,6 +7,6 @@ target triple = "i386-pc-linux-gnu"
@.str1 = internal constant [4 x i8] c"\B5%8\00"
define i32 @test() {
- %rhsv = load i32* bitcast ([4 x i8]* @.str1 to i32*), align 1
+ %rhsv = load i32, i32* bitcast ([4 x i8]* @.str1 to i32*), align 1
ret i32 %rhsv
}
diff --git a/test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll b/test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll
index a8349f042e42c..ef1734ba7d174 100644
--- a/test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll
+++ b/test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll
@@ -9,18 +9,18 @@ entry:
%tmp6 = mul i32 %max289, 4 ; <i32> [#uses=1]
%tmp7 = alloca i8, i32 0 ; <i8*> [#uses=1]
%tmp8 = bitcast i8* %tmp7 to [0 x [0 x i32]]* ; <[0 x [0 x i32]]*> [#uses=1]
- %tmp11 = load i32* null, align 1 ; <i32> [#uses=1]
+ %tmp11 = load i32, i32* null, align 1 ; <i32> [#uses=1]
%tmp12 = icmp eq i32 %tmp11, 3 ; <i1> [#uses=1]
%tmp13 = zext i1 %tmp12 to i8 ; <i8> [#uses=1]
%tmp14 = ashr i32 %tmp6, 2 ; <i32> [#uses=1]
%tmp15 = bitcast [0 x [0 x i32]]* %tmp8 to i8* ; <i8*> [#uses=1]
%tmp16 = mul i32 %tmp14, 4 ; <i32> [#uses=1]
%tmp17 = mul i32 1, %tmp16 ; <i32> [#uses=1]
- %tmp18 = getelementptr i8* %tmp15, i32 %tmp17 ; <i8*> [#uses=1]
+ %tmp18 = getelementptr i8, i8* %tmp15, i32 %tmp17 ; <i8*> [#uses=1]
%tmp19 = bitcast i8* %tmp18 to [0 x i32]* ; <[0 x i32]*> [#uses=1]
%tmp20 = bitcast [0 x i32]* %tmp19 to i32* ; <i32*> [#uses=1]
- %tmp21 = getelementptr i32* %tmp20, i32 0 ; <i32*> [#uses=1]
- %tmp22 = load i32* %tmp21, align 1 ; <i32> [#uses=1]
+ %tmp21 = getelementptr i32, i32* %tmp20, i32 0 ; <i32*> [#uses=1]
+ %tmp22 = load i32, i32* %tmp21, align 1 ; <i32> [#uses=1]
%tmp23 = icmp eq i32 %tmp22, 4 ; <i1> [#uses=1]
%tmp24 = zext i1 %tmp23 to i8 ; <i8> [#uses=1]
%toBool709 = icmp ne i8 %tmp13, 0 ; <i1> [#uses=1]
diff --git a/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll b/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll
index c617ca4fcad3f..3847abd30c802 100644
--- a/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll
+++ b/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll
@@ -3,9 +3,9 @@
define void @0(<4 x i16>*, <4 x i16>*) {
%3 = alloca <4 x i16>* ; <<4 x i16>**> [#uses=1]
- %4 = load <4 x i16>* null, align 1 ; <<4 x i16>> [#uses=1]
+ %4 = load <4 x i16>, <4 x i16>* null, align 1 ; <<4 x i16>> [#uses=1]
%5 = ashr <4 x i16> %4, <i16 5, i16 5, i16 5, i16 5> ; <<4 x i16>> [#uses=1]
- %6 = load <4 x i16>** %3 ; <<4 x i16>*> [#uses=1]
+ %6 = load <4 x i16>*, <4 x i16>** %3 ; <<4 x i16>*> [#uses=1]
store <4 x i16> %5, <4 x i16>* %6, align 1
ret void
}
diff --git a/test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll b/test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll
index dd14c6beec4c6..ced317c4d43f7 100644
--- a/test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll
+++ b/test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll
@@ -2,7 +2,7 @@
; rdar://6903175
define i1 @f0(i32 *%a) nounwind {
- %b = load i32* %a, align 4
+ %b = load i32, i32* %a, align 4
%c = uitofp i32 %b to double
%d = fcmp ogt double %c, 0x41EFFFFFFFE00000
ret i1 %d
diff --git a/test/Transforms/InstCombine/2009-12-17-CmpSelectNull.ll b/test/Transforms/InstCombine/2009-12-17-CmpSelectNull.ll
index fb7497b395d4f..c438ca5fd1721 100644
--- a/test/Transforms/InstCombine/2009-12-17-CmpSelectNull.ll
+++ b/test/Transforms/InstCombine/2009-12-17-CmpSelectNull.ll
@@ -6,9 +6,9 @@
define i8* @demangle_qualified(i32 %isfuncname) nounwind {
entry:
%tobool272 = icmp ne i32 %isfuncname, 0
- %cond276 = select i1 %tobool272, i8* getelementptr inbounds ([2 x i8]* @.str254, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8]* @.str557, i32 0, i32 0) ; <i8*> [#uses=4]
+ %cond276 = select i1 %tobool272, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str254, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str557, i32 0, i32 0) ; <i8*> [#uses=4]
%cmp.i504 = icmp eq i8* %cond276, null
- %rval = getelementptr i8* %cond276, i1 %cmp.i504
+ %rval = getelementptr i8, i8* %cond276, i1 %cmp.i504
ret i8* %rval
}
diff --git a/test/Transforms/InstCombine/2010-03-03-ExtElim.ll b/test/Transforms/InstCombine/2010-03-03-ExtElim.ll
index e0def997d9748..ad0fe5a21783d 100644
--- a/test/Transforms/InstCombine/2010-03-03-ExtElim.ll
+++ b/test/Transforms/InstCombine/2010-03-03-ExtElim.ll
@@ -4,11 +4,11 @@ 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-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]
+@g_177 = constant i32** bitcast (i8* getelementptr (i8, i8* bitcast ([2 x i32*]* @g_92 to i8*), i64 4) to i32**), align 4 ; <i32***> [#uses=1]
define i1 @PR6486() nounwind {
; CHECK-LABEL: @PR6486(
- %tmp = load i32*** @g_177 ; <i32**> [#uses=1]
+ %tmp = load i32**, i32*** @g_177 ; <i32**> [#uses=1]
%cmp = icmp ne i32** null, %tmp ; <i1> [#uses=1]
%conv = zext i1 %cmp to i32 ; <i32> [#uses=1]
%cmp1 = icmp sle i32 0, %conv ; <i1> [#uses=1]
@@ -21,12 +21,12 @@ define i1 @PR6486() nounwind {
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)
+ ret i1 icmp sgt (i32 sext (i16 trunc (i32 select (i1 icmp eq (i32* getelementptr inbounds ([1 x i32], [1 x i32]* @a, i32 0, i32 0), i32* @d), i32 0, i32 1) to i16) to i32), i32 65535)
; CHECK: ret i1 false
}
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)
+ ret i1 icmp sgt (i32 sext (i16 trunc (i32 select (i1 icmp eq (i32* getelementptr inbounds ([1 x i32], [1 x i32]* @a, i32 0, i32 0), i32* @d), i32 0, i32 1) to i16) to i32), i32 42)
; CHECK: ret i1 false
}
diff --git a/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll b/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll
index 09a96749f2606..51610698c244c 100644
--- a/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll
+++ b/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll
@@ -10,7 +10,7 @@ target triple = "x86_64-unknown-linux-gnu"
define void @CopyEventArg(%union.anon* %ev) nounwind {
entry:
- %call = call i32 (i8*, i8*, ...)* @sprintf(i8* undef, i8* getelementptr inbounds ([3 x i8]* @.str, i64 0, i64 0), %union.anon* %ev) nounwind
+ %call = call i32 (i8*, i8*, ...) @sprintf(i8* undef, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %union.anon* %ev) nounwind
; CHECK: bitcast %union.anon* %ev to i8*
; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64
ret void
diff --git a/test/Transforms/InstCombine/2010-11-21-SizeZeroTypeGEP.ll b/test/Transforms/InstCombine/2010-11-21-SizeZeroTypeGEP.ll
index 80983ef270988..798c726e566f5 100644
--- a/test/Transforms/InstCombine/2010-11-21-SizeZeroTypeGEP.ll
+++ b/test/Transforms/InstCombine/2010-11-21-SizeZeroTypeGEP.ll
@@ -5,13 +5,13 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
define {}* @foo({}* %x, i32 %n) {
; CHECK-LABEL: @foo(
; CHECK-NOT: getelementptr
- %p = getelementptr {}* %x, i32 %n
+ %p = getelementptr {}, {}* %x, i32 %n
ret {}* %p
}
define i8* @bar(i64 %n, {{}, [0 x {[0 x i8]}]}* %p) {
; CHECK-LABEL: @bar(
- %g = getelementptr {{}, [0 x {[0 x i8]}]}* %p, i64 %n, i32 1, i64 %n, i32 0, i64 %n
+ %g = getelementptr {{}, [0 x {[0 x i8]}]}, {{}, [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/2011-05-02-VectorBoolean.ll b/test/Transforms/InstCombine/2011-05-02-VectorBoolean.ll
index 02b64e3bb8d34..116c9713d8938 100644
--- a/test/Transforms/InstCombine/2011-05-02-VectorBoolean.ll
+++ b/test/Transforms/InstCombine/2011-05-02-VectorBoolean.ll
@@ -6,9 +6,9 @@ entry:
%a.addr = alloca <2 x i16>, align 4
%.compoundliteral = alloca <2 x i16>, align 4
store <2 x i16> %a, <2 x i16>* %a.addr, align 4
- %tmp = load <2 x i16>* %a.addr, align 4
+ %tmp = load <2 x i16>, <2 x i16>* %a.addr, align 4
store <2 x i16> zeroinitializer, <2 x i16>* %.compoundliteral
- %tmp1 = load <2 x i16>* %.compoundliteral
+ %tmp1 = load <2 x i16>, <2 x i16>* %.compoundliteral
%cmp = icmp uge <2 x i16> %tmp, %tmp1
%sext = sext <2 x i1> %cmp to <2 x i16>
ret <2 x i16> %sext
diff --git a/test/Transforms/InstCombine/2011-05-13-InBoundsGEP.ll b/test/Transforms/InstCombine/2011-05-13-InBoundsGEP.ll
index fba7239e2d1ea..69568705cfd56 100644
--- a/test/Transforms/InstCombine/2011-05-13-InBoundsGEP.ll
+++ b/test/Transforms/InstCombine/2011-05-13-InBoundsGEP.ll
@@ -9,9 +9,9 @@ entry:
%tmp2 = add i32 %argc, 1879048192
%p = alloca i8
; CHECK: getelementptr
- %p1 = getelementptr i8* %p, i32 %tmp1
+ %p1 = getelementptr i8, i8* %p, i32 %tmp1
; CHECK: getelementptr
- %p2 = getelementptr i8* %p, i32 %tmp2
+ %p2 = getelementptr i8, i8* %p, i32 %tmp2
%cmp = icmp ult i8* %p1, %p2
br i1 %cmp, label %bbtrue, label %bbfalse
bbtrue: ; preds = %entry
diff --git a/test/Transforms/InstCombine/2011-05-28-swapmulsub.ll b/test/Transforms/InstCombine/2011-05-28-swapmulsub.ll
index b096d1f952f9d..639b64aacba0a 100644
--- a/test/Transforms/InstCombine/2011-05-28-swapmulsub.ll
+++ b/test/Transforms/InstCombine/2011-05-28-swapmulsub.ll
@@ -7,14 +7,14 @@ entry:
%on_off.addr = alloca i32, align 4
%a = alloca i32, align 4
store i32 %on_off, i32* %on_off.addr, align 4
- %tmp = load i32* %on_off.addr, align 4
+ %tmp = load i32, i32* %on_off.addr, align 4
%sub = sub i32 1, %tmp
; CHECK-NOT: mul i32
%mul = mul i32 %sub, -2
; CHECK: shl
; CHECK-NEXT: add
store i32 %mul, i32* %a, align 4
- %tmp1 = load i32* %a, align 4
+ %tmp1 = load i32, i32* %a, align 4
%conv = trunc i32 %tmp1 to i16
ret i16 %conv
}
@@ -26,15 +26,15 @@ entry:
%a = alloca i32, align 4
store i32 %on_off, i32* %on_off.addr, align 4
store i32 %q, i32* %q.addr, align 4
- %tmp = load i32* %q.addr, align 4
- %tmp1 = load i32* %on_off.addr, align 4
+ %tmp = load i32, i32* %q.addr, align 4
+ %tmp1 = load i32, i32* %on_off.addr, align 4
%sub = sub i32 %tmp, %tmp1
; CHECK-NOT: mul i32
%mul = mul i32 %sub, -4
; CHECK: sub i32
; CHECK-NEXT: shl
store i32 %mul, i32* %a, align 4
- %tmp2 = load i32* %a, align 4
+ %tmp2 = load i32, i32* %a, align 4
%conv = trunc i32 %tmp2 to i16
ret i16 %conv
}
@@ -44,14 +44,14 @@ entry:
%on_off.addr = alloca i32, align 4
%a = alloca i32, align 4
store i32 %on_off, i32* %on_off.addr, align 4
- %tmp = load i32* %on_off.addr, align 4
+ %tmp = load i32, i32* %on_off.addr, align 4
%sub = sub i32 7, %tmp
; CHECK-NOT: mul i32
%mul = mul i32 %sub, -4
; CHECK: shl
; CHECK-NEXT: add
store i32 %mul, i32* %a, align 4
- %tmp1 = load i32* %a, align 4
+ %tmp1 = load i32, i32* %a, align 4
%conv = trunc i32 %tmp1 to i16
ret i16 %conv
}
diff --git a/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll b/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll
index c8f0351858ca7..15c11db37f59e 100644
--- a/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll
+++ b/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll
@@ -9,12 +9,12 @@ define void @fu1(i32 %parm) nounwind ssp {
%ptr = alloca double*, align 4
store i32 %parm, i32* %1, align 4
store double* null, double** %ptr, align 4
- %2 = load i32* %1, align 4
+ %2 = load i32, i32* %1, align 4
%3 = icmp ne i32 %2, 0
br i1 %3, label %4, label %10
; <label>:4 ; preds = %0
- %5 = load i32* %1, align 4
+ %5 = load i32, i32* %1, align 4
%6 = shl nsw i32 %5, 3
; With "nsw", the alloca and its bitcast can be fused:
%7 = add nsw i32 %6, 2048
@@ -25,7 +25,7 @@ define void @fu1(i32 %parm) nounwind ssp {
store double* %9, double** %ptr, align 4
br label %10
; <label>:10 ; preds = %4, %0
- %11 = load double** %ptr, align 4
+ %11 = load double*, double** %ptr, align 4
call void @bar(double* %11)
; CHECK: ret
ret void
@@ -39,12 +39,12 @@ define void @fu2(i32 %parm) nounwind ssp {
%ptr = alloca double*, align 4
store i32 %parm, i32* %1, align 4
store double* null, double** %ptr, align 4
- %2 = load i32* %1, align 4
+ %2 = load i32, i32* %1, align 4
%3 = icmp ne i32 %2, 0
br i1 %3, label %4, label %10
; <label>:4 ; preds = %0
- %5 = load i32* %1, align 4
+ %5 = load i32, i32* %1, align 4
%6 = mul nsw i32 %5, 8
; Without "nsw", the alloca and its bitcast cannot be fused:
%7 = add i32 %6, 2048
@@ -57,7 +57,7 @@ define void @fu2(i32 %parm) nounwind ssp {
br label %10
; <label>:10 ; preds = %4, %0
- %11 = load double** %ptr, align 4
+ %11 = load double*, double** %ptr, align 4
call void @bar(double* %11)
ret void
}
diff --git a/test/Transforms/InstCombine/2011-09-03-Trampoline.ll b/test/Transforms/InstCombine/2011-09-03-Trampoline.ll
index 5456e03573939..1833558cbceb3 100644
--- a/test/Transforms/InstCombine/2011-09-03-Trampoline.ll
+++ b/test/Transforms/InstCombine/2011-09-03-Trampoline.ll
@@ -7,7 +7,7 @@ declare i32 @f(i8 * nest, i32)
; Most common case
define i32 @test0(i32 %n) {
%alloca = alloca [10 x i8], align 16
- %gep = getelementptr [10 x i8]* %alloca, i32 0, i32 0
+ %gep = getelementptr [10 x i8], [10 x i8]* %alloca, i32 0, i32 0
call void @llvm.init.trampoline(i8* %gep, i8* bitcast (i32 (i8*, i32)* @f to i8*),
i8* null)
%tramp = call i8* @llvm.adjust.trampoline(i8* %gep)
@@ -62,7 +62,7 @@ define i32 @test3(i32 %n, i8* %trampmem) {
define i32 @test4(i32 %n) {
%alloca = alloca [10 x i8], align 16
- %gep = getelementptr [10 x i8]* %alloca, i32 0, i32 0
+ %gep = getelementptr [10 x i8], [10 x i8]* %alloca, i32 0, i32 0
call void @llvm.init.trampoline(i8* %gep, i8* bitcast (i32 (i8*, i32)* @f to i8*),
i8* null)
diff --git a/test/Transforms/InstCombine/2011-10-07-AlignPromotion.ll b/test/Transforms/InstCombine/2011-10-07-AlignPromotion.ll
index 22061b272a85f..122669ec04a7e 100644
--- a/test/Transforms/InstCombine/2011-10-07-AlignPromotion.ll
+++ b/test/Transforms/InstCombine/2011-10-07-AlignPromotion.ll
@@ -10,7 +10,7 @@ define void @t(%struct.CGPoint* %a) nounwind {
%Point = alloca %struct.CGPoint, align 4
%1 = bitcast %struct.CGPoint* %a to i64*
%2 = bitcast %struct.CGPoint* %Point to i64*
- %3 = load i64* %1, align 4
+ %3 = load i64, i64* %1, align 4
store i64 %3, i64* %2, align 4
call void @foo(i64* %2) nounwind
ret void
diff --git a/test/Transforms/InstCombine/2012-02-13-FCmp.ll b/test/Transforms/InstCombine/2012-02-13-FCmp.ll
index 39b05946515a7..586f86de3c292 100644
--- a/test/Transforms/InstCombine/2012-02-13-FCmp.ll
+++ b/test/Transforms/InstCombine/2012-02-13-FCmp.ll
@@ -6,9 +6,9 @@
declare i32 @printf(i8*, ...)
define i64 @_Z8tempCastj(i32 %val) uwtable ssp {
entry:
- %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([35 x i8]* @.str1, i64 0, i64 0), i32 %val)
+ %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str1, i64 0, i64 0), i32 %val)
%conv = uitofp i32 %val to double
- %call.i = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([35 x i8]* @.str, i64 0, i64 0), double %conv)
+ %call.i = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), double %conv)
%cmp.i = fcmp oge double %conv, -1.000000e+00
br i1 %cmp.i, label %land.rhs.i, label %if.end.critedge
; CHECK: br i1 true, label %land.rhs.i, label %if.end.critedge
diff --git a/test/Transforms/InstCombine/2012-05-27-Negative-Shift-Crash.ll b/test/Transforms/InstCombine/2012-05-27-Negative-Shift-Crash.ll
index ba83fe9ec0ad9..ba57baf237114 100644
--- a/test/Transforms/InstCombine/2012-05-27-Negative-Shift-Crash.ll
+++ b/test/Transforms/InstCombine/2012-05-27-Negative-Shift-Crash.ll
@@ -20,7 +20,7 @@ entry:
define void @fn4() nounwind uwtable ssp {
entry:
- %0 = load i32* @d, align 4
+ %0 = load i32, i32* @d, align 4
%cmp = icmp eq i32 %0, 0
%conv = zext i1 %cmp to i32
store i32 %conv, i32* @c, align 4
@@ -34,12 +34,12 @@ entry:
store i32 %and, i32* @e, align 4
%sub = add nsw i32 %and, -1
store i32 %sub, i32* @f, align 4
- %0 = load i32* @a, align 4
+ %0 = load i32, i32* @a, align 4
%tobool = icmp eq i32 %0, 0
br i1 %tobool, label %if.else, label %if.then
if.then: ; preds = %entry
- %1 = load i32* @b, align 4
+ %1 = load i32, i32* @b, align 4
%.lobit = lshr i32 %1, 31
%2 = trunc i32 %.lobit to i8
%.not = xor i8 %2, 1
diff --git a/test/Transforms/InstCombine/2012-05-28-select-hang.ll b/test/Transforms/InstCombine/2012-05-28-select-hang.ll
index db1dbd5b6e2f9..c514dd1f5ec75 100644
--- a/test/Transforms/InstCombine/2012-05-28-select-hang.ll
+++ b/test/Transforms/InstCombine/2012-05-28-select-hang.ll
@@ -6,7 +6,7 @@
define void @func() nounwind uwtable ssp {
entry:
- %0 = load i8* @c, align 1
+ %0 = load i8, i8* @c, align 1
%conv = zext i8 %0 to i32
%or = or i32 %conv, 1
%conv1 = trunc i32 %or to i8
@@ -16,7 +16,7 @@ entry:
%and = and i32 1, %neg
%conv3 = trunc i32 %and to i8
store i8 %conv3, i8* @b, align 1
- %1 = load i8* @a, align 1
+ %1 = load i8, i8* @a, align 1
%conv4 = zext i8 %1 to i32
%conv5 = zext i8 %conv3 to i32
%tobool = icmp ne i32 %conv4, 0
diff --git a/test/Transforms/InstCombine/2012-06-06-LoadOfPHIs.ll b/test/Transforms/InstCombine/2012-06-06-LoadOfPHIs.ll
index 22466a96b667d..4af1ca842c598 100644
--- a/test/Transforms/InstCombine/2012-06-06-LoadOfPHIs.ll
+++ b/test/Transforms/InstCombine/2012-06-06-LoadOfPHIs.ll
@@ -34,16 +34,16 @@ bb11: ; preds = %bb8
bb12: ; preds = %bb11, %bb10, %bb7, %bb6
%max.0 = phi double* [ %tmp, %bb6 ], [ %tmp2, %bb7 ], [ %tmp1, %bb10 ], [ %tmp2, %bb11 ]
-; CHECK: %tmp13 = load double* %tmp, align 8
-; CHECK: %tmp14 = load double* %tmp1, align 8
+; CHECK: %tmp13 = load double, double* %tmp, align 8
+; CHECK: %tmp14 = load double, double* %tmp1, align 8
; CHECK: %tmp15 = fcmp olt double %tmp13, %tmp14
- %tmp13 = load double* %tmp, align 8
- %tmp14 = load double* %tmp1, align 8
+ %tmp13 = load double, double* %tmp, align 8
+ %tmp14 = load double, double* %tmp1, align 8
%tmp15 = fcmp olt double %tmp13, %tmp14
br i1 %tmp15, label %bb16, label %bb21
bb16: ; preds = %bb12
- %tmp17 = load double* %tmp2, align 8
+ %tmp17 = load double, double* %tmp2, align 8
%tmp18 = fcmp olt double %tmp13, %tmp17
br i1 %tmp18, label %bb19, label %bb20
@@ -54,7 +54,7 @@ bb20: ; preds = %bb16
br label %bb26
bb21: ; preds = %bb12
- %tmp22 = load double* %tmp2, align 8
+ %tmp22 = load double, double* %tmp2, align 8
%tmp23 = fcmp olt double %tmp14, %tmp22
br i1 %tmp23, label %bb24, label %bb25
@@ -66,16 +66,16 @@ bb25: ; preds = %bb21
bb26: ; preds = %bb25, %bb24, %bb20, %bb19
%min.0 = phi double* [ %tmp, %bb19 ], [ %tmp2, %bb20 ], [ %tmp1, %bb24 ], [ %tmp2, %bb25 ]
-; CHECK: %tmp27 = load double* %min.0, align 8
-; CHECK: %tmp28 = load double* %max.0
+; CHECK: %tmp27 = load double, double* %min.0, align 8
+; CHECK: %tmp28 = load double, double* %max.0
; CHECK: %tmp29 = fadd double %tmp27, %tmp28
- %tmp27 = load double* %min.0, align 8
- %tmp28 = load double* %max.0
+ %tmp27 = load double, double* %min.0, align 8
+ %tmp28 = load double, double* %max.0
%tmp29 = fadd double %tmp27, %tmp28
%tmp30 = fdiv double %tmp29, 2.000000e+00
store double %tmp30, double* %outL
- %tmp31 = load double* %min.0
- %tmp32 = load double* %max.0
+ %tmp31 = load double, double* %min.0
+ %tmp32 = load double, double* %max.0
%tmp33 = fcmp oeq double %tmp31, %tmp32
br i1 %tmp33, label %bb34, label %bb35
@@ -107,11 +107,11 @@ bb45: ; preds = %bb41, %bb38
br i1 %tmp46, label %bb47, label %bb55
bb47: ; preds = %bb45
- %tmp48 = load double* %tmp1, align 8
- %tmp49 = load double* %tmp2, align 8
+ %tmp48 = load double, double* %tmp1, align 8
+ %tmp49 = load double, double* %tmp2, align 8
%tmp50 = fsub double %tmp48, %tmp49
- %tmp51 = load double* %max.0
- %tmp52 = load double* %min.0
+ %tmp51 = load double, double* %max.0
+ %tmp52 = load double, double* %min.0
%tmp53 = fsub double %tmp51, %tmp52
%tmp54 = fdiv double %tmp50, %tmp53
store double %tmp54, double* %outH
@@ -122,11 +122,11 @@ bb55: ; preds = %bb45
br i1 %tmp56, label %bb57, label %bb66
bb57: ; preds = %bb55
- %tmp58 = load double* %tmp2, align 8
- %tmp59 = load double* %tmp, align 8
+ %tmp58 = load double, double* %tmp2, align 8
+ %tmp59 = load double, double* %tmp, align 8
%tmp60 = fsub double %tmp58, %tmp59
- %tmp61 = load double* %max.0
- %tmp62 = load double* %min.0
+ %tmp61 = load double, double* %max.0
+ %tmp62 = load double, double* %min.0
%tmp63 = fsub double %tmp61, %tmp62
%tmp64 = fdiv double %tmp60, %tmp63
%tmp65 = fadd double 2.000000e+00, %tmp64
@@ -134,11 +134,11 @@ bb57: ; preds = %bb55
br label %bb75
bb66: ; preds = %bb55
- %tmp67 = load double* %tmp, align 8
- %tmp68 = load double* %tmp1, align 8
+ %tmp67 = load double, double* %tmp, align 8
+ %tmp68 = load double, double* %tmp1, align 8
%tmp69 = fsub double %tmp67, %tmp68
- %tmp70 = load double* %max.0
- %tmp71 = load double* %min.0
+ %tmp70 = load double, double* %max.0
+ %tmp71 = load double, double* %min.0
%tmp72 = fsub double %tmp70, %tmp71
%tmp73 = fdiv double %tmp69, %tmp72
%tmp74 = fadd double 4.000000e+00, %tmp73
@@ -146,7 +146,7 @@ bb66: ; preds = %bb55
br label %bb75
bb75: ; preds = %bb66, %bb57, %bb47
- %tmp76 = load double* %outH
+ %tmp76 = load double, double* %outH
%tmp77 = fdiv double %tmp76, 6.000000e+00
store double %tmp77, double* %outH
%tmp78 = fcmp olt double %tmp77, 0.000000e+00
diff --git a/test/Transforms/InstCombine/2012-07-25-LoadPart.ll b/test/Transforms/InstCombine/2012-07-25-LoadPart.ll
index 18aab7f27efd1..14fcf52fe9a78 100644
--- a/test/Transforms/InstCombine/2012-07-25-LoadPart.ll
+++ b/test/Transforms/InstCombine/2012-07-25-LoadPart.ll
@@ -5,7 +5,7 @@
@test = constant [4 x i32] [i32 1, i32 2, i32 3, i32 4]
define i64 @foo() {
- %ret = load i64* bitcast (i8* getelementptr (i8* bitcast ([4 x i32]* @test to i8*), i64 2) to i64*), align 1
+ %ret = load i64, i64* bitcast (i8* getelementptr (i8, i8* bitcast ([4 x i32]* @test to i8*), i64 2) to i64*), align 1
ret i64 %ret
; 0x00030000_00020000 in [01 00/00 00 02 00 00 00 03 00/00 00 04 00 00 00]
; LE: ret i64 844424930263040
diff --git a/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll b/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll
index ac9c555020d0a..6665380678842 100644
--- a/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll
+++ b/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll
@@ -5,6 +5,6 @@
declare void @foo(i32*)
define void @test() nounwind {
- call void @foo(i32* getelementptr (i32* addrspacecast ([16 x i32] addrspace(3)* @base to i32*), i64 2147483647)) nounwind
+ call void @foo(i32* getelementptr (i32, i32* addrspacecast ([16 x i32] addrspace(3)* @base to i32*), i64 2147483647)) nounwind
ret void
}
diff --git a/test/Transforms/InstCombine/2012-09-17-ZeroSizedAlloca.ll b/test/Transforms/InstCombine/2012-09-17-ZeroSizedAlloca.ll
index 7015725feb163..1c5a9813e6b3e 100644
--- a/test/Transforms/InstCombine/2012-09-17-ZeroSizedAlloca.ll
+++ b/test/Transforms/InstCombine/2012-09-17-ZeroSizedAlloca.ll
@@ -16,8 +16,8 @@ target triple = "x86_64-apple-macosx10.8.0"
define void @f() {
%1 = alloca [0 x i8], align 1
%2 = alloca [0 x i8], align 1024
- %3 = getelementptr inbounds [0 x i8]* %1, i64 0, i64 0
- %4 = getelementptr inbounds [0 x i8]* %2, i64 0, i64 0
+ %3 = getelementptr inbounds [0 x i8], [0 x i8]* %1, i64 0, i64 0
+ %4 = getelementptr inbounds [0 x i8], [0 x i8]* %2, i64 0, i64 0
store i8* %3, i8** @x, align 8
store i8* %4, i8** @y, align 8
ret void
diff --git a/test/Transforms/InstCombine/2012-09-24-MemcpyFromGlobalCrash.ll b/test/Transforms/InstCombine/2012-09-24-MemcpyFromGlobalCrash.ll
deleted file mode 100644
index 35b62850c6262..0000000000000
--- a/test/Transforms/InstCombine/2012-09-24-MemcpyFromGlobalCrash.ll
+++ /dev/null
@@ -1,19 +0,0 @@
-; RUN: opt < %s -instcombine -S | FileCheck %s
-
-; Check we don't crash due to lack of target data.
-
-@G = constant [100 x i8] zeroinitializer
-
-declare void @bar(i8*)
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
-
-define void @test() {
-; CHECK-LABEL: @test(
-; CHECK: llvm.memcpy
-; CHECK: ret void
- %A = alloca [100 x i8]
- %a = getelementptr inbounds [100 x i8]* %A, i64 0, i64 0
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* getelementptr inbounds ([100 x i8]* @G, i64 0, i32 0), i64 100, i32 4, i1 false)
- call void @bar(i8* %a) readonly
- ret void
-}
diff --git a/test/Transforms/InstCombine/2012-10-25-vector-of-pointers.ll b/test/Transforms/InstCombine/2012-10-25-vector-of-pointers.ll
index 20ea282687422..23210650e2f36 100644
--- a/test/Transforms/InstCombine/2012-10-25-vector-of-pointers.ll
+++ b/test/Transforms/InstCombine/2012-10-25-vector-of-pointers.ll
@@ -9,7 +9,7 @@ target triple = "x86_64-apple-macosx10.8.0"
define void @widget(%struct.hoge* nocapture %arg) nounwind uwtable ssp {
bb:
- %tmp = getelementptr inbounds %struct.hoge* %arg, i64 0, i32 0
+ %tmp = getelementptr inbounds %struct.hoge, %struct.hoge* %arg, i64 0, i32 0
br i1 undef, label %bb1, label %bb17
bb1: ; preds = %bb
@@ -20,7 +20,7 @@ bb2: ; preds = %bb1
bb3: ; preds = %bb1
%tmp4 = bitcast double** %tmp to <2 x double*>*
- %tmp5 = load <2 x double*>* %tmp4, align 8
+ %tmp5 = load <2 x double*>, <2 x double*>* %tmp4, align 8
%tmp6 = ptrtoint <2 x double*> %tmp5 to <2 x i64>
%tmp7 = sub <2 x i64> zeroinitializer, %tmp6
%tmp8 = ashr exact <2 x i64> %tmp7, <i64 3, i64 3>
diff --git a/test/Transforms/InstCombine/2012-12-14-simp-vgep.ll b/test/Transforms/InstCombine/2012-12-14-simp-vgep.ll
index fc29b095e5ced..46702f80c0ccc 100644
--- a/test/Transforms/InstCombine/2012-12-14-simp-vgep.ll
+++ b/test/Transforms/InstCombine/2012-12-14-simp-vgep.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"
define <4 x i32> @foo(<4 x i32*>* %in) {
- %t17 = load <4 x i32*>* %in, align 8
+ %t17 = load <4 x i32*>, <4 x i32*>* %in, align 8
%t18 = icmp eq <4 x i32*> %t17, zeroinitializer
%t19 = zext <4 x i1> %t18 to <4 x i32>
ret <4 x i32> %t19
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 789e3172e7c4d..9425c29a427d3 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
@@ -16,8 +16,8 @@ define { i64, i64 } @function(i32 %x, i32 %y, i32 %z) nounwind {
; CHECK-NOT: bitcast i96* %retval to %struct._my_struct*
entry:
%retval = alloca %struct._my_struct, align 8
- %k.sroa.0.0.copyload = load i96* bitcast (%struct._my_struct* @initval to i96*), align 1
- %k.sroa.1.12.copyload = load i32* bitcast ([4 x i8]* getelementptr inbounds (%struct._my_struct* @initval, i64 0, i32 1) to i32*), align 1
+ %k.sroa.0.0.copyload = load i96, i96* bitcast (%struct._my_struct* @initval to i96*), align 1
+ %k.sroa.1.12.copyload = load i32, i32* bitcast ([4 x i8]* getelementptr inbounds (%struct._my_struct, %struct._my_struct* @initval, i64 0, i32 1) to i32*), align 1
%0 = zext i32 %x to i96
%bf.value = shl nuw nsw i96 %0, 6
%bf.clear = and i96 %k.sroa.0.0.copyload, -288230376151711744
@@ -32,14 +32,14 @@ entry:
%bf.set10 = or i96 %bf.set5, %bf.clear
%retval.0.cast7 = bitcast %struct._my_struct* %retval to i96*
store i96 %bf.set10, i96* %retval.0.cast7, align 8
- %retval.12.idx8 = getelementptr inbounds %struct._my_struct* %retval, i64 0, i32 1
+ %retval.12.idx8 = getelementptr inbounds %struct._my_struct, %struct._my_struct* %retval, i64 0, i32 1
%retval.12.cast9 = bitcast [4 x i8]* %retval.12.idx8 to i32*
store i32 %k.sroa.1.12.copyload, i32* %retval.12.cast9, align 4
%trunc = trunc i96 %bf.set10 to i64
%.fca.0.insert = insertvalue { i64, i64 } undef, i64 %trunc, 0
- %retval.8.idx12 = getelementptr inbounds %struct._my_struct* %retval, i64 0, i32 0, i64 8
+ %retval.8.idx12 = getelementptr inbounds %struct._my_struct, %struct._my_struct* %retval, i64 0, i32 0, i64 8
%retval.8.cast13 = bitcast i8* %retval.8.idx12 to i64*
- %retval.8.load14 = load i64* %retval.8.cast13, align 8
+ %retval.8.load14 = load i64, i64* %retval.8.cast13, align 8
%.fca.1.insert = insertvalue { i64, i64 } %.fca.0.insert, i64 %retval.8.load14, 1
ret { i64, i64 } %.fca.1.insert
}
diff --git a/test/Transforms/InstCombine/CPP_min_max.ll b/test/Transforms/InstCombine/CPP_min_max.ll
index b3d081b613a66..04bf0ceefea93 100644
--- a/test/Transforms/InstCombine/CPP_min_max.ll
+++ b/test/Transforms/InstCombine/CPP_min_max.ll
@@ -10,11 +10,11 @@
define void @_Z5test1RiS_(i32* %x, i32* %y) {
entry:
- %tmp.1.i = load i32* %y ; <i32> [#uses=1]
- %tmp.3.i = load i32* %x ; <i32> [#uses=1]
+ %tmp.1.i = load i32, i32* %y ; <i32> [#uses=1]
+ %tmp.3.i = load i32, i32* %x ; <i32> [#uses=1]
%tmp.4.i = icmp slt i32 %tmp.1.i, %tmp.3.i ; <i1> [#uses=1]
%retval.i = select i1 %tmp.4.i, i32* %y, i32* %x ; <i32*> [#uses=1]
- %tmp.4 = load i32* %retval.i ; <i32> [#uses=1]
+ %tmp.4 = load i32, i32* %retval.i ; <i32> [#uses=1]
store i32 %tmp.4, i32* %x
ret void
}
@@ -22,12 +22,12 @@ entry:
define void @_Z5test2RiS_(i32* %x, i32* %y) {
entry:
%tmp.0 = alloca i32 ; <i32*> [#uses=2]
- %tmp.2 = load i32* %x ; <i32> [#uses=2]
+ %tmp.2 = load i32, i32* %x ; <i32> [#uses=2]
store i32 %tmp.2, i32* %tmp.0
- %tmp.3.i = load i32* %y ; <i32> [#uses=1]
+ %tmp.3.i = load i32, i32* %y ; <i32> [#uses=1]
%tmp.4.i = icmp slt i32 %tmp.2, %tmp.3.i ; <i1> [#uses=1]
%retval.i = select i1 %tmp.4.i, i32* %y, i32* %tmp.0 ; <i32*> [#uses=1]
- %tmp.6 = load i32* %retval.i ; <i32> [#uses=1]
+ %tmp.6 = load i32, i32* %retval.i ; <i32> [#uses=1]
store i32 %tmp.6, i32* %y
ret void
}
diff --git a/test/Transforms/InstCombine/LandingPadClauses.ll b/test/Transforms/InstCombine/LandingPadClauses.ll
index 10af4bcadf688..0d42f7c737f31 100644
--- a/test/Transforms/InstCombine/LandingPadClauses.ll
+++ b/test/Transforms/InstCombine/LandingPadClauses.ll
@@ -7,6 +7,7 @@
declare i32 @generic_personality(i32, i64, i8*, i8*)
declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*)
declare i32 @__objc_personality_v0(i32, i64, i8*, i8*)
+declare i32 @__C_specific_handler(...)
declare void @bar()
@@ -231,3 +232,54 @@ lpad.d:
; CHECK-NEXT: null
; CHECK-NEXT: unreachable
}
+
+define void @foo_seh() {
+; CHECK-LABEL: @foo_seh(
+ invoke void @bar()
+ to label %cont.a unwind label %lpad.a
+cont.a:
+ invoke void @bar()
+ to label %cont.b unwind label %lpad.b
+cont.b:
+ invoke void @bar()
+ to label %cont.c unwind label %lpad.c
+cont.c:
+ invoke void @bar()
+ to label %cont.d unwind label %lpad.d
+cont.d:
+ ret void
+
+lpad.a:
+ %a = landingpad { i8*, i32 } personality i32 (...)* @__C_specific_handler
+ catch i32* null
+ catch i32* @T1
+ unreachable
+; CHECK: %a = landingpad
+; CHECK-NEXT: null
+; CHECK-NEXT: unreachable
+
+lpad.b:
+ %b = landingpad { i8*, i32 } personality i32 (...)* @__C_specific_handler
+ filter [1 x i32*] zeroinitializer
+ unreachable
+; CHECK: %b = landingpad
+; CHECK-NEXT: cleanup
+; CHECK-NEXT: unreachable
+
+lpad.c:
+ %c = landingpad { i8*, i32 } personality i32 (...)* @__C_specific_handler
+ filter [2 x i32*] [i32* @T1, i32* null]
+ unreachable
+; CHECK: %c = landingpad
+; CHECK-NEXT: cleanup
+; CHECK-NEXT: unreachable
+
+lpad.d:
+ %d = landingpad { i8*, i32 } personality i32 (...)* @__C_specific_handler
+ cleanup
+ catch i32* null
+ unreachable
+; CHECK: %d = landingpad
+; CHECK-NEXT: null
+; CHECK-NEXT: unreachable
+}
diff --git a/test/Transforms/InstCombine/PR7357.ll b/test/Transforms/InstCombine/PR7357.ll
index c397c5ee05e3f..616c8225b2ac3 100644
--- a/test/Transforms/InstCombine/PR7357.ll
+++ b/test/Transforms/InstCombine/PR7357.ll
@@ -8,7 +8,7 @@
; CHECK: call arm_aapcscc i8* @strchr
define arm_aapcscc i32 @foo(i32 %argc) nounwind {
bb.nph:
- %c = call arm_aapcscc i8* @strchr(i8* getelementptr ([11 x i8]* @.str1, i32 0,
+ %c = call arm_aapcscc i8* @strchr(i8* getelementptr ([11 x i8], [11 x i8]* @.str1, i32 0,
i32 0), i32 %argc) nounwind readonly
%p = ptrtoint i8* %c to i32
ret i32 %p
diff --git a/test/Transforms/InstCombine/add2.ll b/test/Transforms/InstCombine/add2.ll
index fbbba5954b325..1af2b0ffbf0a9 100644
--- a/test/Transforms/InstCombine/add2.ll
+++ b/test/Transforms/InstCombine/add2.ll
@@ -273,6 +273,35 @@ define i32 @mul_add_to_mul_6(i32 %x, i32 %y) {
; CHECK-NEXT: ret i32 %add
}
+define i16 @mul_add_to_mul_7(i16 %x) {
+ %mul1 = mul nsw i16 %x, 32767
+ %add2 = add nsw i16 %x, %mul1
+ ret i16 %add2
+; CHECK-LABEL: @mul_add_to_mul_7(
+; CHECK-NEXT: %add2 = shl i16 %x, 15
+; CHECK-NEXT: ret i16 %add2
+}
+
+define i16 @mul_add_to_mul_8(i16 %a) {
+ %mul1 = mul nsw i16 %a, 16383
+ %mul2 = mul nsw i16 %a, 16384
+ %add = add nsw i16 %mul1, %mul2
+ ret i16 %add
+; CHECK-LABEL: @mul_add_to_mul_8(
+; CHECK-NEXT: %add = mul nsw i16 %a, 32767
+; CHECK-NEXT: ret i16 %add
+}
+
+define i16 @mul_add_to_mul_9(i16 %a) {
+ %mul1 = mul nsw i16 %a, 16384
+ %mul2 = mul nsw i16 %a, 16384
+ %add = add nsw i16 %mul1, %mul2
+ ret i16 %add
+; CHECK-LABEL: @mul_add_to_mul_9(
+; CHECK-NEXT: %add = shl i16 %a, 15
+; CHECK-NEXT: ret i16 %add
+}
+
; This test and the next test verify that when a range metadata is attached to
; llvm.cttz, ValueTracking correctly intersects the range specified by the
; metadata and the range implied by the intrinsic.
@@ -353,3 +382,16 @@ define i32 @add_nuw_nsw_or_and(i32 %x, i32 %y) {
; CHECK-NEXT: add nuw nsw i32 %x, %y
; CHECK-NEXT: ret i32
}
+
+; A *nsw B + A *nsw C != A *nsw (B + C)
+; e.g. A = -1, B = 1, C = INT_SMAX
+
+define i8 @add_of_mul(i8 %x, i8 %y, i8 %z) {
+; CHECK-LABEL: @add_of_mul(
+ entry:
+ %mA = mul nsw i8 %x, %y
+ %mB = mul nsw i8 %x, %z
+; CHECK: %sum = mul i8
+ %sum = add nsw i8 %mA, %mB
+ ret i8 %sum
+}
diff --git a/test/Transforms/InstCombine/add3.ll b/test/Transforms/InstCombine/add3.ll
index cde3e24215f8b..9d3842f1a31a6 100644
--- a/test/Transforms/InstCombine/add3.ll
+++ b/test/Transforms/InstCombine/add3.ll
@@ -12,8 +12,8 @@ EntryBlock:
store i32 1, i32* %1
add i32 %.val24, -16
inttoptr i32 %2 to i32*
- getelementptr i32* %3, i32 1
- load i32* %4
+ getelementptr i32, i32* %3, i32 1
+ load i32, i32* %4
tail call i32 @callee( i32 %5 )
ret void
}
diff --git a/test/Transforms/InstCombine/addrspacecast.ll b/test/Transforms/InstCombine/addrspacecast.ll
index c1684361f99fa..27f6b720d6674 100644
--- a/test/Transforms/InstCombine/addrspacecast.ll
+++ b/test/Transforms/InstCombine/addrspacecast.ll
@@ -104,12 +104,12 @@ define <4 x float addrspace(2)*> @combine_addrspacecast_types_vector(<4 x i32 ad
define i32 @canonicalize_addrspacecast([16 x i32] addrspace(1)* %arr) {
; CHECK-LABEL: @canonicalize_addrspacecast(
-; CHECK-NEXT: getelementptr inbounds [16 x i32] addrspace(1)* %arr, i32 0, i32 0
+; CHECK-NEXT: getelementptr inbounds [16 x i32], [16 x i32] addrspace(1)* %arr, i32 0, i32 0
; CHECK-NEXT: addrspacecast i32 addrspace(1)* %{{[a-zA-Z0-9]+}} to i32*
-; CHECK-NEXT: load i32*
+; CHECK-NEXT: load i32, i32*
; CHECK-NEXT: ret i32
%p = addrspacecast [16 x i32] addrspace(1)* %arr to i32*
- %v = load i32* %p
+ %v = load i32, i32* %p
ret i32 %v
}
@@ -127,14 +127,14 @@ declare void @foo(i8*) nounwind
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
+ call void @llvm.memcpy.p0i8.p1i8.i32(i8* %alloca, i8 addrspace(1)* addrspacecast (i8 addrspace(2)* getelementptr inbounds ([60 x i8], [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
+ %ptr = getelementptr i8, i8* %alloca, i32 %i
+ %load = load i8, i8* %ptr
%ext = zext i8 %load to i32
%sum.inc = add i32 %sum, %ext
%i.inc = add i32 %i, 1
diff --git a/test/Transforms/InstCombine/alias-recursion.ll b/test/Transforms/InstCombine/alias-recursion.ll
index fa63726d2d338..74254f3e8dfff 100644
--- a/test/Transforms/InstCombine/alias-recursion.ll
+++ b/test/Transforms/InstCombine/alias-recursion.ll
@@ -7,7 +7,7 @@ target triple = "x86_64-pc-windows-msvc"
@0 = constant [1 x i8*] zeroinitializer
-@vtbl = alias getelementptr inbounds ([1 x i8*]* @0, i32 0, i32 0)
+@vtbl = alias getelementptr inbounds ([1 x i8*], [1 x i8*]* @0, i32 0, i32 0)
define i32 (%class.A*)* @test() {
; CHECK-LABEL: test
@@ -19,6 +19,6 @@ for.body: ; preds = %for.body, %entry
for.end: ; preds = %for.body, %entry
%A = phi i32 (%class.A*)** [ bitcast (i8** @vtbl to i32 (%class.A*)**), %for.body ], [ null, %entry ]
- %B = load i32 (%class.A*)** %A
+ %B = load i32 (%class.A*)*, i32 (%class.A*)** %A
ret i32 (%class.A*)* %B
}
diff --git a/test/Transforms/InstCombine/align-2d-gep.ll b/test/Transforms/InstCombine/align-2d-gep.ll
index f6a877684ce47..bbdb3f94cb28e 100644
--- a/test/Transforms/InstCombine/align-2d-gep.ll
+++ b/test/Transforms/InstCombine/align-2d-gep.ll
@@ -22,11 +22,11 @@ bb7.outer:
bb1:
%j = phi i64 [ 0, %bb7.outer ], [ %indvar.next, %bb1 ]
- %t4 = getelementptr [1001 x [20000 x double]]* @Nice, i64 0, i64 %i, i64 %j
+ %t4 = getelementptr [1001 x [20000 x double]], [1001 x [20000 x double]]* @Nice, i64 0, i64 %i, i64 %j
%q = bitcast double* %t4 to <2 x double>*
store <2 x double><double 0.0, double 0.0>, <2 x double>* %q, align 8
- %s4 = getelementptr [1001 x [20001 x double]]* @Awkward, i64 0, i64 %i, i64 %j
+ %s4 = getelementptr [1001 x [20001 x double]], [1001 x [20001 x double]]* @Awkward, i64 0, i64 %i, i64 %j
%r = bitcast double* %s4 to <2 x double>*
store <2 x double><double 0.0, double 0.0>, <2 x double>* %r, align 8
diff --git a/test/Transforms/InstCombine/align-addr.ll b/test/Transforms/InstCombine/align-addr.ll
index 4d22c2cd2ef2b..ab0ae390b1453 100644
--- a/test/Transforms/InstCombine/align-addr.ll
+++ b/test/Transforms/InstCombine/align-addr.ll
@@ -21,7 +21,7 @@ bb:
%i = phi i64 [ %indvar.next, %bb ], [ 20, %entry ]
%j = mul i64 %i, %v
%h = add i64 %j, %z
- %t8 = getelementptr double* %e, i64 %h
+ %t8 = getelementptr double, double* %e, i64 %h
%p = bitcast double* %t8 to <2 x double>*
store <2 x double><double 0.0, double 0.0>, <2 x double>* %p, align 8
%indvar.next = add i64 %i, 1
@@ -43,7 +43,7 @@ return:
define <16 x i8> @test1(<2 x i64> %x) {
entry:
- %tmp = load <16 x i8>* bitcast ([4 x i32]* @GLOBAL to <16 x i8>*), align 1
+ %tmp = load <16 x i8>, <16 x i8>* bitcast ([4 x i32]* @GLOBAL to <16 x i8>*), align 1
ret <16 x i8> %tmp
}
@@ -53,7 +53,7 @@ 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
+ %tmp = load <16 x i8>, <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
}
@@ -63,7 +63,7 @@ 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
+ %tmp = load <16 x i8>, <16 x i8> addrspace(1)* bitcast (i32 addrspace(1)* getelementptr ([8 x i32], [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
}
@@ -71,11 +71,11 @@ define <16 x i8> @test1_as1_gep(<2 x i64> %x) {
; When a load or store lacks an explicit alignment, add one.
; CHECK-LABEL: @test2(
-; CHECK: load double* %p, align 8
+; CHECK: load double, double* %p, align 8
; CHECK: store double %n, double* %p, align 8
define double @test2(double* %p, double %n) nounwind {
- %t = load double* %p
+ %t = load double, double* %p
store double %n, double* %p
ret double %t
}
diff --git a/test/Transforms/InstCombine/align-attr.ll b/test/Transforms/InstCombine/align-attr.ll
index 9f366bf8fab19..99a17db13c4c6 100644
--- a/test/Transforms/InstCombine/align-attr.ll
+++ b/test/Transforms/InstCombine/align-attr.ll
@@ -5,11 +5,11 @@ target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind uwtable
define i32 @foo1(i32* align 32 %a) #0 {
entry:
- %0 = load i32* %a, align 4
+ %0 = load i32, i32* %a, align 4
ret i32 %0
; CHECK-LABEL: @foo1
-; CHECK-DAG: load i32* %a, align 32
+; CHECK-DAG: load i32, i32* %a, align 32
; CHECK: ret i32
}
diff --git a/test/Transforms/InstCombine/align-external.ll b/test/Transforms/InstCombine/align-external.ll
index 66ff9c16e4241..ee98a01201795 100644
--- a/test/Transforms/InstCombine/align-external.ll
+++ b/test/Transforms/InstCombine/align-external.ll
@@ -23,7 +23,7 @@ define i64 @foo(i64 %a) {
define i32 @bar() {
; CHECK-LABEL: @bar(
- %r = load i32* @B, align 1
+ %r = load i32, i32* @B, align 1
; CHECK: align 1
ret i32 %r
}
diff --git a/test/Transforms/InstCombine/aligned-altivec.ll b/test/Transforms/InstCombine/aligned-altivec.ll
new file mode 100644
index 0000000000000..10b4e4d626311
--- /dev/null
+++ b/test/Transforms/InstCombine/aligned-altivec.ll
@@ -0,0 +1,131 @@
+; 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-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+declare <4 x i32> @llvm.ppc.altivec.lvx(i8*) #1
+
+define <4 x i32> @test1(<4 x i32>* %h) #0 {
+entry:
+ %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
+ %hv = bitcast <4 x i32>* %h1 to i8*
+ %vl = call <4 x i32> @llvm.ppc.altivec.lvx(i8* %hv)
+
+; CHECK-LABEL: @test1
+; CHECK: @llvm.ppc.altivec.lvx
+; CHECK: ret <4 x i32>
+
+ %v0 = load <4 x i32>, <4 x i32>* %h, align 8
+ %a = add <4 x i32> %v0, %vl
+ ret <4 x i32> %a
+}
+
+define <4 x i32> @test1a(<4 x i32>* align 16 %h) #0 {
+entry:
+ %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
+ %hv = bitcast <4 x i32>* %h1 to i8*
+ %vl = call <4 x i32> @llvm.ppc.altivec.lvx(i8* %hv)
+
+; CHECK-LABEL: @test1a
+; CHECK-NOT: @llvm.ppc.altivec.lvx
+; CHECK: ret <4 x i32>
+
+ %v0 = load <4 x i32>, <4 x i32>* %h, align 8
+ %a = add <4 x i32> %v0, %vl
+ ret <4 x i32> %a
+}
+
+declare void @llvm.ppc.altivec.stvx(<4 x i32>, i8*) #0
+
+define <4 x i32> @test2(<4 x i32>* %h, <4 x i32> %d) #0 {
+entry:
+ %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
+ %hv = bitcast <4 x i32>* %h1 to i8*
+ call void @llvm.ppc.altivec.stvx(<4 x i32> %d, i8* %hv)
+
+ %v0 = load <4 x i32>, <4 x i32>* %h, align 8
+ ret <4 x i32> %v0
+
+; CHECK-LABEL: @test2
+; CHECK: @llvm.ppc.altivec.stvx
+; CHECK: ret <4 x i32>
+}
+
+define <4 x i32> @test2a(<4 x i32>* align 16 %h, <4 x i32> %d) #0 {
+entry:
+ %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
+ %hv = bitcast <4 x i32>* %h1 to i8*
+ call void @llvm.ppc.altivec.stvx(<4 x i32> %d, i8* %hv)
+
+ %v0 = load <4 x i32>, <4 x i32>* %h, align 8
+ ret <4 x i32> %v0
+
+; CHECK-LABEL: @test2
+; CHECK-NOT: @llvm.ppc.altivec.stvx
+; CHECK: ret <4 x i32>
+}
+
+declare <4 x i32> @llvm.ppc.altivec.lvxl(i8*) #1
+
+define <4 x i32> @test1l(<4 x i32>* %h) #0 {
+entry:
+ %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
+ %hv = bitcast <4 x i32>* %h1 to i8*
+ %vl = call <4 x i32> @llvm.ppc.altivec.lvxl(i8* %hv)
+
+; CHECK-LABEL: @test1l
+; CHECK: @llvm.ppc.altivec.lvxl
+; CHECK: ret <4 x i32>
+
+ %v0 = load <4 x i32>, <4 x i32>* %h, align 8
+ %a = add <4 x i32> %v0, %vl
+ ret <4 x i32> %a
+}
+
+define <4 x i32> @test1la(<4 x i32>* align 16 %h) #0 {
+entry:
+ %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
+ %hv = bitcast <4 x i32>* %h1 to i8*
+ %vl = call <4 x i32> @llvm.ppc.altivec.lvxl(i8* %hv)
+
+; CHECK-LABEL: @test1la
+; CHECK-NOT: @llvm.ppc.altivec.lvxl
+; CHECK: ret <4 x i32>
+
+ %v0 = load <4 x i32>, <4 x i32>* %h, align 8
+ %a = add <4 x i32> %v0, %vl
+ ret <4 x i32> %a
+}
+
+declare void @llvm.ppc.altivec.stvxl(<4 x i32>, i8*) #0
+
+define <4 x i32> @test2l(<4 x i32>* %h, <4 x i32> %d) #0 {
+entry:
+ %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
+ %hv = bitcast <4 x i32>* %h1 to i8*
+ call void @llvm.ppc.altivec.stvxl(<4 x i32> %d, i8* %hv)
+
+ %v0 = load <4 x i32>, <4 x i32>* %h, align 8
+ ret <4 x i32> %v0
+
+; CHECK-LABEL: @test2l
+; CHECK: @llvm.ppc.altivec.stvxl
+; CHECK: ret <4 x i32>
+}
+
+define <4 x i32> @test2la(<4 x i32>* align 16 %h, <4 x i32> %d) #0 {
+entry:
+ %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
+ %hv = bitcast <4 x i32>* %h1 to i8*
+ call void @llvm.ppc.altivec.stvxl(<4 x i32> %d, i8* %hv)
+
+ %v0 = load <4 x i32>, <4 x i32>* %h, align 8
+ ret <4 x i32> %v0
+
+; CHECK-LABEL: @test2l
+; CHECK-NOT: @llvm.ppc.altivec.stvxl
+; CHECK: ret <4 x i32>
+}
+
+attributes #0 = { nounwind }
+attributes #1 = { nounwind readonly }
+
diff --git a/test/Transforms/InstCombine/aligned-qpx.ll b/test/Transforms/InstCombine/aligned-qpx.ll
new file mode 100644
index 0000000000000..e9710df5670cd
--- /dev/null
+++ b/test/Transforms/InstCombine/aligned-qpx.ll
@@ -0,0 +1,165 @@
+; 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-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+declare <4 x double> @llvm.ppc.qpx.qvlfs(i8*) #1
+
+define <4 x double> @test1(<4 x float>* %h) #0 {
+entry:
+ %h1 = getelementptr <4 x float>, <4 x float>* %h, i64 1
+ %hv = bitcast <4 x float>* %h1 to i8*
+ %vl = call <4 x double> @llvm.ppc.qpx.qvlfs(i8* %hv)
+
+; CHECK-LABEL: @test1
+; CHECK: @llvm.ppc.qpx.qvlfs
+; CHECK: ret <4 x double>
+
+ %v0 = load <4 x float>, <4 x float>* %h, align 8
+ %v0e = fpext <4 x float> %v0 to <4 x double>
+ %a = fadd <4 x double> %v0e, %vl
+ ret <4 x double> %a
+}
+
+define <4 x double> @test1a(<4 x float>* align 16 %h) #0 {
+entry:
+ %h1 = getelementptr <4 x float>, <4 x float>* %h, i64 1
+ %hv = bitcast <4 x float>* %h1 to i8*
+ %vl = call <4 x double> @llvm.ppc.qpx.qvlfs(i8* %hv)
+
+; CHECK-LABEL: @test1a
+; CHECK-NOT: @llvm.ppc.qpx.qvlfs
+; CHECK-NOT: load <4 x double>
+; CHECK: ret <4 x double>
+
+ %v0 = load <4 x float>, <4 x float>* %h, align 8
+ %v0e = fpext <4 x float> %v0 to <4 x double>
+ %a = fadd <4 x double> %v0e, %vl
+ ret <4 x double> %a
+}
+
+declare void @llvm.ppc.qpx.qvstfs(<4 x double>, i8*) #0
+
+define <4 x float> @test2(<4 x float>* %h, <4 x double> %d) #0 {
+entry:
+ %h1 = getelementptr <4 x float>, <4 x float>* %h, i64 1
+ %hv = bitcast <4 x float>* %h1 to i8*
+ call void @llvm.ppc.qpx.qvstfs(<4 x double> %d, i8* %hv)
+
+ %v0 = load <4 x float>, <4 x float>* %h, align 8
+ ret <4 x float> %v0
+
+; CHECK-LABEL: @test2
+; CHECK: @llvm.ppc.qpx.qvstfs
+; CHECK: ret <4 x float>
+}
+
+define <4 x float> @test2a(<4 x float>* align 16 %h, <4 x double> %d) #0 {
+entry:
+ %h1 = getelementptr <4 x float>, <4 x float>* %h, i64 1
+ %hv = bitcast <4 x float>* %h1 to i8*
+ call void @llvm.ppc.qpx.qvstfs(<4 x double> %d, i8* %hv)
+
+ %v0 = load <4 x float>, <4 x float>* %h, align 8
+ ret <4 x float> %v0
+
+; CHECK-LABEL: @test2
+; CHECK: fptrunc <4 x double> %d to <4 x float>
+; CHECK-NOT: @llvm.ppc.qpx.qvstfs
+; CHECK-NOT: store <4 x double>
+; CHECK: ret <4 x float>
+}
+
+declare <4 x double> @llvm.ppc.qpx.qvlfd(i8*) #1
+
+define <4 x double> @test1l(<4 x double>* %h) #0 {
+entry:
+ %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1
+ %hv = bitcast <4 x double>* %h1 to i8*
+ %vl = call <4 x double> @llvm.ppc.qpx.qvlfd(i8* %hv)
+
+; CHECK-LABEL: @test1l
+; CHECK: @llvm.ppc.qpx.qvlfd
+; CHECK: ret <4 x double>
+
+ %v0 = load <4 x double>, <4 x double>* %h, align 8
+ %a = fadd <4 x double> %v0, %vl
+ ret <4 x double> %a
+}
+
+define <4 x double> @test1ln(<4 x double>* align 16 %h) #0 {
+entry:
+ %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1
+ %hv = bitcast <4 x double>* %h1 to i8*
+ %vl = call <4 x double> @llvm.ppc.qpx.qvlfd(i8* %hv)
+
+; CHECK-LABEL: @test1ln
+; CHECK: @llvm.ppc.qpx.qvlfd
+; CHECK: ret <4 x double>
+
+ %v0 = load <4 x double>, <4 x double>* %h, align 8
+ %a = fadd <4 x double> %v0, %vl
+ ret <4 x double> %a
+}
+
+define <4 x double> @test1la(<4 x double>* align 32 %h) #0 {
+entry:
+ %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1
+ %hv = bitcast <4 x double>* %h1 to i8*
+ %vl = call <4 x double> @llvm.ppc.qpx.qvlfd(i8* %hv)
+
+; CHECK-LABEL: @test1la
+; CHECK-NOT: @llvm.ppc.qpx.qvlfd
+; CHECK: ret <4 x double>
+
+ %v0 = load <4 x double>, <4 x double>* %h, align 8
+ %a = fadd <4 x double> %v0, %vl
+ ret <4 x double> %a
+}
+
+declare void @llvm.ppc.qpx.qvstfd(<4 x double>, i8*) #0
+
+define <4 x double> @test2l(<4 x double>* %h, <4 x double> %d) #0 {
+entry:
+ %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1
+ %hv = bitcast <4 x double>* %h1 to i8*
+ call void @llvm.ppc.qpx.qvstfd(<4 x double> %d, i8* %hv)
+
+ %v0 = load <4 x double>, <4 x double>* %h, align 8
+ ret <4 x double> %v0
+
+; CHECK-LABEL: @test2l
+; CHECK: @llvm.ppc.qpx.qvstfd
+; CHECK: ret <4 x double>
+}
+
+define <4 x double> @test2ln(<4 x double>* align 16 %h, <4 x double> %d) #0 {
+entry:
+ %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1
+ %hv = bitcast <4 x double>* %h1 to i8*
+ call void @llvm.ppc.qpx.qvstfd(<4 x double> %d, i8* %hv)
+
+ %v0 = load <4 x double>, <4 x double>* %h, align 8
+ ret <4 x double> %v0
+
+; CHECK-LABEL: @test2ln
+; CHECK: @llvm.ppc.qpx.qvstfd
+; CHECK: ret <4 x double>
+}
+
+define <4 x double> @test2la(<4 x double>* align 32 %h, <4 x double> %d) #0 {
+entry:
+ %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1
+ %hv = bitcast <4 x double>* %h1 to i8*
+ call void @llvm.ppc.qpx.qvstfd(<4 x double> %d, i8* %hv)
+
+ %v0 = load <4 x double>, <4 x double>* %h, align 8
+ ret <4 x double> %v0
+
+; CHECK-LABEL: @test2l
+; CHECK-NOT: @llvm.ppc.qpx.qvstfd
+; CHECK: ret <4 x double>
+}
+
+attributes #0 = { nounwind }
+attributes #1 = { nounwind readonly }
+
diff --git a/test/Transforms/InstCombine/alloca.ll b/test/Transforms/InstCombine/alloca.ll
index 6d0c131c51ed3..b61b75e9f9f34 100644
--- a/test/Transforms/InstCombine/alloca.ll
+++ b/test/Transforms/InstCombine/alloca.ll
@@ -1,6 +1,6 @@
-; 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 -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 -check-prefix=CHECK -check-prefix=ALL
+; 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 -check-prefix=ALL
+; RUN: opt < %s -instcombine -S | FileCheck %s -check-prefix=NODL -check-prefix=ALL
declare void @use(...)
@@ -13,14 +13,14 @@ declare void @use(...)
; CHECK-NOT: alloca
define void @test() {
%X = alloca [0 x i32] ; <[0 x i32]*> [#uses=1]
- call void (...)* @use( [0 x i32]* %X )
+ call void (...) @use( [0 x i32]* %X )
%Y = alloca i32, i32 0 ; <i32*> [#uses=1]
- call void (...)* @use( i32* %Y )
+ call void (...) @use( i32* %Y )
%Z = alloca { } ; <{ }*> [#uses=1]
- call void (...)* @use( { }* %Z )
- %size = load i32* @int
+ call void (...) @use( { }* %Z )
+ %size = load i32, i32* @int
%A = alloca {{}}, i32 %size
- call void (...)* @use( {{}}* %A )
+ call void (...) @use( {{}}* %A )
ret void
}
@@ -38,7 +38,7 @@ define void @test2() {
; CHECK-NOT: alloca
define void @test3() {
%A = alloca { i32 } ; <{ i32 }*> [#uses=1]
- %B = getelementptr { i32 }* %A, i32 0, i32 0 ; <i32*> [#uses=1]
+ %B = getelementptr { i32 }, { i32 }* %A, i32 0, i32 0 ; <i32*> [#uses=1]
store i32 123, i32* %B
ret void
}
@@ -62,16 +62,16 @@ define void @test5() {
entry:
%a = alloca { i32 }
%b = alloca i32*
- %a.1 = getelementptr { i32 }* %a, i32 0, i32 0
+ %a.1 = getelementptr { i32 }, { i32 }* %a, i32 0, i32 0
store i32 123, i32* %a.1
store i32* %a.1, i32** %b
%b.1 = bitcast i32** %b to i32*
store i32 123, i32* %b.1
- %a.2 = getelementptr { i32 }* %a, i32 0, i32 0
+ %a.2 = getelementptr { i32 }, { i32 }* %a, i32 0, i32 0
store atomic i32 2, i32* %a.2 unordered, align 4
- %a.3 = getelementptr { i32 }* %a, i32 0, i32 0
+ %a.3 = getelementptr { i32 }, { i32 }* %a, i32 0, i32 0
store atomic i32 3, i32* %a.3 release, align 4
- %a.4 = getelementptr { i32 }* %a, i32 0, i32 0
+ %a.4 = getelementptr { i32 }, { i32 }* %a, i32 0, i32 0
store atomic i32 4, i32* %a.4 seq_cst, align 4
ret void
}
@@ -89,7 +89,7 @@ define void @test6() {
entry:
%a = alloca { i32 }
%b = alloca i32
- %a.1 = getelementptr { i32 }* %a, i32 0, i32 0
+ %a.1 = getelementptr { i32 }, { i32 }* %a, i32 0, i32 0
store volatile i32 123, i32* %a.1
tail call void @f(i32* %b)
ret void
@@ -116,17 +116,17 @@ declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32,
define void @test8() {
; CHECK-LABEL: @test8(
; CHECK: alloca [100 x i32]
-; CHECK: getelementptr inbounds [100 x i32]* %x1, i64 0, i64 0
+; CHECK: getelementptr inbounds [100 x i32], [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
+; P32: getelementptr inbounds [100 x i32], [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
+; NODL: getelementptr inbounds [100 x i32], [100 x i32]* %x1, i64 0, i64 0
%x = alloca i32, i32 100
- call void (...)* @use(i32* %x)
+ call void (...) @use(i32* %x)
ret void
}
@@ -142,7 +142,7 @@ entry:
%inalloca.save = call i8* @llvm.stacksave()
%argmem = alloca inalloca <{ %struct_type }>
; CHECK: alloca inalloca i64, align 8
- %0 = getelementptr inbounds <{ %struct_type }>* %argmem, i32 0, i32 0
+ %0 = getelementptr inbounds <{ %struct_type }>, <{ %struct_type }>* %argmem, i32 0, i32 0
%1 = bitcast %struct_type* %0 to i8*
%2 = bitcast %struct_type* %a to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %1, i8* %2, i32 8, i32 4, i1 false)
@@ -150,3 +150,16 @@ entry:
call void @llvm.stackrestore(i8* %inalloca.save)
ret void
}
+
+define void @test10() {
+entry:
+; ALL-LABEL: @test10(
+; ALL: %v32 = alloca i1, align 8
+; ALL: %v64 = alloca i1, align 8
+; ALL: %v33 = alloca i1, align 8
+ %v32 = alloca i1, align 8
+ %v64 = alloca i1, i64 1, align 8
+ %v33 = alloca i1, i33 1, align 8
+ call void (...) @use(i1* %v32, i1* %v64, i1* %v33)
+ ret void
+}
diff --git a/test/Transforms/InstCombine/assume-loop-align.ll b/test/Transforms/InstCombine/assume-loop-align.ll
index 19190de2cddd6..e803ba61774db 100644
--- a/test/Transforms/InstCombine/assume-loop-align.ll
+++ b/test/Transforms/InstCombine/assume-loop-align.ll
@@ -19,16 +19,16 @@ entry:
br label %for.body
; CHECK-LABEL: @foo
-; CHECK: load i32* {{.*}} align 64
+; CHECK: load i32, i32* {{.*}} align 64
; CHECK: store i32 {{.*}} align 64
; CHECK: ret
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32* %b, i64 %indvars.iv
- %0 = load i32* %arrayidx, align 4
+ %arrayidx = getelementptr inbounds i32, i32* %b, i64 %indvars.iv
+ %0 = load i32, i32* %arrayidx, align 4
%add = add nsw i32 %0, 1
- %arrayidx5 = getelementptr inbounds i32* %a, i64 %indvars.iv
+ %arrayidx5 = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
store i32 %add, i32* %arrayidx5, align 4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 16
%1 = trunc i64 %indvars.iv.next to i32
diff --git a/test/Transforms/InstCombine/assume-redundant.ll b/test/Transforms/InstCombine/assume-redundant.ll
index 81fe0945949b4..4b869ef2c50e1 100644
--- a/test/Transforms/InstCombine/assume-redundant.ll
+++ b/test/Transforms/InstCombine/assume-redundant.ll
@@ -15,8 +15,8 @@ define void @_Z3fooR1s(%struct.s* nocapture readonly dereferenceable(8) %x) #0 {
; CHECK-NOT: call void @llvm.assume
entry:
- %a = getelementptr inbounds %struct.s* %x, i64 0, i32 0
- %0 = load double** %a, align 8
+ %a = getelementptr inbounds %struct.s, %struct.s* %x, i64 0, i32 0
+ %0 = load double*, double** %a, align 8
%ptrint = ptrtoint double* %0 to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
@@ -25,16 +25,16 @@ entry:
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.1, %for.body ]
tail call void @llvm.assume(i1 %maskcond)
- %arrayidx = getelementptr inbounds double* %0, i64 %indvars.iv
- %1 = load double* %arrayidx, align 16
+ %arrayidx = getelementptr inbounds double, double* %0, i64 %indvars.iv
+ %1 = load double, double* %arrayidx, align 16
%add = fadd double %1, 1.000000e+00
tail call void @llvm.assume(i1 %maskcond)
%mul = fmul double %add, 2.000000e+00
store double %mul, double* %arrayidx, align 16
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
tail call void @llvm.assume(i1 %maskcond)
- %arrayidx.1 = getelementptr inbounds double* %0, i64 %indvars.iv.next
- %2 = load double* %arrayidx.1, align 8
+ %arrayidx.1 = getelementptr inbounds double, double* %0, i64 %indvars.iv.next
+ %2 = load double, double* %arrayidx.1, align 8
%add.1 = fadd double %2, 1.000000e+00
tail call void @llvm.assume(i1 %maskcond)
%mul.1 = fmul double %add.1, 2.000000e+00
diff --git a/test/Transforms/InstCombine/assume.ll b/test/Transforms/InstCombine/assume.ll
index 7e45c04622ac7..2f9213820f2b5 100644
--- a/test/Transforms/InstCombine/assume.ll
+++ b/test/Transforms/InstCombine/assume.ll
@@ -5,12 +5,12 @@ target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind uwtable
define i32 @foo1(i32* %a) #0 {
entry:
- %0 = load i32* %a, align 4
+ %0 = load i32, i32* %a, align 4
; Check that the alignment has been upgraded and that the assume has not
; been removed:
; CHECK-LABEL: @foo1
-; CHECK-DAG: load i32* %a, align 32
+; CHECK-DAG: load i32, i32* %a, align 32
; CHECK-DAG: call void @llvm.assume
; CHECK: ret i32
@@ -27,7 +27,7 @@ define i32 @foo2(i32* %a) #0 {
entry:
; Same check as in @foo1, but make sure it works if the assume is first too.
; CHECK-LABEL: @foo2
-; CHECK-DAG: load i32* %a, align 32
+; CHECK-DAG: load i32, i32* %a, align 32
; CHECK-DAG: call void @llvm.assume
; CHECK: ret i32
@@ -36,7 +36,7 @@ entry:
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
- %0 = load i32* %a, align 4
+ %0 = load i32, i32* %a, align 4
ret i32 %0
}
@@ -192,7 +192,7 @@ declare void @escape(i32* %a)
; metadata form?
define i1 @nonnull1(i32** %a) {
entry:
- %load = load i32** %a
+ %load = load i32*, i32** %a
%cmp = icmp ne i32* %load, null
tail call void @llvm.assume(i1 %cmp)
tail call void @escape(i32* %load)
@@ -209,7 +209,7 @@ entry:
; to pointer types. Doing otherwise would be illegal.
define i1 @nonnull2(i32* %a) {
entry:
- %load = load i32* %a
+ %load = load i32, i32* %a
%cmp = icmp ne i32 %load, 0
tail call void @llvm.assume(i1 %cmp)
%rval = icmp eq i32 %load, 0
@@ -224,7 +224,7 @@ entry:
; if the assume is control dependent on something else
define i1 @nonnull3(i32** %a, i1 %control) {
entry:
- %load = load i32** %a
+ %load = load i32*, i32** %a
%cmp = icmp ne i32* %load, null
br i1 %control, label %taken, label %not_taken
taken:
@@ -244,7 +244,7 @@ not_taken:
; interrupted by an exception being thrown
define i1 @nonnull4(i32** %a) {
entry:
- %load = load i32** %a
+ %load = load i32*, i32** %a
;; This call may throw!
tail call void @escape(i32* %load)
%cmp = icmp ne i32* %load, null
diff --git a/test/Transforms/InstCombine/atomic.ll b/test/Transforms/InstCombine/atomic.ll
index 98cecefcc2946..5754a5a4ba56f 100644
--- a/test/Transforms/InstCombine/atomic.ll
+++ b/test/Transforms/InstCombine/atomic.ll
@@ -7,10 +7,10 @@ target triple = "x86_64-apple-macosx10.7.0"
define i32 @test2(i32* %p) {
; CHECK-LABEL: define i32 @test2(
-; CHECK: %x = load atomic i32* %p seq_cst, align 4
+; CHECK: %x = load atomic i32, i32* %p seq_cst, align 4
; CHECK: shl i32 %x, 1
- %x = load atomic i32* %p seq_cst, align 4
- %y = load i32* %p, align 4
+ %x = load atomic i32, i32* %p seq_cst, align 4
+ %y = load i32, i32* %p, align 4
%z = add i32 %x, %y
ret i32 %z
}
diff --git a/test/Transforms/InstCombine/bitcast-alias-function.ll b/test/Transforms/InstCombine/bitcast-alias-function.ll
index cfec09200dbc3..1a598a5d41537 100644
--- a/test/Transforms/InstCombine/bitcast-alias-function.ll
+++ b/test/Transforms/InstCombine/bitcast-alias-function.ll
@@ -91,12 +91,12 @@ define void @bitcast_alias_scalar(float* noalias %source, float* noalias %dest)
entry:
; CHECK-LABEL: @bitcast_alias_scalar
; CHECK: bitcast float* %source to i32*
-; CHECK: load i32*
+; CHECK: load i32, i32*
; CHECK-NOT: fptoui
; CHECK-NOT: uitofp
; CHECK: bitcast float* %dest to i32*
; CHECK: store i32
- %tmp = load float* %source, align 8
+ %tmp = load float, float* %source, align 8
%call = call float @alias_i32_to_f32(float %tmp) nounwind
store float %call, float* %dest, align 8
ret void
@@ -107,12 +107,12 @@ define void @bitcast_alias_vector(<2 x float>* noalias %source, <2 x float>* noa
entry:
; CHECK-LABEL: @bitcast_alias_vector
; CHECK: bitcast <2 x float>* %source to <2 x i32>*
-; CHECK: load <2 x i32>*
+; CHECK: load <2 x i32>, <2 x i32>*
; CHECK-NOT: fptoui
; CHECK-NOT: uitofp
; CHECK: bitcast <2 x float>* %dest to <2 x i32>*
; CHECK: store <2 x i32>
- %tmp = load <2 x float>* %source, align 8
+ %tmp = load <2 x float>, <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
@@ -123,11 +123,11 @@ define void @bitcast_alias_vector_scalar_same_size(<2 x float>* noalias %source,
entry:
; CHECK-LABEL: @bitcast_alias_vector_scalar_same_size
; CHECK: bitcast <2 x float>* %source to i64*
-; CHECK: load i64*
+; CHECK: load i64, i64*
; CHECK: %call = call i64 @func_i64
; CHECK: bitcast <2 x float>* %dest to i64*
; CHECK: store i64
- %tmp = load <2 x float>* %source, align 8
+ %tmp = load <2 x float>, <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
@@ -137,11 +137,11 @@ define void @bitcast_alias_scalar_vector_same_size(i64* noalias %source, i64* no
entry:
; CHECK-LABEL: @bitcast_alias_scalar_vector_same_size
; CHECK: bitcast i64* %source to <2 x float>*
-; CHECK: load <2 x float>*
+; CHECK: load <2 x float>, <2 x float>*
; CHECK: call <2 x float> @func_v2f32
; CHECK: bitcast i64* %dest to <2 x float>*
; CHECK: store <2 x float>
- %tmp = load i64* %source, align 8
+ %tmp = load i64, i64* %source, align 8
%call = call i64 @alias_i64_to_v2f32(i64 %tmp) nounwind
store i64 %call, i64* %dest, align 8
ret void
@@ -151,11 +151,11 @@ define void @bitcast_alias_vector_ptrs_same_size(<2 x i64*>* noalias %source, <2
entry:
; CHECK-LABEL: @bitcast_alias_vector_ptrs_same_size
; CHECK: bitcast <2 x i64*>* %source to <2 x i32*>*
-; CHECK: load <2 x i32*>*
+; CHECK: load <2 x i32*>, <2 x i32*>*
; CHECK: call <2 x i32*> @func_v2i32p
; CHECK: bitcast <2 x i64*>* %dest to <2 x i32*>*
; CHECK: store <2 x i32*>
- %tmp = load <2 x i64*>* %source, align 8
+ %tmp = load <2 x i64*>, <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
@@ -169,7 +169,7 @@ entry:
; CHECK-NOT: fptoui
; CHECK: @alias_i64_to_f32
; CHECK-NOT: uitofp
- %tmp = load float* %source, align 8
+ %tmp = load float, float* %source, align 8
%call = call float @alias_i64_to_f32(float %tmp) nounwind
store float %call, float* %dest, align 8
ret void
@@ -181,7 +181,7 @@ entry:
; 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
+ %tmp = load <2 x float>, <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
@@ -191,7 +191,7 @@ define void @bitcast_alias_vector_mismatched_number_elements(<4 x float>* noalia
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
+ %tmp = load <4 x float>, <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
@@ -201,7 +201,7 @@ define void @bitcast_alias_vector_scalar_mismatched_bit_size(<4 x float>* noalia
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
+ %tmp = load <4 x float>, <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
@@ -211,7 +211,7 @@ define void @bitcast_alias_vector_ptrs_scalar_mismatched_bit_size(<4 x i32*>* no
entry:
; CHECK-LABEL: @bitcast_alias_vector_ptrs_scalar_mismatched_bit_size
; CHECK: @alias_v4i32p_to_i64
- %tmp = load <4 x i32*>* %source, align 8
+ %tmp = load <4 x i32*>, <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
@@ -221,7 +221,7 @@ define void @bitcast_alias_scalar_vector_ptrs_same_size(i64* noalias %source, i6
entry:
; CHECK-LABEL: @bitcast_alias_scalar_vector_ptrs_same_size
; CHECK: @alias_i64_to_v2i32p
- %tmp = load i64* %source, align 8
+ %tmp = load i64, i64* %source, align 8
%call = call i64 @alias_i64_to_v2i32p(i64 %tmp) nounwind
store i64 %call, i64* %dest, align 8
ret void
@@ -231,7 +231,7 @@ define void @bitcast_alias_scalar_vector_mismatched_bit_size(i64* noalias %sourc
entry:
; CHECK-LABEL: @bitcast_alias_scalar_vector_mismatched_bit_size
; CHECK: call i64 @alias_i64_to_v4f32
- %tmp = load i64* %source, align 8
+ %tmp = load i64, 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.ll b/test/Transforms/InstCombine/bitcast.ll
index c7a520bcf360b..579839e4245b0 100644
--- a/test/Transforms/InstCombine/bitcast.ll
+++ b/test/Transforms/InstCombine/bitcast.ll
@@ -148,7 +148,7 @@ define <2 x i16> @BitcastInsert(i32 %a) {
; 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
+ %load = load <2 x i64>, <2 x i64>* %cast, align 16
ret <2 x i64> %load
; CHECK: @test7
; CHECK: bitcast
diff --git a/test/Transforms/InstCombine/bittest.ll b/test/Transforms/InstCombine/bittest.ll
index 84ee7dd602d5c..edf65d5a87bae 100644
--- a/test/Transforms/InstCombine/bittest.ll
+++ b/test/Transforms/InstCombine/bittest.ll
@@ -5,7 +5,7 @@
define void @_Z12h000007_testv(i32* %P) {
entry:
- %tmp.2 = load i32* @b_rec.0 ; <i32> [#uses=1]
+ %tmp.2 = load i32, i32* @b_rec.0 ; <i32> [#uses=1]
%tmp.9 = or i32 %tmp.2, -989855744 ; <i32> [#uses=2]
%tmp.16 = and i32 %tmp.9, -805306369 ; <i32> [#uses=2]
%tmp.17 = and i32 %tmp.9, -973078529 ; <i32> [#uses=1]
diff --git a/test/Transforms/InstCombine/branch.ll b/test/Transforms/InstCombine/branch.ll
new file mode 100644
index 0000000000000..5be93cc20234a
--- /dev/null
+++ b/test/Transforms/InstCombine/branch.ll
@@ -0,0 +1,16 @@
+; RUN: opt -instcombine -S < %s | FileCheck %s
+
+define i32 @test(i32 %x) {
+; CHECK-LABEL: @test
+entry:
+; CHECK-NOT: icmp
+; CHECK: br i1 undef,
+ %cmp = icmp ult i32 %x, 7
+ br i1 %cmp, label %merge, label %merge
+merge:
+; CHECK-LABEL: merge:
+; CHECK: ret i32 %x
+ ret i32 %x
+}
+
+
diff --git a/test/Transforms/InstCombine/call-cast-target.ll b/test/Transforms/InstCombine/call-cast-target.ll
index 4a5c94961e296..881e80762ea6b 100644
--- a/test/Transforms/InstCombine/call-cast-target.ll
+++ b/test/Transforms/InstCombine/call-cast-target.ll
@@ -72,3 +72,18 @@ entry:
%call = tail call i32 bitcast (i32 (i32)* @fn4 to i32 (i32*)*)(i32* %a)
ret i32 %call
}
+
+declare i1 @fn5({ i32, i32 }* byval align 4 %r)
+
+define i1 @test5() {
+; CHECK-LABEL: @test5
+; CHECK: %[[call:.*]] = call i1 bitcast (i1 ({ i32, i32 }*)* @fn5 to i1 (i32, i32)*)(i32 {{.*}}, i32 {{.*}})
+; CHECK-NEXT: ret i1 %[[call]]
+ %1 = alloca { i32, i32 }, align 4
+ %2 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %1, i32 0, i32 0
+ %3 = load i32, i32* %2, align 4
+ %4 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %1, i32 0, i32 1
+ %5 = load i32, i32* %4, align 4
+ %6 = call i1 bitcast (i1 ({ i32, i32 }*)* @fn5 to i1 (i32, i32)*)(i32 %3, i32 %5)
+ ret i1 %6
+}
diff --git a/test/Transforms/InstCombine/call-intrinsics.ll b/test/Transforms/InstCombine/call-intrinsics.ll
index f9d108058063c..3e37a71e1bf60 100644
--- a/test/Transforms/InstCombine/call-intrinsics.ll
+++ b/test/Transforms/InstCombine/call-intrinsics.ll
@@ -3,17 +3,17 @@
@X = global i8 0 ; <i8*> [#uses=3]
@Y = global i8 12 ; <i8*> [#uses=2]
-declare void @llvm.memmove.i32(i8*, i8*, i32, i32)
+declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
-declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
-declare void @llvm.memset.i32(i8*, i8, i32, i32)
+declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1)
define void @zero_byte_test() {
; These process zero bytes, so they are a noop.
- call void @llvm.memmove.i32( i8* @X, i8* @Y, i32 0, i32 100 )
- call void @llvm.memcpy.i32( i8* @X, i8* @Y, i32 0, i32 100 )
- call void @llvm.memset.i32( i8* @X, i8 123, i32 0, i32 100 )
+ call void @llvm.memmove.p0i8.p0i8.i32( i8* @X, i8* @Y, i32 0, i32 128, i1 false )
+ call void @llvm.memcpy.p0i8.p0i8.i32( i8* @X, i8* @Y, i32 0, i32 128, i1 false )
+ call void @llvm.memset.p0i8.i32( i8* @X, i8 123, i32 0, i32 128, i1 false )
ret void
}
diff --git a/test/Transforms/InstCombine/call.ll b/test/Transforms/InstCombine/call.ll
index e68c0ad9b2081..47ae71f37fb2b 100644
--- a/test/Transforms/InstCombine/call.ll
+++ b/test/Transforms/InstCombine/call.ll
@@ -61,7 +61,7 @@ define void @test3a(i8, ...) {unreachable }
define void @test3(i8 %A, i8 %B) {
; CHECK-LABEL: @test3(
; CHECK: %1 = zext i8 %B to i32
-; CHECK: call void (i8, ...)* @test3a(i8 %A, i32 %1)
+; 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
diff --git a/test/Transforms/InstCombine/call2.ll b/test/Transforms/InstCombine/call2.ll
index 1f45c7ab75dd5..70a5b3ce36e3e 100644
--- a/test/Transforms/InstCombine/call2.ll
+++ b/test/Transforms/InstCombine/call2.ll
@@ -4,11 +4,11 @@
define i32 @bar() {
entry:
%retval = alloca i32, align 4 ; <i32*> [#uses=1]
- %tmp = call i32 (...)* bitcast (i32 (i8*)* @f to i32 (...)*)( double 3.000000e+00 ) ; <i32> [#uses=0]
+ %tmp = call i32 (...) bitcast (i32 (i8*)* @f to i32 (...)*)( double 3.000000e+00 ) ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
- %retval1 = load i32* %retval ; <i32> [#uses=1]
+ %retval1 = load i32, i32* %retval ; <i32> [#uses=1]
ret i32 %retval1
}
@@ -20,6 +20,6 @@ entry:
br label %return
return: ; preds = %entry
- %retval1 = load i32* %retval ; <i32> [#uses=1]
+ %retval1 = load i32, i32* %retval ; <i32> [#uses=1]
ret i32 %retval1
}
diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll
index aac7a531b356a..68f86336580b7 100644
--- a/test/Transforms/InstCombine/cast.ll
+++ b/test/Transforms/InstCombine/cast.ll
@@ -93,9 +93,9 @@ declare void @varargs(i32, ...)
define void @test11(i32* %P) {
%c = bitcast i32* %P to i16* ; <i16*> [#uses=1]
- call void (i32, ...)* @varargs( i32 5, i16* %c )
+ call void (i32, ...) @varargs( i32 5, i16* %c )
ret void
-; CHECK: call void (i32, ...)* @varargs(i32 5, i32* %P)
+; CHECK: call void (i32, ...) @varargs(i32 5, i32* %P)
; CHECK: ret void
}
@@ -104,7 +104,7 @@ define void @test_invoke_vararg_cast(i32* %a, i32* %b) {
entry:
%0 = bitcast i32* %b to i8*
%1 = bitcast i32* %a to i64*
- invoke void (i32, ...)* @varargs(i32 1, i8* %0, i64* %1)
+ invoke void (i32, ...) @varargs(i32 1, i8* %0, i64* %1)
to label %invoke.cont unwind label %lpad
invoke.cont: ; preds = %entry
@@ -116,13 +116,13 @@ lpad: ; preds = %entry
ret void
; CHECK-LABEL: test_invoke_vararg_cast
; CHECK-LABEL: entry:
-; CHECK: invoke void (i32, ...)* @varargs(i32 1, i32* %b, i32* %a)
+; CHECK: invoke void (i32, ...) @varargs(i32 1, i32* %b, i32* %a)
}
define i8* @test13(i64 %A) {
- %c = getelementptr [0 x i8]* bitcast ([32832 x i8]* @inbuf to [0 x i8]*), i64 0, i64 %A ; <i8*> [#uses=1]
+ %c = getelementptr [0 x i8], [0 x i8]* bitcast ([32832 x i8]* @inbuf to [0 x i8]*), i64 0, i64 %A ; <i8*> [#uses=1]
ret i8* %c
-; CHECK: %c = getelementptr [32832 x i8]* @inbuf, i64 0, i64 %A
+; CHECK: %c = getelementptr [32832 x i8], [32832 x i8]* @inbuf, i64 0, i64 %A
; CHECK: ret i8* %c
}
@@ -187,8 +187,8 @@ define i32 @test21(i32 %X) {
%c2 = sext i8 %c1 to i32 ; <i32> [#uses=1]
%RV = and i32 %c2, 255 ; <i32> [#uses=1]
ret i32 %RV
-; CHECK: %c21 = and i32 %X, 255
-; CHECK: ret i32 %c21
+; CHECK: %c2.1 = and i32 %X, 255
+; CHECK: ret i32 %c2.1
}
define i32 @test22(i32 %X) {
@@ -231,14 +231,14 @@ define i32 @test26(float %F) {
define [4 x float]* @test27([9 x [4 x float]]* %A) {
%c = bitcast [9 x [4 x float]]* %A to [4 x float]* ; <[4 x float]*> [#uses=1]
ret [4 x float]* %c
-; CHECK: %c = getelementptr inbounds [9 x [4 x float]]* %A, i64 0, i64 0
+; CHECK: %c = getelementptr inbounds [9 x [4 x float]], [9 x [4 x float]]* %A, i64 0, i64 0
; CHECK: ret [4 x float]* %c
}
define float* @test28([4 x float]* %A) {
%c = bitcast [4 x float]* %A to float* ; <float*> [#uses=1]
ret float* %c
-; CHECK: %c = getelementptr inbounds [4 x float]* %A, i64 0, i64 0
+; CHECK: %c = getelementptr inbounds [4 x float], [4 x float]* %A, i64 0, i64 0
; CHECK: ret float* %c
}
@@ -359,7 +359,7 @@ define i16 @test40(i16 %a) {
; PR1263
define i32* @test41(i32* %tmp1) {
%tmp64 = bitcast i32* %tmp1 to { i32 }*
- %tmp65 = getelementptr { i32 }* %tmp64, i32 0, i32 0
+ %tmp65 = getelementptr { i32 }, { i32 }* %tmp64, i32 0, i32 0
ret i32* %tmp65
; CHECK-LABEL: @test41(
; CHECK: ret i32* %tmp1
@@ -367,7 +367,7 @@ define i32* @test41(i32* %tmp1) {
define i32 addrspace(1)* @test41_addrspacecast_smaller(i32* %tmp1) {
%tmp64 = addrspacecast i32* %tmp1 to { i32 } addrspace(1)*
- %tmp65 = getelementptr { i32 } addrspace(1)* %tmp64, i32 0, i32 0
+ %tmp65 = getelementptr { i32 }, { i32 } addrspace(1)* %tmp64, i32 0, i32 0
ret i32 addrspace(1)* %tmp65
; CHECK-LABEL: @test41_addrspacecast_smaller(
; CHECK: addrspacecast i32* %tmp1 to i32 addrspace(1)*
@@ -376,7 +376,7 @@ define i32 addrspace(1)* @test41_addrspacecast_smaller(i32* %tmp1) {
define i32* @test41_addrspacecast_larger(i32 addrspace(1)* %tmp1) {
%tmp64 = addrspacecast i32 addrspace(1)* %tmp1 to { i32 }*
- %tmp65 = getelementptr { i32 }* %tmp64, i32 0, i32 0
+ %tmp65 = getelementptr { i32 }, { i32 }* %tmp64, i32 0, i32 0
ret i32* %tmp65
; CHECK-LABEL: @test41_addrspacecast_larger(
; CHECK: addrspacecast i32 addrspace(1)* %tmp1 to i32*
@@ -728,11 +728,11 @@ define %s @test68(%s *%p, i64 %i) {
; CHECK-LABEL: @test68(
%o = mul i64 %i, 12
%q = bitcast %s* %p to i8*
- %pp = getelementptr inbounds i8* %q, i64 %o
-; CHECK-NEXT: getelementptr %s*
+ %pp = getelementptr inbounds i8, i8* %q, i64 %o
+; CHECK-NEXT: getelementptr %s, %s*
%r = bitcast i8* %pp to %s*
- %l = load %s* %r
-; CHECK-NEXT: load %s*
+ %l = load %s, %s* %r
+; CHECK-NEXT: load %s, %s*
ret %s %l
; CHECK-NEXT: ret %s
}
@@ -740,28 +740,28 @@ define %s @test68(%s *%p, i64 %i) {
; addrspacecasts should be eliminated.
define %s @test68_addrspacecast(%s* %p, i64 %i) {
; CHECK-LABEL: @test68_addrspacecast(
-; CHECK-NEXT: getelementptr %s*
-; CHECK-NEXT: load %s*
+; CHECK-NEXT: getelementptr %s, %s*
+; CHECK-NEXT: load %s, %s*
; CHECK-NEXT: ret %s
%o = mul i64 %i, 12
%q = addrspacecast %s* %p to i8 addrspace(2)*
- %pp = getelementptr inbounds i8 addrspace(2)* %q, i64 %o
+ %pp = getelementptr inbounds i8, i8 addrspace(2)* %q, i64 %o
%r = addrspacecast i8 addrspace(2)* %pp to %s*
- %l = load %s* %r
+ %l = load %s, %s* %r
ret %s %l
}
define %s @test68_addrspacecast_2(%s* %p, i64 %i) {
; CHECK-LABEL: @test68_addrspacecast_2(
-; CHECK-NEXT: getelementptr %s* %p
+; CHECK-NEXT: getelementptr %s, %s* %p
; CHECK-NEXT: addrspacecast
-; CHECK-NEXT: load %s addrspace(1)*
+; CHECK-NEXT: load %s, %s addrspace(1)*
; CHECK-NEXT: ret %s
%o = mul i64 %i, 12
%q = addrspacecast %s* %p to i8 addrspace(2)*
- %pp = getelementptr inbounds i8 addrspace(2)* %q, i64 %o
+ %pp = getelementptr inbounds i8, i8 addrspace(2)* %q, i64 %o
%r = addrspacecast i8 addrspace(2)* %pp to %s addrspace(1)*
- %l = load %s addrspace(1)* %r
+ %l = load %s, %s addrspace(1)* %r
ret %s %l
}
@@ -769,11 +769,11 @@ 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)*
+ %pp = getelementptr inbounds i8, i8 addrspace(1)* %q, i32 %o
+; CHECK-NEXT: getelementptr %s, %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)*
+ %l = load %s, %s addrspace(1)* %r
+; CHECK-NEXT: load %s, %s addrspace(1)*
ret %s %l
; CHECK-NEXT: ret %s
}
@@ -782,11 +782,11 @@ define double @test69(double *%p, i64 %i) {
; CHECK-LABEL: @test69(
%o = shl nsw i64 %i, 3
%q = bitcast double* %p to i8*
- %pp = getelementptr inbounds i8* %q, i64 %o
-; CHECK-NEXT: getelementptr inbounds double*
+ %pp = getelementptr inbounds i8, i8* %q, i64 %o
+; CHECK-NEXT: getelementptr inbounds double, double*
%r = bitcast i8* %pp to double*
- %l = load double* %r
-; CHECK-NEXT: load double*
+ %l = load double, double* %r
+; CHECK-NEXT: load double, double*
ret double %l
; CHECK-NEXT: ret double
}
@@ -796,11 +796,11 @@ define %s @test70(%s *%p, i64 %i) {
%o = mul nsw i64 %i, 36
; CHECK-NEXT: mul nsw i64 %i, 3
%q = bitcast %s* %p to i8*
- %pp = getelementptr inbounds i8* %q, i64 %o
-; CHECK-NEXT: getelementptr inbounds %s*
+ %pp = getelementptr inbounds i8, i8* %q, i64 %o
+; CHECK-NEXT: getelementptr inbounds %s, %s*
%r = bitcast i8* %pp to %s*
- %l = load %s* %r
-; CHECK-NEXT: load %s*
+ %l = load %s, %s* %r
+; CHECK-NEXT: load %s, %s*
ret %s %l
; CHECK-NEXT: ret %s
}
@@ -810,11 +810,11 @@ define double @test71(double *%p, i64 %i) {
%o = shl i64 %i, 5
; CHECK-NEXT: shl i64 %i, 2
%q = bitcast double* %p to i8*
- %pp = getelementptr i8* %q, i64 %o
-; CHECK-NEXT: getelementptr double*
+ %pp = getelementptr i8, i8* %q, i64 %o
+; CHECK-NEXT: getelementptr double, double*
%r = bitcast i8* %pp to double*
- %l = load double* %r
-; CHECK-NEXT: load double*
+ %l = load double, double* %r
+; CHECK-NEXT: load double, double*
ret double %l
; CHECK-NEXT: ret double
}
@@ -825,11 +825,11 @@ define double @test72(double *%p, i32 %i) {
%o = sext i32 %so to i64
; CHECK-NEXT: sext i32 %i to i64
%q = bitcast double* %p to i8*
- %pp = getelementptr inbounds i8* %q, i64 %o
-; CHECK-NEXT: getelementptr inbounds double*
+ %pp = getelementptr inbounds i8, i8* %q, i64 %o
+; CHECK-NEXT: getelementptr inbounds double, double*
%r = bitcast i8* %pp to double*
- %l = load double* %r
-; CHECK-NEXT: load double*
+ %l = load double, double* %r
+; CHECK-NEXT: load double, double*
ret double %l
; CHECK-NEXT: ret double
}
@@ -840,11 +840,11 @@ define double @test73(double *%p, i128 %i) {
%o = trunc i128 %lo to i64
; CHECK-NEXT: trunc i128 %i to i64
%q = bitcast double* %p to i8*
- %pp = getelementptr inbounds i8* %q, i64 %o
-; CHECK-NEXT: getelementptr double*
+ %pp = getelementptr inbounds i8, i8* %q, i64 %o
+; CHECK-NEXT: getelementptr double, double*
%r = bitcast i8* %pp to double*
- %l = load double* %r
-; CHECK-NEXT: load double*
+ %l = load double, double* %r
+; CHECK-NEXT: load double, double*
ret double %l
; CHECK-NEXT: ret double
}
@@ -852,11 +852,11 @@ define double @test73(double *%p, i128 %i) {
define double @test74(double *%p, i64 %i) {
; CHECK-LABEL: @test74(
%q = bitcast double* %p to i64*
- %pp = getelementptr inbounds i64* %q, i64 %i
-; CHECK-NEXT: getelementptr inbounds double*
+ %pp = getelementptr inbounds i64, i64* %q, i64 %i
+; CHECK-NEXT: getelementptr inbounds double, double*
%r = bitcast i64* %pp to double*
- %l = load double* %r
-; CHECK-NEXT: load double*
+ %l = load double, double* %r
+; CHECK-NEXT: load double, double*
ret double %l
; CHECK-NEXT: ret double
}
@@ -868,7 +868,7 @@ define i32* @test75(i32* %p, i32 %x) {
%z = sext i32 %y to i64
; CHECK-NEXT: sext i32 %y to i64
%q = bitcast i32* %p to i8*
- %r = getelementptr i8* %q, i64 %z
+ %r = getelementptr i8, i8* %q, i64 %z
%s = bitcast i8* %r to i32*
ret i32* %s
}
@@ -879,11 +879,11 @@ define %s @test76(%s *%p, i64 %i, i64 %j) {
%o2 = mul nsw i64 %o, %j
; CHECK-NEXT: %o2 = mul i64 %i, %j
%q = bitcast %s* %p to i8*
- %pp = getelementptr inbounds i8* %q, i64 %o2
-; CHECK-NEXT: getelementptr %s* %p, i64 %o2
+ %pp = getelementptr inbounds i8, i8* %q, i64 %o2
+; CHECK-NEXT: getelementptr %s, %s* %p, i64 %o2
%r = bitcast i8* %pp to %s*
- %l = load %s* %r
-; CHECK-NEXT: load %s*
+ %l = load %s, %s* %r
+; CHECK-NEXT: load %s, %s*
ret %s %l
; CHECK-NEXT: ret %s
}
@@ -895,11 +895,11 @@ define %s @test77(%s *%p, i64 %i, i64 %j) {
; CHECK-NEXT: %o = mul nsw i64 %i, 3
; CHECK-NEXT: %o2 = mul nsw i64 %o, %j
%q = bitcast %s* %p to i8*
- %pp = getelementptr inbounds i8* %q, i64 %o2
-; CHECK-NEXT: getelementptr inbounds %s* %p, i64 %o2
+ %pp = getelementptr inbounds i8, i8* %q, i64 %o2
+; CHECK-NEXT: getelementptr inbounds %s, %s* %p, i64 %o2
%r = bitcast i8* %pp to %s*
- %l = load %s* %r
-; CHECK-NEXT: load %s*
+ %l = load %s, %s* %r
+; CHECK-NEXT: load %s, %s*
ret %s %l
; CHECK-NEXT: ret %s
}
@@ -923,11 +923,11 @@ define %s @test78(%s *%p, i64 %i, i64 %j, i32 %k, i32 %l, i128 %m, i128 %n) {
%h = mul nsw i64 %g, %j
; CHECK-NEXT: mul i64 %g, %j
%q = bitcast %s* %p to i8*
- %pp = getelementptr inbounds i8* %q, i64 %h
-; CHECK-NEXT: getelementptr %s* %p, i64 %h
+ %pp = getelementptr inbounds i8, i8* %q, i64 %h
+; CHECK-NEXT: getelementptr %s, %s* %p, i64 %h
%r = bitcast i8* %pp to %s*
- %load = load %s* %r
-; CHECK-NEXT: load %s*
+ %load = load %s, %s* %r
+; CHECK-NEXT: load %s, %s*
ret %s %load
; CHECK-NEXT: ret %s
}
@@ -940,9 +940,9 @@ define %s @test79(%s *%p, i64 %i, i32 %j) {
%c = mul i32 %b, %j
%q = bitcast %s* %p to i8*
; CHECK: bitcast
- %pp = getelementptr inbounds i8* %q, i32 %c
+ %pp = getelementptr inbounds i8, i8* %q, i32 %c
%r = bitcast i8* %pp to %s*
- %l = load %s* %r
+ %l = load %s, %s* %r
ret %s %l
}
@@ -951,39 +951,39 @@ define double @test80([100 x double]* %p, i32 %i) {
%tmp = shl nsw i32 %i, 3
; CHECK-NEXT: sext i32 %i to i64
%q = bitcast [100 x double]* %p to i8*
- %pp = getelementptr i8* %q, i32 %tmp
-; CHECK-NEXT: getelementptr [100 x double]*
+ %pp = getelementptr i8, i8* %q, i32 %tmp
+; CHECK-NEXT: getelementptr [100 x double], [100 x double]*
%r = bitcast i8* %pp to double*
- %l = load double* %r
-; CHECK-NEXT: load double*
+ %l = load double, double* %r
+; CHECK-NEXT: load double, double*
ret double %l
; CHECK-NEXT: ret double
}
define double @test80_addrspacecast([100 x double] addrspace(1)* %p, i32 %i) {
; CHECK-LABEL: @test80_addrspacecast(
-; CHECK-NEXT: getelementptr [100 x double] addrspace(1)* %p
-; CHECK-NEXT: load double addrspace(1)*
+; CHECK-NEXT: getelementptr [100 x double], [100 x double] addrspace(1)* %p
+; CHECK-NEXT: load double, double addrspace(1)*
; CHECK-NEXT: ret double
%tmp = shl nsw i32 %i, 3
%q = addrspacecast [100 x double] addrspace(1)* %p to i8 addrspace(2)*
- %pp = getelementptr i8 addrspace(2)* %q, i32 %tmp
+ %pp = getelementptr i8, i8 addrspace(2)* %q, i32 %tmp
%r = addrspacecast i8 addrspace(2)* %pp to double addrspace(1)*
- %l = load double addrspace(1)* %r
+ %l = load double, double addrspace(1)* %r
ret double %l
}
define double @test80_addrspacecast_2([100 x double] addrspace(1)* %p, i32 %i) {
; CHECK-LABEL: @test80_addrspacecast_2(
-; CHECK-NEXT: getelementptr [100 x double] addrspace(1)*
+; CHECK-NEXT: getelementptr [100 x double], [100 x double] addrspace(1)*
; CHECK-NEXT: addrspacecast double addrspace(1)*
-; CHECK-NEXT: load double addrspace(3)*
+; CHECK-NEXT: load double, double addrspace(3)*
; CHECK-NEXT: ret double
%tmp = shl nsw i32 %i, 3
%q = addrspacecast [100 x double] addrspace(1)* %p to i8 addrspace(2)*
- %pp = getelementptr i8 addrspace(2)* %q, i32 %tmp
+ %pp = getelementptr i8, i8 addrspace(2)* %q, i32 %tmp
%r = addrspacecast i8 addrspace(2)* %pp to double addrspace(3)*
- %l = load double addrspace(3)* %r
+ %l = load double, double addrspace(3)* %r
ret double %l
}
@@ -992,11 +992,11 @@ define double @test80_as1([100 x double] addrspace(1)* %p, i16 %i) {
%tmp = shl nsw i16 %i, 3
; 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)*
+ %pp = getelementptr i8, i8 addrspace(1)* %q, i16 %tmp
+; CHECK-NEXT: getelementptr [100 x double], [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)*
+ %l = load double, double addrspace(1)* %r
+; CHECK-NEXT: load double, double addrspace(1)*
ret double %l
; CHECK-NEXT: ret double
}
@@ -1004,9 +1004,9 @@ define double @test80_as1([100 x double] addrspace(1)* %p, i16 %i) {
define double @test81(double *%p, float %f) {
%i = fptosi float %f to i64
%q = bitcast double* %p to i8*
- %pp = getelementptr i8* %q, i64 %i
+ %pp = getelementptr i8, i8* %q, i64 %i
%r = bitcast i8* %pp to double*
- %l = load double* %r
+ %l = load double, double* %r
ret double %l
}
@@ -1104,3 +1104,36 @@ define i32 @PR21388(i32* %v) {
; CHECK-NEXT: %[[sext:.*]] = sext i1 %[[icmp]] to i32
; CHECK-NEXT: ret i32 %[[sext]]
}
+
+define float @sitofp_zext(i16 %a) {
+; CHECK-LABEL: @sitofp_zext(
+; CHECK-NEXT: %[[sitofp:.*]] = uitofp i16 %a to float
+; CHECK-NEXT: ret float %[[sitofp]]
+ %zext = zext i16 %a to i32
+ %sitofp = sitofp i32 %zext to float
+ ret float %sitofp
+}
+
+define i1 @PR23309(i32 %A, i32 %B) {
+; CHECK-LABEL: @PR23309(
+; CHECK-NEXT: %[[sub:.*]] = sub i32 %A, %B
+; CHECK-NEXT: %[[and:.*]] = and i32 %[[sub]], 1
+; CHECK-NEXT: %[[cmp:.*]] = icmp ne i32 %[[and]], 0
+; CHECK-NEXT: ret i1 %[[cmp]]
+ %add = add i32 %A, -4
+ %sub = sub nsw i32 %add, %B
+ %trunc = trunc i32 %sub to i1
+ ret i1 %trunc
+}
+
+define i1 @PR23309v2(i32 %A, i32 %B) {
+; CHECK-LABEL: @PR23309v2(
+; CHECK-NEXT: %[[sub:.*]] = add i32 %A, %B
+; CHECK-NEXT: %[[and:.*]] = and i32 %[[sub]], 1
+; CHECK-NEXT: %[[cmp:.*]] = icmp ne i32 %[[and]], 0
+; CHECK-NEXT: ret i1 %[[cmp]]
+ %add = add i32 %A, -4
+ %sub = add nuw i32 %add, %B
+ %trunc = trunc i32 %sub to i1
+ ret i1 %trunc
+}
diff --git a/test/Transforms/InstCombine/cast_ptr.ll b/test/Transforms/InstCombine/cast_ptr.ll
index 23006a84604b1..eaf946ef92598 100644
--- a/test/Transforms/InstCombine/cast_ptr.ll
+++ b/test/Transforms/InstCombine/cast_ptr.ll
@@ -3,6 +3,8 @@
target datalayout = "p:32:32-p1:32:32-p2:16:16"
+@global = global i8 0
+
; This shouldn't convert to getelementptr because the relationship
; between the arithmetic and the layout of allocated memory is
; entirely unknown.
@@ -47,10 +49,29 @@ define i1 @test2_as2_larger(i8 addrspace(2)* %a, i8 addrspace(2)* %b) {
ret i1 %r
}
+; These casts should not be folded away.
+; CHECK-LABEL: @test2_diff_as
+; CHECK: icmp sge i32 %i0, %i1
+define i1 @test2_diff_as(i8* %p, i8 addrspace(1)* %q) {
+ %i0 = ptrtoint i8* %p to i32
+ %i1 = ptrtoint i8 addrspace(1)* %q to i32
+ %r0 = icmp sge i32 %i0, %i1
+ ret i1 %r0
+}
+
+; These casts should not be folded away.
+; CHECK-LABEL: @test2_diff_as_global
+; CHECK: icmp sge i32 %i1
+define i1 @test2_diff_as_global(i8 addrspace(1)* %q) {
+ %i0 = ptrtoint i8* @global to i32
+ %i1 = ptrtoint i8 addrspace(1)* %q to i32
+ %r0 = icmp sge i32 %i1, %i0
+ ret i1 %r0
+}
+
; These casts should also be folded away.
; CHECK-LABEL: @test3(
; CHECK: icmp eq i8* %a, @global
-@global = global i8 0
define i1 @test3(i8* %a) {
%tmpa = ptrtoint i8* %a to i32
%r = icmp eq i32 %tmpa, ptrtoint (i8* @global to i32)
@@ -86,7 +107,7 @@ define i1 @test4_as2(i16 %A) {
declare %op* @foo(%op* %X)
define %unop* @test5(%op* %O) {
- %tmp = load %unop* (%op*)** bitcast ([1 x %op* (%op*)*]* @Array to %unop* (%op*)**); <%unop* (%op*)*> [#uses=1]
+ %tmp = load %unop* (%op*)*, %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-LABEL: @test5(
@@ -101,8 +122,8 @@ define %unop* @test5(%op* %O) {
define i8 @test6(i8 addrspace(1)* %source) {
entry:
%arrayidx223 = addrspacecast i8 addrspace(1)* %source to i8*
- %tmp4 = load i8* %arrayidx223
+ %tmp4 = load i8, i8* %arrayidx223
ret i8 %tmp4
; CHECK-LABEL: @test6(
-; CHECK: load i8* %arrayidx223
+; CHECK: load i8, i8* %arrayidx223
}
diff --git a/test/Transforms/InstCombine/constant-expr-datalayout.ll b/test/Transforms/InstCombine/constant-expr-datalayout.ll
index 9a72c77afdb0f..cdecfc91f592f 100644
--- a/test/Transforms/InstCombine/constant-expr-datalayout.ll
+++ b/test/Transforms/InstCombine/constant-expr-datalayout.ll
@@ -6,7 +6,7 @@ target triple = "x86_64-unknown-linux-gnu"
%test1.struct = type { i32, i32 }
@test1.aligned_glbl = global %test1.struct zeroinitializer, align 4
define void @test1(i64 *%ptr) {
- store i64 and (i64 ptrtoint (i32* getelementptr (%test1.struct* @test1.aligned_glbl, i32 0, i32 1) to i64), i64 3), i64* %ptr
+ store i64 and (i64 ptrtoint (i32* getelementptr (%test1.struct, %test1.struct* @test1.aligned_glbl, i32 0, i32 1) to i64), i64 3), i64* %ptr
; CHECK: store i64 0, i64* %ptr
ret void
}
diff --git a/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll b/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll
index bb61f02c8e230..0ab76be17cb32 100644
--- a/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll
+++ b/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll
@@ -149,22 +149,22 @@ define i1 @constant_fold_inttoptr() {
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
+; CHECK: load float, float addrspace(3)* bitcast (i32 addrspace(3)* @g to float addrspace(3)*), align 4
+ %a = load float, 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
+; CHECK: load i32, i32 addrspace(3)* bitcast (float addrspace(3)* @g_float_as3 to i32 addrspace(3)*), align 4
+ %a = load i32, i32 addrspace(3)* bitcast (float addrspace(3)* @g_float_as3 to i32 addrspace(3)*), align 4
ret i32 %a
}
define <4 x float> @constant_fold_bitcast_vector_as() {
; CHECK-LABEL: @constant_fold_bitcast_vector_as(
-; CHECK: load <4 x float> addrspace(3)* @g_v4f_as3, align 16
- %a = load <4 x float> addrspace(3)* bitcast (<4 x i32> addrspace(3)* bitcast (<4 x float> addrspace(3)* @g_v4f_as3 to <4 x i32> addrspace(3)*) to <4 x float> addrspace(3)*), align 4
+; CHECK: load <4 x float>, <4 x float> addrspace(3)* @g_v4f_as3, align 16
+ %a = load <4 x float>, <4 x float> addrspace(3)* bitcast (<4 x i32> addrspace(3)* bitcast (<4 x float> addrspace(3)* @g_v4f_as3 to <4 x i32> addrspace(3)*) to <4 x float> addrspace(3)*), align 4
ret <4 x float> %a
}
@@ -172,9 +172,9 @@ define <4 x float> @constant_fold_bitcast_vector_as() {
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
+; CHECK: load i32, i32 addrspace(3)* getelementptr inbounds ([10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i16 0, i16 0), align 16
+ %p = getelementptr [10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i7 0, i7 0
+ %x = load i32, i32 addrspace(3)* %p, align 4
ret i32 %x
}
@@ -184,22 +184,22 @@ define i32 @test_cast_gep_small_indices_as() {
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)
+ i32 addrspace(3)* getelementptr ([10 x i32], [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
+; CHECK: load i32, i32 addrspace(3)* getelementptr inbounds ([10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i16 0, i16 0), align 16
+ %p = getelementptr [10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i64 0, i64 0
+ %x = load i32, 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
+; CHECK: load i32, i32 addrspace(3)* getelementptr inbounds (%struct.foo, %struct.foo addrspace(3)* @constant_fold_global_ptr, i16 0, i32 2, i16 2), align 8
+ %x = getelementptr %struct.foo, %struct.foo addrspace(3)* @constant_fold_global_ptr, i18 0, i32 2, i12 2
+ %y = load i32, i32 addrspace(3)* %x, align 4
ret i32 %y
}
@@ -208,8 +208,8 @@ define i32 @test_constant_cast_gep_struct_indices_as() {
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
+ %x = getelementptr [5 x i32], [5 x i32] addrspace(3)* @constant_data_as3, i32 0, i32 1
+ %y = load i32, i32 addrspace(3)* %x, align 4
ret i32 %y
}
@@ -219,14 +219,14 @@ define i32 @test_read_data_from_global_as3() {
@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)
+@indirect = addrspace(0) constant i32 addrspace(1)* addrspace(2)* getelementptr inbounds ([4 x i32 addrspace(1)*], [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
+ %p = load i32 addrspace(1)* addrspace(2)*, i32 addrspace(1)* addrspace(2)* addrspace(0)* @indirect, align 4
+ %a = load i32 addrspace(1)*, i32 addrspace(1)* addrspace(2)* %p, align 4
+ %b = load i32, i32 addrspace(1)* %a, align 4
ret i32 %b
}
@@ -234,8 +234,8 @@ define i32 @constant_through_array_as_ptrs() {
define float @canonicalize_addrspacecast(i32 %i) {
; CHECK-LABEL: @canonicalize_addrspacecast
-; CHECK-NEXT: getelementptr inbounds float* addrspacecast (float addrspace(3)* bitcast ([0 x i8] addrspace(3)* @shared_mem to float addrspace(3)*) to float*), i32 %i
- %p = getelementptr inbounds float* addrspacecast ([0 x i8] addrspace(3)* @shared_mem to float*), i32 %i
- %v = load float* %p
+; CHECK-NEXT: getelementptr inbounds float, float* addrspacecast (float addrspace(3)* bitcast ([0 x i8] addrspace(3)* @shared_mem to float addrspace(3)*) to float*), i32 %i
+ %p = getelementptr inbounds float, float* addrspacecast ([0 x i8] addrspace(3)* @shared_mem to float*), i32 %i
+ %v = load float, float* %p
ret float %v
}
diff --git a/test/Transforms/InstCombine/constant-fold-alias.ll b/test/Transforms/InstCombine/constant-fold-alias.ll
index 13da0f4452424..c872f57c37e1f 100644
--- a/test/Transforms/InstCombine/constant-fold-alias.ll
+++ b/test/Transforms/InstCombine/constant-fold-alias.ll
@@ -6,8 +6,8 @@ target datalayout = "e-p1:16:16-p2:32:32-p3:64:64"
@G2 = global i32 42
@G3 = global [4 x i8] zeroinitializer, align 1
-@A1 = alias bitcast (i8* getelementptr inbounds ([4 x i8]* @G3, i32 0, i32 2) to i32*)
-@A2 = alias inttoptr (i64 and (i64 ptrtoint (i8* getelementptr inbounds ([4 x i8]* @G3, i32 0, i32 3) to i64), i64 -4) to i32*)
+@A1 = alias bitcast (i8* getelementptr inbounds ([4 x i8], [4 x i8]* @G3, i32 0, i32 2) to i32*)
+@A2 = alias inttoptr (i64 and (i64 ptrtoint (i8* getelementptr inbounds ([4 x i8], [4 x i8]* @G3, i32 0, i32 3) to i64), i64 -4) to i32*)
define i64 @f1() {
; This cannot be constant folded because G1 is underaligned.
diff --git a/test/Transforms/InstCombine/constant-fold-gep.ll b/test/Transforms/InstCombine/constant-fold-gep.ll
index 5fb56023a4f6f..77090529e1305 100644
--- a/test/Transforms/InstCombine/constant-fold-gep.ll
+++ b/test/Transforms/InstCombine/constant-fold-gep.ll
@@ -9,48 +9,48 @@ target datalayout = "E-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-
@Y = internal global [3 x %struct.X] zeroinitializer
define void @frob() {
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 0), align 16
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 0), align 4
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 1), align 4
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 1), align 4
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 2), align 8
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 2), align 4
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 0), align 4
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 3), align 4
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 1), align 4
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 4), align 4
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 2), align 4
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 5), align 4
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 0), align 8
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 6), align 4
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 1), align 4
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 7), align 4
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 2), align 8
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 8), align 4
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 0), align 4
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 9), align 4
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 1), align 4
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 10), align 4
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 2), align 4
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 11), align 4
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 0), align 16
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 12), align 4
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 1), align 4
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 13), align 4
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 2), align 8
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 14), align 8
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 0), align 8
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 15), align 8
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 1), align 8
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 16), align 8
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 2), align 8
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 17), align 8
-; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 1, i64 0, i32 0, i64 0), align 8
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 18), align 8
-; CHECK: store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 2, i64 0, i32 0, i64 0), align 16
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 36), align 8
-; CHECK: store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 1, i64 0, i32 0, i64 1), align 8
- store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 19), align 8
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 0), align 16
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 0), align 4
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 1), align 4
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 1), align 4
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 2), align 8
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 2), align 4
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 0), align 4
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 3), align 4
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 1), align 4
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 4), align 4
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 2), align 4
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 5), align 4
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 0), align 8
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 6), align 4
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 1), align 4
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 7), align 4
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 2), align 8
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 8), align 4
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 0), align 4
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 9), align 4
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 1), align 4
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 10), align 4
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 2), align 4
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 11), align 4
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 0), align 16
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 12), align 4
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 1), align 4
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 13), align 4
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 2), align 8
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 14), align 8
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 0), align 8
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 15), align 8
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 1), align 8
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 16), align 8
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 2), align 8
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 17), align 8
+; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 1, i64 0, i32 0, i64 0), align 8
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 18), align 8
+; CHECK: store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 2, i64 0, i32 0, i64 0), align 16
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 36), align 8
+; CHECK: store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 1, i64 0, i32 0, i64 1), align 8
+ store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 19), align 8
ret void
}
@@ -61,12 +61,12 @@ define void @frob() {
define i64 @test2() {
entry:
- %A = bitcast i8* getelementptr inbounds ([1000 x i8]* @X, i64 1, i64 0) to i8*
- %B = bitcast i8* getelementptr inbounds ([1000 x i8]* @X, i64 0, i64 0) to i8*
+ %A = bitcast i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @X, i64 1, i64 0) to i8*
+ %B = bitcast i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @X, i64 0, i64 0) to i8*
%B2 = ptrtoint i8* %B to i64
%C = sub i64 0, %B2
- %D = getelementptr i8* %A, i64 %C
+ %D = getelementptr i8, i8* %A, i64 %C
%E = ptrtoint i8* %D to i64
ret i64 %E
@@ -80,12 +80,12 @@ define i16 @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)*
+ %A = bitcast i8 addrspace(1)* getelementptr inbounds ([1000 x i8], [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], [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
+ %D = getelementptr i8, i8 addrspace(1)* %A, i16 %C
%E = ptrtoint i8 addrspace(1)* %D to i16
ret i16 %E
diff --git a/test/Transforms/InstCombine/constant-fold-hang.ll b/test/Transforms/InstCombine/constant-fold-hang.ll
new file mode 100644
index 0000000000000..2ca6b86ccc2f9
--- /dev/null
+++ b/test/Transforms/InstCombine/constant-fold-hang.ll
@@ -0,0 +1,14 @@
+; RUN: opt -instcombine < %s
+
+; Function Attrs: nounwind readnone ssp
+define void @mulByZero(<4 x i16> %x) #0 {
+entry:
+ %a = tail call <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x i16> %x, <4 x i16> zeroinitializer) #2
+ ret void
+}
+
+; Function Attrs: nounwind readnone
+declare <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x i16>, <4 x i16>) #1
+
+attributes #0 = { nounwind readnone ssp }
+attributes #1 = { nounwind readnone }
diff --git a/test/Transforms/InstCombine/crash.ll b/test/Transforms/InstCombine/crash.ll
index 2ef6ac64c7f3c..2d93ecd59bf57 100644
--- a/test/Transforms/InstCombine/crash.ll
+++ b/test/Transforms/InstCombine/crash.ll
@@ -35,12 +35,12 @@ entry:
; PR4908
define void @test2(<1 x i16>* nocapture %b, i32* nocapture %c) nounwind ssp {
entry:
- %arrayidx = getelementptr inbounds <1 x i16>* %b, i64 undef ; <<1 x i16>*>
- %tmp2 = load <1 x i16>* %arrayidx ; <<1 x i16>> [#uses=1]
+ %arrayidx = getelementptr inbounds <1 x i16>, <1 x i16>* %b, i64 undef ; <<1 x i16>*>
+ %tmp2 = load <1 x i16>, <1 x i16>* %arrayidx ; <<1 x i16>> [#uses=1]
%tmp6 = bitcast <1 x i16> %tmp2 to i16 ; <i16> [#uses=1]
%tmp7 = zext i16 %tmp6 to i32 ; <i32> [#uses=1]
%ins = or i32 0, %tmp7 ; <i32> [#uses=1]
- %arrayidx20 = getelementptr inbounds i32* %c, i64 undef ; <i32*> [#uses=1]
+ %arrayidx20 = getelementptr inbounds i32, i32* %c, i64 undef ; <i32*> [#uses=1]
store i32 %ins, i32* %arrayidx20
ret void
}
@@ -60,7 +60,7 @@ define void @foo(i1) nounwind align 2 {
; <label>:3 ; preds = %2, %1
%4 = phi i8 [ 1, %2 ], [ 0, %1 ] ; <i8> [#uses=1]
%5 = icmp eq i8 %4, 0 ; <i1> [#uses=1]
- %6 = load i64* @tmp2, align 8 ; <i64> [#uses=1]
+ %6 = load i64, i64* @tmp2, align 8 ; <i64> [#uses=1]
%7 = select i1 %5, i64 0, i64 %6 ; <i64> [#uses=1]
br label %8
@@ -79,9 +79,9 @@ define void @bar3(i1, i1) nounwind align 2 {
br i1 %1, label %10, label %3
; <label>:3 ; preds = %2
- %4 = getelementptr inbounds %t0* null, i64 0, i32 1 ; <i32*> [#uses=0]
- %5 = getelementptr inbounds %t1* null, i64 0, i32 4 ; <i32**> [#uses=1]
- %6 = load i32** %5, align 8 ; <i32*> [#uses=1]
+ %4 = getelementptr inbounds %t0, %t0* null, i64 0, i32 1 ; <i32*> [#uses=0]
+ %5 = getelementptr inbounds %t1, %t1* null, i64 0, i32 4 ; <i32**> [#uses=1]
+ %6 = load i32*, i32** %5, align 8 ; <i32*> [#uses=1]
%7 = icmp ne i32* %6, null ; <i1> [#uses=1]
%8 = zext i1 %7 to i32 ; <i32> [#uses=1]
%9 = add i32 %8, 0 ; <i32> [#uses=1]
@@ -115,7 +115,7 @@ BB1:
BB2:
%v5_ = phi i1 [ true, %BB0], [false, %BB1]
- %v6 = load i64* %P
+ %v6 = load i64, i64* %P
br label %l8
l8:
@@ -149,7 +149,7 @@ exit:
define arm_aapcs_vfpcc i32 @test6(i32 %argc, i8** %argv) nounwind {
entry:
- store i32* getelementptr (i32* bitcast (i32 (i32, i8**)* @test6 to i32*), i32 -2048), i32** @test6g, align 4
+ store i32* getelementptr (i32, i32* bitcast (i32 (i32, i8**)* @test6 to i32*), i32 -2048), i32** @test6g, align 4
unreachable
}
@@ -182,8 +182,8 @@ cont: ; preds = %ehcleanup
resume { i8*, i32 } %exc1
cond.false: ; preds = %entry
- %tmp4 = getelementptr inbounds %class.RuleBasedBreakIterator* %this, i32 0, i32 0 ; <i64 ()**> [#uses=1]
- %tmp5 = load i64 ()** %tmp4 ; <i64 ()*> [#uses=1]
+ %tmp4 = getelementptr inbounds %class.RuleBasedBreakIterator, %class.RuleBasedBreakIterator* %this, i32 0, i32 0 ; <i64 ()**> [#uses=1]
+ %tmp5 = load i64 ()*, i64 ()** %tmp4 ; <i64 ()*> [#uses=1]
%call = invoke i64 %tmp5()
to label %cond.end unwind label %ehcleanup ; <i64> [#uses=1]
@@ -242,10 +242,10 @@ entry:
; PR6503
define void @test12(i32* %A) nounwind {
entry:
- %tmp1 = load i32* %A
+ %tmp1 = load i32, i32* %A
%cmp = icmp ugt i32 1, %tmp1 ; <i1> [#uses=1]
%conv = zext i1 %cmp to i32 ; <i32> [#uses=1]
- %tmp2 = load i32* %A
+ %tmp2 = load i32, i32* %A
%cmp3 = icmp ne i32 %tmp2, 0 ; <i1> [#uses=1]
%conv4 = zext i1 %cmp3 to i32 ; <i32> [#uses=1]
%or = or i32 %conv, %conv4 ; <i32> [#uses=1]
@@ -258,10 +258,10 @@ entry:
%s2 = type { i64 }
define void @test13() nounwind ssp {
entry:
- %0 = getelementptr inbounds %s1* null, i64 0, i32 2, i64 0, i32 0
+ %0 = getelementptr inbounds %s1, %s1* null, i64 0, i32 2, i64 0, i32 0
%1 = bitcast i64* %0 to i32*
- %2 = getelementptr inbounds %s1* null, i64 0, i32 2, i64 1, i32 0
- %.pre = load i32* %1, align 8
+ %2 = getelementptr inbounds %s1, %s1* null, i64 0, i32 2, i64 1, i32 0
+ %.pre = load i32, i32* %1, align 8
%3 = lshr i32 %.pre, 19
%brmerge = or i1 undef, undef
%4 = and i32 %3, 3
@@ -269,7 +269,7 @@ entry:
%6 = shl i32 %5, 19
%7 = add i32 %6, 1572864
%8 = and i32 %7, 1572864
- %9 = load i64* %2, align 8
+ %9 = load i64, i64* %2, align 8
%trunc156 = trunc i64 %9 to i32
%10 = and i32 %trunc156, -1537
%11 = and i32 %10, -6145
@@ -304,7 +304,7 @@ entry:
define void @test15(i32* %p_92) nounwind {
entry:
-%0 = load i32* %p_92, align 4
+%0 = load i32, i32* %p_92, align 4
%1 = icmp ne i32 %0, 0
%2 = zext i1 %1 to i32
%3 = call i32 @func_14() nounwind
@@ -349,7 +349,7 @@ define double @test16(i32 %a) nounwind {
define %struct.basic_ios *@test17() ssp {
entry:
- %add.ptr.i = getelementptr i8* null, i64 undef
+ %add.ptr.i = getelementptr i8, i8* null, i64 undef
%0 = bitcast i8* %add.ptr.i to %struct.basic_ios*
ret %struct.basic_ios* %0
}
diff --git a/test/Transforms/InstCombine/debug-line.ll b/test/Transforms/InstCombine/debug-line.ll
index 1946576183c4f..823ec98ebe2b4 100644
--- a/test/Transforms/InstCombine/debug-line.ll
+++ b/test/Transforms/InstCombine/debug-line.ll
@@ -5,7 +5,7 @@
define void @foo() nounwind ssp {
;CHECK: call i32 @putchar{{.+}} !dbg
- %1 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i32 97), !dbg !5
+ %1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i32 97), !dbg !5
ret void, !dbg !7
}
@@ -15,14 +15,14 @@ declare i32 @printf(i8*, ...)
!llvm.module.flags = !{!10}
!llvm.dbg.sp = !{!0}
-!0 = !{!"0x2e\00foo\00foo\00\004\000\001\000\006\000\000\000", !8, !1, !3, null, void ()* @foo, null, null, null} ; [ DW_TAG_subprogram ]
-!1 = !{!"0x29", !8} ; [ DW_TAG_file_type ]
-!2 = !{!"0x11\0012\00clang\001\00\000\00\000", !8, !4, !4, !9, null, null} ; [ DW_TAG_compile_unit ]
-!3 = !{!"0x15\00\000\000\000\000\000\000", !8, !1, null, !4, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
+!0 = !DISubprogram(name: "foo", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !8, scope: !1, type: !3, function: void ()* @foo)
+!1 = !DIFile(filename: "m.c", directory: "/private/tmp")
+!2 = !DICompileUnit(language: DW_LANG_C99, producer: "clang", isOptimized: true, emissionKind: 0, file: !8, enums: !{}, retainedTypes: !{}, subprograms: !9)
+!3 = !DISubroutineType(types: !4)
!4 = !{null}
-!5 = !MDLocation(line: 5, column: 2, scope: !6)
-!6 = !{!"0xb\004\0012\000", !8, !0} ; [ DW_TAG_lexical_block ]
-!7 = !MDLocation(line: 6, column: 1, scope: !6)
-!8 = !{!"m.c", !"/private/tmp"}
+!5 = !DILocation(line: 5, column: 2, scope: !6)
+!6 = distinct !DILexicalBlock(line: 4, column: 12, file: !8, scope: !0)
+!7 = !DILocation(line: 6, column: 1, scope: !6)
+!8 = !DIFile(filename: "m.c", directory: "/private/tmp")
!9 = !{!0}
-!10 = !{i32 1, !"Debug Info Version", i32 2}
+!10 = !{i32 1, !"Debug Info Version", i32 3}
diff --git a/test/Transforms/InstCombine/debuginfo.ll b/test/Transforms/InstCombine/debuginfo.ll
index ae72f700039e3..3875bcc9b8c64 100644
--- a/test/Transforms/InstCombine/debuginfo.ll
+++ b/test/Transforms/InstCombine/debuginfo.ll
@@ -14,15 +14,15 @@ entry:
store i8* %__dest, i8** %__dest.addr, align 8
; CHECK-NOT: call void @llvm.dbg.declare
; CHECK: call void @llvm.dbg.value
- call void @llvm.dbg.declare(metadata i8** %__dest.addr, metadata !0, metadata !{}), !dbg !16
+ call void @llvm.dbg.declare(metadata i8** %__dest.addr, metadata !0, metadata !DIExpression()), !dbg !16
store i32 %__val, i32* %__val.addr, align 4
- call void @llvm.dbg.declare(metadata i32* %__val.addr, metadata !7, metadata !{}), !dbg !18
+ call void @llvm.dbg.declare(metadata i32* %__val.addr, metadata !7, metadata !DIExpression()), !dbg !18
store i64 %__len, i64* %__len.addr, align 8
- call void @llvm.dbg.declare(metadata i64* %__len.addr, metadata !9, metadata !{}), !dbg !20
- %tmp = load i8** %__dest.addr, align 8, !dbg !21
- %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
+ call void @llvm.dbg.declare(metadata i64* %__len.addr, metadata !9, metadata !DIExpression()), !dbg !20
+ %tmp = load i8*, i8** %__dest.addr, align 8, !dbg !21
+ %tmp1 = load i32, i32* %__val.addr, align 4, !dbg !21
+ %tmp2 = load i64, i64* %__len.addr, align 8, !dbg !21
+ %tmp3 = load i8*, i8** %__dest.addr, align 8, !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
@@ -31,29 +31,29 @@ entry:
!llvm.dbg.cu = !{!3}
!llvm.module.flags = !{!30}
-!0 = !{!"0x101\00__dest\0016777294\000", !1, !2, !6} ; [ DW_TAG_arg_variable ]
-!1 = !{!"0x2e\00foobar\00foobar\00\0079\001\001\000\006\00256\001\0079", !27, !2, !4, null, i8* (i8*, i32, i64)* @foobar, null, null, !25} ; [ DW_TAG_subprogram ] [line 79] [local] [def] [foobar]
-!2 = !{!"0x29", !27} ; [ DW_TAG_file_type ]
-!3 = !{!"0x11\0012\00clang version 3.0 (trunk 127710)\001\00\000\00\000", !28, !29, !29, !24, null, null} ; [ DW_TAG_compile_unit ]
-!4 = !{!"0x15\00\000\000\000\000\000\000", !27, !2, null, !5, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
+!0 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "__dest", line: 78, arg: 1, scope: !1, file: !2, type: !6)
+!1 = !DISubprogram(name: "foobar", line: 79, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 79, file: !27, scope: !2, type: !4, function: i8* (i8*, i32, i64)* @foobar, variables: !25)
+!2 = !DIFile(filename: "string.h", directory: "Game")
+!3 = !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk 127710)", isOptimized: true, emissionKind: 0, file: !28, enums: !29, retainedTypes: !29, subprograms: !24)
+!4 = !DISubroutineType(types: !5)
!5 = !{!6}
-!6 = !{!"0xf\00\000\0064\0064\000\000", null, !3, null} ; [ DW_TAG_pointer_type ]
-!7 = !{!"0x101\00__val\0033554510\000", !1, !2, !8} ; [ DW_TAG_arg_variable ]
-!8 = !{!"0x24\00int\000\0032\0032\000\000\005", null, !3} ; [ DW_TAG_base_type ]
-!9 = !{!"0x101\00__len\0050331726\000", !1, !2, !10} ; [ DW_TAG_arg_variable ]
-!10 = !{!"0x16\00size_t\0080\000\000\000\000", !27, !3, !11} ; [ DW_TAG_typedef ]
-!11 = !{!"0x16\00__darwin_size_t\0090\000\000\000\000", !27, !3, !12} ; [ DW_TAG_typedef ]
-!12 = !{!"0x24\00long unsigned int\000\0064\0064\000\000\007", null, !3} ; [ DW_TAG_base_type ]
-!16 = !MDLocation(line: 78, column: 28, scope: !1)
-!18 = !MDLocation(line: 78, column: 40, scope: !1)
-!20 = !MDLocation(line: 78, column: 54, scope: !1)
-!21 = !MDLocation(line: 80, column: 3, scope: !22)
-!22 = !{!"0xb\0080\003\007", !27, !23} ; [ DW_TAG_lexical_block ]
-!23 = !{!"0xb\0079\001\006", !27, !1} ; [ DW_TAG_lexical_block ]
+!6 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, scope: !3, baseType: null)
+!7 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "__val", line: 78, arg: 2, scope: !1, file: !2, type: !8)
+!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
+!9 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "__len", line: 78, arg: 3, scope: !1, file: !2, type: !10)
+!10 = !DIDerivedType(tag: DW_TAG_typedef, name: "size_t", line: 80, file: !27, scope: !3, baseType: !11)
+!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "__darwin_size_t", line: 90, file: !27, scope: !3, baseType: !12)
+!12 = !DIBasicType(tag: DW_TAG_base_type, name: "long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned)
+!16 = !DILocation(line: 78, column: 28, scope: !1)
+!18 = !DILocation(line: 78, column: 40, scope: !1)
+!20 = !DILocation(line: 78, column: 54, scope: !1)
+!21 = !DILocation(line: 80, column: 3, scope: !22)
+!22 = distinct !DILexicalBlock(line: 80, column: 3, file: !27, scope: !23)
+!23 = distinct !DILexicalBlock(line: 79, column: 1, file: !27, scope: !1)
!24 = !{!1}
!25 = !{!0, !7, !9}
-!26 = !{!"0x29", !28} ; [ DW_TAG_file_type ]
-!27 = !{!"string.h", !"Game"}
-!28 = !{!"bits.c", !"Game"}
-!29 = !{i32 0}
-!30 = !{i32 1, !"Debug Info Version", i32 2}
+!26 = !DIFile(filename: "bits.c", directory: "Game")
+!27 = !DIFile(filename: "string.h", directory: "Game")
+!28 = !DIFile(filename: "bits.c", directory: "Game")
+!29 = !{}
+!30 = !{i32 1, !"Debug Info Version", i32 3}
diff --git a/test/Transforms/InstCombine/default-alignment.ll b/test/Transforms/InstCombine/default-alignment.ll
new file mode 100644
index 0000000000000..718da2136717b
--- /dev/null
+++ b/test/Transforms/InstCombine/default-alignment.ll
@@ -0,0 +1,10 @@
+; RUN: opt -verify -instcombine < %s
+%Foo = type <{ i8, x86_fp80 }>
+
+define i8 @t(%Foo* %arg) {
+entry:
+ %0 = getelementptr %Foo, %Foo* %arg, i32 0, i32 0
+ %1 = load i8, i8* %0, align 1
+ ret i8 %1
+}
+
diff --git a/test/Transforms/InstCombine/demand_shrink_nsw.ll b/test/Transforms/InstCombine/demand_shrink_nsw.ll
new file mode 100644
index 0000000000000..f491742951670
--- /dev/null
+++ b/test/Transforms/InstCombine/demand_shrink_nsw.ll
@@ -0,0 +1,26 @@
+; RUN: opt -instcombine -o - -S %s | FileCheck %s
+
+; The constant at %v35 should be shrunk, but this must lead to the nsw flag of
+; %v43 getting removed so that %v44 is not illegally optimized away.
+; CHECK-LABEL: @foo
+; CHECK: %v35 = add nuw i32 %v34, 1362915575
+; ...
+; CHECK: add nuw i32 %v42, 1533579450
+; CHECK-NEXT: %v44 = or i32 %v43, -2147483648
+; CHECK-NEXT: %v45 = xor i32 %v44, 749011377
+; CHECK-NEXT: ret i32 %v45
+define i32 @foo(i32 %arg) {
+ %v33 = and i32 %arg, 223
+ %v34 = xor i32 %v33, 29
+ %v35 = add nuw i32 %v34, 3510399223
+ %v37 = or i32 %v34, 1874836915
+ %v38 = and i32 %v34, 221
+ %v39 = xor i32 %v38, 1874836915
+ %v40 = xor i32 %v37, %v39
+ %v41 = shl nsw nuw i32 %v40, 1
+ %v42 = sub i32 %v35, %v41
+ %v43 = add nsw i32 %v42, 1533579450
+ %v44 = or i32 %v43, -2147483648
+ %v45 = xor i32 %v44, 749011377
+ ret i32 %v45
+}
diff --git a/test/Transforms/InstCombine/descale-zero.ll b/test/Transforms/InstCombine/descale-zero.ll
deleted file mode 100644
index 4656837cc05ed..0000000000000
--- a/test/Transforms/InstCombine/descale-zero.ll
+++ /dev/null
@@ -1,20 +0,0 @@
-; RUN: opt < %s -instcombine -S | FileCheck %s
-
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.10.0"
-
-define internal i8* @descale_zero() {
-entry:
-; CHECK: load i8** inttoptr (i64 48 to i8**), align 16
-; CHECK-NEXT: ret i8*
- %i16_ptr = load i16** inttoptr (i64 48 to i16**), align 16
- %num = load i64* inttoptr (i64 64 to i64*), align 64
- %num_times_2 = shl i64 %num, 1
- %num_times_2_plus_4 = add i64 %num_times_2, 4
- %i8_ptr = bitcast i16* %i16_ptr to i8*
- %i8_ptr_num_times_2_plus_4 = getelementptr i8* %i8_ptr, i64 %num_times_2_plus_4
- %num_times_neg2 = mul i64 %num, -2
- %num_times_neg2_minus_4 = add i64 %num_times_neg2, -4
- %addr = getelementptr i8* %i8_ptr_num_times_2_plus_4, i64 %num_times_neg2_minus_4
- ret i8* %addr
-}
diff --git a/test/Transforms/InstCombine/disable-simplify-libcalls.ll b/test/Transforms/InstCombine/disable-simplify-libcalls.ll
index 6652788617917..e25ce31cbfbf0 100644
--- a/test/Transforms/InstCombine/disable-simplify-libcalls.ll
+++ b/test/Transforms/InstCombine/disable-simplify-libcalls.ll
@@ -87,7 +87,7 @@ define double @t5(double %x) {
define i8* @t6(i8* %x) {
; CHECK-LABEL: @t6(
- %empty = getelementptr [1 x i8]* @empty, i32 0, i32 0
+ %empty = getelementptr [1 x i8], [1 x i8]* @empty, i32 0, i32 0
%ret = call i8* @strcat(i8* %x, i8* %empty)
ret i8* %ret
; CHECK: call i8* @strcat
@@ -95,7 +95,7 @@ define i8* @t6(i8* %x) {
define i8* @t7(i8* %x) {
; CHECK-LABEL: @t7(
- %empty = getelementptr [1 x i8]* @empty, i32 0, i32 0
+ %empty = getelementptr [1 x i8], [1 x i8]* @empty, i32 0, i32 0
%ret = call i8* @strncat(i8* %x, i8* %empty, i32 1)
ret i8* %ret
; CHECK: call i8* @strncat
@@ -103,7 +103,7 @@ define i8* @t7(i8* %x) {
define i8* @t8() {
; CHECK-LABEL: @t8(
- %x = getelementptr inbounds [13 x i8]* @.str1, i32 0, i32 0
+ %x = getelementptr inbounds [13 x i8], [13 x i8]* @.str1, i32 0, i32 0
%ret = call i8* @strchr(i8* %x, i32 119)
ret i8* %ret
; CHECK: call i8* @strchr
@@ -111,7 +111,7 @@ define i8* @t8() {
define i8* @t9() {
; CHECK-LABEL: @t9(
- %x = getelementptr inbounds [13 x i8]* @.str1, i32 0, i32 0
+ %x = getelementptr inbounds [13 x i8], [13 x i8]* @.str1, i32 0, i32 0
%ret = call i8* @strrchr(i8* %x, i32 119)
ret i8* %ret
; CHECK: call i8* @strrchr
@@ -119,8 +119,8 @@ define i8* @t9() {
define i32 @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
+ %x = getelementptr inbounds [4 x i8], [4 x i8]* @.str2, i32 0, i32 0
+ %y = getelementptr inbounds [4 x i8], [4 x i8]* @.str3, i32 0, i32 0
%ret = call i32 @strcmp(i8* %x, i8* %y)
ret i32 %ret
; CHECK: call i32 @strcmp
@@ -128,8 +128,8 @@ define i32 @t10() {
define i32 @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
+ %x = getelementptr inbounds [4 x i8], [4 x i8]* @.str2, i32 0, i32 0
+ %y = getelementptr inbounds [4 x i8], [4 x i8]* @.str3, i32 0, i32 0
%ret = call i32 @strncmp(i8* %x, i8* %y, i64 3)
ret i32 %ret
; CHECK: call i32 @strncmp
@@ -137,7 +137,7 @@ define i32 @t11() {
define i8* @t12(i8* %x) {
; CHECK-LABEL: @t12(
- %y = getelementptr inbounds [4 x i8]* @.str2, i32 0, i32 0
+ %y = getelementptr inbounds [4 x i8], [4 x i8]* @.str2, i32 0, i32 0
%ret = call i8* @strcpy(i8* %x, i8* %y)
ret i8* %ret
; CHECK: call i8* @strcpy
@@ -145,7 +145,7 @@ define i8* @t12(i8* %x) {
define i8* @t13(i8* %x) {
; CHECK-LABEL: @t13(
- %y = getelementptr inbounds [4 x i8]* @.str2, i32 0, i32 0
+ %y = getelementptr inbounds [4 x i8], [4 x i8]* @.str2, i32 0, i32 0
%ret = call i8* @stpcpy(i8* %x, i8* %y)
ret i8* %ret
; CHECK: call i8* @stpcpy
@@ -153,7 +153,7 @@ define i8* @t13(i8* %x) {
define i8* @t14(i8* %x) {
; CHECK-LABEL: @t14(
- %y = getelementptr inbounds [4 x i8]* @.str2, i32 0, i32 0
+ %y = getelementptr inbounds [4 x i8], [4 x i8]* @.str2, i32 0, i32 0
%ret = call i8* @strncpy(i8* %x, i8* %y, i64 3)
ret i8* %ret
; CHECK: call i8* @strncpy
@@ -161,7 +161,7 @@ define i8* @t14(i8* %x) {
define i64 @t15() {
; CHECK-LABEL: @t15(
- %x = getelementptr inbounds [4 x i8]* @.str2, i32 0, i32 0
+ %x = getelementptr inbounds [4 x i8], [4 x i8]* @.str2, i32 0, i32 0
%ret = call i64 @strlen(i8* %x)
ret i64 %ret
; CHECK: call i64 @strlen
@@ -169,7 +169,7 @@ define i64 @t15() {
define i8* @t16(i8* %x) {
; CHECK-LABEL: @t16(
- %y = getelementptr inbounds [1 x i8]* @.str, i32 0, i32 0
+ %y = getelementptr inbounds [1 x i8], [1 x i8]* @.str, i32 0, i32 0
%ret = call i8* @strpbrk(i8* %x, i8* %y)
ret i8* %ret
; CHECK: call i8* @strpbrk
@@ -177,7 +177,7 @@ define i8* @t16(i8* %x) {
define i64 @t17(i8* %x) {
; CHECK-LABEL: @t17(
- %y = getelementptr inbounds [1 x i8]* @.str, i32 0, i32 0
+ %y = getelementptr inbounds [1 x i8], [1 x i8]* @.str, i32 0, i32 0
%ret = call i64 @strspn(i8* %x, i8* %y)
ret i64 %ret
; CHECK: call i64 @strspn
@@ -185,7 +185,7 @@ define i64 @t17(i8* %x) {
define double @t18(i8** %y) {
; CHECK-LABEL: @t18(
- %x = getelementptr inbounds [6 x i8]* @.str4, i64 0, i64 0
+ %x = getelementptr inbounds [6 x i8], [6 x i8]* @.str4, i64 0, i64 0
%ret = call double @strtod(i8* %x, i8** %y)
ret double %ret
; CHECK: call double @strtod
@@ -193,7 +193,7 @@ define double @t18(i8** %y) {
define float @t19(i8** %y) {
; CHECK-LABEL: @t19(
- %x = getelementptr inbounds [6 x i8]* @.str4, i64 0, i64 0
+ %x = getelementptr inbounds [6 x i8], [6 x i8]* @.str4, i64 0, i64 0
%ret = call float @strtof(i8* %x, i8** %y)
ret float %ret
; CHECK: call float @strtof
@@ -201,7 +201,7 @@ define float @t19(i8** %y) {
define x86_fp80 @t20(i8** %y) {
; CHECK-LABEL: @t20(
- %x = getelementptr inbounds [6 x i8]* @.str4, i64 0, i64 0
+ %x = getelementptr inbounds [6 x i8], [6 x i8]* @.str4, i64 0, i64 0
%ret = call x86_fp80 @strtold(i8* %x, i8** %y)
ret x86_fp80 %ret
; CHECK: call x86_fp80 @strtold
@@ -209,7 +209,7 @@ define x86_fp80 @t20(i8** %y) {
define i64 @t21(i8** %y) {
; CHECK-LABEL: @t21(
- %x = getelementptr inbounds [5 x i8]* @.str5, i64 0, i64 0
+ %x = getelementptr inbounds [5 x i8], [5 x i8]* @.str5, i64 0, i64 0
%ret = call i64 @strtol(i8* %x, i8** %y, i32 10)
ret i64 %ret
; CHECK: call i64 @strtol
@@ -217,7 +217,7 @@ define i64 @t21(i8** %y) {
define i64 @t22(i8** %y) {
; CHECK-LABEL: @t22(
- %x = getelementptr inbounds [5 x i8]* @.str5, i64 0, i64 0
+ %x = getelementptr inbounds [5 x i8], [5 x i8]* @.str5, i64 0, i64 0
%ret = call i64 @strtoll(i8* %x, i8** %y, i32 10)
ret i64 %ret
; CHECK: call i64 @strtoll
@@ -225,7 +225,7 @@ define i64 @t22(i8** %y) {
define i64 @t23(i8** %y) {
; CHECK-LABEL: @t23(
- %x = getelementptr inbounds [5 x i8]* @.str5, i64 0, i64 0
+ %x = getelementptr inbounds [5 x i8], [5 x i8]* @.str5, i64 0, i64 0
%ret = call i64 @strtoul(i8* %x, i8** %y, i32 10)
ret i64 %ret
; CHECK: call i64 @strtoul
@@ -233,7 +233,7 @@ define i64 @t23(i8** %y) {
define i64 @t24(i8** %y) {
; CHECK-LABEL: @t24(
- %x = getelementptr inbounds [5 x i8]* @.str5, i64 0, i64 0
+ %x = getelementptr inbounds [5 x i8], [5 x i8]* @.str5, i64 0, i64 0
%ret = call i64 @strtoull(i8* %x, i8** %y, i32 10)
ret i64 %ret
; CHECK: call i64 @strtoull
@@ -241,7 +241,7 @@ define i64 @t24(i8** %y) {
define i64 @t25(i8* %y) {
; CHECK-LABEL: @t25(
- %x = getelementptr [1 x i8]* @empty, i32 0, i32 0
+ %x = getelementptr [1 x i8], [1 x i8]* @empty, i32 0, i32 0
%ret = call i64 @strcspn(i8* %x, i8* %y)
ret i64 %ret
; CHECK: call i64 @strcspn
@@ -277,7 +277,7 @@ define i32 @t29(i64 %y) {
define void @t30() {
; CHECK-LABEL: @t30(
- %x = getelementptr inbounds [13 x i8]* @.str1, i32 0, i32 0
+ %x = getelementptr inbounds [13 x i8], [13 x i8]* @.str1, i32 0, i32 0
call i32 @fprintf(i8* null, i8* %x)
ret void
; CHECK: call i32 @fprintf
@@ -320,7 +320,7 @@ define i64 @t35(i64 %y) {
define void @t36() {
; CHECK-LABEL: @t36(
- %x = getelementptr inbounds [1 x i8]* @empty, i32 0, i32 0
+ %x = getelementptr inbounds [1 x i8], [1 x i8]* @empty, i32 0, i32 0
call i32 @printf(i8* %x)
ret void
; CHECK: call i32 @printf
@@ -328,7 +328,7 @@ define void @t36() {
define void @t37(i8* %x) {
; CHECK-LABEL: @t37(
- %y = getelementptr inbounds [13 x i8]* @.str1, i32 0, i32 0
+ %y = getelementptr inbounds [13 x i8], [13 x i8]* @.str1, i32 0, i32 0
call i32 @sprintf(i8* %x, i8* %y)
ret void
; CHECK: call i32 @sprintf
diff --git a/test/Transforms/InstCombine/div-shift-crash.ll b/test/Transforms/InstCombine/div-shift-crash.ll
index a619724564033..936173cd6d489 100644
--- a/test/Transforms/InstCombine/div-shift-crash.ll
+++ b/test/Transforms/InstCombine/div-shift-crash.ll
@@ -14,7 +14,7 @@ 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
+ %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, %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
@@ -39,7 +39,7 @@ 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
+ %l_8191.sroa.0.0.copyload.i.i = load i64, 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
diff --git a/test/Transforms/InstCombine/dom-conditions.ll b/test/Transforms/InstCombine/dom-conditions.ll
new file mode 100644
index 0000000000000..4264043526814
--- /dev/null
+++ b/test/Transforms/InstCombine/dom-conditions.ll
@@ -0,0 +1,152 @@
+; RUN: opt -instcombine -value-tracking-dom-conditions=1 -S < %s | FileCheck %s
+
+target datalayout = "e-p:64:64:64-p1:16:16:16-p2:32:32:32-p3: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 i1 @test_cmp_ult(i64 %A) {
+; CHECK-LABEL: @test_cmp_ult
+entry:
+ %cmp = icmp ult i64 %A, 64
+ br i1 %cmp, label %taken, label %untaken
+
+taken:
+; CHECK-LABEL: taken:
+; CHECK-NEXT: ret i1 false
+ %cmp2 = icmp ugt i64 %A, 64
+ ret i1 %cmp2
+untaken:
+ ret i1 true
+}
+
+define i1 @test_cmp_ule(i64 %A) {
+; CHECK-LABEL: @test_cmp_ule
+entry:
+ %cmp = icmp ule i64 %A, 64
+ br i1 %cmp, label %taken, label %untaken
+
+taken:
+; CHECK-LABEL: taken:
+; CHECK-NEXT: ret i1 false
+ %cmp2 = icmp ugt i64 %A, 128
+ ret i1 %cmp2
+untaken:
+ ret i1 true
+}
+
+define i1 @test_cmp_sgt(i32 %A) {
+; CHECK-LABEL: @test_cmp_sgt
+entry:
+ %cmp = icmp sgt i32 %A, 10
+ br i1 %cmp, label %taken, label %untaken
+
+taken:
+; CHECK-LABEL: taken:
+; CHECK-NEXT: ret i1 true
+ %cmp2 = icmp sgt i32 %A, -1
+ ret i1 %cmp2
+untaken:
+ ret i1 true
+}
+
+define i64 @test_add_zero_bits(i64 %A) {
+; CHECK-LABEL: @test_add_zero_bits
+entry:
+ %cmp = icmp eq i64 %A, 2
+ br i1 %cmp, label %taken, label %untaken
+
+taken:
+; CHECK-LABEL: taken:
+; CHECK-NEXT: ret i64 3
+ %add = add i64 %A, 1
+ ret i64 %add
+untaken:
+ ret i64 %A
+}
+
+define i64 @test_add_nsw(i64 %A) {
+; CHECK-LABEL: @test_add_nsw
+entry:
+ %cmp = icmp ult i64 %A, 20
+ br i1 %cmp, label %taken, label %untaken
+
+taken:
+; CHECK-LABEL: taken:
+; CHECK-NEXT: %add = add nuw nsw i64 %A, 1
+; CHECK-NEXT: ret i64 %add
+ %add = add i64 %A, 1
+ ret i64 %add
+untaken:
+ ret i64 %A
+}
+
+; After sinking the instructions into the if block, check that we
+; can simplify some of them using dominating conditions.
+define i32 @test_add_zero_bits_sink(i32 %x) nounwind ssp {
+; CHECK-LABEL: @test_add_zero_bits_sink(
+; CHECK-NOT: sdiv i32
+entry:
+ %a = add nsw i32 %x, 16
+ %b = sdiv i32 %a, %x
+ %cmp = icmp ult i32 %x, 7
+ br i1 %cmp, label %bb1, label %bb2
+
+bb1:
+; CHECK-LABEL: bb1:
+; CHECK-NEXT: or i32 %x, 16
+; CHECK-NEXT: udiv i32
+ ret i32 %b
+
+bb2:
+ ret i32 %x
+}
+
+; A condition in the same block gives no information
+define i32 @test_neg1(i32 %x) nounwind ssp {
+; CHECK-LABEL: @test_neg1
+; CHECK: add
+; CHECK: sdiv
+; CHECK: icmp
+; CHECK: select
+entry:
+ %a = add nsw i32 %x, 16
+ %b = sdiv i32 %a, %x
+ %cmp = icmp ult i32 %x, 7
+ %ret = select i1 %cmp, i32 %a, i32 %b
+ ret i32 %ret
+}
+
+; A non-dominating edge gives no information
+define i32 @test_neg2(i32 %x) {
+; CHECK-LABEL: @test_neg2
+entry:
+ %cmp = icmp ult i32 %x, 7
+ br i1 %cmp, label %bb1, label %merge
+
+bb1:
+ br label %merge
+
+merge:
+; CHECK-LABEL: merge:
+; CHECK: icmp
+; CHECK: select
+ %cmp2 = icmp ult i32 %x, 7
+ %ret = select i1 %cmp2, i32 %x, i32 0
+ ret i32 %ret
+}
+
+; A unconditional branch expressed as a condition one gives no
+; information (and shouldn't trip any asserts.)
+define i32 @test_neg3(i32 %x) {
+; CHECK-LABEL: @test_neg3
+entry:
+ %cmp = icmp ult i32 %x, 7
+ br i1 %cmp, label %merge, label %merge
+merge:
+; CHECK-LABEL: merge:
+; CHECK: icmp
+; CHECK: select
+ %cmp2 = icmp ult i32 %x, 7
+ %ret = select i1 %cmp2, i32 %x, i32 0
+ ret i32 %ret
+}
+
+declare i32 @bar()
diff --git a/test/Transforms/InstCombine/enforce-known-alignment.ll b/test/Transforms/InstCombine/enforce-known-alignment.ll
index 46bb60569fe2b..323a7ec2998cb 100644
--- a/test/Transforms/InstCombine/enforce-known-alignment.ll
+++ b/test/Transforms/InstCombine/enforce-known-alignment.ll
@@ -8,12 +8,12 @@ define void @foo(i32) {
; 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]
- %5 = getelementptr { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } }* %4, i32 0, i32 0 ; <{ [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 } } }>], [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 } } }>, <{ { { [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]
+ %5 = getelementptr { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } }, { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } }* %4, i32 0, i32 0 ; <{ [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 }*> [#uses=1]
%6 = bitcast { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 }* %5 to { [8 x i16] }* ; <{ [8 x i16] }*> [#uses=1]
- %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]
+ %7 = getelementptr { [8 x i16] }, { [8 x i16] }* %6, i32 0, i32 0 ; <[8 x i16]*> [#uses=1]
+ %8 = getelementptr [8 x i16], [8 x i16]* %7, i32 0, i32 0 ; <i16*> [#uses=1]
store i16 0, i16* %8, align 16
call void @bar(i16* %8)
ret void
@@ -24,12 +24,12 @@ 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]
+ %1 = getelementptr [3 x <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>], [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 } } }>, <{ { { [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 } }, { { [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]
+ %5 = getelementptr { [8 x i16] }, { [8 x i16] } addrspace(1)* %4, i32 0, i32 0 ; <[8 x i16]*> [#uses=1]
+ %6 = getelementptr [8 x i16], [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
diff --git a/test/Transforms/InstCombine/err-rep-cold.ll b/test/Transforms/InstCombine/err-rep-cold.ll
index 0cbafc43e0f65..6c4e4e1ccb010 100644
--- a/test/Transforms/InstCombine/err-rep-cold.ll
+++ b/test/Transforms/InstCombine/err-rep-cold.ll
@@ -18,11 +18,11 @@ entry:
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
+ %0 = load %struct._IO_FILE*, %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], [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]+]]
+; CHECK: %call = tail call i32 (%struct._IO_FILE*, i8*, ...) @fprintf(%struct._IO_FILE* %0, i8* getelementptr inbounds ([13 x i8], [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 ]
@@ -38,11 +38,11 @@ entry:
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)
+ %0 = load %struct._IO_FILE*, %struct._IO_FILE** @stderr, align 8
+ %1 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [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]+]]
+; CHECK: tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [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 ]
@@ -58,11 +58,11 @@ entry:
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)
+ %0 = load %struct._IO_FILE*, %struct._IO_FILE** @stdout, align 8
+ %1 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [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]]
+; CHECK-NOT: tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [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 ]
diff --git a/test/Transforms/InstCombine/extractvalue.ll b/test/Transforms/InstCombine/extractvalue.ll
index 04c7ffa219dae..6319590873a2f 100644
--- a/test/Transforms/InstCombine/extractvalue.ll
+++ b/test/Transforms/InstCombine/extractvalue.ll
@@ -13,7 +13,7 @@ define i32 @foo(i32 %a, i32 %b) {
%s1 = insertvalue {i32, i32} %s1.1, i32 %b, 1
%v1 = extractvalue {i32, i32} %s1, 0
%v2 = extractvalue {i32, i32} %s1, 1
-
+
; Build a nested struct and pull a sub struct out of it
; This requires instcombine to insert a few insertvalue instructions
%ns1.1 = insertvalue {i32, {i32, i32}} undef, i32 %v1, 0
@@ -40,8 +40,8 @@ define i32 @foo(i32 %a, i32 %b) {
}
; 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: [[GEP:%[a-z0-9]+]] = getelementptr inbounds {{.*}}, {{.*}}* %pair, i64 0, i32 1
+; CHECK-NEXT: [[LOAD:%[A-Za-z0-9]+]] = load i32, i32* [[GEP]]
; CHECK-NEXT: store
; CHECK-NEXT: br label %loop
; CHECK-NOT: extractvalue
@@ -52,7 +52,7 @@ define i32 @extract2gep({i32, i32}* %pair, i32* %P) {
; The load + extractvalue should be converted
; to an inbounds gep + smaller load.
; The new load should be in the same spot as the old load.
- %L = load {i32, i32}* %pair
+ %L = load {i32, i32}, {i32, i32}* %pair
store i32 0, i32* %P
br label %loop
@@ -68,13 +68,13 @@ end:
}
; 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: [[GEP:%[a-z0-9]+]] = getelementptr inbounds {{.*}}, {{.*}}* %arg, i64 0, i32 1, i32 1
+; CHECK-NEXT: [[LOAD:%[A-Za-z0-9]+]] = load i32, i32* [[GEP]]
; CHECK-NEXT: ret i32 [[LOAD]]
define i32 @doubleextract2gep({i32, {i32, i32}}* %arg) {
; The load + extractvalues should be converted
; to a 3-index inbounds gep + smaller load.
- %L = load {i32, {i32, i32}}* %arg
+ %L = load {i32, {i32, i32}}, {i32, {i32, i32}}* %arg
%E1 = extractvalue {i32, {i32, i32}} %L, 1
%E2 = extractvalue {i32, i32} %E1, 1
ret i32 %E2
@@ -88,7 +88,7 @@ define i32 @doubleextract2gep({i32, {i32, i32}}* %arg) {
; CHECK-NEXT: ret
define i32 @nogep-multiuse({i32, i32}* %pair) {
; The load should be left unchanged since both parts are needed.
- %L = load volatile {i32, i32}* %pair
+ %L = load volatile {i32, i32}, {i32, i32}* %pair
%LHS = extractvalue {i32, i32} %L, 0
%RHS = extractvalue {i32, i32} %L, 1
%R = add i32 %LHS, %RHS
@@ -101,7 +101,7 @@ define i32 @nogep-multiuse({i32, i32}* %pair) {
; CHECK-NEXT: ret
define i32 @nogep-volatile({i32, i32}* %pair) {
; The load volatile should be left unchanged.
- %L = load volatile {i32, i32}* %pair
+ %L = load volatile {i32, i32}, {i32, i32}* %pair
%E = extractvalue {i32, i32} %L, 1
ret i32 %E
}
diff --git a/test/Transforms/InstCombine/fast-math.ll b/test/Transforms/InstCombine/fast-math.ll
index c6081c3992532..4eebdbdfacf1e 100644
--- a/test/Transforms/InstCombine/fast-math.ll
+++ b/test/Transforms/InstCombine/fast-math.ll
@@ -267,6 +267,14 @@ define <4 x float> @fmul3_vec(<4 x float> %f1, <4 x float> %f2) {
; CHECK: fmul fast <4 x float> %f1, <float 3.000000e+00, float 2.000000e+00, float 1.000000e+00, float 1.000000e+00>
}
+; Make sure fmul with constant expression doesn't assert.
+define <4 x float> @fmul3_vec_constexpr(<4 x float> %f1, <4 x float> %f2) {
+ %constExprMul = bitcast i128 trunc (i160 bitcast (<5 x float> <float 6.0e+3, float 6.0e+3, float 2.0e+3, float 1.0e+3, float undef> to i160) to i128) to <4 x float>
+ %t1 = fdiv <4 x float> %f1, <float 2.0e+3, float 3.0e+3, float 2.0e+3, float 1.0e+3>
+ %t3 = fmul fast <4 x float> %t1, %constExprMul
+ ret <4 x float> %t3
+}
+
; Rule "X/C1 * C2 => X * (C2/C1) is not applicable if C2/C1 is either a special
; value of a denormal. The 0x3810000000000000 here take value FLT_MIN
;
diff --git a/test/Transforms/InstCombine/fcmp.ll b/test/Transforms/InstCombine/fcmp.ll
index ee39d1084ebcb..7fd46f2281832 100644
--- a/test/Transforms/InstCombine/fcmp.ll
+++ b/test/Transforms/InstCombine/fcmp.ll
@@ -240,3 +240,38 @@ define i32 @test17(double %a, double (double)* %p) nounwind {
%conv = zext i1 %cmp to i32
ret i32 %conv
}
+
+; Can fold fcmp with undef on one side by choosing NaN for the undef
+define i32 @test18_undef_unordered(float %a) nounwind {
+; CHECK-LABEL: @test18_undef_unordered
+; CHECK: ret i32 1
+ %cmp = fcmp ueq float %a, undef
+ %conv = zext i1 %cmp to i32
+ ret i32 %conv
+}
+; Can fold fcmp with undef on one side by choosing NaN for the undef
+define i32 @test18_undef_ordered(float %a) nounwind {
+; CHECK-LABEL: @test18_undef_ordered
+; CHECK: ret i32 0
+ %cmp = fcmp oeq float %a, undef
+ %conv = zext i1 %cmp to i32
+ ret i32 %conv
+}
+
+; Can fold fcmp with undef on both side
+; fcmp u_pred undef, undef -> true
+; fcmp o_pred undef, undef -> false
+; because whatever you choose for the first undef
+; you can choose NaN for the other undef
+define i1 @test19_undef_unordered() nounwind {
+; CHECK-LABEL: @test19_undef
+; CHECK: ret i1 true
+ %cmp = fcmp ueq float undef, undef
+ ret i1 %cmp
+}
+define i1 @test19_undef_ordered() nounwind {
+; CHECK-LABEL: @test19_undef
+; CHECK: ret i1 false
+ %cmp = fcmp oeq float undef, undef
+ ret i1 %cmp
+}
diff --git a/test/Transforms/InstCombine/fmul.ll b/test/Transforms/InstCombine/fmul.ll
index a776765ac2ca1..ac3000fc05149 100644
--- a/test/Transforms/InstCombine/fmul.ll
+++ b/test/Transforms/InstCombine/fmul.ll
@@ -74,7 +74,7 @@ define float @test7(float %x, float %y) {
; 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
+ %0 = load i32, 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
diff --git a/test/Transforms/InstCombine/fold-vector-zero.ll b/test/Transforms/InstCombine/fold-vector-zero.ll
index e1d86b6cd07cb..bf661df7795dd 100644
--- a/test/Transforms/InstCombine/fold-vector-zero.ll
+++ b/test/Transforms/InstCombine/fold-vector-zero.ll
@@ -9,7 +9,7 @@ bb30:
%l0 = phi i64 [ -2222, %bb8 ], [ %r23, %bb30 ]
%r2 = add i64 %s0, %B
%r3 = inttoptr i64 %r2 to <2 x double>*
- %r4 = load <2 x double>* %r3, align 8
+ %r4 = load <2 x double>, <2 x double>* %r3, align 8
%r6 = bitcast <2 x double> %r4 to <2 x i64>
%r7 = bitcast <2 x double> zeroinitializer to <2 x i64>
%r8 = insertelement <2 x i64> undef, i64 9223372036854775807, i32 0
diff --git a/test/Transforms/InstCombine/fp-ret-bitcast.ll b/test/Transforms/InstCombine/fp-ret-bitcast.ll
index b2fbc0b882db6..7106933d2bde0 100644
--- a/test/Transforms/InstCombine/fp-ret-bitcast.ll
+++ b/test/Transforms/InstCombine/fp-ret-bitcast.ll
@@ -13,11 +13,11 @@ define void @bork() nounwind {
entry:
%color = alloca %struct.NSArray*
%color.466 = alloca %struct.NSObject*
- %tmp103 = load %struct.NSArray** %color, align 4
- %tmp103104 = getelementptr %struct.NSArray* %tmp103, i32 0, i32 0
+ %tmp103 = load %struct.NSArray*, %struct.NSArray** %color, align 4
+ %tmp103104 = getelementptr %struct.NSArray, %struct.NSArray* %tmp103, i32 0, i32 0
store %struct.NSObject* %tmp103104, %struct.NSObject** %color.466, align 4
- %tmp105 = load %struct.objc_selector** @"\01L_OBJC_SELECTOR_REFERENCES_81", align 4
- %tmp106 = load %struct.NSObject** %color.466, align 4
+ %tmp105 = load %struct.objc_selector*, %struct.objc_selector** @"\01L_OBJC_SELECTOR_REFERENCES_81", align 4
+ %tmp106 = load %struct.NSObject*, %struct.NSObject** %color.466, align 4
%tmp107 = call float bitcast (void (%struct.NSObject*, ...)* @objc_msgSend_fpret to float (%struct.NSObject*, %struct.objc_selector*)*)( %struct.NSObject* %tmp106, %struct.objc_selector* %tmp105 ) nounwind
br label %exit
diff --git a/test/Transforms/InstCombine/fpextend.ll b/test/Transforms/InstCombine/fpextend.ll
index 8640cd2b6f5c5..775caadb45a43 100644
--- a/test/Transforms/InstCombine/fpextend.ll
+++ b/test/Transforms/InstCombine/fpextend.ll
@@ -5,7 +5,7 @@
define void @test() nounwind {
entry:
- %tmp = load float* @X, align 4 ; <float> [#uses=1]
+ %tmp = load float, float* @X, align 4 ; <float> [#uses=1]
%tmp1 = fpext float %tmp to double ; <double> [#uses=1]
%tmp3 = fadd double %tmp1, 0.000000e+00 ; <double> [#uses=1]
%tmp34 = fptrunc double %tmp3 to float ; <float> [#uses=1]
@@ -15,9 +15,9 @@ entry:
define void @test2() nounwind {
entry:
- %tmp = load float* @X, align 4 ; <float> [#uses=1]
+ %tmp = load float, float* @X, align 4 ; <float> [#uses=1]
%tmp1 = fpext float %tmp to double ; <double> [#uses=1]
- %tmp2 = load float* @Y, align 4 ; <float> [#uses=1]
+ %tmp2 = load float, float* @Y, align 4 ; <float> [#uses=1]
%tmp23 = fpext float %tmp2 to double ; <double> [#uses=1]
%tmp5 = fmul double %tmp1, %tmp23 ; <double> [#uses=1]
%tmp56 = fptrunc double %tmp5 to float ; <float> [#uses=1]
@@ -27,9 +27,9 @@ entry:
define void @test3() nounwind {
entry:
- %tmp = load float* @X, align 4 ; <float> [#uses=1]
+ %tmp = load float, float* @X, align 4 ; <float> [#uses=1]
%tmp1 = fpext float %tmp to double ; <double> [#uses=1]
- %tmp2 = load float* @Y, align 4 ; <float> [#uses=1]
+ %tmp2 = load float, float* @Y, align 4 ; <float> [#uses=1]
%tmp23 = fpext float %tmp2 to double ; <double> [#uses=1]
%tmp5 = fdiv double %tmp1, %tmp23 ; <double> [#uses=1]
%tmp56 = fptrunc double %tmp5 to float ; <float> [#uses=1]
@@ -39,7 +39,7 @@ entry:
define void @test4() nounwind {
entry:
- %tmp = load float* @X, align 4 ; <float> [#uses=1]
+ %tmp = load float, float* @X, align 4 ; <float> [#uses=1]
%tmp1 = fpext float %tmp to double ; <double> [#uses=1]
%tmp2 = fsub double -0.000000e+00, %tmp1 ; <double> [#uses=1]
%tmp34 = fptrunc double %tmp2 to float ; <float> [#uses=1]
diff --git a/test/Transforms/InstCombine/fprintf-1.ll b/test/Transforms/InstCombine/fprintf-1.ll
index 6741345839a08..6d21f39d4fd6c 100644
--- a/test/Transforms/InstCombine/fprintf-1.ll
+++ b/test/Transforms/InstCombine/fprintf-1.ll
@@ -19,9 +19,9 @@ declare i32 @fprintf(%FILE*, i8*, ...)
define void @test_simplify1(%FILE* %fp) {
; 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)
+ %fmt = getelementptr [13 x i8], [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], [13 x i8]* @hello_world, i32 0, i32 0), i32 12, i32 1, %FILE* %fp)
ret void
; CHECK-NEXT: ret void
}
@@ -30,8 +30,8 @@ define void @test_simplify1(%FILE* %fp) {
define void @test_simplify2(%FILE* %fp) {
; 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)
+ %fmt = getelementptr [3 x i8], [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)
ret void
; CHECK-NEXT: ret void
@@ -42,10 +42,10 @@ define void @test_simplify2(%FILE* %fp) {
define void @test_simplify3(%FILE* %fp) {
; 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)
-; CHECK-NEXT: call i32 @fwrite(i8* getelementptr inbounds ([13 x i8]* @hello_world, i32 0, i32 0), i32 12, i32 1, %FILE* %fp)
+ %fmt = getelementptr [3 x i8], [3 x i8]* @percent_s, i32 0, i32 0
+ %str = getelementptr [13 x i8], [13 x i8]* @hello_world, i32 0, i32 0
+ call i32 (%FILE*, i8*, ...) @fprintf(%FILE* %fp, i8* %fmt, i8* %str)
+; CHECK-NEXT: call i32 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32 0), i32 12, i32 1, %FILE* %fp)
ret void
; CHECK-NEXT: ret void
}
@@ -54,36 +54,36 @@ define void @test_simplify3(%FILE* %fp) {
define void @test_simplify4(%FILE* %fp) {
; 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-IPRINTF-NEXT: call i32 (%FILE*, i8*, ...)* @fiprintf(%FILE* %fp, i8* getelementptr inbounds ([3 x i8]* @percent_d, i32 0, i32 0), i32 187)
+ %fmt = getelementptr [3 x i8], [3 x i8]* @percent_d, i32 0, i32 0
+ call i32 (%FILE*, i8*, ...) @fprintf(%FILE* %fp, i8* %fmt, i32 187)
+; CHECK-IPRINTF-NEXT: call i32 (%FILE*, i8*, ...) @fiprintf(%FILE* %fp, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @percent_d, i32 0, i32 0), i32 187)
ret void
; CHECK-IPRINTF-NEXT: ret void
}
define void @test_no_simplify1(%FILE* %fp) {
; 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-IPRINTF-NEXT: call i32 (%FILE*, i8*, ...)* @fprintf(%FILE* %fp, i8* getelementptr inbounds ([3 x i8]* @percent_f, i32 0, i32 0), double 1.870000e+00)
+ %fmt = getelementptr [3 x i8], [3 x i8]* @percent_f, i32 0, i32 0
+ call i32 (%FILE*, i8*, ...) @fprintf(%FILE* %fp, i8* %fmt, double 1.87)
+; CHECK-IPRINTF-NEXT: call i32 (%FILE*, i8*, ...) @fprintf(%FILE* %fp, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @percent_f, i32 0, i32 0), double 1.870000e+00)
ret void
; CHECK-IPRINTF-NEXT: ret void
}
define void @test_no_simplify2(%FILE* %fp, double %d) {
; 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)
+ %fmt = getelementptr [3 x i8], [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], [3 x i8]* @percent_f, i32 0, i32 0), double %d)
ret void
; CHECK-NEXT: ret void
}
define i32 @test_no_simplify3(%FILE* %fp) {
; 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))
+ %fmt = getelementptr [13 x i8], [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], [13 x i8]* @hello_world, i32 0, i32 0))
ret i32 %1
; CHECK-NEXT: ret i32 %1
}
diff --git a/test/Transforms/InstCombine/fputs-1.ll b/test/Transforms/InstCombine/fputs-1.ll
index 473610e6120a1..1c245753e61f1 100644
--- a/test/Transforms/InstCombine/fputs-1.ll
+++ b/test/Transforms/InstCombine/fputs-1.ll
@@ -16,7 +16,7 @@ declare i32 @fputs(i8*, %FILE*)
define void @test_simplify1(%FILE* %fp) {
; CHECK-LABEL: @test_simplify1(
- %str = getelementptr [1 x i8]* @empty, i32 0, i32 0
+ %str = getelementptr [1 x i8], [1 x i8]* @empty, i32 0, i32 0
call i32 @fputs(i8* %str, %FILE* %fp)
ret void
; CHECK-NEXT: ret void
@@ -26,7 +26,7 @@ define void @test_simplify1(%FILE* %fp) {
define void @test_simplify2(%FILE* %fp) {
; CHECK-LABEL: @test_simplify2(
- %str = getelementptr [2 x i8]* @A, i32 0, i32 0
+ %str = getelementptr [2 x i8], [2 x i8]* @A, i32 0, i32 0
call i32 @fputs(i8* %str, %FILE* %fp)
; CHECK-NEXT: call i32 @fputc(i32 65, %FILE* %fp)
ret void
@@ -35,9 +35,9 @@ define void @test_simplify2(%FILE* %fp) {
define void @test_simplify3(%FILE* %fp) {
; CHECK-LABEL: @test_simplify3(
- %str = getelementptr [7 x i8]* @hello, i32 0, i32 0
+ %str = getelementptr [7 x i8], [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)
+; CHECK-NEXT: call i32 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @hello, i32 0, i32 0), i32 6, i32 1, %FILE* %fp)
ret void
; CHECK-NEXT: ret void
}
diff --git a/test/Transforms/InstCombine/fwrite-1.ll b/test/Transforms/InstCombine/fwrite-1.ll
index 6f9a8e463a8c5..10f0b23e1d8d8 100644
--- a/test/Transforms/InstCombine/fwrite-1.ll
+++ b/test/Transforms/InstCombine/fwrite-1.ll
@@ -15,7 +15,7 @@ declare i64 @fwrite(i8*, i64, i64, %FILE *)
define void @test_simplify1(%FILE* %fp) {
; CHECK-LABEL: @test_simplify1(
- %str = getelementptr inbounds [1 x i8]* @str, i64 0, i64 0
+ %str = getelementptr inbounds [1 x i8], [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)
ret void
@@ -24,7 +24,7 @@ define void @test_simplify1(%FILE* %fp) {
define void @test_simplify2(%FILE* %fp) {
; CHECK-LABEL: @test_simplify2(
- %str = getelementptr inbounds [0 x i8]* @empty, i64 0, i64 0
+ %str = getelementptr inbounds [0 x i8], [0 x i8]* @empty, i64 0, i64 0
call i64 @fwrite(i8* %str, i64 1, i64 0, %FILE* %fp)
ret void
; CHECK-NEXT: ret void
@@ -32,7 +32,7 @@ define void @test_simplify2(%FILE* %fp) {
define void @test_simplify3(%FILE* %fp) {
; CHECK-LABEL: @test_simplify3(
- %str = getelementptr inbounds [0 x i8]* @empty, i64 0, i64 0
+ %str = getelementptr inbounds [0 x i8], [0 x i8]* @empty, i64 0, i64 0
call i64 @fwrite(i8* %str, i64 0, i64 1, %FILE* %fp)
ret void
; CHECK-NEXT: ret void
@@ -40,7 +40,7 @@ define void @test_simplify3(%FILE* %fp) {
define i64 @test_no_simplify1(%FILE* %fp) {
; CHECK-LABEL: @test_no_simplify1(
- %str = getelementptr inbounds [1 x i8]* @str, i64 0, i64 0
+ %str = getelementptr inbounds [1 x i8], [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
ret i64 %ret
@@ -49,7 +49,7 @@ define i64 @test_no_simplify1(%FILE* %fp) {
define void @test_no_simplify2(%FILE* %fp, i64 %size) {
; CHECK-LABEL: @test_no_simplify2(
- %str = getelementptr inbounds [1 x i8]* @str, i64 0, i64 0
+ %str = getelementptr inbounds [1 x i8], [1 x i8]* @str, i64 0, i64 0
call i64 @fwrite(i8* %str, i64 %size, i64 1, %FILE* %fp)
; CHECK-NEXT: call i64 @fwrite
ret void
diff --git a/test/Transforms/InstCombine/gc.relocate.ll b/test/Transforms/InstCombine/gc.relocate.ll
new file mode 100644
index 0000000000000..a51aac10eb57c
--- /dev/null
+++ b/test/Transforms/InstCombine/gc.relocate.ll
@@ -0,0 +1,21 @@
+; RUN: opt < %s -instcombine -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:128:128"
+
+; Uses InstCombine with DataLayout to propagate dereferenceable
+; attribute via gc.relocate: if the derived ptr is dereferenceable(N),
+; then the return attribute of gc.relocate is dereferenceable(N).
+
+declare zeroext i1 @return_i1()
+declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...)
+declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32)
+
+define i32 addrspace(1)* @deref(i32 addrspace(1)* dereferenceable(8) %dparam) gc "statepoint-example" {
+; Checks that a dereferenceabler pointer
+; CHECK-LABEL: @deref
+; CHECK: call dereferenceable(8)
+entry:
+ %load = load i32, i32 addrspace(1)* %dparam
+ %tok = tail call i32 (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 0, i32 0, i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)* %dparam)
+ %relocate = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %tok, i32 7, i32 7)
+ ret i32 addrspace(1)* %relocate
+}
diff --git a/test/Transforms/InstCombine/gep-addrspace.ll b/test/Transforms/InstCombine/gep-addrspace.ll
index 29511a3c6677b..aa46ea6713025 100644
--- a/test/Transforms/InstCombine/gep-addrspace.ll
+++ b/test/Transforms/InstCombine/gep-addrspace.ll
@@ -8,11 +8,11 @@ target triple = "x86_64-pc-win32"
; make sure that we are not crashing when creating an illegal type
define void @func(%myStruct addrspace(1)* nocapture %p) nounwind {
ST:
- %A = getelementptr inbounds %myStruct addrspace(1)* %p, i64 0
+ %A = getelementptr inbounds %myStruct, %myStruct addrspace(1)* %p, i64 0
%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
+ %C = getelementptr inbounds %myStruct, %myStruct* %B, i32 0, i32 1
+ %D = getelementptr inbounds [3 x float], [3 x float]* %C, i32 0, i32 2
+ %E = load float, float* %D, align 4
%F = fsub float %E, undef
ret void
}
@@ -23,9 +23,9 @@ ST:
define void @keep_necessary_addrspacecast(i64 %i, float** %out0, float** %out1) {
entry:
; CHECK-LABEL: @keep_necessary_addrspacecast
- %0 = getelementptr [256 x float]* addrspacecast ([256 x float] addrspace(3)* @array to [256 x float]*), i64 0, i64 %i
+ %0 = getelementptr [256 x float], [256 x float]* addrspacecast ([256 x float] addrspace(3)* @array to [256 x float]*), i64 0, i64 %i
; CHECK: addrspacecast float addrspace(3)* %{{[0-9]+}} to float*
- %1 = getelementptr [0 x float]* addrspacecast (float addrspace(3)* @scalar to [0 x float]*), i64 0, i64 %i
+ %1 = getelementptr [0 x float], [0 x float]* addrspacecast (float addrspace(3)* @scalar to [0 x float]*), i64 0, i64 %i
; CHECK: addrspacecast float addrspace(3)* %{{[0-9]+}} to float*
store float* %0, float** %out0, align 4
store float* %1, float** %out1, align 4
diff --git a/test/Transforms/InstCombine/gep-sext.ll b/test/Transforms/InstCombine/gep-sext.ll
new file mode 100644
index 0000000000000..36e2aeff02cfc
--- /dev/null
+++ b/test/Transforms/InstCombine/gep-sext.ll
@@ -0,0 +1,61 @@
+; 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"
+target triple = "x86_64-pc-win32"
+
+declare void @use(i32) readonly
+
+; We prefer to canonicalize the machine width gep indices early
+define void @test(i32* %p, i32 %index) {
+; CHECK-LABEL: @test
+; CHECK-NEXT: %1 = sext i32 %index to i64
+; CHECK-NEXT: %addr = getelementptr i32, i32* %p, i64 %1
+ %addr = getelementptr i32, i32* %p, i32 %index
+ %val = load i32, i32* %addr
+ call void @use(i32 %val)
+ ret void
+}
+; If they've already been canonicalized via zext, that's fine
+define void @test2(i32* %p, i32 %index) {
+; CHECK-LABEL: @test2
+; CHECK-NEXT: %i = zext i32 %index to i64
+; CHECK-NEXT: %addr = getelementptr i32, i32* %p, i64 %i
+ %i = zext i32 %index to i64
+ %addr = getelementptr i32, i32* %p, i64 %i
+ %val = load i32, i32* %addr
+ call void @use(i32 %val)
+ ret void
+}
+; If we can use a zext, we prefer that. This requires
+; knowing that the index is positive.
+define void @test3(i32* %p, i32 %index) {
+; CHECK-LABEL: @test3
+; CHECK: zext
+; CHECK-NOT: sext
+ %addr_begin = getelementptr i32, i32* %p, i64 40
+ %addr_fixed = getelementptr i32, i32* %addr_begin, i64 48
+ %val_fixed = load i32, i32* %addr_fixed, !range !0
+ %addr = getelementptr i32, i32* %addr_begin, i32 %val_fixed
+ %val = load i32, i32* %addr
+ call void @use(i32 %val)
+ ret void
+}
+; Replace sext with zext where possible
+define void @test4(i32* %p, i32 %index) {
+; CHECK-LABEL: @test4
+; CHECK: zext
+; CHECK-NOT: sext
+ %addr_begin = getelementptr i32, i32* %p, i64 40
+ %addr_fixed = getelementptr i32, i32* %addr_begin, i64 48
+ %val_fixed = load i32, i32* %addr_fixed, !range !0
+ %i = sext i32 %val_fixed to i64
+ %addr = getelementptr i32, i32* %addr_begin, i64 %i
+ %val = load i32, i32* %addr
+ call void @use(i32 %val)
+ ret void
+}
+
+;; !range !0
+!0 = !{i32 0, i32 2147483647}
+
+
+
diff --git a/test/Transforms/InstCombine/gepgep.ll b/test/Transforms/InstCombine/gepgep.ll
index 9e681d28c424b..24b81aaea3f1b 100644
--- a/test/Transforms/InstCombine/gepgep.ll
+++ b/test/Transforms/InstCombine/gepgep.ll
@@ -8,6 +8,6 @@ target triple = "x86_64-unknown-linux-gnu"
declare void @use(i8*)
define void @f() {
- call void @use(i8* getelementptr (i8* getelementptr (i8* bitcast ([64 x float]* @buffer to i8*), i64 and (i64 sub (i64 0, i64 ptrtoint ([64 x float]* @buffer to i64)), i64 63)), i64 64))
+ call void @use(i8* getelementptr (i8, i8* getelementptr (i8, i8* bitcast ([64 x float]* @buffer to i8*), i64 and (i64 sub (i64 0, i64 ptrtoint ([64 x float]* @buffer to i64)), i64 63)), i64 64))
ret void
}
diff --git a/test/Transforms/InstCombine/gepphigep.ll b/test/Transforms/InstCombine/gepphigep.ll
index 9aab609901e20..5ae3171b39f61 100644
--- a/test/Transforms/InstCombine/gepphigep.ll
+++ b/test/Transforms/InstCombine/gepphigep.ll
@@ -2,55 +2,135 @@
%struct1 = type { %struct2*, i32, i32, i32 }
%struct2 = type { i32, i32 }
+%struct3 = type { i32, %struct4, %struct4 }
+%struct4 = type { %struct2, %struct2 }
define i32 @test1(%struct1* %dm, i1 %tmp4, i64 %tmp9, i64 %tmp19) {
bb:
- %tmp = getelementptr inbounds %struct1* %dm, i64 0, i32 0
- %tmp1 = load %struct2** %tmp, align 8
+ %tmp = getelementptr inbounds %struct1, %struct1* %dm, i64 0, i32 0
+ %tmp1 = load %struct2*, %struct2** %tmp, align 8
br i1 %tmp4, label %bb1, label %bb2
bb1:
- %tmp10 = getelementptr inbounds %struct2* %tmp1, i64 %tmp9
- %tmp11 = getelementptr inbounds %struct2* %tmp10, i64 0, i32 0
+ %tmp10 = getelementptr inbounds %struct2, %struct2* %tmp1, i64 %tmp9
+ %tmp11 = getelementptr inbounds %struct2, %struct2* %tmp10, i64 0, i32 0
store i32 0, i32* %tmp11, align 4
br label %bb3
bb2:
- %tmp20 = getelementptr inbounds %struct2* %tmp1, i64 %tmp19
- %tmp21 = getelementptr inbounds %struct2* %tmp20, i64 0, i32 0
+ %tmp20 = getelementptr inbounds %struct2, %struct2* %tmp1, i64 %tmp19
+ %tmp21 = getelementptr inbounds %struct2, %struct2* %tmp20, i64 0, i32 0
store i32 0, i32* %tmp21, align 4
br label %bb3
bb3:
%phi = phi %struct2* [ %tmp10, %bb1 ], [ %tmp20, %bb2 ]
- %tmp24 = getelementptr inbounds %struct2* %phi, i64 0, i32 1
- %tmp25 = load i32* %tmp24, align 4
+ %tmp24 = getelementptr inbounds %struct2, %struct2* %phi, i64 0, i32 1
+ %tmp25 = load i32, i32* %tmp24, align 4
ret i32 %tmp25
; CHECK-LABEL: @test1(
-; CHECK: getelementptr inbounds %struct2* %tmp1, i64 %tmp9, i32 0
-; CHECK: getelementptr inbounds %struct2* %tmp1, i64 %tmp19, i32 0
+; CHECK: getelementptr inbounds %struct2, %struct2* %tmp1, i64 %tmp9, i32 0
+; CHECK: getelementptr inbounds %struct2, %struct2* %tmp1, i64 %tmp19, i32 0
; CHECK: %[[PHI:[0-9A-Za-z]+]] = phi i64 [ %tmp9, %bb1 ], [ %tmp19, %bb2 ]
-; CHECK: getelementptr inbounds %struct2* %tmp1, i64 %[[PHI]], i32 1
+; CHECK: getelementptr inbounds %struct2, %struct2* %tmp1, i64 %[[PHI]], i32 1
}
define i32 @test2(%struct1* %dm, i1 %tmp4, i64 %tmp9, i64 %tmp19) {
bb:
- %tmp = getelementptr inbounds %struct1* %dm, i64 0, i32 0
- %tmp1 = load %struct2** %tmp, align 8
- %tmp10 = getelementptr inbounds %struct2* %tmp1, i64 %tmp9
- %tmp11 = getelementptr inbounds %struct2* %tmp10, i64 0, i32 0
+ %tmp = getelementptr inbounds %struct1, %struct1* %dm, i64 0, i32 0
+ %tmp1 = load %struct2*, %struct2** %tmp, align 8
+ %tmp10 = getelementptr inbounds %struct2, %struct2* %tmp1, i64 %tmp9
+ %tmp11 = getelementptr inbounds %struct2, %struct2* %tmp10, i64 0, i32 0
store i32 0, i32* %tmp11, align 4
- %tmp20 = getelementptr inbounds %struct2* %tmp1, i64 %tmp19
- %tmp21 = getelementptr inbounds %struct2* %tmp20, i64 0, i32 0
+ %tmp20 = getelementptr inbounds %struct2, %struct2* %tmp1, i64 %tmp19
+ %tmp21 = getelementptr inbounds %struct2, %struct2* %tmp20, i64 0, i32 0
store i32 0, i32* %tmp21, align 4
- %tmp24 = getelementptr inbounds %struct2* %tmp10, i64 0, i32 1
- %tmp25 = load i32* %tmp24, align 4
+ %tmp24 = getelementptr inbounds %struct2, %struct2* %tmp10, i64 0, i32 1
+ %tmp25 = load i32, i32* %tmp24, align 4
ret i32 %tmp25
; CHECK-LABEL: @test2(
-; CHECK: getelementptr inbounds %struct2* %tmp1, i64 %tmp9, i32 0
-; CHECK: getelementptr inbounds %struct2* %tmp1, i64 %tmp19, i32 0
-; CHECK: getelementptr inbounds %struct2* %tmp1, i64 %tmp9, i32 1
+; CHECK: getelementptr inbounds %struct2, %struct2* %tmp1, i64 %tmp9, i32 0
+; CHECK: getelementptr inbounds %struct2, %struct2* %tmp1, i64 %tmp19, i32 0
+; CHECK: getelementptr inbounds %struct2, %struct2* %tmp1, i64 %tmp9, i32 1
+}
+
+; Check that instcombine doesn't insert GEPs before landingpad.
+
+define i32 @test3(%struct3* %dm, i1 %tmp4, i64 %tmp9, i64 %tmp19, i64 %tmp20, i64 %tmp21) {
+bb:
+ %tmp = getelementptr inbounds %struct3, %struct3* %dm, i64 0
+ br i1 %tmp4, label %bb1, label %bb2
+
+bb1:
+ %tmp1 = getelementptr inbounds %struct3, %struct3* %tmp, i64 %tmp19, i32 1
+ %tmp11 = getelementptr inbounds %struct4, %struct4* %tmp1, i64 0, i32 0, i32 0
+ store i32 0, i32* %tmp11, align 4
+ br label %bb3
+
+bb2:
+ %tmp2 = getelementptr inbounds %struct3, %struct3* %tmp, i64 %tmp20, i32 1
+ %tmp12 = getelementptr inbounds %struct4, %struct4* %tmp2, i64 0, i32 0, i32 1
+ store i32 0, i32* %tmp12, align 4
+ br label %bb3
+
+bb3:
+ %phi = phi %struct4* [ %tmp1, %bb1 ], [ %tmp2, %bb2 ]
+ %tmp22 = invoke i32 @foo1(i32 11) to label %bb4 unwind label %bb5
+
+bb4:
+ ret i32 0
+
+bb5:
+ %tmp27 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) catch i8* bitcast (i8** @_ZTIi to i8*)
+ %tmp34 = getelementptr inbounds %struct4, %struct4* %phi, i64 %tmp21, i32 1
+ %tmp35 = getelementptr inbounds %struct2, %struct2* %tmp34, i64 0, i32 1
+ %tmp25 = load i32, i32* %tmp35, align 4
+ ret i32 %tmp25
+
+; CHECK-LABEL: @test3(
+; CHECK: bb5:
+; CHECK-NEXT: {{.*}}landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+}
+
+@_ZTIi = external constant i8*
+declare i32 @__gxx_personality_v0(...)
+declare i32 @foo1(i32)
+
+
+; Check that instcombine doesn't fold GEPs into themselves through a loop
+; back-edge.
+
+define i8* @test4(i32 %value, i8* %buffer) {
+entry:
+ %incptr = getelementptr inbounds i8, i8* %buffer, i64 1
+ %cmp = icmp ugt i32 %value, 127
+ br i1 %cmp, label %loop.header, label %exit
+
+loop.header:
+ br label %loop.body
+
+loop.body:
+ %loopptr = phi i8* [ %incptr, %loop.header ], [ %incptr2, %loop.body ]
+ %newval = phi i32 [ %value, %loop.header ], [ %shr, %loop.body ]
+ %shr = lshr i32 %newval, 7
+ %incptr2 = getelementptr inbounds i8, i8* %loopptr, i64 1
+ %cmp2 = icmp ugt i32 %shr, 127
+ br i1 %cmp2, label %loop.body, label %loop.exit
+
+loop.exit:
+ %exitptr = phi i8* [ %incptr2, %loop.body ]
+ br label %exit
+
+exit:
+ %ptr2 = phi i8* [ %exitptr, %loop.exit ], [ %incptr, %entry ]
+ %incptr3 = getelementptr inbounds i8, i8* %ptr2, i64 1
+ ret i8* %incptr3
+
+; CHECK-LABEL: @test4(
+; CHECK: loop.body:
+; CHECK: getelementptr{{.*}}i64 1
+; CHECK: exit:
}
diff --git a/test/Transforms/InstCombine/getelementptr.ll b/test/Transforms/InstCombine/getelementptr.ll
index 94cc1803073a0..276ada91f3c63 100644
--- a/test/Transforms/InstCombine/getelementptr.ll
+++ b/test/Transforms/InstCombine/getelementptr.ll
@@ -14,14 +14,14 @@ target datalayout = "e-p:64:64-p1:16:16-p2:32:32:32-p3:64:64:64"
; Test noop elimination
define i32* @test1(i32* %I) {
- %A = getelementptr i32* %I, i64 0
+ %A = getelementptr i32, i32* %I, i64 0
ret i32* %A
; 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
+ %A = getelementptr i32, i32 addrspace(1)* %I, i64 0
ret i32 addrspace(1)* %A
; CHECK-LABEL: @test1_as1(
; CHECK: ret i32 addrspace(1)* %I
@@ -29,7 +29,7 @@ define i32 addrspace(1)* @test1_as1(i32 addrspace(1)* %I) {
; Test noop elimination
define i32* @test2(i32* %I) {
- %A = getelementptr i32* %I
+ %A = getelementptr i32, i32* %I
ret i32* %A
; CHECK-LABEL: @test2(
; CHECK: ret i32* %I
@@ -37,38 +37,38 @@ define i32* @test2(i32* %I) {
; Test that two array indexing geps fold
define i32* @test3(i32* %I) {
- %A = getelementptr i32* %I, i64 17
- %B = getelementptr i32* %A, i64 4
+ %A = getelementptr i32, i32* %I, i64 17
+ %B = getelementptr i32, i32* %A, i64 4
ret i32* %B
; CHECK-LABEL: @test3(
-; CHECK: getelementptr i32* %I, i64 21
+; CHECK: getelementptr i32, i32* %I, i64 21
}
; Test that two getelementptr insts fold
define i32* @test4({ i32 }* %I) {
- %A = getelementptr { i32 }* %I, i64 1
- %B = getelementptr { i32 }* %A, i64 0, i32 0
+ %A = getelementptr { i32 }, { i32 }* %I, i64 1
+ %B = getelementptr { i32 }, { i32 }* %A, i64 0, i32 0
ret i32* %B
; CHECK-LABEL: @test4(
-; CHECK: getelementptr { i32 }* %I, i64 1, i32 0
+; CHECK: getelementptr { i32 }, { 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], [10 x i8]* @Global, i64 0, i64 4
store i8 %B, i8* %A
ret void
; CHECK-LABEL: @test5(
-; CHECK: store i8 %B, i8* getelementptr inbounds ([10 x i8]* @Global, i64 0, i64 4)
+; CHECK: store i8 %B, i8* getelementptr inbounds ([10 x i8], [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
+ %A = getelementptr [10 x i8], [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)
+; CHECK: store i8 %B, i8 addrspace(1)* getelementptr inbounds ([10 x i8], [10 x i8] addrspace(1)* @Global_as1, i16 0, i16 4)
}
%as1_ptr_struct = type { i32 addrspace(1)* }
@@ -80,9 +80,9 @@ define void @test5_as1(i8 %B) {
; 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: store i32 addrspace(2)* %B, i32 addrspace(2)* addrspace(1)* getelementptr inbounds (%as2_ptr_struct, %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
+ %A = getelementptr %as2_ptr_struct, %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
}
@@ -91,26 +91,26 @@ define void @test_evaluate_gep_nested_as_ptrs(i32 addrspace(2)* %B) {
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: store i8 addrspace(2)* %B, i8 addrspace(2)* addrspace(1)* getelementptr inbounds ([4 x i8 addrspace(2)*], [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
+ %A = getelementptr [4 x i8 addrspace(2)*], [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, i32* %I, i64 %C
+ %B = getelementptr i32, i32* %A, i64 %D
ret i32* %B
; CHECK-LABEL: @test7(
-; CHECK: %A.sum = add i64 %C, %D
-; CHECK: getelementptr i32* %I, i64 %A.sum
+; CHECK: %A = getelementptr i32, i32* %I, i64 %C
+; CHECK: %B = getelementptr i32, i32* %A, i64 %D
}
define i8* @test8([10 x i32]* %X) {
;; Fold into the cast.
- %A = getelementptr [10 x i32]* %X, i64 0, i64 0
+ %A = getelementptr [10 x i32], [10 x i32]* %X, i64 0, i64 0
%B = bitcast i32* %A to i8*
ret i8* %B
; CHECK-LABEL: @test8(
@@ -118,7 +118,7 @@ define i8* @test8([10 x i32]* %X) {
}
define i32 @test9() {
- %A = getelementptr { i32, double }* null, i32 0, i32 1
+ %A = getelementptr { i32, double }, { i32, double }* null, i32 0, i32 1
%B = ptrtoint double* %A to i32
ret i32 %B
; CHECK-LABEL: @test9(
@@ -126,8 +126,8 @@ define i32 @test9() {
}
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
+ %tmp.1 = getelementptr { i32, i32 }, { i32, i32 }* %x, i32 0, i32 1
+ %tmp.3 = getelementptr { i32, i32 }, { i32, i32 }* %y, i32 0, i32 1
;; seteq x, y
%tmp.4 = icmp eq i32* %tmp.1, %tmp.3
ret i1 %tmp.4
@@ -136,7 +136,7 @@ define i1 @test10({ i32, i32 }* %x, { i32, i32 }* %y) {
}
define i1 @test11({ i32, i32 }* %X) {
- %P = getelementptr { i32, i32 }* %X, i32 0, i32 0
+ %P = getelementptr { i32, i32 }, { i32, i32 }* %X, i32 0, i32 0
%Q = icmp eq i32* %P, null
ret i1 %Q
; CHECK-LABEL: @test11(
@@ -147,18 +147,18 @@ define i1 @test11({ i32, i32 }* %X) {
; PR4748
define i32 @test12(%struct.A* %a) {
entry:
- %g3 = getelementptr %struct.A* %a, i32 0, i32 1
+ %g3 = getelementptr %struct.A, %struct.A* %a, i32 0, i32 1
store i32 10, i32* %g3, align 4
- %g4 = getelementptr %struct.A* %a, i32 0, i32 0
+ %g4 = getelementptr %struct.A, %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, %struct.A* %new_a, i32 0, i32 1
+ %a_a = load i32, i32* %g5, align 4
ret i32 %a_a
; CHECK-LABEL: @test12(
-; CHECK: getelementptr %struct.A* %a, i64 0, i32 1
+; CHECK: getelementptr %struct.A, %struct.A* %a, i64 0, i32 1
; CHECK-NEXT: store i32 10, i32* %g3
; CHECK-NEXT: ret i32 10
}
@@ -167,8 +167,8 @@ entry:
; PR2235
%S = type { i32, [ 100 x i32] }
define i1 @test13(i64 %X, %S* %P) {
- %A = getelementptr inbounds %S* %P, i32 0, i32 1, i64 %X
- %B = getelementptr inbounds %S* %P, i32 0, i32 0
+ %A = getelementptr inbounds %S, %S* %P, i32 0, i32 1, i64 %X
+ %B = getelementptr inbounds %S, %S* %P, i32 0, i32 0
%C = icmp eq i32* %A, %B
ret i1 %C
; CHECK-LABEL: @test13(
@@ -180,8 +180,8 @@ define <2 x i1> @test13_vector(<2 x i64> %X, <2 x %S*> %P) nounwind {
; 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>
+ %A = getelementptr inbounds %S, <2 x %S*> %P, <2 x i64> zeroinitializer, <2 x i32> <i32 1, i32 1>, <2 x i64> %X
+ %B = getelementptr inbounds %S, <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
}
@@ -190,8 +190,8 @@ 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
+ %A = getelementptr inbounds %S, %S addrspace(1)* %P, i16 0, i32 1, i16 %X
+ %B = getelementptr inbounds %S, %S addrspace(1)* %P, i16 0, i32 0
%C = icmp eq i32 addrspace(1)* %A, %B
ret i1 %C
}
@@ -202,8 +202,8 @@ define <2 x i1> @test13_vector_as1(<2 x i16> %X, <2 x %S addrspace(1)*> %P) {
; 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>
+ %A = getelementptr inbounds %S, <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 %S, <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
}
@@ -211,8 +211,8 @@ define <2 x i1> @test13_vector_as1(<2 x i16> %X, <2 x %S addrspace(1)*> %P) {
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
+ %A = getelementptr inbounds %S, %S* %P, i32 0, i32 1, i32 %X
+ %B = getelementptr inbounds %S, %S* %P, i32 0, i32 0
%C = icmp eq i32* %A, %B
ret i1 %C
}
@@ -220,8 +220,8 @@ define i1 @test13_i32(i32 %X, %S* %P) {
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
+ %A = getelementptr inbounds %S, %S* %P, i16 0, i32 1, i16 %X
+ %B = getelementptr inbounds %S, %S* %P, i16 0, i32 0
%C = icmp eq i32* %A, %B
ret i1 %C
}
@@ -229,8 +229,8 @@ define i1 @test13_i16(i16 %X, %S* %P) {
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
+ %A = getelementptr inbounds %S, %S* %P, i128 0, i32 1, i128 %X
+ %B = getelementptr inbounds %S, %S* %P, i128 0, i32 0
%C = icmp eq i32* %A, %B
ret i1 %C
}
@@ -239,25 +239,25 @@ define i1 @test13_i128(i128 %X, %S* %P) {
@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
+ %tmp = getelementptr i8, i8* getelementptr ([3 x i8], [3 x i8]* @G, i32 0, i32 0), i64 %idx
ret i8* %tmp
; CHECK-LABEL: @test14(
-; CHECK: getelementptr [3 x i8]* @G, i64 0, i64 %idx
+; CHECK: getelementptr [3 x i8], [3 x i8]* @G, i64 0, i64 %idx
}
; Test folding of constantexpr geps into normal geps.
@Array = external global [40 x i32]
define i32 *@test15(i64 %X) {
- %A = getelementptr i32* getelementptr ([40 x i32]* @Array, i64 0, i64 0), i64 %X
+ %A = getelementptr i32, i32* getelementptr ([40 x i32], [40 x i32]* @Array, i64 0, i64 0), i64 %X
ret i32* %A
; CHECK-LABEL: @test15(
-; CHECK: getelementptr [40 x i32]* @Array, i64 0, i64 %X
+; CHECK: getelementptr [40 x i32], [40 x i32]* @Array, i64 0, i64 %X
}
define i32* @test16(i32* %X, i32 %Idx) {
- %R = getelementptr i32* %X, i32 %Idx
+ %R = getelementptr i32, i32* %X, i32 %Idx
ret i32* %R
; CHECK-LABEL: @test16(
; CHECK: sext i32 %Idx to i64
@@ -265,8 +265,8 @@ define i32* @test16(i32* %X, i32 %Idx) {
define i1 @test17(i16* %P, i32 %I, i32 %J) {
- %X = getelementptr inbounds i16* %P, i32 %I
- %Y = getelementptr inbounds i16* %P, i32 %J
+ %X = getelementptr inbounds i16, i16* %P, i32 %I
+ %Y = getelementptr inbounds i16, i16* %P, i32 %J
%C = icmp ult i16* %X, %Y
ret i1 %C
; CHECK-LABEL: @test17(
@@ -274,7 +274,7 @@ define i1 @test17(i16* %P, i32 %I, i32 %J) {
}
define i1 @test18(i16* %P, i32 %I) {
- %X = getelementptr inbounds i16* %P, i32 %I
+ %X = getelementptr inbounds i16, i16* %P, i32 %I
%C = icmp ult i16* %X, %P
ret i1 %C
; CHECK-LABEL: @test18(
@@ -287,7 +287,7 @@ define i1 @test18_as1(i16 addrspace(1)* %P, i32 %I) {
; 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
+ %X = getelementptr inbounds i16, i16 addrspace(1)* %P, i32 %I
%C = icmp ult i16 addrspace(1)* %X, %P
ret i1 %C
}
@@ -298,7 +298,7 @@ define i1 @test18_as1_i32(i16 addrspace(1)* %P, i32 %I) {
; 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
+ %X = getelementptr inbounds i16, i16 addrspace(1)* %P, i32 %I
%C = icmp ult i16 addrspace(1)* %X, %P
ret i1 %C
}
@@ -307,7 +307,7 @@ define i1 @test18_as1_i32(i16 addrspace(1)* %P, i32 %I) {
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
+ %X = getelementptr inbounds i16, i16* %P, i16 %I
%C = icmp ult i16* %X, %P
ret i1 %C
}
@@ -316,7 +316,7 @@ define i1 @test18_i16(i16* %P, i16 %I) {
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
+ %X = getelementptr inbounds i16, i16* %P, i64 %I
%C = icmp ult i16* %X, %P
ret i1 %C
}
@@ -325,14 +325,14 @@ define i1 @test18_i64(i16* %P, i64 %I) {
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
+ %X = getelementptr inbounds i16, 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.4 = getelementptr inbounds i32, i32* %P, i32 %A
+ %tmp.9 = getelementptr inbounds i32, 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
@@ -341,7 +341,7 @@ define i32 @test19(i32* %P, i32 %A, i32 %B) {
}
define i32 @test20(i32* %P, i32 %A, i32 %B) {
- %tmp.4 = getelementptr inbounds i32* %P, i32 %A
+ %tmp.4 = getelementptr inbounds i32, i32* %P, i32 %A
%tmp.6 = icmp eq i32* %tmp.4, %P
%tmp.7 = zext i1 %tmp.6 to i32
ret i32 %tmp.7
@@ -350,7 +350,7 @@ define i32 @test20(i32* %P, i32 %A, i32 %B) {
}
define i32 @test20_as1(i32 addrspace(1)* %P, i32 %A, i32 %B) {
- %tmp.4 = getelementptr inbounds i32 addrspace(1)* %P, i32 %A
+ %tmp.4 = getelementptr inbounds i32, 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
@@ -361,12 +361,12 @@ define i32 @test20_as1(i32 addrspace(1)* %P, i32 %A, i32 %B) {
define i32 @test21() {
%pbob1 = alloca %intstruct
- %pbob2 = getelementptr %intstruct* %pbob1
- %pbobel = getelementptr %intstruct* %pbob2, i64 0, i32 0
- %rval = load i32* %pbobel
+ %pbob2 = getelementptr %intstruct, %intstruct* %pbob1
+ %pbobel = getelementptr %intstruct, %intstruct* %pbob2, i64 0, i32 0
+ %rval = load i32, i32* %pbobel
ret i32 %rval
; CHECK-LABEL: @test21(
-; CHECK: getelementptr %intstruct* %pbob1, i64 0, i32 0
+; CHECK: getelementptr %intstruct, %intstruct* %pbob1, i64 0, i32 0
}
@@ -374,18 +374,18 @@ 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, i32* @A, i64 1),
+ getelementptr (i32, i32* @B, i64 2)
ret i1 %C
; CHECK-LABEL: @test22(
-; CHECK: icmp ult (i32* getelementptr inbounds (i32* @A, i64 1), i32* getelementptr (i32* @B, i64 2))
+; CHECK: icmp ult (i32* getelementptr inbounds (i32, i32* @A, i64 1), i32* getelementptr (i32, i32* @B, i64 2))
}
%X = type { [10 x i32], float }
define i1 @test23() {
- %A = getelementptr %X* null, i64 0, i32 0, i64 0 ; <i32*> [#uses=1]
+ %A = getelementptr %X, %X* null, i64 0, i32 0, i64 0 ; <i32*> [#uses=1]
%B = icmp ne i32* %A, null ; <i1> [#uses=1]
ret i1 %B
; CHECK-LABEL: @test23(
@@ -394,9 +394,9 @@ define i1 @test23() {
define void @test25() {
entry:
- %tmp = getelementptr { i64, i64, i64, i64 }* null, i32 0, i32 3 ; <i64*> [#uses=1]
- %tmp.upgrd.1 = load i64* %tmp ; <i64> [#uses=1]
- %tmp8.ui = load i64* null ; <i64> [#uses=1]
+ %tmp = getelementptr { i64, i64, i64, i64 }, { i64, i64, i64, i64 }* null, i32 0, i32 3 ; <i64*> [#uses=1]
+ %tmp.upgrd.1 = load i64, i64* %tmp ; <i64> [#uses=1]
+ %tmp8.ui = load i64, i64* null ; <i64> [#uses=1]
%tmp8 = bitcast i64 %tmp8.ui to i64 ; <i64> [#uses=1]
%tmp9 = and i64 %tmp8, %tmp.upgrd.1 ; <i64> [#uses=1]
%sext = trunc i64 %tmp9 to i32 ; <i32> [#uses=1]
@@ -411,8 +411,8 @@ declare void @foo25(i32, i64)
; PR1637
define i1 @test26(i8* %arr) {
- %X = getelementptr i8* %arr, i32 1
- %Y = getelementptr i8* %arr, i32 1
+ %X = getelementptr i8, i8* %arr, i32 1
+ %Y = getelementptr i8, i8* %arr, i32 1
%test = icmp uge i8* %X, %Y
ret i1 %test
; CHECK-LABEL: @test26(
@@ -427,14 +427,14 @@ 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
- %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
+ %tmp344 = load %struct.siginfo_t*, %struct.siginfo_t** %from_addr, align 8
+ %tmp345 = getelementptr %struct.siginfo_t, %struct.siginfo_t* %tmp344, i32 0, i32 3
+ %tmp346 = getelementptr { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] }, { { 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 }*
- %tmp348 = getelementptr { i32, i32, %struct.sigval_t }* %tmp346347, i32 0, i32 2
- %tmp349 = getelementptr %struct.sigval_t* %tmp348, i32 0, i32 0
+ %tmp348 = getelementptr { i32, i32, %struct.sigval_t }, { i32, i32, %struct.sigval_t }* %tmp346347, i32 0, i32 2
+ %tmp349 = getelementptr %struct.sigval_t, %struct.sigval_t* %tmp348, i32 0, i32 0
%tmp349350 = bitcast i8** %tmp349 to i32*
- %tmp351 = load i32* %tmp349350, align 8
+ %tmp351 = load i32, 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 )
@@ -450,17 +450,17 @@ entry:
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
- %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
+ %tmp3 = call i32 @puts( i8* getelementptr ([6 x i8], [6 x i8]* @.str, i32 0, i32 0) ) nounwind
+ %tmp45 = getelementptr inbounds [1 x [1 x %struct.x]], [1 x [1 x %struct.x]]* %orientations, i32 1, i32 0, i32 0
+ %orientations62 = getelementptr [1 x [1 x %struct.x]], [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
- %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
+ %tmp12 = getelementptr inbounds %struct.x, %struct.x* %tmp45, i32 %tmp12.rec
+ %tmp16 = call i32 (i8*, ...) @printf( i8* getelementptr ([12 x i8], [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
@@ -482,12 +482,12 @@ declare i32 @printf(i8*, ...)
%T = type <{ i64, i64, i64 }>
define i32 @test29(i8* %start, i32 %X) nounwind {
entry:
- %tmp3 = load i64* null
- %add.ptr = getelementptr i8* %start, i64 %tmp3
- %tmp158 = load i32* null
- %add.ptr159 = getelementptr %T* null, i32 %tmp158
- %add.ptr209 = getelementptr i8* %start, i64 0
- %add.ptr212 = getelementptr i8* %add.ptr209, i32 %X
+ %tmp3 = load i64, i64* null
+ %add.ptr = getelementptr i8, i8* %start, i64 %tmp3
+ %tmp158 = load i32, i32* null
+ %add.ptr159 = getelementptr %T, %T* null, i32 %tmp158
+ %add.ptr209 = getelementptr i8, i8* %start, i64 0
+ %add.ptr212 = getelementptr i8, i8* %add.ptr209, i32 %X
%cmp214 = icmp ugt i8* %add.ptr212, %add.ptr
br i1 %cmp214, label %if.then216, label %if.end363
@@ -506,8 +506,8 @@ entry:
%0 = alloca i32, i32 %n, align 4
%1 = bitcast i32* %0 to [0 x i32]*
call void @test30f(i32* %0) nounwind
- %2 = getelementptr [0 x i32]* %1, i32 0, i32 %m
- %3 = load i32* %2, align 4
+ %2 = getelementptr [0 x i32], [0 x i32]* %1, i32 0, i32 %m
+ %3 = load i32, i32* %2, align 4
ret i32 %3
; CHECK-LABEL: @test30(
; CHECK: getelementptr i32
@@ -518,8 +518,8 @@ declare void @test30f(i32*)
define i1 @test31(i32* %A) {
- %B = getelementptr i32* %A, i32 1
- %C = getelementptr i32* %A, i64 1
+ %B = getelementptr i32, i32* %A, i32 1
+ %C = getelementptr i32, i32* %A, i64 1
%V = icmp eq i32* %B, %C
ret i1 %V
; CHECK-LABEL: @test31(
@@ -530,18 +530,18 @@ define i1 @test31(i32* %A) {
; PR1345
define i8* @test32(i8* %v) {
%A = alloca [4 x i8*], align 16
- %B = getelementptr [4 x i8*]* %A, i32 0, i32 0
+ %B = getelementptr [4 x i8*], [4 x i8*]* %A, i32 0, i32 0
store i8* null, i8** %B
%C = bitcast [4 x i8*]* %A to { [16 x i8] }*
- %D = getelementptr { [16 x i8] }* %C, i32 0, i32 0, i32 8
+ %D = getelementptr { [16 x i8] }, { [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
- %G = load i8** %F
+ %F = getelementptr [4 x i8*], [4 x i8*]* %A, i32 0, i32 2
+ %G = load i8*, i8** %F
ret i8* %G
; 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
+; CHECK: %D = getelementptr [4 x i8*], [4 x i8*]* %A, i64 0, i64 1
+; CHECK: %F = getelementptr [4 x i8*], [4 x i8*]* %A, i64 0, i64 2
}
; PR3290
@@ -550,44 +550,44 @@ define i8* @test32(i8* %v) {
define i32* @test33(%struct.Key* %A) {
; CHECK-LABEL: @test33(
-; CHECK: getelementptr %struct.Key* %A, i64 0, i32 0, i32 1
+; CHECK: getelementptr %struct.Key, %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
+ %C = getelementptr %struct.anon, %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
+; CHECK: getelementptr %struct.Key, %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
+ %C = getelementptr %struct.anon, %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
+; CHECK: getelementptr [10 x i32], [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
+ %C = getelementptr [5 x i32], [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
+; CHECK: getelementptr [10 x %struct.Key], [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
+ %C = getelementptr [20 x i32], [20 x i32] addrspace(1)* %B, i32 0, i32 2
ret i32 addrspace(1)* %C
}
define i32 addrspace(1)* @test33_addrspacecast(%struct.Key* %A) {
; CHECK-LABEL: @test33_addrspacecast(
-; CHECK: %C = getelementptr %struct.Key* %A, i64 0, i32 0, i32 1
+; CHECK: %C = getelementptr %struct.Key, %struct.Key* %A, i64 0, i32 0, i32 1
; CHECK-NEXT: addrspacecast i32* %C to i32 addrspace(1)*
; CHECK-NEXT: ret
%B = addrspacecast %struct.Key* %A to %struct.anon addrspace(1)*
- %C = getelementptr %struct.anon addrspace(1)* %B, i32 0, i32 2
+ %C = getelementptr %struct.anon, %struct.anon addrspace(1)* %B, i32 0, i32 2
ret i32 addrspace(1)* %C
}
@@ -596,10 +596,10 @@ define i8* @test34(i8* %Val, i64 %V) nounwind {
entry:
%A = alloca %T2, align 8
%mrv_gep = bitcast %T2* %A to i64*
- %B = getelementptr %T2* %A, i64 0, i32 0
+ %B = getelementptr %T2, %T2* %A, i64 0, i32 0
store i64 %V, i64* %mrv_gep
- %C = load i8** %B, align 8
+ %C = load i8*, i8** %B, align 8
ret i8* %C
; CHECK-LABEL: @test34(
; CHECK: %[[C:.*]] = inttoptr i64 %V to i8*
@@ -617,11 +617,11 @@ entry:
; Instcombine should be able to fold this getelementptr.
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
+ call i32 (i8*, ...) @printf(i8* getelementptr ([17 x i8], [17 x i8]* @"\01LC8", i32 0, i32 0),
+ i8* getelementptr (%t1, %t1* bitcast (%t0* @s to %t1*), i32 0, i32 1, i32 0)) nounwind
ret i32 0
; 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]+]]
+; CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @"\01LC8", i64 0, i64 0), i8* getelementptr inbounds (%t0, %t0* @s, i64 0, i32 1, i64 0)) [[NUW:#[0-9]+]]
}
; Instcombine should constant-fold the GEP so that indices that have
@@ -630,9 +630,9 @@ define i32 @test35() nounwind {
; the same address is computed, but 3 is in the range of [0,11).
define i8* @test36() nounwind {
- ret i8* getelementptr ([11 x i8]* @array, i32 0, i64 -1)
+ ret i8* getelementptr ([11 x i8], [11 x i8]* @array, i32 0, i64 -1)
; CHECK-LABEL: @test36(
-; CHECK: ret i8* getelementptr ([11 x i8]* @array, i64 1676976733973595601, i64 4)
+; CHECK: ret i8* getelementptr ([11 x i8], [11 x i8]* @array, i64 1676976733973595601, i64 4)
}
; Instcombine shouldn't assume that gep(A,0,1) != gep(A,1,0).
@@ -640,18 +640,18 @@ define i8* @test36() nounwind {
define i1 @test37() nounwind {
; 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)
+ %t = icmp eq i8* getelementptr ([1 x i8], [1 x i8]* @A37, i64 0, i64 1),
+ getelementptr ([1 x i8], [1 x i8]* @A37, i64 1, i64 0)
ret i1 %t
}
; Test index promotion
define i32* @test38(i32* %I, i32 %n) {
- %A = getelementptr i32* %I, i32 %n
+ %A = getelementptr i32, i32* %I, i32 %n
ret i32* %A
; CHECK-LABEL: @test38(
; CHECK: = sext i32 %n to i64
-; CHECK: %A = getelementptr i32* %I, i64 %
+; CHECK: %A = getelementptr i32, i32* %I, i64 %
}
; Test that we don't duplicate work when the second gep is a "bitcast".
@@ -660,14 +660,14 @@ declare void @pr10322_f2(%pr10322_t*)
declare void @pr10322_f3(i8**)
define void @pr10322_f1(%pr10322_t* %foo) {
entry:
- %arrayidx8 = getelementptr inbounds %pr10322_t* %foo, i64 2
+ %arrayidx8 = getelementptr inbounds %pr10322_t, %pr10322_t* %foo, i64 2
call void @pr10322_f2(%pr10322_t* %arrayidx8) nounwind
- %tmp2 = getelementptr inbounds %pr10322_t* %arrayidx8, i64 0, i32 0
+ %tmp2 = getelementptr inbounds %pr10322_t, %pr10322_t* %arrayidx8, i64 0, i32 0
call void @pr10322_f3(i8** %tmp2) nounwind
ret void
; CHECK-LABEL: @pr10322_f1(
-; CHECK: %tmp2 = getelementptr inbounds %pr10322_t* %arrayidx8, i64 0, i32 0
+; CHECK: %tmp2 = getelementptr inbounds %pr10322_t, %pr10322_t* %arrayidx8, i64 0, i32 0
}
; Test that we combine the last two geps in this sequence, before we
@@ -676,14 +676,14 @@ entry:
%three_gep_t2 = type {%three_gep_t}
define void @three_gep_f(%three_gep_t2* %x) {
- %gep1 = getelementptr %three_gep_t2* %x, i64 2
+ %gep1 = getelementptr %three_gep_t2, %three_gep_t2* %x, i64 2
call void @three_gep_h(%three_gep_t2* %gep1)
- %gep2 = getelementptr %three_gep_t2* %gep1, i64 0, i32 0
- %gep3 = getelementptr %three_gep_t* %gep2, i64 0, i32 0
+ %gep2 = getelementptr %three_gep_t2, %three_gep_t2* %gep1, i64 0, i32 0
+ %gep3 = getelementptr %three_gep_t, %three_gep_t* %gep2, i64 0, i32 0
call void @three_gep_g(i32* %gep3)
; CHECK-LABEL: @three_gep_f(
-; CHECK: %gep3 = getelementptr %three_gep_t2* %gep1, i64 0, i32 0, i32 0
+; CHECK: %gep3 = getelementptr %three_gep_t2, %three_gep_t2* %gep1, i64 0, i32 0, i32 0
ret void
}
@@ -694,21 +694,21 @@ declare void @three_gep_h(%three_gep_t2*)
%struct.zot = type { i64, i8 }
define void @test39(%struct.ham* %arg, i8 %arg1) nounwind {
- %tmp = getelementptr inbounds %struct.ham* %arg, i64 0, i32 2
- %tmp2 = load %struct.zot** %tmp, align 8
+ %tmp = getelementptr inbounds %struct.ham, %struct.ham* %arg, i64 0, i32 2
+ %tmp2 = load %struct.zot*, %struct.zot** %tmp, align 8
%tmp3 = bitcast %struct.zot* %tmp2 to i8*
- %tmp4 = getelementptr inbounds i8* %tmp3, i64 -8
+ %tmp4 = getelementptr inbounds i8, i8* %tmp3, i64 -8
store i8 %arg1, i8* %tmp4, align 8
ret void
; CHECK-LABEL: @test39(
-; CHECK: getelementptr inbounds %struct.ham* %arg, i64 0, i32 2
-; CHECK: getelementptr inbounds i8* %{{.+}}, i64 -8
+; CHECK: getelementptr inbounds %struct.ham, %struct.ham* %arg, i64 0, i32 2
+; CHECK: getelementptr inbounds i8, i8* %{{.+}}, 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
+ %c = getelementptr [1 x i8], [1 x i8]* %a, i32 0, i32 0
+ %d = getelementptr [1 x i8], [1 x i8]* %b, i32 0, i32 0
%cmp = icmp ult i8* %c, %d
ret i1 %cmp
@@ -718,82 +718,82 @@ define i1 @pr16483([1 x i8]* %a, [1 x i8]* %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: getelementptr i32, 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
+ %t = getelementptr i8, i8 addrspace(1)* %cast, i16 %V
+ %x = load i8, 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: getelementptr [100 x double], [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
+ %t = getelementptr i64, i64* %cast, i64 %V
+ %x = load i64, i64* %t
ret i64 %x
}
; gep should be done in the original address space.
define i64 @test_gep_bitcast_array_same_size_element_addrspacecast([100 x double]* %arr, i64 %N) {
; CHECK-LABEL: @test_gep_bitcast_array_same_size_element_addrspacecast(
-; CHECK: getelementptr [100 x double]* %arr, i64 0, i64 %V
+; CHECK: getelementptr [100 x double], [100 x double]* %arr, i64 0, i64 %V
; CHECK-NEXT: bitcast double*
; CHECK-NEXT: %t = addrspacecast i64*
-; CHECK: load i64 addrspace(3)* %t
+; CHECK: load i64, i64 addrspace(3)* %t
%cast = addrspacecast [100 x double]* %arr to i64 addrspace(3)*
%V = mul i64 %N, 8
- %t = getelementptr i64 addrspace(3)* %cast, i64 %V
- %x = load i64 addrspace(3)* %t
+ %t = getelementptr i64, i64 addrspace(3)* %cast, i64 %V
+ %x = load i64, i64 addrspace(3)* %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: getelementptr [100 x double], [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
+ %t = getelementptr i8, i8* %cast, i64 %V
+ %x = load i8, 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: getelementptr [100 x double], [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
+ %t = getelementptr i64, i64 addrspace(1)* %cast, i16 %V
+ %x = load i64, 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: getelementptr [100 x double], [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
+ %t = getelementptr i8, i8 addrspace(1)* %cast, i16 %V
+ %x = load i8, 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
+ %gep = getelementptr inbounds [3 x i32], [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
+ %gep2 = getelementptr i8, i8* %gepi8, i64 %np
%ret = ptrtoint i8* %gep2 to i64
ret i64 %ret
@@ -802,11 +802,11 @@ define i64 @test40() {
}
define i16 @test41([3 x i32] addrspace(1)* %array) {
- %gep = getelementptr inbounds [3 x i32] addrspace(1)* %array, i16 0, i16 2
+ %gep = getelementptr inbounds [3 x i32], [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
+ %gep2 = getelementptr i8, i8 addrspace(1)* %gepi8, i16 %np
%ret = ptrtoint i8 addrspace(1)* %gep2 to i16
ret i16 %ret
@@ -817,7 +817,7 @@ define i16 @test41([3 x i32] addrspace(1)* %array) {
define i8* @test42(i8* %c1, i8* %c2) {
%ptrtoint = ptrtoint i8* %c1 to i64
%sub = sub i64 0, %ptrtoint
- %gep = getelementptr inbounds i8* %c2, i64 %sub
+ %gep = getelementptr inbounds i8, i8* %c2, i64 %sub
ret i8* %gep
; CHECK-LABEL: @test42(
@@ -832,7 +832,7 @@ define i16* @test43(i16* %c1, i16* %c2) {
%ptrtoint = ptrtoint i16* %c1 to i64
%sub = sub i64 0, %ptrtoint
%shr = ashr i64 %sub, 1
- %gep = getelementptr inbounds i16* %c2, i64 %shr
+ %gep = getelementptr inbounds i16, i16* %c2, i64 %shr
ret i16* %gep
; CHECK-LABEL: @test43(
@@ -847,7 +847,7 @@ define %struct.C* @test44(%struct.C* %c1, %struct.C* %c2) {
%ptrtoint = ptrtoint %struct.C* %c1 to i64
%sub = sub i64 0, %ptrtoint
%shr = sdiv i64 %sub, 7
- %gep = getelementptr inbounds %struct.C* %c2, i64 %shr
+ %gep = getelementptr inbounds %struct.C, %struct.C* %c2, i64 %shr
ret %struct.C* %gep
; CHECK-LABEL: @test44(
@@ -863,7 +863,7 @@ define %struct.C* @test45(%struct.C* %c1, %struct.C** %c2) {
%ptrtoint2 = ptrtoint %struct.C** %c2 to i64
%sub = sub i64 %ptrtoint2, %ptrtoint1 ; C2 - C1
%shr = sdiv i64 %sub, 7
- %gep = getelementptr inbounds %struct.C* %c1, i64 %shr ; C1 + (C2 - C1)
+ %gep = getelementptr inbounds %struct.C, %struct.C* %c1, i64 %shr ; C1 + (C2 - C1)
ret %struct.C* %gep
; CHECK-LABEL: @test45(
@@ -875,14 +875,14 @@ define %struct.C* @test46(%struct.C* %c1, %struct.C* %c2, i64 %N) {
%ptrtoint = ptrtoint %struct.C* %c1 to i64
%sub = sub i64 0, %ptrtoint
%sdiv = sdiv i64 %sub, %N
- %gep = getelementptr inbounds %struct.C* %c2, i64 %sdiv
+ %gep = getelementptr inbounds %struct.C, %struct.C* %c2, i64 %sdiv
ret %struct.C* %gep
; CHECK-LABEL: @test46(
; CHECK-NEXT: [[PTRTOINT:%.*]] = ptrtoint %struct.C* %c1 to i64
; CHECK-NEXT: [[SUB:%.*]] = sub i64 0, [[PTRTOINT]]
; CHECK-NEXT: [[SDIV:%.*]] = sdiv i64 [[SUB]], %N
-; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds %struct.C* %c2, i64 %sdiv
+; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds %struct.C, %struct.C* %c2, i64 %sdiv
; CHECK-NEXT: ret %struct.C* [[GEP]]
}
@@ -890,7 +890,7 @@ define i32 addrspace(1)* @ascast_0_gep(i32* %p) nounwind {
; CHECK-LABEL: @ascast_0_gep(
; CHECK-NOT: getelementptr
; CHECK: ret
- %gep = getelementptr i32* %p, i32 0
+ %gep = getelementptr i32, i32* %p, i32 0
%x = addrspacecast i32* %gep to i32 addrspace(1)*
ret i32 addrspace(1)* %x
}
@@ -902,7 +902,7 @@ define i32 addrspace(1)* @ascast_0_0_gep([128 x i32]* %p) nounwind {
; CHECK-NEXT: getelementptr [128 x i32]
; CHECK-NEXT: addrspacecast i32*
; CHECK-NEXT: ret i32 addrspace(1)*
- %gep = getelementptr [128 x i32]* %p, i32 0, i32 0
+ %gep = getelementptr [128 x i32], [128 x i32]* %p, i32 0, i32 0
%x = addrspacecast i32* %gep to i32 addrspace(1)*
ret i32 addrspace(1)* %x
}
diff --git a/test/Transforms/InstCombine/icmp-range.ll b/test/Transforms/InstCombine/icmp-range.ll
index 0911ab03c6018..041adf76b5e1b 100644
--- a/test/Transforms/InstCombine/icmp-range.ll
+++ b/test/Transforms/InstCombine/icmp-range.ll
@@ -6,14 +6,14 @@
define i1 @test_nonzero(i32* nocapture readonly %arg) {
; CHECK-LABEL:test_nonzero
; CHECK: ret i1 true
- %val = load i32* %arg, !range !0
+ %val = load i32, i32* %arg, !range !0
%rval = icmp ne i32 %val, 0
ret i1 %rval
}
define i1 @test_nonzero2(i32* nocapture readonly %arg) {
; CHECK-LABEL:test_nonzero2
; CHECK: ret i1 false
- %val = load i32* %arg, !range !0
+ %val = load i32, i32* %arg, !range !0
%rval = icmp eq i32 %val, 0
ret i1 %rval
}
@@ -23,7 +23,7 @@ define i1 @test_nonzero3(i32* nocapture readonly %arg) {
; CHECK-LABEL: test_nonzero3
; Check that this does not trigger - it wouldn't be legal
; CHECK: icmp
- %val = load i32* %arg, !range !1
+ %val = load i32, i32* %arg, !range !1
%rval = icmp ne i32 %val, 0
ret i1 %rval
}
@@ -32,7 +32,7 @@ define i1 @test_nonzero3(i32* nocapture readonly %arg) {
define i1 @test_nonzero4(i8* nocapture readonly %arg) {
; CHECK-LABEL: test_nonzero4
; CHECK: ret i1 false
- %val = load i8* %arg, !range !2
+ %val = load i8, i8* %arg, !range !2
%rval = icmp ne i8 %val, 0
ret i1 %rval
}
@@ -40,7 +40,7 @@ define i1 @test_nonzero4(i8* nocapture readonly %arg) {
define i1 @test_nonzero5(i8* nocapture readonly %arg) {
; CHECK-LABEL: test_nonzero5
; CHECK: ret i1 false
- %val = load i8* %arg, !range !2
+ %val = load i8, i8* %arg, !range !2
%rval = icmp ugt i8 %val, 0
ret i1 %rval
}
@@ -49,7 +49,7 @@ define i1 @test_nonzero5(i8* nocapture readonly %arg) {
define i1 @test_nonzero6(i8* %argw) {
; CHECK-LABEL: test_nonzero6
; CHECK: icmp ne i8 %val, 0
- %val = load i8* %argw, !range !3
+ %val = load i8, i8* %argw, !range !3
%rval = icmp sgt i8 %val, 0
ret i1 %rval
}
diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll
index 64741c5712ebe..edcf76d5a7d2c 100644
--- a/test/Transforms/InstCombine/icmp.ll
+++ b/test/Transforms/InstCombine/icmp.ll
@@ -244,8 +244,8 @@ define i1 @test23(i32 %x) nounwind {
; CHECK: %cmp = icmp eq i64 %i, 1000
; CHECK: ret i1 %cmp
define i1 @test24(i64 %i) {
- %p1 = getelementptr inbounds i32* getelementptr inbounds ([1000 x i32]* @X, i64 0, i64 0), i64 %i
- %cmp = icmp eq i32* %p1, getelementptr inbounds ([1000 x i32]* @X, i64 1, i64 0)
+ %p1 = getelementptr inbounds i32, i32* getelementptr inbounds ([1000 x i32], [1000 x i32]* @X, i64 0, i64 0), i64 %i
+ %cmp = icmp eq i32* %p1, getelementptr inbounds ([1000 x i32], [1000 x i32]* @X, i64 1, i64 0)
ret i1 %cmp
}
@@ -256,8 +256,8 @@ define i1 @test24(i64 %i) {
; 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)
+ %p1 = getelementptr inbounds i32, i32 addrspace(1)* getelementptr inbounds ([1000 x i32], [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], [1000 x i32] addrspace(1)* @X_as1, i64 1, i64 0)
ret i1 %cmp
}
@@ -619,8 +619,8 @@ declare i32 @test58_d(i64)
define i1 @test59(i8* %foo) {
%bit = bitcast i8* %foo to i32*
- %gep1 = getelementptr inbounds i32* %bit, i64 2
- %gep2 = getelementptr inbounds i8* %foo, i64 10
+ %gep1 = getelementptr inbounds i32, i32* %bit, i64 2
+ %gep2 = getelementptr inbounds i8, i8* %foo, i64 10
%cast1 = bitcast i32* %gep1 to i8*
%cmp = icmp ult i8* %cast1, %gep2
%use = ptrtoint i8* %cast1 to i64
@@ -632,23 +632,23 @@ define i1 @test59(i8* %foo) {
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
+ %gep1 = getelementptr inbounds i32, i32 addrspace(1)* %bit, i64 2
+ %gep2 = getelementptr inbounds i8, 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: %[[GEP:.+]] = getelementptr inbounds i8, i8 addrspace(1)* %foo, i16 8
; CHECK: ptrtoint i8 addrspace(1)* %[[GEP]] to i16
; CHECK: ret i1 true
}
define i1 @test60(i8* %foo, i64 %i, i64 %j) {
%bit = bitcast i8* %foo to i32*
- %gep1 = getelementptr inbounds i32* %bit, i64 %i
- %gep2 = getelementptr inbounds i8* %foo, i64 %j
+ %gep1 = getelementptr inbounds i32, i32* %bit, i64 %i
+ %gep2 = getelementptr inbounds i8, i8* %foo, i64 %j
%cast1 = bitcast i32* %gep1 to i8*
%cmp = icmp ult i8* %cast1, %gep2
ret i1 %cmp
@@ -660,8 +660,8 @@ define i1 @test60(i8* %foo, i64 %i, i64 %j) {
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
+ %gep1 = getelementptr inbounds i32, i32 addrspace(1)* %bit, i64 %i
+ %gep2 = getelementptr inbounds i8, 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
@@ -677,8 +677,8 @@ define i1 @test60_as1(i8 addrspace(1)* %foo, i64 %i, i64 %j) {
; bitcast. This uses the same sized addrspace.
define i1 @test60_addrspacecast(i8* %foo, i64 %i, i64 %j) {
%bit = addrspacecast i8* %foo to i32 addrspace(3)*
- %gep1 = getelementptr inbounds i32 addrspace(3)* %bit, i64 %i
- %gep2 = getelementptr inbounds i8* %foo, i64 %j
+ %gep1 = getelementptr inbounds i32, i32 addrspace(3)* %bit, i64 %i
+ %gep2 = getelementptr inbounds i8, i8* %foo, i64 %j
%cast1 = addrspacecast i32 addrspace(3)* %gep1 to i8*
%cmp = icmp ult i8* %cast1, %gep2
ret i1 %cmp
@@ -690,8 +690,8 @@ define i1 @test60_addrspacecast(i8* %foo, i64 %i, i64 %j) {
define i1 @test60_addrspacecast_smaller(i8* %foo, i16 %i, i64 %j) {
%bit = addrspacecast i8* %foo to i32 addrspace(1)*
- %gep1 = getelementptr inbounds i32 addrspace(1)* %bit, i16 %i
- %gep2 = getelementptr inbounds i8* %foo, i64 %j
+ %gep1 = getelementptr inbounds i32, i32 addrspace(1)* %bit, i16 %i
+ %gep2 = getelementptr inbounds i8, i8* %foo, i64 %j
%cast1 = addrspacecast i32 addrspace(1)* %gep1 to i8*
%cmp = icmp ult i8* %cast1, %gep2
ret i1 %cmp
@@ -704,8 +704,8 @@ define i1 @test60_addrspacecast_smaller(i8* %foo, i16 %i, i64 %j) {
define i1 @test60_addrspacecast_larger(i8 addrspace(1)* %foo, i32 %i, i16 %j) {
%bit = addrspacecast i8 addrspace(1)* %foo to i32 addrspace(2)*
- %gep1 = getelementptr inbounds i32 addrspace(2)* %bit, i32 %i
- %gep2 = getelementptr inbounds i8 addrspace(1)* %foo, i16 %j
+ %gep1 = getelementptr inbounds i32, i32 addrspace(2)* %bit, i32 %i
+ %gep2 = getelementptr inbounds i8, i8 addrspace(1)* %foo, i16 %j
%cast1 = addrspacecast i32 addrspace(2)* %gep1 to i8 addrspace(1)*
%cmp = icmp ult i8 addrspace(1)* %cast1, %gep2
ret i1 %cmp
@@ -718,8 +718,8 @@ define i1 @test60_addrspacecast_larger(i8 addrspace(1)* %foo, i32 %i, i16 %j) {
define i1 @test61(i8* %foo, i64 %i, i64 %j) {
%bit = bitcast i8* %foo to i32*
- %gep1 = getelementptr i32* %bit, i64 %i
- %gep2 = getelementptr i8* %foo, i64 %j
+ %gep1 = getelementptr i32, i32* %bit, i64 %i
+ %gep2 = getelementptr i8, i8* %foo, i64 %j
%cast1 = bitcast i32* %gep1 to i8*
%cmp = icmp ult i8* %cast1, %gep2
ret i1 %cmp
@@ -731,8 +731,8 @@ define i1 @test61(i8* %foo, i64 %i, i64 %j) {
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
+ %gep1 = getelementptr i32, i32 addrspace(1)* %bit, i16 %i
+ %gep2 = getelementptr i8, 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
@@ -743,8 +743,8 @@ define i1 @test61_as1(i8 addrspace(1)* %foo, i16 %i, i16 %j) {
}
define i1 @test62(i8* %a) {
- %arrayidx1 = getelementptr inbounds i8* %a, i64 1
- %arrayidx2 = getelementptr inbounds i8* %a, i64 10
+ %arrayidx1 = getelementptr inbounds i8, i8* %a, i64 1
+ %arrayidx2 = getelementptr inbounds i8, i8* %a, i64 10
%cmp = icmp slt i8* %arrayidx1, %arrayidx2
ret i1 %cmp
; CHECK-LABEL: @test62(
@@ -754,8 +754,8 @@ define i1 @test62(i8* %a) {
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
+ %arrayidx1 = getelementptr inbounds i8, i8 addrspace(1)* %a, i64 1
+ %arrayidx2 = getelementptr inbounds i8, i8 addrspace(1)* %a, i64 10
%cmp = icmp slt i8 addrspace(1)* %arrayidx1, %arrayidx2
ret i1 %cmp
}
@@ -1115,8 +1115,8 @@ define i1 @icmp_add_and_shr_ne_0(i32 %X) {
; 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
+ %a = getelementptr i8, i8* %x, i64 8
+ %b = getelementptr inbounds i8, i8* %x, i64 8
%c = icmp ugt i8* %a, %b
ret i1 %c
}
@@ -1124,8 +1124,8 @@ define i1 @test71(i8* %x) {
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
+ %a = getelementptr i8, i8 addrspace(1)* %x, i64 8
+ %b = getelementptr inbounds i8, i8 addrspace(1)* %x, i64 8
%c = icmp ugt i8 addrspace(1)* %a, %b
ret i1 %c
}
@@ -1573,3 +1573,33 @@ define i32 @f5(i8 %a, i8 %b) {
%sub7.sub = select i1 %cmp4, i32 %sub7, i32 %sub
ret i32 %sub7.sub
}
+
+; CHECK-LABEL: @f6
+; CHECK: %cmp.unshifted = xor i32 %a, %b
+; CHECK-NEXT: %cmp.mask = and i32 %cmp.unshifted, 255
+; CHECK-NEXT: %cmp = icmp eq i32 %cmp.mask, 0
+; CHECK-NEXT: %s = select i1 %cmp, i32 10000, i32 0
+; CHECK-NEXT: ret i32 %s
+define i32 @f6(i32 %a, i32 %b) {
+ %sext = shl i32 %a, 24
+ %conv = ashr i32 %sext, 24
+ %sext6 = shl i32 %b, 24
+ %conv4 = ashr i32 %sext6, 24
+ %cmp = icmp eq i32 %conv, %conv4
+ %s = select i1 %cmp, i32 10000, i32 0
+ ret i32 %s
+}
+
+; CHECK-LABEL: @f7
+; CHECK: %cmp.unshifted = xor i32 %a, %b
+; CHECK-NEXT: %cmp.mask = and i32 %cmp.unshifted, 511
+; CHECK-NEXT: %cmp = icmp ne i32 %cmp.mask, 0
+; CHECK-NEXT: %s = select i1 %cmp, i32 10000, i32 0
+; CHECK-NEXT: ret i32 %s
+define i32 @f7(i32 %a, i32 %b) {
+ %sext = shl i32 %a, 23
+ %sext6 = shl i32 %b, 23
+ %cmp = icmp ne i32 %sext, %sext6
+ %s = select i1 %cmp, i32 10000, i32 0
+ ret i32 %s
+}
diff --git a/test/Transforms/InstCombine/inline-intrinsic-assert.ll b/test/Transforms/InstCombine/inline-intrinsic-assert.ll
new file mode 100644
index 0000000000000..af34277563e09
--- /dev/null
+++ b/test/Transforms/InstCombine/inline-intrinsic-assert.ll
@@ -0,0 +1,30 @@
+; RUN: opt < %s -inline -instcombine -S | FileCheck %s
+
+; PR22857: http://llvm.org/bugs/show_bug.cgi?id=22857
+; The inliner should not add an edge to an intrinsic and
+; then assert that it did not add an edge to an intrinsic!
+
+define float @foo(float %f1) #0 {
+ %call = call float @bar(float %f1)
+ ret float %call
+
+; CHECK-LABEL: @foo(
+; CHECK-NEXT: call float @llvm.fabs.f32
+; CHECK-NEXT: ret float
+}
+
+define float @bar(float %f1) #0 {
+ %call = call float @sqr(float %f1)
+ %call1 = call float @sqrtf(float %call) #0
+ ret float %call1
+}
+
+define float @sqr(float %f) #0 {
+ %mul = fmul fast float %f, %f
+ ret float %mul
+}
+
+declare float @sqrtf(float) #0
+
+attributes #0 = { "unsafe-fp-math"="true" }
+
diff --git a/test/Transforms/InstCombine/intrinsics.ll b/test/Transforms/InstCombine/intrinsics.ll
index 8e7742f8c34a1..9767704c85cfd 100644
--- a/test/Transforms/InstCombine/intrinsics.ll
+++ b/test/Transforms/InstCombine/intrinsics.ll
@@ -349,7 +349,8 @@ define i32 @ctlz_select(i32 %Value) nounwind {
ret i32 %s
; CHECK-LABEL: @ctlz_select(
-; CHECK: select i1 %tobool, i32 %ctlz, i32 32
+; CHECK-NEXT: call i32 @llvm.ctlz.i32(i32 %Value, i1 false)
+; CHECK-NEXT: ret i32
}
define i32 @cttz_select(i32 %Value) nounwind {
@@ -359,5 +360,68 @@ define i32 @cttz_select(i32 %Value) nounwind {
ret i32 %s
; CHECK-LABEL: @cttz_select(
-; CHECK: select i1 %tobool, i32 %cttz, i32 32
+; CHECK-NEXT: call i32 @llvm.cttz.i32(i32 %Value, i1 false)
+; CHECK-NEXT: ret i32
+}
+
+; CHECK-LABEL: @overflow_div_add(
+; CHECK: ret i1 false
+define i1 @overflow_div_add(i32 %v1, i32 %v2) nounwind {
+entry:
+ %div = sdiv i32 %v1, 2
+ %t = call %ov.result.32 @llvm.sadd.with.overflow.i32(i32 %div, i32 1)
+ %obit = extractvalue %ov.result.32 %t, 1
+ ret i1 %obit
+}
+
+; CHECK-LABEL: @overflow_div_sub(
+; CHECK: ret i1 false
+define i1 @overflow_div_sub(i32 %v1, i32 %v2) nounwind {
+entry:
+ ; Check cases where the known sign bits are larger than the word size.
+ %a = ashr i32 %v1, 18
+ %div = sdiv i32 %a, 65536
+ %t = call %ov.result.32 @llvm.ssub.with.overflow.i32(i32 %div, i32 1)
+ %obit = extractvalue %ov.result.32 %t, 1
+ ret i1 %obit
+}
+
+; CHECK-LABEL: @overflow_mod_mul(
+; CHECK: ret i1 false
+define i1 @overflow_mod_mul(i32 %v1, i32 %v2) nounwind {
+entry:
+ %rem = srem i32 %v1, 1000
+ %t = call %ov.result.32 @llvm.smul.with.overflow.i32(i32 %rem, i32 %rem)
+ %obit = extractvalue %ov.result.32 %t, 1
+ ret i1 %obit
+}
+
+; CHECK-LABEL: @overflow_mod_overflow_mul(
+; CHECK-NOT: ret i1 false
+define i1 @overflow_mod_overflow_mul(i32 %v1, i32 %v2) nounwind {
+entry:
+ %rem = srem i32 %v1, 65537
+ ; This may overflow because the result of the mul operands may be greater than 16bits
+ ; and the result greater than 32.
+ %t = call %ov.result.32 @llvm.smul.with.overflow.i32(i32 %rem, i32 %rem)
+ %obit = extractvalue %ov.result.32 %t, 1
+ ret i1 %obit
+}
+
+define %ov.result.32 @ssubtest_reorder(i8 %a) {
+ %A = sext i8 %a to i32
+ %x = call %ov.result.32 @llvm.ssub.with.overflow.i32(i32 0, i32 %A)
+ ret %ov.result.32 %x
+; CHECK-LABEL: @ssubtest_reorder
+; CHECK: %x = sub nsw i32 0, %A
+; CHECK-NEXT: %1 = insertvalue %ov.result.32 { i32 undef, i1 false }, i32 %x, 0
+; CHECK-NEXT: ret %ov.result.32 %1
+}
+
+define %ov.result.32 @never_overflows_ssub_test0(i32 %a) {
+ %x = call %ov.result.32 @llvm.ssub.with.overflow.i32(i32 %a, i32 0)
+ ret %ov.result.32 %x
+; CHECK-LABEL: @never_overflows_ssub_test0
+; CHECK-NEXT: %[[x:.*]] = insertvalue %ov.result.32 { i32 undef, i1 false }, i32 %a, 0
+; CHECK-NEXT: ret %ov.result.32 %[[x]]
}
diff --git a/test/Transforms/InstCombine/invariant.ll b/test/Transforms/InstCombine/invariant.ll
index 383238022692c..246f9e6404170 100644
--- a/test/Transforms/InstCombine/invariant.ll
+++ b/test/Transforms/InstCombine/invariant.ll
@@ -11,6 +11,6 @@ define i8 @f() {
%i = call {}* @llvm.invariant.start(i64 1, i8* %a) ; <{}*> [#uses=0]
; CHECK: call {}* @llvm.invariant.start
call void @g(i8* %a)
- %r = load i8* %a ; <i8> [#uses=1]
+ %r = load i8, i8* %a ; <i8> [#uses=1]
ret i8 %r
}
diff --git a/test/Transforms/InstCombine/known_align.ll b/test/Transforms/InstCombine/known_align.ll
index 0249951966dcc..653c4c51e2da6 100644
--- a/test/Transforms/InstCombine/known_align.ll
+++ b/test/Transforms/InstCombine/known_align.ll
@@ -11,17 +11,17 @@ entry:
%tmp = alloca i32, align 4 ; <i32*> [#uses=2]
%tmp1 = alloca i32, align 4 ; <i32*> [#uses=3]
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
- %tmp3 = load i32* getelementptr (%struct.p* @t, i32 0, i32 1), align 1 ; <i32> [#uses=1]
+ %tmp3 = load i32, i32* getelementptr (%struct.p, %struct.p* @t, i32 0, i32 1), align 1 ; <i32> [#uses=1]
store i32 %tmp3, i32* %tmp1, align 4
- %tmp5 = load i32* %tmp1, align 4 ; <i32> [#uses=1]
- store i32 %tmp5, i32* getelementptr (%struct.p* @u, i32 0, i32 1), align 1
- %tmp6 = load i32* %tmp1, align 4 ; <i32> [#uses=1]
+ %tmp5 = load i32, i32* %tmp1, align 4 ; <i32> [#uses=1]
+ store i32 %tmp5, i32* getelementptr (%struct.p, %struct.p* @u, i32 0, i32 1), align 1
+ %tmp6 = load i32, i32* %tmp1, align 4 ; <i32> [#uses=1]
store i32 %tmp6, i32* %tmp, align 4
- %tmp7 = load i32* %tmp, align 4 ; <i32> [#uses=1]
+ %tmp7 = load i32, i32* %tmp, align 4 ; <i32> [#uses=1]
store i32 %tmp7, i32* %retval, align 4
br label %return
return: ; preds = %entry
- %retval8 = load i32* %retval ; <i32> [#uses=1]
+ %retval8 = load i32, i32* %retval ; <i32> [#uses=1]
ret i32 %retval8
}
diff --git a/test/Transforms/InstCombine/load-cmp.ll b/test/Transforms/InstCombine/load-cmp.ll
index 98100263b48ca..b0bfdc4c4c54c 100644
--- a/test/Transforms/InstCombine/load-cmp.ll
+++ b/test/Transforms/InstCombine/load-cmp.ll
@@ -1,5 +1,4 @@
-; 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
+; RUN: opt -instcombine -S -default-data-layout="p:32:32:32-p1:16:16:16-n8:16:32:64" < %s | FileCheck %s
@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]
@@ -21,185 +20,137 @@
define i1 @test1(i32 %X) {
- %P = getelementptr inbounds [10 x i16]* @G16, i32 0, i32 %X
- %Q = load i16* %P
+ %P = getelementptr inbounds [10 x i16], [10 x i16]* @G16, i32 0, i32 %X
+ %Q = load i16, i16* %P
%R = icmp eq i16 %Q, 0
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
+; CHECK-LABEL: @test1(
+; CHECK-NEXT: %R = icmp eq i32 %X, 9
+; CHECK-NEXT: ret i1 %R
}
define i1 @test1_noinbounds(i32 %X) {
- %P = getelementptr [10 x i16]* @G16, i32 0, i32 %X
- %Q = load i16* %P
+ %P = getelementptr [10 x i16], [10 x i16]* @G16, i32 0, i32 %X
+ %Q = load i16, 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
+; CHECK-LABEL: @test1_noinbounds(
+; CHECK-NEXT: %R = icmp eq i32 %X, 9
+; CHECK-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
+ %P = getelementptr [10 x i16], [10 x i16]* @G16, i64 0, i64 %X
+ %Q = load i16, 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
+; CHECK-LABEL: @test1_noinbounds_i64(
+; CHECK: %R = icmp eq i32 %1, 9
+; CHECK-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
+ %p = getelementptr [10 x i16], [10 x i16] addrspace(1)* @G16_as1, i16 0, i32 %x
+ %q = load i16, 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
+; CHECK-LABEL: @test1_noinbounds_as1(
+; CHECK-NEXT: trunc i32 %x to i16
+; CHECK-NEXT: %r = icmp eq i16 %1, 9
+; CHECK-NEXT: ret i1 %r
}
define i1 @test2(i32 %X) {
- %P = getelementptr inbounds [10 x i16]* @G16, i32 0, i32 %X
- %Q = load i16* %P
+ %P = getelementptr inbounds [10 x i16], [10 x i16]* @G16, i32 0, i32 %X
+ %Q = load i16, i16* %P
%R = icmp slt i16 %Q, 85
ret i1 %R
-; NODL-LABEL: @test2(
-; NODL-NEXT: %R = icmp ne i32 %X, 4
-; NODL-NEXT: ret i1 %R
+; CHECK-LABEL: @test2(
+; CHECK-NEXT: %R = icmp ne i32 %X, 4
+; CHECK-NEXT: ret i1 %R
}
define i1 @test3(i32 %X) {
- %P = getelementptr inbounds [6 x double]* @GD, i32 0, i32 %X
- %Q = load double* %P
+ %P = getelementptr inbounds [6 x double], [6 x double]* @GD, i32 0, i32 %X
+ %Q = load double, double* %P
%R = fcmp oeq double %Q, 1.0
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
+; CHECK-LABEL: @test3(
+; CHECK-NEXT: %R = icmp eq i32 %X, 1
+; CHECK-NEXT: ret i1 %R
}
define i1 @test4(i32 %X) {
- %P = getelementptr inbounds [10 x i16]* @G16, i32 0, i32 %X
- %Q = load i16* %P
+ %P = getelementptr inbounds [10 x i16], [10 x i16]* @G16, i32 0, i32 %X
+ %Q = load i16, i16* %P
%R = icmp sle i16 %Q, 73
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
+; CHECK-LABEL: @test4(
+; CHECK-NEXT: lshr i32 933, %X
+; CHECK-NEXT: and i32 {{.*}}, 1
+; CHECK-NEXT: %R = icmp ne i32 {{.*}}, 0
+; CHECK-NEXT: ret i1 %R
}
define i1 @test4_i16(i16 %X) {
- %P = getelementptr inbounds [10 x i16]* @G16, i32 0, i16 %X
- %Q = load i16* %P
+ %P = getelementptr inbounds [10 x i16], [10 x i16]* @G16, i32 0, i16 %X
+ %Q = load i16, i16* %P
%R = icmp sle i16 %Q, 73
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
+; CHECK-LABEL: @test4_i16(
+; CHECK-NEXT: sext i16 %X to i32
+; CHECK-NEXT: lshr i32 933, %1
+; CHECK-NEXT: and i32 {{.*}}, 1
+; CHECK-NEXT: %R = icmp ne i32 {{.*}}, 0
+; CHECK-NEXT: ret i1 %R
}
define i1 @test5(i32 %X) {
- %P = getelementptr inbounds [10 x i16]* @G16, i32 0, i32 %X
- %Q = load i16* %P
+ %P = getelementptr inbounds [10 x i16], [10 x i16]* @G16, i32 0, i32 %X
+ %Q = load i16, i16* %P
%R = icmp eq i16 %Q, 69
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
+; CHECK-LABEL: @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
}
define i1 @test6(i32 %X) {
- %P = getelementptr inbounds [6 x double]* @GD, i32 0, i32 %X
- %Q = load double* %P
+ %P = getelementptr inbounds [6 x double], [6 x double]* @GD, i32 0, i32 %X
+ %Q = load double, double* %P
%R = fcmp ogt double %Q, 0.0
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
+; CHECK-LABEL: @test6(
+; CHECK-NEXT: add i32 %X, -1
+; CHECK-NEXT: %R = icmp ult i32 {{.*}}, 3
+; CHECK-NEXT: ret i1 %R
}
define i1 @test7(i32 %X) {
- %P = getelementptr inbounds [6 x double]* @GD, i32 0, i32 %X
- %Q = load double* %P
+ %P = getelementptr inbounds [6 x double], [6 x double]* @GD, i32 0, i32 %X
+ %Q = load double, double* %P
%R = fcmp olt double %Q, 0.0
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
+; CHECK-LABEL: @test7(
+; CHECK-NEXT: add i32 %X, -1
+; CHECK-NEXT: %R = icmp ugt i32 {{.*}}, 2
+; CHECK-NEXT: ret i1 %R
}
define i1 @test8(i32 %X) {
- %P = getelementptr inbounds [10 x i16]* @G16, i32 0, i32 %X
- %Q = load i16* %P
+ %P = getelementptr inbounds [10 x i16], [10 x i16]* @G16, i32 0, i32 %X
+ %Q = load i16, i16* %P
%R = and i16 %Q, 3
%S = icmp eq i16 %R, 0
ret i1 %S
-; 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
+; CHECK-LABEL: @test8(
+; CHECK-NEXT: and i32 %X, -2
+; CHECK-NEXT: icmp eq i32 {{.*}}, 8
+; CHECK-NEXT: ret i1
}
@GA = internal constant [4 x { i32, i32 } ] [
@@ -210,41 +161,30 @@ define i1 @test8(i32 %X) {
]
define i1 @test9(i32 %X) {
- %P = getelementptr inbounds [4 x { i32, i32 } ]* @GA, i32 0, i32 %X, i32 1
- %Q = load i32* %P
+ %P = getelementptr inbounds [4 x { i32, i32 } ], [4 x { i32, i32 } ]* @GA, i32 0, i32 %X, i32 1
+ %Q = load i32, i32* %P
%R = icmp eq i32 %Q, 1
ret i1 %R
-; 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
+; CHECK-LABEL: @test9(
+; CHECK-NEXT: add i32 %X, -1
+; CHECK-NEXT: icmp ult i32 {{.*}}, 2
+; CHECK-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
+; CHECK-LABEL: @test10_struct(
+; CHECK: ret i1 false
+ %p = getelementptr inbounds %Foo, %Foo* @GS, i32 %x, i32 0
+ %q = load i32, 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
+; CHECK-LABEL: @test10_struct_noinbounds(
+; CHECK: getelementptr %Foo, %Foo* @GS, i32 %x, i32 0
+ %p = getelementptr %Foo, %Foo* @GS, i32 %x, i32 0
+ %q = load i32, i32* %p
%r = icmp eq i32 %q, 9
ret i1 %r
}
@@ -252,14 +192,10 @@ define i1 @test10_struct_noinbounds(i32 %x) {
; 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
+; CHECK-LABEL: @test10_struct_i16(
+; CHECK: ret i1 false
+ %p = getelementptr inbounds %Foo, %Foo* @GS, i16 %x, i32 0
+ %q = load i32, i32* %p
%r = icmp eq i32 %q, 0
ret i1 %r
}
@@ -267,108 +203,79 @@ define i1 @test10_struct_i16(i16 %x){
; 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
+; CHECK-LABEL: @test10_struct_i64(
+; CHECK: ret i1 false
+ %p = getelementptr inbounds %Foo, %Foo* @GS, i64 %x, i32 0
+ %q = load i32, 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
+; CHECK-LABEL: @test10_struct_noinbounds_i16(
+; CHECK: %1 = sext i16 %x to i32
+; CHECK: getelementptr %Foo, %Foo* @GS, i32 %1, i32 0
+ %p = getelementptr %Foo, %Foo* @GS, i16 %x, i32 0
+ %q = load i32, 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
+; CHECK-LABEL: @test10_struct_arr(
+; CHECK-NEXT: %r = icmp ne i32 %x, 1
+; CHECK-NEXT: ret i1 %r
+ %p = getelementptr inbounds [4 x %Foo], [4 x %Foo]* @GStructArr, i32 0, i32 %x, i32 2
+ %q = load i32, 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
+; CHECK-LABEL: @test10_struct_arr_noinbounds(
+; CHECK-NEXT %p = getelementptr [4 x %Foo], [4 x %Foo]* @GStructArr, i32 0, i32 %x, i32 2
+ %p = getelementptr [4 x %Foo], [4 x %Foo]* @GStructArr, i32 0, i32 %x, i32 2
+ %q = load i32, 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
+; CHECK-LABEL: @test10_struct_arr_i16(
+; CHECK-NEXT: %r = icmp ne i16 %x, 1
+; CHECK-NEXT: ret i1 %r
+ %p = getelementptr inbounds [4 x %Foo], [4 x %Foo]* @GStructArr, i16 0, i16 %x, i32 2
+ %q = load i32, 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
+; CHECK-LABEL: @test10_struct_arr_i64(
+; CHECK-NEXT: trunc i64 %x to i32
+; CHECK-NEXT: %r = icmp ne i32 %1, 1
+; CHECK-NEXT: ret i1 %r
+ %p = getelementptr inbounds [4 x %Foo], [4 x %Foo]* @GStructArr, i64 0, i64 %x, i32 2
+ %q = load i32, 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
+; CHECK-LABEL: @test10_struct_arr_noinbounds_i16(
+; CHECK-NEXT: %r = icmp ne i16 %x, 1
+ %p = getelementptr [4 x %Foo], [4 x %Foo]* @GStructArr, i32 0, i16 %x, i32 2
+ %q = load i32, 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
+; CHECK-LABEL: @test10_struct_arr_noinbounds_i64(
+; CHECK: %r = icmp ne i32 %1, 1
+; CHECK-NEXT: ret i1 %r
+ %p = getelementptr [4 x %Foo], [4 x %Foo]* @GStructArr, i32 0, i64 %x, i32 2
+ %q = load i32, 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 e8cbad335dea9..dfc07983eff42 100644
--- a/test/Transforms/InstCombine/load-select.ll
+++ b/test/Transforms/InstCombine/load-select.ll
@@ -10,7 +10,7 @@ define i32 @b(i32 %y) nounwind readonly {
; CHECK: ret i32
entry:
%0 = icmp eq i32 %y, 0 ; <i1> [#uses=1]
- %storemerge = select i1 %0, i32* getelementptr inbounds ([2 x i32]* @a, i32 0, i32 1), i32* getelementptr inbounds ([2 x i32]* @a, i32 0, i32 0) ; <i32*> [#uses=1]
- %1 = load i32* %storemerge, align 4 ; <i32> [#uses=1]
+ %storemerge = select i1 %0, i32* getelementptr inbounds ([2 x i32], [2 x i32]* @a, i32 0, i32 1), i32* getelementptr inbounds ([2 x i32], [2 x i32]* @a, i32 0, i32 0) ; <i32*> [#uses=1]
+ %1 = load i32, i32* %storemerge, align 4 ; <i32> [#uses=1]
ret i32 %1
}
diff --git a/test/Transforms/InstCombine/load.ll b/test/Transforms/InstCombine/load.ll
index b4b7558a1a05a..2cc55e99fd20f 100644
--- a/test/Transforms/InstCombine/load.ll
+++ b/test/Transforms/InstCombine/load.ll
@@ -1,8 +1,9 @@
; RUN: opt -instcombine -S < %s | FileCheck %s
+; RUN: opt -passes=instcombine -S < %s | FileCheck %s
; This test makes sure that these instructions are properly eliminated.
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-p:64:64:64-i64:64-f80:128-n8:16:32:64-S128"
@X = constant i32 42 ; <i32*> [#uses=2]
@X2 = constant i32 47 ; <i32*> [#uses=1]
@@ -15,31 +16,31 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
; CHECK-LABEL: @test1(
; CHECK-NOT: load
define i32 @test1() {
- %B = load i32* @X ; <i32> [#uses=1]
+ %B = load i32, i32* @X ; <i32> [#uses=1]
ret i32 %B
}
; CHECK-LABEL: @test2(
; CHECK-NOT: load
define float @test2() {
- %A = getelementptr [2 x { i32, float }]* @Y, i64 0, i64 1, i32 1 ; <float*> [#uses=1]
- %B = load float* %A ; <float> [#uses=1]
+ %A = getelementptr [2 x { i32, float }], [2 x { i32, float }]* @Y, i64 0, i64 1, i32 1 ; <float*> [#uses=1]
+ %B = load float, float* %A ; <float> [#uses=1]
ret float %B
}
; CHECK-LABEL: @test3(
; CHECK-NOT: load
define i32 @test3() {
- %A = getelementptr [2 x { i32, float }]* @Y, i64 0, i64 0, i32 0 ; <i32*> [#uses=1]
- %B = load i32* %A ; <i32> [#uses=1]
+ %A = getelementptr [2 x { i32, float }], [2 x { i32, float }]* @Y, i64 0, i64 0, i32 0 ; <i32*> [#uses=1]
+ %B = load i32, i32* %A ; <i32> [#uses=1]
ret i32 %B
}
; CHECK-LABEL: @test4(
; CHECK-NOT: load
define i32 @test4() {
- %A = getelementptr [2 x { i32, float }]* @Z, i64 0, i64 1, i32 0 ; <i32*> [#uses=1]
- %B = load i32* %A ; <i32> [#uses=1]
+ %A = getelementptr [2 x { i32, float }], [2 x { i32, float }]* @Z, i64 0, i64 1, i32 0 ; <i32*> [#uses=1]
+ %B = load i32, i32* %A ; <i32> [#uses=1]
ret i32 %B
}
@@ -47,15 +48,15 @@ define i32 @test4() {
; CHECK-NOT: load
define i32 @test5(i1 %C) {
%Y = select i1 %C, i32* @X, i32* @X2 ; <i32*> [#uses=1]
- %Z = load i32* %Y ; <i32> [#uses=1]
+ %Z = load i32, i32* %Y ; <i32> [#uses=1]
ret i32 %Z
}
; CHECK-LABEL: @test7(
; CHECK-NOT: load
define i32 @test7(i32 %X) {
- %V = getelementptr i32* null, i32 %X ; <i32*> [#uses=1]
- %R = load i32* %V ; <i32> [#uses=1]
+ %V = getelementptr i32, i32* null, i32 %X ; <i32*> [#uses=1]
+ %R = load i32, i32* %V ; <i32> [#uses=1]
ret i32 %R
}
@@ -63,15 +64,15 @@ define i32 @test7(i32 %X) {
; CHECK-NOT: load
define i32 @test8(i32* %P) {
store i32 1, i32* %P
- %X = load i32* %P ; <i32> [#uses=1]
+ %X = load i32, i32* %P ; <i32> [#uses=1]
ret i32 %X
}
; CHECK-LABEL: @test9(
; CHECK-NOT: load
define i32 @test9(i32* %P) {
- %X = load i32* %P ; <i32> [#uses=1]
- %Y = load i32* %P ; <i32> [#uses=1]
+ %X = load i32, i32* %P ; <i32> [#uses=1]
+ %Y = load i32, i32* %P ; <i32> [#uses=1]
%Z = sub i32 %X, %Y ; <i32> [#uses=1]
ret i32 %Z
}
@@ -88,17 +89,17 @@ F: ; preds = %0
store i32 0, i32* %P
br label %C
C: ; preds = %F, %T
- %V = load i32* %P ; <i32> [#uses=1]
+ %V = load i32, i32* %P ; <i32> [#uses=1]
ret i32 %V
}
; CHECK-LABEL: @test11(
; CHECK-NOT: load
define double @test11(double* %p) {
- %t0 = getelementptr double* %p, i32 1
+ %t0 = getelementptr double, double* %p, i32 1
store double 2.0, double* %t0
- %t1 = getelementptr double* %p, i32 1
- %x = load double* %t1
+ %t1 = getelementptr double, double* %p, i32 1
+ %x = load double, double* %t1
ret double %x
}
@@ -109,14 +110,14 @@ define i32 @test12(i32* %P) {
store i32 123, i32* %A
; Cast the result of the load not the source
%Q = bitcast i32* %A to i32*
- %V = load i32* %Q
+ %V = load i32, i32* %Q
ret i32 %V
}
; CHECK-LABEL: @test13(
; CHECK-NOT: load
define <16 x i8> @test13(<2 x i64> %x) {
- %tmp = load <16 x i8>* bitcast ([4 x i32]* @GLOBAL to <16 x i8>*)
+ %tmp = load <16 x i8>, <16 x i8>* bitcast ([4 x i32]* @GLOBAL to <16 x i8>*)
ret <16 x i8> %tmp
}
@@ -127,13 +128,13 @@ define i8 @test14(i8 %x, i32 %y) {
; those confuse the analysis into thinking that the second store does not alias
; the first.
; CHECK-LABEL: @test14(
-; CHECK: %[[R:.*]] = load i8*
+; CHECK: %[[R:.*]] = load i8, i8*
; CHECK-NEXT: ret i8 %[[R]]
%a = alloca i32
%a.i8 = bitcast i32* %a to i8*
store i8 %x, i8* %a.i8
store i32 %y, i32* %a
- %r = load i8* %a.i8
+ %r = load i8, i8* %a.i8
ret i8 %r
}
@@ -142,11 +143,61 @@ define i8 @test14(i8 %x, i32 %y) {
define i8 @test15(i8 %x, i32 %y) {
; Same test as @test14 essentially, but using a global instead of an alloca.
; CHECK-LABEL: @test15(
-; CHECK: %[[R:.*]] = load i8*
+; CHECK: %[[R:.*]] = load i8, i8*
; CHECK-NEXT: ret i8 %[[R]]
%g.i8 = bitcast i32* @test15_global to i8*
store i8 %x, i8* %g.i8
store i32 %y, i32* @test15_global
- %r = load i8* %g.i8
+ %r = load i8, i8* %g.i8
ret i8 %r
}
+
+define void @test16(i8* %x, i8* %a, i8* %b, i8* %c) {
+; Check that we canonicalize loads which are only stored to use integer types
+; when there is a valid integer type.
+; CHECK-LABEL: @test16(
+; CHECK: %[[L1:.*]] = load i32, i32*
+; CHECK-NOT: load
+; CHECK: store i32 %[[L1]], i32*
+; CHECK: store i32 %[[L1]], i32*
+; CHECK-NOT: store
+; CHECK: %[[L1:.*]] = load i32, i32*
+; CHECK-NOT: load
+; CHECK: store i32 %[[L1]], i32*
+; CHECK: store i32 %[[L1]], i32*
+; CHECK-NOT: store
+; CHECK: ret
+
+entry:
+ %x.cast = bitcast i8* %x to float*
+ %a.cast = bitcast i8* %a to float*
+ %b.cast = bitcast i8* %b to float*
+ %c.cast = bitcast i8* %c to i32*
+
+ %x1 = load float, float* %x.cast
+ store float %x1, float* %a.cast
+ store float %x1, float* %b.cast
+
+ %x2 = load float, float* %x.cast
+ store float %x2, float* %b.cast
+ %x2.cast = bitcast float %x2 to i32
+ store i32 %x2.cast, i32* %c.cast
+
+ ret void
+}
+
+define void @test17(i8** %x, i8 %y) {
+; Check that in cases similar to @test16 we don't try to rewrite a load when
+; its only use is a store but it is used as the pointer to that store rather
+; than the value.
+;
+; CHECK-LABEL: @test17(
+; CHECK: %[[L:.*]] = load i8*, i8**
+; CHECK: store i8 %y, i8* %[[L]]
+
+entry:
+ %x.load = load i8*, i8** %x
+ store i8 %y, i8* %x.load
+
+ ret void
+}
diff --git a/test/Transforms/InstCombine/load3.ll b/test/Transforms/InstCombine/load3.ll
index f79ef9a695c2c..6db8dd391fa1d 100644
--- a/test/Transforms/InstCombine/load3.ll
+++ b/test/Transforms/InstCombine/load3.ll
@@ -5,10 +5,10 @@ target triple = "i386-apple-macosx10.0.0"
; Instcombine should be able to do trivial CSE of loads.
define i32 @test1(i32* %p) {
- %t0 = getelementptr i32* %p, i32 1
- %y = load i32* %t0
- %t1 = getelementptr i32* %p, i32 1
- %x = load i32* %t1
+ %t0 = getelementptr i32, i32* %p, i32 1
+ %y = load i32, i32* %t0
+ %t1 = getelementptr i32, i32* %p, i32 1
+ %x = load i32, i32* %t1
%a = sub i32 %y, %x
ret i32 %a
; CHECK-LABEL: @test1(
@@ -19,7 +19,7 @@ define i32 @test1(i32* %p) {
; PR7429
@.str = private constant [4 x i8] c"XYZ\00"
define float @test2() {
- %tmp = load float* bitcast ([4 x i8]* @.str to float*), align 1
+ %tmp = load float, float* bitcast ([4 x i8]* @.str to float*), align 1
ret float %tmp
; CHECK-LABEL: @test2(
@@ -37,10 +37,10 @@ align 4
; PR14986
define void @test3() nounwind {
; This is a weird way of computing zero.
- %l = load i32* getelementptr ([36 x i32]* @expect32, i32 29826161, i32 28), align 4
- store i32 %l, i32* getelementptr ([36 x i32]* @rslts32, i32 29826161, i32 28), align 4
+ %l = load i32, i32* getelementptr ([36 x i32], [36 x i32]* @expect32, i32 29826161, i32 28), align 4
+ store i32 %l, i32* getelementptr ([36 x i32], [36 x i32]* @rslts32, i32 29826161, i32 28), align 4
ret void
; CHECK-LABEL: @test3(
-; CHECK: store i32 1, i32* getelementptr inbounds ([36 x i32]* @rslts32, i32 0, i32 0)
+; CHECK: store i32 1, i32* getelementptr inbounds ([36 x i32], [36 x i32]* @rslts32, i32 0, i32 0)
}
diff --git a/test/Transforms/InstCombine/loadstore-alignment.ll b/test/Transforms/InstCombine/loadstore-alignment.ll
index e90bdb7cdd990..4afa82dcb4c52 100644
--- a/test/Transforms/InstCombine/loadstore-alignment.ll
+++ b/test/Transforms/InstCombine/loadstore-alignment.ll
@@ -9,58 +9,58 @@ target datalayout = "E-p:64:64:64-p1:64:64:64-p2:32:32:32-a0:0:8-f32:32:32-f64:6
; CHECK-LABEL: @static_hem(
; CHECK: , align 16
define <2 x i64> @static_hem() {
- %t = getelementptr <2 x i64>* @x, i32 7
- %tmp1 = load <2 x i64>* %t, align 1
+ %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 7
+ %tmp1 = load <2 x i64>, <2 x i64>* %t, align 1
ret <2 x i64> %tmp1
}
; CHECK-LABEL: @static_hem_addrspacecast(
; CHECK: , align 16
define <2 x i64> @static_hem_addrspacecast() {
- %t = getelementptr <2 x i64>* @x, i32 7
+ %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 7
%t.asc = addrspacecast <2 x i64>* %t to <2 x i64> addrspace(1)*
- %tmp1 = load <2 x i64> addrspace(1)* %t.asc, align 1
+ %tmp1 = load <2 x i64>, <2 x i64> addrspace(1)* %t.asc, align 1
ret <2 x i64> %tmp1
}
; CHECK-LABEL: @static_hem_addrspacecast_smaller_ptr(
; CHECK: , align 16
define <2 x i64> @static_hem_addrspacecast_smaller_ptr() {
- %t = getelementptr <2 x i64>* @x, i32 7
+ %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 7
%t.asc = addrspacecast <2 x i64>* %t to <2 x i64> addrspace(2)*
- %tmp1 = load <2 x i64> addrspace(2)* %t.asc, align 1
+ %tmp1 = load <2 x i64>, <2 x i64> addrspace(2)* %t.asc, align 1
ret <2 x i64> %tmp1
}
; CHECK-LABEL: @static_hem_addrspacecast_larger_ptr(
; CHECK: , align 16
define <2 x i64> @static_hem_addrspacecast_larger_ptr() {
- %t = getelementptr <2 x i64> addrspace(2)* @x.as2, i32 7
+ %t = getelementptr <2 x i64>, <2 x i64> addrspace(2)* @x.as2, i32 7
%t.asc = addrspacecast <2 x i64> addrspace(2)* %t to <2 x i64> addrspace(1)*
- %tmp1 = load <2 x i64> addrspace(1)* %t.asc, align 1
+ %tmp1 = load <2 x i64>, <2 x i64> addrspace(1)* %t.asc, align 1
ret <2 x i64> %tmp1
}
; CHECK-LABEL: @hem(
; CHECK: , align 16
define <2 x i64> @hem(i32 %i) {
- %t = getelementptr <2 x i64>* @x, i32 %i
- %tmp1 = load <2 x i64>* %t, align 1
+ %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 %i
+ %tmp1 = load <2 x i64>, <2 x i64>* %t, align 1
ret <2 x i64> %tmp1
}
; CHECK-LABEL: @hem_2d(
; CHECK: , align 16
define <2 x i64> @hem_2d(i32 %i, i32 %j) {
- %t = getelementptr [13 x <2 x i64>]* @xx, i32 %i, i32 %j
- %tmp1 = load <2 x i64>* %t, align 1
+ %t = getelementptr [13 x <2 x i64>], [13 x <2 x i64>]* @xx, i32 %i, i32 %j
+ %tmp1 = load <2 x i64>, <2 x i64>* %t, align 1
ret <2 x i64> %tmp1
}
; CHECK-LABEL: @foo(
; CHECK: , align 16
define <2 x i64> @foo() {
- %tmp1 = load <2 x i64>* @x, align 1
+ %tmp1 = load <2 x i64>, <2 x i64>* @x, align 1
ret <2 x i64> %tmp1
}
@@ -70,14 +70,14 @@ define <2 x i64> @foo() {
define <2 x i64> @bar() {
%t = alloca <2 x i64>
call void @kip(<2 x i64>* %t)
- %tmp1 = load <2 x i64>* %t, align 1
+ %tmp1 = load <2 x i64>, <2 x i64>* %t, align 1
ret <2 x i64> %tmp1
}
; CHECK-LABEL: @static_hem_store(
; CHECK: , align 16
define void @static_hem_store(<2 x i64> %y) {
- %t = getelementptr <2 x i64>* @x, i32 7
+ %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 7
store <2 x i64> %y, <2 x i64>* %t, align 1
ret void
}
@@ -85,7 +85,7 @@ define void @static_hem_store(<2 x i64> %y) {
; CHECK-LABEL: @hem_store(
; CHECK: , align 16
define void @hem_store(i32 %i, <2 x i64> %y) {
- %t = getelementptr <2 x i64>* @x, i32 %i
+ %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 %i
store <2 x i64> %y, <2 x i64>* %t, align 1
ret void
}
@@ -93,7 +93,7 @@ define void @hem_store(i32 %i, <2 x i64> %y) {
; CHECK-LABEL: @hem_2d_store(
; CHECK: , align 16
define void @hem_2d_store(i32 %i, i32 %j, <2 x i64> %y) {
- %t = getelementptr [13 x <2 x i64>]* @xx, i32 %i, i32 %j
+ %t = getelementptr [13 x <2 x i64>], [13 x <2 x i64>]* @xx, i32 %i, i32 %j
store <2 x i64> %y, <2 x i64>* %t, align 1
ret void
}
diff --git a/test/Transforms/InstCombine/loadstore-metadata.ll b/test/Transforms/InstCombine/loadstore-metadata.ll
index 3d18ac0e33444..a30c0bc852ea1 100644
--- a/test/Transforms/InstCombine/loadstore-metadata.ll
+++ b/test/Transforms/InstCombine/loadstore-metadata.ll
@@ -5,9 +5,9 @@ target datalayout = "e-m:e-p:64:64:64-i64:64-f80:128-n8:16:32:64-S128"
define i32 @test_load_cast_combine_tbaa(float* %ptr) {
; Ensure (cast (load (...))) -> (load (cast (...))) preserves TBAA.
; CHECK-LABEL: @test_load_cast_combine_tbaa(
-; CHECK: load i32* %{{.*}}, !tbaa !0
+; CHECK: load i32, i32* %{{.*}}, !tbaa !0
entry:
- %l = load float* %ptr, !tbaa !0
+ %l = load float, float* %ptr, !tbaa !0
%c = bitcast float %l to i32
ret i32 %c
}
@@ -15,9 +15,9 @@ entry:
define i32 @test_load_cast_combine_noalias(float* %ptr) {
; Ensure (cast (load (...))) -> (load (cast (...))) preserves no-alias metadata.
; CHECK-LABEL: @test_load_cast_combine_noalias(
-; CHECK: load i32* %{{.*}}, !alias.scope !2, !noalias !1
+; CHECK: load i32, i32* %{{.*}}, !alias.scope !2, !noalias !1
entry:
- %l = load float* %ptr, !alias.scope !2, !noalias !1
+ %l = load float, float* %ptr, !alias.scope !2, !noalias !1
%c = bitcast float %l to i32
ret i32 %c
}
@@ -27,11 +27,11 @@ define float @test_load_cast_combine_range(i32* %ptr) {
; would be nice to preserve or update it somehow but this is hard when moving
; between types.
; CHECK-LABEL: @test_load_cast_combine_range(
-; CHECK: load float* %{{.*}}
+; CHECK: load float, float* %{{.*}}
; CHECK-NOT: !range
; CHECK: ret float
entry:
- %l = load i32* %ptr, !range !5
+ %l = load i32, i32* %ptr, !range !5
%c = bitcast i32 %l to float
ret float %c
}
@@ -39,9 +39,9 @@ entry:
define i32 @test_load_cast_combine_invariant(float* %ptr) {
; Ensure (cast (load (...))) -> (load (cast (...))) preserves invariant metadata.
; CHECK-LABEL: @test_load_cast_combine_invariant(
-; CHECK: load i32* %{{.*}}, !invariant.load !3
+; CHECK: load i32, i32* %{{.*}}, !invariant.load !3
entry:
- %l = load float* %ptr, !invariant.load !3
+ %l = load float, float* %ptr, !invariant.load !3
%c = bitcast float %l to i32
ret i32 %c
}
@@ -50,9 +50,9 @@ define i32 @test_load_cast_combine_nontemporal(float* %ptr) {
; Ensure (cast (load (...))) -> (load (cast (...))) preserves nontemporal
; metadata.
; CHECK-LABEL: @test_load_cast_combine_nontemporal(
-; CHECK: load i32* %{{.*}}, !nontemporal !4
+; CHECK: load i32, i32* %{{.*}}, !nontemporal !4
entry:
- %l = load float* %ptr, !nontemporal !4
+ %l = load float, float* %ptr, !nontemporal !4
%c = bitcast float %l to i32
ret i32 %c
}
@@ -61,15 +61,15 @@ define void @test_load_cast_combine_loop(float* %src, i32* %dst, i32 %n) {
; Ensure (cast (load (...))) -> (load (cast (...))) preserves loop access
; metadata.
; CHECK-LABEL: @test_load_cast_combine_loop(
-; CHECK: load i32* %{{.*}}, !llvm.mem.parallel_loop_access !1
+; CHECK: load i32, i32* %{{.*}}, !llvm.mem.parallel_loop_access !1
entry:
br label %loop
loop:
%i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
- %src.gep = getelementptr inbounds float* %src, i32 %i
- %dst.gep = getelementptr inbounds i32* %dst, i32 %i
- %l = load float* %src.gep, !llvm.mem.parallel_loop_access !1
+ %src.gep = getelementptr inbounds float, float* %src, i32 %i
+ %dst.gep = getelementptr inbounds i32, i32* %dst, i32 %i
+ %l = load float, float* %src.gep, !llvm.mem.parallel_loop_access !1
%c = bitcast float %l to i32
store i32 %c, i32* %dst.gep
%i.next = add i32 %i, 1
@@ -80,6 +80,31 @@ exit:
ret void
}
+define void @test_load_cast_combine_nonnull(float** %ptr) {
+; We can't preserve nonnull metadata when converting a load of a pointer to
+; a load of an integer. Instead, we translate it to range metadata.
+; FIXME: We should also transform range metadata back into nonnull metadata.
+; FIXME: This test is very fragile. If any LABEL lines are added after
+; this point, the test will fail, because this test depends on a metadata tuple,
+; which is always emitted at the end of the file. At some point, we should
+; consider an option to the IR printer to emit MD tuples after the function
+; that first uses them--this will allow us to refer to them like this and not
+; have the tests break. For now, this function must always come last in this
+; file, and no LABEL lines are to be added after this point.
+;
+; CHECK-LABEL: @test_load_cast_combine_nonnull(
+; CHECK: %[[V:.*]] = load i64, i64* %{{.*}}, !range ![[MD:[0-9]+]]
+; CHECK-NOT: !nonnull
+; CHECK: store i64 %[[V]], i64*
+entry:
+ %p = load float*, float** %ptr, !nonnull !3
+ %gep = getelementptr float*, float** %ptr, i32 42
+ store float* %p, float** %gep
+ ret void
+}
+
+; This is the metadata tuple that we reference above:
+; CHECK: ![[MD]] = !{i64 1, i64 0}
!0 = !{ !1, !1, i64 0 }
!1 = !{ !1 }
!2 = !{ !2, !1 }
diff --git a/test/Transforms/InstCombine/lshr-phi.ll b/test/Transforms/InstCombine/lshr-phi.ll
index 76a113face05e..79dc8b33192de 100644
--- a/test/Transforms/InstCombine/lshr-phi.ll
+++ b/test/Transforms/InstCombine/lshr-phi.ll
@@ -8,24 +8,24 @@
define i32 @hash_string(i8* nocapture %key) nounwind readonly {
entry:
- %t0 = load i8* %key, align 1 ; <i8> [#uses=1]
+ %t0 = load i8, i8* %key, align 1 ; <i8> [#uses=1]
%t1 = icmp eq i8 %t0, 0 ; <i1> [#uses=1]
br i1 %t1, label %bb2, label %bb
bb: ; preds = %bb, %entry
%indvar = phi i64 [ 0, %entry ], [ %tmp, %bb ] ; <i64> [#uses=2]
%k.04 = phi i32 [ 0, %entry ], [ %t8, %bb ] ; <i32> [#uses=2]
- %cp.05 = getelementptr i8* %key, i64 %indvar ; <i8*> [#uses=1]
+ %cp.05 = getelementptr i8, i8* %key, i64 %indvar ; <i8*> [#uses=1]
%t2 = shl i32 %k.04, 1 ; <i32> [#uses=1]
%t3 = lshr i32 %k.04, 14 ; <i32> [#uses=1]
%t4 = add i32 %t2, %t3 ; <i32> [#uses=1]
- %t5 = load i8* %cp.05, align 1 ; <i8> [#uses=1]
+ %t5 = load i8, i8* %cp.05, align 1 ; <i8> [#uses=1]
%t6 = sext i8 %t5 to i32 ; <i32> [#uses=1]
%t7 = xor i32 %t6, %t4 ; <i32> [#uses=1]
%t8 = and i32 %t7, 16383 ; <i32> [#uses=2]
%tmp = add i64 %indvar, 1 ; <i64> [#uses=2]
- %scevgep = getelementptr i8* %key, i64 %tmp ; <i8*> [#uses=1]
- %t9 = load i8* %scevgep, align 1 ; <i8> [#uses=1]
+ %scevgep = getelementptr i8, i8* %key, i64 %tmp ; <i8*> [#uses=1]
+ %t9 = load i8, i8* %scevgep, align 1 ; <i8> [#uses=1]
%t10 = icmp eq i8 %t9, 0 ; <i1> [#uses=1]
br i1 %t10, label %bb2, label %bb
diff --git a/test/Transforms/InstCombine/malloc-free-delete.ll b/test/Transforms/InstCombine/malloc-free-delete.ll
index ed25e4e49c84f..dc04adb06966e 100644
--- a/test/Transforms/InstCombine/malloc-free-delete.ll
+++ b/test/Transforms/InstCombine/malloc-free-delete.ll
@@ -3,9 +3,9 @@
define i32 @main(i32 %argc, i8** %argv) {
; 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))
+ %malloc_206 = tail call i8* @malloc(i32 mul (i32 ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i32), i32 10))
store i8* %malloc_206, i8** %c_19
- %tmp_207 = load i8** %c_19
+ %tmp_207 = load i8*, i8** %c_19
tail call void @free(i8* %tmp_207)
ret i32 0
; CHECK-NEXT: ret i32 0
@@ -146,17 +146,36 @@ lpad.i: ; preds = %entry
}
declare i8* @_Znwm(i64) nobuiltin
-declare void @_ZdlPvm(i8*, i64) nobuiltin
declare i8* @_Znwj(i32) nobuiltin
-declare void @_ZdlPvj(i8*, i32) nobuiltin
declare i8* @_Znam(i64) nobuiltin
-declare void @_ZdaPvm(i8*, i64) nobuiltin
declare i8* @_Znaj(i32) nobuiltin
-declare void @_ZdaPvj(i8*, i32) nobuiltin
+declare void @_ZdlPv(i8*) nobuiltin
+declare void @_ZdaPv(i8*) nobuiltin
+
+define linkonce void @_ZdlPvm(i8* %p, i64) nobuiltin {
+ call void @_ZdlPv(i8* %p)
+ ret void
+}
+define linkonce void @_ZdlPvj(i8* %p, i32) nobuiltin {
+ call void @_ZdlPv(i8* %p)
+ ret void
+}
+define linkonce void @_ZdaPvm(i8* %p, i64) nobuiltin {
+ call void @_ZdaPv(i8* %p)
+ ret void
+}
+define linkonce void @_ZdaPvj(i8* %p, i32) nobuiltin {
+ call void @_ZdaPv(i8* %p)
+ ret void
+}
; CHECK-LABEL: @test8(
define void @test8() {
; CHECK-NOT: call
+ %nw = call i8* @_Znwm(i64 32) builtin
+ call void @_ZdlPv(i8* %nw) builtin
+ %na = call i8* @_Znam(i64 32) builtin
+ call void @_ZdaPv(i8* %na) builtin
%nwm = call i8* @_Znwm(i64 32) builtin
call void @_ZdlPvm(i8* %nwm, i64 32) builtin
%nwj = call i8* @_Znwj(i32 32) builtin
diff --git a/test/Transforms/InstCombine/max-of-nots.ll b/test/Transforms/InstCombine/max-of-nots.ll
new file mode 100644
index 0000000000000..dd9c54b067394
--- /dev/null
+++ b/test/Transforms/InstCombine/max-of-nots.ll
@@ -0,0 +1,85 @@
+; RUN: opt -S -instcombine < %s | FileCheck %s
+
+define i32 @compute_min_2(i32 %x, i32 %y) {
+; CHECK-LABEL: compute_min_2
+ entry:
+ %not_x = sub i32 -1, %x
+ %not_y = sub i32 -1, %y
+ %cmp = icmp sgt i32 %not_x, %not_y
+ %not_min = select i1 %cmp, i32 %not_x, i32 %not_y
+ %min = sub i32 -1, %not_min
+ ret i32 %min
+
+; CHECK: %0 = icmp slt i32 %x, %y
+; CHECK-NEXT: %1 = select i1 %0, i32 %x, i32 %y
+; CHECK-NEXT: ret i32 %1
+}
+
+define i32 @compute_min_3(i32 %x, i32 %y, i32 %z) {
+; CHECK-LABEL: compute_min_3
+ entry:
+ %not_x = sub i32 -1, %x
+ %not_y = sub i32 -1, %y
+ %not_z = sub i32 -1, %z
+ %cmp_1 = icmp sgt i32 %not_x, %not_y
+ %not_min_1 = select i1 %cmp_1, i32 %not_x, i32 %not_y
+ %cmp_2 = icmp sgt i32 %not_min_1, %not_z
+ %not_min_2 = select i1 %cmp_2, i32 %not_min_1, i32 %not_z
+ %min = sub i32 -1, %not_min_2
+ ret i32 %min
+
+; CHECK: %0 = icmp slt i32 %x, %y
+; CHECK-NEXT: %1 = select i1 %0, i32 %x, i32 %y
+; CHECK-NEXT: %2 = icmp slt i32 %1, %z
+; CHECK-NEXT: %3 = select i1 %2, i32 %1, i32 %z
+; CHECK-NEXT: ret i32 %3
+}
+
+define i32 @compute_min_arithmetic(i32 %x, i32 %y) {
+; CHECK-LABEL: compute_min_arithmetic
+ entry:
+ %not_value = sub i32 3, %x
+ %not_y = sub i32 -1, %y
+ %cmp = icmp sgt i32 %not_value, %not_y
+ %not_min = select i1 %cmp, i32 %not_value, i32 %not_y
+ ret i32 %not_min
+
+; CHECK: %0 = add i32 %x, -4
+; CHECK-NEXT: %1 = icmp slt i32 %0, %y
+; CHECK-NEXT: %2 = select i1 %1, i32 %0, i32 %y
+; CHECK-NEXT: %3 = xor i32 %2, -1
+; CHECK-NEXT: ret i32 %3
+}
+
+declare void @fake_use(i32)
+
+define i32 @compute_min_pessimization(i32 %x, i32 %y) {
+; CHECK-LABEL: compute_min_pessimization
+ entry:
+ %not_value = sub i32 3, %x
+ call void @fake_use(i32 %not_value)
+ %not_y = sub i32 -1, %y
+ %cmp = icmp sgt i32 %not_value, %not_y
+; CHECK: %not_value = sub i32 3, %x
+; CHECK: %cmp = icmp sgt i32 %not_value, %not_y
+ %not_min = select i1 %cmp, i32 %not_value, i32 %not_y
+ %min = sub i32 -1, %not_min
+ ret i32 %min
+}
+
+define i32 @max_of_nots(i32 %x, i32 %y) {
+; CHECK-LABEL: @max_of_nots(
+; CHECK-NEXT: icmp
+; CHECK-NEXT: select
+; CHECK-NEXT: icmp
+; CHECK-NEXT: select
+; CHECK-NEXT: xor
+; CHECK-NEXT: ret
+ %c0 = icmp sgt i32 %y, 0
+ %xor_y = xor i32 %y, -1
+ %s0 = select i1 %c0, i32 %xor_y, i32 -1
+ %xor_x = xor i32 %x, -1
+ %c1 = icmp slt i32 %s0, %xor_x
+ %smax96 = select i1 %c1, i32 %xor_x, i32 %s0
+ ret i32 %smax96
+}
diff --git a/test/Transforms/InstCombine/mem-gep-zidx.ll b/test/Transforms/InstCombine/mem-gep-zidx.ll
new file mode 100644
index 0000000000000..cf021b1337037
--- /dev/null
+++ b/test/Transforms/InstCombine/mem-gep-zidx.ll
@@ -0,0 +1,48 @@
+; RUN: opt -S -instcombine < %s | FileCheck %s
+target datalayout = "E-m:e-i64:64-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+@f.a = private unnamed_addr constant [1 x i32] [i32 12], align 4
+@f.b = private unnamed_addr constant [1 x i32] [i32 55], align 4
+
+define signext i32 @test1(i32 signext %x) #0 {
+entry:
+ %idxprom = sext i32 %x to i64
+ %arrayidx = getelementptr inbounds [1 x i32], [1 x i32]* @f.a, i64 0, i64 %idxprom
+ %0 = load i32, i32* %arrayidx, align 4
+ ret i32 %0
+
+; CHECK-LABEL: @test1
+; CHECK: ret i32 12
+}
+
+declare void @foo(i64* %p)
+define void @test2(i32 signext %x, i64 %v) #0 {
+entry:
+ %p = alloca i64
+ %idxprom = sext i32 %x to i64
+ %arrayidx = getelementptr inbounds i64, i64* %p, i64 %idxprom
+ store i64 %v, i64* %arrayidx
+ call void @foo(i64* %p)
+ ret void
+
+; CHECK-LABEL: @test2
+; CHECK: %p = alloca i64
+; CHECK: store i64 %v, i64* %p
+; CHECK: ret void
+}
+
+define signext i32 @test3(i32 signext %x, i1 %y) #0 {
+entry:
+ %idxprom = sext i32 %x to i64
+ %p = select i1 %y, [1 x i32]* @f.a, [1 x i32]* @f.b
+ %arrayidx = getelementptr inbounds [1 x i32], [1 x i32]* %p, i64 0, i64 %idxprom
+ %0 = load i32, i32* %arrayidx, align 4
+ ret i32 %0
+
+; CHECK-LABEL: @test3
+; CHECK: getelementptr inbounds [1 x i32], [1 x i32]* %p, i64 0, i64 0
+}
+
+attributes #0 = { nounwind readnone }
+
diff --git a/test/Transforms/InstCombine/memchr.ll b/test/Transforms/InstCombine/memchr.ll
new file mode 100644
index 0000000000000..216dba874ccb2
--- /dev/null
+++ b/test/Transforms/InstCombine/memchr.ll
@@ -0,0 +1,200 @@
+; Test that the memchr library call simplifier works correctly.
+; RUN: opt < %s -instcombine -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:128:128-n8:16:32"
+
+@hello = constant [14 x i8] c"hello world\5Cn\00"
+@hellonull = constant [14 x i8] c"hello\00world\5Cn\00"
+@null = constant [1 x i8] zeroinitializer
+@newlines = constant [3 x i8] c"\0D\0A\00"
+@single = constant [2 x i8] c"\1F\00"
+@spaces = constant [4 x i8] c" \0D\0A\00"
+@negative = constant [3 x i8] c"\FF\FE\00"
+@chp = global i8* zeroinitializer
+
+declare i8* @memchr(i8*, i32, i32)
+
+define void @test1() {
+; CHECK-LABEL: @test1
+; CHECK: store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @hello, i32 0, i32 6)
+; CHECK-NOT: call i8* @memchr
+; CHECK: ret void
+
+ %str = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
+ %dst = call i8* @memchr(i8* %str, i32 119, i32 14)
+ store i8* %dst, i8** @chp
+ ret void
+}
+
+define void @test2() {
+; CHECK-LABEL: @test2
+; CHECK: store i8* null, i8** @chp, align 4
+; CHECK-NOT: call i8* @memchr
+; CHECK: ret void
+
+ %str = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
+ %dst = call i8* @memchr(i8* %str, i32 119, i32 1)
+ store i8* %dst, i8** @chp
+ ret void
+}
+
+define void @test3() {
+; CHECK-LABEL: @test3
+; CHECK: store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @hello, i32 0, i32 13)
+; CHECK-NOT: call i8* @memchr
+; CHECK: ret void
+
+ %src = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
+ %dst = call i8* @memchr(i8* %src, i32 0, i32 14)
+ store i8* %dst, i8** @chp
+ ret void
+}
+
+define void @test4(i32 %chr) {
+; CHECK-LABEL: @test4
+; CHECK: call i8* @memchr
+; CHECK-NOT: call i8* @memchr
+; CHECK: ret void
+
+ %src = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
+ %dst = call i8* @memchr(i8* %src, i32 %chr, i32 14)
+ store i8* %dst, i8** @chp
+ ret void
+}
+
+define void @test5() {
+; CHECK-LABEL: @test5
+; CHECK: store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @hello, i32 0, i32 13)
+; CHECK-NOT: call i8* @memchr
+; CHECK: ret void
+
+ %src = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
+ %dst = call i8* @memchr(i8* %src, i32 65280, i32 14)
+ store i8* %dst, i8** @chp
+ ret void
+}
+
+define void @test6() {
+; CHECK-LABEL: @test6
+; CHECK: store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @hello, i32 0, i32 6)
+; CHECK-NOT: call i8* @memchr
+; CHECK: ret void
+
+ %src = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
+; Overflow, but we still find the right thing.
+ %dst = call i8* @memchr(i8* %src, i32 119, i32 100)
+ store i8* %dst, i8** @chp
+ ret void
+}
+
+define void @test7() {
+; CHECK-LABEL: @test7
+; CHECK: store i8* null, i8** @chp, align 4
+; CHECK-NOT: call i8* @memchr
+; CHECK: ret void
+
+ %src = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
+; Overflow
+ %dst = call i8* @memchr(i8* %src, i32 120, i32 100)
+ store i8* %dst, i8** @chp
+ ret void
+}
+
+define void @test8() {
+; CHECK-LABEL: @test8
+; CHECK: store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @hellonull, i32 0, i32 6)
+; CHECK-NOT: call i8* @memchr
+; CHECK: ret void
+
+ %str = getelementptr [14 x i8], [14 x i8]* @hellonull, i32 0, i32 0
+ %dst = call i8* @memchr(i8* %str, i32 119, i32 14)
+ store i8* %dst, i8** @chp
+ ret void
+}
+
+define void @test9() {
+; CHECK-LABEL: @test9
+; CHECK: store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @hellonull, i32 0, i32 6)
+; CHECK-NOT: call i8* @memchr
+; CHECK: ret void
+
+ %str = getelementptr [14 x i8], [14 x i8]* @hellonull, i32 0, i32 2
+ %dst = call i8* @memchr(i8* %str, i32 119, i32 12)
+ store i8* %dst, i8** @chp
+ ret void
+}
+
+define void @test10() {
+; CHECK-LABEL: @test10
+; CHECK: store i8* null, i8** @chp, align 4
+; CHECK-NOT: call i8* @memchr
+; CHECK: ret void
+
+ %str = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
+ %dst = call i8* @memchr(i8* %str, i32 119, i32 6)
+ store i8* %dst, i8** @chp
+ ret void
+}
+
+; Check transformation memchr("\r\n", C, 2) != nullptr -> (C & 9216) != 0
+define i1 @test11(i32 %C) {
+; CHECK-LABEL: @test11
+; CHECK-NEXT: [[TRUNC:%.*]] = trunc i32 %C to i16
+; CHECK-NEXT: %memchr.bounds = icmp ult i16 [[TRUNC]], 16
+; CHECK-NEXT: [[SHL:%.*]] = shl i16 1, [[TRUNC]]
+; CHECK-NEXT: [[AND:%.*]] = and i16 [[SHL]], 9216
+; CHECK-NEXT: %memchr.bits = icmp ne i16 [[AND]], 0
+; CHECK-NEXT: %memchr = and i1 %memchr.bounds, %memchr.bits
+; CHECK-NEXT: ret i1 %memchr
+
+ %dst = call i8* @memchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @newlines, i64 0, i64 0), i32 %C, i32 2)
+ %cmp = icmp ne i8* %dst, null
+ ret i1 %cmp
+}
+
+; No 64 bits here
+define i1 @test12(i32 %C) {
+; CHECK-LABEL: @test12
+; CHECK-NEXT: %dst = call i8* @memchr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @spaces, i32 0, i32 0), i32 %C, i32 3)
+; CHECK-NEXT: %cmp = icmp ne i8* %dst, null
+; CHECK-NEXT: ret i1 %cmp
+
+ %dst = call i8* @memchr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @spaces, i64 0, i64 0), i32 %C, i32 3)
+ %cmp = icmp ne i8* %dst, null
+ ret i1 %cmp
+}
+
+define i1 @test13(i32 %C) {
+; CHECK-LABEL: @test13
+; CHECK-NEXT: %memchr.bounds = icmp ult i32 %C, 32
+; CHECK-NEXT: [[SHL:%.*]] = shl i32 1, %C
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[SHL]], -2147483647
+; CHECK-NEXT: %memchr.bits = icmp ne i32 [[AND]], 0
+; CHECK-NEXT: %memchr = and i1 %memchr.bounds, %memchr.bits
+; CHECK-NEXT: ret i1 %memchr
+
+ %dst = call i8* @memchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @single, i64 0, i64 0), i32 %C, i32 2)
+ %cmp = icmp ne i8* %dst, null
+ ret i1 %cmp
+}
+
+define i1 @test14(i32 %C) {
+; CHECK-LABEL: @test14
+; CHECK-NEXT: icmp eq i32 %C, 31
+; CHECK-NEXT: ret
+
+ %dst = call i8* @memchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @single, i64 0, i64 0), i32 %C, i32 1)
+ %cmp = icmp ne i8* %dst, null
+ ret i1 %cmp
+}
+
+define i1 @test15(i32 %C) {
+; CHECK-LABEL: @test15
+; CHECK-NEXT: %dst = call i8* @memchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @negative, i32 0, i32 0), i32 %C, i32 3)
+; CHECK-NEXT: %cmp = icmp ne i8* %dst, null
+; CHECK-NEXT: ret i1 %cmp
+
+ %dst = call i8* @memchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @negative, i64 0, i64 0), i32 %C, i32 3)
+ %cmp = icmp ne i8* %dst, null
+ ret i1 %cmp
+}
diff --git a/test/Transforms/InstCombine/memcmp-1.ll b/test/Transforms/InstCombine/memcmp-1.ll
index d960693a05d4d..db15bd66b7156 100644
--- a/test/Transforms/InstCombine/memcmp-1.ll
+++ b/test/Transforms/InstCombine/memcmp-1.ll
@@ -33,9 +33,9 @@ define i32 @test_simplify2(i8* %mem1, i8* %mem2) {
define i32 @test_simplify3(i8* %mem1, i8* %mem2) {
; CHECK-LABEL: @test_simplify3(
%ret = call i32 @memcmp(i8* %mem1, i8* %mem2, i32 1)
-; CHECK: [[LOAD1:%[a-z]+]] = load i8* %mem1, align 1
+; CHECK: [[LOAD1:%[a-z]+]] = load i8, i8* %mem1, align 1
; CHECK: [[ZEXT1:%[a-z]+]] = zext i8 [[LOAD1]] to i32
-; CHECK: [[LOAD2:%[a-z]+]] = load i8* %mem2, align 1
+; CHECK: [[LOAD2:%[a-z]+]] = load i8, i8* %mem2, align 1
; CHECK: [[ZEXT2:%[a-z]+]] = zext i8 [[LOAD2]] to i32
; CHECK: [[RET:%[a-z]+]] = sub nsw i32 [[ZEXT1]], [[ZEXT2]]
ret i32 %ret
@@ -46,8 +46,8 @@ define i32 @test_simplify3(i8* %mem1, i8* %mem2) {
define i32 @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
+ %mem1 = getelementptr [4 x i8], [4 x i8]* @hel, i32 0, i32 0
+ %mem2 = getelementptr [8 x i8], [8 x i8]* @hello_u, i32 0, i32 0
%ret = call i32 @memcmp(i8* %mem1, i8* %mem2, i32 3)
ret i32 %ret
; CHECK: ret i32 0
@@ -55,8 +55,8 @@ define i32 @test_simplify4() {
define i32 @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
+ %mem1 = getelementptr [4 x i8], [4 x i8]* @hel, i32 0, i32 0
+ %mem2 = getelementptr [4 x i8], [4 x i8]* @foo, i32 0, i32 0
%ret = call i32 @memcmp(i8* %mem1, i8* %mem2, i32 3)
ret i32 %ret
; CHECK: ret i32 1
@@ -64,8 +64,8 @@ define i32 @test_simplify5() {
define i32 @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
+ %mem1 = getelementptr [4 x i8], [4 x i8]* @foo, i32 0, i32 0
+ %mem2 = getelementptr [4 x i8], [4 x i8]* @hel, i32 0, i32 0
%ret = call i32 @memcmp(i8* %mem1, i8* %mem2, i32 3)
ret i32 %ret
; CHECK: ret i32 -1
diff --git a/test/Transforms/InstCombine/memcpy-from-global.ll b/test/Transforms/InstCombine/memcpy-from-global.ll
index 3bc1d36f486d2..da38087d7397e 100644
--- a/test/Transforms/InstCombine/memcpy-from-global.ll
+++ b/test/Transforms/InstCombine/memcpy-from-global.ll
@@ -14,23 +14,23 @@ entry:
%tmp3 = shl i32 %hash, 2 ; <i32> [#uses=1]
%tmp5 = and i32 %tmp3, 124 ; <i32> [#uses=4]
- %tmp753 = getelementptr [128 x float]* %lookupTable, i32 0, i32 %tmp5 ; <float*> [#uses=1]
- %tmp9 = load float* %tmp753 ; <float> [#uses=1]
+ %tmp753 = getelementptr [128 x float], [128 x float]* %lookupTable, i32 0, i32 %tmp5 ; <float*> [#uses=1]
+ %tmp9 = load float, float* %tmp753 ; <float> [#uses=1]
%tmp11 = fmul float %tmp9, %x ; <float> [#uses=1]
%tmp13 = fadd float %tmp11, 0.000000e+00 ; <float> [#uses=1]
%tmp17.sum52 = or i32 %tmp5, 1 ; <i32> [#uses=1]
- %tmp1851 = getelementptr [128 x float]* %lookupTable, i32 0, i32 %tmp17.sum52 ; <float*> [#uses=1]
- %tmp19 = load float* %tmp1851 ; <float> [#uses=1]
+ %tmp1851 = getelementptr [128 x float], [128 x float]* %lookupTable, i32 0, i32 %tmp17.sum52 ; <float*> [#uses=1]
+ %tmp19 = load float, float* %tmp1851 ; <float> [#uses=1]
%tmp21 = fmul float %tmp19, %y ; <float> [#uses=1]
%tmp23 = fadd float %tmp21, %tmp13 ; <float> [#uses=1]
%tmp27.sum50 = or i32 %tmp5, 2 ; <i32> [#uses=1]
- %tmp2849 = getelementptr [128 x float]* %lookupTable, i32 0, i32 %tmp27.sum50 ; <float*> [#uses=1]
- %tmp29 = load float* %tmp2849 ; <float> [#uses=1]
+ %tmp2849 = getelementptr [128 x float], [128 x float]* %lookupTable, i32 0, i32 %tmp27.sum50 ; <float*> [#uses=1]
+ %tmp29 = load float, float* %tmp2849 ; <float> [#uses=1]
%tmp31 = fmul float %tmp29, %z ; <float> [#uses=1]
%tmp33 = fadd float %tmp31, %tmp23 ; <float> [#uses=1]
%tmp37.sum48 = or i32 %tmp5, 3 ; <i32> [#uses=1]
- %tmp3847 = getelementptr [128 x float]* %lookupTable, i32 0, i32 %tmp37.sum48 ; <float*> [#uses=1]
- %tmp39 = load float* %tmp3847 ; <float> [#uses=1]
+ %tmp3847 = getelementptr [128 x float], [128 x float]* %lookupTable, i32 0, i32 %tmp37.sum48 ; <float*> [#uses=1]
+ %tmp39 = load float, float* %tmp3847 ; <float> [#uses=1]
%tmp41 = fmul float %tmp39, %w ; <float> [#uses=1]
%tmp43 = fadd float %tmp41, %tmp33 ; <float> [#uses=1]
ret float %tmp43
@@ -57,10 +57,10 @@ define void @test2() {
; %A alloca is deleted
; CHECK-NEXT: alloca [124 x i8]
-; CHECK-NEXT: getelementptr inbounds [124 x i8]*
+; CHECK-NEXT: getelementptr inbounds [124 x i8], [124 x i8]*
; use @G instead of %A
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.*}}, i8* getelementptr inbounds (%T* @G, i64 0, i32 0)
+; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.*}}, i8* getelementptr inbounds (%T, %T* @G, i64 0, i32 0)
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* bitcast (%T* @G to i8*), i64 124, i32 4, i1 false)
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %b, i8* %a, i64 124, i32 4, i1 false)
call void @bar(i8* %b)
@@ -101,7 +101,7 @@ define void @test3() {
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-LABEL: @test3(
-; CHECK-NEXT: call void @bar(i8* getelementptr inbounds (%T* @G, i64 0, i32 0))
+; CHECK-NEXT: call void @bar(i8* getelementptr inbounds (%T, %T* @G, i64 0, i32 0))
ret void
}
@@ -111,7 +111,7 @@ define void @test3_addrspacecast() {
call void @llvm.memcpy.p0i8.p1i8.i64(i8* %a, i8 addrspace(1)* addrspacecast (%T* @G to i8 addrspace(1)*), i64 124, i32 4, i1 false)
call void @bar(i8* %a) readonly
; CHECK-LABEL: @test3_addrspacecast(
-; CHECK-NEXT: call void @bar(i8* getelementptr inbounds (%T* @G, i64 0, i32 0))
+; CHECK-NEXT: call void @bar(i8* getelementptr inbounds (%T, %T* @G, i64 0, i32 0))
ret void
}
@@ -122,7 +122,7 @@ define void @test4() {
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-LABEL: @test4(
-; CHECK-NEXT: call void @baz(i8* byval getelementptr inbounds (%T* @G, i64 0, i32 0))
+; CHECK-NEXT: call void @baz(i8* byval getelementptr inbounds (%T, %T* @G, i64 0, i32 0))
ret void
}
@@ -134,7 +134,7 @@ define void @test5() {
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-LABEL: @test5(
-; CHECK-NEXT: call void @baz(i8* byval getelementptr inbounds (%T* @G, i64 0, i32 0))
+; CHECK-NEXT: call void @baz(i8* byval getelementptr inbounds (%T, %T* @G, i64 0, i32 0))
ret void
}
@@ -155,7 +155,7 @@ define void @test6() {
define void @test7() {
%A = alloca %U, align 16
%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 @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* bitcast (%U* getelementptr ([2 x %U], [2 x %U]* @H, i64 0, i32 0) to i8*), i64 20, i32 4, i1 false)
call void @bar(i8* %a) readonly
; CHECK-LABEL: @test7(
; CHECK-NEXT: call void @bar(i8* bitcast ([2 x %U]* @H to i8*))
@@ -165,7 +165,7 @@ define void @test7() {
define void @test8() {
%A = alloca %U, align 16
%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 @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* bitcast (%U* getelementptr ([2 x %U], [2 x %U]* @H, i64 0, i32 1) to i8*), i64 20, i32 4, i1 false)
call void @bar(i8* %a) readonly
; CHECK-LABEL: @test8(
; CHECK: llvm.memcpy
@@ -177,7 +177,7 @@ define void @test8() {
define void @test8_addrspacecast() {
%A = alloca %U, align 16
%a = bitcast %U* %A to i8*
- call void @llvm.memcpy.p0i8.p1i8.i64(i8* %a, i8 addrspace(1)* addrspacecast (%U* getelementptr ([2 x %U]* @H, i64 0, i32 1) to i8 addrspace(1)*), i64 20, i32 4, i1 false)
+ call void @llvm.memcpy.p0i8.p1i8.i64(i8* %a, i8 addrspace(1)* addrspacecast (%U* getelementptr ([2 x %U], [2 x %U]* @H, i64 0, i32 1) to i8 addrspace(1)*), i64 20, i32 4, i1 false)
call void @bar(i8* %a) readonly
; CHECK-LABEL: @test8_addrspacecast(
; CHECK: llvm.memcpy
@@ -188,19 +188,19 @@ define void @test8_addrspacecast() {
define void @test9() {
%A = alloca %U, align 4
%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 @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* bitcast (%U* getelementptr ([2 x %U], [2 x %U]* @H, i64 0, i32 1) to i8*), i64 20, i32 4, i1 false)
call void @bar(i8* %a) readonly
; CHECK-LABEL: @test9(
-; CHECK-NEXT: call void @bar(i8* bitcast (%U* getelementptr inbounds ([2 x %U]* @H, i64 0, i64 1) to i8*))
+; CHECK-NEXT: call void @bar(i8* bitcast (%U* getelementptr inbounds ([2 x %U], [2 x %U]* @H, i64 0, i64 1) to i8*))
ret void
}
define void @test9_addrspacecast() {
%A = alloca %U, align 4
%a = bitcast %U* %A to i8*
- call void @llvm.memcpy.p0i8.p1i8.i64(i8* %a, i8 addrspace(1)* addrspacecast (%U* getelementptr ([2 x %U]* @H, i64 0, i32 1) to i8 addrspace(1)*), i64 20, i32 4, i1 false)
+ call void @llvm.memcpy.p0i8.p1i8.i64(i8* %a, i8 addrspace(1)* addrspacecast (%U* getelementptr ([2 x %U], [2 x %U]* @H, i64 0, i32 1) to i8 addrspace(1)*), i64 20, i32 4, i1 false)
call void @bar(i8* %a) readonly
; CHECK-LABEL: @test9_addrspacecast(
-; CHECK-NEXT: call void @bar(i8* bitcast (%U* getelementptr inbounds ([2 x %U]* @H, i64 0, i64 1) to i8*))
+; CHECK-NEXT: call void @bar(i8* bitcast (%U* getelementptr inbounds ([2 x %U], [2 x %U]* @H, i64 0, i64 1) to i8*))
ret void
}
diff --git a/test/Transforms/InstCombine/memmove.ll b/test/Transforms/InstCombine/memmove.ll
index 9d51ea0e70bb4..96f230eece066 100644
--- a/test/Transforms/InstCombine/memmove.ll
+++ b/test/Transforms/InstCombine/memmove.ll
@@ -14,16 +14,16 @@ define void @test1(i8* %A, i8* %B, i32 %N) {
define void @test2(i8* %A, i32 %N) {
;; dest can't alias source since we can't write to source!
- call void @llvm.memmove.p0i8.p0i8.i32(i8* %A, i8* getelementptr inbounds ([33 x i8]* @S, i32 0, i32 0), i32 %N, i32 1, i1 false)
+ call void @llvm.memmove.p0i8.p0i8.i32(i8* %A, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @S, i32 0, i32 0), i32 %N, i32 1, i1 false)
ret void
}
define i32 @test3() {
- %h_p = getelementptr [2 x i8]* @h, i32 0, i32 0 ; <i8*> [#uses=1]
- %hel_p = getelementptr [4 x i8]* @hel, i32 0, i32 0 ; <i8*> [#uses=1]
- %hello_u_p = getelementptr [8 x i8]* @hello_u, i32 0, i32 0 ; <i8*> [#uses=1]
+ %h_p = getelementptr [2 x i8], [2 x i8]* @h, i32 0, i32 0 ; <i8*> [#uses=1]
+ %hel_p = getelementptr [4 x i8], [4 x i8]* @hel, i32 0, i32 0 ; <i8*> [#uses=1]
+ %hello_u_p = getelementptr [8 x i8], [8 x i8]* @hello_u, i32 0, i32 0 ; <i8*> [#uses=1]
%target = alloca [1024 x i8] ; <[1024 x i8]*> [#uses=1]
- %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=3]
+ %target_p = getelementptr [1024 x i8], [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=3]
call void @llvm.memmove.p0i8.p0i8.i32(i8* %target_p, i8* %h_p, i32 2, i32 2, i1 false)
call void @llvm.memmove.p0i8.p0i8.i32(i8* %target_p, i8* %hel_p, i32 4, i32 4, i1 false)
call void @llvm.memmove.p0i8.p0i8.i32(i8* %target_p, i8* %hello_u_p, i32 8, i32 8, i1 false)
diff --git a/test/Transforms/InstCombine/memset.ll b/test/Transforms/InstCombine/memset.ll
index 7f02dad58a7a0..dfafcf948d1cd 100644
--- a/test/Transforms/InstCombine/memset.ll
+++ b/test/Transforms/InstCombine/memset.ll
@@ -2,7 +2,7 @@
define i32 @main() {
%target = alloca [1024 x i8]
- %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0
+ %target_p = getelementptr [1024 x i8], [1024 x i8]* %target, i32 0, i32 0
call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 0, i32 1, i1 false)
call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 1, i32 1, i1 false)
call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 2, i32 2, i1 false)
diff --git a/test/Transforms/InstCombine/memset2.ll b/test/Transforms/InstCombine/memset2.ll
index 87639f0d6a224..ad4c225846bf1 100644
--- a/test/Transforms/InstCombine/memset2.ll
+++ b/test/Transforms/InstCombine/memset2.ll
@@ -7,7 +7,7 @@
define i32 @test(%struct.Moves addrspace(1)* nocapture %moves) {
entry:
; CHECK: bitcast i8 addrspace(1)* %gep to i64 addrspace(1)*
- %gep = getelementptr inbounds %struct.Moves addrspace(1)* %moves, i32 1, i32 0, i32 9
+ %gep = getelementptr inbounds %struct.Moves, %struct.Moves addrspace(1)* %moves, i32 1, i32 0, i32 9
call void @llvm.memset.p1i8.i64(i8 addrspace(1)* %gep, i8 0, i64 8, i32 1, i1 false)
ret i32 0
}
diff --git a/test/Transforms/InstCombine/merge-icmp.ll b/test/Transforms/InstCombine/merge-icmp.ll
index b021fe0429a55..6a65b5befa38f 100644
--- a/test/Transforms/InstCombine/merge-icmp.ll
+++ b/test/Transforms/InstCombine/merge-icmp.ll
@@ -1,7 +1,7 @@
; RUN: opt -S -instcombine < %s | FileCheck %s
define i1 @test1(i16* %x) {
- %load = load i16* %x, align 4
+ %load = load i16, i16* %x, align 4
%trunc = trunc i16 %load to i8
%cmp1 = icmp eq i8 %trunc, 127
%and = and i16 %load, -256
@@ -15,7 +15,7 @@ define i1 @test1(i16* %x) {
}
define i1 @test2(i16* %x) {
- %load = load i16* %x, align 4
+ %load = load i16, i16* %x, align 4
%and = and i16 %load, -256
%cmp1 = icmp eq i16 %and, 32512
%trunc = trunc i16 %load to i8
diff --git a/test/Transforms/InstCombine/minmax-fold.ll b/test/Transforms/InstCombine/minmax-fold.ll
new file mode 100644
index 0000000000000..4ed0c78216d61
--- /dev/null
+++ b/test/Transforms/InstCombine/minmax-fold.ll
@@ -0,0 +1,112 @@
+; RUN: opt -S -instcombine < %s | FileCheck %s
+
+; CHECK-LABEL: @t1
+; CHECK-NEXT: icmp
+; CHECK-NEXT: select
+; CHECK-NEXT: sext
+define i64 @t1(i32 %a) {
+ ; This is the canonical form for a type-changing min/max.
+ %1 = icmp slt i32 %a, 5
+ %2 = select i1 %1, i32 %a, i32 5
+ %3 = sext i32 %2 to i64
+ ret i64 %3
+}
+
+; CHECK-LABEL: @t2
+; CHECK-NEXT: icmp
+; CHECK-NEXT: select
+; CHECK-NEXT: sext
+define i64 @t2(i32 %a) {
+ ; Check this is converted into canonical form, as above.
+ %1 = icmp slt i32 %a, 5
+ %2 = sext i32 %a to i64
+ %3 = select i1 %1, i64 %2, i64 5
+ ret i64 %3
+}
+
+; CHECK-LABEL: @t3
+; CHECK-NEXT: icmp
+; CHECK-NEXT: select
+; CHECK-NEXT: zext
+define i64 @t3(i32 %a) {
+ ; Same as @t2, with flipped operands and zext instead of sext.
+ %1 = icmp ult i32 %a, 5
+ %2 = zext i32 %a to i64
+ %3 = select i1 %1, i64 5, i64 %2
+ ret i64 %3
+}
+
+; CHECK-LABEL: @t4
+; CHECK-NEXT: icmp
+; CHECK-NEXT: select
+; CHECK-NEXT: trunc
+define i32 @t4(i64 %a) {
+ ; Same again, with trunc.
+ %1 = icmp slt i64 %a, 5
+ %2 = trunc i64 %a to i32
+ %3 = select i1 %1, i32 %2, i32 5
+ ret i32 %3
+}
+
+; CHECK-LABEL: @t5
+; CHECK-NEXT: icmp
+; CHECK-NEXT: zext
+; CHECK-NEXT: select
+define i64 @t5(i32 %a) {
+ ; Same as @t3, but with mismatched signedness between icmp and zext.
+ ; InstCombine should leave this alone.
+ %1 = icmp slt i32 %a, 5
+ %2 = zext i32 %a to i64
+ %3 = select i1 %1, i64 5, i64 %2
+ ret i64 %3
+}
+
+; CHECK-LABEL: @t6
+; CHECK-NEXT: icmp
+; CHECK-NEXT: select
+; CHECK-NEXT: sitofp
+define float @t6(i32 %a) {
+ %1 = icmp slt i32 %a, 0
+ %2 = select i1 %1, i32 %a, i32 0
+ %3 = sitofp i32 %2 to float
+ ret float %3
+}
+
+; CHECK-LABEL: @t7
+; CHECK-NEXT: icmp
+; CHECK-NEXT: select
+; CHECK-NEXT: trunc
+define i16 @t7(i32 %a) {
+ %1 = icmp slt i32 %a, -32768
+ %2 = trunc i32 %a to i16
+ %3 = select i1 %1, i16 %2, i16 -32768
+ ret i16 %3
+}
+
+; Just check for no infinite loop. InstSimplify liked to
+; "simplify" -32767 by removing all the sign bits,
+; which led to a canonicalization fight between different
+; parts of instcombine.
+define i32 @t8(i64 %a, i32 %b) {
+ %1 = icmp slt i64 %a, -32767
+ %2 = select i1 %1, i64 %a, i64 -32767
+ %3 = trunc i64 %2 to i32
+ %4 = icmp slt i32 %b, 42
+ %5 = select i1 %4, i32 42, i32 %3
+ %6 = icmp ne i32 %5, %b
+ %7 = zext i1 %6 to i32
+ ret i32 %7
+}
+
+; Ensure this doesn't get converted to a min/max.
+; CHECK-LABEL: @t9
+; CHECK-NEXT: icmp
+; CHECK-NEXT: sext
+; CHECK-NEXT: 4294967295
+; CHECK-NEXT: ret
+define i64 @t9(i32 %a) {
+ %1 = icmp sgt i32 %a, -1
+ %2 = sext i32 %a to i64
+ %3 = select i1 %1, i64 %2, i64 4294967295
+ ret i64 %3
+}
diff --git a/test/Transforms/InstCombine/mul.ll b/test/Transforms/InstCombine/mul.ll
index 4d1e6c700bda2..6e67c7fa08a06 100644
--- a/test/Transforms/InstCombine/mul.ll
+++ b/test/Transforms/InstCombine/mul.ll
@@ -107,7 +107,7 @@ define i32 @test12(i32 %a, i32 %b) {
; PR2642
define internal void @test13(<4 x float>*) {
; CHECK-LABEL: @test13(
- load <4 x float>* %0, align 1
+ load <4 x float>, <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
ret void
@@ -288,3 +288,19 @@ define i32 @test31(i32 %V) {
; CHECK: %[[mul:.*]] = shl i32 %V, zext (i1 icmp ne (i32* inttoptr (i64 1 to i32*), i32* @PR22087) to i32)
; CHECK-NEXT: ret i32 %[[mul]]
}
+
+define i32 @test32(i32 %X) {
+; CHECK-LABEL: @test32
+ %mul = mul nsw i32 %X, -2147483648
+ ret i32 %mul
+; CHECK: %[[shl:.*]] = shl i32 %X, 31
+; CHECK-NEXT: ret i32 %[[shl]]
+}
+
+define i32 @test33(i32 %X) {
+; CHECK-LABEL: @test33
+ %mul = mul nsw i32 %X, 1073741824
+; CHECK: %[[shl:.*]] = shl nsw i32 %X, 30
+; CHECK-NEXT: ret i32 %[[shl]]
+ ret i32 %mul
+}
diff --git a/test/Transforms/InstCombine/multi-size-address-space-pointer.ll b/test/Transforms/InstCombine/multi-size-address-space-pointer.ll
index 2d88bed4e7bf2..4e5b2100f34ab 100644
--- a/test/Transforms/InstCombine/multi-size-address-space-pointer.ll
+++ b/test/Transforms/InstCombine/multi-size-address-space-pointer.ll
@@ -4,43 +4,43 @@ target datalayout = "e-p:32:32:32-p1:64:64:64-p2:8:8:8-p3:16:16:16-p4:16:16:16-i
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
+; CHECK: %arrayidx = getelementptr i32, i32* %a, i32 1
+ %arrayidx = getelementptr i32, i32 addrspace(0)* %a, i64 1
+ %y = load i32, 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
+; CHECK: %arrayidx = getelementptr i32, i32 addrspace(1)* %a, i64 1
+ %arrayidx = getelementptr i32, i32 addrspace(1)* %a, i32 1
+ %y = load i32, 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
+; CHECK: %arrayidx = getelementptr i32, i32 addrspace(2)* %a, i8 1
+ %arrayidx = getelementptr i32, i32 addrspace(2)* %a, i32 1
+ %y = load i32, 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
+; CHECK: %arrayidx = getelementptr i32, i32 addrspace(3)* %a, i16 1
+ %arrayidx = getelementptr i32, i32 addrspace(3)* %a, i32 1
+ %y = load i32, 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: %y = load i32, 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
+ %y = load i32, i32 addrspace(2)* %castback, align 4
ret i32 %y
}
@@ -55,12 +55,12 @@ define i8 @test_combine_inttoptr(i8 %a) {
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: %y = load i32, 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
+ %y = load i32, i32 addrspace(2)* %p, align 4
ret i32 %y
}
@@ -75,38 +75,38 @@ define <2 x i8> @test_combine_vector_inttoptr(<2 x i8> %a) {
; 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
+; CHECK-NEXT: getelementptr i32, i32 addrspace(2)* %p, i8 1
+ %ret = getelementptr i32, 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
+; CHECK-NEXT: getelementptr i32, i32 addrspace(2)* %p, i8 1
+ %ret = getelementptr i32, 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
+; CHECK-NEXT: getelementptr i32, i32 addrspace(3)* %p, i16 1
+ %ret = getelementptr i32, 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
+; CHECK-NEXT: getelementptr i32, i32 addrspace(2)* %p, i8 %1
+ %ret = getelementptr i32, 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
+; CHECK-NEXT: getelementptr i32, i32 addrspace(1)* %p, i64 %1
+ %ret = getelementptr i32, 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 4ed283603446a..07e68251b5ae4 100644
--- a/test/Transforms/InstCombine/no-negzero.ll
+++ b/test/Transforms/InstCombine/no-negzero.ll
@@ -14,17 +14,17 @@ entry:
%0 = alloca double, align 8 ; <double*> [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store double %x, double* %x_addr
- %1 = load double* %x_addr, align 8 ; <double> [#uses=1]
+ %1 = load double, double* %x_addr, align 8 ; <double> [#uses=1]
%2 = call double @fabs(double %1) nounwind readnone ; <double> [#uses=1]
%3 = call double @sqrt(double %2) nounwind readonly ; <double> [#uses=1]
%4 = fadd double %3, 0.000000e+00 ; <double> [#uses=1]
store double %4, double* %0, align 8
- %5 = load double* %0, align 8 ; <double> [#uses=1]
+ %5 = load double, double* %0, align 8 ; <double> [#uses=1]
store double %5, double* %retval, align 8
br label %return
return: ; preds = %entry
- %retval1 = load double* %retval ; <double> [#uses=1]
+ %retval1 = load double, double* %retval ; <double> [#uses=1]
ret double %retval1
}
diff --git a/test/Transforms/InstCombine/not.ll b/test/Transforms/InstCombine/not.ll
index 4012ce1ea4ba3..9d59edd7934da 100644
--- a/test/Transforms/InstCombine/not.ll
+++ b/test/Transforms/InstCombine/not.ll
@@ -52,3 +52,9 @@ entry:
%retval67 = zext i1 %tmp3 to i8 ; <i8> [#uses=1]
ret i8 %retval67
}
+
+define <2 x i1> @test7(<2 x i32> %A, <2 x i32> %B) {
+ %cond = icmp sle <2 x i32> %A, %B
+ %Ret = xor <2 x i1> %cond, <i1 true, i1 true>
+ ret <2 x i1> %Ret
+}
diff --git a/test/Transforms/InstCombine/obfuscated_splat.ll b/test/Transforms/InstCombine/obfuscated_splat.ll
index fa9cb423d02c8..c37456cc9cfac 100644
--- a/test/Transforms/InstCombine/obfuscated_splat.ll
+++ b/test/Transforms/InstCombine/obfuscated_splat.ll
@@ -1,7 +1,7 @@
; RUN: opt -instcombine -S < %s | FileCheck %s
define void @test(<4 x float> *%in_ptr, <4 x float> *%out_ptr) {
- %A = load <4 x float>* %in_ptr, align 16
+ %A = load <4 x float>, <4 x float>* %in_ptr, align 16
%B = shufflevector <4 x float> %A, <4 x float> undef, <4 x i32> <i32 0, i32 0, i32 undef, i32 undef>
%C = shufflevector <4 x float> %B, <4 x float> %A, <4 x i32> <i32 0, i32 1, i32 4, i32 undef>
%D = shufflevector <4 x float> %C, <4 x float> %A, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
diff --git a/test/Transforms/InstCombine/objsize-address-space.ll b/test/Transforms/InstCombine/objsize-address-space.ll
index a971c913bd411..6046dad897903 100644
--- a/test/Transforms/InstCombine/objsize-address-space.ll
+++ b/test/Transforms/InstCombine/objsize-address-space.ll
@@ -21,20 +21,20 @@ declare i16 @llvm.objectsize.i16.p3i8(i8 addrspace(3)*, i1) nounwind readonly
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)
+ %1 = call i32 @llvm.objectsize.i32.p3i8(i8 addrspace(3)* getelementptr inbounds ([60 x i8], [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)
+ %1 = call i16 @llvm.objectsize.i16.p3i8(i8 addrspace(3)* getelementptr inbounds ([60 x i8], [60 x i8] addrspace(3)* @a_as3, i32 0, i32 0), i1 false)
ret i16 %1
}
@a_alias = weak alias [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)
+ %1 = call i32 @llvm.objectsize.i32.p3i8(i8 addrspace(3)* getelementptr inbounds ([60 x i8], [60 x i8] addrspace(3)* @a_alias, i32 0, i32 0), i1 false)
ret i32 %1
}
diff --git a/test/Transforms/InstCombine/objsize-noverify.ll b/test/Transforms/InstCombine/objsize-noverify.ll
new file mode 100644
index 0000000000000..7e469bd252827
--- /dev/null
+++ b/test/Transforms/InstCombine/objsize-noverify.ll
@@ -0,0 +1,43 @@
+; Test objectsize bounds checking that won't verify until after -instcombine.
+; RUN: opt < %s -disable-verify -instcombine -S | opt -S | FileCheck %s
+; We need target data to get the sizes of the arrays and structures.
+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 i32 @llvm.objectsize.i32.p0i8(i8*, i1) nounwind readonly
+
+; CHECK-LABEL: @PR13390(
+define i32 @PR13390(i1 %bool, i8* %a) {
+entry:
+ %cond = or i1 %bool, true
+ br i1 %cond, label %return, label %xpto
+
+xpto:
+ %select = select i1 %bool, i8* %select, i8* %a
+ %select2 = select i1 %bool, i8* %a, i8* %select2
+ %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
+
+return:
+ ret i32 42
+}
+
+; CHECK-LABEL: @PR13621(
+define i32 @PR13621(i1 %bool) nounwind {
+entry:
+ %cond = or i1 %bool, true
+ br i1 %cond, label %return, label %xpto
+
+; technically reachable, but this malformed IR may appear as a result of constant propagation
+xpto:
+ %gep2 = getelementptr i8, i8* %gep, i32 1
+ %gep = getelementptr i8, i8* %gep2, i32 1
+ %o = call i32 @llvm.objectsize.i32.p0i8(i8* %gep, i1 true)
+; CHECK: ret i32 undef
+ ret i32 %o
+
+return:
+ ret i32 7
+}
diff --git a/test/Transforms/InstCombine/objsize.ll b/test/Transforms/InstCombine/objsize.ll
index 1285b1c3aa6a9..335a816e9ecea 100644
--- a/test/Transforms/InstCombine/objsize.ll
+++ b/test/Transforms/InstCombine/objsize.ll
@@ -8,7 +8,7 @@ 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 @foo() nounwind {
; CHECK-LABEL: @foo(
; CHECK-NEXT: ret i32 60
- %1 = call i32 @llvm.objectsize.i32.p0i8(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], [60 x i8]* @a, i32 0, i32 0), i1 false)
ret i32 %1
}
@@ -16,24 +16,24 @@ define i8* @bar() nounwind {
; CHECK-LABEL: @bar(
entry:
%retval = alloca i8*
- %0 = call i32 @llvm.objectsize.i32.p0i8(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], [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
cond.true:
- %1 = load i8** %retval
+ %1 = load i8*, i8** %retval
ret i8* %1
cond.false:
- %2 = load i8** %retval
+ %2 = load i8*, i8** %retval
ret i8* %2
}
define i32 @f() nounwind {
; CHECK-LABEL: @f(
; CHECK-NEXT: ret i32 0
- %1 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr ([60 x i8]* @a, i32 1, i32 0), i1 false)
+ %1 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr ([60 x i8], [60 x i8]* @a, i32 1, i32 0), i1 false)
ret i32 %1
}
@@ -42,7 +42,7 @@ define i32 @f() nounwind {
define i1 @baz() nounwind {
; CHECK-LABEL: @baz(
; CHECK-NEXT: objectsize
- %1 = tail call i32 @llvm.objectsize.i32.p0i8(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], [0 x i8]* @window, i32 0, i32 0), i1 false)
%2 = icmp eq i32 %1, -1
ret i1 %2
}
@@ -51,7 +51,7 @@ define void @test1(i8* %q, i32 %x) nounwind noinline {
; CHECK-LABEL: @test1(
; CHECK: objectsize.i32.p0i8
entry:
- %0 = call i32 @llvm.objectsize.i32.p0i8(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], [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"
@@ -67,7 +67,7 @@ entry:
define i32 @test2() nounwind {
; CHECK-LABEL: @test2(
; CHECK-NEXT: ret i32 34
- %1 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr (i8* bitcast ([9 x i32]* @.str5 to i8*), i32 2), i1 false)
+ %1 = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr (i8, i8* bitcast ([9 x i32]* @.str5 to i8*), i32 2), i1 false)
ret i32 %1
}
@@ -86,7 +86,7 @@ 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]
+ %0 = getelementptr inbounds float, float* getelementptr inbounds ([480 x float], [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.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]
@@ -94,7 +94,7 @@ bb11:
unreachable
bb12:
- %4 = getelementptr inbounds float* getelementptr inbounds ([480 x float]* @array, i32 0, i32 128), i32 -127 ; <float*> [#uses=1]
+ %4 = getelementptr inbounds float, float* getelementptr inbounds ([480 x float], [480 x float]* @array, i32 0, i32 128), i32 -127 ; <float*> [#uses=1]
%5 = bitcast float* %4 to i8* ; <i8*> [#uses=1]
%6 = call i8* @__inline_memcpy_chk(i8* %5, i8* undef, i32 512) nounwind inlinehint ; <i8*> [#uses=0]
; CHECK: @__inline_memcpy_chk
@@ -126,7 +126,7 @@ define i8* @test5(i32 %n) nounwind ssp {
entry:
%0 = tail call noalias i8* @malloc(i32 20) nounwind
%1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %0, i1 false)
- %2 = load i8** @s, align 8
+ %2 = load i8*, i8** @s, align 8
; CHECK-NOT: @llvm.objectsize
; CHECK: @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* %1, i32 10, i32 1, i1 false)
%3 = tail call i8* @__memcpy_chk(i8* %0, i8* %2, i32 10, i32 %1) nounwind
@@ -138,7 +138,7 @@ define void @test6(i32 %n) nounwind ssp {
entry:
%0 = tail call noalias i8* @malloc(i32 20) nounwind
%1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %0, i1 false)
- %2 = load i8** @s, align 8
+ %2 = load i8*, i8** @s, align 8
; CHECK-NOT: @llvm.objectsize
; CHECK: @__memcpy_chk(i8* %0, i8* %1, i32 30, i32 20)
%3 = tail call i8* @__memcpy_chk(i8* %0, i8* %2, i32 30, i32 %1) nounwind
@@ -153,7 +153,7 @@ define i32 @test7(i8** %esc) {
; CHECK-LABEL: @test7(
%alloc = call noalias i8* @malloc(i32 48) nounwind
store i8* %alloc, i8** %esc
- %gep = getelementptr inbounds i8* %alloc, i32 16
+ %gep = getelementptr inbounds i8, i8* %alloc, i32 16
%objsize = call i32 @llvm.objectsize.i32.p0i8(i8* %gep, i1 false) nounwind readonly
; CHECK: ret i32 32
ret i32 %objsize
@@ -165,7 +165,7 @@ define i32 @test8(i8** %esc) {
; 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
+ %gep = getelementptr inbounds i8, i8* %alloc, i32 5
%objsize = call i32 @llvm.objectsize.i32.p0i8(i8* %gep, i1 false) nounwind readonly
; CHECK: ret i32 30
ret i32 %objsize
@@ -176,7 +176,7 @@ declare noalias i8* @strndup(i8* nocapture, i32) nounwind
; 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
+ %call = tail call i8* @strdup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0)) nounwind
store i8* %call, i8** %esc, align 8
%1 = tail call i32 @llvm.objectsize.i32.p0i8(i8* %call, i1 true)
; CHECK: ret i32 8
@@ -185,7 +185,7 @@ define i32 @test9(i8** %esc) {
; 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
+ %call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8], [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.p0i8(i8* %call, i1 true)
; CHECK: ret i32 4
@@ -194,7 +194,7 @@ define i32 @test10(i8** %esc) {
; 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
+ %call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8], [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.p0i8(i8* %call, i1 true)
; CHECK: ret i32 8
@@ -203,7 +203,7 @@ define i32 @test11(i8** %esc) {
; 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
+ %call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8], [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.p0i8(i8* %call, i1 true)
; CHECK: ret i32 8
@@ -212,50 +212,13 @@ define i32 @test12(i8** %esc) {
; 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
+ %call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8], [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.p0i8(i8* %call, i1 true)
; CHECK: ret i32 8
ret i32 %1
}
-; CHECK-LABEL: @PR13390(
-define i32 @PR13390(i1 %bool, i8* %a) {
-entry:
- %cond = or i1 %bool, true
- br i1 %cond, label %return, label %xpto
-
-xpto:
- %select = select i1 %bool, i8* %select, i8* %a
- %select2 = select i1 %bool, i8* %a, i8* %select2
- %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
-
-return:
- ret i32 42
-}
-
-; CHECK-LABEL: @PR13621(
-define i32 @PR13621(i1 %bool) nounwind {
-entry:
- %cond = or i1 %bool, true
- br i1 %cond, label %return, label %xpto
-
-; technically reachable, but this malformed IR may appear as a result of constant propagation
-xpto:
- %gep2 = getelementptr i8* %gep, i32 1
- %gep = getelementptr i8* %gep2, i32 1
- %o = call i32 @llvm.objectsize.i32.p0i8(i8* %gep, i1 true)
-; CHECK: ret i32 undef
- ret i32 %o
-
-return:
- ret i32 7
-}
-
@globalalias = internal alias [60 x i8]* @a
; CHECK-LABEL: @test18(
diff --git a/test/Transforms/InstCombine/odr-linkage.ll b/test/Transforms/InstCombine/odr-linkage.ll
index 2ce62468dc77d..73675efb08bb6 100644
--- a/test/Transforms/InstCombine/odr-linkage.ll
+++ b/test/Transforms/InstCombine/odr-linkage.ll
@@ -6,10 +6,10 @@
@g4 = internal constant i32 4
define i32 @test() {
- %A = load i32* @g1
- %B = load i32* @g2
- %C = load i32* @g3
- %D = load i32* @g4
+ %A = load i32, i32* @g1
+ %B = load i32, i32* @g2
+ %C = load i32, i32* @g3
+ %D = load i32, i32* @g4
%a = add i32 %A, %B
%b = add i32 %a, %C
diff --git a/test/Transforms/InstCombine/or.ll b/test/Transforms/InstCombine/or.ll
index f604bafcc3302..b91a5954d97ed 100644
--- a/test/Transforms/InstCombine/or.ll
+++ b/test/Transforms/InstCombine/or.ll
@@ -394,7 +394,7 @@ define i32 @test37(i32* %xp, i32 %y) {
; CHECK: select i1 %tobool, i32 -1, i32 %x
%tobool = icmp ne i32 %y, 0
%sext = sext i1 %tobool to i32
- %x = load i32* %xp
+ %x = load i32, i32* %xp
%or = or i32 %sext, %x
ret i32 %or
}
@@ -404,7 +404,7 @@ define i32 @test38(i32* %xp, i32 %y) {
; CHECK: select i1 %tobool, i32 -1, i32 %x
%tobool = icmp ne i32 %y, 0
%sext = sext i1 %tobool to i32
- %x = load i32* %xp
+ %x = load i32, i32* %xp
%or = or i32 %x, %sext
ret i32 %or
}
diff --git a/test/Transforms/InstCombine/osx-names.ll b/test/Transforms/InstCombine/osx-names.ll
index 926caadc49d8e..04d842d0ec28b 100644
--- a/test/Transforms/InstCombine/osx-names.ll
+++ b/test/Transforms/InstCombine/osx-names.ll
@@ -16,14 +16,14 @@ target triple = "i386-apple-macosx10.7.2"
define void @test1(%struct.__sFILE* %stream) nounwind {
; 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
+ %call = tail call i32 (%struct.__sFILE*, i8*, ...) @fprintf(%struct.__sFILE* %stream, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0)) nounwind
ret void
}
define void @test2(%struct.__sFILE* %stream, i8* %str) nounwind ssp {
; 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
+ %call = tail call i32 (%struct.__sFILE*, i8*, ...) @fprintf(%struct.__sFILE* %stream, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str2, i32 0, i32 0), i8* %str) nounwind
ret void
}
diff --git a/test/Transforms/InstCombine/overflow-mul.ll b/test/Transforms/InstCombine/overflow-mul.ll
index 6d8d40bcac3e6..bc0504b0a96d1 100644
--- a/test/Transforms/InstCombine/overflow-mul.ll
+++ b/test/Transforms/InstCombine/overflow-mul.ll
@@ -174,6 +174,17 @@ define <4 x i32> @pr20113(<4 x i16> %a, <4 x i16> %b) {
ret <4 x i32> %vcgez.i
}
+
+; The last test needs this weird datalayout.
+target datalayout = "i32:8:8"
+; Without it, InstCombine will align the pointed on 4 Bytes
+; The KnownBitsZero that result from the alignment allows to
+; turn:
+; and i32 %mul, 255
+; to:
+; and i32 %mul, 252
+; The mask is no longer in the form 2^n-1 and this prevents the transformation.
+
@pr21445_data = external global i32
define i1 @pr21445(i8 %a) {
; CHECK-LABEL: @pr21445(
diff --git a/test/Transforms/InstCombine/overflow.ll b/test/Transforms/InstCombine/overflow.ll
index 3eddc80a70489..4c0a8a2c0df7d 100644
--- a/test/Transforms/InstCombine/overflow.ll
+++ b/test/Transforms/InstCombine/overflow.ll
@@ -97,39 +97,6 @@ if.end: ; preds = %entry
; CHECK: ret i8
}
-; CHECK-LABEL: @test5(
-; CHECK: llvm.uadd.with.overflow
-; CHECK: ret i64
-define i64 @test5(i64 %a, i64 %b) nounwind ssp {
-entry:
- %add = add i64 %b, %a
- %cmp = icmp ult i64 %add, %a
- %Q = select i1 %cmp, i64 %b, i64 42
- ret i64 %Q
-}
-
-; CHECK-LABEL: @test6(
-; CHECK: llvm.uadd.with.overflow
-; CHECK: ret i64
-define i64 @test6(i64 %a, i64 %b) nounwind ssp {
-entry:
- %add = add i64 %b, %a
- %cmp = icmp ult i64 %add, %b
- %Q = select i1 %cmp, i64 %b, i64 42
- ret i64 %Q
-}
-
-; CHECK-LABEL: @test7(
-; CHECK: llvm.uadd.with.overflow
-; CHECK: ret i64
-define i64 @test7(i64 %a, i64 %b) nounwind ssp {
-entry:
- %add = add i64 %b, %a
- %cmp = icmp ugt i64 %b, %add
- %Q = select i1 %cmp, i64 %b, i64 42
- ret i64 %Q
-}
-
; CHECK-LABEL: @test8(
; PR11438
; This is @test1, but the operands are not sign-extended. Make sure
diff --git a/test/Transforms/InstCombine/phi-merge-gep.ll b/test/Transforms/InstCombine/phi-merge-gep.ll
index 25c9cea9b7705..b548e51a56a05 100644
--- a/test/Transforms/InstCombine/phi-merge-gep.ll
+++ b/test/Transforms/InstCombine/phi-merge-gep.ll
@@ -7,39 +7,39 @@
define void @foo(float* %Ar, float* %Ai, i64 %As, float* %Cr, float* %Ci, i64 %Cs, i64 %n) nounwind {
entry:
- %0 = getelementptr inbounds float* %Ar, i64 0 ; <float*> [#uses=1]
- %1 = getelementptr inbounds float* %Ai, i64 0 ; <float*> [#uses=1]
+ %0 = getelementptr inbounds float, float* %Ar, i64 0 ; <float*> [#uses=1]
+ %1 = getelementptr inbounds float, float* %Ai, i64 0 ; <float*> [#uses=1]
%2 = mul i64 %n, %As ; <i64> [#uses=1]
- %3 = getelementptr inbounds float* %Ar, i64 %2 ; <float*> [#uses=1]
+ %3 = getelementptr inbounds float, float* %Ar, i64 %2 ; <float*> [#uses=1]
%4 = mul i64 %n, %As ; <i64> [#uses=1]
- %5 = getelementptr inbounds float* %Ai, i64 %4 ; <float*> [#uses=1]
+ %5 = getelementptr inbounds float, float* %Ai, i64 %4 ; <float*> [#uses=1]
%6 = mul i64 %n, 2 ; <i64> [#uses=1]
%7 = mul i64 %6, %As ; <i64> [#uses=1]
- %8 = getelementptr inbounds float* %Ar, i64 %7 ; <float*> [#uses=1]
+ %8 = getelementptr inbounds float, float* %Ar, i64 %7 ; <float*> [#uses=1]
%9 = mul i64 %n, 2 ; <i64> [#uses=1]
%10 = mul i64 %9, %As ; <i64> [#uses=1]
- %11 = getelementptr inbounds float* %Ai, i64 %10 ; <float*> [#uses=1]
- %12 = getelementptr inbounds float* %Cr, i64 0 ; <float*> [#uses=1]
- %13 = getelementptr inbounds float* %Ci, i64 0 ; <float*> [#uses=1]
+ %11 = getelementptr inbounds float, float* %Ai, i64 %10 ; <float*> [#uses=1]
+ %12 = getelementptr inbounds float, float* %Cr, i64 0 ; <float*> [#uses=1]
+ %13 = getelementptr inbounds float, float* %Ci, i64 0 ; <float*> [#uses=1]
%14 = mul i64 %n, %Cs ; <i64> [#uses=1]
- %15 = getelementptr inbounds float* %Cr, i64 %14 ; <float*> [#uses=1]
+ %15 = getelementptr inbounds float, float* %Cr, i64 %14 ; <float*> [#uses=1]
%16 = mul i64 %n, %Cs ; <i64> [#uses=1]
- %17 = getelementptr inbounds float* %Ci, i64 %16 ; <float*> [#uses=1]
+ %17 = getelementptr inbounds float, float* %Ci, i64 %16 ; <float*> [#uses=1]
%18 = mul i64 %n, 2 ; <i64> [#uses=1]
%19 = mul i64 %18, %Cs ; <i64> [#uses=1]
- %20 = getelementptr inbounds float* %Cr, i64 %19 ; <float*> [#uses=1]
+ %20 = getelementptr inbounds float, float* %Cr, i64 %19 ; <float*> [#uses=1]
%21 = mul i64 %n, 2 ; <i64> [#uses=1]
%22 = mul i64 %21, %Cs ; <i64> [#uses=1]
- %23 = getelementptr inbounds float* %Ci, i64 %22 ; <float*> [#uses=1]
+ %23 = getelementptr inbounds float, float* %Ci, i64 %22 ; <float*> [#uses=1]
br label %bb13
bb: ; preds = %bb13
- %24 = load float* %A0r.0, align 4 ; <float> [#uses=1]
- %25 = load float* %A0i.0, align 4 ; <float> [#uses=1]
- %26 = load float* %A1r.0, align 4 ; <float> [#uses=2]
- %27 = load float* %A1i.0, align 4 ; <float> [#uses=2]
- %28 = load float* %A2r.0, align 4 ; <float> [#uses=2]
- %29 = load float* %A2i.0, align 4 ; <float> [#uses=2]
+ %24 = load float, float* %A0r.0, align 4 ; <float> [#uses=1]
+ %25 = load float, float* %A0i.0, align 4 ; <float> [#uses=1]
+ %26 = load float, float* %A1r.0, align 4 ; <float> [#uses=2]
+ %27 = load float, float* %A1i.0, align 4 ; <float> [#uses=2]
+ %28 = load float, float* %A2r.0, align 4 ; <float> [#uses=2]
+ %29 = load float, float* %A2i.0, align 4 ; <float> [#uses=2]
%30 = fadd float %26, %28 ; <float> [#uses=2]
%31 = fadd float %27, %29 ; <float> [#uses=2]
%32 = fsub float %26, %28 ; <float> [#uses=1]
@@ -62,18 +62,18 @@ bb: ; preds = %bb13
store float %43, float* %C1i.0, align 4
store float %44, float* %C2r.0, align 4
store float %45, float* %C2i.0, align 4
- %46 = getelementptr inbounds float* %A0r.0, i64 %As ; <float*> [#uses=1]
- %47 = getelementptr inbounds float* %A0i.0, i64 %As ; <float*> [#uses=1]
- %48 = getelementptr inbounds float* %A1r.0, i64 %As ; <float*> [#uses=1]
- %49 = getelementptr inbounds float* %A1i.0, i64 %As ; <float*> [#uses=1]
- %50 = getelementptr inbounds float* %A2r.0, i64 %As ; <float*> [#uses=1]
- %51 = getelementptr inbounds float* %A2i.0, i64 %As ; <float*> [#uses=1]
- %52 = getelementptr inbounds float* %C0r.0, i64 %Cs ; <float*> [#uses=1]
- %53 = getelementptr inbounds float* %C0i.0, i64 %Cs ; <float*> [#uses=1]
- %54 = getelementptr inbounds float* %C1r.0, i64 %Cs ; <float*> [#uses=1]
- %55 = getelementptr inbounds float* %C1i.0, i64 %Cs ; <float*> [#uses=1]
- %56 = getelementptr inbounds float* %C2r.0, i64 %Cs ; <float*> [#uses=1]
- %57 = getelementptr inbounds float* %C2i.0, i64 %Cs ; <float*> [#uses=1]
+ %46 = getelementptr inbounds float, float* %A0r.0, i64 %As ; <float*> [#uses=1]
+ %47 = getelementptr inbounds float, float* %A0i.0, i64 %As ; <float*> [#uses=1]
+ %48 = getelementptr inbounds float, float* %A1r.0, i64 %As ; <float*> [#uses=1]
+ %49 = getelementptr inbounds float, float* %A1i.0, i64 %As ; <float*> [#uses=1]
+ %50 = getelementptr inbounds float, float* %A2r.0, i64 %As ; <float*> [#uses=1]
+ %51 = getelementptr inbounds float, float* %A2i.0, i64 %As ; <float*> [#uses=1]
+ %52 = getelementptr inbounds float, float* %C0r.0, i64 %Cs ; <float*> [#uses=1]
+ %53 = getelementptr inbounds float, float* %C0i.0, i64 %Cs ; <float*> [#uses=1]
+ %54 = getelementptr inbounds float, float* %C1r.0, i64 %Cs ; <float*> [#uses=1]
+ %55 = getelementptr inbounds float, float* %C1i.0, i64 %Cs ; <float*> [#uses=1]
+ %56 = getelementptr inbounds float, float* %C2r.0, i64 %Cs ; <float*> [#uses=1]
+ %57 = getelementptr inbounds float, float* %C2i.0, i64 %Cs ; <float*> [#uses=1]
%58 = add nsw i64 %i.0, 1 ; <i64> [#uses=1]
br label %bb13
diff --git a/test/Transforms/InstCombine/phi.ll b/test/Transforms/InstCombine/phi.ll
index 6e314651383ce..54cc4cfe45948 100644
--- a/test/Transforms/InstCombine/phi.ll
+++ b/test/Transforms/InstCombine/phi.ll
@@ -125,11 +125,11 @@ Exit: ; preds = %Loop
define i32* @test8({ i32, i32 } *%A, i1 %b) {
BB0:
- %X = getelementptr inbounds { i32, i32 } *%A, i32 0, i32 1
+ %X = getelementptr inbounds { i32, i32 }, { i32, i32 } *%A, i32 0, i32 1
br i1 %b, label %BB1, label %BB2
BB1:
- %Y = getelementptr { i32, i32 } *%A, i32 0, i32 1
+ %Y = getelementptr { i32, i32 }, { i32, i32 } *%A, i32 0, i32 1
br label %BB2
BB2:
@@ -139,7 +139,7 @@ BB2:
; CHECK-LABEL: @test8(
; CHECK-NOT: phi
; CHECK: BB2:
-; CHECK-NEXT: %B = getelementptr { i32, i32 }* %A
+; CHECK-NEXT: %B = getelementptr { i32, i32 }, { i32, i32 }* %A
; CHECK-NEXT: ret i32* %B
}
@@ -149,11 +149,11 @@ entry:
br i1 %c, label %bb1, label %bb
bb:
- %C = load i32* %B, align 1
+ %C = load i32, i32* %B, align 1
br label %bb2
bb1:
- %D = load i32* %A, align 1
+ %D = load i32, i32* %A, align 1
br label %bb2
bb2:
@@ -162,7 +162,7 @@ bb2:
; CHECK-LABEL: @test9(
; CHECK: bb2:
; CHECK-NEXT: phi i32* [ %B, %bb ], [ %A, %bb1 ]
-; CHECK-NEXT: %E = load i32* %{{[^,]*}}, align 1
+; CHECK-NEXT: %E = load i32, i32* %{{[^,]*}}, align 1
; CHECK-NEXT: ret i32 %E
}
@@ -173,11 +173,11 @@ entry:
br i1 %c, label %bb1, label %bb
bb:
- %C = load i32* %B, align 16
+ %C = load i32, i32* %B, align 16
br label %bb2
bb1:
- %D = load i32* %A, align 32
+ %D = load i32, i32* %A, align 32
br label %bb2
bb2:
@@ -186,7 +186,7 @@ bb2:
; CHECK-LABEL: @test10(
; CHECK: bb2:
; CHECK-NEXT: phi i32* [ %B, %bb ], [ %A, %bb1 ]
-; CHECK-NEXT: %E = load i32* %{{[^,]*}}, align 16
+; CHECK-NEXT: %E = load i32, i32* %{{[^,]*}}, align 16
; CHECK-NEXT: ret i32 %E
}
@@ -375,30 +375,30 @@ entry:
store i32 %flag, i32* %flag.addr
store i32* %pointer2, i32** %pointer2.addr
store i32 10, i32* %res
- %tmp = load i32* %flag.addr ; <i32> [#uses=1]
+ %tmp = load i32, i32* %flag.addr ; <i32> [#uses=1]
%tobool = icmp ne i32 %tmp, 0 ; <i1> [#uses=1]
br i1 %tobool, label %if.then, label %if.else
return: ; preds = %if.end
- %tmp7 = load i32* %retval ; <i32> [#uses=1]
+ %tmp7 = load i32, i32* %retval ; <i32> [#uses=1]
ret i32 %tmp7
if.end: ; preds = %if.else, %if.then
- %tmp6 = load i32* %res ; <i32> [#uses=1]
+ %tmp6 = load i32, i32* %res ; <i32> [#uses=1]
store i32 %tmp6, i32* %retval
br label %return
if.then: ; preds = %entry
- %tmp1 = load i32 addrspace(1)** %pointer1.addr ; <i32 addrspace(1)*>
- %arrayidx = getelementptr i32 addrspace(1)* %tmp1, i32 0 ; <i32 addrspace(1)*> [#uses=1]
- %tmp2 = load i32 addrspace(1)* %arrayidx ; <i32> [#uses=1]
+ %tmp1 = load i32 addrspace(1)*, i32 addrspace(1)** %pointer1.addr ; <i32 addrspace(1)*>
+ %arrayidx = getelementptr i32, i32 addrspace(1)* %tmp1, i32 0 ; <i32 addrspace(1)*> [#uses=1]
+ %tmp2 = load i32, i32 addrspace(1)* %arrayidx ; <i32> [#uses=1]
store i32 %tmp2, i32* %res
br label %if.end
if.else: ; preds = %entry
- %tmp3 = load i32** %pointer2.addr ; <i32*> [#uses=1]
- %arrayidx4 = getelementptr i32* %tmp3, i32 0 ; <i32*> [#uses=1]
- %tmp5 = load i32* %arrayidx4 ; <i32> [#uses=1]
+ %tmp3 = load i32*, i32** %pointer2.addr ; <i32*> [#uses=1]
+ %arrayidx4 = getelementptr i32, i32* %tmp3, i32 0 ; <i32*> [#uses=1]
+ %tmp5 = load i32, i32* %arrayidx4 ; <i32> [#uses=1]
store i32 %tmp5, i32* %res
br label %if.end
}
diff --git a/test/Transforms/InstCombine/pr12251.ll b/test/Transforms/InstCombine/pr12251.ll
index 8c382bb104aca..7197bda2e542d 100644
--- a/test/Transforms/InstCombine/pr12251.ll
+++ b/test/Transforms/InstCombine/pr12251.ll
@@ -2,13 +2,13 @@
define zeroext i1 @_Z3fooPb(i8* nocapture %x) {
entry:
- %a = load i8* %x, align 1, !range !0
+ %a = load i8, i8* %x, align 1, !range !0
%b = and i8 %a, 1
%tobool = icmp ne i8 %b, 0
ret i1 %tobool
}
-; CHECK: %a = load i8* %x, align 1, !range !0
+; CHECK: %a = load i8, i8* %x, align 1, !range !0
; CHECK-NEXT: %tobool = icmp ne i8 %a, 0
; CHECK-NEXT: ret i1 %tobool
diff --git a/test/Transforms/InstCombine/pr21651.ll b/test/Transforms/InstCombine/pr21651.ll
index 914785f329af5..d2b8d312d8c61 100644
--- a/test/Transforms/InstCombine/pr21651.ll
+++ b/test/Transforms/InstCombine/pr21651.ll
@@ -1,5 +1,9 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
+; Provide legal integer types.
+target datalayout = "n8:16:32:64"
+
+
define void @PR21651() {
switch i2 0, label %out [
i2 0, label %out
diff --git a/test/Transforms/InstCombine/pr2645-0.ll b/test/Transforms/InstCombine/pr2645-0.ll
index e8aeb2afb9cf2..21bfa64a8604c 100644
--- a/test/Transforms/InstCombine/pr2645-0.ll
+++ b/test/Transforms/InstCombine/pr2645-0.ll
@@ -6,10 +6,10 @@
define internal void @""(i8*) {
; <label>:1
bitcast i8* %0 to i32* ; <i32*>:2 [#uses=1]
- load i32* %2, align 1 ; <i32>:3 [#uses=1]
- getelementptr i8* %0, i32 4 ; <i8*>:4 [#uses=1]
+ load i32, i32* %2, align 1 ; <i32>:3 [#uses=1]
+ getelementptr i8, i8* %0, i32 4 ; <i8*>:4 [#uses=1]
bitcast i8* %4 to i32* ; <i32*>:5 [#uses=1]
- load i32* %5, align 1 ; <i32>:6 [#uses=1]
+ load i32, i32* %5, align 1 ; <i32>:6 [#uses=1]
br label %7
; <label>:7 ; preds = %9, %1
@@ -22,7 +22,7 @@ define internal void @""(i8*) {
sitofp i32 %.0 to float ; <float>:10 [#uses=1]
insertelement <4 x float> %.01, float %10, i32 0 ; <<4 x float>>:11 [#uses=1]
shufflevector <4 x float> %11, <4 x float> undef, <4 x i32> zeroinitializer ; <<4 x float>>:12 [#uses=2]
- getelementptr i8* %0, i32 48 ; <i8*>:13 [#uses=1]
+ getelementptr i8, i8* %0, i32 48 ; <i8*>:13 [#uses=1]
bitcast i8* %13 to <4 x float>* ; <<4 x float>*>:14 [#uses=1]
store <4 x float> %12, <4 x float>* %14, align 16
add i32 %.0, 2 ; <i32>:15 [#uses=1]
diff --git a/test/Transforms/InstCombine/pr2645-1.ll b/test/Transforms/InstCombine/pr2645-1.ll
index d320dafcd252c..2986d21866bf9 100644
--- a/test/Transforms/InstCombine/pr2645-1.ll
+++ b/test/Transforms/InstCombine/pr2645-1.ll
@@ -13,9 +13,9 @@ define internal void @""(i8*, i32, i8*) {
br i1 %5, label %6, label %20
; <label>:6 ; preds = %4
- %7 = getelementptr i8* %2, i32 %.0 ; <i8*> [#uses=1]
+ %7 = getelementptr i8, i8* %2, i32 %.0 ; <i8*> [#uses=1]
%8 = bitcast i8* %7 to <4 x i16>* ; <<4 x i16>*> [#uses=1]
- %9 = load <4 x i16>* %8, align 1 ; <<4 x i16>> [#uses=1]
+ %9 = load <4 x i16>, <4 x i16>* %8, align 1 ; <<4 x i16>> [#uses=1]
%10 = bitcast <4 x i16> %9 to <1 x i64> ; <<1 x i64>> [#uses=1]
%11 = call <2 x i64> @foo(<1 x i64> %10)
; <<2 x i64>> [#uses=1]
@@ -24,7 +24,7 @@ define internal void @""(i8*, i32, i8*) {
%14 = shufflevector <8 x i16> %13, <8 x i16> %13, <8 x i32> < i32 0, i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3 > ; <<8 x i16>> [#uses=1]
%15 = bitcast <8 x i16> %14 to <4 x i32> ; <<4 x i32>> [#uses=1]
%16 = sitofp <4 x i32> %15 to <4 x float> ; <<4 x float>> [#uses=1]
- %17 = getelementptr i8* %0, i32 %.0 ; <i8*> [#uses=1]
+ %17 = getelementptr i8, i8* %0, i32 %.0 ; <i8*> [#uses=1]
%18 = bitcast i8* %17 to <4 x float>* ; <<4 x float>*> [#uses=1]
store <4 x float> %16, <4 x float>* %18, align 1
%19 = add i32 %.0, 1 ; <i32> [#uses=1]
diff --git a/test/Transforms/InstCombine/pr2996.ll b/test/Transforms/InstCombine/pr2996.ll
index ff3245d8668cf..f5e1df4dd048f 100644
--- a/test/Transforms/InstCombine/pr2996.ll
+++ b/test/Transforms/InstCombine/pr2996.ll
@@ -5,7 +5,7 @@ define void @func_53(i16 signext %p_56) nounwind {
entry:
%0 = icmp sgt i16 %p_56, -1 ; <i1> [#uses=1]
%iftmp.0.0 = select i1 %0, i32 -1, i32 0 ; <i32> [#uses=1]
- %1 = call i32 (...)* @func_4(i32 %iftmp.0.0) nounwind ; <i32> [#uses=0]
+ %1 = call i32 (...) @func_4(i32 %iftmp.0.0) nounwind ; <i32> [#uses=0]
ret void
}
diff --git a/test/Transforms/InstCombine/pr8547.ll b/test/Transforms/InstCombine/pr8547.ll
index 7e9cbe17b68d2..6d74b4002c113 100644
--- a/test/Transforms/InstCombine/pr8547.ll
+++ b/test/Transforms/InstCombine/pr8547.ll
@@ -21,6 +21,6 @@ for.cond: ; preds = %for.cond, %codeRepl
br i1 %tobool, label %for.cond, label %codeRepl2
codeRepl2: ; preds = %for.cond
- %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i64 0, i64 0), i32 %conv2) nounwind
+ %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %conv2) nounwind
ret i32 0
}
diff --git a/test/Transforms/InstCombine/printf-1.ll b/test/Transforms/InstCombine/printf-1.ll
index 483bc7a6b079e..75e11ce7b7b46 100644
--- a/test/Transforms/InstCombine/printf-1.ll
+++ b/test/Transforms/InstCombine/printf-1.ll
@@ -21,8 +21,8 @@ declare i32 @printf(i8*, ...)
define void @test_simplify1() {
; CHECK-LABEL: @test_simplify1(
- %fmt = getelementptr [1 x i8]* @empty, i32 0, i32 0
- call i32 (i8*, ...)* @printf(i8* %fmt)
+ %fmt = getelementptr [1 x i8], [1 x i8]* @empty, i32 0, i32 0
+ call i32 (i8*, ...) @printf(i8* %fmt)
ret void
; CHECK-NEXT: ret void
}
@@ -31,8 +31,8 @@ define void @test_simplify1() {
define void @test_simplify2() {
; CHECK-LABEL: @test_simplify2(
- %fmt = getelementptr [2 x i8]* @h, i32 0, i32 0
- call i32 (i8*, ...)* @printf(i8* %fmt)
+ %fmt = getelementptr [2 x i8], [2 x i8]* @h, i32 0, i32 0
+ call i32 (i8*, ...) @printf(i8* %fmt)
; CHECK-NEXT: call i32 @putchar(i32 104)
ret void
; CHECK-NEXT: ret void
@@ -40,8 +40,8 @@ define void @test_simplify2() {
define void @test_simplify3() {
; CHECK-LABEL: @test_simplify3(
- %fmt = getelementptr [2 x i8]* @percent, i32 0, i32 0
- call i32 (i8*, ...)* @printf(i8* %fmt)
+ %fmt = getelementptr [2 x i8], [2 x i8]* @percent, i32 0, i32 0
+ call i32 (i8*, ...) @printf(i8* %fmt)
; CHECK-NEXT: call i32 @putchar(i32 37)
ret void
; CHECK-NEXT: ret void
@@ -51,9 +51,9 @@ define void @test_simplify3() {
define void @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))
+ %fmt = getelementptr [13 x i8], [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], [12 x i8]* [[STR]], i32 0, i32 0))
ret void
; CHECK-NEXT: ret void
}
@@ -62,8 +62,8 @@ define void @test_simplify4() {
define void @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)
+ %fmt = getelementptr [3 x i8], [3 x i8]* @percent_c, i32 0, i32 0
+ call i32 (i8*, ...) @printf(i8* %fmt, i8 104)
; CHECK-NEXT: call i32 @putchar(i32 104)
ret void
; CHECK-NEXT: ret void
@@ -73,10 +73,10 @@ define void @test_simplify5() {
define void @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)
-; CHECK-NEXT: call i32 @puts(i8* getelementptr inbounds ([13 x i8]* @hello_world, i32 0, i32 0))
+ %fmt = getelementptr [4 x i8], [4 x i8]* @percent_s, i32 0, i32 0
+ %str = getelementptr [13 x i8], [13 x i8]* @hello_world, i32 0, i32 0
+ call i32 (i8*, ...) @printf(i8* %fmt, i8* %str)
+; CHECK-NEXT: call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32 0))
ret void
; CHECK-NEXT: ret void
}
@@ -85,35 +85,35 @@ define void @test_simplify6() {
define void @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-IPRINTF-NEXT: call i32 (i8*, ...)* @iprintf(i8* getelementptr inbounds ([3 x i8]* @percent_d, i32 0, i32 0), i32 187)
+ %fmt = getelementptr [3 x i8], [3 x i8]* @percent_d, i32 0, i32 0
+ call i32 (i8*, ...) @printf(i8* %fmt, i32 187)
+; CHECK-IPRINTF-NEXT: call i32 (i8*, ...) @iprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @percent_d, i32 0, i32 0), i32 187)
ret void
; CHECK-IPRINTF-NEXT: ret void
}
define void @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-IPRINTF-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([3 x i8]* @percent_f, i32 0, i32 0), double 1.870000e+00)
+ %fmt = getelementptr [3 x i8], [3 x i8]* @percent_f, i32 0, i32 0
+ call i32 (i8*, ...) @printf(i8* %fmt, double 1.87)
+; CHECK-IPRINTF-NEXT: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @percent_f, i32 0, i32 0), double 1.870000e+00)
ret void
; CHECK-IPRINTF-NEXT: ret void
}
define void @test_no_simplify2(i8* %fmt, double %d) {
; CHECK-LABEL: @test_no_simplify2(
- call i32 (i8*, ...)* @printf(i8* %fmt, double %d)
-; CHECK-NEXT: call i32 (i8*, ...)* @printf(i8* %fmt, double %d)
+ call i32 (i8*, ...) @printf(i8* %fmt, double %d)
+; CHECK-NEXT: call i32 (i8*, ...) @printf(i8* %fmt, double %d)
ret void
; CHECK-NEXT: ret void
}
define i32 @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))
+ %fmt = getelementptr [2 x i8], [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], [2 x i8]* @h, i32 0, i32 0))
ret i32 %ret
; CHECK-NEXT: ret i32 %ret
}
diff --git a/test/Transforms/InstCombine/printf-2.ll b/test/Transforms/InstCombine/printf-2.ll
index 7e018ebba04df..d6769856e3d82 100644
--- a/test/Transforms/InstCombine/printf-2.ll
+++ b/test/Transforms/InstCombine/printf-2.ll
@@ -14,8 +14,8 @@ declare void @printf(i8*, ...)
define void @test_simplify1() {
; CHECK-LABEL: @test_simplify1(
- %fmt = getelementptr [2 x i8]* @h, i32 0, i32 0
- call void (i8*, ...)* @printf(i8* %fmt)
+ %fmt = getelementptr [2 x i8], [2 x i8]* @h, i32 0, i32 0
+ call void (i8*, ...) @printf(i8* %fmt)
; CHECK-NEXT: call i32 @putchar(i32 104)
ret void
; CHECK-NEXT: ret void
@@ -23,19 +23,19 @@ define void @test_simplify1() {
define void @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))
+ %fmt = getelementptr [13 x i8], [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], [12 x i8]* @str, i32 0, i32 0))
ret void
; CHECK-NEXT: ret void
}
define void @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)
-; CHECK-NEXT: call i32 @puts(i8* getelementptr inbounds ([13 x i8]* @hello_world, i32 0, i32 0))
+ %fmt = getelementptr [4 x i8], [4 x i8]* @percent_s, i32 0, i32 0
+ %str = getelementptr [13 x i8], [13 x i8]* @hello_world, i32 0, i32 0
+ call void (i8*, ...) @printf(i8* %fmt, i8* %str)
+; CHECK-NEXT: call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32 0))
ret void
; CHECK-NEXT: ret void
}
diff --git a/test/Transforms/InstCombine/puts-1.ll b/test/Transforms/InstCombine/puts-1.ll
index bd7557ef650fe..21028684851d3 100644
--- a/test/Transforms/InstCombine/puts-1.ll
+++ b/test/Transforms/InstCombine/puts-1.ll
@@ -12,7 +12,7 @@ declare i32 @puts(i8*)
define void @test_simplify1() {
; CHECK-LABEL: @test_simplify1(
- %str = getelementptr [1 x i8]* @empty, i32 0, i32 0
+ %str = getelementptr [1 x i8], [1 x i8]* @empty, i32 0, i32 0
call i32 @puts(i8* %str)
; CHECK-NEXT: call i32 @putchar(i32 10)
ret void
@@ -23,9 +23,9 @@ define void @test_simplify1() {
define i32 @test_no_simplify1() {
; CHECK-LABEL: @test_no_simplify1(
- %str = getelementptr [1 x i8]* @empty, i32 0, i32 0
+ %str = getelementptr [1 x i8], [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))
+; CHECK-NEXT: call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty, i32 0, i32 0))
ret i32 %ret
; CHECK-NEXT: ret i32 %ret
}
diff --git a/test/Transforms/InstCombine/select-cmp-br.ll b/test/Transforms/InstCombine/select-cmp-br.ll
index f10d58783a770..1dc7e153f5fb0 100644
--- a/test/Transforms/InstCombine/select-cmp-br.ll
+++ b/test/Transforms/InstCombine/select-cmp-br.ll
@@ -9,13 +9,13 @@ declare void @foobar()
define void @test1(%C*) {
entry:
- %1 = getelementptr inbounds %C* %0, i64 0, i32 0, i32 0
- %m = load i64** %1, align 8
- %2 = getelementptr inbounds %C* %0, i64 1, i32 0, i32 0
- %n = load i64** %2, align 8
- %3 = getelementptr inbounds i64* %m, i64 9
+ %1 = getelementptr inbounds %C, %C* %0, i64 0, i32 0, i32 0
+ %m = load i64*, i64** %1, align 8
+ %2 = getelementptr inbounds %C, %C* %0, i64 1, i32 0, i32 0
+ %n = load i64*, i64** %2, align 8
+ %3 = getelementptr inbounds i64, i64* %m, i64 9
%4 = bitcast i64* %3 to i64 (%C*)**
- %5 = load i64 (%C*)** %4, align 8
+ %5 = load i64 (%C*)*, i64 (%C*)** %4, align 8
%6 = icmp eq i64* %m, %n
%7 = select i1 %6, %C* %0, %C* null
%8 = icmp eq %C* %7, null
@@ -25,7 +25,7 @@ entry:
ret void
; <label>:10 ; preds = %entry
- %11 = getelementptr inbounds %C* %7, i64 0, i32 0
+ %11 = getelementptr inbounds %C, %C* %7, i64 0, i32 0
tail call void @bar(%struct.S* %11)
br label %9
@@ -40,13 +40,13 @@ entry:
define void @test2(%C*) {
entry:
- %1 = getelementptr inbounds %C* %0, i64 0, i32 0, i32 0
- %m = load i64** %1, align 8
- %2 = getelementptr inbounds %C* %0, i64 1, i32 0, i32 0
- %n = load i64** %2, align 8
- %3 = getelementptr inbounds i64* %m, i64 9
+ %1 = getelementptr inbounds %C, %C* %0, i64 0, i32 0, i32 0
+ %m = load i64*, i64** %1, align 8
+ %2 = getelementptr inbounds %C, %C* %0, i64 1, i32 0, i32 0
+ %n = load i64*, i64** %2, align 8
+ %3 = getelementptr inbounds i64, i64* %m, i64 9
%4 = bitcast i64* %3 to i64 (%C*)**
- %5 = load i64 (%C*)** %4, align 8
+ %5 = load i64 (%C*)*, i64 (%C*)** %4, align 8
%6 = icmp eq i64* %m, %n
%7 = select i1 %6, %C* null, %C* %0
%8 = icmp eq %C* %7, null
@@ -56,7 +56,7 @@ entry:
ret void
; <label>:10 ; preds = %entry
- %11 = getelementptr inbounds %C* %7, i64 0, i32 0
+ %11 = getelementptr inbounds %C, %C* %7, i64 0, i32 0
tail call void @bar(%struct.S* %11)
br label %9
@@ -71,13 +71,13 @@ entry:
define void @test3(%C*) {
entry:
- %1 = getelementptr inbounds %C* %0, i64 0, i32 0, i32 0
- %m = load i64** %1, align 8
- %2 = getelementptr inbounds %C* %0, i64 1, i32 0, i32 0
- %n = load i64** %2, align 8
- %3 = getelementptr inbounds i64* %m, i64 9
+ %1 = getelementptr inbounds %C, %C* %0, i64 0, i32 0, i32 0
+ %m = load i64*, i64** %1, align 8
+ %2 = getelementptr inbounds %C, %C* %0, i64 1, i32 0, i32 0
+ %n = load i64*, i64** %2, align 8
+ %3 = getelementptr inbounds i64, i64* %m, i64 9
%4 = bitcast i64* %3 to i64 (%C*)**
- %5 = load i64 (%C*)** %4, align 8
+ %5 = load i64 (%C*)*, i64 (%C*)** %4, align 8
%6 = icmp eq i64* %m, %n
%7 = select i1 %6, %C* %0, %C* null
%8 = icmp ne %C* %7, null
@@ -87,7 +87,7 @@ entry:
ret void
; <label>:10 ; preds = %entry
- %11 = getelementptr inbounds %C* %7, i64 0, i32 0
+ %11 = getelementptr inbounds %C, %C* %7, i64 0, i32 0
tail call void @bar(%struct.S* %11)
br label %9
@@ -102,13 +102,13 @@ entry:
define void @test4(%C*) {
entry:
- %1 = getelementptr inbounds %C* %0, i64 0, i32 0, i32 0
- %m = load i64** %1, align 8
- %2 = getelementptr inbounds %C* %0, i64 1, i32 0, i32 0
- %n = load i64** %2, align 8
- %3 = getelementptr inbounds i64* %m, i64 9
+ %1 = getelementptr inbounds %C, %C* %0, i64 0, i32 0, i32 0
+ %m = load i64*, i64** %1, align 8
+ %2 = getelementptr inbounds %C, %C* %0, i64 1, i32 0, i32 0
+ %n = load i64*, i64** %2, align 8
+ %3 = getelementptr inbounds i64, i64* %m, i64 9
%4 = bitcast i64* %3 to i64 (%C*)**
- %5 = load i64 (%C*)** %4, align 8
+ %5 = load i64 (%C*)*, i64 (%C*)** %4, align 8
%6 = icmp eq i64* %m, %n
%7 = select i1 %6, %C* null, %C* %0
%8 = icmp ne %C* %7, null
@@ -118,7 +118,7 @@ entry:
ret void
; <label>:10 ; preds = %entry
- %11 = getelementptr inbounds %C* %7, i64 0, i32 0
+ %11 = getelementptr inbounds %C, %C* %7, i64 0, i32 0
tail call void @bar(%struct.S* %11)
br label %9
@@ -141,7 +141,7 @@ entry:
ret void
; <label>:5 ; preds = %entry
- %6 = getelementptr inbounds %C* %2, i64 0, i32 0
+ %6 = getelementptr inbounds %C, %C* %2, i64 0, i32 0
tail call void @bar(%struct.S* %6)
br label %4
diff --git a/test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll b/test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll
new file mode 100644
index 0000000000000..894bf6db0a428
--- /dev/null
+++ b/test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll
@@ -0,0 +1,327 @@
+; RUN: opt -instcombine -S < %s | FileCheck %s
+
+; This test is to verify that the instruction combiner is able to fold
+; a cttz/ctlz followed by a icmp + select into a single cttz/ctlz with
+; the 'is_zero_undef' flag cleared.
+
+define i16 @test1(i16 %x) {
+; CHECK-LABEL: @test1(
+; CHECK: [[VAR:%[a-zA-Z0-9]+]] = tail call i16 @llvm.ctlz.i16(i16 %x, i1 false)
+; CHECK-NEXT: ret i16 [[VAR]]
+entry:
+ %0 = tail call i16 @llvm.ctlz.i16(i16 %x, i1 true)
+ %tobool = icmp ne i16 %x, 0
+ %cond = select i1 %tobool, i16 %0, i16 16
+ ret i16 %cond
+}
+
+define i32 @test2(i32 %x) {
+; CHECK-LABEL: @test2(
+; CHECK: [[VAR:%[a-zA-Z0-9]+]] = tail call i32 @llvm.ctlz.i32(i32 %x, i1 false)
+; CHECK-NEXT: ret i32 [[VAR]]
+entry:
+ %0 = tail call i32 @llvm.ctlz.i32(i32 %x, i1 true)
+ %tobool = icmp ne i32 %x, 0
+ %cond = select i1 %tobool, i32 %0, i32 32
+ ret i32 %cond
+}
+
+define i64 @test3(i64 %x) {
+; CHECK-LABEL: @test3(
+; CHECK: [[VAR:%[a-zA-Z0-9]+]] = tail call i64 @llvm.ctlz.i64(i64 %x, i1 false)
+; CHECK-NEXT: ret i64 [[VAR]]
+entry:
+ %0 = tail call i64 @llvm.ctlz.i64(i64 %x, i1 true)
+ %tobool = icmp ne i64 %x, 0
+ %cond = select i1 %tobool, i64 %0, i64 64
+ ret i64 %cond
+}
+
+define i16 @test4(i16 %x) {
+; CHECK-LABEL: @test4(
+; CHECK: [[VAR:%[a-zA-Z0-9]+]] = tail call i16 @llvm.ctlz.i16(i16 %x, i1 false)
+; CHECK-NEXT: ret i16 [[VAR]]
+entry:
+ %0 = tail call i16 @llvm.ctlz.i16(i16 %x, i1 true)
+ %tobool = icmp eq i16 %x, 0
+ %cond = select i1 %tobool, i16 16, i16 %0
+ ret i16 %cond
+}
+
+define i32 @test5(i32 %x) {
+; CHECK-LABEL: @test5(
+; CHECK: [[VAR:%[a-zA-Z0-9]+]] = tail call i32 @llvm.ctlz.i32(i32 %x, i1 false)
+; CHECK-NEXT: ret i32 [[VAR]]
+entry:
+ %0 = tail call i32 @llvm.ctlz.i32(i32 %x, i1 true)
+ %tobool = icmp eq i32 %x, 0
+ %cond = select i1 %tobool, i32 32, i32 %0
+ ret i32 %cond
+}
+
+define i64 @test6(i64 %x) {
+; CHECK-LABEL: @test6(
+; CHECK: [[VAR:%[a-zA-Z0-9]+]] = tail call i64 @llvm.ctlz.i64(i64 %x, i1 false)
+; CHECK-NEXT: ret i64 [[VAR]]
+entry:
+ %0 = tail call i64 @llvm.ctlz.i64(i64 %x, i1 true)
+ %tobool = icmp eq i64 %x, 0
+ %cond = select i1 %tobool, i64 64, i64 %0
+ ret i64 %cond
+}
+
+define i16 @test1b(i16 %x) {
+; CHECK-LABEL: @test1b(
+; CHECK: [[VAR:%[a-zA-Z0-9]+]] = tail call i16 @llvm.cttz.i16(i16 %x, i1 false)
+; CHECK-NEXT: ret i16 [[VAR]]
+entry:
+ %0 = tail call i16 @llvm.cttz.i16(i16 %x, i1 true)
+ %tobool = icmp ne i16 %x, 0
+ %cond = select i1 %tobool, i16 %0, i16 16
+ ret i16 %cond
+}
+
+define i32 @test2b(i32 %x) {
+; CHECK-LABEL: @test2b(
+; CHECK: [[VAR:%[a-zA-Z0-9]+]] = tail call i32 @llvm.cttz.i32(i32 %x, i1 false)
+; CHECK-NEXT: ret i32 [[VAR]]
+entry:
+ %0 = tail call i32 @llvm.cttz.i32(i32 %x, i1 true)
+ %tobool = icmp ne i32 %x, 0
+ %cond = select i1 %tobool, i32 %0, i32 32
+ ret i32 %cond
+}
+
+define i64 @test3b(i64 %x) {
+; CHECK-LABEL: @test3b(
+; CHECK: [[VAR:%[a-zA-Z0-9]+]] = tail call i64 @llvm.cttz.i64(i64 %x, i1 false)
+; CHECK-NEXT: ret i64 [[VAR]]
+entry:
+ %0 = tail call i64 @llvm.cttz.i64(i64 %x, i1 true)
+ %tobool = icmp ne i64 %x, 0
+ %cond = select i1 %tobool, i64 %0, i64 64
+ ret i64 %cond
+}
+
+define i16 @test4b(i16 %x) {
+; CHECK-LABEL: @test4b(
+; CHECK: [[VAR:%[a-zA-Z0-9]+]] = tail call i16 @llvm.cttz.i16(i16 %x, i1 false)
+; CHECK-NEXT: ret i16 [[VAR]]
+entry:
+ %0 = tail call i16 @llvm.cttz.i16(i16 %x, i1 true)
+ %tobool = icmp eq i16 %x, 0
+ %cond = select i1 %tobool, i16 16, i16 %0
+ ret i16 %cond
+}
+
+define i32 @test5b(i32 %x) {
+; CHECK-LABEL: @test5b(
+; CHECK: [[VAR:%[a-zA-Z0-9]+]] = tail call i32 @llvm.cttz.i32(i32 %x, i1 false)
+; CHECK-NEXT: ret i32 [[VAR]]
+entry:
+ %0 = tail call i32 @llvm.cttz.i32(i32 %x, i1 true)
+ %tobool = icmp eq i32 %x, 0
+ %cond = select i1 %tobool, i32 32, i32 %0
+ ret i32 %cond
+}
+
+define i64 @test6b(i64 %x) {
+; CHECK-LABEL: @test6b(
+; CHECK: [[VAR:%[a-zA-Z0-9]+]] = tail call i64 @llvm.cttz.i64(i64 %x, i1 false)
+; CHECK-NEXT: ret i64 [[VAR]]
+entry:
+ %0 = tail call i64 @llvm.cttz.i64(i64 %x, i1 true)
+ %tobool = icmp eq i64 %x, 0
+ %cond = select i1 %tobool, i64 64, i64 %0
+ ret i64 %cond
+}
+
+define i32 @test1c(i16 %x) {
+; CHECK-LABEL: @test1c(
+; CHECK: [[VAR1:%[a-zA-Z0-9]+]] = tail call i16 @llvm.cttz.i16(i16 %x, i1 false)
+; CHECK-NEXT: [[VAR2:%[a-zA-Z0-9]+]] = zext i16 [[VAR1]] to i32
+; CHECK-NEXT: ret i32 [[VAR2]]
+entry:
+ %0 = tail call i16 @llvm.cttz.i16(i16 %x, i1 true)
+ %cast2 = zext i16 %0 to i32
+ %tobool = icmp ne i16 %x, 0
+ %cond = select i1 %tobool, i32 %cast2, i32 16
+ ret i32 %cond
+}
+
+define i64 @test2c(i16 %x) {
+; CHECK-LABEL: @test2c(
+; CHECK: [[VAR1:%[a-zA-Z0-9]+]] = tail call i16 @llvm.cttz.i16(i16 %x, i1 false)
+; CHECK-NEXT: [[VAR2:%[a-zA-Z0-9]+]] = zext i16 [[VAR1]] to i64
+; CHECK-NEXT: ret i64 [[VAR2]]
+entry:
+ %0 = tail call i16 @llvm.cttz.i16(i16 %x, i1 true)
+ %conv = zext i16 %0 to i64
+ %tobool = icmp ne i16 %x, 0
+ %cond = select i1 %tobool, i64 %conv, i64 16
+ ret i64 %cond
+}
+
+define i64 @test3c(i32 %x) {
+; CHECK-LABEL: @test3c(
+; CHECK: [[VAR1:%[a-zA-Z0-9]+]] = tail call i32 @llvm.cttz.i32(i32 %x, i1 false)
+; CHECK-NEXT: [[VAR2:%[a-zA-Z0-9]+]] = zext i32 [[VAR1]] to i64
+; CHECK-NEXT: ret i64 [[VAR2]]
+entry:
+ %0 = tail call i32 @llvm.cttz.i32(i32 %x, i1 true)
+ %conv = zext i32 %0 to i64
+ %tobool = icmp ne i32 %x, 0
+ %cond = select i1 %tobool, i64 %conv, i64 32
+ ret i64 %cond
+}
+
+define i32 @test4c(i16 %x) {
+; CHECK-LABEL: @test4c(
+; CHECK: [[VAR1:%[a-zA-Z0-9]+]] = tail call i16 @llvm.ctlz.i16(i16 %x, i1 false)
+; CHECK-NEXT: [[VAR2:%[a-zA-Z0-9]+]] = zext i16 [[VAR1]] to i32
+; CHECK-NEXT: ret i32 [[VAR2]]
+entry:
+ %0 = tail call i16 @llvm.ctlz.i16(i16 %x, i1 true)
+ %cast = zext i16 %0 to i32
+ %tobool = icmp ne i16 %x, 0
+ %cond = select i1 %tobool, i32 %cast, i32 16
+ ret i32 %cond
+}
+
+define i64 @test5c(i16 %x) {
+; CHECK-LABEL: @test5c(
+; CHECK: [[VAR1:%[a-zA-Z0-9]+]] = tail call i16 @llvm.ctlz.i16(i16 %x, i1 false)
+; CHECK-NEXT: [[VAR2:%[a-zA-Z0-9]+]] = zext i16 [[VAR1]] to i64
+; CHECK-NEXT: ret i64 [[VAR2]]
+entry:
+ %0 = tail call i16 @llvm.ctlz.i16(i16 %x, i1 true)
+ %cast = zext i16 %0 to i64
+ %tobool = icmp ne i16 %x, 0
+ %cond = select i1 %tobool, i64 %cast, i64 16
+ ret i64 %cond
+}
+
+define i64 @test6c(i32 %x) {
+; CHECK-LABEL: @test6c(
+; CHECK: [[VAR1:%[a-zA-Z0-9]+]] = tail call i32 @llvm.ctlz.i32(i32 %x, i1 false)
+; CHECK-NEXT: [[VAR2:%[a-zA-Z0-9]+]] = zext i32 [[VAR1]] to i64
+; CHECK-NEXT: ret i64 [[VAR2]]
+entry:
+ %0 = tail call i32 @llvm.ctlz.i32(i32 %x, i1 true)
+ %cast = zext i32 %0 to i64
+ %tobool = icmp ne i32 %x, 0
+ %cond = select i1 %tobool, i64 %cast, i64 32
+ ret i64 %cond
+}
+
+define i16 @test1d(i64 %x) {
+; CHECK-LABEL: @test1d(
+; CHECK: [[VAR1:%[a-zA-Z0-9]+]] = tail call i64 @llvm.cttz.i64(i64 %x, i1 false)
+; CHECK-NEXT: [[VAR2:%[a-zA-Z0-9]+]] = trunc i64 [[VAR1]] to i16
+; CHECK-NEXT: ret i16 [[VAR2]]
+entry:
+ %0 = tail call i64 @llvm.cttz.i64(i64 %x, i1 true)
+ %conv = trunc i64 %0 to i16
+ %tobool = icmp ne i64 %x, 0
+ %cond = select i1 %tobool, i16 %conv, i16 64
+ ret i16 %cond
+}
+
+define i32 @test2d(i64 %x) {
+; CHECK-LABEL: @test2d(
+; CHECK: [[VAR1:%[a-zA-Z0-9]+]] = tail call i64 @llvm.cttz.i64(i64 %x, i1 false)
+; CHECK-NEXT: [[VAR2:%[a-zA-Z0-9]+]] = trunc i64 [[VAR1]] to i32
+; CHECK-NEXT: ret i32 [[VAR2]]
+entry:
+ %0 = tail call i64 @llvm.cttz.i64(i64 %x, i1 true)
+ %cast = trunc i64 %0 to i32
+ %tobool = icmp ne i64 %x, 0
+ %cond = select i1 %tobool, i32 %cast, i32 64
+ ret i32 %cond
+}
+
+define i16 @test3d(i32 %x) {
+; CHECK-LABEL: @test3d(
+; CHECK: [[VAR1:%[a-zA-Z0-9]+]] = tail call i32 @llvm.cttz.i32(i32 %x, i1 false)
+; CHECK-NEXT: [[VAR2:%[a-zA-Z0-9]+]] = trunc i32 [[VAR1]] to i16
+; CHECK-NEXT: ret i16 [[VAR2]]
+entry:
+ %0 = tail call i32 @llvm.cttz.i32(i32 %x, i1 true)
+ %cast = trunc i32 %0 to i16
+ %tobool = icmp ne i32 %x, 0
+ %cond = select i1 %tobool, i16 %cast, i16 32
+ ret i16 %cond
+}
+
+define i16 @test4d(i64 %x) {
+; CHECK-LABEL: @test4d(
+; CHECK: [[VAR1:%[a-zA-Z0-9]+]] = tail call i64 @llvm.ctlz.i64(i64 %x, i1 false)
+; CHECK-NEXT: [[VAR2:%[a-zA-Z0-9]+]] = trunc i64 [[VAR1]] to i16
+; CHECK-NEXT: ret i16 [[VAR2]]
+entry:
+ %0 = tail call i64 @llvm.ctlz.i64(i64 %x, i1 true)
+ %cast = trunc i64 %0 to i16
+ %tobool = icmp ne i64 %x, 0
+ %cond = select i1 %tobool, i16 %cast, i16 64
+ ret i16 %cond
+}
+
+define i32 @test5d(i64 %x) {
+; CHECK-LABEL: @test5d(
+; CHECK: [[VAR1:%[a-zA-Z0-9]+]] = tail call i64 @llvm.ctlz.i64(i64 %x, i1 false)
+; CHECK-NEXT: [[VAR2:%[a-zA-Z0-9]+]] = trunc i64 [[VAR1]] to i32
+; CHECK-NEXT: ret i32 [[VAR2]]
+entry:
+ %0 = tail call i64 @llvm.ctlz.i64(i64 %x, i1 true)
+ %cast = trunc i64 %0 to i32
+ %tobool = icmp ne i64 %x, 0
+ %cond = select i1 %tobool, i32 %cast, i32 64
+ ret i32 %cond
+}
+
+define i16 @test6d(i32 %x) {
+; CHECK-LABEL: @test6d(
+; CHECK: [[VAR1:%[a-zA-Z0-9]+]] = tail call i32 @llvm.ctlz.i32(i32 %x, i1 false)
+; CHECK-NEXT: [[VAR2:%[a-zA-Z0-9]+]] = trunc i32 [[VAR1]] to i16
+; CHECK-NEXT: ret i16 [[VAR2]]
+entry:
+ %0 = tail call i32 @llvm.ctlz.i32(i32 %x, i1 true)
+ %cast = trunc i32 %0 to i16
+ %tobool = icmp ne i32 %x, 0
+ %cond = select i1 %tobool, i16 %cast, i16 32
+ ret i16 %cond
+}
+
+define i64 @select_bug1(i32 %x) {
+; CHECK-LABEL: @select_bug1(
+; CHECK: [[VAR1:%[a-zA-Z0-9]+]] = tail call i32 @llvm.cttz.i32(i32 %x, i1 false)
+; CHECK-NEXT: [[VAR2:%[a-zA-Z0-9]+]] = zext i32 [[VAR1]] to i64
+; CHECK-NEXT: ret i64 [[VAR2]]
+entry:
+ %0 = tail call i32 @llvm.cttz.i32(i32 %x, i1 false)
+ %conv = zext i32 %0 to i64
+ %tobool = icmp ne i32 %x, 0
+ %cond = select i1 %tobool, i64 %conv, i64 32
+ ret i64 %cond
+}
+
+define i16 @select_bug2(i32 %x) {
+; CHECK-LABEL: @select_bug2(
+; CHECK: [[VAR1:%[a-zA-Z0-9]+]] = tail call i32 @llvm.cttz.i32(i32 %x, i1 false)
+; CHECK-NEXT: [[VAR2:%[a-zA-Z0-9]+]] = trunc i32 [[VAR1]] to i16
+; CHECK-NEXT: ret i16 [[VAR2]]
+entry:
+ %0 = tail call i32 @llvm.cttz.i32(i32 %x, i1 false)
+ %conv = trunc i32 %0 to i16
+ %tobool = icmp ne i32 %x, 0
+ %cond = select i1 %tobool, i16 %conv, i16 32
+ ret i16 %cond
+}
+
+
+declare i16 @llvm.ctlz.i16(i16, i1)
+declare i32 @llvm.ctlz.i32(i32, i1)
+declare i64 @llvm.ctlz.i64(i64, i1)
+declare i16 @llvm.cttz.i16(i16, i1)
+declare i32 @llvm.cttz.i32(i32, i1)
+declare i64 @llvm.cttz.i64(i64, i1)
diff --git a/test/Transforms/InstCombine/select-crash-noverify.ll b/test/Transforms/InstCombine/select-crash-noverify.ll
new file mode 100644
index 0000000000000..4a366aa8fb834
--- /dev/null
+++ b/test/Transforms/InstCombine/select-crash-noverify.ll
@@ -0,0 +1,19 @@
+; RUN: opt < %s -disable-verify -instcombine -S | opt -S | FileCheck %s
+; Formerly crashed, PR8490.
+
+; CHECK-LABEL: @test3(
+define i32 @test3(i1 %bool, i32 %a) {
+entry:
+ %cond = or i1 %bool, true
+ br i1 %cond, label %return, label %xpto
+
+; technically reachable, but this malformed IR may appear as a result of constant propagation
+xpto:
+ %select = select i1 %bool, i32 %a, i32 %select
+ %select2 = select i1 %bool, i32 %select2, i32 %a
+ %sum = add i32 %select, %select2
+ ret i32 %sum
+
+return:
+ ret i32 7
+}
diff --git a/test/Transforms/InstCombine/select-crash.ll b/test/Transforms/InstCombine/select-crash.ll
index 77446cd8ba023..991635b63aa88 100644
--- a/test/Transforms/InstCombine/select-crash.ll
+++ b/test/Transforms/InstCombine/select-crash.ll
@@ -30,20 +30,3 @@ define <4 x float> @foo(i1 %b, <4 x float> %x, <4 x float> %y, <4 x float> %z) {
%sel = select i1 %b, <4 x float> %a, <4 x float> %sub
ret <4 x float> %sel
}
-
-; CHECK-LABEL: @test3(
-define i32 @test3(i1 %bool, i32 %a) {
-entry:
- %cond = or i1 %bool, true
- br i1 %cond, label %return, label %xpto
-
-; technically reachable, but this malformed IR may appear as a result of constant propagation
-xpto:
- %select = select i1 %bool, i32 %a, i32 %select
- %select2 = select i1 %bool, i32 %select2, i32 %a
- %sum = add i32 %select, %select2
- ret i32 %sum
-
-return:
- ret i32 7
-}
diff --git a/test/Transforms/InstCombine/select-load-call.ll b/test/Transforms/InstCombine/select-load-call.ll
index b63468de53e1c..ad0ef4f85eb27 100644
--- a/test/Transforms/InstCombine/select-load-call.ll
+++ b/test/Transforms/InstCombine/select-load-call.ll
@@ -10,6 +10,6 @@ define i32 @test(i1 %cond, i32 *%P) {
call void @test2() readonly
%P2 = select i1 %cond, i32 *%P, i32* %A
- %V = load i32* %P2
+ %V = load i32, i32* %P2
ret i32 %V
}
diff --git a/test/Transforms/InstCombine/select-select.ll b/test/Transforms/InstCombine/select-select.ll
index 65820acf07b89..768d1c47c2096 100644
--- a/test/Transforms/InstCombine/select-select.ll
+++ b/test/Transforms/InstCombine/select-select.ll
@@ -21,4 +21,14 @@ define float @foo2(float %a) #0 {
ret float %f
}
+; CHECK-LABEL: @foo3
+define <2 x i32> @foo3(<2 x i1> %vec_bool, i1 %bool, <2 x i32> %V) {
+; CHECK: %[[sel0:.*]] = select <2 x i1> %vec_bool, <2 x i32> zeroinitializer, <2 x i32> %V
+; CHECK: %[[sel1:.*]] = select i1 %bool, <2 x i32> %[[sel0]], <2 x i32> %V
+; CHECK: ret <2 x i32> %[[sel1]]
+ %sel0 = select <2 x i1> %vec_bool, <2 x i32> zeroinitializer, <2 x i32> %V
+ %sel1 = select i1 %bool, <2 x i32> %sel0, <2 x i32> %V
+ ret <2 x i32> %sel1
+}
+
attributes #0 = { nounwind readnone ssp uwtable }
diff --git a/test/Transforms/InstCombine/select.ll b/test/Transforms/InstCombine/select.ll
index 054f00a0de496..e4bc96cff1764 100644
--- a/test/Transforms/InstCombine/select.ll
+++ b/test/Transforms/InstCombine/select.ll
@@ -301,30 +301,30 @@ define i32 @test15j(i32 %X) {
define i32 @test16(i1 %C, i32* %P) {
%P2 = select i1 %C, i32* %P, i32* null
- %V = load i32* %P2
+ %V = load i32, i32* %P2
ret i32 %V
; CHECK-LABEL: @test16(
-; CHECK-NEXT: %V = load i32* %P
+; CHECK-NEXT: %V = load i32, i32* %P
; CHECK: ret i32 %V
}
;; It may be legal to load from a null address in a non-zero address space
define i32 @test16_neg(i1 %C, i32 addrspace(1)* %P) {
%P2 = select i1 %C, i32 addrspace(1)* %P, i32 addrspace(1)* null
- %V = load i32 addrspace(1)* %P2
+ %V = load i32, i32 addrspace(1)* %P2
ret i32 %V
; CHECK-LABEL: @test16_neg
; CHECK-NEXT: %P2 = select i1 %C, i32 addrspace(1)* %P, i32 addrspace(1)* null
-; CHECK-NEXT: %V = load i32 addrspace(1)* %P2
+; CHECK-NEXT: %V = load i32, i32 addrspace(1)* %P2
; CHECK: ret i32 %V
}
define i32 @test16_neg2(i1 %C, i32 addrspace(1)* %P) {
%P2 = select i1 %C, i32 addrspace(1)* null, i32 addrspace(1)* %P
- %V = load i32 addrspace(1)* %P2
+ %V = load i32, i32 addrspace(1)* %P2
ret i32 %V
; CHECK-LABEL: @test16_neg2
; CHECK-NEXT: %P2 = select i1 %C, i32 addrspace(1)* null, i32 addrspace(1)* %P
-; CHECK-NEXT: %V = load i32 addrspace(1)* %P2
+; CHECK-NEXT: %V = load i32, i32 addrspace(1)* %P2
; CHECK: ret i32 %V
}
@@ -423,11 +423,11 @@ jump:
%c = or i1 false, false
br label %ret
ret:
- %a = phi i1 [true, %jump], [%c, %entry]
- %b = select i1 %a, i32 10, i32 20
+ %a = phi i1 [true, %entry], [%c, %jump]
+ %b = select i1 %a, i32 20, i32 10
ret i32 %b
; CHECK-LABEL: @test26(
-; CHECK: %a = phi i32 [ 10, %jump ], [ 20, %entry ]
+; CHECK: %a = phi i32 [ 20, %entry ], [ 10, %jump ]
; CHECK-NEXT: ret i32 %a
}
@@ -813,7 +813,7 @@ define i32 @test59(i32 %x, i32 %y) nounwind {
define i1 @test60(i32 %x, i1* %y) nounwind {
%cmp = icmp eq i32 %x, 0
- %load = load i1* %y, align 1
+ %load = load i1, i1* %y, align 1
%cmp1 = icmp slt i32 %x, 1
%sel = select i1 %cmp, i1 %load, i1 %cmp1
ret i1 %sel
@@ -823,7 +823,7 @@ define i1 @test60(i32 %x, i1* %y) nounwind {
@glbl = constant i32 10
define i32 @test61(i32* %ptr) {
- %A = load i32* %ptr
+ %A = load i32, i32* %ptr
%B = icmp eq i32* %ptr, @glbl
%C = select i1 %B, i32 %A, i32 10
ret i32 %C
@@ -1249,11 +1249,11 @@ define i32 @test76(i1 %flag, i32* %x) {
; CHECK-LABEL: @test76(
; CHECK: store i32 0, i32* %x
; CHECK: %[[P:.*]] = select i1 %flag, i32* @under_aligned, i32* %x
-; CHECK: load i32* %[[P]]
+; CHECK: load i32, i32* %[[P]]
store i32 0, i32* %x
%p = select i1 %flag, i32* @under_aligned, i32* %x
- %v = load i32* %p
+ %v = load i32, i32* %p
ret i32 %v
}
@@ -1268,13 +1268,13 @@ define i32 @test77(i1 %flag, i32* %x) {
; CHECK: call void @scribble_on_i32(i32* %[[A]])
; CHECK: store i32 0, i32* %x
; CHECK: %[[P:.*]] = select i1 %flag, i32* %[[A]], i32* %x
-; CHECK: load i32* %[[P]]
+; CHECK: load i32, i32* %[[P]]
%under_aligned = alloca i32, align 1
call void @scribble_on_i32(i32* %under_aligned)
store i32 0, i32* %x
%p = select i1 %flag, i32* %under_aligned, i32* %x
- %v = load i32* %p
+ %v = load i32, i32* %p
ret i32 %v
}
@@ -1282,8 +1282,8 @@ define i32 @test78(i1 %flag, i32* %x, i32* %y, i32* %z) {
; Test that we can speculate the loads around the select even when we can't
; fold the load completely away.
; CHECK-LABEL: @test78(
-; CHECK: %[[V1:.*]] = load i32* %x
-; CHECK-NEXT: %[[V2:.*]] = load i32* %y
+; CHECK: %[[V1:.*]] = load i32, i32* %x
+; CHECK-NEXT: %[[V2:.*]] = load i32, i32* %y
; CHECK-NEXT: %[[S:.*]] = select i1 %flag, i32 %[[V1]], i32 %[[V2]]
; CHECK-NEXT: ret i32 %[[S]]
entry:
@@ -1292,7 +1292,7 @@ entry:
; Block forwarding by storing to %z which could alias either %x or %y.
store i32 42, i32* %z
%p = select i1 %flag, i32* %x, i32* %y
- %v = load i32* %p
+ %v = load i32, i32* %p
ret i32 %v
}
@@ -1300,8 +1300,8 @@ define float @test79(i1 %flag, float* %x, i32* %y, i32* %z) {
; Test that we can speculate the loads around the select even when we can't
; fold the load completely away.
; CHECK-LABEL: @test79(
-; CHECK: %[[V1:.*]] = load float* %x
-; CHECK-NEXT: %[[V2:.*]] = load float* %y
+; CHECK: %[[V1:.*]] = load float, float* %x
+; CHECK-NEXT: %[[V2:.*]] = load float, float* %y
; CHECK-NEXT: %[[S:.*]] = select i1 %flag, float %[[V1]], float %[[V2]]
; CHECK-NEXT: ret float %[[S]]
entry:
@@ -1312,7 +1312,7 @@ entry:
; Block forwarding by storing to %z which could alias either %x or %y.
store i32 42, i32* %z
%p = select i1 %flag, float* %x, float* %y1
- %v = load float* %p
+ %v = load float, float* %p
ret float %v
}
@@ -1322,7 +1322,7 @@ define i32 @test80(i1 %flag) {
; CHECK-LABEL: @test80(
; CHECK: %[[X:.*]] = alloca i32
; CHECK-NEXT: %[[Y:.*]] = alloca i32
-; CHECK: %[[V:.*]] = load i32* %[[X]]
+; CHECK: %[[V:.*]] = load i32, i32* %[[X]]
; CHECK-NEXT: store i32 %[[V]], i32* %[[Y]]
; CHECK-NEXT: ret i32 %[[V]]
entry:
@@ -1330,10 +1330,10 @@ entry:
%y = alloca i32
call void @scribble_on_i32(i32* %x)
call void @scribble_on_i32(i32* %y)
- %tmp = load i32* %x
+ %tmp = load i32, i32* %x
store i32 %tmp, i32* %y
%p = select i1 %flag, i32* %x, i32* %y
- %v = load i32* %p
+ %v = load i32, i32* %p
ret i32 %v
}
@@ -1343,7 +1343,7 @@ define float @test81(i1 %flag) {
; CHECK-LABEL: @test81(
; CHECK: %[[X:.*]] = alloca i32
; CHECK-NEXT: %[[Y:.*]] = alloca i32
-; CHECK: %[[V:.*]] = load i32* %[[X]]
+; CHECK: %[[V:.*]] = load i32, i32* %[[X]]
; CHECK-NEXT: store i32 %[[V]], i32* %[[Y]]
; CHECK-NEXT: %[[C:.*]] = bitcast i32 %[[V]] to float
; CHECK-NEXT: ret float %[[C]]
@@ -1354,10 +1354,10 @@ entry:
%y1 = bitcast i32* %y to float*
call void @scribble_on_i32(i32* %x1)
call void @scribble_on_i32(i32* %y)
- %tmp = load i32* %x1
+ %tmp = load i32, i32* %x1
store i32 %tmp, i32* %y
%p = select i1 %flag, float* %x, float* %y1
- %v = load float* %p
+ %v = load float, float* %p
ret float %v
}
@@ -1369,7 +1369,7 @@ define i32 @test82(i1 %flag) {
; CHECK-NEXT: %[[Y:.*]] = alloca i32
; CHECK-NEXT: %[[X1:.*]] = bitcast float* %[[X]] to i32*
; CHECK-NEXT: %[[Y1:.*]] = bitcast i32* %[[Y]] to float*
-; CHECK: %[[V:.*]] = load float* %[[X]]
+; CHECK: %[[V:.*]] = load float, float* %[[X]]
; CHECK-NEXT: store float %[[V]], float* %[[Y1]]
; CHECK-NEXT: %[[C:.*]] = bitcast float %[[V]] to i32
; CHECK-NEXT: ret i32 %[[C]]
@@ -1380,10 +1380,10 @@ entry:
%y1 = bitcast i32* %y to float*
call void @scribble_on_i32(i32* %x1)
call void @scribble_on_i32(i32* %y)
- %tmp = load float* %x
+ %tmp = load float, float* %x
store float %tmp, float* %y1
%p = select i1 %flag, i32* %x1, i32* %y
- %v = load i32* %p
+ %v = load i32, i32* %p
ret i32 %v
}
@@ -1398,7 +1398,7 @@ define i8* @test83(i1 %flag) {
; CHECK-NEXT: %[[Y:.*]] = alloca i8*
; CHECK-DAG: %[[X2:.*]] = bitcast i8** %[[X]] to i64*
; CHECK-DAG: %[[Y2:.*]] = bitcast i8** %[[Y]] to i64*
-; CHECK: %[[V:.*]] = load i64* %[[X2]]
+; CHECK: %[[V:.*]] = load i64, i64* %[[X2]]
; CHECK-NEXT: store i64 %[[V]], i64* %[[Y2]]
; CHECK-NEXT: %[[C:.*]] = inttoptr i64 %[[V]] to i8*
; CHECK-NEXT: ret i8* %[[S]]
@@ -1409,10 +1409,10 @@ entry:
%y1 = bitcast i64* %y to i8**
call void @scribble_on_i64(i64* %x1)
call void @scribble_on_i64(i64* %y)
- %tmp = load i64* %x1
+ %tmp = load i64, i64* %x1
store i64 %tmp, i64* %y
%p = select i1 %flag, i8** %x, i8** %y1
- %v = load i8** %p
+ %v = load i8*, i8** %p
ret i8* %v
}
@@ -1422,7 +1422,7 @@ define i64 @test84(i1 %flag) {
; CHECK-LABEL: @test84(
; CHECK: %[[X:.*]] = alloca i8*
; CHECK-NEXT: %[[Y:.*]] = alloca i8*
-; CHECK: %[[V:.*]] = load i8** %[[X]]
+; CHECK: %[[V:.*]] = load i8*, i8** %[[X]]
; CHECK-NEXT: store i8* %[[V]], i8** %[[Y]]
; CHECK-NEXT: %[[C:.*]] = ptrtoint i8* %[[V]] to i64
; CHECK-NEXT: ret i64 %[[C]]
@@ -1433,10 +1433,10 @@ entry:
%y1 = bitcast i64* %y to i8**
call void @scribble_on_i64(i64* %x1)
call void @scribble_on_i64(i64* %y)
- %tmp = load i8** %x
+ %tmp = load i8*, i8** %x
store i8* %tmp, i8** %y1
%p = select i1 %flag, i64* %x1, i64* %y
- %v = load i64* %p
+ %v = load i64, i64* %p
ret i64 %v
}
@@ -1445,10 +1445,10 @@ define i8* @test85(i1 %flag) {
; pointer doesn't load all of the stored integer bits. We could fix this, but it
; would require endianness checks and other nastiness.
; CHECK-LABEL: @test85(
-; CHECK: %[[T:.*]] = load i128*
+; CHECK: %[[T:.*]] = load i128, i128*
; CHECK-NEXT: store i128 %[[T]], i128*
-; CHECK-NEXT: %[[X:.*]] = load i8**
-; CHECK-NEXT: %[[Y:.*]] = load i8**
+; CHECK-NEXT: %[[X:.*]] = load i8*, i8**
+; CHECK-NEXT: %[[Y:.*]] = load i8*, i8**
; CHECK-NEXT: %[[V:.*]] = select i1 %flag, i8* %[[X]], i8* %[[Y]]
; CHECK-NEXT: ret i8* %[[V]]
entry:
@@ -1459,10 +1459,10 @@ entry:
%y1 = bitcast i128* %y to i8**
call void @scribble_on_i128(i128* %x2)
call void @scribble_on_i128(i128* %y)
- %tmp = load i128* %x2
+ %tmp = load i128, i128* %x2
store i128 %tmp, i128* %y
%p = select i1 %flag, i8** %x1, i8** %y1
- %v = load i8** %p
+ %v = load i8*, i8** %p
ret i8* %v
}
@@ -1472,10 +1472,10 @@ define i128 @test86(i1 %flag) {
; the bits of the integer.
;
; CHECK-LABEL: @test86(
-; CHECK: %[[T:.*]] = load i8**
+; CHECK: %[[T:.*]] = load i8*, i8**
; CHECK-NEXT: store i8* %[[T]], i8**
-; CHECK-NEXT: %[[X:.*]] = load i128*
-; CHECK-NEXT: %[[Y:.*]] = load i128*
+; CHECK-NEXT: %[[X:.*]] = load i128, i128*
+; CHECK-NEXT: %[[Y:.*]] = load i128, i128*
; CHECK-NEXT: %[[V:.*]] = select i1 %flag, i128 %[[X]], i128 %[[Y]]
; CHECK-NEXT: ret i128 %[[V]]
entry:
@@ -1486,9 +1486,49 @@ entry:
%y1 = bitcast i128* %y to i8**
call void @scribble_on_i128(i128* %x2)
call void @scribble_on_i128(i128* %y)
- %tmp = load i8** %x1
+ %tmp = load i8*, i8** %x1
store i8* %tmp, i8** %y1
%p = select i1 %flag, i128* %x2, i128* %y
- %v = load i128* %p
+ %v = load i128, i128* %p
ret i128 %v
}
+
+define i32 @test_select_select0(i32 %a, i32 %r0, i32 %r1, i32 %v1, i32 %v2) {
+ ; CHECK-LABEL: @test_select_select0(
+ ; CHECK: %[[C0:.*]] = icmp sge i32 %a, %v1
+ ; CHECK-NEXT: %[[C1:.*]] = icmp slt i32 %a, %v2
+ ; CHECK-NEXT: %[[C:.*]] = and i1 %[[C1]], %[[C0]]
+ ; CHECK-NEXT: %[[SEL:.*]] = select i1 %[[C]], i32 %r0, i32 %r1
+ ; CHECK-NEXT: ret i32 %[[SEL]]
+ %c0 = icmp sge i32 %a, %v1
+ %s0 = select i1 %c0, i32 %r0, i32 %r1
+ %c1 = icmp slt i32 %a, %v2
+ %s1 = select i1 %c1, i32 %s0, i32 %r1
+ ret i32 %s1
+}
+
+define i32 @test_select_select1(i32 %a, i32 %r0, i32 %r1, i32 %v1, i32 %v2) {
+ ; CHECK-LABEL: @test_select_select1(
+ ; CHECK: %[[C0:.*]] = icmp sge i32 %a, %v1
+ ; CHECK-NEXT: %[[C1:.*]] = icmp slt i32 %a, %v2
+ ; CHECK-NEXT: %[[C:.*]] = or i1 %[[C1]], %[[C0]]
+ ; CHECK-NEXT: %[[SEL:.*]] = select i1 %[[C]], i32 %r0, i32 %r1
+ ; CHECK-NEXT: ret i32 %[[SEL]]
+ %c0 = icmp sge i32 %a, %v1
+ %s0 = select i1 %c0, i32 %r0, i32 %r1
+ %c1 = icmp slt i32 %a, %v2
+ %s1 = select i1 %c1, i32 %r0, i32 %s0
+ ret i32 %s1
+}
+
+define i32 @test_max_of_min(i32 %a) {
+; MAX(MIN(%a, -1), -1) == -1
+; CHECK-LABEL: @test_max_of_min(
+; CHECK: ret i32 -1
+ %not_a = xor i32 %a, -1
+ %c0 = icmp sgt i32 %a, 0
+ %s0 = select i1 %c0, i32 %not_a, i32 -1
+ %c1 = icmp sgt i32 %s0, -1
+ %s1 = select i1 %c1, i32 %s0, i32 -1
+ ret i32 %s1
+}
diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll
index 0b5b5deb68c57..79c2ae28105e4 100644
--- a/test/Transforms/InstCombine/shift.ll
+++ b/test/Transforms/InstCombine/shift.ll
@@ -575,7 +575,7 @@ entry:
; CHECK: %0 = shl i8 %tmp4, 2
; CHECK: %tmp54 = and i8 %0, 16
%tmp55 = xor i8 %tmp54, %tmp51
-; CHECK: ret i8 %tmp551
+; CHECK: ret i8 %tmp55.1
ret i8 %tmp55
}
@@ -743,7 +743,7 @@ define i32 @test57(i32 %x) {
%or = or i32 %shl, 7
ret i32 %or
; CHECK-LABEL: @test57(
-; CHECK: %shl = shl i32 %shr1, 4
+; CHECK: %shl = shl i32 %shr.1, 4
}
diff --git a/test/Transforms/InstCombine/shufflemask-undef.ll b/test/Transforms/InstCombine/shufflemask-undef.ll
index aa6baa989bfc1..10509a92941ba 100644
--- a/test/Transforms/InstCombine/shufflemask-undef.ll
+++ b/test/Transforms/InstCombine/shufflemask-undef.ll
@@ -69,8 +69,8 @@ target triple = "i386-apple-darwin9"
define i32 @foo(%struct.State* %dst, <4 x float>* %prgrm, <4 x float>** %buffs, %struct._VMConstants* %cnstn, %struct.PPStreamToken* %pstrm, %struct.PluginBufferData* %gpctx, %struct.VMTextures* %txtrs, %struct.VMGPStack* %gpstk) nounwind {
bb266.i:
- getelementptr <4 x float>* null, i32 11 ; <<4 x float>*>:0 [#uses=1]
- load <4 x float>* %0, align 16 ; <<4 x float>>:1 [#uses=1]
+ getelementptr <4 x float>, <4 x float>* null, i32 11 ; <<4 x float>*>:0 [#uses=1]
+ load <4 x float>, <4 x float>* %0, align 16 ; <<4 x float>>:1 [#uses=1]
shufflevector <4 x float> %1, <4 x float> undef, <4 x i32> < i32 0, i32 1, i32 1, i32 1 > ; <<4 x float>>:2 [#uses=1]
shufflevector <4 x float> %2, <4 x float> undef, <4 x i32> < i32 0, i32 4, i32 1, i32 5 > ; <<4 x float>>:3 [#uses=1]
shufflevector <4 x float> undef, <4 x float> undef, <4 x i32> < i32 0, i32 4, i32 1, i32 5 > ; <<4 x float>>:4 [#uses=1]
diff --git a/test/Transforms/InstCombine/signed-comparison.ll b/test/Transforms/InstCombine/signed-comparison.ll
index ab0e7e7ff9fef..922f4dcb2d420 100644
--- a/test/Transforms/InstCombine/signed-comparison.ll
+++ b/test/Transforms/InstCombine/signed-comparison.ll
@@ -12,8 +12,8 @@ entry:
bb:
%indvar = phi i64 [ 0, %entry ], [ %indvar.next, %bb ]
%t0 = and i64 %indvar, 65535
- %t1 = getelementptr double* %p, i64 %t0
- %t2 = load double* %t1, align 8
+ %t1 = getelementptr double, double* %p, i64 %t0
+ %t2 = load double, double* %t1, align 8
%t3 = fmul double %t2, 2.2
store double %t3, double* %t1, align 8
%i.04 = trunc i64 %indvar to i16
diff --git a/test/Transforms/InstCombine/simplify-demanded-bits-pointer.ll b/test/Transforms/InstCombine/simplify-demanded-bits-pointer.ll
index 6d2193fe448ae..db8f17917d1e1 100644
--- a/test/Transforms/InstCombine/simplify-demanded-bits-pointer.ll
+++ b/test/Transforms/InstCombine/simplify-demanded-bits-pointer.ll
@@ -29,7 +29,7 @@ bb95: ; preds = %bb88
unreachable
bb107: ; preds = %bb88
- %0 = load i16* undef, align 8 ; <i16> [#uses=1]
+ %0 = load i16, i16* undef, align 8 ; <i16> [#uses=1]
%1 = icmp eq i16 %0, 38 ; <i1> [#uses=1]
%src_eqv_here.0 = select i1 %1, %struct.rtx_def* null, %struct.rtx_def* null ; <%struct.rtx_def*> [#uses=1]
br i1 undef, label %bb127, label %bb125
diff --git a/test/Transforms/InstCombine/simplify-libcalls.ll b/test/Transforms/InstCombine/simplify-libcalls.ll
index fae3e6e3d9bea..7cc6710613791 100644
--- a/test/Transforms/InstCombine/simplify-libcalls.ll
+++ b/test/Transforms/InstCombine/simplify-libcalls.ll
@@ -1,11 +1,12 @@
; RUN: opt -S < %s -instcombine | 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"
@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]
+ call i32 (i8*, i8*, ...) @sprintf( i8* %P, i8* getelementptr ([3 x i8], [3 x i8]* @G, i32 0, i32 0), i32* %X ) ; <i32>:1 [#uses=0]
ret void
}
@@ -15,26 +16,26 @@ define void @foo(i8* %P, i32* %X) {
@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]
+ %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8], [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)
+; CHECK: ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str, i32 0, i32 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]
+ %tmp3 = tail call i8* @strchr( i8* getelementptr ([8 x i8], [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)
+; CHECK: ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str1, i32 0, i32 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]
+ %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8], [5 x i8]* @str2, i32 0, i32 1), i32 80 ) ; <i8*> [#uses=1]
ret i8* %tmp3
; CHECK-LABEL: @test3(
@@ -47,8 +48,8 @@ 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]
+ %tmp4 = load i8*, i8** %start_addr, align 4 ; <i8*> [#uses=1]
+ %tmp5 = call i32 @memcmp( i8* %tmp4, i8* getelementptr ([5 x i8], [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
@@ -80,7 +81,7 @@ entry:
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]
+ %cond392 = select i1 undef, i8* getelementptr ([2 x i8], [2 x i8]* @.str13, i32 0, i32 0), i8* getelementptr ([2 x i8], [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
}
@@ -114,11 +115,11 @@ for.end: ; preds = %for.cond20
@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
+ %h_p = getelementptr [2 x i8], [2 x i8]* @h, i32 0, i32 0
+ %hel_p = getelementptr [4 x i8], [4 x i8]* @hel, i32 0, i32 0
+ %hello_u_p = getelementptr [8 x i8], [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
+ %target_p = getelementptr [1024 x i8], [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)
diff --git a/test/Transforms/InstCombine/sincospi.ll b/test/Transforms/InstCombine/sincospi.ll
index 739827f1962ad..f49fb35cb76aa 100644
--- a/test/Transforms/InstCombine/sincospi.ll
+++ b/test/Transforms/InstCombine/sincospi.ll
@@ -18,17 +18,17 @@ declare double @__cospi(double %x) #0
@var64 = global double 0.0
define float @test_instbased_f32() {
- %val = load float* @var32
+ %val = load float, 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: [[VAL:%[a-z0-9]+]] = load float, float* @var32
; CHECK-FLOAT-IN-VEC: [[SINCOS:%[a-z0-9]+]] = call <2 x float> @__sincospif_stret(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: [[VAL:%[a-z0-9]+]] = load float, float* @var32
; CHECK: [[SINCOS:%[a-z0-9]+]] = call { float, float } @__sincospif_stret(float [[VAL]])
; CHECK: extractvalue { float, float } [[SINCOS]], 0
; CHECK: extractvalue { float, float } [[SINCOS]], 1
@@ -55,17 +55,17 @@ define float @test_constant_f32() {
}
define double @test_instbased_f64() {
- %val = load double* @var64
+ %val = load double, 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: [[VAL:%[a-z0-9]+]] = load double, 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: [[VAL:%[a-z0-9]+]] = load double, 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
diff --git a/test/Transforms/InstCombine/sitofp.ll b/test/Transforms/InstCombine/sitofp.ll
index bd31b89f7879a..8209778388364 100644
--- a/test/Transforms/InstCombine/sitofp.ll
+++ b/test/Transforms/InstCombine/sitofp.ll
@@ -1,28 +1,40 @@
-; RUN: opt < %s -instcombine -S | not grep itofp
+; RUN: opt < %s -instcombine -S | FileCheck %s
+; CHECK-LABEL: test1
+; CHECK: ret i1 true
define i1 @test1(i8 %A) {
%B = sitofp i8 %A to double
%C = fcmp ult double %B, 128.0
- ret i1 %C ; True!
+ ret i1 %C
}
+
+; CHECK-LABEL: test2
+; CHECK: ret i1 true
define i1 @test2(i8 %A) {
%B = sitofp i8 %A to double
%C = fcmp ugt double %B, -128.1
- ret i1 %C ; True!
+ ret i1 %C
}
+; CHECK-LABEL: test3
+; CHECK: ret i1 true
define i1 @test3(i8 %A) {
%B = sitofp i8 %A to double
%C = fcmp ule double %B, 127.0
- ret i1 %C ; true!
+ ret i1 %C
}
+; CHECK-LABEL: test4
+; CHECK: icmp ne i8 %A, 127
+; CHECK-NEXT: ret i1
define i1 @test4(i8 %A) {
%B = sitofp i8 %A to double
%C = fcmp ult double %B, 127.0
- ret i1 %C ; A != 127
+ ret i1 %C
}
+; CHECK-LABEL: test5
+; CHECK: ret i32
define i32 @test5(i32 %A) {
%B = sitofp i32 %A to double
%C = fptosi double %B to i32
@@ -31,25 +43,142 @@ define i32 @test5(i32 %A) {
ret i32 %E
}
+; CHECK-LABEL: test6
+; CHECK: and i32 %A, 39
+; CHECK-NEXT: ret i32
define i32 @test6(i32 %A) {
- %B = and i32 %A, 7 ; <i32> [#uses=1]
- %C = and i32 %A, 32 ; <i32> [#uses=1]
- %D = sitofp i32 %B to double ; <double> [#uses=1]
- %E = sitofp i32 %C to double ; <double> [#uses=1]
- %F = fadd double %D, %E ; <double> [#uses=1]
- %G = fptosi double %F to i32 ; <i32> [#uses=1]
- ret i32 %G
+ %B = and i32 %A, 7
+ %C = and i32 %A, 32
+ %D = sitofp i32 %B to double
+ %E = sitofp i32 %C to double
+ %F = fadd double %D, %E
+ %G = fptosi double %F to i32
+ ret i32 %G
+}
+
+; CHECK-LABEL: test7
+; CHECK: ret i32
+define i32 @test7(i32 %A) nounwind {
+ %B = sitofp i32 %A to double
+ %C = fptoui double %B to i32
+ ret i32 %C
+}
+
+; CHECK-LABEL: test8
+; CHECK: ret i32
+define i32 @test8(i32 %A) nounwind {
+ %B = uitofp i32 %A to double
+ %C = fptosi double %B to i32
+ ret i32 %C
+}
+
+; CHECK-LABEL: test9
+; CHECK: zext i8
+; CHECK-NEXT: ret i32
+define i32 @test9(i8 %A) nounwind {
+ %B = sitofp i8 %A to float
+ %C = fptoui float %B to i32
+ ret i32 %C
+}
+
+; CHECK-LABEL: test10
+; CHECK: sext i8
+; CHECK-NEXT: ret i32
+define i32 @test10(i8 %A) nounwind {
+ %B = sitofp i8 %A to float
+ %C = fptosi float %B to i32
+ ret i32 %C
+}
+
+; If the input value is outside of the range of the output cast, it's
+; undefined behavior, so we can assume it fits.
+; CHECK-LABEL: test11
+; CHECK: trunc
+; CHECK-NEXT: ret i8
+define i8 @test11(i32 %A) nounwind {
+ %B = sitofp i32 %A to float
+ %C = fptosi float %B to i8
+ ret i8 %C
+}
+
+; If the input value is negative, it'll be outside the range of the
+; output cast, and thus undefined behavior.
+; CHECK-LABEL: test12
+; CHECK: zext i8
+; CHECK-NEXT: ret i32
+define i32 @test12(i8 %A) nounwind {
+ %B = sitofp i8 %A to float
+ %C = fptoui float %B to i32
+ ret i32 %C
+}
+
+; This can't fold because the 25-bit input doesn't fit in the mantissa.
+; CHECK-LABEL: test13
+; CHECK: uitofp
+; CHECK-NEXT: fptoui
+define i32 @test13(i25 %A) nounwind {
+ %B = uitofp i25 %A to float
+ %C = fptoui float %B to i32
+ ret i32 %C
+}
+
+; But this one can.
+; CHECK-LABEL: test14
+; CHECK: zext i24
+; CHECK-NEXT: ret i32
+define i32 @test14(i24 %A) nounwind {
+ %B = uitofp i24 %A to float
+ %C = fptoui float %B to i32
+ ret i32 %C
+}
+
+; And this one can too.
+; CHECK-LABEL: test15
+; CHECK: trunc i32
+; CHECK-NEXT: ret i24
+define i24 @test15(i32 %A) nounwind {
+ %B = uitofp i32 %A to float
+ %C = fptoui float %B to i24
+ ret i24 %C
+}
+
+; This can fold because the 25-bit input is signed and we disard the sign bit.
+; CHECK-LABEL: test16
+; CHECK: zext
+define i32 @test16(i25 %A) nounwind {
+ %B = sitofp i25 %A to float
+ %C = fptoui float %B to i32
+ ret i32 %C
+}
+
+; This can't fold because the 26-bit input won't fit the mantissa
+; even after disarding the signed bit.
+; CHECK-LABEL: test17
+; CHECK: sitofp
+; CHECK-NEXT: fptoui
+define i32 @test17(i26 %A) nounwind {
+ %B = sitofp i26 %A to float
+ %C = fptoui float %B to i32
+ ret i32 %C
}
-define i32 @test7(i32 %a) nounwind {
- %b = sitofp i32 %a to double ; <double> [#uses=1]
- %c = fptoui double %b to i32 ; <i32> [#uses=1]
- ret i32 %c
+; This can fold because the 54-bit output is signed and we disard the sign bit.
+; CHECK-LABEL: test18
+; CHECK: trunc
+define i54 @test18(i64 %A) nounwind {
+ %B = sitofp i64 %A to double
+ %C = fptosi double %B to i54
+ ret i54 %C
}
-define i32 @test8(i32 %a) nounwind {
- %b = uitofp i32 %a to double ; <double> [#uses=1]
- %c = fptosi double %b to i32 ; <i32> [#uses=1]
- ret i32 %c
+; This can't fold because the 55-bit output won't fit the mantissa
+; even after disarding the sign bit.
+; CHECK-LABEL: test19
+; CHECK: sitofp
+; CHECK-NEXT: fptosi
+define i55 @test19(i64 %A) nounwind {
+ %B = sitofp i64 %A to double
+ %C = fptosi double %B to i55
+ ret i55 %C
}
diff --git a/test/Transforms/InstCombine/sprintf-1.ll b/test/Transforms/InstCombine/sprintf-1.ll
index afa38f35ae83c..ddf2f2f88e73b 100644
--- a/test/Transforms/InstCombine/sprintf-1.ll
+++ b/test/Transforms/InstCombine/sprintf-1.ll
@@ -20,17 +20,17 @@ declare i32 @sprintf(i8*, i8*, ...)
define void @test_simplify1(i8* %dst) {
; 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)
+ %fmt = getelementptr [13 x i8], [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], [13 x i8]* @hello_world, i32 0, i32 0), i32 13, i32 1, i1 false)
ret void
; CHECK-NEXT: ret void
}
define void @test_simplify2(i8* %dst) {
; CHECK-LABEL: @test_simplify2(
- %fmt = getelementptr [1 x i8]* @null, i32 0, i32 0
- call i32 (i8*, i8*, ...)* @sprintf(i8* %dst, i8* %fmt)
+ %fmt = getelementptr [1 x i8], [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
ret void
; CHECK-NEXT: ret void
@@ -38,8 +38,8 @@ define void @test_simplify2(i8* %dst) {
define void @test_simplify3(i8* %dst) {
; CHECK-LABEL: @test_simplify3(
- %fmt = getelementptr [7 x i8]* @null_hello, i32 0, i32 0
- call i32 (i8*, i8*, ...)* @sprintf(i8* %dst, i8* %fmt)
+ %fmt = getelementptr [7 x i8], [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
ret void
; CHECK-NEXT: ret void
@@ -49,10 +49,10 @@ define void @test_simplify3(i8* %dst) {
define void @test_simplify4(i8* %dst) {
; 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)
+ %fmt = getelementptr [3 x i8], [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
-; CHECK-NEXT: [[NUL:%[a-z0-9]+]] = getelementptr i8* %dst, i32 1
+; CHECK-NEXT: [[NUL:%[a-z0-9]+]] = getelementptr i8, i8* %dst, i32 1
; CHECK-NEXT: store i8 0, i8* [[NUL]], align 1
ret void
; CHECK-NEXT: ret void
@@ -62,8 +62,8 @@ define void @test_simplify4(i8* %dst) {
define void @test_simplify5(i8* %dst, i8* %str) {
; 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)
+ %fmt = getelementptr [3 x i8], [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)
; CHECK-NEXT: [[LENINC:%[a-z0-9]+]] = add i32 [[STRLEN]], 1
; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %str, i32 [[LENINC]], i32 1, i1 false)
@@ -75,26 +75,26 @@ define void @test_simplify5(i8* %dst, i8* %str) {
define void @test_simplify6(i8* %dst) {
; 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-IPRINTF-NEXT: call i32 (i8*, i8*, ...)* @siprintf(i8* %dst, i8* getelementptr inbounds ([3 x i8]* @percent_d, i32 0, i32 0), i32 187)
+ %fmt = getelementptr [3 x i8], [3 x i8]* @percent_d, i32 0, i32 0
+ call i32 (i8*, i8*, ...) @sprintf(i8* %dst, i8* %fmt, i32 187)
+; CHECK-IPRINTF-NEXT: call i32 (i8*, i8*, ...) @siprintf(i8* %dst, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @percent_d, i32 0, i32 0), i32 187)
ret void
; CHECK-IPRINTF-NEXT: ret void
}
define void @test_no_simplify1(i8* %dst) {
; 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-IPRINTF-NEXT: call i32 (i8*, i8*, ...)* @sprintf(i8* %dst, i8* getelementptr inbounds ([3 x i8]* @percent_f, i32 0, i32 0), double 1.870000e+00)
+ %fmt = getelementptr [3 x i8], [3 x i8]* @percent_f, i32 0, i32 0
+ call i32 (i8*, i8*, ...) @sprintf(i8* %dst, i8* %fmt, double 1.87)
+; CHECK-IPRINTF-NEXT: call i32 (i8*, i8*, ...) @sprintf(i8* %dst, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @percent_f, i32 0, i32 0), double 1.870000e+00)
ret void
; CHECK-IPRINTF-NEXT: ret void
}
define void @test_no_simplify2(i8* %dst, i8* %fmt, double %d) {
; 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)
+ 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
; CHECK-NEXT: ret void
}
diff --git a/test/Transforms/InstCombine/sqrt.ll b/test/Transforms/InstCombine/sqrt.ll
index 650b10c6e9669..bf44e4f841ce3 100644
--- a/test/Transforms/InstCombine/sqrt.ll
+++ b/test/Transforms/InstCombine/sqrt.ll
@@ -38,13 +38,13 @@ entry:
; CHECK: sqrt(
; CHECK-NOT: sqrtf(
; CHECK: fptrunc
- %arrayidx13 = getelementptr inbounds float* %v, i64 2
- %tmp14 = load float* %arrayidx13
+ %arrayidx13 = getelementptr inbounds float, float* %v, i64 2
+ %tmp14 = load float, float* %arrayidx13
%mul18 = fmul float %tmp14, %tmp14
%add19 = fadd float undef, %mul18
%conv = fpext float %add19 to double
%call34 = call double @sqrt(double %conv) readnone
- %call36 = call i32 (double)* @foo(double %call34) nounwind
+ %call36 = call i32 (double) @foo(double %call34) nounwind
%conv38 = fptrunc double %call34 to float
ret float %conv38
}
diff --git a/test/Transforms/InstCombine/srem1.ll b/test/Transforms/InstCombine/srem1.ll
index f18690c3fff27..31452d8f208a3 100644
--- a/test/Transforms/InstCombine/srem1.ll
+++ b/test/Transforms/InstCombine/srem1.ll
@@ -5,7 +5,7 @@
define i32 @func_56(i32 %p_58, i32 %p_59, i32 %p_61, i16 signext %p_62) nounwind {
entry:
- %call = call i32 (...)* @rshift_s_s( i32 %p_61, i32 1 ) ; <i32> [#uses=1]
+ %call = call i32 (...) @rshift_s_s( i32 %p_61, i32 1 ) ; <i32> [#uses=1]
%conv = sext i32 %call to i64 ; <i64> [#uses=1]
%or = or i64 -1734012817166602727, %conv ; <i64> [#uses=1]
%rem = srem i64 %or, 1 ; <i64> [#uses=1]
diff --git a/test/Transforms/InstCombine/stack-overalign.ll b/test/Transforms/InstCombine/stack-overalign.ll
index 80c2ee88f340c..a8f086e6cb937 100644
--- a/test/Transforms/InstCombine/stack-overalign.ll
+++ b/test/Transforms/InstCombine/stack-overalign.ll
@@ -18,8 +18,8 @@
define void @foo() nounwind {
entry:
%src = alloca [1024 x i8], align 1
- %src1 = getelementptr [1024 x i8]* %src, i32 0, i32 0
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([1024 x i8]* @dst, i32 0, i32 0), i8* %src1, i32 1024, i32 1, i1 false)
+ %src1 = getelementptr [1024 x i8], [1024 x i8]* %src, i32 0, i32 0
+ call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dst, i32 0, i32 0), i8* %src1, i32 1024, i32 1, i1 false)
call void @frob(i8* %src1) nounwind
ret void
}
diff --git a/test/Transforms/InstCombine/stacksaverestore.ll b/test/Transforms/InstCombine/stacksaverestore.ll
index f5c7a6f9f3f95..de400e91a7518 100644
--- a/test/Transforms/InstCombine/stacksaverestore.ll
+++ b/test/Transforms/InstCombine/stacksaverestore.ll
@@ -31,7 +31,7 @@ bb: ; preds = %bb, %bb.preheader
%i.0.reg2mem.0 = phi i32 [ 0, %bb.preheader ], [ %indvar.next, %bb ] ; <i32> [#uses=2]
%tmp = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1]
%tmp23 = alloca i8, i32 %size ; <i8*> [#uses=2]
- %tmp27 = getelementptr i8* %tmp23, i32 %tmp25 ; <i8*> [#uses=1]
+ %tmp27 = getelementptr i8, i8* %tmp23, i32 %tmp25 ; <i8*> [#uses=1]
store i8 0, i8* %tmp27, align 1
%tmp28 = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1]
%tmp52 = alloca i8, i32 %size ; <i8*> [#uses=1]
diff --git a/test/Transforms/InstCombine/statepoint.ll b/test/Transforms/InstCombine/statepoint.ll
index bee219db9c125..f904f207bfdc4 100644
--- a/test/Transforms/InstCombine/statepoint.ll
+++ b/test/Transforms/InstCombine/statepoint.ll
@@ -5,10 +5,10 @@
declare void @func()
-define i1 @test_negative(i32 addrspace(1)* %p) {
+define i1 @test_negative(i32 addrspace(1)* %p) gc "statepoint-example" {
entry:
- %safepoint_token = tail call i32 (void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()* @func, i32 0, i32 0, i32 0, i32 addrspace(1)* %p)
- %pnew = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %safepoint_token, i32 4, i32 4)
+ %safepoint_token = tail call i32 (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)* %p)
+ %pnew = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %safepoint_token, i32 7, i32 7)
%cmp = icmp eq i32 addrspace(1)* %pnew, null
ret i1 %cmp
; CHECK-LABEL: test_negative
@@ -16,20 +16,20 @@ entry:
; CHECK: ret i1 %cmp
}
-define i1 @test_nonnull(i32 addrspace(1)* nonnull %p) {
+define i1 @test_nonnull(i32 addrspace(1)* nonnull %p) gc "statepoint-example" {
entry:
- %safepoint_token = tail call i32 (void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()* @func, i32 0, i32 0, i32 0, i32 addrspace(1)* %p)
- %pnew = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %safepoint_token, i32 4, i32 4)
+ %safepoint_token = tail call i32 (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)* %p)
+ %pnew = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %safepoint_token, i32 7, i32 7)
%cmp = icmp eq i32 addrspace(1)* %pnew, null
ret i1 %cmp
; CHECK-LABEL: test_nonnull
; CHECK: ret i1 false
}
-define i1 @test_null() {
+define i1 @test_null() gc "statepoint-example" {
entry:
- %safepoint_token = tail call i32 (void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()* @func, i32 0, i32 0, i32 0, i32 addrspace(1)* null)
- %pnew = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %safepoint_token, i32 4, i32 4)
+ %safepoint_token = tail call i32 (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)* null)
+ %pnew = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %safepoint_token, i32 7, i32 7)
%cmp = icmp eq i32 addrspace(1)* %pnew, null
ret i1 %cmp
; CHECK-LABEL: test_null
@@ -37,10 +37,10 @@ entry:
; CHECK: ret i1 true
}
-define i1 @test_undef() {
+define i1 @test_undef() gc "statepoint-example" {
entry:
- %safepoint_token = tail call i32 (void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()* @func, i32 0, i32 0, i32 0, i32 addrspace(1)* undef)
- %pnew = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %safepoint_token, i32 4, i32 4)
+ %safepoint_token = tail call i32 (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)* undef)
+ %pnew = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %safepoint_token, i32 7, i32 7)
%cmp = icmp eq i32 addrspace(1)* %pnew, null
ret i1 %cmp
; CHECK-LABEL: test_undef
@@ -48,5 +48,5 @@ entry:
; CHECK: ret i1 undef
}
-declare i32 @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()*, i32, i32, ...)
+declare i32 @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)
declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32) #3
diff --git a/test/Transforms/InstCombine/store.ll b/test/Transforms/InstCombine/store.ll
index 0bb175923e981..5dfbd7140901f 100644
--- a/test/Transforms/InstCombine/store.ll
+++ b/test/Transforms/InstCombine/store.ll
@@ -12,7 +12,7 @@ define void @test1(i32* %P) {
}
define void @test2(i32* %P) {
- %X = load i32* %P ; <i32> [#uses=1]
+ %X = load i32, i32* %P ; <i32> [#uses=1]
%Y = add i32 %X, 0 ; <i32> [#uses=1]
store i32 %Y, i32* %P
ret void
@@ -36,12 +36,12 @@ Cond2:
br label %Cont
Cont:
- %V = load i32* %A
+ %V = load i32, i32* %A
ret i32 %V
; CHECK-LABEL: @test3(
; CHECK-NOT: alloca
; CHECK: Cont:
-; CHECK-NEXT: %storemerge = phi i32 [ 47, %Cond2 ], [ -987654321, %Cond ]
+; CHECK-NEXT: %storemerge = phi i32 [ -987654321, %Cond ], [ 47, %Cond2 ]
; CHECK-NEXT: ret i32 %storemerge
}
@@ -56,7 +56,7 @@ Cond:
br label %Cont
Cont:
- %V = load i32* %A
+ %V = load i32, i32* %A
ret i32 %V
; CHECK-LABEL: @test4(
; CHECK-NOT: alloca
@@ -92,15 +92,15 @@ entry:
for.cond: ; preds = %for.body, %entry
%storemerge = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %0 = load i32* %gi, align 4, !tbaa !0
+ %0 = load i32, i32* %gi, align 4, !tbaa !0
%cmp = icmp slt i32 %0, %n
br i1 %cmp, label %for.body, label %for.end
for.body: ; preds = %for.cond
%idxprom = sext i32 %0 to i64
- %arrayidx = getelementptr inbounds float* %a, i64 %idxprom
+ %arrayidx = getelementptr inbounds float, float* %a, i64 %idxprom
store float 0.000000e+00, float* %arrayidx, align 4, !tbaa !3
- %1 = load i32* %gi, align 4, !tbaa !0
+ %1 = load i32, i32* %gi, align 4, !tbaa !0
%inc = add nsw i32 %1, 1
store i32 %inc, i32* %gi, align 4, !tbaa !0
br label %for.cond
diff --git a/test/Transforms/InstCombine/stpcpy-1.ll b/test/Transforms/InstCombine/stpcpy-1.ll
index b918c9e9e890b..cc8289937078b 100644
--- a/test/Transforms/InstCombine/stpcpy-1.ll
+++ b/test/Transforms/InstCombine/stpcpy-1.ll
@@ -14,31 +14,31 @@ declare i8* @stpcpy(i8*, i8*)
define i8* @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
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%ret = call i8* @stpcpy(i8* %dst, i8* %src)
; CHECK: @llvm.memcpy.p0i8.p0i8.i32
-; CHECK-NEXT: getelementptr inbounds ([32 x i8]* @a, i32 0, i32 5)
+; CHECK-NEXT: getelementptr inbounds ([32 x i8], [32 x i8]* @a, i32 0, i32 5)
ret i8* %ret
}
define i8* @test_simplify2() {
; CHECK-LABEL: @test_simplify2(
- %dst = getelementptr [32 x i8]* @a, i32 0, i32 0
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
%ret = call i8* @stpcpy(i8* %dst, i8* %dst)
; CHECK: [[LEN:%[a-z]+]] = call i32 @strlen
-; CHECK-NEXT: getelementptr inbounds [32 x i8]* @a, i32 0, i32 [[LEN]]
+; CHECK-NEXT: getelementptr inbounds [32 x i8], [32 x i8]* @a, i32 0, i32 [[LEN]]
ret i8* %ret
}
define i8* @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
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [32 x i8], [32 x i8]* @b, i32 0, i32 0
%ret = call i8* @stpcpy(i8* %dst, i8* %src)
; CHECK: call i8* @stpcpy
diff --git a/test/Transforms/InstCombine/stpcpy-2.ll b/test/Transforms/InstCombine/stpcpy-2.ll
index 6a0f7530d5a86..07e13a69e2d25 100644
--- a/test/Transforms/InstCombine/stpcpy-2.ll
+++ b/test/Transforms/InstCombine/stpcpy-2.ll
@@ -13,8 +13,8 @@ declare i16* @stpcpy(i8*, i8*)
define void @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
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
call i16* @stpcpy(i8* %dst, i8* %src)
; CHECK: call i16* @stpcpy
diff --git a/test/Transforms/InstCombine/stpcpy_chk-1.ll b/test/Transforms/InstCombine/stpcpy_chk-1.ll
index 393c5d96d10b8..2fcc34b052278 100644
--- a/test/Transforms/InstCombine/stpcpy_chk-1.ll
+++ b/test/Transforms/InstCombine/stpcpy_chk-1.ll
@@ -13,33 +13,33 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
-; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 11)
+; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
+; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 11)
%ret = call i8* @__stpcpy_chk(i8* %dst, i8* %src, i32 60)
ret i8* %ret
}
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
-; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 11)
+; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
+; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 11)
%ret = call i8* @__stpcpy_chk(i8* %dst, i8* %src, i32 12)
ret i8* %ret
}
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
-; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 11)
+; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
+; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 11)
%ret = call i8* @__stpcpy_chk(i8* %dst, i8* %src, i32 -1)
ret i8* %ret
}
@@ -48,10 +48,10 @@ define i8* @test_simplify3() {
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
-; CHECK-NEXT: %stpcpy = call i8* @stpcpy(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8]* @b, i32 0, i32 0))
+; CHECK-NEXT: %stpcpy = call i8* @stpcpy(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i32 0, i32 0))
; CHECK-NEXT: ret i8* %stpcpy
%ret = call i8* @__stpcpy_chk(i8* %dst, i8* %src, i32 -1)
ret i8* %ret
@@ -61,12 +61,12 @@ define i8* @test_simplify4() {
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0
-; CHECK-NEXT: %len = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i1 false)
-; CHECK-NEXT: %1 = call i8* @__memcpy_chk(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0), i32 12, i32 %len)
-; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 11)
+; CHECK-NEXT: %len = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false)
+; CHECK-NEXT: %1 = call i8* @__memcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 %len)
+; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 11)
%len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i1 false)
%ret = call i8* @__stpcpy_chk(i8* %dst, i8* %src, i32 %len)
ret i8* %ret
@@ -76,10 +76,10 @@ define i8* @test_simplify5() {
define i8* @test_simplify6() {
; CHECK-LABEL: @test_simplify6(
- %dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
-; CHECK-NEXT: %strlen = call i32 @strlen(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0))
-; CHECK-NEXT: %1 = getelementptr inbounds [60 x i8]* @a, i32 0, i32 %strlen
+; CHECK-NEXT: %strlen = call i32 @strlen(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0))
+; CHECK-NEXT: %1 = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 %strlen
; CHECK-NEXT: ret i8* %1
%len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i1 false)
%ret = call i8* @__stpcpy_chk(i8* %dst, i8* %dst, i32 %len)
@@ -90,10 +90,10 @@ define i8* @test_simplify6() {
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
-; CHECK-NEXT: %ret = call i8* @__stpcpy_chk(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8]* @b, i32 0, i32 0), i32 8)
+; CHECK-NEXT: %ret = call i8* @__stpcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i32 0, i32 0), i32 8)
; CHECK-NEXT: ret i8* %ret
%ret = call i8* @__stpcpy_chk(i8* %dst, i8* %src, i32 8)
ret i8* %ret
diff --git a/test/Transforms/InstCombine/stpcpy_chk-2.ll b/test/Transforms/InstCombine/stpcpy_chk-2.ll
index b503da9c191c4..b4803f98b2497 100644
--- a/test/Transforms/InstCombine/stpcpy_chk-2.ll
+++ b/test/Transforms/InstCombine/stpcpy_chk-2.ll
@@ -10,8 +10,8 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
define void @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
+ %dst = getelementptr inbounds [60 x i16], [60 x i16]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [8 x i8], [8 x i8]* @.str, i32 0, i32 0
; CHECK-NEXT: call i16* @__strcpy_chk
call i16* @__strcpy_chk(i16* %dst, i8* %src, i32 8)
diff --git a/test/Transforms/InstCombine/strcat-1.ll b/test/Transforms/InstCombine/strcat-1.ll
index 131ad4834837b..446a26e94ac4e 100644
--- a/test/Transforms/InstCombine/strcat-1.ll
+++ b/test/Transforms/InstCombine/strcat-1.ll
@@ -18,19 +18,19 @@ define i32 @main() {
; CHECK: call i32 @puts
%target = alloca [1024 x i8]
- %arg1 = getelementptr [1024 x i8]* %target, i32 0, i32 0
+ %arg1 = getelementptr [1024 x i8], [1024 x i8]* %target, i32 0, i32 0
store i8 0, i8* %arg1
; rslt1 = strcat(target, "hello\00")
- %arg2 = getelementptr [6 x i8]* @hello, i32 0, i32 0
+ %arg2 = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%rslt1 = call i8* @strcat(i8* %arg1, i8* %arg2)
; rslt2 = strcat(rslt1, "\00")
- %arg3 = getelementptr [1 x i8]* @null, i32 0, i32 0
+ %arg3 = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%rslt2 = call i8* @strcat(i8* %rslt1, i8* %arg3)
; rslt3 = strcat(rslt2, "\00hello\00")
- %arg4 = getelementptr [7 x i8]* @null_hello, i32 0, i32 0
+ %arg4 = getelementptr [7 x i8], [7 x i8]* @null_hello, i32 0, i32 0
%rslt3 = call i8* @strcat(i8* %rslt2, i8* %arg4)
call i32 @puts( i8* %rslt3 )
diff --git a/test/Transforms/InstCombine/strcat-2.ll b/test/Transforms/InstCombine/strcat-2.ll
index 48f82670c325b..287019770acf8 100644
--- a/test/Transforms/InstCombine/strcat-2.ll
+++ b/test/Transforms/InstCombine/strcat-2.ll
@@ -15,8 +15,8 @@ define void @test_simplify1() {
; CHECK-NOT: call i8* @strcat
; CHECK: ret void
- %dst = getelementptr [32 x i8]* @a, i32 0, i32 0
- %src = getelementptr [6 x i8]* @hello, i32 0, i32 0
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
call i8* @strcat(i8* %dst, i8* %src)
ret void
}
@@ -25,8 +25,8 @@ define void @test_simplify2() {
; CHECK-LABEL: @test_simplify2(
; CHECK-NEXT: ret void
- %dst = getelementptr [32 x i8]* @a, i32 0, i32 0
- %src = getelementptr [1 x i8]* @empty, i32 0, i32 0
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [1 x i8], [1 x i8]* @empty, i32 0, i32 0
call i8* @strcat(i8* %dst, i8* %src)
ret void
}
diff --git a/test/Transforms/InstCombine/strcat-3.ll b/test/Transforms/InstCombine/strcat-3.ll
index e3396df73d370..88cd162d0cd53 100644
--- a/test/Transforms/InstCombine/strcat-3.ll
+++ b/test/Transforms/InstCombine/strcat-3.ll
@@ -15,8 +15,8 @@ define void @test_nosimplify1() {
; CHECK: call i16* @strcat
; CHECK: ret void
- %dst = getelementptr [32 x i8]* @a, i32 0, i32 0
- %src = getelementptr [6 x i8]* @hello, i32 0, i32 0
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
call i16* @strcat(i8* %dst, i8* %src)
ret void
}
diff --git a/test/Transforms/InstCombine/strchr-1.ll b/test/Transforms/InstCombine/strchr-1.ll
index 66b3e2e51c7ab..6c10ebdfcc430 100644
--- a/test/Transforms/InstCombine/strchr-1.ll
+++ b/test/Transforms/InstCombine/strchr-1.ll
@@ -1,20 +1,21 @@
; Test that the strchr library call simplifier works correctly.
; RUN: opt < %s -instcombine -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:128:128"
+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"
@hello = constant [14 x i8] c"hello world\5Cn\00"
@null = constant [1 x i8] zeroinitializer
+@newlines = constant [3 x i8] c"\0D\0A\00"
@chp = global i8* zeroinitializer
declare i8* @strchr(i8*, i32)
define void @test_simplify1() {
-; CHECK: store i8* getelementptr inbounds ([14 x i8]* @hello, i32 0, i32 6)
+; CHECK: store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @hello, i32 0, i32 6)
; CHECK-NOT: call i8* @strchr
; CHECK: ret void
- %str = getelementptr [14 x i8]* @hello, i32 0, i32 0
+ %str = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
%dst = call i8* @strchr(i8* %str, i32 119)
store i8* %dst, i8** @chp
ret void
@@ -25,18 +26,18 @@ define void @test_simplify2() {
; CHECK-NOT: call i8* @strchr
; CHECK: ret void
- %str = getelementptr [1 x i8]* @null, i32 0, i32 0
+ %str = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%dst = call i8* @strchr(i8* %str, i32 119)
store i8* %dst, i8** @chp
ret void
}
define void @test_simplify3() {
-; CHECK: store i8* getelementptr inbounds ([14 x i8]* @hello, i32 0, i32 13)
+; CHECK: store i8* getelementptr inbounds ([14 x i8], [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
+ %src = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
%dst = call i8* @strchr(i8* %src, i32 0)
store i8* %dst, i8** @chp
ret void
@@ -47,18 +48,18 @@ define void @test_simplify4(i32 %chr) {
; CHECK-NOT: call i8* @strchr
; CHECK: ret void
- %src = getelementptr [14 x i8]* @hello, i32 0, i32 0
+ %src = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
%dst = call i8* @strchr(i8* %src, 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: store i8* getelementptr inbounds ([14 x i8], [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
+ %src = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
%dst = call i8* @strchr(i8* %src, i32 65280)
store i8* %dst, i8** @chp
ret void
@@ -68,7 +69,7 @@ define void @test_simplify5() {
define void @test_simplify6(i8* %str) {
; CHECK: %strlen = call i32 @strlen(i8* %str)
; CHECK-NOT: call i8* @strchr
-; CHECK: %strchr = getelementptr i8* %str, i32 %strlen
+; CHECK: %strchr = getelementptr i8, i8* %str, i32 %strlen
; CHECK: store i8* %strchr, i8** @chp, align 4
; CHECK: ret void
@@ -76,3 +77,19 @@ define void @test_simplify6(i8* %str) {
store i8* %dst, i8** @chp
ret void
}
+
+; Check transformation strchr("\r\n", C) != nullptr -> (C & 9217) != 0
+define i1 @test_simplify7(i32 %C) {
+; CHECK-LABEL: @test_simplify7
+; CHECK-NEXT: [[TRUNC:%.*]] = trunc i32 %C to i16
+; CHECK-NEXT: %memchr.bounds = icmp ult i16 [[TRUNC]], 16
+; CHECK-NEXT: [[SHL:%.*]] = shl i16 1, [[TRUNC]]
+; CHECK-NEXT: [[AND:%.*]] = and i16 [[SHL]], 9217
+; CHECK-NEXT: %memchr.bits = icmp ne i16 [[AND]], 0
+; CHECK-NEXT: %memchr1 = and i1 %memchr.bounds, %memchr.bits
+; CHECK-NEXT: ret i1 %memchr1
+
+ %dst = call i8* @strchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @newlines, i64 0, i64 0), i32 %C)
+ %cmp = icmp ne i8* %dst, null
+ ret i1 %cmp
+}
diff --git a/test/Transforms/InstCombine/strchr-2.ll b/test/Transforms/InstCombine/strchr-2.ll
index 35bbd23e6d4d1..dd86a16f77bcc 100644
--- a/test/Transforms/InstCombine/strchr-2.ll
+++ b/test/Transforms/InstCombine/strchr-2.ll
@@ -14,7 +14,7 @@ define void @test_nosimplify1() {
; CHECK: call i8 @strchr
; CHECK: ret void
- %str = getelementptr [14 x i8]* @hello, i32 0, i32 0
+ %str = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
%dst = call i8 @strchr(i8* %str, i32 119)
store i8 %dst, i8* @chr
ret void
diff --git a/test/Transforms/InstCombine/strcmp-1.ll b/test/Transforms/InstCombine/strcmp-1.ll
index 9bbd7dbe7da86..9bc1fc693557a 100644
--- a/test/Transforms/InstCombine/strcmp-1.ll
+++ b/test/Transforms/InstCombine/strcmp-1.ll
@@ -13,12 +13,12 @@ declare i32 @strcmp(i8*, i8*)
; strcmp("", x) -> -*x
define i32 @test1(i8* %str2) {
; CHECK-LABEL: @test1(
-; CHECK: %strcmpload = load i8* %str
+; CHECK: %strcmpload = load i8, i8* %str
; CHECK: %1 = zext i8 %strcmpload to i32
; CHECK: %2 = sub nsw i32 0, %1
; CHECK: ret i32 %2
- %str1 = getelementptr inbounds [1 x i8]* @null, i32 0, i32 0
+ %str1 = getelementptr inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0
%temp1 = call i32 @strcmp(i8* %str1, i8* %str2)
ret i32 %temp1
@@ -27,11 +27,11 @@ define i32 @test1(i8* %str2) {
; strcmp(x, "") -> *x
define i32 @test2(i8* %str1) {
; CHECK-LABEL: @test2(
-; CHECK: %strcmpload = load i8* %str
+; CHECK: %strcmpload = load i8, i8* %str
; CHECK: %1 = zext i8 %strcmpload to i32
; CHECK: ret i32 %1
- %str2 = getelementptr inbounds [1 x i8]* @null, i32 0, i32 0
+ %str2 = getelementptr inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0
%temp1 = call i32 @strcmp(i8* %str1, i8* %str2)
ret i32 %temp1
}
@@ -41,8 +41,8 @@ define i32 @test3() {
; CHECK-LABEL: @test3(
; CHECK: ret i32 -1
- %str1 = getelementptr inbounds [5 x i8]* @hell, i32 0, i32 0
- %str2 = getelementptr inbounds [6 x i8]* @hello, i32 0, i32 0
+ %str1 = getelementptr inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0
+ %str2 = getelementptr inbounds [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%temp1 = call i32 @strcmp(i8* %str1, i8* %str2)
ret i32 %temp1
}
@@ -51,8 +51,8 @@ define i32 @test4() {
; CHECK-LABEL: @test4(
; CHECK: ret i32 1
- %str1 = getelementptr inbounds [5 x i8]* @hell, i32 0, i32 0
- %str2 = getelementptr inbounds [1 x i8]* @null, i32 0, i32 0
+ %str1 = getelementptr inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0
+ %str2 = getelementptr inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0
%temp1 = call i32 @strcmp(i8* %str1, i8* %str2)
ret i32 %temp1
}
@@ -61,12 +61,12 @@ define i32 @test4() {
; (This transform is rather difficult to trigger in a useful manner)
define i32 @test5(i1 %b) {
; CHECK-LABEL: @test5(
-; CHECK: %memcmp = call i32 @memcmp(i8* getelementptr inbounds ([6 x i8]* @hello, i32 0, i32 0), i8* %str2, i32 5)
+; CHECK: %memcmp = call i32 @memcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8* %str2, i32 5)
; CHECK: ret i32 %memcmp
- %str1 = getelementptr inbounds [6 x i8]* @hello, i32 0, i32 0
- %temp1 = getelementptr inbounds [5 x i8]* @hell, i32 0, i32 0
- %temp2 = getelementptr inbounds [5 x i8]* @bell, i32 0, i32 0
+ %str1 = getelementptr inbounds [6 x i8], [6 x i8]* @hello, i32 0, i32 0
+ %temp1 = getelementptr inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0
+ %temp2 = getelementptr inbounds [5 x i8], [5 x i8]* @bell, i32 0, i32 0
%str2 = select i1 %b, i8* %temp1, i8* %temp2
%temp3 = call i32 @strcmp(i8* %str1, i8* %str2)
ret i32 %temp3
diff --git a/test/Transforms/InstCombine/strcmp-2.ll b/test/Transforms/InstCombine/strcmp-2.ll
index f0ef516522708..a537b10e0deb3 100644
--- a/test/Transforms/InstCombine/strcmp-2.ll
+++ b/test/Transforms/InstCombine/strcmp-2.ll
@@ -13,8 +13,8 @@ define i16 @test_nosimplify() {
; CHECK: call i16 @strcmp
; CHECK: ret i16 %temp1
- %str1 = getelementptr inbounds [5 x i8]* @hell, i32 0, i32 0
- %str2 = getelementptr inbounds [6 x i8]* @hello, i32 0, i32 0
+ %str1 = getelementptr inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0
+ %str2 = getelementptr inbounds [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%temp1 = call i16 @strcmp(i8* %str1, i8* %str2)
ret i16 %temp1
}
diff --git a/test/Transforms/InstCombine/strcpy-1.ll b/test/Transforms/InstCombine/strcpy-1.ll
index 7c253f6f9fca9..24c70c18fc05d 100644
--- a/test/Transforms/InstCombine/strcpy-1.ll
+++ b/test/Transforms/InstCombine/strcpy-1.ll
@@ -15,8 +15,8 @@ declare i8* @strcpy(i8*, i8*)
define void @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
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
call i8* @strcpy(i8* %dst, i8* %src)
; CHECK: @llvm.memcpy.p0i8.p0i8.i32
@@ -26,18 +26,18 @@ define void @test_simplify1() {
define i8* @test_simplify2() {
; CHECK-LABEL: @test_simplify2(
- %dst = getelementptr [32 x i8]* @a, i32 0, i32 0
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
%ret = call i8* @strcpy(i8* %dst, i8* %dst)
-; CHECK: ret i8* getelementptr inbounds ([32 x i8]* @a, i32 0, i32 0)
+; CHECK: ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @a, i32 0, i32 0)
ret i8* %ret
}
define i8* @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
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [32 x i8], [32 x i8]* @b, i32 0, i32 0
%ret = call i8* @strcpy(i8* %dst, i8* %src)
; CHECK: call i8* @strcpy
diff --git a/test/Transforms/InstCombine/strcpy-2.ll b/test/Transforms/InstCombine/strcpy-2.ll
index bad392d7c6488..cfc8a410b7eec 100644
--- a/test/Transforms/InstCombine/strcpy-2.ll
+++ b/test/Transforms/InstCombine/strcpy-2.ll
@@ -13,8 +13,8 @@ declare i16* @strcpy(i8*, i8*)
define void @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
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
call i16* @strcpy(i8* %dst, i8* %src)
; CHECK: call i16* @strcpy
diff --git a/test/Transforms/InstCombine/strcpy_chk-1.ll b/test/Transforms/InstCombine/strcpy_chk-1.ll
index e3f163fd087dc..7a21a49c993ce 100644
--- a/test/Transforms/InstCombine/strcpy_chk-1.ll
+++ b/test/Transforms/InstCombine/strcpy_chk-1.ll
@@ -13,33 +13,33 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
-; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0)
+; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
+; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0)
%ret = call i8* @__strcpy_chk(i8* %dst, i8* %src, i32 60)
ret i8* %ret
}
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
-; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0)
+; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
+; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0)
%ret = call i8* @__strcpy_chk(i8* %dst, i8* %src, i32 12)
ret i8* %ret
}
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
-; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0)
+; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
+; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0)
%ret = call i8* @__strcpy_chk(i8* %dst, i8* %src, i32 -1)
ret i8* %ret
}
@@ -48,10 +48,10 @@ define i8* @test_simplify3() {
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
-; CHECK-NEXT: %strcpy = call i8* @strcpy(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8]* @b, i32 0, i32 0))
+; CHECK-NEXT: %strcpy = call i8* @strcpy(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i32 0, i32 0))
; CHECK-NEXT: ret i8* %strcpy
%ret = call i8* @__strcpy_chk(i8* %dst, i8* %src, i32 -1)
ret i8* %ret
@@ -61,11 +61,11 @@ define i8* @test_simplify4() {
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0
-; CHECK-NEXT: %len = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i1 false)
-; CHECK-NEXT: %1 = call i8* @__memcpy_chk(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0), i32 12, i32 %len)
+; CHECK-NEXT: %len = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false)
+; CHECK-NEXT: %1 = call i8* @__memcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 %len)
; CHECK-NEXT: ret i8* %1
%len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i1 false)
%ret = call i8* @__strcpy_chk(i8* %dst, i8* %src, i32 %len)
@@ -76,10 +76,10 @@ define i8* @test_simplify5() {
define i8* @test_simplify6() {
; CHECK-LABEL: @test_simplify6(
- %dst = getelementptr inbounds [60 x i8]* @a, i32 0, i32 0
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
-; CHECK-NEXT: %len = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i1 false)
-; CHECK-NEXT: %ret = call i8* @__strcpy_chk(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i32 %len)
+; CHECK-NEXT: %len = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false)
+; CHECK-NEXT: %ret = call i8* @__strcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i32 %len)
; CHECK-NEXT: ret i8* %ret
%len = call i32 @llvm.objectsize.i32.p0i8(i8* %dst, i1 false)
%ret = call i8* @__strcpy_chk(i8* %dst, i8* %dst, i32 %len)
@@ -90,10 +90,10 @@ define i8* @test_simplify6() {
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
-; CHECK-NEXT: %ret = call i8* @__strcpy_chk(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8]* @b, i32 0, i32 0), i32 8)
+; CHECK-NEXT: %ret = call i8* @__strcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i32 0, i32 0), i32 8)
; CHECK-NEXT: ret i8* %ret
%ret = call i8* @__strcpy_chk(i8* %dst, i8* %src, i32 8)
ret i8* %ret
diff --git a/test/Transforms/InstCombine/strcpy_chk-2.ll b/test/Transforms/InstCombine/strcpy_chk-2.ll
index 1eff5a822e787..c2204a830bae5 100644
--- a/test/Transforms/InstCombine/strcpy_chk-2.ll
+++ b/test/Transforms/InstCombine/strcpy_chk-2.ll
@@ -10,8 +10,8 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
define void @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
+ %dst = getelementptr inbounds [60 x i16], [60 x i16]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [8 x i8], [8 x i8]* @.str, i32 0, i32 0
; CHECK-NEXT: call i16* @__strcpy_chk
call i16* @__strcpy_chk(i16* %dst, i8* %src, i32 8)
diff --git a/test/Transforms/InstCombine/strcpy_chk-64.ll b/test/Transforms/InstCombine/strcpy_chk-64.ll
index 31447d9569e15..8a2cdc2f2bb5e 100644
--- a/test/Transforms/InstCombine/strcpy_chk-64.ll
+++ b/test/Transforms/InstCombine/strcpy_chk-64.ll
@@ -7,7 +7,7 @@ define void @func(i8* %i) nounwind ssp {
; CHECK: @__strcpy_chk(i8* %arraydecay, i8* %i, i64 32)
entry:
%s = alloca [32 x i8], align 16
- %arraydecay = getelementptr inbounds [32 x i8]* %s, i32 0, i32 0
+ %arraydecay = getelementptr inbounds [32 x i8], [32 x i8]* %s, i32 0, i32 0
%call = call i8* @__strcpy_chk(i8* %arraydecay, i8* %i, i64 32)
call void @func2(i8* %arraydecay)
ret void
diff --git a/test/Transforms/InstCombine/strcspn-1.ll b/test/Transforms/InstCombine/strcspn-1.ll
index b3b52b5025a54..8d441a9eecd06 100644
--- a/test/Transforms/InstCombine/strcspn-1.ll
+++ b/test/Transforms/InstCombine/strcspn-1.ll
@@ -14,7 +14,7 @@ declare i64 @strcspn(i8*, i8*)
define i64 @test_simplify1(i8* %str) {
; CHECK-LABEL: @test_simplify1(
- %pat = getelementptr [1 x i8]* @null, i32 0, i32 0
+ %pat = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%ret = call i64 @strcspn(i8* %str, i8* %pat)
; CHECK-NEXT: [[VAR:%[a-z]+]] = call i64 @strlen(i8* %str)
@@ -26,7 +26,7 @@ define i64 @test_simplify1(i8* %str) {
define i64 @test_simplify2(i8* %pat) {
; CHECK-LABEL: @test_simplify2(
- %str = getelementptr [1 x i8]* @null, i32 0, i32 0
+ %str = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%ret = call i64 @strcspn(i8* %str, i8* %pat)
ret i64 %ret
@@ -37,8 +37,8 @@ define i64 @test_simplify2(i8* %pat) {
define i64 @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
+ %str = getelementptr [6 x i8], [6 x i8]* @abcba, i32 0, i32 0
+ %pat = getelementptr [4 x i8], [4 x i8]* @abc, i32 0, i32 0
%ret = call i64 @strcspn(i8* %str, i8* %pat)
ret i64 %ret
diff --git a/test/Transforms/InstCombine/strcspn-2.ll b/test/Transforms/InstCombine/strcspn-2.ll
index ecfa27d3b6ba9..749860afcd4e1 100644
--- a/test/Transforms/InstCombine/strcspn-2.ll
+++ b/test/Transforms/InstCombine/strcspn-2.ll
@@ -12,7 +12,7 @@ declare double @strcspn(i8*, i8*)
define double @test_no_simplify1(i8* %pat) {
; CHECK-LABEL: @test_no_simplify1(
- %str = getelementptr [1 x i8]* @null, i32 0, i32 0
+ %str = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%ret = call double @strcspn(i8* %str, i8* %pat)
; CHECK-NEXT: call double @strcspn
diff --git a/test/Transforms/InstCombine/strlen-1.ll b/test/Transforms/InstCombine/strlen-1.ll
index 4a3caf28a0fe3..fe453699a60e1 100644
--- a/test/Transforms/InstCombine/strlen-1.ll
+++ b/test/Transforms/InstCombine/strlen-1.ll
@@ -17,7 +17,7 @@ declare i32 @strlen(i8*)
define i32 @test_simplify1() {
; CHECK-LABEL: @test_simplify1(
- %hello_p = getelementptr [6 x i8]* @hello, i32 0, i32 0
+ %hello_p = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%hello_l = call i32 @strlen(i8* %hello_p)
ret i32 %hello_l
; CHECK-NEXT: ret i32 5
@@ -25,7 +25,7 @@ define i32 @test_simplify1() {
define i32 @test_simplify2() {
; CHECK-LABEL: @test_simplify2(
- %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0
+ %null_p = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%null_l = call i32 @strlen(i8* %null_p)
ret i32 %null_l
; CHECK-NEXT: ret i32 0
@@ -33,7 +33,7 @@ define i32 @test_simplify2() {
define i32 @test_simplify3() {
; CHECK-LABEL: @test_simplify3(
- %null_hello_p = getelementptr [7 x i8]* @null_hello, i32 0, i32 0
+ %null_hello_p = getelementptr [7 x i8], [7 x i8]* @null_hello, i32 0, i32 0
%null_hello_l = call i32 @strlen(i8* %null_hello_p)
ret i32 %null_hello_l
; CHECK-NEXT: ret i32 0
@@ -50,7 +50,7 @@ define i32 @test_simplify4() {
define i1 @test_simplify5() {
; CHECK-LABEL: @test_simplify5(
- %hello_p = getelementptr [6 x i8]* @hello, i32 0, i32 0
+ %hello_p = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%hello_l = call i32 @strlen(i8* %hello_p)
%eq_hello = icmp eq i32 %hello_l, 0
ret i1 %eq_hello
@@ -59,7 +59,7 @@ define i1 @test_simplify5() {
define i1 @test_simplify6() {
; CHECK-LABEL: @test_simplify6(
- %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0
+ %null_p = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%null_l = call i32 @strlen(i8* %null_p)
%eq_null = icmp eq i32 %null_l, 0
ret i1 %eq_null
@@ -70,7 +70,7 @@ define i1 @test_simplify6() {
define i1 @test_simplify7() {
; CHECK-LABEL: @test_simplify7(
- %hello_p = getelementptr [6 x i8]* @hello, i32 0, i32 0
+ %hello_p = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%hello_l = call i32 @strlen(i8* %hello_p)
%ne_hello = icmp ne i32 %hello_l, 0
ret i1 %ne_hello
@@ -79,7 +79,7 @@ define i1 @test_simplify7() {
define i1 @test_simplify8() {
; CHECK-LABEL: @test_simplify8(
- %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0
+ %null_p = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%null_l = call i32 @strlen(i8* %null_p)
%ne_null = icmp ne i32 %null_l, 0
ret i1 %ne_null
@@ -88,8 +88,8 @@ define i1 @test_simplify8() {
define i32 @test_simplify9(i1 %x) {
; CHECK-LABEL: @test_simplify9
- %hello = getelementptr [6 x i8]* @hello, i32 0, i32 0
- %longer = getelementptr [7 x i8]* @longer, i32 0, i32 0
+ %hello = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
+ %longer = getelementptr [7 x i8], [7 x i8]* @longer, i32 0, i32 0
%s = select i1 %x, i8* %hello, i8* %longer
%l = call i32 @strlen(i8* %s)
; CHECK-NEXT: select i1 %x, i32 5, i32 6
@@ -101,7 +101,7 @@ define i32 @test_simplify9(i1 %x) {
define i32 @test_no_simplify1() {
; CHECK-LABEL: @test_no_simplify1(
- %a_p = getelementptr [32 x i8]* @a, i32 0, i32 0
+ %a_p = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
%a_l = call i32 @strlen(i8* %a_p)
; CHECK-NEXT: %a_l = call i32 @strlen
ret i32 %a_l
diff --git a/test/Transforms/InstCombine/strlen-2.ll b/test/Transforms/InstCombine/strlen-2.ll
index 6652a310ba6a7..df5eee0caef73 100644
--- a/test/Transforms/InstCombine/strlen-2.ll
+++ b/test/Transforms/InstCombine/strlen-2.ll
@@ -10,7 +10,7 @@ declare i32 @strlen(i8*, i32)
define i32 @test_no_simplify1() {
; CHECK-LABEL: @test_no_simplify1(
- %hello_p = getelementptr [6 x i8]* @hello, i32 0, i32 0
+ %hello_p = getelementptr [6 x i8], [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
ret i32 %hello_l
diff --git a/test/Transforms/InstCombine/strncat-1.ll b/test/Transforms/InstCombine/strncat-1.ll
index 8eae3dae2e234..4b8da81f6fb66 100644
--- a/test/Transforms/InstCombine/strncat-1.ll
+++ b/test/Transforms/InstCombine/strncat-1.ll
@@ -17,19 +17,19 @@ define i32 @main() {
; CHECK: call i32 @puts
%target = alloca [1024 x i8]
- %arg1 = getelementptr [1024 x i8]* %target, i32 0, i32 0
+ %arg1 = getelementptr [1024 x i8], [1024 x i8]* %target, i32 0, i32 0
store i8 0, i8* %arg1
; rslt1 = strncat(target, "hello\00")
- %arg2 = getelementptr [6 x i8]* @hello, i32 0, i32 0
+ %arg2 = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%rslt1 = call i8* @strncat(i8* %arg1, i8* %arg2, i32 6)
; rslt2 = strncat(rslt1, "\00")
- %arg3 = getelementptr [1 x i8]* @null, i32 0, i32 0
+ %arg3 = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%rslt2 = call i8* @strncat(i8* %rslt1, i8* %arg3, i32 42)
; rslt3 = strncat(rslt2, "\00hello\00")
- %arg4 = getelementptr [7 x i8]* @null_hello, i32 0, i32 0
+ %arg4 = getelementptr [7 x i8], [7 x i8]* @null_hello, i32 0, i32 0
%rslt3 = call i8* @strncat(i8* %rslt2, i8* %arg4, i32 42)
call i32 @puts(i8* %rslt3)
diff --git a/test/Transforms/InstCombine/strncat-2.ll b/test/Transforms/InstCombine/strncat-2.ll
index b09fa1260a033..3533e1eace708 100644
--- a/test/Transforms/InstCombine/strncat-2.ll
+++ b/test/Transforms/InstCombine/strncat-2.ll
@@ -15,8 +15,8 @@ define void @test_simplify1() {
; CHECK-NOT: call i8* @strncat
; CHECK: ret void
- %dst = getelementptr [32 x i8]* @a, i32 0, i32 0
- %src = getelementptr [6 x i8]* @hello, i32 0, i32 0
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
call i8* @strncat(i8* %dst, i8* %src, i32 13)
ret void
}
@@ -25,8 +25,8 @@ define void @test_simplify2() {
; CHECK-LABEL: @test_simplify2(
; CHECK-NEXT: ret void
- %dst = getelementptr [32 x i8]* @a, i32 0, i32 0
- %src = getelementptr [1 x i8]* @empty, i32 0, i32 0
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [1 x i8], [1 x i8]* @empty, i32 0, i32 0
call i8* @strncat(i8* %dst, i8* %src, i32 13)
ret void
}
@@ -35,8 +35,8 @@ define void @test_simplify3() {
; CHECK-LABEL: @test_simplify3(
; CHECK-NEXT: ret void
- %dst = getelementptr [32 x i8]* @a, i32 0, i32 0
- %src = getelementptr [6 x i8]* @hello, i32 0, i32 0
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
call i8* @strncat(i8* %dst, i8* %src, i32 0)
ret void
}
@@ -46,8 +46,8 @@ define void @test_nosimplify1() {
; CHECK: call i8* @strncat
; CHECK: ret void
- %dst = getelementptr [32 x i8]* @a, i32 0, i32 0
- %src = getelementptr [6 x i8]* @hello, i32 0, i32 0
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
call i8* @strncat(i8* %dst, i8* %src, i32 1)
ret void
}
diff --git a/test/Transforms/InstCombine/strncat-3.ll b/test/Transforms/InstCombine/strncat-3.ll
index 1b25b4aca1ae9..0f6964df9154f 100644
--- a/test/Transforms/InstCombine/strncat-3.ll
+++ b/test/Transforms/InstCombine/strncat-3.ll
@@ -15,8 +15,8 @@ define void @test_nosimplify1() {
; CHECK: call i16* @strncat
; CHECK: ret void
- %dst = getelementptr [32 x i8]* @a, i32 0, i32 0
- %src = getelementptr [6 x i8]* @hello, i32 0, i32 0
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
call i16* @strncat(i8* %dst, i8* %src, i32 13)
ret void
}
diff --git a/test/Transforms/InstCombine/strncmp-1.ll b/test/Transforms/InstCombine/strncmp-1.ll
index 49b095554c2c8..a1121821fdf5d 100644
--- a/test/Transforms/InstCombine/strncmp-1.ll
+++ b/test/Transforms/InstCombine/strncmp-1.ll
@@ -13,12 +13,12 @@ declare i32 @strncmp(i8*, i8*, i32)
; strncmp("", x, n) -> -*x
define i32 @test1(i8* %str2) {
; CHECK-LABEL: @test1(
-; CHECK: %strcmpload = load i8* %str
+; CHECK: %strcmpload = load i8, i8* %str
; CHECK: %1 = zext i8 %strcmpload to i32
; CHECK: %2 = sub nsw i32 0, %1
; CHECK: ret i32 %2
- %str1 = getelementptr inbounds [1 x i8]* @null, i32 0, i32 0
+ %str1 = getelementptr inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0
%temp1 = call i32 @strncmp(i8* %str1, i8* %str2, i32 10)
ret i32 %temp1
}
@@ -26,11 +26,11 @@ define i32 @test1(i8* %str2) {
; strncmp(x, "", n) -> *x
define i32 @test2(i8* %str1) {
; CHECK-LABEL: @test2(
-; CHECK: %strcmpload = load i8* %str1
+; CHECK: %strcmpload = load i8, i8* %str1
; CHECK: %1 = zext i8 %strcmpload to i32
; CHECK: ret i32 %1
- %str2 = getelementptr inbounds [1 x i8]* @null, i32 0, i32 0
+ %str2 = getelementptr inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0
%temp1 = call i32 @strncmp(i8* %str1, i8* %str2, i32 10)
ret i32 %temp1
}
@@ -40,8 +40,8 @@ define i32 @test3() {
; CHECK-LABEL: @test3(
; CHECK: ret i32 -1
- %str1 = getelementptr inbounds [5 x i8]* @hell, i32 0, i32 0
- %str2 = getelementptr inbounds [6 x i8]* @hello, i32 0, i32 0
+ %str1 = getelementptr inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0
+ %str2 = getelementptr inbounds [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%temp1 = call i32 @strncmp(i8* %str1, i8* %str2, i32 10)
ret i32 %temp1
}
@@ -50,8 +50,8 @@ define i32 @test4() {
; CHECK-LABEL: @test4(
; CHECK: ret i32 1
- %str1 = getelementptr inbounds [5 x i8]* @hell, i32 0, i32 0
- %str2 = getelementptr inbounds [1 x i8]* @null, i32 0, i32 0
+ %str1 = getelementptr inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0
+ %str2 = getelementptr inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0
%temp1 = call i32 @strncmp(i8* %str1, i8* %str2, i32 10)
ret i32 %temp1
}
@@ -60,8 +60,8 @@ define i32 @test5() {
; CHECK-LABEL: @test5(
; CHECK: ret i32 0
- %str1 = getelementptr inbounds [5 x i8]* @hell, i32 0, i32 0
- %str2 = getelementptr inbounds [6 x i8]* @hello, i32 0, i32 0
+ %str1 = getelementptr inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0
+ %str2 = getelementptr inbounds [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%temp1 = call i32 @strncmp(i8* %str1, i8* %str2, i32 4)
ret i32 %temp1
}
@@ -69,9 +69,9 @@ define i32 @test5() {
; strncmp(x,y,1) -> memcmp(x,y,1)
define i32 @test6(i8* %str1, i8* %str2) {
; CHECK-LABEL: @test6(
-; CHECK: [[LOAD1:%[a-z]+]] = load i8* %str1, align 1
+; CHECK: [[LOAD1:%[a-z]+]] = load i8, i8* %str1, align 1
; CHECK: [[ZEXT1:%[a-z]+]] = zext i8 [[LOAD1]] to i32
-; CHECK: [[LOAD2:%[a-z]+]] = load i8* %str2, align 1
+; CHECK: [[LOAD2:%[a-z]+]] = load i8, i8* %str2, align 1
; CHECK: [[ZEXT2:%[a-z]+]] = zext i8 [[LOAD2]] to i32
; CHECK: [[RET:%[a-z]+]] = sub nsw i32 [[ZEXT1]], [[ZEXT2]]
; CHECK: ret i32 [[RET]]
diff --git a/test/Transforms/InstCombine/strncmp-2.ll b/test/Transforms/InstCombine/strncmp-2.ll
index 16ad8a4f62a7e..9e19781e04c41 100644
--- a/test/Transforms/InstCombine/strncmp-2.ll
+++ b/test/Transforms/InstCombine/strncmp-2.ll
@@ -13,8 +13,8 @@ define i16 @test_nosimplify() {
; CHECK: call i16 @strncmp
; CHECK: ret i16 %temp1
- %str1 = getelementptr inbounds [5 x i8]* @hell, i32 0, i32 0
- %str2 = getelementptr inbounds [6 x i8]* @hello, i32 0, i32 0
+ %str1 = getelementptr inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0
+ %str2 = getelementptr inbounds [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%temp1 = call i16 @strncmp(i8* %str1, i8* %str2, i32 10)
ret i16 %temp1
}
diff --git a/test/Transforms/InstCombine/strncpy-1.ll b/test/Transforms/InstCombine/strncpy-1.ll
index c70197f12e283..28cb26b170471 100644
--- a/test/Transforms/InstCombine/strncpy-1.ll
+++ b/test/Transforms/InstCombine/strncpy-1.ll
@@ -20,16 +20,16 @@ define i32 @test_simplify1() {
; CHECK-NOT: call i8* @strncpy
; CHECK: call i32 @puts
%target = alloca [1024 x i8]
- %arg1 = getelementptr [1024 x i8]* %target, i32 0, i32 0
+ %arg1 = getelementptr [1024 x i8], [1024 x i8]* %target, i32 0, i32 0
store i8 0, i8* %arg1
- %arg2 = getelementptr [6 x i8]* @hello, i32 0, i32 0
+ %arg2 = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%rslt1 = call i8* @strncpy(i8* %arg1, i8* %arg2, i32 6)
- %arg3 = getelementptr [1 x i8]* @null, i32 0, i32 0
+ %arg3 = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%rslt2 = call i8* @strncpy(i8* %rslt1, i8* %arg3, i32 42)
- %arg4 = getelementptr [7 x i8]* @null_hello, i32 0, i32 0
+ %arg4 = getelementptr [7 x i8], [7 x i8]* @null_hello, i32 0, i32 0
%rslt3 = call i8* @strncpy(i8* %rslt2, i8* %arg4, i32 42)
call i32 @puts( i8* %rslt3 )
@@ -40,8 +40,8 @@ define i32 @test_simplify1() {
define void @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
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
call i8* @strncpy(i8* %dst, i8* %src, i32 32)
; CHECK: call void @llvm.memset.p0i8.i32
@@ -52,20 +52,20 @@ define void @test_simplify2() {
define i8* @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
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%ret = call i8* @strncpy(i8* %dst, i8* %src, i32 0)
ret i8* %ret
-; CHECK: ret i8* getelementptr inbounds ([32 x i8]* @a, i32 0, i32 0)
+; CHECK: ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @a, i32 0, i32 0)
}
; Check strncpy(x, s, c) -> memcpy(x, s, c, 1) [s and c are constant].
define void @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
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
call i8* @strncpy(i8* %dst, i8* %src, i32 6)
; CHECK: call void @llvm.memcpy.p0i8.p0i8.i32
@@ -76,8 +76,8 @@ define void @test_simplify4() {
define void @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
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [32 x i8], [32 x i8]* @b, i32 0, i32 0
call i8* @strncpy(i8* %dst, i8* %src, i32 32)
; CHECK: call i8* @strncpy
@@ -86,8 +86,8 @@ define void @test_no_simplify1() {
define void @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
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
call i8* @strncpy(i8* %dst, i8* %src, i32 8)
; CHECK: call i8* @strncpy
diff --git a/test/Transforms/InstCombine/strncpy-2.ll b/test/Transforms/InstCombine/strncpy-2.ll
index acc2878648fcd..5c45f9f24aee0 100644
--- a/test/Transforms/InstCombine/strncpy-2.ll
+++ b/test/Transforms/InstCombine/strncpy-2.ll
@@ -13,8 +13,8 @@ declare i16* @strncpy(i8*, i8*, i32)
define void @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
+ %dst = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
+ %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
call i16* @strncpy(i8* %dst, i8* %src, i32 6)
; CHECK: call i16* @strncpy
diff --git a/test/Transforms/InstCombine/strncpy_chk-1.ll b/test/Transforms/InstCombine/strncpy_chk-1.ll
index 9242a8acdbbe6..03690b9b1e019 100644
--- a/test/Transforms/InstCombine/strncpy_chk-1.ll
+++ b/test/Transforms/InstCombine/strncpy_chk-1.ll
@@ -13,32 +13,32 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
-; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0)
+; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
+; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0)
%ret = call i8* @__strncpy_chk(i8* %dst, i8* %src, i32 12, i32 60)
ret i8* %ret
}
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
-; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0)
+; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 1, i1 false)
+; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0)
%ret = call i8* @__strncpy_chk(i8* %dst, i8* %src, i32 12, i32 12)
ret i8* %ret
}
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
-; CHECK-NEXT: %strncpy = call i8* @strncpy(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8]* @b, i32 0, i32 0), i32 12)
+; CHECK-NEXT: %strncpy = call i8* @strncpy(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i32 0, i32 0), i32 12)
; CHECK-NEXT: ret i8* %strncpy
%ret = call i8* @__strncpy_chk(i8* %dst, i8* %src, i32 12, i32 60)
ret i8* %ret
@@ -48,10 +48,10 @@ define i8* @test_simplify3() {
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0
-; CHECK-NEXT: %ret = call i8* @__strncpy_chk(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0), i32 8, i32 4)
+; CHECK-NEXT: %ret = call i8* @__strncpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 8, i32 4)
; CHECK-NEXT: ret i8* %ret
%ret = call i8* @__strncpy_chk(i8* %dst, i8* %src, i32 8, i32 4)
ret i8* %ret
@@ -59,10 +59,10 @@ define i8* @test_no_simplify1() {
define i8* @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
+ %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
-; CHECK-NEXT: %ret = call i8* @__strncpy_chk(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8]* @b, i32 0, i32 0), i32 8, i32 0)
+; CHECK-NEXT: %ret = call i8* @__strncpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i32 0, i32 0), i32 8, i32 0)
; CHECK-NEXT: ret i8* %ret
%ret = call i8* @__strncpy_chk(i8* %dst, i8* %src, i32 8, i32 0)
ret i8* %ret
diff --git a/test/Transforms/InstCombine/strncpy_chk-2.ll b/test/Transforms/InstCombine/strncpy_chk-2.ll
index 829a4798f09ab..89ecd46c04a9c 100644
--- a/test/Transforms/InstCombine/strncpy_chk-2.ll
+++ b/test/Transforms/InstCombine/strncpy_chk-2.ll
@@ -10,8 +10,8 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
define void @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
+ %dst = getelementptr inbounds [60 x i16], [60 x i16]* @a, i32 0, i32 0
+ %src = getelementptr inbounds [60 x i16], [60 x i16]* @b, i32 0, i32 0
; CHECK-NEXT: call i16* @__strncpy_chk
call i16* @__strncpy_chk(i16* %dst, i16* %src, i32 60, i32 60)
diff --git a/test/Transforms/InstCombine/strpbrk-1.ll b/test/Transforms/InstCombine/strpbrk-1.ll
index 58b2d9e88d2c6..a61100deb8757 100644
--- a/test/Transforms/InstCombine/strpbrk-1.ll
+++ b/test/Transforms/InstCombine/strpbrk-1.ll
@@ -14,7 +14,7 @@ declare i8* @strpbrk(i8*, i8*)
define i8* @test_simplify1(i8* %str) {
; CHECK-LABEL: @test_simplify1(
- %pat = getelementptr [1 x i8]* @null, i32 0, i32 0
+ %pat = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%ret = call i8* @strpbrk(i8* %str, i8* %pat)
ret i8* %ret
@@ -25,7 +25,7 @@ define i8* @test_simplify1(i8* %str) {
define i8* @test_simplify2(i8* %pat) {
; CHECK-LABEL: @test_simplify2(
- %str = getelementptr [1 x i8]* @null, i32 0, i32 0
+ %str = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%ret = call i8* @strpbrk(i8* %str, i8* %pat)
ret i8* %ret
@@ -36,19 +36,19 @@ define i8* @test_simplify2(i8* %pat) {
define i8* @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
+ %str = getelementptr [12 x i8], [12 x i8]* @hello, i32 0, i32 0
+ %pat = getelementptr [2 x i8], [2 x i8]* @w, i32 0, i32 0
%ret = call i8* @strpbrk(i8* %str, i8* %pat)
ret i8* %ret
-; CHECK-NEXT: ret i8* getelementptr inbounds ([12 x i8]* @hello, i32 0, i32 6)
+; CHECK-NEXT: ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @hello, i32 0, i32 6)
}
; Check strpbrk(s, "a") -> strchr(s, 'a').
define i8* @test_simplify4(i8* %str) {
; CHECK-LABEL: @test_simplify4(
- %pat = getelementptr [2 x i8]* @w, i32 0, i32 0
+ %pat = getelementptr [2 x i8], [2 x i8]* @w, i32 0, i32 0
%ret = call i8* @strpbrk(i8* %str, i8* %pat)
; CHECK-NEXT: [[VAR:%[a-z]+]] = call i8* @strchr(i8* %str, i32 119)
diff --git a/test/Transforms/InstCombine/strpbrk-2.ll b/test/Transforms/InstCombine/strpbrk-2.ll
index b797d7a595275..0af6faf40bc28 100644
--- a/test/Transforms/InstCombine/strpbrk-2.ll
+++ b/test/Transforms/InstCombine/strpbrk-2.ll
@@ -13,8 +13,8 @@ declare i16* @strpbrk(i8*, i8*)
define i16* @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
+ %str = getelementptr [12 x i8], [12 x i8]* @hello, i32 0, i32 0
+ %pat = getelementptr [2 x i8], [2 x i8]* @w, i32 0, i32 0
%ret = call i16* @strpbrk(i8* %str, i8* %pat)
; CHECK-NEXT: %ret = call i16* @strpbrk
diff --git a/test/Transforms/InstCombine/strrchr-1.ll b/test/Transforms/InstCombine/strrchr-1.ll
index 4615f5f2bd252..3ae68fba96dfc 100644
--- a/test/Transforms/InstCombine/strrchr-1.ll
+++ b/test/Transforms/InstCombine/strrchr-1.ll
@@ -10,11 +10,11 @@ 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* @strrchr(i8*, i32)
define void @test_simplify1() {
-; CHECK: store i8* getelementptr inbounds ([14 x i8]* @hello, i32 0, i32 6)
+; CHECK: store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @hello, i32 0, i32 6)
; CHECK-NOT: call i8* @strrchr
; CHECK: ret void
- %str = getelementptr [14 x i8]* @hello, i32 0, i32 0
+ %str = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
%dst = call i8* @strrchr(i8* %str, i32 119)
store i8* %dst, i8** @chp
ret void
@@ -25,29 +25,29 @@ define void @test_simplify2() {
; CHECK-NOT: call i8* @strrchr
; CHECK: ret void
- %str = getelementptr [1 x i8]* @null, i32 0, i32 0
+ %str = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%dst = call i8* @strrchr(i8* %str, i32 119)
store i8* %dst, i8** @chp
ret void
}
define void @test_simplify3() {
-; CHECK: store i8* getelementptr inbounds ([14 x i8]* @hello, i32 0, i32 13)
+; CHECK: store i8* getelementptr inbounds ([14 x i8], [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
+ %src = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
%dst = call i8* @strrchr(i8* %src, i32 0)
store i8* %dst, i8** @chp
ret void
}
define void @test_simplify4() {
-; CHECK: store i8* getelementptr inbounds ([14 x i8]* @hello, i32 0, i32 13)
+; CHECK: store i8* getelementptr inbounds ([14 x i8], [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
+ %src = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
%dst = call i8* @strrchr(i8* %src, i32 65280)
store i8* %dst, i8** @chp
ret void
@@ -58,7 +58,7 @@ define void @test_nosimplify1(i32 %chr) {
; CHECK: call i8* @strrchr
; CHECK: ret void
- %src = getelementptr [14 x i8]* @hello, i32 0, i32 0
+ %src = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
%dst = call i8* @strrchr(i8* %src, i32 %chr)
store i8* %dst, i8** @chp
ret void
diff --git a/test/Transforms/InstCombine/strrchr-2.ll b/test/Transforms/InstCombine/strrchr-2.ll
index 1974f6ca6033d..4c203d0e8e791 100644
--- a/test/Transforms/InstCombine/strrchr-2.ll
+++ b/test/Transforms/InstCombine/strrchr-2.ll
@@ -14,7 +14,7 @@ define void @test_nosimplify1() {
; CHECK: call i8 @strrchr
; CHECK: ret void
- %str = getelementptr [14 x i8]* @hello, i32 0, i32 0
+ %str = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
%dst = call i8 @strrchr(i8* %str, i32 119)
store i8 %dst, i8* @chr
ret void
diff --git a/test/Transforms/InstCombine/strspn-1.ll b/test/Transforms/InstCombine/strspn-1.ll
index ac940cce9e560..3d9c573ac6177 100644
--- a/test/Transforms/InstCombine/strspn-1.ll
+++ b/test/Transforms/InstCombine/strspn-1.ll
@@ -14,7 +14,7 @@ declare i64 @strspn(i8*, i8*)
define i64 @test_simplify1(i8* %str) {
; CHECK-LABEL: @test_simplify1(
- %pat = getelementptr [1 x i8]* @null, i32 0, i32 0
+ %pat = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%ret = call i64 @strspn(i8* %str, i8* %pat)
ret i64 %ret
@@ -25,7 +25,7 @@ define i64 @test_simplify1(i8* %str) {
define i64 @test_simplify2(i8* %pat) {
; CHECK-LABEL: @test_simplify2(
- %str = getelementptr [1 x i8]* @null, i32 0, i32 0
+ %str = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%ret = call i64 @strspn(i8* %str, i8* %pat)
ret i64 %ret
@@ -36,8 +36,8 @@ define i64 @test_simplify2(i8* %pat) {
define i64 @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
+ %str = getelementptr [6 x i8], [6 x i8]* @abcba, i32 0, i32 0
+ %pat = getelementptr [4 x i8], [4 x i8]* @abc, i32 0, i32 0
%ret = call i64 @strspn(i8* %str, i8* %pat)
ret i64 %ret
diff --git a/test/Transforms/InstCombine/strstr-1.ll b/test/Transforms/InstCombine/strstr-1.ll
index a946dd32779ae..d57e56ccdaf37 100644
--- a/test/Transforms/InstCombine/strstr-1.ll
+++ b/test/Transforms/InstCombine/strstr-1.ll
@@ -15,7 +15,7 @@ declare i8* @strstr(i8*, i8*)
define i8* @test_simplify1(i8* %str) {
; CHECK-LABEL: @test_simplify1(
- %pat = getelementptr inbounds [1 x i8]* @.str, i32 0, i32 0
+ %pat = getelementptr inbounds [1 x i8], [1 x i8]* @.str, i32 0, i32 0
%ret = call i8* @strstr(i8* %str, i8* %pat)
ret i8* %ret
; CHECK-NEXT: ret i8* %str
@@ -25,7 +25,7 @@ define i8* @test_simplify1(i8* %str) {
define i8* @test_simplify2(i8* %str) {
; CHECK-LABEL: @test_simplify2(
- %pat = getelementptr inbounds [2 x i8]* @.str1, i32 0, i32 0
+ %pat = getelementptr inbounds [2 x i8], [2 x i8]* @.str1, i32 0, i32 0
%ret = call i8* @strstr(i8* %str, i8* %pat)
ret i8* %ret
; CHECK-NEXT: @strchr(i8* %str, i32 97)
@@ -35,11 +35,11 @@ define i8* @test_simplify2(i8* %str) {
define i8* @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
+ %str = getelementptr inbounds [6 x i8], [6 x i8]* @.str2, i32 0, i32 0
+ %pat = getelementptr inbounds [4 x i8], [4 x i8]* @.str3, i32 0, i32 0
%ret = call i8* @strstr(i8* %str, i8* %pat)
ret i8* %ret
-; CHECK-NEXT: getelementptr inbounds ([6 x i8]* @.str2, i64 0, i64 1)
+; CHECK-NEXT: getelementptr inbounds ([6 x i8], [6 x i8]* @.str2, i64 0, i64 1)
}
; Check strstr(str, str) -> str.
diff --git a/test/Transforms/InstCombine/strstr-2.ll b/test/Transforms/InstCombine/strstr-2.ll
index 7b28ed0e691e1..9cb33115c2eeb 100644
--- a/test/Transforms/InstCombine/strstr-2.ll
+++ b/test/Transforms/InstCombine/strstr-2.ll
@@ -10,7 +10,7 @@ declare i8 @strstr(i8*, i8*)
define i8 @test_no_simplify1(i8* %str) {
; CHECK-LABEL: @test_no_simplify1(
- %pat = getelementptr inbounds [1 x i8]* @null, i32 0, i32 0
+ %pat = getelementptr inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0
%ret = call i8 @strstr(i8* %str, i8* %pat)
; CHECK-NEXT: call i8 @strstr
ret i8 %ret
diff --git a/test/Transforms/InstCombine/struct-assign-tbaa.ll b/test/Transforms/InstCombine/struct-assign-tbaa.ll
index 4e4b3f2a1a888..c75a839f3fb63 100644
--- a/test/Transforms/InstCombine/struct-assign-tbaa.ll
+++ b/test/Transforms/InstCombine/struct-assign-tbaa.ll
@@ -10,8 +10,8 @@ declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32,
%struct.test1 = type { float }
; CHECK: @test
-; CHECK: %2 = load float* %0, align 4, !tbaa !0
-; CHECK: store float %2, float* %1, align 4, !tbaa !0
+; CHECK: %[[LOAD:.*]] = load i32, i32* %{{.*}}, align 4, !tbaa !0
+; CHECK: store i32 %[[LOAD:.*]], i32* %{{.*}}, align 4, !tbaa !0
; CHECK: ret
define void @test1(%struct.test1* nocapture %a, %struct.test1* nocapture %b) {
entry:
@@ -30,8 +30,8 @@ define i32 (i8*, i32*, double*)*** @test2() {
%tmp = alloca %struct.test2, align 8
%tmp1 = bitcast %struct.test2* %tmp to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* undef, i64 8, i32 8, i1 false), !tbaa.struct !4
- %tmp2 = getelementptr %struct.test2* %tmp, i32 0, i32 0
- %tmp3 = load i32 (i8*, i32*, double*)*** %tmp2
+ %tmp2 = getelementptr %struct.test2, %struct.test2* %tmp, i32 0, i32 0
+ %tmp3 = load i32 (i8*, i32*, double*)**, i32 (i8*, i32*, double*)*** %tmp2
ret i32 (i8*, i32*, double*)*** %tmp2
}
diff --git a/test/Transforms/InstCombine/sub.ll b/test/Transforms/InstCombine/sub.ll
index 0e421f75f1391..c76d8d0e2205d 100644
--- a/test/Transforms/InstCombine/sub.ll
+++ b/test/Transforms/InstCombine/sub.ll
@@ -216,7 +216,7 @@ define zeroext i1 @test22(i32 %a, i32 %b) nounwind {
; rdar://7362831
define i32 @test23(i8* %P, i64 %A){
- %B = getelementptr inbounds i8* %P, i64 %A
+ %B = getelementptr inbounds i8, i8* %P, i64 %A
%C = ptrtoint i8* %B to i64
%D = trunc i64 %C to i32
%E = ptrtoint i8* %P to i64
@@ -232,7 +232,7 @@ 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
+ %B = getelementptr inbounds i8, 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
@@ -242,7 +242,7 @@ define i8 @test23_as1(i8 addrspace(1)* %P, i16 %A) {
}
define i64 @test24(i8* %P, i64 %A){
- %B = getelementptr inbounds i8* %P, i64 %A
+ %B = getelementptr inbounds i8, i8* %P, i64 %A
%C = ptrtoint i8* %B to i64
%E = ptrtoint i8* %P to i64
%G = sub i64 %C, %E
@@ -254,7 +254,7 @@ define i64 @test24(i8* %P, 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
+ %B = getelementptr inbounds i8, 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
@@ -262,7 +262,7 @@ define i16 @test24_as1(i8 addrspace(1)* %P, i16 %A) {
}
define i64 @test24a(i8* %P, i64 %A){
- %B = getelementptr inbounds i8* %P, i64 %A
+ %B = getelementptr inbounds i8, i8* %P, i64 %A
%C = ptrtoint i8* %B to i64
%E = ptrtoint i8* %P to i64
%G = sub i64 %E, %C
@@ -276,7 +276,7 @@ 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
+ %B = getelementptr inbounds i8, 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
@@ -287,7 +287,7 @@ define i16 @test24a_as1(i8 addrspace(1)* %P, i16 %A) {
@Arr = external global [42 x i16]
define i64 @test24b(i8* %P, i64 %A){
- %B = getelementptr inbounds [42 x i16]* @Arr, i64 0, i64 %A
+ %B = getelementptr inbounds [42 x i16], [42 x i16]* @Arr, i64 0, i64 %A
%C = ptrtoint i16* %B to i64
%G = sub i64 %C, ptrtoint ([42 x i16]* @Arr to i64)
ret i64 %G
@@ -298,9 +298,9 @@ define i64 @test24b(i8* %P, i64 %A){
define i64 @test25(i8* %P, i64 %A){
- %B = getelementptr inbounds [42 x i16]* @Arr, i64 0, i64 %A
+ %B = getelementptr inbounds [42 x i16], [42 x i16]* @Arr, i64 0, 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)
+ %G = sub i64 %C, ptrtoint (i16* getelementptr ([42 x i16], [42 x i16]* @Arr, i64 1, i64 0) to i64)
ret i64 %G
; CHECK-LABEL: @test25(
; CHECK-NEXT: shl nuw i64 %A, 1
@@ -316,9 +316,9 @@ define i16 @test25_as1(i8 addrspace(1)* %P, i64 %A) {
; 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
+ %B = getelementptr inbounds [42 x i16], [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)
+ %G = sub i16 %C, ptrtoint (i16 addrspace(1)* getelementptr ([42 x i16], [42 x i16] addrspace(1)* @Arr_as1, i64 1, i64 0) to i16)
ret i16 %G
}
@@ -353,8 +353,8 @@ define i32 @test28(i32 %x, i32 %y, i32 %z) {
}
define i64 @test29(i8* %foo, i64 %i, i64 %j) {
- %gep1 = getelementptr inbounds i8* %foo, i64 %i
- %gep2 = getelementptr inbounds i8* %foo, i64 %j
+ %gep1 = getelementptr inbounds i8, i8* %foo, i64 %i
+ %gep2 = getelementptr inbounds i8, i8* %foo, i64 %j
%cast1 = ptrtoint i8* %gep1 to i64
%cast2 = ptrtoint i8* %gep2 to i64
%sub = sub i64 %cast1, %cast2
@@ -366,8 +366,8 @@ define i64 @test29(i8* %foo, i64 %i, i64 %j) {
define i64 @test30(i8* %foo, i64 %i, i64 %j) {
%bit = bitcast i8* %foo to i32*
- %gep1 = getelementptr inbounds i32* %bit, i64 %i
- %gep2 = getelementptr inbounds i8* %foo, i64 %j
+ %gep1 = getelementptr inbounds i32, i32* %bit, i64 %i
+ %gep2 = getelementptr inbounds i8, i8* %foo, i64 %j
%cast1 = ptrtoint i32* %gep1 to i64
%cast2 = ptrtoint i8* %gep2 to i64
%sub = sub i64 %cast1, %cast2
@@ -384,8 +384,8 @@ define i16 @test30_as1(i8 addrspace(1)* %foo, i16 %i, i16 %j) {
; 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
+ %gep1 = getelementptr inbounds i32, i32 addrspace(1)* %bit, i16 %i
+ %gep2 = getelementptr inbounds i8, 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
diff --git a/test/Transforms/InstCombine/switch-truncate-crash.ll b/test/Transforms/InstCombine/switch-truncate-crash.ll
new file mode 100644
index 0000000000000..cc3c1ff28ed2b
--- /dev/null
+++ b/test/Transforms/InstCombine/switch-truncate-crash.ll
@@ -0,0 +1,7 @@
+; RUN: opt -instcombine < %s
+
+define void @test() {
+ switch i32 0, label %out [i32 0, label %out]
+out:
+ ret void
+}
diff --git a/test/Transforms/InstCombine/type_pun.ll b/test/Transforms/InstCombine/type_pun.ll
new file mode 100644
index 0000000000000..098164cd029f0
--- /dev/null
+++ b/test/Transforms/InstCombine/type_pun.ll
@@ -0,0 +1,141 @@
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+; Ensure that type punning using a union of vector and same-sized array
+; generates an extract instead of a shuffle with an uncommon vector size:
+;
+; typedef uint32_t v4i32 __attribute__((vector_size(16)));
+; union { v4i32 v; uint32_t a[4]; };
+;
+; This cleans up behind SROA, which inserts the uncommon vector size when
+; cleaning up the alloca/store/GEP/load.
+
+
+; Provide legal integer types.
+target datalayout = "p:32:32"
+
+
+; Extracting the zeroth element in an i32 array.
+define i32 @type_pun_zeroth(<16 x i8> %in) {
+; CHECK-LABEL: @type_pun_zeroth(
+; CHECK-NEXT: %[[BC:.*]] = bitcast <16 x i8> %in to <4 x i32>
+; CHECK-NEXT: %[[EXT:.*]] = extractelement <4 x i32> %[[BC]], i32 0
+; CHECK-NEXT: ret i32 %[[EXT]]
+ %sroa = shufflevector <16 x i8> %in, <16 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+ %1 = bitcast <4 x i8> %sroa to i32
+ ret i32 %1
+}
+
+; Extracting the first element in an i32 array.
+define i32 @type_pun_first(<16 x i8> %in) {
+; CHECK-LABEL: @type_pun_first(
+; CHECK-NEXT: %[[BC:.*]] = bitcast <16 x i8> %in to <4 x i32>
+; CHECK-NEXT: %[[EXT:.*]] = extractelement <4 x i32> %[[BC]], i32 1
+; CHECK-NEXT: ret i32 %[[EXT]]
+ %sroa = shufflevector <16 x i8> %in, <16 x i8> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
+ %1 = bitcast <4 x i8> %sroa to i32
+ ret i32 %1
+}
+
+; Extracting an i32 that isn't aligned to any natural boundary.
+define i32 @type_pun_misaligned(<16 x i8> %in) {
+; CHECK-LABEL: @type_pun_misaligned(
+; CHECK-NEXT: %[[SHUF:.*]] = shufflevector <16 x i8> %in, <16 x i8> undef, <16 x i32> <i32 6, i32 7, i32 8, i32 9, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
+; CHECK-NEXT: %[[BC:.*]] = bitcast <16 x i8> %[[SHUF]] to <4 x i32>
+; CHECK-NEXT: %[[EXT:.*]] = extractelement <4 x i32> %[[BC]], i32 0
+; CHECK-NEXT: ret i32 %[[EXT]]
+ %sroa = shufflevector <16 x i8> %in, <16 x i8> undef, <4 x i32> <i32 6, i32 7, i32 8, i32 9>
+ %1 = bitcast <4 x i8> %sroa to i32
+ ret i32 %1
+}
+
+; Type punning to an array of pointers.
+define i32* @type_pun_pointer(<16 x i8> %in) {
+; CHECK-LABEL: @type_pun_pointer(
+; CHECK-NEXT: %[[BC:.*]] = bitcast <16 x i8> %in to <4 x i32>
+; CHECK-NEXT: %[[EXT:.*]] = extractelement <4 x i32> %[[BC]], i32 0
+; CHECK-NEXT: %[[I2P:.*]] = inttoptr i32 %[[EXT]] to i32*
+; CHECK-NEXT: ret i32* %[[I2P]]
+ %sroa = shufflevector <16 x i8> %in, <16 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+ %1 = bitcast <4 x i8> %sroa to i32
+ %2 = inttoptr i32 %1 to i32*
+ ret i32* %2
+}
+
+; Type punning to an array of 32-bit floating-point values.
+define float @type_pun_float(<16 x i8> %in) {
+; CHECK-LABEL: @type_pun_float(
+; CHECK-NEXT: %[[BC:.*]] = bitcast <16 x i8> %in to <4 x float>
+; CHECK-NEXT: %[[EXT:.*]] = extractelement <4 x float> %[[BC]], i32 0
+; CHECK-NEXT: ret float %[[EXT]]
+ %sroa = shufflevector <16 x i8> %in, <16 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+ %1 = bitcast <4 x i8> %sroa to float
+ ret float %1
+}
+
+; Type punning to an array of 64-bit floating-point values.
+define double @type_pun_double(<16 x i8> %in) {
+; CHECK-LABEL: @type_pun_double(
+; CHECK-NEXT: %[[BC:.*]] = bitcast <16 x i8> %in to <2 x double>
+; CHECK-NEXT: %[[EXT:.*]] = extractelement <2 x double> %[[BC]], i32 0
+; CHECK-NEXT: ret double %[[EXT]]
+ %sroa = shufflevector <16 x i8> %in, <16 x i8> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+ %1 = bitcast <8 x i8> %sroa to double
+ ret double %1
+}
+
+; Type punning to same-size floating-point and integer values.
+; Verify that multiple uses with different bitcast types are properly handled.
+define { float, i32 } @type_pun_float_i32(<16 x i8> %in) {
+; CHECK-LABEL: @type_pun_float_i32(
+; CHECK-NEXT: %[[BCI:.*]] = bitcast <16 x i8> %in to <4 x i32>
+; CHECK-NEXT: %[[EXTI:.*]] = extractelement <4 x i32> %[[BCI]], i32 0
+; CHECK-NEXT: %[[BCF:.*]] = bitcast <16 x i8> %in to <4 x float>
+; CHECK-NEXT: %[[EXTF:.*]] = extractelement <4 x float> %[[BCF]], i32 0
+; CHECK-NEXT: %1 = insertvalue { float, i32 } undef, float %[[EXTF]], 0
+; CHECK-NEXT: %2 = insertvalue { float, i32 } %1, i32 %[[EXTI]], 1
+; CHECK-NEXT: ret { float, i32 } %2
+ %sroa = shufflevector <16 x i8> %in, <16 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+ %f = bitcast <4 x i8> %sroa to float
+ %i = bitcast <4 x i8> %sroa to i32
+ %1 = insertvalue { float, i32 } undef, float %f, 0
+ %2 = insertvalue { float, i32 } %1, i32 %i, 1
+ ret { float, i32 } %2
+}
+
+; Type punning two i32 values, with control flow.
+; Verify that the bitcast is shared and dominates usage.
+define i32 @type_pun_i32_ctrl(<16 x i8> %in) {
+; CHECK-LABEL: @type_pun_i32_ctrl(
+entry: ; CHECK-NEXT: entry:
+; CHECK-NEXT: %[[BC:.*]] = bitcast <16 x i8> %in to <4 x i32>
+; CHECK-NEXT: br
+ %sroa = shufflevector <16 x i8> %in, <16 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+ br i1 undef, label %left, label %right
+left: ; CHECK: left:
+; CHECK-NEXT: %[[EXTL:.*]] = extractelement <4 x i32> %[[BC]], i32 0
+; CHECK-NEXT: br
+ %lhs = bitcast <4 x i8> %sroa to i32
+ br label %tail
+right: ; CHECK: right:
+; CHECK-NEXT: %[[EXTR:.*]] = extractelement <4 x i32> %[[BC]], i32 0
+; CHECK-NEXT: br
+ %rhs = bitcast <4 x i8> %sroa to i32
+ br label %tail
+tail: ; CHECK: tail:
+; CHECK-NEXT: %i = phi i32 [ %[[EXTL]], %left ], [ %[[EXTR]], %right ]
+; CHECK-NEXT: ret i32 %i
+ %i = phi i32 [ %lhs, %left ], [ %rhs, %right ]
+ ret i32 %i
+}
+
+; Extracting a type that won't fit in a vector isn't handled. The function
+; should stay the same.
+define i40 @type_pun_unhandled(<16 x i8> %in) {
+; CHECK-LABEL: @type_pun_unhandled(
+; CHECK-NEXT: %sroa = shufflevector <16 x i8> %in, <16 x i8> undef, <5 x i32> <i32 4, i32 5, i32 6, i32 7, i32 8>
+; CHECK-NEXT: %1 = bitcast <5 x i8> %sroa to i40
+; CHECK-NEXT: ret i40 %1
+ %sroa = shufflevector <16 x i8> %in, <16 x i8> undef, <5 x i32> <i32 4, i32 5, i32 6, i32 7, i32 8>
+ %1 = bitcast <5 x i8> %sroa to i40
+ ret i40 %1
+}
diff --git a/test/Transforms/InstCombine/unpack-fca.ll b/test/Transforms/InstCombine/unpack-fca.ll
new file mode 100644
index 0000000000000..48bb157956aae
--- /dev/null
+++ b/test/Transforms/InstCombine/unpack-fca.ll
@@ -0,0 +1,114 @@
+; RUN: opt -instcombine -S < %s | FileCheck %s
+
+target datalayout = "e-i64:64-f80:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+%A__vtbl = type { i8*, i32 (%A*)* }
+%A = type { %A__vtbl* }
+
+@A__vtblZ = constant %A__vtbl { i8* null, i32 (%A*)* @A.foo }
+
+declare i32 @A.foo(%A* nocapture %this)
+
+declare i8* @allocmemory(i64)
+
+define void @storeA() {
+body:
+ %0 = tail call i8* @allocmemory(i64 32)
+ %1 = bitcast i8* %0 to %A*
+; CHECK-LABEL: storeA
+; CHECK: store %A__vtbl* @A__vtblZ
+ store %A { %A__vtbl* @A__vtblZ }, %A* %1, align 8
+ ret void
+}
+
+define void @storeStructOfA() {
+body:
+ %0 = tail call i8* @allocmemory(i64 32)
+ %1 = bitcast i8* %0 to { %A }*
+; CHECK-LABEL: storeStructOfA
+; CHECK: store %A__vtbl* @A__vtblZ
+ store { %A } { %A { %A__vtbl* @A__vtblZ } }, { %A }* %1, align 8
+ ret void
+}
+
+define void @storeArrayOfA() {
+body:
+ %0 = tail call i8* @allocmemory(i64 32)
+ %1 = bitcast i8* %0 to [1 x %A]*
+; CHECK-LABEL: storeArrayOfA
+; CHECK: store %A__vtbl* @A__vtblZ
+ store [1 x %A] [%A { %A__vtbl* @A__vtblZ }], [1 x %A]* %1, align 8
+ ret void
+}
+
+define void @storeStructOfArrayOfA() {
+body:
+ %0 = tail call i8* @allocmemory(i64 32)
+ %1 = bitcast i8* %0 to { [1 x %A] }*
+; CHECK-LABEL: storeStructOfArrayOfA
+; CHECK: store %A__vtbl* @A__vtblZ
+ store { [1 x %A] } { [1 x %A] [%A { %A__vtbl* @A__vtblZ }] }, { [1 x %A] }* %1, align 8
+ ret void
+}
+
+define %A @loadA() {
+body:
+ %0 = tail call i8* @allocmemory(i64 32)
+ %1 = bitcast i8* %0 to %A*
+; CHECK-LABEL: loadA
+; CHECK: load %A__vtbl*,
+; CHECK: insertvalue %A undef, %A__vtbl* {{.*}}, 0
+ %2 = load %A, %A* %1, align 8
+ ret %A %2
+}
+
+define { %A } @loadStructOfA() {
+body:
+ %0 = tail call i8* @allocmemory(i64 32)
+ %1 = bitcast i8* %0 to { %A }*
+; CHECK-LABEL: loadStructOfA
+; CHECK: load %A__vtbl*,
+; CHECK: insertvalue %A undef, %A__vtbl* {{.*}}, 0
+; CHECK: insertvalue { %A } undef, %A {{.*}}, 0
+ %2 = load { %A }, { %A }* %1, align 8
+ ret { %A } %2
+}
+
+define [1 x %A] @loadArrayOfA() {
+body:
+ %0 = tail call i8* @allocmemory(i64 32)
+ %1 = bitcast i8* %0 to [1 x %A]*
+; CHECK-LABEL: loadArrayOfA
+; CHECK: load %A__vtbl*,
+; CHECK: insertvalue %A undef, %A__vtbl* {{.*}}, 0
+; CHECK: insertvalue [1 x %A] undef, %A {{.*}}, 0
+ %2 = load [1 x %A], [1 x %A]* %1, align 8
+ ret [1 x %A] %2
+}
+
+define { [1 x %A] } @loadStructOfArrayOfA() {
+body:
+ %0 = tail call i8* @allocmemory(i64 32)
+ %1 = bitcast i8* %0 to { [1 x %A] }*
+; CHECK-LABEL: loadStructOfArrayOfA
+; CHECK: load %A__vtbl*,
+; CHECK: insertvalue %A undef, %A__vtbl* {{.*}}, 0
+; CHECK: insertvalue [1 x %A] undef, %A {{.*}}, 0
+; CHECK: insertvalue { [1 x %A] } undef, [1 x %A] {{.*}}, 0
+ %2 = load { [1 x %A] }, { [1 x %A] }* %1, align 8
+ ret { [1 x %A] } %2
+}
+
+define { %A } @structOfA() {
+body:
+ %0 = tail call i8* @allocmemory(i64 32)
+ %1 = bitcast i8* %0 to { %A }*
+; CHECK-LABEL: structOfA
+; CHECK: store %A__vtbl* @A__vtblZ
+ store { %A } { %A { %A__vtbl* @A__vtblZ } }, { %A }* %1, align 8
+ %2 = load { %A }, { %A }* %1, align 8
+; CHECK-NOT: load
+; CHECK: ret { %A } { %A { %A__vtbl* @A__vtblZ } }
+ ret { %A } %2
+}
diff --git a/test/Transforms/InstCombine/urem-simplify-bug.ll b/test/Transforms/InstCombine/urem-simplify-bug.ll
index 3e94ab5b2c336..1220dfdc77f05 100644
--- a/test/Transforms/InstCombine/urem-simplify-bug.ll
+++ b/test/Transforms/InstCombine/urem-simplify-bug.ll
@@ -22,8 +22,8 @@ bb14: ; preds = %entry
br label %bb15
bb15: ; preds = %bb14, %bb
- %iftmp.0.0 = phi i8* [ getelementptr ([5 x i8]* @.str1, i32 0, i32 0), %bb14 ], [ getelementptr ([5 x i8]* @.str, i32 0, i32 0), %bb ] ; <i8*> [#uses=1]
- %tmp17 = call i32 (i8*, ...)* @printf( i8* %iftmp.0.0 ) nounwind ; <i32> [#uses=0]
+ %iftmp.0.0 = phi i8* [ getelementptr ([5 x i8], [5 x i8]* @.str1, i32 0, i32 0), %bb14 ], [ getelementptr ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), %bb ] ; <i8*> [#uses=1]
+ %tmp17 = call i32 (i8*, ...) @printf( i8* %iftmp.0.0 ) nounwind ; <i32> [#uses=0]
ret i32 0
}
diff --git a/test/Transforms/InstCombine/vec_demanded_elts.ll b/test/Transforms/InstCombine/vec_demanded_elts.ll
index 00a029aeab78d..4245c7a3c134e 100644
--- a/test/Transforms/InstCombine/vec_demanded_elts.ll
+++ b/test/Transforms/InstCombine/vec_demanded_elts.ll
@@ -110,7 +110,7 @@ define void @vac(<4 x float>* nocapture %a) nounwind {
; CHECK-NOT: load
; CHECK: ret
entry:
- %tmp1 = load <4 x float>* %a ; <<4 x float>> [#uses=1]
+ %tmp1 = load <4 x float>, <4 x float>* %a ; <<4 x float>> [#uses=1]
%vecins = insertelement <4 x float> %tmp1, float 0.000000e+00, i32 0 ; <<4 x float>> [#uses=1]
%vecins4 = insertelement <4 x float> %vecins, float 0.000000e+00, i32 1; <<4 x float>> [#uses=1]
%vecins6 = insertelement <4 x float> %vecins4, float 0.000000e+00, i32 2; <<4 x float>> [#uses=1]
@@ -141,8 +141,8 @@ declare i64 @llvm.x86.sse2.cvttsd2si64(<2 x double>)
; <rdar://problem/6945110>
define <4 x i32> @kernel3_vertical(<4 x i16> * %src, <8 x i16> * %foo) nounwind {
entry:
- %tmp = load <4 x i16>* %src
- %tmp1 = load <8 x i16>* %foo
+ %tmp = load <4 x i16>, <4 x i16>* %src
+ %tmp1 = load <8 x i16>, <8 x i16>* %foo
; CHECK: %tmp2 = shufflevector
%tmp2 = shufflevector <4 x i16> %tmp, <4 x i16> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
; pmovzxwd ignores the upper 64-bits of its input; -instcombine should remove this shuffle:
@@ -350,19 +350,19 @@ define <8 x float> @test_vpermilvar_ps_256(<8 x float> %v) {
ret <8 x float> %a
}
-declare <2 x double> @llvm.x86.avx.vpermilvar.pd(<2 x double>, <2 x i32>)
+declare <2 x double> @llvm.x86.avx.vpermilvar.pd(<2 x double>, <2 x i64>)
define <2 x double> @test_vpermilvar_pd(<2 x double> %v) {
; CHECK-LABEL: @test_vpermilvar_pd(
; CHECK: shufflevector <2 x double> %v, <2 x double> undef, <2 x i32> <i32 1, i32 0>
- %a = tail call <2 x double> @llvm.x86.avx.vpermilvar.pd(<2 x double> %v, <2 x i32> <i32 2, i32 0>)
+ %a = tail call <2 x double> @llvm.x86.avx.vpermilvar.pd(<2 x double> %v, <2 x i64> <i64 2, i64 0>)
ret <2 x double> %a
}
-declare <4 x double> @llvm.x86.avx.vpermilvar.pd.256(<4 x double>, <4 x i32>)
+declare <4 x double> @llvm.x86.avx.vpermilvar.pd.256(<4 x double>, <4 x i64>)
define <4 x double> @test_vpermilvar_pd_256(<4 x double> %v) {
; CHECK-LABEL: @test_vpermilvar_pd_256(
; CHECK: shufflevector <4 x double> %v, <4 x double> undef, <4 x i32> <i32 1, i32 0, i32 3, i32 2>
- %a = tail call <4 x double> @llvm.x86.avx.vpermilvar.pd.256(<4 x double> %v, <4 x i32> <i32 3, i32 1, i32 2, i32 0>)
+ %a = tail call <4 x double> @llvm.x86.avx.vpermilvar.pd.256(<4 x double> %v, <4 x i64> <i64 3, i64 1, i64 2, i64 0>)
ret <4 x double> %a
}
@@ -383,14 +383,14 @@ define <8 x float> @test_vpermilvar_ps_256_zero(<8 x float> %v) {
define <2 x double> @test_vpermilvar_pd_zero(<2 x double> %v) {
; CHECK-LABEL: @test_vpermilvar_pd_zero(
; CHECK: shufflevector <2 x double> %v, <2 x double> undef, <2 x i32> zeroinitializer
- %a = tail call <2 x double> @llvm.x86.avx.vpermilvar.pd(<2 x double> %v, <2 x i32> zeroinitializer)
+ %a = tail call <2 x double> @llvm.x86.avx.vpermilvar.pd(<2 x double> %v, <2 x i64> zeroinitializer)
ret <2 x double> %a
}
define <4 x double> @test_vpermilvar_pd_256_zero(<4 x double> %v) {
; CHECK-LABEL: @test_vpermilvar_pd_256_zero(
; CHECK: shufflevector <4 x double> %v, <4 x double> undef, <4 x i32> <i32 0, i32 0, i32 2, i32 2>
- %a = tail call <4 x double> @llvm.x86.avx.vpermilvar.pd.256(<4 x double> %v, <4 x i32> zeroinitializer)
+ %a = tail call <4 x double> @llvm.x86.avx.vpermilvar.pd.256(<4 x double> %v, <4 x i64> zeroinitializer)
ret <4 x double> %a
}
diff --git a/test/Transforms/InstCombine/vec_extract_var_elt.ll b/test/Transforms/InstCombine/vec_extract_var_elt.ll
index f6f9e0134a163..5c0610ff48bbd 100644
--- a/test/Transforms/InstCombine/vec_extract_var_elt.ll
+++ b/test/Transforms/InstCombine/vec_extract_var_elt.ll
@@ -3,7 +3,7 @@
define void @test (float %b, <8 x float> * %p) {
; CHECK: extractelement
; CHECK: fptosi
- %1 = load <8 x float> * %p
+ %1 = load <8 x float> , <8 x float> * %p
%2 = bitcast <8 x float> %1 to <8 x i32>
%3 = bitcast <8 x i32> %2 to <8 x float>
%a = fptosi <8 x float> %3 to <8 x i32>
diff --git a/test/Transforms/InstCombine/vec_phi_extract.ll b/test/Transforms/InstCombine/vec_phi_extract.ll
index 1d778a000fb70..1079dc9e71989 100644
--- a/test/Transforms/InstCombine/vec_phi_extract.ll
+++ b/test/Transforms/InstCombine/vec_phi_extract.ll
@@ -16,7 +16,7 @@ loop:
%end = icmp ult i32 %elt, %limit
%3 = add i32 10, %elt
%4 = sext i32 %elt to i64
- %5 = getelementptr i32* %ptr, i64 %4
+ %5 = getelementptr i32, i32* %ptr, i64 %4
store i32 %3, i32* %5
%inc = add <16 x i32> %2, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
br i1 %end, label %loop, label %ret
diff --git a/test/Transforms/InstCombine/vec_shuffle.ll b/test/Transforms/InstCombine/vec_shuffle.ll
index eb4e9d6f8c308..d4d7f167ef072 100644
--- a/test/Transforms/InstCombine/vec_shuffle.ll
+++ b/test/Transforms/InstCombine/vec_shuffle.ll
@@ -190,11 +190,11 @@ 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
+ %tmp1 = load <4 x i16>, <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
+ %tmp4 = load <4 x i16>, <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>
@@ -414,3 +414,11 @@ define <4 x i32> @pr20114(<4 x i32> %__mask) {
%masked_new.i.i.i = and <4 x i32> bitcast (<2 x i64> <i64 ptrtoint (<4 x i32> (<4 x i32>)* @pr20114 to i64), i64 ptrtoint (<4 x i32> (<4 x i32>)* @pr20114 to i64)> to <4 x i32>), %mask01.i
ret <4 x i32> %masked_new.i.i.i
}
+
+define <2 x i32*> @pr23113(<4 x i32*> %A) {
+; CHECK-LABEL: @pr23113
+; CHECK: %[[V:.*]] = shufflevector <4 x i32*> %A, <4 x i32*> undef, <2 x i32> <i32 0, i32 1>
+; CHECK-NEXT: ret <2 x i32*> %[[V]]
+ %1 = shufflevector <4 x i32*> %A, <4 x i32*> undef, <2 x i32> <i32 0, i32 1>
+ ret <2 x i32*> %1
+}
diff --git a/test/Transforms/InstCombine/vector-casts.ll b/test/Transforms/InstCombine/vector-casts.ll
index ca97b3407da6d..727eb4ebb4c8c 100644
--- a/test/Transforms/InstCombine/vector-casts.ll
+++ b/test/Transforms/InstCombine/vector-casts.ll
@@ -133,7 +133,7 @@ entry:
%dim31 = insertelement <4 x i32> %dim30, i32 %a, i32 2
%dim32 = insertelement <4 x i32> %dim31, i32 %a, i32 3
- %offset_ptr = getelementptr <4 x float>* null, i32 1
+ %offset_ptr = getelementptr <4 x float>, <4 x float>* null, i32 1
%offset_int = ptrtoint <4 x float>* %offset_ptr to i64
%sizeof32 = trunc i64 %offset_int to i32
diff --git a/test/Transforms/InstCombine/vector_gep1.ll b/test/Transforms/InstCombine/vector_gep1.ll
index 90ca26212f2a6..0f4e407dd7fed 100644
--- a/test/Transforms/InstCombine/vector_gep1.ll
+++ b/test/Transforms/InstCombine/vector_gep1.ll
@@ -17,26 +17,26 @@ define <2 x i1> @test2(<2 x i8*> %a) {
}
define <2 x i1> @test3(<2 x i8*> %a) {
- %g = getelementptr <2 x i8*> %a, <2 x i32> <i32 1, i32 0>
+ %g = getelementptr i8, <2 x i8*> %a, <2 x i32> <i32 1, i32 0>
%B = icmp ult <2 x i8*> %g, zeroinitializer
ret <2 x i1> %B
}
define <1 x i1> @test4(<1 x i8*> %a) {
- %g = getelementptr <1 x i8*> %a, <1 x i32> <i32 1>
+ %g = getelementptr i8, <1 x i8*> %a, <1 x i32> <i32 1>
%B = icmp ult <1 x i8*> %g, zeroinitializer
ret <1 x i1> %B
}
define <2 x i1> @test5(<2 x i8*> %a) {
- %w = getelementptr <2 x i8*> %a, <2 x i32> zeroinitializer
- %e = getelementptr <2 x i8*> %w, <2 x i32> <i32 5, i32 9>
- %g = getelementptr <2 x i8*> %e, <2 x i32> <i32 1, i32 0>
+ %w = getelementptr i8, <2 x i8*> %a, <2 x i32> zeroinitializer
+ %e = getelementptr i8, <2 x i8*> %w, <2 x i32> <i32 5, i32 9>
+ %g = getelementptr i8, <2 x i8*> %e, <2 x i32> <i32 1, i32 0>
%B = icmp ult <2 x i8*> %g, zeroinitializer
ret <2 x i1> %B
}
define <2 x i32*> @test7(<2 x {i32, i32}*> %a) {
- %w = getelementptr <2 x {i32, i32}*> %a, <2 x i32> <i32 5, i32 9>, <2 x i32> zeroinitializer
+ %w = getelementptr {i32, i32}, <2 x {i32, i32}*> %a, <2 x i32> <i32 5, i32 9>, <2 x i32> zeroinitializer
ret <2 x i32*> %w
}
diff --git a/test/Transforms/InstCombine/vector_gep2.ll b/test/Transforms/InstCombine/vector_gep2.ll
index 42057d60b8c8b..d76a7d56cc7a1 100644
--- a/test/Transforms/InstCombine/vector_gep2.ll
+++ b/test/Transforms/InstCombine/vector_gep2.ll
@@ -5,7 +5,7 @@ target triple = "x86_64-unknown-linux-gnu"
define <2 x i8*> @testa(<2 x i8*> %a) {
; 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>
+ %g = getelementptr i8, <2 x i8*> %a, <2 x i32> <i32 0, i32 1>
+; CHECK: getelementptr i8, <2 x i8*> %a, <2 x i64> <i64 0, i64 1>
ret <2 x i8*> %g
}
diff --git a/test/Transforms/InstCombine/volatile_store.ll b/test/Transforms/InstCombine/volatile_store.ll
index 7cab199a58f47..7377b6815e290 100644
--- a/test/Transforms/InstCombine/volatile_store.ll
+++ b/test/Transforms/InstCombine/volatile_store.ll
@@ -5,7 +5,7 @@
define void @self_assign_1() {
entry:
- %tmp = load volatile i32* @x ; <i32> [#uses=1]
+ %tmp = load volatile i32, i32* @x ; <i32> [#uses=1]
store volatile i32 %tmp, i32* @x
br label %return
diff --git a/test/Transforms/InstCombine/vsx-unaligned.ll b/test/Transforms/InstCombine/vsx-unaligned.ll
index 26e04268f4463..ad264fb15b314 100644
--- a/test/Transforms/InstCombine/vsx-unaligned.ll
+++ b/test/Transforms/InstCombine/vsx-unaligned.ll
@@ -14,28 +14,28 @@ entry:
%t1 = alloca <4 x float>*, align 8
%t2 = alloca <2 x double>*, align 8
store <4 x float>* @vf, <4 x float>** %t1, align 8
- %0 = load <4 x float>** %t1, align 8
+ %0 = load <4 x float>*, <4 x float>** %t1, align 8
%1 = bitcast <4 x float>* %0 to i8*
%2 = call <4 x i32> @llvm.ppc.vsx.lxvw4x(i8* %1)
store <4 x float>* @res_vf, <4 x float>** %t1, align 8
- %3 = load <4 x float>** %t1, align 8
+ %3 = load <4 x float>*, <4 x float>** %t1, align 8
%4 = bitcast <4 x float>* %3 to i8*
call void @llvm.ppc.vsx.stxvw4x(<4 x i32> %2, i8* %4)
store <2 x double>* @vd, <2 x double>** %t2, align 8
- %5 = load <2 x double>** %t2, align 8
+ %5 = load <2 x double>*, <2 x double>** %t2, align 8
%6 = bitcast <2 x double>* %5 to i8*
%7 = call <2 x double> @llvm.ppc.vsx.lxvd2x(i8* %6)
store <2 x double>* @res_vd, <2 x double>** %t2, align 8
- %8 = load <2 x double>** %t2, align 8
+ %8 = load <2 x double>*, <2 x double>** %t2, align 8
%9 = bitcast <2 x double>* %8 to i8*
call void @llvm.ppc.vsx.stxvd2x(<2 x double> %7, i8* %9)
ret void
}
; CHECK-LABEL: @test1
-; CHECK: %0 = load <4 x i32>* bitcast (<4 x float>* @vf to <4 x i32>*), align 1
+; CHECK: %0 = load <4 x i32>, <4 x i32>* bitcast (<4 x float>* @vf to <4 x i32>*), align 1
; CHECK: store <4 x i32> %0, <4 x i32>* bitcast (<4 x float>* @res_vf to <4 x i32>*), align 1
-; CHECK: %1 = load <2 x double>* @vd, align 1
+; CHECK: %1 = load <2 x double>, <2 x double>* @vd, align 1
; CHECK: store <2 x double> %1, <2 x double>* @res_vd, align 1
declare <4 x i32> @llvm.ppc.vsx.lxvw4x(i8*)
diff --git a/test/Transforms/InstCombine/weak-symbols.ll b/test/Transforms/InstCombine/weak-symbols.ll
index ec946ead86026..3f92e64d2ec09 100644
--- a/test/Transforms/InstCombine/weak-symbols.ll
+++ b/test/Transforms/InstCombine/weak-symbols.ll
@@ -13,8 +13,8 @@ define i32 @foo() nounwind {
; CHECK: ret i32 %temp1
entry:
- %str1 = getelementptr inbounds [2 x i8]* @fake_init, i64 0, i64 0
- %str2 = getelementptr inbounds [2 x i8]* @.str, i64 0, i64 0
+ %str1 = getelementptr inbounds [2 x i8], [2 x i8]* @fake_init, i64 0, i64 0
+ %str2 = getelementptr inbounds [2 x i8], [2 x i8]* @.str, i64 0, i64 0
%temp1 = call i32 @strcmp(i8* %str1, i8* %str2) nounwind readonly
ret i32 %temp1
}
@@ -24,8 +24,8 @@ define i32 @bar() nounwind {
; CHECK: ret i32 0
entry:
- %str1 = getelementptr inbounds [2 x i8]* @real_init, i64 0, i64 0
- %str2 = getelementptr inbounds [2 x i8]* @.str, i64 0, i64 0
+ %str1 = getelementptr inbounds [2 x i8], [2 x i8]* @real_init, i64 0, i64 0
+ %str2 = getelementptr inbounds [2 x i8], [2 x i8]* @.str, i64 0, i64 0
%temp1 = call i32 @strcmp(i8* %str1, i8* %str2) nounwind readonly
ret i32 %temp1
}
diff --git a/test/Transforms/InstCombine/x86-insertps.ll b/test/Transforms/InstCombine/x86-insertps.ll
new file mode 100644
index 0000000000000..092bf7c6c6244
--- /dev/null
+++ b/test/Transforms/InstCombine/x86-insertps.ll
@@ -0,0 +1,150 @@
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+declare <4 x float> @llvm.x86.sse41.insertps(<4 x float>, <4 x float>, i8) nounwind readnone
+
+; This should never happen, but make sure we don't crash handling a non-constant immediate byte.
+
+define <4 x float> @insertps_non_const_imm(<4 x float> %v1, <4 x float> %v2, i8 %c) {
+ %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v2, i8 %c)
+ ret <4 x float> %res
+
+; CHECK-LABEL: @insertps_non_const_imm
+; CHECK-NEXT: call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v2, i8 %c)
+; CHECK-NEXT: ret <4 x float>
+}
+
+; If all zero mask bits are set, return a zero regardless of the other control bits.
+
+define <4 x float> @insertps_0x0f(<4 x float> %v1, <4 x float> %v2) {
+ %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v2, i8 15)
+ ret <4 x float> %res
+
+; CHECK-LABEL: @insertps_0x0f
+; CHECK-NEXT: ret <4 x float> zeroinitializer
+}
+define <4 x float> @insertps_0xff(<4 x float> %v1, <4 x float> %v2) {
+ %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v2, i8 255)
+ ret <4 x float> %res
+
+; CHECK-LABEL: @insertps_0xff
+; CHECK-NEXT: ret <4 x float> zeroinitializer
+}
+
+; If some zero mask bits are set that do not override the insertion, we do not change anything.
+
+define <4 x float> @insertps_0x0c(<4 x float> %v1, <4 x float> %v2) {
+ %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v2, i8 12)
+ ret <4 x float> %res
+
+; CHECK-LABEL: @insertps_0x0c
+; CHECK-NEXT: call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v2, i8 12)
+; CHECK-NEXT: ret <4 x float>
+}
+
+; ...unless both input vectors are the same operand.
+
+define <4 x float> @insertps_0x15_single_input(<4 x float> %v1) {
+ %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v1, i8 21)
+ ret <4 x float> %res
+
+; CHECK-LABEL: @insertps_0x15_single_input
+; CHECK-NEXT: shufflevector <4 x float> %v1, <4 x float> <float 0.000000e+00, float undef, float 0.000000e+00, float undef>, <4 x i32> <i32 4, i32 0, i32 6, i32 3>
+; CHECK-NEXT: ret <4 x float>
+}
+
+; The zero mask overrides the insertion lane.
+
+define <4 x float> @insertps_0x1a_single_input(<4 x float> %v1) {
+ %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v1, i8 26)
+ ret <4 x float> %res
+
+; CHECK-LABEL: @insertps_0x1a_single_input
+; CHECK-NEXT: shufflevector <4 x float> %v1, <4 x float> <float undef, float 0.000000e+00, float undef, float 0.000000e+00>, <4 x i32> <i32 0, i32 5, i32 2, i32 7>
+; CHECK-NEXT: ret <4 x float>
+}
+
+; The zero mask overrides the insertion lane, so the second input vector is not used.
+
+define <4 x float> @insertps_0xc1(<4 x float> %v1, <4 x float> %v2) {
+ %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v2, i8 193)
+ ret <4 x float> %res
+
+; CHECK-LABEL: @insertps_0xc1
+; CHECK-NEXT: shufflevector <4 x float> %v1, <4 x float> <float 0.000000e+00, float undef, float undef, float undef>, <4 x i32> <i32 4, i32 1, i32 2, i32 3>
+; CHECK-NEXT: ret <4 x float>
+}
+
+; If no zero mask bits are set, convert to a shuffle.
+
+define <4 x float> @insertps_0x00(<4 x float> %v1, <4 x float> %v2) {
+ %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v2, i8 0)
+ ret <4 x float> %res
+
+; CHECK-LABEL: @insertps_0x00
+; CHECK-NEXT: shufflevector <4 x float> %v1, <4 x float> %v2, <4 x i32> <i32 4, i32 1, i32 2, i32 3>
+; CHECK-NEXT: ret <4 x float>
+}
+
+define <4 x float> @insertps_0x10(<4 x float> %v1, <4 x float> %v2) {
+ %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v2, i8 16)
+ ret <4 x float> %res
+
+; CHECK-LABEL: @insertps_0x10
+; CHECK-NEXT: shufflevector <4 x float> %v1, <4 x float> %v2, <4 x i32> <i32 0, i32 4, i32 2, i32 3>
+; CHECK-NEXT: ret <4 x float>
+}
+
+define <4 x float> @insertps_0x20(<4 x float> %v1, <4 x float> %v2) {
+ %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v2, i8 32)
+ ret <4 x float> %res
+
+; CHECK-LABEL: @insertps_0x20
+; CHECK-NEXT: shufflevector <4 x float> %v1, <4 x float> %v2, <4 x i32> <i32 0, i32 1, i32 4, i32 3>
+; CHECK-NEXT: ret <4 x float>
+}
+
+define <4 x float> @insertps_0x30(<4 x float> %v1, <4 x float> %v2) {
+ %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v2, i8 48)
+ ret <4 x float> %res
+
+; CHECK-LABEL: @insertps_0x30
+; CHECK-NEXT: shufflevector <4 x float> %v1, <4 x float> %v2, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
+; CHECK-NEXT: ret <4 x float>
+}
+
+define <4 x float> @insertps_0xc0(<4 x float> %v1, <4 x float> %v2) {
+ %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v2, i8 192)
+ ret <4 x float> %res
+
+; CHECK-LABEL: @insertps_0xc0
+; CHECK-NEXT: shufflevector <4 x float> %v1, <4 x float> %v2, <4 x i32> <i32 7, i32 1, i32 2, i32 3>
+; CHECK-NEXT: ret <4 x float>
+}
+
+define <4 x float> @insertps_0xd0(<4 x float> %v1, <4 x float> %v2) {
+ %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v2, i8 208)
+ ret <4 x float> %res
+
+; CHECK-LABEL: @insertps_0xd0
+; CHECK-NEXT: shufflevector <4 x float> %v1, <4 x float> %v2, <4 x i32> <i32 0, i32 7, i32 2, i32 3>
+; CHECK-NEXT: ret <4 x float>
+}
+
+define <4 x float> @insertps_0xe0(<4 x float> %v1, <4 x float> %v2) {
+ %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v2, i8 224)
+ ret <4 x float> %res
+
+; CHECK-LABEL: @insertps_0xe0
+; CHECK-NEXT: shufflevector <4 x float> %v1, <4 x float> %v2, <4 x i32> <i32 0, i32 1, i32 7, i32 3>
+; CHECK-NEXT: ret <4 x float>
+}
+
+define <4 x float> @insertps_0xf0(<4 x float> %v1, <4 x float> %v2) {
+ %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %v1, <4 x float> %v2, i8 240)
+ ret <4 x float> %res
+
+; CHECK-LABEL: @insertps_0xf0
+; CHECK-NEXT: shufflevector <4 x float> %v1, <4 x float> %v2, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
+; CHECK-NEXT: ret <4 x float>
+}
+
diff --git a/test/Transforms/InstCombine/x86-vperm2.ll b/test/Transforms/InstCombine/x86-vperm2.ll
new file mode 100644
index 0000000000000..5c60852dddb60
--- /dev/null
+++ b/test/Transforms/InstCombine/x86-vperm2.ll
@@ -0,0 +1,283 @@
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+; This should never happen, but make sure we don't crash handling a non-constant immediate byte.
+
+define <4 x double> @perm2pd_non_const_imm(<4 x double> %a0, <4 x double> %a1, i8 %b) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 %b)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_non_const_imm
+; CHECK-NEXT: call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 %b)
+; CHECK-NEXT: ret <4 x double>
+}
+
+
+; In the following 4 tests, both zero mask bits of the immediate are set.
+
+define <4 x double> @perm2pd_0x88(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 136)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x88
+; CHECK-NEXT: ret <4 x double> zeroinitializer
+}
+
+define <8 x float> @perm2ps_0x88(<8 x float> %a0, <8 x float> %a1) {
+ %res = call <8 x float> @llvm.x86.avx.vperm2f128.ps.256(<8 x float> %a0, <8 x float> %a1, i8 136)
+ ret <8 x float> %res
+
+; CHECK-LABEL: @perm2ps_0x88
+; CHECK-NEXT: ret <8 x float> zeroinitializer
+}
+
+define <8 x i32> @perm2si_0x88(<8 x i32> %a0, <8 x i32> %a1) {
+ %res = call <8 x i32> @llvm.x86.avx.vperm2f128.si.256(<8 x i32> %a0, <8 x i32> %a1, i8 136)
+ ret <8 x i32> %res
+
+; CHECK-LABEL: @perm2si_0x88
+; CHECK-NEXT: ret <8 x i32> zeroinitializer
+}
+
+define <4 x i64> @perm2i_0x88(<4 x i64> %a0, <4 x i64> %a1) {
+ %res = call <4 x i64> @llvm.x86.avx2.vperm2i128(<4 x i64> %a0, <4 x i64> %a1, i8 136)
+ ret <4 x i64> %res
+
+; CHECK-LABEL: @perm2i_0x88
+; CHECK-NEXT: ret <4 x i64> zeroinitializer
+}
+
+
+; The other control bits are ignored when zero mask bits of the immediate are set.
+
+define <4 x double> @perm2pd_0xff(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 255)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0xff
+; CHECK-NEXT: ret <4 x double> zeroinitializer
+}
+
+
+; The following 16 tests are simple shuffles, except for 2 cases where we can just return one of the
+; source vectors. Verify that we generate the right shuffle masks and undef source operand where possible..
+
+define <4 x double> @perm2pd_0x00(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 0)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x00
+; CHECK-NEXT: %1 = shufflevector <4 x double> %a0, <4 x double> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
+; CHECK-NEXT: ret <4 x double> %1
+}
+
+define <4 x double> @perm2pd_0x01(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 1)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x01
+; CHECK-NEXT: %1 = shufflevector <4 x double> %a0, <4 x double> undef, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
+; CHECK-NEXT: ret <4 x double> %1
+}
+
+define <4 x double> @perm2pd_0x02(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 2)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x02
+; CHECK-NEXT: %1 = shufflevector <4 x double> %a1, <4 x double> %a0, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
+; CHECK-NEXT: ret <4 x double> %1
+}
+
+define <4 x double> @perm2pd_0x03(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 3)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x03
+; CHECK-NEXT: %1 = shufflevector <4 x double> %a1, <4 x double> %a0, <4 x i32> <i32 2, i32 3, i32 4, i32 5>
+; CHECK-NEXT: ret <4 x double> %1
+}
+
+define <4 x double> @perm2pd_0x10(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 16)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x10
+; CHECK-NEXT: ret <4 x double> %a0
+}
+
+define <4 x double> @perm2pd_0x11(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 17)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x11
+; CHECK-NEXT: %1 = shufflevector <4 x double> %a0, <4 x double> undef, <4 x i32> <i32 2, i32 3, i32 2, i32 3>
+; CHECK-NEXT: ret <4 x double> %1
+}
+
+define <4 x double> @perm2pd_0x12(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 18)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x12
+; CHECK-NEXT: %1 = shufflevector <4 x double> %a1, <4 x double> %a0, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
+; CHECK-NEXT: ret <4 x double> %1
+}
+
+define <4 x double> @perm2pd_0x13(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 19)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x13
+; CHECK-NEXT: %1 = shufflevector <4 x double> %a1, <4 x double> %a0, <4 x i32> <i32 2, i32 3, i32 6, i32 7>
+; CHECK-NEXT: ret <4 x double> %1
+}
+
+define <4 x double> @perm2pd_0x20(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 32)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x20
+; CHECK-NEXT: %1 = shufflevector <4 x double> %a0, <4 x double> %a1, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
+; CHECK-NEXT: ret <4 x double> %1
+}
+
+define <4 x double> @perm2pd_0x21(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 33)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x21
+; CHECK-NEXT: %1 = shufflevector <4 x double> %a0, <4 x double> %a1, <4 x i32> <i32 2, i32 3, i32 4, i32 5>
+; CHECK-NEXT: ret <4 x double> %1
+}
+
+define <4 x double> @perm2pd_0x22(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 34)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x22
+; CHECK-NEXT: %1 = shufflevector <4 x double> %a1, <4 x double> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
+; CHECK-NEXT: ret <4 x double> %1
+}
+
+define <4 x double> @perm2pd_0x23(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 35)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x23
+; CHECK-NEXT: %1 = shufflevector <4 x double> %a1, <4 x double> undef, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
+; CHECK-NEXT: ret <4 x double> %1
+}
+
+define <4 x double> @perm2pd_0x30(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 48)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x30
+; CHECK-NEXT: %1 = shufflevector <4 x double> %a0, <4 x double> %a1, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
+; CHECK-NEXT: ret <4 x double> %1
+}
+
+define <4 x double> @perm2pd_0x31(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 49)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x31
+; CHECK-NEXT: %1 = shufflevector <4 x double> %a0, <4 x double> %a1, <4 x i32> <i32 2, i32 3, i32 6, i32 7>
+; CHECK-NEXT: ret <4 x double> %1
+}
+
+define <4 x double> @perm2pd_0x32(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 50)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x32
+; CHECK-NEXT: ret <4 x double> %a1
+}
+
+define <4 x double> @perm2pd_0x33(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 51)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x33
+; CHECK-NEXT: %1 = shufflevector <4 x double> %a1, <4 x double> undef, <4 x i32> <i32 2, i32 3, i32 2, i32 3>
+; CHECK-NEXT: ret <4 x double> %1
+}
+
+; Confirm that a mask for 32-bit elements is also correct.
+
+define <8 x float> @perm2ps_0x31(<8 x float> %a0, <8 x float> %a1) {
+ %res = call <8 x float> @llvm.x86.avx.vperm2f128.ps.256(<8 x float> %a0, <8 x float> %a1, i8 49)
+ ret <8 x float> %res
+
+; CHECK-LABEL: @perm2ps_0x31
+; CHECK-NEXT: %1 = shufflevector <8 x float> %a0, <8 x float> %a1, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 12, i32 13, i32 14, i32 15>
+; CHECK-NEXT: ret <8 x float> %1
+}
+
+
+; Confirm that the AVX2 version works the same.
+
+define <4 x i64> @perm2i_0x33(<4 x i64> %a0, <4 x i64> %a1) {
+ %res = call <4 x i64> @llvm.x86.avx2.vperm2i128(<4 x i64> %a0, <4 x i64> %a1, i8 51)
+ ret <4 x i64> %res
+
+; CHECK-LABEL: @perm2i_0x33
+; CHECK-NEXT: %1 = shufflevector <4 x i64> %a1, <4 x i64> undef, <4 x i32> <i32 2, i32 3, i32 2, i32 3>
+; CHECK-NEXT: ret <4 x i64> %1
+}
+
+
+; Confirm that when a single zero mask bit is set, we replace a source vector with zeros.
+
+define <4 x double> @perm2pd_0x81(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 129)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x81
+; CHECK-NEXT: shufflevector <4 x double> %a0, <4 x double> <double 0.0{{.*}}<4 x i32> <i32 2, i32 3, i32 4, i32 5>
+; CHECK-NEXT: ret <4 x double>
+}
+
+define <4 x double> @perm2pd_0x83(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 131)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x83
+; CHECK-NEXT: shufflevector <4 x double> %a1, <4 x double> <double 0.0{{.*}}, <4 x i32> <i32 2, i32 3, i32 4, i32 5>
+; CHECK-NEXT: ret <4 x double>
+}
+
+define <4 x double> @perm2pd_0x28(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 40)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x28
+; CHECK-NEXT: shufflevector <4 x double> <double 0.0{{.*}}, <4 x double> %a1, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
+; CHECK-NEXT: ret <4 x double>
+}
+
+define <4 x double> @perm2pd_0x08(<4 x double> %a0, <4 x double> %a1) {
+ %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 8)
+ ret <4 x double> %res
+
+; CHECK-LABEL: @perm2pd_0x08
+; CHECK-NEXT: shufflevector <4 x double> <double 0.0{{.*}}, <4 x double> %a0, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
+; CHECK-NEXT: ret <4 x double>
+}
+
+; Check one more with the AVX2 version.
+
+define <4 x i64> @perm2i_0x28(<4 x i64> %a0, <4 x i64> %a1) {
+ %res = call <4 x i64> @llvm.x86.avx2.vperm2i128(<4 x i64> %a0, <4 x i64> %a1, i8 40)
+ ret <4 x i64> %res
+
+; CHECK-LABEL: @perm2i_0x28
+; CHECK-NEXT: shufflevector <4 x i64> <i64 0{{.*}}, <4 x i64> %a1, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
+; CHECK-NEXT: ret <4 x i64>
+}
+
+declare <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double>, <4 x double>, i8) nounwind readnone
+declare <8 x float> @llvm.x86.avx.vperm2f128.ps.256(<8 x float>, <8 x float>, i8) nounwind readnone
+declare <8 x i32> @llvm.x86.avx.vperm2f128.si.256(<8 x i32>, <8 x i32>, i8) nounwind readnone
+declare <4 x i64> @llvm.x86.avx2.vperm2i128(<4 x i64>, <4 x i64>, i8) nounwind readnone
+
diff --git a/test/Transforms/InstCombine/xor.ll b/test/Transforms/InstCombine/xor.ll
index c8debcbac226a..33d5a2a9fda5f 100644
--- a/test/Transforms/InstCombine/xor.ll
+++ b/test/Transforms/InstCombine/xor.ll
@@ -63,8 +63,8 @@ define i32 @test7(i32 %A, i32 %B) {
; CHECK-LABEL: @test7(
; CHECK-NEXT: %A1 = and i32 %A, 7
; CHECK-NEXT: %B1 = and i32 %B, 128
-; CHECK-NEXT: %C11 = or i32 %A1, %B1
-; CHECK-NEXT: ret i32 %C11
+; CHECK-NEXT: %C1.1 = or i32 %A1, %B1
+; CHECK-NEXT: ret i32 %C1.1
%A1 = and i32 %A, 7 ; <i32> [#uses=1]
%B1 = and i32 %B, 128 ; <i32> [#uses=1]
%C1 = xor i32 %A1, %B1 ; <i32> [#uses=1]
@@ -96,8 +96,8 @@ define i1 @test9(i8 %A) {
define i8 @test10(i8 %A) {
; CHECK-LABEL: @test10(
; CHECK-NEXT: %B = and i8 %A, 3
-; CHECK-NEXT: %C1 = or i8 %B, 4
-; CHECK-NEXT: ret i8 %C1
+; CHECK-NEXT: %C.1 = or i8 %B, 4
+; CHECK-NEXT: ret i8 %C.1
%B = and i8 %A, 3 ; <i8> [#uses=1]
%C = xor i8 %B, 4 ; <i8> [#uses=1]
ret i8 %C
diff --git a/test/Transforms/InstCombine/zext-or-icmp.ll b/test/Transforms/InstCombine/zext-or-icmp.ll
index ddc60834f586a..3a27f9a124cba 100644
--- a/test/Transforms/InstCombine/zext-or-icmp.ll
+++ b/test/Transforms/InstCombine/zext-or-icmp.ll
@@ -10,19 +10,19 @@ entry:
%tmp3 = and i32 %tmp2, 2 ; <i32> [#uses=1]
%tmp5 = and i32 %blk_i, 1 ; <i32> [#uses=1]
%tmp6 = or i32 %tmp3, %tmp5 ; <i32> [#uses=1]
- %tmp8 = getelementptr %struct.FooBar* %up, i32 0, i32 7 ; <i16*> [#uses=1]
- %tmp9 = load i16* %tmp8, align 1 ; <i16> [#uses=1]
+ %tmp8 = getelementptr %struct.FooBar, %struct.FooBar* %up, i32 0, i32 7 ; <i16*> [#uses=1]
+ %tmp9 = load i16, i16* %tmp8, align 1 ; <i16> [#uses=1]
%tmp910 = zext i16 %tmp9 to i32 ; <i32> [#uses=1]
- %tmp12 = getelementptr [4 x i8]* @some_idx, i32 0, i32 %tmp6 ; <i8*> [#uses=1]
- %tmp13 = load i8* %tmp12, align 1 ; <i8> [#uses=1]
+ %tmp12 = getelementptr [4 x i8], [4 x i8]* @some_idx, i32 0, i32 %tmp6 ; <i8*> [#uses=1]
+ %tmp13 = load i8, i8* %tmp12, align 1 ; <i8> [#uses=1]
%tmp1314 = zext i8 %tmp13 to i32 ; <i32> [#uses=1]
%tmp151 = lshr i32 %tmp910, %tmp1314 ; <i32> [#uses=1]
%tmp1516 = trunc i32 %tmp151 to i8 ; <i8> [#uses=1]
- %tmp18 = getelementptr %struct.FooBar* %up, i32 0, i32 0 ; <i8*> [#uses=1]
- %tmp19 = load i8* %tmp18, align 1 ; <i8> [#uses=1]
+ %tmp18 = getelementptr %struct.FooBar, %struct.FooBar* %up, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp19 = load i8, i8* %tmp18, align 1 ; <i8> [#uses=1]
%tmp22 = and i8 %tmp1516, %tmp19 ; <i8> [#uses=1]
- %tmp24 = getelementptr %struct.FooBar* %up, i32 0, i32 0 ; <i8*> [#uses=1]
- %tmp25 = load i8* %tmp24, align 1 ; <i8> [#uses=1]
+ %tmp24 = getelementptr %struct.FooBar, %struct.FooBar* %up, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp25 = load i8, i8* %tmp24, align 1 ; <i8> [#uses=1]
%tmp26.mask = and i8 %tmp25, 1 ; <i8> [#uses=1]
%toBool = icmp eq i8 %tmp26.mask, 0 ; <i1> [#uses=1]
%toBool.not = xor i1 %toBool, true ; <i1> [#uses=1]