[llvm] 42d98d8 - [MemCpyOpt] Convert tests to opaque pointers (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 5 05:54:30 PDT 2022
Author: Nikita Popov
Date: 2022-10-05T14:53:50+02:00
New Revision: 42d98d80fb86b0eb7058a7288e7a4c900f04c556
URL: https://github.com/llvm/llvm-project/commit/42d98d80fb86b0eb7058a7288e7a4c900f04c556
DIFF: https://github.com/llvm/llvm-project/commit/42d98d80fb86b0eb7058a7288e7a4c900f04c556.diff
LOG: [MemCpyOpt] Convert tests to opaque pointers (NFC)
Converted using the script at
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34.
Added:
Modified:
llvm/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll
llvm/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll
llvm/test/Transforms/MemCpyOpt/2011-06-02-CallSlotOverwritten.ll
llvm/test/Transforms/MemCpyOpt/aa-recursion-assertion-failure.ll
llvm/test/Transforms/MemCpyOpt/align.ll
llvm/test/Transforms/MemCpyOpt/atomic.ll
llvm/test/Transforms/MemCpyOpt/byval-readnone.ll
llvm/test/Transforms/MemCpyOpt/callslot.ll
llvm/test/Transforms/MemCpyOpt/callslot_aa.ll
llvm/test/Transforms/MemCpyOpt/callslot_badaa.ll
llvm/test/Transforms/MemCpyOpt/callslot_deref.ll
llvm/test/Transforms/MemCpyOpt/callslot_noalias.ll
llvm/test/Transforms/MemCpyOpt/callslot_throw.ll
llvm/test/Transforms/MemCpyOpt/capturing-func.ll
llvm/test/Transforms/MemCpyOpt/crash.ll
llvm/test/Transforms/MemCpyOpt/fca2memcpy.ll
llvm/test/Transforms/MemCpyOpt/form-memset.ll
llvm/test/Transforms/MemCpyOpt/invariant.start.ll
llvm/test/Transforms/MemCpyOpt/lifetime.ll
llvm/test/Transforms/MemCpyOpt/load-store-to-memcpy.ll
llvm/test/Transforms/MemCpyOpt/loadstore-sret.ll
llvm/test/Transforms/MemCpyOpt/memcpy-byval-forwarding-clobbers.ll
llvm/test/Transforms/MemCpyOpt/memcpy-in-loop.ll
llvm/test/Transforms/MemCpyOpt/memcpy-invoke-memcpy.ll
llvm/test/Transforms/MemCpyOpt/memcpy-to-memset-with-lifetimes.ll
llvm/test/Transforms/MemCpyOpt/memcpy-to-memset.ll
llvm/test/Transforms/MemCpyOpt/memcpy-undef.ll
llvm/test/Transforms/MemCpyOpt/memcpy.ll
llvm/test/Transforms/MemCpyOpt/memmove.ll
llvm/test/Transforms/MemCpyOpt/memset-memcpy-oversized.ll
llvm/test/Transforms/MemCpyOpt/memset-memcpy-redundant-memset.ll
llvm/test/Transforms/MemCpyOpt/memset-memcpy-to-2x-memset.ll
llvm/test/Transforms/MemCpyOpt/merge-into-memset.ll
llvm/test/Transforms/MemCpyOpt/mixed-sizes.ll
llvm/test/Transforms/MemCpyOpt/non-integral.ll
llvm/test/Transforms/MemCpyOpt/nonlocal-memcpy-memcpy.ll
llvm/test/Transforms/MemCpyOpt/nontemporal.ll
llvm/test/Transforms/MemCpyOpt/pr29105.ll
llvm/test/Transforms/MemCpyOpt/pr37967.ll
llvm/test/Transforms/MemCpyOpt/pr54682.ll
llvm/test/Transforms/MemCpyOpt/preserve-memssa.ll
llvm/test/Transforms/MemCpyOpt/process_store.ll
llvm/test/Transforms/MemCpyOpt/profitable-memset.ll
llvm/test/Transforms/MemCpyOpt/smaller.ll
llvm/test/Transforms/MemCpyOpt/sret.ll
llvm/test/Transforms/MemCpyOpt/stackrestore.ll
llvm/test/Transforms/MemCpyOpt/store-to-memset-is-nonzero-type.ll
llvm/test/Transforms/MemCpyOpt/store-to-memset.ll
llvm/test/Transforms/MemCpyOpt/variable-sized-memcpy-memcpy.ll
llvm/test/Transforms/MemCpyOpt/variable-sized-memcpy-uninit.ll
llvm/test/Transforms/MemCpyOpt/variable-sized-memset-memcpy.ll
llvm/test/Transforms/MemCpyOpt/vscale-crashes.ll
llvm/test/Transforms/MemCpyOpt/vscale-memset.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll b/llvm/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll
index de4965a3b5d9..ec967ff862fb 100644
--- a/llvm/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll
+++ b/llvm/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll
@@ -7,24 +7,22 @@ target triple = "i386-pc-linux-gnu"
%0 = type { x86_fp80, x86_fp80 }
-define internal fastcc void @initialize(%0* noalias nocapture sret(%0) %agg.result) nounwind {
+define internal fastcc void @initialize(ptr noalias nocapture sret(%0) %agg.result) nounwind {
; CHECK-LABEL: @initialize(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[AGG_RESULT_03:%.*]] = getelementptr [[TMP0:%.*]], %0* [[AGG_RESULT:%.*]], i32 0, i32 0
-; CHECK-NEXT: store x86_fp80 0xK00000000000000000000, x86_fp80* [[AGG_RESULT_03]], align 4
-; CHECK-NEXT: [[AGG_RESULT_15:%.*]] = getelementptr [[TMP0]], %0* [[AGG_RESULT]], i32 0, i32 1
-; CHECK-NEXT: store x86_fp80 0xK00000000000000000000, x86_fp80* [[AGG_RESULT_15]], align 4
+; CHECK-NEXT: store x86_fp80 0xK00000000000000000000, ptr [[AGG_RESULT:%.*]], align 4
+; CHECK-NEXT: [[AGG_RESULT_15:%.*]] = getelementptr [[TMP0:%.*]], ptr [[AGG_RESULT]], i32 0, i32 1
+; CHECK-NEXT: store x86_fp80 0xK00000000000000000000, ptr [[AGG_RESULT_15]], align 4
; CHECK-NEXT: ret void
;
entry:
- %agg.result.03 = getelementptr %0, %0* %agg.result, i32 0, i32 0
- store x86_fp80 0xK00000000000000000000, x86_fp80* %agg.result.03
- %agg.result.15 = getelementptr %0, %0* %agg.result, i32 0, i32 1
- store x86_fp80 0xK00000000000000000000, x86_fp80* %agg.result.15
+ store x86_fp80 0xK00000000000000000000, ptr %agg.result
+ %agg.result.15 = getelementptr %0, ptr %agg.result, i32 0, i32 1
+ store x86_fp80 0xK00000000000000000000, ptr %agg.result.15
ret void
}
-declare fastcc x86_fp80 @passed_uninitialized(%0* nocapture) nounwind
+declare fastcc x86_fp80 @passed_uninitialized(ptr nocapture) nounwind
define fastcc void @badly_optimized() nounwind {
; CHECK-LABEL: @badly_optimized(
@@ -32,27 +30,19 @@ define fastcc void @badly_optimized() nounwind {
; CHECK-NEXT: [[Z:%.*]] = alloca [[TMP0:%.*]], align 8
; CHECK-NEXT: [[TMP:%.*]] = alloca [[TMP0]], align 8
; CHECK-NEXT: [[MEMTMP:%.*]] = alloca [[TMP0]], align 8
-; CHECK-NEXT: call fastcc void @initialize(%0* noalias sret(%0) [[Z]])
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast %0* [[TMP]] to i8*
-; CHECK-NEXT: [[MEMTMP2:%.*]] = bitcast %0* [[MEMTMP]] to i8*
-; CHECK-NEXT: [[Z3:%.*]] = bitcast %0* [[Z]] to i8*
-; CHECK-NEXT: [[TMP4:%.*]] = bitcast %0* [[TMP]] to i8*
-; CHECK-NEXT: [[TMP5:%.*]] = call fastcc x86_fp80 @passed_uninitialized(%0* [[Z]])
+; CHECK-NEXT: call fastcc void @initialize(ptr noalias sret([[TMP0]]) [[Z]])
+; CHECK-NEXT: [[TMP5:%.*]] = call fastcc x86_fp80 @passed_uninitialized(ptr [[Z]])
; CHECK-NEXT: ret void
;
entry:
%z = alloca %0
%tmp = alloca %0
%memtmp = alloca %0, align 8
- call fastcc void @initialize(%0* noalias sret(%0) %memtmp)
- %tmp1 = bitcast %0* %tmp to i8*
- %memtmp2 = bitcast %0* %memtmp to i8*
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %tmp1, i8* align 8 %memtmp2, i32 24, i1 false)
- %z3 = bitcast %0* %z to i8*
- %tmp4 = bitcast %0* %tmp to i8*
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %z3, i8* align 8 %tmp4, i32 24, i1 false)
- %tmp5 = call fastcc x86_fp80 @passed_uninitialized(%0* %z)
+ call fastcc void @initialize(ptr noalias sret(%0) %memtmp)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 8 %tmp, ptr align 8 %memtmp, i32 24, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 8 %z, ptr align 8 %tmp, i32 24, i1 false)
+ %tmp5 = call fastcc x86_fp80 @passed_uninitialized(ptr %z)
ret void
}
-declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind
+declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind
diff --git a/llvm/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll b/llvm/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll
index 089199d19c9f..36e46938c3e0 100644
--- a/llvm/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll
+++ b/llvm/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll
@@ -5,31 +5,24 @@ target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
%a = type { i32 }
%b = type { float }
-declare void @g(%a* nocapture)
+declare void @g(ptr nocapture)
define float @f() {
; CHECK-LABEL: @f(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[A_VAR:%.*]] = alloca [[A:%.*]], align 8
; CHECK-NEXT: [[B_VAR:%.*]] = alloca [[B:%.*]], align 8
-; CHECK-NEXT: [[B_VAR1:%.*]] = bitcast %b* [[B_VAR]] to %a*
-; CHECK-NEXT: call void @g(%a* [[B_VAR1]])
-; CHECK-NEXT: [[A_I8:%.*]] = bitcast %a* [[A_VAR]] to i8*
-; CHECK-NEXT: [[B_I8:%.*]] = bitcast %b* [[B_VAR]] to i8*
-; CHECK-NEXT: [[TMP1:%.*]] = getelementptr [[B]], %b* [[B_VAR]], i32 0, i32 0
-; CHECK-NEXT: [[TMP2:%.*]] = load float, float* [[TMP1]], align 4
+; CHECK-NEXT: call void @g(ptr [[B_VAR]])
+; CHECK-NEXT: [[TMP2:%.*]] = load float, ptr [[B_VAR]], align 4
; CHECK-NEXT: ret float [[TMP2]]
;
entry:
%a_var = alloca %a
%b_var = alloca %b, align 1
- call void @g(%a* %a_var)
- %a_i8 = bitcast %a* %a_var to i8*
- %b_i8 = bitcast %b* %b_var to i8*
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %b_i8, i8* %a_i8, i32 4, i1 false)
- %tmp1 = getelementptr %b, %b* %b_var, i32 0, i32 0
- %tmp2 = load float, float* %tmp1
+ call void @g(ptr %a_var)
+ call void @llvm.memcpy.p0.p0.i32(ptr %b_var, ptr %a_var, i32 4, i1 false)
+ %tmp2 = load float, ptr %b_var
ret float %tmp2
}
-declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind
+declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind
diff --git a/llvm/test/Transforms/MemCpyOpt/2011-06-02-CallSlotOverwritten.ll b/llvm/test/Transforms/MemCpyOpt/2011-06-02-CallSlotOverwritten.ll
index 10c8ff1c7b9f..e58e0635de1a 100644
--- a/llvm/test/Transforms/MemCpyOpt/2011-06-02-CallSlotOverwritten.ll
+++ b/llvm/test/Transforms/MemCpyOpt/2011-06-02-CallSlotOverwritten.ll
@@ -8,43 +8,35 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
target triple = "i386-apple-darwin10"
%struct1 = type { i32, i32 }
-%struct2 = type { %struct1, i8* }
+%struct2 = type { %struct1, ptr }
-declare void @bar(%struct1* nocapture sret(%struct1) %agg.result) nounwind
+declare void @bar(ptr nocapture sret(%struct1) %agg.result) nounwind
define i32 @foo() nounwind {
; CHECK-LABEL: @foo(
; CHECK-NEXT: [[X:%.*]] = alloca [[STRUCT1:%.*]], align 8
; CHECK-NEXT: [[Y:%.*]] = alloca [[STRUCT2:%.*]], align 8
-; CHECK-NEXT: call void @bar(%struct1* sret(%struct1) [[X]]) [[ATTR0:#.*]]
-; CHECK-NEXT: [[GEPN1:%.*]] = getelementptr inbounds [[STRUCT2]], %struct2* [[Y]], i32 0, i32 0, i32 0
-; CHECK-NEXT: store i32 0, i32* [[GEPN1]], align 8
-; CHECK-NEXT: [[GEPN2:%.*]] = getelementptr inbounds [[STRUCT2]], %struct2* [[Y]], i32 0, i32 0, i32 1
-; CHECK-NEXT: store i32 0, i32* [[GEPN2]], align 4
-; CHECK-NEXT: [[BIT1:%.*]] = bitcast %struct1* [[X]] to i64*
-; CHECK-NEXT: [[BIT2:%.*]] = bitcast %struct2* [[Y]] to i64*
-; CHECK-NEXT: [[LOAD:%.*]] = load i64, i64* [[BIT1]], align 8
-; CHECK-NEXT: store i64 [[LOAD]], i64* [[BIT2]], align 8
-; CHECK-NEXT: [[GEP1:%.*]] = getelementptr [[STRUCT2]], %struct2* [[Y]], i32 0, i32 0, i32 0
-; CHECK-NEXT: [[RET:%.*]] = load i32, i32* [[GEP1]], align 4
+; CHECK-NEXT: call void @bar(ptr sret(%struct1) [[X]]) [[ATTR0:#.*]]
+; CHECK-NEXT: store i32 0, ptr [[Y]], align 8
+; CHECK-NEXT: [[GEPN2:%.*]] = getelementptr inbounds [[STRUCT2]], ptr [[Y]], i32 0, i32 0, i32 1
+; CHECK-NEXT: store i32 0, ptr [[GEPN2]], align 4
+; CHECK-NEXT: [[LOAD:%.*]] = load i64, ptr [[X]], align 8
+; CHECK-NEXT: store i64 [[LOAD]], ptr [[Y]], align 8
+; CHECK-NEXT: [[RET:%.*]] = load i32, ptr [[Y]], align 4
; CHECK-NEXT: ret i32 [[RET]]
;
%x = alloca %struct1, align 8
%y = alloca %struct2, align 8
- call void @bar(%struct1* sret(%struct1) %x) nounwind
+ call void @bar(ptr sret(%struct1) %x) nounwind
- %gepn1 = getelementptr inbounds %struct2, %struct2* %y, i32 0, i32 0, i32 0
- store i32 0, i32* %gepn1, align 8
- %gepn2 = getelementptr inbounds %struct2, %struct2* %y, i32 0, i32 0, i32 1
- store i32 0, i32* %gepn2, align 4
+ store i32 0, ptr %y, align 8
+ %gepn2 = getelementptr inbounds %struct2, ptr %y, i32 0, i32 0, i32 1
+ store i32 0, ptr %gepn2, align 4
- %bit1 = bitcast %struct1* %x to i64*
- %bit2 = bitcast %struct2* %y to i64*
- %load = load i64, i64* %bit1, align 8
- store i64 %load, i64* %bit2, align 8
+ %load = load i64, ptr %x, align 8
+ store i64 %load, ptr %y, align 8
- %gep1 = getelementptr %struct2, %struct2* %y, i32 0, i32 0, i32 0
- %ret = load i32, i32* %gep1
+ %ret = load i32, ptr %y
ret i32 %ret
}
diff --git a/llvm/test/Transforms/MemCpyOpt/aa-recursion-assertion-failure.ll b/llvm/test/Transforms/MemCpyOpt/aa-recursion-assertion-failure.ll
index 89529030004f..98a911bc5e7c 100644
--- a/llvm/test/Transforms/MemCpyOpt/aa-recursion-assertion-failure.ll
+++ b/llvm/test/Transforms/MemCpyOpt/aa-recursion-assertion-failure.ll
@@ -14,30 +14,30 @@ define dso_local void @_Z1ml(i64 %e) {
; CHECK: for.cond.while.cond.loopexit_crit_edge.us-lcssa:
; CHECK-NEXT: br label [[WHILE_COND_LOOPEXIT:%.*]]
; CHECK: while.cond.loopexit:
-; CHECK-NEXT: [[TMP0:%.*]] = phi i8* [ [[ADD_PTR_I:%.*]], [[FOR_COND_WHILE_COND_LOOPEXIT_CRIT_EDGE_US_LCSSA:%.*]] ], [ [[TMP1:%.*]], [[WHILE_COND]] ]
-; CHECK-NEXT: [[I_1_LCSSA:%.*]] = phi i8* [ [[I_2:%.*]], [[FOR_COND_WHILE_COND_LOOPEXIT_CRIT_EDGE_US_LCSSA]] ], [ [[I_0:%.*]], [[WHILE_COND]] ]
+; CHECK-NEXT: [[TMP0:%.*]] = phi ptr [ [[ADD_PTR_I:%.*]], [[FOR_COND_WHILE_COND_LOOPEXIT_CRIT_EDGE_US_LCSSA:%.*]] ], [ [[TMP1:%.*]], [[WHILE_COND]] ]
+; CHECK-NEXT: [[I_1_LCSSA:%.*]] = phi ptr [ [[I_2:%.*]], [[FOR_COND_WHILE_COND_LOOPEXIT_CRIT_EDGE_US_LCSSA]] ], [ [[I_0:%.*]], [[WHILE_COND]] ]
; CHECK-NEXT: br label [[WHILE_COND]]
; CHECK: while.cond:
-; CHECK-NEXT: [[TMP1]] = phi i8* [ [[L]], [[ENTRY:%.*]] ], [ [[TMP0]], [[WHILE_COND_LOOPEXIT]] ]
-; CHECK-NEXT: [[I_0]] = phi i8* [ [[L]], [[ENTRY]] ], [ [[I_1_LCSSA]], [[WHILE_COND_LOOPEXIT]] ]
+; CHECK-NEXT: [[TMP1]] = phi ptr [ [[L]], [[ENTRY:%.*]] ], [ [[TMP0]], [[WHILE_COND_LOOPEXIT]] ]
+; CHECK-NEXT: [[I_0]] = phi ptr [ [[L]], [[ENTRY]] ], [ [[I_1_LCSSA]], [[WHILE_COND_LOOPEXIT]] ]
; CHECK-NEXT: br i1 undef, label [[FOR_BODY_LR_PH:%.*]], label [[WHILE_COND_LOOPEXIT]]
; CHECK: for.body.lr.ph:
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
; CHECK: for.body:
-; CHECK-NEXT: [[TMP2:%.*]] = phi i8* [ [[TMP1]], [[FOR_BODY_LR_PH]] ], [ [[ADD_PTR_I]], [[IF_END5:%.*]] ]
-; CHECK-NEXT: [[I_15:%.*]] = phi i8* [ [[I_0]], [[FOR_BODY_LR_PH]] ], [ [[I_2]], [[IF_END5]] ]
-; CHECK-NEXT: [[ADD_PTR_I]] = getelementptr inbounds i8, i8* [[TMP2]], i64 [[E:%.*]]
-; CHECK-NEXT: [[TMP3:%.*]] = load i8, i8* [[TMP2]], align 1, !noalias !0
-; CHECK-NEXT: [[TMP4:%.*]] = load i8, i8* [[I_15]], align 1, !alias.scope !0
-; CHECK-NEXT: store i8 [[TMP4]], i8* [[TMP2]], align 1
+; CHECK-NEXT: [[TMP2:%.*]] = phi ptr [ [[TMP1]], [[FOR_BODY_LR_PH]] ], [ [[ADD_PTR_I]], [[IF_END5:%.*]] ]
+; CHECK-NEXT: [[I_15:%.*]] = phi ptr [ [[I_0]], [[FOR_BODY_LR_PH]] ], [ [[I_2]], [[IF_END5]] ]
+; CHECK-NEXT: [[ADD_PTR_I]] = getelementptr inbounds i8, ptr [[TMP2]], i64 [[E:%.*]]
+; CHECK-NEXT: [[TMP3:%.*]] = load i8, ptr [[TMP2]], align 1, !noalias !0
+; CHECK-NEXT: [[TMP4:%.*]] = load i8, ptr [[I_15]], align 1, !alias.scope !0
+; CHECK-NEXT: store i8 [[TMP4]], ptr [[TMP2]], align 1
; CHECK-NEXT: br label [[_Z1DPCS_L_EXIT:%.*]]
; CHECK: _Z1dPcS_l.exit:
; CHECK-NEXT: br i1 undef, label [[IF_THEN3:%.*]], label [[IF_END5]]
; CHECK: if.then3:
-; CHECK-NEXT: [[ADD_PTR4:%.*]] = getelementptr inbounds i8, i8* [[I_15]], i64 [[E]]
+; CHECK-NEXT: [[ADD_PTR4:%.*]] = getelementptr inbounds i8, ptr [[I_15]], i64 [[E]]
; CHECK-NEXT: br label [[IF_END5]]
; CHECK: if.end5:
-; CHECK-NEXT: [[I_2]] = phi i8* [ [[ADD_PTR4]], [[IF_THEN3]] ], [ [[I_15]], [[_Z1DPCS_L_EXIT]] ]
+; CHECK-NEXT: [[I_2]] = phi ptr [ [[ADD_PTR4]], [[IF_THEN3]] ], [ [[I_15]], [[_Z1DPCS_L_EXIT]] ]
; CHECK-NEXT: br i1 false, label [[FOR_BODY]], label [[FOR_COND_WHILE_COND_LOOPEXIT_CRIT_EDGE_US_LCSSA]]
;
entry:
@@ -48,36 +48,36 @@ for.cond.while.cond.loopexit_crit_edge.us-lcssa: ; preds = %if.end5
br label %while.cond.loopexit
while.cond.loopexit: ; preds = %while.cond, %for.cond.while.cond.loopexit_crit_edge.us-lcssa
- %0 = phi i8* [ %add.ptr.i, %for.cond.while.cond.loopexit_crit_edge.us-lcssa ], [ %1, %while.cond ]
- %i.1.lcssa = phi i8* [ %i.2, %for.cond.while.cond.loopexit_crit_edge.us-lcssa ], [ %i.0, %while.cond ]
+ %0 = phi ptr [ %add.ptr.i, %for.cond.while.cond.loopexit_crit_edge.us-lcssa ], [ %1, %while.cond ]
+ %i.1.lcssa = phi ptr [ %i.2, %for.cond.while.cond.loopexit_crit_edge.us-lcssa ], [ %i.0, %while.cond ]
br label %while.cond
while.cond: ; preds = %while.cond.loopexit, %entry
- %1 = phi i8* [ %l, %entry ], [ %0, %while.cond.loopexit ]
- %i.0 = phi i8* [ %l, %entry ], [ %i.1.lcssa, %while.cond.loopexit ]
+ %1 = phi ptr [ %l, %entry ], [ %0, %while.cond.loopexit ]
+ %i.0 = phi ptr [ %l, %entry ], [ %i.1.lcssa, %while.cond.loopexit ]
br i1 undef, label %for.body.lr.ph, label %while.cond.loopexit
for.body.lr.ph: ; preds = %while.cond
br label %for.body
for.body: ; preds = %if.end5, %for.body.lr.ph
- %2 = phi i8* [ %1, %for.body.lr.ph ], [ %add.ptr.i, %if.end5 ]
- %i.15 = phi i8* [ %i.0, %for.body.lr.ph ], [ %i.2, %if.end5 ]
- %add.ptr.i = getelementptr inbounds i8, i8* %2, i64 %e
- %3 = load i8, i8* %2, align 1, !noalias !0
- %4 = load i8, i8* %i.15, align 1, !alias.scope !0
- store i8 %4, i8* %2, align 1
+ %2 = phi ptr [ %1, %for.body.lr.ph ], [ %add.ptr.i, %if.end5 ]
+ %i.15 = phi ptr [ %i.0, %for.body.lr.ph ], [ %i.2, %if.end5 ]
+ %add.ptr.i = getelementptr inbounds i8, ptr %2, i64 %e
+ %3 = load i8, ptr %2, align 1, !noalias !0
+ %4 = load i8, ptr %i.15, align 1, !alias.scope !0
+ store i8 %4, ptr %2, align 1
br label %_Z1dPcS_l.exit
_Z1dPcS_l.exit: ; preds = %for.body
br i1 undef, label %if.then3, label %if.end5
if.then3: ; preds = %_Z1dPcS_l.exit
- %add.ptr4 = getelementptr inbounds i8, i8* %i.15, i64 %e
+ %add.ptr4 = getelementptr inbounds i8, ptr %i.15, i64 %e
br label %if.end5
if.end5: ; preds = %if.then3, %_Z1dPcS_l.exit
- %i.2 = phi i8* [ %add.ptr4, %if.then3 ], [ %i.15, %_Z1dPcS_l.exit ]
+ %i.2 = phi ptr [ %add.ptr4, %if.then3 ], [ %i.15, %_Z1dPcS_l.exit ]
br i1 false, label %for.body, label %for.cond.while.cond.loopexit_crit_edge.us-lcssa
}
diff --git a/llvm/test/Transforms/MemCpyOpt/align.ll b/llvm/test/Transforms/MemCpyOpt/align.ll
index 740e0c75dad6..6d855fa7f081 100644
--- a/llvm/test/Transforms/MemCpyOpt/align.ll
+++ b/llvm/test/Transforms/MemCpyOpt/align.ll
@@ -2,30 +2,27 @@
; RUN: opt < %s -S -basic-aa -memcpyopt -verify-memoryssa | FileCheck %s
target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind
-declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) nounwind
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind
+declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind
; The resulting memset is only 4-byte aligned, despite containing
; a 16-byte aligned store in the middle.
-define void @foo(i32* %p) {
+define void @foo(ptr %p) {
; CHECK-LABEL: @foo(
-; CHECK-NEXT: [[A0:%.*]] = getelementptr i32, i32* [[P:%.*]], i64 0
-; CHECK-NEXT: [[A1:%.*]] = getelementptr i32, i32* [[P]], i64 1
-; CHECK-NEXT: [[A2:%.*]] = getelementptr i32, i32* [[P]], i64 2
-; CHECK-NEXT: [[A3:%.*]] = getelementptr i32, i32* [[P]], i64 3
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32* [[A0]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[TMP1]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: [[A1:%.*]] = getelementptr i32, ptr [[P:%.*]], i64 1
+; CHECK-NEXT: [[A2:%.*]] = getelementptr i32, ptr [[P]], i64 2
+; CHECK-NEXT: [[A3:%.*]] = getelementptr i32, ptr [[P]], i64 3
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[P]], i8 0, i64 16, i1 false)
; CHECK-NEXT: ret void
;
- %a0 = getelementptr i32, i32* %p, i64 0
- store i32 0, i32* %a0, align 4
- %a1 = getelementptr i32, i32* %p, i64 1
- store i32 0, i32* %a1, align 16
- %a2 = getelementptr i32, i32* %p, i64 2
- store i32 0, i32* %a2, align 4
- %a3 = getelementptr i32, i32* %p, i64 3
- store i32 0, i32* %a3, align 4
+ store i32 0, ptr %p, align 4
+ %a1 = getelementptr i32, ptr %p, i64 1
+ store i32 0, ptr %a1, align 16
+ %a2 = getelementptr i32, ptr %p, i64 2
+ store i32 0, ptr %a2, align 4
+ %a3 = getelementptr i32, ptr %p, i64 3
+ store i32 0, ptr %a3, align 4
ret void
}
@@ -35,17 +32,12 @@ define void @bar() {
; CHECK-LABEL: @bar(
; CHECK-NEXT: [[A4:%.*]] = alloca i32, align 8
; CHECK-NEXT: [[A8:%.*]] = alloca i32, align 8
-; CHECK-NEXT: [[A8_CAST:%.*]] = bitcast i32* [[A8]] to i8*
-; CHECK-NEXT: [[A4_CAST:%.*]] = bitcast i32* [[A4]] to i8*
-; CHECK-NEXT: [[A41:%.*]] = bitcast i32* [[A4]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[A41]], i8 0, i64 4, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[A4]], i8 0, i64 4, i1 false)
; CHECK-NEXT: ret void
;
%a4 = alloca i32, align 4
%a8 = alloca i32, align 8
- %a8.cast = bitcast i32* %a8 to i8*
- %a4.cast = bitcast i32* %a4 to i8*
- call void @llvm.memset.p0i8.i64(i8* align 8 %a8.cast, i8 0, i64 4, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a4.cast, i8* align 4 %a8.cast, i64 4, i1 false)
+ call void @llvm.memset.p0.i64(ptr align 8 %a8, i8 0, i64 4, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a4, ptr align 4 %a8, i64 4, i1 false)
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/atomic.ll b/llvm/test/Transforms/MemCpyOpt/atomic.ll
index dcbb829777f8..279c94abd3dc 100644
--- a/llvm/test/Transforms/MemCpyOpt/atomic.ll
+++ b/llvm/test/Transforms/MemCpyOpt/atomic.ll
@@ -6,29 +6,25 @@ target triple = "x86_64-apple-macosx10.7.0"
@x = global i32 0
-declare void @otherf(i32*)
+declare void @otherf(ptr)
-declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) nounwind
+declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind
; memcpyopt should not touch atomic ops
define void @test1() nounwind uwtable ssp {
; CHECK-LABEL: @test1(
; CHECK-NEXT: [[X:%.*]] = alloca [101 x i32], align 16
-; CHECK-NEXT: [[BC:%.*]] = bitcast [101 x i32]* [[X]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 16 [[BC]], i8 0, i64 400, i1 false)
-; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds [101 x i32], [101 x i32]* [[X]], i32 0, i32 100
-; CHECK-NEXT: store atomic i32 0, i32* [[GEP1]] unordered, align 4
-; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds [101 x i32], [101 x i32]* [[X]], i32 0, i32 0
-; CHECK-NEXT: call void @otherf(i32* [[GEP2]])
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 16 [[X]], i8 0, i64 400, i1 false)
+; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds [101 x i32], ptr [[X]], i32 0, i32 100
+; CHECK-NEXT: store atomic i32 0, ptr [[GEP1]] unordered, align 4
+; CHECK-NEXT: call void @otherf(ptr [[X]])
; CHECK-NEXT: ret void
;
%x = alloca [101 x i32], align 16
- %bc = bitcast [101 x i32]* %x to i8*
- call void @llvm.memset.p0i8.i64(i8* align 16 %bc, i8 0, i64 400, i1 false)
- %gep1 = getelementptr inbounds [101 x i32], [101 x i32]* %x, i32 0, i32 100
- store atomic i32 0, i32* %gep1 unordered, align 4
- %gep2 = getelementptr inbounds [101 x i32], [101 x i32]* %x, i32 0, i32 0
- call void @otherf(i32* %gep2)
+ call void @llvm.memset.p0.i64(ptr align 16 %x, i8 0, i64 400, i1 false)
+ %gep1 = getelementptr inbounds [101 x i32], ptr %x, i32 0, i32 100
+ store atomic i32 0, ptr %gep1 unordered, align 4
+ call void @otherf(ptr %x)
ret void
}
@@ -37,18 +33,18 @@ define void @test2() nounwind uwtable ssp {
; CHECK-LABEL: @test2(
; CHECK-NEXT: [[OLD:%.*]] = alloca i32, align 4
; CHECK-NEXT: [[NEW:%.*]] = alloca i32, align 4
-; CHECK-NEXT: call void @otherf(i32* nocapture [[NEW]])
-; CHECK-NEXT: store atomic i32 0, i32* @x unordered, align 4
-; CHECK-NEXT: call void @otherf(i32* nocapture [[NEW]])
+; CHECK-NEXT: call void @otherf(ptr nocapture [[NEW]])
+; CHECK-NEXT: store atomic i32 0, ptr @x unordered, align 4
+; CHECK-NEXT: call void @otherf(ptr nocapture [[NEW]])
; CHECK-NEXT: ret void
;
%old = alloca i32
%new = alloca i32
- call void @otherf(i32* nocapture %old)
- store atomic i32 0, i32* @x unordered, align 4
- %v = load i32, i32* %old
- store i32 %v, i32* %new
- call void @otherf(i32* nocapture %new)
+ call void @otherf(ptr nocapture %old)
+ store atomic i32 0, ptr @x unordered, align 4
+ %v = load i32, ptr %old
+ store i32 %v, ptr %new
+ call void @otherf(ptr nocapture %new)
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/byval-readnone.ll b/llvm/test/Transforms/MemCpyOpt/byval-readnone.ll
index 6f33483de48b..414dd1061535 100644
--- a/llvm/test/Transforms/MemCpyOpt/byval-readnone.ll
+++ b/llvm/test/Transforms/MemCpyOpt/byval-readnone.ll
@@ -3,15 +3,15 @@
%struct = type { i16 }
-declare i16 @g(%struct*) readnone
+declare i16 @g(ptr) readnone
define void @f() {
; CHECK-LABEL: @f(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[CALL:%.*]] = call i16 @g(%struct* byval(%struct) align 1 undef)
+; CHECK-NEXT: [[CALL:%.*]] = call i16 @g(ptr byval(%struct) align 1 undef)
; CHECK-NEXT: ret void
;
entry:
- %call = call i16 @g(%struct* byval(%struct) align 1 undef)
+ %call = call i16 @g(ptr byval(%struct) align 1 undef)
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/callslot.ll b/llvm/test/Transforms/MemCpyOpt/callslot.ll
index 5cb57022198f..63a5924e87be 100644
--- a/llvm/test/Transforms/MemCpyOpt/callslot.ll
+++ b/llvm/test/Transforms/MemCpyOpt/callslot.ll
@@ -5,22 +5,18 @@ define i8 @read_dest_between_call_and_memcpy() {
; CHECK-LABEL: @read_dest_between_call_and_memcpy(
; CHECK-NEXT: [[DEST:%.*]] = alloca [16 x i8], align 1
; CHECK-NEXT: [[SRC:%.*]] = alloca [16 x i8], align 1
-; CHECK-NEXT: [[DEST_I8:%.*]] = bitcast [16 x i8]* [[DEST]] to i8*
-; CHECK-NEXT: [[SRC_I8:%.*]] = bitcast [16 x i8]* [[SRC]] to i8*
-; CHECK-NEXT: store i8 1, i8* [[DEST_I8]], align 1
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[SRC_I8]], i8 0, i64 16, i1 false)
-; CHECK-NEXT: [[X:%.*]] = load i8, i8* [[DEST_I8]], align 1
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DEST_I8]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: store i8 1, ptr [[DEST]], align 1
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[SRC]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: [[X:%.*]] = load i8, ptr [[DEST]], align 1
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DEST]], i8 0, i64 16, i1 false)
; CHECK-NEXT: ret i8 [[X]]
;
%dest = alloca [16 x i8]
%src = alloca [16 x i8]
- %dest.i8 = bitcast [16 x i8]* %dest to i8*
- %src.i8 = bitcast [16 x i8]* %src to i8*
- store i8 1, i8* %dest.i8
- call void @llvm.memset.p0i8.i64(i8* %src.i8, i8 0, i64 16, i1 false)
- %x = load i8, i8* %dest.i8
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dest.i8, i8* %src.i8, i64 16, i1 false)
+ store i8 1, ptr %dest
+ call void @llvm.memset.p0.i64(ptr %src, i8 0, i64 16, i1 false)
+ %x = load i8, ptr %dest
+ call void @llvm.memcpy.p0.p0.i64(ptr %dest, ptr %src, i64 16, i1 false)
ret i8 %x
}
@@ -28,20 +24,16 @@ define i8 @read_src_between_call_and_memcpy() {
; CHECK-LABEL: @read_src_between_call_and_memcpy(
; CHECK-NEXT: [[DEST:%.*]] = alloca [16 x i8], align 1
; CHECK-NEXT: [[SRC:%.*]] = alloca [16 x i8], align 1
-; CHECK-NEXT: [[DEST_I8:%.*]] = bitcast [16 x i8]* [[DEST]] to i8*
-; CHECK-NEXT: [[SRC_I8:%.*]] = bitcast [16 x i8]* [[SRC]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[SRC_I8]], i8 0, i64 16, i1 false)
-; CHECK-NEXT: [[X:%.*]] = load i8, i8* [[SRC_I8]], align 1
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DEST_I8]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[SRC]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: [[X:%.*]] = load i8, ptr [[SRC]], align 1
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DEST]], i8 0, i64 16, i1 false)
; CHECK-NEXT: ret i8 [[X]]
;
%dest = alloca [16 x i8]
%src = alloca [16 x i8]
- %dest.i8 = bitcast [16 x i8]* %dest to i8*
- %src.i8 = bitcast [16 x i8]* %src to i8*
- call void @llvm.memset.p0i8.i64(i8* %src.i8, i8 0, i64 16, i1 false)
- %x = load i8, i8* %src.i8
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dest.i8, i8* %src.i8, i64 16, i1 false)
+ call void @llvm.memset.p0.i64(ptr %src, i8 0, i64 16, i1 false)
+ %x = load i8, ptr %src
+ call void @llvm.memcpy.p0.p0.i64(ptr %dest, ptr %src, i64 16, i1 false)
ret i8 %x
}
@@ -49,20 +41,16 @@ define void @write_dest_between_call_and_memcpy() {
; CHECK-LABEL: @write_dest_between_call_and_memcpy(
; CHECK-NEXT: [[DEST:%.*]] = alloca [16 x i8], align 1
; CHECK-NEXT: [[SRC:%.*]] = alloca [16 x i8], align 1
-; CHECK-NEXT: [[DEST_I8:%.*]] = bitcast [16 x i8]* [[DEST]] to i8*
-; CHECK-NEXT: [[SRC_I8:%.*]] = bitcast [16 x i8]* [[SRC]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[SRC_I8]], i8 0, i64 16, i1 false)
-; CHECK-NEXT: store i8 1, i8* [[DEST_I8]], align 1
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DEST_I8]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[SRC]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: store i8 1, ptr [[DEST]], align 1
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DEST]], i8 0, i64 16, i1 false)
; CHECK-NEXT: ret void
;
%dest = alloca [16 x i8]
%src = alloca [16 x i8]
- %dest.i8 = bitcast [16 x i8]* %dest to i8*
- %src.i8 = bitcast [16 x i8]* %src to i8*
- call void @llvm.memset.p0i8.i64(i8* %src.i8, i8 0, i64 16, i1 false)
- store i8 1, i8* %dest.i8
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dest.i8, i8* %src.i8, i64 16, i1 false)
+ call void @llvm.memset.p0.i64(ptr %src, i8 0, i64 16, i1 false)
+ store i8 1, ptr %dest
+ call void @llvm.memcpy.p0.p0.i64(ptr %dest, ptr %src, i64 16, i1 false)
ret void
}
@@ -70,37 +58,31 @@ define void @write_src_between_call_and_memcpy() {
; CHECK-LABEL: @write_src_between_call_and_memcpy(
; CHECK-NEXT: [[DEST:%.*]] = alloca [16 x i8], align 1
; CHECK-NEXT: [[SRC:%.*]] = alloca [16 x i8], align 1
-; CHECK-NEXT: [[DEST_I8:%.*]] = bitcast [16 x i8]* [[DEST]] to i8*
-; CHECK-NEXT: [[SRC_I8:%.*]] = bitcast [16 x i8]* [[SRC]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[SRC_I8]], i8 0, i64 16, i1 false)
-; CHECK-NEXT: store i8 1, i8* [[SRC_I8]], align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DEST_I8]], i8* [[SRC_I8]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[SRC]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: store i8 1, ptr [[SRC]], align 1
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DEST]], ptr [[SRC]], i64 16, i1 false)
; CHECK-NEXT: ret void
;
%dest = alloca [16 x i8]
%src = alloca [16 x i8]
- %dest.i8 = bitcast [16 x i8]* %dest to i8*
- %src.i8 = bitcast [16 x i8]* %src to i8*
- call void @llvm.memset.p0i8.i64(i8* %src.i8, i8 0, i64 16, i1 false)
- store i8 1, i8* %src.i8
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dest.i8, i8* %src.i8, i64 16, i1 false)
+ call void @llvm.memset.p0.i64(ptr %src, i8 0, i64 16, i1 false)
+ store i8 1, ptr %src
+ call void @llvm.memcpy.p0.p0.i64(ptr %dest, ptr %src, i64 16, i1 false)
ret void
}
-define void @throw_between_call_and_mempy(i8* dereferenceable(16) %dest.i8) {
+define void @throw_between_call_and_mempy(ptr dereferenceable(16) %dest.i8) {
; CHECK-LABEL: @throw_between_call_and_mempy(
; CHECK-NEXT: [[SRC:%.*]] = alloca [16 x i8], align 1
-; CHECK-NEXT: [[SRC_I8:%.*]] = bitcast [16 x i8]* [[SRC]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[SRC_I8]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[SRC]], i8 0, i64 16, i1 false)
; CHECK-NEXT: call void @may_throw() #[[ATTR2:[0-9]+]]
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DEST_I8:%.*]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DEST_I8:%.*]], i8 0, i64 16, i1 false)
; CHECK-NEXT: ret void
;
%src = alloca [16 x i8]
- %src.i8 = bitcast [16 x i8]* %src to i8*
- call void @llvm.memset.p0i8.i64(i8* %src.i8, i8 0, i64 16, i1 false)
+ call void @llvm.memset.p0.i64(ptr %src, i8 0, i64 16, i1 false)
call void @may_throw() readnone
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dest.i8, i8* %src.i8, i64 16, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dest.i8, ptr %src, i64 16, i1 false)
ret void
}
@@ -108,19 +90,15 @@ define void @dest_is_gep_nounwind_call() {
; CHECK-LABEL: @dest_is_gep_nounwind_call(
; CHECK-NEXT: [[DEST:%.*]] = alloca [16 x i8], align 1
; CHECK-NEXT: [[SRC:%.*]] = alloca [8 x i8], align 1
-; CHECK-NEXT: [[SRC_I8:%.*]] = bitcast [8 x i8]* [[SRC]] to i8*
-; CHECK-NEXT: [[DEST_I8:%.*]] = getelementptr [16 x i8], [16 x i8]* [[DEST]], i64 0, i64 8
-; CHECK-NEXT: [[DEST_I81:%.*]] = bitcast i8* [[DEST_I8]] to [8 x i8]*
-; CHECK-NEXT: [[DEST_I812:%.*]] = bitcast [8 x i8]* [[DEST_I81]] to i8*
-; CHECK-NEXT: call void @accept_ptr(i8* [[DEST_I812]]) #[[ATTR3:[0-9]+]]
+; CHECK-NEXT: [[DEST_I8:%.*]] = getelementptr [16 x i8], ptr [[DEST]], i64 0, i64 8
+; CHECK-NEXT: call void @accept_ptr(ptr [[DEST_I8]]) #[[ATTR3:[0-9]+]]
; CHECK-NEXT: ret void
;
%dest = alloca [16 x i8]
%src = alloca [8 x i8]
- %src.i8 = bitcast [8 x i8]* %src to i8*
- %dest.i8 = getelementptr [16 x i8], [16 x i8]* %dest, i64 0, i64 8
- call void @accept_ptr(i8* %src.i8) nounwind
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dest.i8, i8* %src.i8, i64 8, i1 false)
+ %dest.i8 = getelementptr [16 x i8], ptr %dest, i64 0, i64 8
+ call void @accept_ptr(ptr %src) nounwind
+ call void @llvm.memcpy.p0.p0.i64(ptr %dest.i8, ptr %src, i64 8, i1 false)
ret void
}
@@ -128,19 +106,15 @@ define void @dest_is_gep_may_throw_call() {
; CHECK-LABEL: @dest_is_gep_may_throw_call(
; CHECK-NEXT: [[DEST:%.*]] = alloca [16 x i8], align 1
; CHECK-NEXT: [[SRC:%.*]] = alloca [8 x i8], align 1
-; CHECK-NEXT: [[SRC_I8:%.*]] = bitcast [8 x i8]* [[SRC]] to i8*
-; CHECK-NEXT: [[DEST_I8:%.*]] = getelementptr [16 x i8], [16 x i8]* [[DEST]], i64 0, i64 8
-; CHECK-NEXT: [[DEST_I81:%.*]] = bitcast i8* [[DEST_I8]] to [8 x i8]*
-; CHECK-NEXT: [[DEST_I812:%.*]] = bitcast [8 x i8]* [[DEST_I81]] to i8*
-; CHECK-NEXT: call void @accept_ptr(i8* [[DEST_I812]])
+; CHECK-NEXT: [[DEST_I8:%.*]] = getelementptr [16 x i8], ptr [[DEST]], i64 0, i64 8
+; CHECK-NEXT: call void @accept_ptr(ptr [[DEST_I8]])
; CHECK-NEXT: ret void
;
%dest = alloca [16 x i8]
%src = alloca [8 x i8]
- %src.i8 = bitcast [8 x i8]* %src to i8*
- %dest.i8 = getelementptr [16 x i8], [16 x i8]* %dest, i64 0, i64 8
- call void @accept_ptr(i8* %src.i8)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dest.i8, i8* %src.i8, i64 8, i1 false)
+ %dest.i8 = getelementptr [16 x i8], ptr %dest, i64 0, i64 8
+ call void @accept_ptr(ptr %src)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dest.i8, ptr %src, i64 8, i1 false)
ret void
}
@@ -148,19 +122,15 @@ define void @dest_is_gep_requires_movement() {
; CHECK-LABEL: @dest_is_gep_requires_movement(
; CHECK-NEXT: [[DEST:%.*]] = alloca [16 x i8], align 1
; CHECK-NEXT: [[SRC:%.*]] = alloca [8 x i8], align 1
-; CHECK-NEXT: [[SRC_I8:%.*]] = bitcast [8 x i8]* [[SRC]] to i8*
-; CHECK-NEXT: [[DEST_I8:%.*]] = getelementptr [16 x i8], [16 x i8]* [[DEST]], i64 0, i64 8
-; CHECK-NEXT: [[DEST_I81:%.*]] = bitcast i8* [[DEST_I8]] to [8 x i8]*
-; CHECK-NEXT: [[DEST_I812:%.*]] = bitcast [8 x i8]* [[DEST_I81]] to i8*
-; CHECK-NEXT: call void @accept_ptr(i8* [[DEST_I812]]) #[[ATTR3]]
+; CHECK-NEXT: [[DEST_I8:%.*]] = getelementptr [16 x i8], ptr [[DEST]], i64 0, i64 8
+; CHECK-NEXT: call void @accept_ptr(ptr [[DEST_I8]]) #[[ATTR3]]
; CHECK-NEXT: ret void
;
%dest = alloca [16 x i8]
%src = alloca [8 x i8]
- %src.i8 = bitcast [8 x i8]* %src to i8*
- call void @accept_ptr(i8* %src.i8) nounwind
- %dest.i8 = getelementptr [16 x i8], [16 x i8]* %dest, i64 0, i64 8
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dest.i8, i8* %src.i8, i64 8, i1 false)
+ call void @accept_ptr(ptr %src) nounwind
+ %dest.i8 = getelementptr [16 x i8], ptr %dest, i64 0, i64 8
+ call void @llvm.memcpy.p0.p0.i64(ptr %dest.i8, ptr %src, i64 8, i1 false)
ret void
}
@@ -168,20 +138,15 @@ define void @capture_before_call_argmemonly() {
; CHECK-LABEL: @capture_before_call_argmemonly(
; CHECK-NEXT: [[DEST:%.*]] = alloca [16 x i8], align 1
; CHECK-NEXT: [[SRC:%.*]] = alloca [16 x i8], align 1
-; CHECK-NEXT: [[DEST_I8:%.*]] = bitcast [16 x i8]* [[DEST]] to i8*
-; CHECK-NEXT: [[SRC_I8:%.*]] = bitcast [16 x i8]* [[SRC]] to i8*
-; CHECK-NEXT: call void @accept_ptr(i8* [[DEST_I8]])
-; CHECK-NEXT: [[DEST1:%.*]] = bitcast [16 x i8]* [[DEST]] to i8*
-; CHECK-NEXT: call void @accept_ptr(i8* nocapture [[DEST1]]) #[[ATTR4:[0-9]+]]
+; CHECK-NEXT: call void @accept_ptr(ptr [[DEST]])
+; CHECK-NEXT: call void @accept_ptr(ptr nocapture [[DEST]]) #[[ATTR4:[0-9]+]]
; CHECK-NEXT: ret void
;
%dest = alloca [16 x i8]
%src = alloca [16 x i8]
- %dest.i8 = bitcast [16 x i8]* %dest to i8*
- %src.i8 = bitcast [16 x i8]* %src to i8*
- call void @accept_ptr(i8* %dest.i8) ; capture
- call void @accept_ptr(i8* nocapture %src.i8) argmemonly
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dest.i8, i8* %src.i8, i64 16, i1 false)
+ call void @accept_ptr(ptr %dest) ; capture
+ call void @accept_ptr(ptr nocapture %src) argmemonly
+ call void @llvm.memcpy.p0.p0.i64(ptr %dest, ptr %src, i64 16, i1 false)
ret void
}
@@ -189,21 +154,16 @@ define void @capture_before_call_argmemonly_nounwind() {
; CHECK-LABEL: @capture_before_call_argmemonly_nounwind(
; CHECK-NEXT: [[DEST:%.*]] = alloca [16 x i8], align 1
; CHECK-NEXT: [[SRC:%.*]] = alloca [16 x i8], align 1
-; CHECK-NEXT: [[DEST_I8:%.*]] = bitcast [16 x i8]* [[DEST]] to i8*
-; CHECK-NEXT: [[SRC_I8:%.*]] = bitcast [16 x i8]* [[SRC]] to i8*
-; CHECK-NEXT: call void @accept_ptr(i8* [[DEST_I8]])
-; CHECK-NEXT: [[DEST1:%.*]] = bitcast [16 x i8]* [[DEST]] to i8*
-; CHECK-NEXT: call void @accept_ptr(i8* nocapture [[DEST1]]) #[[ATTR5:[0-9]+]]
+; CHECK-NEXT: call void @accept_ptr(ptr [[DEST]])
+; CHECK-NEXT: call void @accept_ptr(ptr nocapture [[DEST]]) #[[ATTR5:[0-9]+]]
; CHECK-NEXT: ret void
;
%dest = alloca [16 x i8]
%src = alloca [16 x i8]
- %dest.i8 = bitcast [16 x i8]* %dest to i8*
- %src.i8 = bitcast [16 x i8]* %src to i8*
- call void @accept_ptr(i8* %dest.i8) ; capture
+ call void @accept_ptr(ptr %dest) ; capture
; NB: argmemonly currently implies willreturn.
- call void @accept_ptr(i8* nocapture %src.i8) argmemonly nounwind
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dest.i8, i8* %src.i8, i64 16, i1 false)
+ call void @accept_ptr(ptr nocapture %src) argmemonly nounwind
+ call void @llvm.memcpy.p0.p0.i64(ptr %dest, ptr %src, i64 16, i1 false)
ret void
}
@@ -211,20 +171,15 @@ define void @capture_before_call_argmemonly_nounwind_willreturn() {
; CHECK-LABEL: @capture_before_call_argmemonly_nounwind_willreturn(
; CHECK-NEXT: [[DEST:%.*]] = alloca [16 x i8], align 1
; CHECK-NEXT: [[SRC:%.*]] = alloca [16 x i8], align 1
-; CHECK-NEXT: [[DEST_I8:%.*]] = bitcast [16 x i8]* [[DEST]] to i8*
-; CHECK-NEXT: [[SRC_I8:%.*]] = bitcast [16 x i8]* [[SRC]] to i8*
-; CHECK-NEXT: call void @accept_ptr(i8* [[DEST_I8]])
-; CHECK-NEXT: [[DEST1:%.*]] = bitcast [16 x i8]* [[DEST]] to i8*
-; CHECK-NEXT: call void @accept_ptr(i8* nocapture [[DEST1]]) #[[ATTR6:[0-9]+]]
+; CHECK-NEXT: call void @accept_ptr(ptr [[DEST]])
+; CHECK-NEXT: call void @accept_ptr(ptr nocapture [[DEST]]) #[[ATTR6:[0-9]+]]
; CHECK-NEXT: ret void
;
%dest = alloca [16 x i8]
%src = alloca [16 x i8]
- %dest.i8 = bitcast [16 x i8]* %dest to i8*
- %src.i8 = bitcast [16 x i8]* %src to i8*
- call void @accept_ptr(i8* %dest.i8) ; capture
- call void @accept_ptr(i8* nocapture %src.i8) argmemonly nounwind willreturn
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dest.i8, i8* %src.i8, i64 16, i1 false)
+ call void @accept_ptr(ptr %dest) ; capture
+ call void @accept_ptr(ptr nocapture %src) argmemonly nounwind willreturn
+ call void @llvm.memcpy.p0.p0.i64(ptr %dest, ptr %src, i64 16, i1 false)
ret void
}
@@ -234,34 +189,29 @@ define void @capture_nopath_call(i1 %cond) {
; CHECK-LABEL: @capture_nopath_call(
; CHECK-NEXT: [[DEST:%.*]] = alloca [16 x i8], align 1
; CHECK-NEXT: [[SRC:%.*]] = alloca [16 x i8], align 1
-; CHECK-NEXT: [[DEST_I8:%.*]] = bitcast [16 x i8]* [[DEST]] to i8*
-; CHECK-NEXT: [[SRC_I8:%.*]] = bitcast [16 x i8]* [[SRC]] to i8*
; CHECK-NEXT: br i1 [[COND:%.*]], label [[CAPTURES:%.*]], label [[NOCAPTURES:%.*]]
; CHECK: captures:
-; CHECK-NEXT: call void @accept_ptr(i8* [[DEST_I8]])
+; CHECK-NEXT: call void @accept_ptr(ptr [[DEST]])
; CHECK-NEXT: ret void
; CHECK: nocaptures:
-; CHECK-NEXT: [[DEST1:%.*]] = bitcast [16 x i8]* [[DEST]] to i8*
-; CHECK-NEXT: call void @accept_ptr(i8* [[DEST1]]) #[[ATTR3]]
+; CHECK-NEXT: call void @accept_ptr(ptr [[DEST]]) #[[ATTR3]]
; CHECK-NEXT: ret void
;
%dest = alloca [16 x i8]
%src = alloca [16 x i8]
- %dest.i8 = bitcast [16 x i8]* %dest to i8*
- %src.i8 = bitcast [16 x i8]* %src to i8*
br i1 %cond, label %captures, label %nocaptures
captures:
- call void @accept_ptr(i8* %dest.i8) ; capture
+ call void @accept_ptr(ptr %dest) ; capture
ret void
nocaptures:
- call void @accept_ptr(i8* %src.i8) nounwind
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dest.i8, i8* %src.i8, i64 16, i1 false)
+ call void @accept_ptr(ptr %src) nounwind
+ call void @llvm.memcpy.p0.p0.i64(ptr %dest, ptr %src, i64 16, i1 false)
ret void
}
declare void @may_throw()
-declare void @accept_ptr(i8*)
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i1)
-declare void @llvm.memset.p0i8.i64(i8*, i8, i64, i1)
+declare void @accept_ptr(ptr)
+declare void @llvm.memcpy.p0.p0.i64(ptr, ptr, i64, i1)
+declare void @llvm.memset.p0.i64(ptr, i8, i64, i1)
diff --git a/llvm/test/Transforms/MemCpyOpt/callslot_aa.ll b/llvm/test/Transforms/MemCpyOpt/callslot_aa.ll
index 2a6dd607cc7d..b49ddd9b53ad 100644
--- a/llvm/test/Transforms/MemCpyOpt/callslot_aa.ll
+++ b/llvm/test/Transforms/MemCpyOpt/callslot_aa.ll
@@ -4,22 +4,22 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
%T = type { i64, i64 }
-define void @test(i8* %src) {
+define void @test(ptr %src) {
; CHECK-LABEL: @test(
; CHECK-NEXT: [[TMP:%.*]] = alloca i8, align 1
; CHECK-NEXT: [[DST:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[DST]], i8* align 8 [[SRC:%.*]], i64 1, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DST]], ptr align 8 [[SRC:%.*]], i64 1, i1 false)
; CHECK-NEXT: ret void
;
%tmp = alloca i8
%dst = alloca i8
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %tmp, i8* align 8 %src, i64 1, i1 false), !noalias !2
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %tmp, i64 1, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %tmp, ptr align 8 %src, i64 1, i1 false), !noalias !2
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst, ptr align 8 %tmp, i64 1, i1 false)
ret void
}
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i1)
+declare void @llvm.memcpy.p0.p0.i64(ptr, ptr, i64, i1)
; Check that the noalias for "dst" was removed by checking that the metadata is gone
; CHECK-NOT: "dst"
diff --git a/llvm/test/Transforms/MemCpyOpt/callslot_badaa.ll b/llvm/test/Transforms/MemCpyOpt/callslot_badaa.ll
index 346546f72c4c..35c9f7305752 100644
--- a/llvm/test/Transforms/MemCpyOpt/callslot_badaa.ll
+++ b/llvm/test/Transforms/MemCpyOpt/callslot_badaa.ll
@@ -2,8 +2,8 @@
; Make sure callslot optimization merges alias.scope metadata correctly when it merges instructions.
; Merging here naively generates:
-; call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %src, i64 1, i1 false), !alias.scope !3
-; call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %src), !noalias !0
+; call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst, ptr align 8 %src, i64 1, i1 false), !alias.scope !3
+; call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %src), !noalias !0
; ...
; !0 = !{!1}
; !1 = distinct !{!1, !2, !"callee1: %a"}
@@ -17,19 +17,19 @@ define i8 @test(i8 %input) {
%dst = alloca i8
%src = alloca i8
; NOTE: we're matching the full line and looking for the lack of !alias.scope here
-; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %src, i64 1, i1 false)
- call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %src), !noalias !3
- store i8 %input, i8* %src
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %tmp, i8* align 8 %src, i64 1, i1 false), !alias.scope !0
- call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %src), !noalias !3
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %tmp, i64 1, i1 false), !alias.scope !3
- %ret_value = load i8, i8* %dst
+; CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst, ptr align 8 %src, i64 1, i1 false)
+ call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %src), !noalias !3
+ store i8 %input, ptr %src
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %tmp, ptr align 8 %src, i64 1, i1 false), !alias.scope !0
+ call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %src), !noalias !3
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst, ptr align 8 %tmp, i64 1, i1 false), !alias.scope !3
+ %ret_value = load i8, ptr %dst
ret i8 %ret_value
}
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i1)
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
+declare void @llvm.memcpy.p0.p0.i64(ptr, ptr, i64, i1)
!0 = !{!1}
!1 = distinct !{!1, !2, !"callee0: %a"}
diff --git a/llvm/test/Transforms/MemCpyOpt/callslot_deref.ll b/llvm/test/Transforms/MemCpyOpt/callslot_deref.ll
index f7868f47aea2..2dfe6f267447 100644
--- a/llvm/test/Transforms/MemCpyOpt/callslot_deref.ll
+++ b/llvm/test/Transforms/MemCpyOpt/callslot_deref.ll
@@ -2,39 +2,33 @@
; RUN: opt < %s -S -basic-aa -memcpyopt -verify-memoryssa | FileCheck %s
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1) unnamed_addr nounwind
-declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) nounwind
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1) unnamed_addr nounwind
+declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind
; all bytes of %dst that are touch by the memset are dereferenceable
-define void @must_remove_memcpy(i8* noalias nocapture dereferenceable(4096) %dst) nofree nosync {
+define void @must_remove_memcpy(ptr noalias nocapture dereferenceable(4096) %dst) nofree nosync {
; CHECK-LABEL: @must_remove_memcpy(
; CHECK-NEXT: [[SRC:%.*]] = alloca [4096 x i8], align 1
-; CHECK-NEXT: [[P:%.*]] = getelementptr inbounds [4096 x i8], [4096 x i8]* [[SRC]], i64 0, i64 0
-; CHECK-NEXT: [[DST1:%.*]] = bitcast i8* [[DST:%.*]] to [4096 x i8]*
-; CHECK-NEXT: [[DST12:%.*]] = bitcast [4096 x i8]* [[DST1]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DST12]], i8 0, i64 4096, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DST:%.*]], i8 0, i64 4096, i1 false)
; CHECK-NEXT: ret void
;
%src = alloca [4096 x i8], align 1
- %p = getelementptr inbounds [4096 x i8], [4096 x i8]* %src, i64 0, i64 0
- call void @llvm.memset.p0i8.i64(i8* %p, i8 0, i64 4096, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %p, i64 4096, i1 false) #2
+ call void @llvm.memset.p0.i64(ptr %src, i8 0, i64 4096, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 4096, i1 false) #2
ret void
}
; memset touch more bytes than those guaranteed to be dereferenceable
; We can't remove the memcpy, but we can turn it into an independent memset.
-define void @must_not_remove_memcpy(i8* noalias nocapture dereferenceable(1024) %dst) nofree nosync {
+define void @must_not_remove_memcpy(ptr noalias nocapture dereferenceable(1024) %dst) nofree nosync {
; CHECK-LABEL: @must_not_remove_memcpy(
; CHECK-NEXT: [[SRC:%.*]] = alloca [4096 x i8], align 1
-; CHECK-NEXT: [[P:%.*]] = getelementptr inbounds [4096 x i8], [4096 x i8]* [[SRC]], i64 0, i64 0
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[P]], i8 0, i64 4096, i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DST:%.*]], i8 0, i64 4096, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[SRC]], i8 0, i64 4096, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DST:%.*]], i8 0, i64 4096, i1 false)
; CHECK-NEXT: ret void
;
%src = alloca [4096 x i8], align 1
- %p = getelementptr inbounds [4096 x i8], [4096 x i8]* %src, i64 0, i64 0
- call void @llvm.memset.p0i8.i64(i8* %p, i8 0, i64 4096, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %p, i64 4096, i1 false) #2
+ call void @llvm.memset.p0.i64(ptr %src, i8 0, i64 4096, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 4096, i1 false) #2
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/callslot_noalias.ll b/llvm/test/Transforms/MemCpyOpt/callslot_noalias.ll
index 63358055bc3c..14fc31234b48 100644
--- a/llvm/test/Transforms/MemCpyOpt/callslot_noalias.ll
+++ b/llvm/test/Transforms/MemCpyOpt/callslot_noalias.ll
@@ -1,22 +1,22 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -memcpyopt < %s | FileCheck %s
-declare void @func(i8* %dst)
+declare void @func(ptr %dst)
; The noalias metadata from the call, the load and the store should be merged,
; so that no metadata is left on the call.
-define i8 @test(i8* dereferenceable(1) noalias %dst) {
+define i8 @test(ptr dereferenceable(1) noalias %dst) {
; CHECK-LABEL: @test(
; CHECK-NEXT: [[TMP:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @func(i8* nocapture [[DST:%.*]]) #[[ATTR0:[0-9]+]]{{$}}
-; CHECK-NEXT: [[V2:%.*]] = load i8, i8* [[DST]], align 1, !alias.scope !0
+; CHECK-NEXT: call void @func(ptr nocapture [[DST:%.*]]) #[[ATTR0:[0-9]+]]{{$}}
+; CHECK-NEXT: [[V2:%.*]] = load i8, ptr [[DST]], align 1, !alias.scope !0
; CHECK-NEXT: ret i8 [[V2]]
;
%tmp = alloca i8
- call void @func(i8* nocapture %tmp) nounwind, !noalias !0
- %v = load i8, i8* %tmp, !noalias !0
- store i8 %v, i8* %dst, !alias.scope !0
- %v2 = load i8, i8* %dst, !alias.scope !0
+ call void @func(ptr nocapture %tmp) nounwind, !noalias !0
+ %v = load i8, ptr %tmp, !noalias !0
+ store i8 %v, ptr %dst, !alias.scope !0
+ %v2 = load i8, ptr %dst, !alias.scope !0
ret i8 %v2
}
diff --git a/llvm/test/Transforms/MemCpyOpt/callslot_throw.ll b/llvm/test/Transforms/MemCpyOpt/callslot_throw.ll
index 62b6fcfe4d5a..1e3ff4b3d711 100644
--- a/llvm/test/Transforms/MemCpyOpt/callslot_throw.ll
+++ b/llvm/test/Transforms/MemCpyOpt/callslot_throw.ll
@@ -1,75 +1,75 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -memcpyopt < %s -verify-memoryssa | FileCheck %s
-declare void @may_throw(i32* nocapture %x)
+declare void @may_throw(ptr nocapture %x)
-define void @test1(i32* nocapture noalias dereferenceable(4) %x) {
+define void @test1(ptr nocapture noalias dereferenceable(4) %x) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[T:%.*]] = alloca i32, align 4
-; CHECK-NEXT: call void @may_throw(i32* nonnull [[T]])
-; CHECK-NEXT: [[LOAD:%.*]] = load i32, i32* [[T]], align 4
-; CHECK-NEXT: store i32 [[LOAD]], i32* [[X:%.*]], align 4
+; CHECK-NEXT: call void @may_throw(ptr nonnull [[T]])
+; CHECK-NEXT: [[LOAD:%.*]] = load i32, ptr [[T]], align 4
+; CHECK-NEXT: store i32 [[LOAD]], ptr [[X:%.*]], align 4
; CHECK-NEXT: ret void
;
entry:
%t = alloca i32, align 4
- call void @may_throw(i32* nonnull %t)
- %load = load i32, i32* %t, align 4
- store i32 %load, i32* %x, align 4
+ call void @may_throw(ptr nonnull %t)
+ %load = load i32, ptr %t, align 4
+ store i32 %load, ptr %x, align 4
ret void
}
declare void @always_throws()
-define void @test2(i32* nocapture noalias dereferenceable(4) %x) {
+define void @test2(ptr nocapture noalias dereferenceable(4) %x) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[T:%.*]] = alloca i32, align 4
-; CHECK-NEXT: call void @may_throw(i32* nonnull [[T]]) #[[ATTR0:[0-9]+]]
-; CHECK-NEXT: [[LOAD:%.*]] = load i32, i32* [[T]], align 4
+; CHECK-NEXT: call void @may_throw(ptr nonnull [[T]]) #[[ATTR0:[0-9]+]]
+; CHECK-NEXT: [[LOAD:%.*]] = load i32, ptr [[T]], align 4
; CHECK-NEXT: call void @always_throws()
-; CHECK-NEXT: store i32 [[LOAD]], i32* [[X:%.*]], align 4
+; CHECK-NEXT: store i32 [[LOAD]], ptr [[X:%.*]], align 4
; CHECK-NEXT: ret void
;
entry:
%t = alloca i32, align 4
- call void @may_throw(i32* nonnull %t) nounwind
- %load = load i32, i32* %t, align 4
+ call void @may_throw(ptr nonnull %t) nounwind
+ %load = load i32, ptr %t, align 4
call void @always_throws()
- store i32 %load, i32* %x, align 4
+ store i32 %load, ptr %x, align 4
ret void
}
; byval argument is not visible on unwind.
-define void @test_byval(i32* nocapture noalias dereferenceable(4) byval(i32) %x) {
+define void @test_byval(ptr nocapture noalias dereferenceable(4) byval(i32) %x) {
; CHECK-LABEL: @test_byval(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[T:%.*]] = alloca i32, align 4
-; CHECK-NEXT: call void @may_throw(i32* nonnull [[X:%.*]])
+; CHECK-NEXT: call void @may_throw(ptr nonnull [[X:%.*]])
; CHECK-NEXT: ret void
;
entry:
%t = alloca i32, align 4
- call void @may_throw(i32* nonnull %t)
- %load = load i32, i32* %t, align 4
- store i32 %load, i32* %x, align 4
+ call void @may_throw(ptr nonnull %t)
+ %load = load i32, ptr %t, align 4
+ store i32 %load, ptr %x, align 4
ret void
}
; TODO: With updated semantics, sret could also be invisible on unwind.
-define void @test_sret(i32* nocapture noalias dereferenceable(4) sret(i32) %x) {
+define void @test_sret(ptr nocapture noalias dereferenceable(4) sret(i32) %x) {
; CHECK-LABEL: @test_sret(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[T:%.*]] = alloca i32, align 4
-; CHECK-NEXT: call void @may_throw(i32* nonnull [[T]])
-; CHECK-NEXT: [[LOAD:%.*]] = load i32, i32* [[T]], align 4
-; CHECK-NEXT: store i32 [[LOAD]], i32* [[X:%.*]], align 4
+; CHECK-NEXT: call void @may_throw(ptr nonnull [[T]])
+; CHECK-NEXT: [[LOAD:%.*]] = load i32, ptr [[T]], align 4
+; CHECK-NEXT: store i32 [[LOAD]], ptr [[X:%.*]], align 4
; CHECK-NEXT: ret void
;
entry:
%t = alloca i32, align 4
- call void @may_throw(i32* nonnull %t)
- %load = load i32, i32* %t, align 4
- store i32 %load, i32* %x, align 4
+ call void @may_throw(ptr nonnull %t)
+ %load = load i32, ptr %t, align 4
+ store i32 %load, ptr %x, align 4
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/capturing-func.ll b/llvm/test/Transforms/MemCpyOpt/capturing-func.ll
index 84c1446ae0a4..d6078d45a356 100644
--- a/llvm/test/Transforms/MemCpyOpt/capturing-func.ll
+++ b/llvm/test/Transforms/MemCpyOpt/capturing-func.ll
@@ -3,10 +3,10 @@
target datalayout = "e"
-declare void @foo(i8*)
-declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
+declare void @foo(ptr)
+declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
; Check that the transformation isn't applied if the called function can
; capture the pointer argument (i.e. the nocapture attribute isn't present)
@@ -14,16 +14,16 @@ define void @test() {
; CHECK-LABEL: define {{[^@]+}}@test() {
; CHECK-NEXT: [[PTR1:%.*]] = alloca i8, align 1
; CHECK-NEXT: [[PTR2:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @foo(i8* [[PTR2]])
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[PTR1]], i8* [[PTR2]], i32 1, i1 false)
-; CHECK-NEXT: call void @foo(i8* [[PTR1]])
+; CHECK-NEXT: call void @foo(ptr [[PTR2]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[PTR1]], ptr [[PTR2]], i32 1, i1 false)
+; CHECK-NEXT: call void @foo(ptr [[PTR1]])
; CHECK-NEXT: ret void
;
%ptr1 = alloca i8
%ptr2 = alloca i8
- call void @foo(i8* %ptr2)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %ptr1, i8* %ptr2, i32 1, i1 false)
- call void @foo(i8* %ptr1)
+ call void @foo(ptr %ptr2)
+ call void @llvm.memcpy.p0.p0.i32(ptr %ptr1, ptr %ptr2, i32 1, i1 false)
+ call void @foo(ptr %ptr1)
ret void
}
@@ -32,20 +32,16 @@ define void @test_bitcast() {
; CHECK-LABEL: define {{[^@]+}}@test_bitcast() {
; CHECK-NEXT: [[PTR1:%.*]] = alloca [2 x i8], align 1
; CHECK-NEXT: [[PTR2:%.*]] = alloca [2 x i8], align 1
-; CHECK-NEXT: [[PTR1_CAST:%.*]] = bitcast [2 x i8]* [[PTR1]] to i8*
-; CHECK-NEXT: [[PTR2_CAST:%.*]] = bitcast [2 x i8]* [[PTR2]] to i8*
-; CHECK-NEXT: call void @foo(i8* [[PTR2_CAST]])
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[PTR1_CAST]], i8* [[PTR2_CAST]], i32 2, i1 false)
-; CHECK-NEXT: call void @foo(i8* [[PTR1_CAST]])
+; CHECK-NEXT: call void @foo(ptr [[PTR2]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[PTR1]], ptr [[PTR2]], i32 2, i1 false)
+; CHECK-NEXT: call void @foo(ptr [[PTR1]])
; CHECK-NEXT: ret void
;
%ptr1 = alloca [2 x i8]
%ptr2 = alloca [2 x i8]
- %ptr1.cast = bitcast [2 x i8]* %ptr1 to i8*
- %ptr2.cast = bitcast [2 x i8]* %ptr2 to i8*
- call void @foo(i8* %ptr2.cast)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %ptr1.cast, i8* %ptr2.cast, i32 2, i1 false)
- call void @foo(i8* %ptr1.cast)
+ call void @foo(ptr %ptr2)
+ call void @llvm.memcpy.p0.p0.i32(ptr %ptr1, ptr %ptr2, i32 2, i1 false)
+ call void @foo(ptr %ptr1)
ret void
}
@@ -55,19 +51,19 @@ define void @test_lifetime_end() {
; CHECK-LABEL: define {{[^@]+}}@test_lifetime_end() {
; CHECK-NEXT: [[PTR1:%.*]] = alloca i8, align 1
; CHECK-NEXT: [[PTR2:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* [[PTR2]])
-; CHECK-NEXT: call void @foo(i8* [[PTR1]])
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* [[PTR2]])
-; CHECK-NEXT: call void @foo(i8* [[PTR1]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 1, ptr [[PTR2]])
+; CHECK-NEXT: call void @foo(ptr [[PTR1]])
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 1, ptr [[PTR2]])
+; CHECK-NEXT: call void @foo(ptr [[PTR1]])
; CHECK-NEXT: ret void
;
%ptr1 = alloca i8
%ptr2 = alloca i8
- call void @llvm.lifetime.start.p0i8(i64 1, i8* %ptr2)
- call void @foo(i8* %ptr2)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %ptr1, i8* %ptr2, i32 1, i1 false)
- call void @llvm.lifetime.end.p0i8(i64 1, i8* %ptr2)
- call void @foo(i8* %ptr1)
+ call void @llvm.lifetime.start.p0(i64 1, ptr %ptr2)
+ call void @foo(ptr %ptr2)
+ call void @llvm.memcpy.p0.p0.i32(ptr %ptr1, ptr %ptr2, i32 1, i1 false)
+ call void @llvm.lifetime.end.p0(i64 1, ptr %ptr2)
+ call void @foo(ptr %ptr1)
ret void
}
@@ -76,20 +72,20 @@ define void @test_lifetime_not_end() {
; CHECK-LABEL: define {{[^@]+}}@test_lifetime_not_end() {
; CHECK-NEXT: [[PTR1:%.*]] = alloca i8, align 1
; CHECK-NEXT: [[PTR2:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* [[PTR2]])
-; CHECK-NEXT: call void @foo(i8* [[PTR2]])
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[PTR1]], i8* [[PTR2]], i32 1, i1 false)
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 0, i8* [[PTR2]])
-; CHECK-NEXT: call void @foo(i8* [[PTR1]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 1, ptr [[PTR2]])
+; CHECK-NEXT: call void @foo(ptr [[PTR2]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[PTR1]], ptr [[PTR2]], i32 1, i1 false)
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 0, ptr [[PTR2]])
+; CHECK-NEXT: call void @foo(ptr [[PTR1]])
; CHECK-NEXT: ret void
;
%ptr1 = alloca i8
%ptr2 = alloca i8
- call void @llvm.lifetime.start.p0i8(i64 1, i8* %ptr2)
- call void @foo(i8* %ptr2)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %ptr1, i8* %ptr2, i32 1, i1 false)
- call void @llvm.lifetime.end.p0i8(i64 0, i8* %ptr2)
- call void @foo(i8* %ptr1)
+ call void @llvm.lifetime.start.p0(i64 1, ptr %ptr2)
+ call void @foo(ptr %ptr2)
+ call void @llvm.memcpy.p0.p0.i32(ptr %ptr1, ptr %ptr2, i32 1, i1 false)
+ call void @llvm.lifetime.end.p0(i64 0, ptr %ptr2)
+ call void @foo(ptr %ptr1)
ret void
}
@@ -99,13 +95,13 @@ define void @test_function_end() {
; CHECK-LABEL: define {{[^@]+}}@test_function_end() {
; CHECK-NEXT: [[PTR1:%.*]] = alloca i8, align 1
; CHECK-NEXT: [[PTR2:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @foo(i8* [[PTR1]])
+; CHECK-NEXT: call void @foo(ptr [[PTR1]])
; CHECK-NEXT: ret void
;
%ptr1 = alloca i8
%ptr2 = alloca i8
- call void @foo(i8* %ptr2)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %ptr1, i8* %ptr2, i32 1, i1 false)
+ call void @foo(ptr %ptr2)
+ call void @llvm.memcpy.p0.p0.i32(ptr %ptr1, ptr %ptr2, i32 1, i1 false)
ret void
}
@@ -114,21 +110,21 @@ define void @test_terminator() {
; CHECK-LABEL: define {{[^@]+}}@test_terminator() {
; CHECK-NEXT: [[PTR1:%.*]] = alloca i8, align 1
; CHECK-NEXT: [[PTR2:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @foo(i8* [[PTR2]])
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[PTR1]], i8* [[PTR2]], i32 1, i1 false)
+; CHECK-NEXT: call void @foo(ptr [[PTR2]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[PTR1]], ptr [[PTR2]], i32 1, i1 false)
; CHECK-NEXT: br label [[NEXT:%.*]]
; CHECK: next:
-; CHECK-NEXT: call void @foo(i8* [[PTR1]])
+; CHECK-NEXT: call void @foo(ptr [[PTR1]])
; CHECK-NEXT: ret void
;
%ptr1 = alloca i8
%ptr2 = alloca i8
- call void @foo(i8* %ptr2)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %ptr1, i8* %ptr2, i32 1, i1 false)
+ call void @foo(ptr %ptr2)
+ call void @llvm.memcpy.p0.p0.i32(ptr %ptr1, ptr %ptr2, i32 1, i1 false)
br label %next
next:
- call void @foo(i8* %ptr1)
+ call void @foo(ptr %ptr1)
ret void
}
@@ -138,39 +134,39 @@ define void @test_terminator2() {
; CHECK-LABEL: define {{[^@]+}}@test_terminator2() {
; CHECK-NEXT: [[PTR1:%.*]] = alloca i8, align 1
; CHECK-NEXT: [[PTR2:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @foo(i8* [[PTR2]])
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[PTR1]], i8* [[PTR2]], i32 1, i1 false)
+; CHECK-NEXT: call void @foo(ptr [[PTR2]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[PTR1]], ptr [[PTR2]], i32 1, i1 false)
; CHECK-NEXT: br label [[NEXT:%.*]]
; CHECK: next:
; CHECK-NEXT: ret void
;
%ptr1 = alloca i8
%ptr2 = alloca i8
- call void @foo(i8* %ptr2)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %ptr1, i8* %ptr2, i32 1, i1 false)
+ call void @foo(ptr %ptr2)
+ call void @llvm.memcpy.p0.p0.i32(ptr %ptr1, ptr %ptr2, i32 1, i1 false)
br label %next
next:
ret void
}
-declare void @capture(i8*)
+declare void @capture(ptr)
; This case should not be optimized, because dest is captured before the call.
define void @test_dest_captured_before_alloca() {
; CHECK-LABEL: define {{[^@]+}}@test_dest_captured_before_alloca() {
; CHECK-NEXT: [[PTR1:%.*]] = alloca i8, align 1
; CHECK-NEXT: [[PTR2:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @capture(i8* [[PTR1]])
-; CHECK-NEXT: call void @foo(i8* [[PTR2]]) #[[ATTR2:[0-9]+]]
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[PTR1]], i8* [[PTR2]], i32 1, i1 false)
+; CHECK-NEXT: call void @capture(ptr [[PTR1]])
+; CHECK-NEXT: call void @foo(ptr [[PTR2]]) #[[ATTR2:[0-9]+]]
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[PTR1]], ptr [[PTR2]], i32 1, i1 false)
; CHECK-NEXT: ret void
;
%ptr1 = alloca i8
%ptr2 = alloca i8
- call void @capture(i8* %ptr1)
- call void @foo(i8* %ptr2) argmemonly
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %ptr1, i8* %ptr2, i32 1, i1 false)
+ call void @capture(ptr %ptr1)
+ call void @foo(ptr %ptr2) argmemonly
+ call void @llvm.memcpy.p0.p0.i32(ptr %ptr1, ptr %ptr2, i32 1, i1 false)
ret void
}
@@ -182,36 +178,36 @@ define void @test_dest_captured_before_alloca() {
define void @test_dest_captured_before_global() {
; CHECK-LABEL: define {{[^@]+}}@test_dest_captured_before_global() {
; CHECK-NEXT: [[PTR:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @icmp_g(i8* [[PTR]])
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* @g, i8* [[PTR]], i32 1, i1 false)
+; CHECK-NEXT: call void @icmp_g(ptr [[PTR]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr @g, ptr [[PTR]], i32 1, i1 false)
; CHECK-NEXT: ret void
;
%ptr = alloca i8
- call void @icmp_g(i8* %ptr)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* @g, i8* %ptr, i32 1, i1 false)
+ call void @icmp_g(ptr %ptr)
+ call void @llvm.memcpy.p0.p0.i32(ptr @g, ptr %ptr, i32 1, i1 false)
ret void
}
-define void @icmp_g(i8* %p) {
+define void @icmp_g(ptr %p) {
; CHECK-LABEL: define {{[^@]+}}@icmp_g
-; CHECK-SAME: (i8* [[P:%.*]]) {
-; CHECK-NEXT: [[C:%.*]] = icmp eq i8* [[P]], @g
+; CHECK-SAME: (ptr [[P:%.*]]) {
+; CHECK-NEXT: [[C:%.*]] = icmp eq ptr [[P]], @g
; CHECK-NEXT: br i1 [[C]], label [[IF:%.*]], label [[ELSE:%.*]]
; CHECK: if:
-; CHECK-NEXT: store i8 1, i8* [[P]], align 1
+; CHECK-NEXT: store i8 1, ptr [[P]], align 1
; CHECK-NEXT: ret void
; CHECK: else:
-; CHECK-NEXT: store i8 2, i8* [[P]], align 1
+; CHECK-NEXT: store i8 2, ptr [[P]], align 1
; CHECK-NEXT: ret void
;
- %c = icmp eq i8* %p, @g
+ %c = icmp eq ptr %p, @g
br i1 %c, label %if, label %else
if:
- store i8 1, i8* %p
+ store i8 1, ptr %p
ret void
else:
- store i8 2, i8* %p
+ store i8 2, ptr %p
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/crash.ll b/llvm/test/Transforms/MemCpyOpt/crash.ll
index 0c1938643047..e32d8967248e 100644
--- a/llvm/test/Transforms/MemCpyOpt/crash.ll
+++ b/llvm/test/Transforms/MemCpyOpt/crash.ll
@@ -8,78 +8,74 @@ target triple = "armv7-eabi"
%struct.bar = type { %struct.qw, %struct.qw, %struct.qw, %struct.qw, %struct.qw, float, float}
; PR4882
-define void @test1(%struct.bar* %this) {
+define void @test1(ptr %this) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[STRUCT_BAR:%.*]], %struct.bar* [[THIS:%.*]], i32 0, i32 0, i32 0, i32 0
-; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_BAR]], %struct.bar* [[THIS]], i32 0, i32 0, i32 0, i32 1
-; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[STRUCT_BAR]], %struct.bar* [[THIS]], i32 0, i32 0, i32 0, i32 2
-; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds [[STRUCT_BAR]], %struct.bar* [[THIS]], i32 0, i32 0, i32 0, i32 3
-; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[STRUCT_BAR]], %struct.bar* [[THIS]], i32 0, i32 1, i32 0, i32 0
-; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[STRUCT_BAR]], %struct.bar* [[THIS]], i32 0, i32 1, i32 0, i32 1
-; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[STRUCT_BAR]], %struct.bar* [[THIS]], i32 0, i32 1, i32 0, i32 2
-; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT_BAR]], %struct.bar* [[THIS]], i32 0, i32 1, i32 0, i32 3
-; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT_BAR]], %struct.bar* [[THIS]], i32 0, i32 3, i32 0, i32 1
-; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT_BAR]], %struct.bar* [[THIS]], i32 0, i32 3, i32 0, i32 2
-; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT_BAR]], %struct.bar* [[THIS]], i32 0, i32 3, i32 0, i32 3
-; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT_BAR]], %struct.bar* [[THIS]], i32 0, i32 4, i32 0, i32 0
-; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT_BAR]], %struct.bar* [[THIS]], i32 0, i32 4, i32 0, i32 1
-; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT_BAR]], %struct.bar* [[THIS]], i32 0, i32 4, i32 0, i32 2
-; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT_BAR]], %struct.bar* [[THIS]], i32 0, i32 4, i32 0, i32 3
-; CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds [[STRUCT_BAR]], %struct.bar* [[THIS]], i32 0, i32 5
-; CHECK-NEXT: [[TMP16:%.*]] = bitcast float* [[TMP0]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[TMP16]], i8 0, i64 32, i1 false)
-; CHECK-NEXT: [[TMP17:%.*]] = bitcast float* [[TMP8]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[TMP17]], i8 0, i64 32, i1 false)
+; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[STRUCT_BAR:%.*]], ptr [[THIS:%.*]], i32 0, i32 0, i32 0, i32 1
+; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 0, i32 0, i32 2
+; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 0, i32 0, i32 3
+; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 1, i32 0, i32 0
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 1, i32 0, i32 1
+; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 1, i32 0, i32 2
+; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 1, i32 0, i32 3
+; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 3, i32 0, i32 1
+; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 3, i32 0, i32 2
+; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 3, i32 0, i32 3
+; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 4, i32 0, i32 0
+; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 4, i32 0, i32 1
+; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 4, i32 0, i32 2
+; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 4, i32 0, i32 3
+; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 5
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[THIS]], i8 0, i64 32, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[TMP7]], i8 0, i64 32, i1 false)
; CHECK-NEXT: unreachable
;
entry:
- %0 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 0, i32 0, i32 0
- store float 0.000000e+00, float* %0, align 4
- %1 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 0, i32 0, i32 1
- store float 0.000000e+00, float* %1, align 4
- %2 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 0, i32 0, i32 2
- store float 0.000000e+00, float* %2, align 4
- %3 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 0, i32 0, i32 3
- store float 0.000000e+00, float* %3, align 4
- %4 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 1, i32 0, i32 0
- store float 0.000000e+00, float* %4, align 4
- %5 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 1, i32 0, i32 1
- store float 0.000000e+00, float* %5, align 4
- %6 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 1, i32 0, i32 2
- store float 0.000000e+00, float* %6, align 4
- %7 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 1, i32 0, i32 3
- store float 0.000000e+00, float* %7, align 4
- %8 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 3, i32 0, i32 1
- store float 0.000000e+00, float* %8, align 4
- %9 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 3, i32 0, i32 2
- store float 0.000000e+00, float* %9, align 4
- %10 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 3, i32 0, i32 3
- store float 0.000000e+00, float* %10, align 4
- %11 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 4, i32 0, i32 0
- store float 0.000000e+00, float* %11, align 4
- %12 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 4, i32 0, i32 1
- store float 0.000000e+00, float* %12, align 4
- %13 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 4, i32 0, i32 2
- store float 0.000000e+00, float* %13, align 4
- %14 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 4, i32 0, i32 3
- store float 0.000000e+00, float* %14, align 4
- %15 = getelementptr inbounds %struct.bar, %struct.bar* %this, i32 0, i32 5
- store float 0.000000e+00, float* %15, align 4
+ store float 0.000000e+00, ptr %this, align 4
+ %0 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 0, i32 0, i32 1
+ store float 0.000000e+00, ptr %0, align 4
+ %1 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 0, i32 0, i32 2
+ store float 0.000000e+00, ptr %1, align 4
+ %2 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 0, i32 0, i32 3
+ store float 0.000000e+00, ptr %2, align 4
+ %3 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 1, i32 0, i32 0
+ store float 0.000000e+00, ptr %3, align 4
+ %4 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 1, i32 0, i32 1
+ store float 0.000000e+00, ptr %4, align 4
+ %5 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 1, i32 0, i32 2
+ store float 0.000000e+00, ptr %5, align 4
+ %6 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 1, i32 0, i32 3
+ store float 0.000000e+00, ptr %6, align 4
+ %7 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 3, i32 0, i32 1
+ store float 0.000000e+00, ptr %7, align 4
+ %8 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 3, i32 0, i32 2
+ store float 0.000000e+00, ptr %8, align 4
+ %9 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 3, i32 0, i32 3
+ store float 0.000000e+00, ptr %9, align 4
+ %10 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 4, i32 0, i32 0
+ store float 0.000000e+00, ptr %10, align 4
+ %11 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 4, i32 0, i32 1
+ store float 0.000000e+00, ptr %11, align 4
+ %12 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 4, i32 0, i32 2
+ store float 0.000000e+00, ptr %12, align 4
+ %13 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 4, i32 0, i32 3
+ store float 0.000000e+00, ptr %13, align 4
+ %14 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 5
+ store float 0.000000e+00, ptr %14, align 4
unreachable
}
; PR8753
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind
define void @test2(i32 %cmd) nounwind {
; CHECK-LABEL: @test2(
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* null, i8* undef, i64 20, i1 false) [[ATTR1:#.*]]
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr null, ptr undef, i64 20, i1 false) #[[ATTR1:[0-9]+]]
; CHECK-NEXT: ret void
;
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* undef, i8* undef, i64 20, i1 false) nounwind
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* null, i8* undef, i64 20, i1 false) nounwind
+ call void @llvm.memcpy.p0.p0.i64(ptr undef, ptr undef, i64 20, i1 false) nounwind
+ call void @llvm.memcpy.p0.p0.i64(ptr null, ptr undef, i64 20, i1 false) nounwind
ret void
}
@@ -87,11 +83,11 @@ define void @test2(i32 %cmd) nounwind {
@g = external global i16, align 1
-define void @inttoptr_constexpr_crash(<1 x i16*>* %p) {
+define void @inttoptr_constexpr_crash(ptr %p) {
; CHECK-LABEL: @inttoptr_constexpr_crash(
-; CHECK-NEXT: store <1 x i16*> inttoptr (<1 x i16> bitcast (<2 x i8> <i8 ptrtoint (i16* @g to i8), i8 ptrtoint (i16* @g to i8)> to <1 x i16>) to <1 x i16*>), <1 x i16*>* [[P:%.*]], align 1
+; CHECK-NEXT: store <1 x ptr> inttoptr (<1 x i16> bitcast (<2 x i8> <i8 ptrtoint (ptr @g to i8), i8 ptrtoint (ptr @g to i8)> to <1 x i16>) to <1 x ptr>), ptr [[P:%.*]], align 1
; CHECK-NEXT: ret void
;
- store <1 x i16*> inttoptr (<1 x i16> bitcast (<2 x i8> <i8 ptrtoint (i16* @g to i8), i8 ptrtoint (i16* @g to i8)> to <1 x i16>) to <1 x i16*>), <1 x i16*>* %p, align 1
+ store <1 x ptr> inttoptr (<1 x i16> bitcast (<2 x i8> <i8 ptrtoint (ptr @g to i8), i8 ptrtoint (ptr @g to i8)> to <1 x i16>) to <1 x ptr>), ptr %p, align 1
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/fca2memcpy.ll b/llvm/test/Transforms/MemCpyOpt/fca2memcpy.ll
index f18d6cd2cecb..33ce9c24a2b9 100644
--- a/llvm/test/Transforms/MemCpyOpt/fca2memcpy.ll
+++ b/llvm/test/Transforms/MemCpyOpt/fca2memcpy.ll
@@ -4,160 +4,140 @@
target datalayout = "e-i64:64-f80:128-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"
-%S = type { i8*, i8, i32 }
+%S = type { ptr, i8, i32 }
-define void @copy(%S* %src, %S* %dst) {
+define void @copy(ptr %src, ptr %dst) {
; CHECK-LABEL: @copy(
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast %S* [[DST:%.*]] to i8*
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast %S* [[SRC:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memmove.p0i8.p0i8.i64(i8* align 8 [[TMP1]], i8* align 8 [[TMP2]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memmove.p0.p0.i64(ptr align 8 [[DST:%.*]], ptr align 8 [[SRC:%.*]], i64 16, i1 false)
; CHECK-NEXT: ret void
;
- %1 = load %S, %S* %src
- store %S %1, %S* %dst
+ %1 = load %S, ptr %src
+ store %S %1, ptr %dst
ret void
}
-define void @noaliassrc(%S* noalias %src, %S* %dst) {
+define void @noaliassrc(ptr noalias %src, ptr %dst) {
; CHECK-LABEL: @noaliassrc(
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast %S* [[DST:%.*]] to i8*
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast %S* [[SRC:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[TMP1]], i8* align 8 [[TMP2]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DST:%.*]], ptr align 8 [[SRC:%.*]], i64 16, i1 false)
; CHECK-NEXT: ret void
;
- %1 = load %S, %S* %src
- store %S %1, %S* %dst
+ %1 = load %S, ptr %src
+ store %S %1, ptr %dst
ret void
}
-define void @noaliasdst(%S* %src, %S* noalias %dst) {
+define void @noaliasdst(ptr %src, ptr noalias %dst) {
; CHECK-LABEL: @noaliasdst(
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast %S* [[DST:%.*]] to i8*
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast %S* [[SRC:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[TMP1]], i8* align 8 [[TMP2]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DST:%.*]], ptr align 8 [[SRC:%.*]], i64 16, i1 false)
; CHECK-NEXT: ret void
;
- %1 = load %S, %S* %src
- store %S %1, %S* %dst
+ %1 = load %S, ptr %src
+ store %S %1, ptr %dst
ret void
}
-define void @destroysrc(%S* %src, %S* %dst) {
+define void @destroysrc(ptr %src, ptr %dst) {
; CHECK-LABEL: @destroysrc(
-; CHECK-NEXT: [[TMP1:%.*]] = load [[S:%.*]], %S* [[SRC:%.*]], align 8
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast %S* [[SRC]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP2]], i8 0, i64 16, i1 false)
-; CHECK-NEXT: store [[S]] [[TMP1]], %S* [[DST:%.*]], align 8
+; CHECK-NEXT: [[TMP1:%.*]] = load [[S:%.*]], ptr [[SRC:%.*]], align 8
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[SRC]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: store [[S]] [[TMP1]], ptr [[DST:%.*]], align 8
; CHECK-NEXT: ret void
;
- %1 = load %S, %S* %src
- store %S zeroinitializer, %S* %src
- store %S %1, %S* %dst
+ %1 = load %S, ptr %src
+ store %S zeroinitializer, ptr %src
+ store %S %1, ptr %dst
ret void
}
-define void @destroynoaliassrc(%S* noalias %src, %S* %dst) {
+define void @destroynoaliassrc(ptr noalias %src, ptr %dst) {
; CHECK-LABEL: @destroynoaliassrc(
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast %S* [[SRC:%.*]] to i8*
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast %S* [[DST:%.*]] to i8*
-; CHECK-NEXT: [[TMP3:%.*]] = bitcast %S* [[SRC]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[TMP2]], i8* align 8 [[TMP3]], i64 16, i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP1]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DST:%.*]], ptr align 8 [[SRC]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[SRC:%.*]], i8 0, i64 16, i1 false)
; CHECK-NEXT: ret void
;
- %1 = load %S, %S* %src
- store %S zeroinitializer, %S* %src
- store %S %1, %S* %dst
+ %1 = load %S, ptr %src
+ store %S zeroinitializer, ptr %src
+ store %S %1, ptr %dst
ret void
}
-define void @copyalias(%S* %src, %S* %dst) {
+define void @copyalias(ptr %src, ptr %dst) {
; CHECK-LABEL: @copyalias(
-; CHECK-NEXT: [[TMP1:%.*]] = load [[S:%.*]], %S* [[SRC:%.*]], align 8
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast %S* [[DST:%.*]] to i8*
-; CHECK-NEXT: [[TMP3:%.*]] = bitcast %S* [[SRC]] to i8*
-; CHECK-NEXT: call void @llvm.memmove.p0i8.p0i8.i64(i8* align 8 [[TMP2]], i8* align 8 [[TMP3]], i64 16, i1 false)
-; CHECK-NEXT: store [[S]] [[TMP1]], %S* [[DST]], align 8
+; CHECK-NEXT: [[TMP1:%.*]] = load [[S:%.*]], ptr [[SRC:%.*]], align 8
+; CHECK-NEXT: call void @llvm.memmove.p0.p0.i64(ptr align 8 [[DST:%.*]], ptr align 8 [[SRC]], i64 16, i1 false)
+; CHECK-NEXT: store [[S]] [[TMP1]], ptr [[DST]], align 8
; CHECK-NEXT: ret void
;
- %1 = load %S, %S* %src
- %2 = load %S, %S* %src
- store %S %1, %S* %dst
- store %S %2, %S* %dst
+ %1 = load %S, ptr %src
+ %2 = load %S, ptr %src
+ store %S %1, ptr %dst
+ store %S %2, ptr %dst
ret void
}
; If the store address is computed in a complex manner, make
; sure we lift the computation as well if needed and possible.
-define void @addrproducer(%S* %src, %S* %dst) {
+define void @addrproducer(ptr %src, ptr %dst) {
; CHECK-LABEL: @addrproducer(
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast %S* [[DST:%.*]] to i8*
-; CHECK-NEXT: [[DST2:%.*]] = getelementptr [[S:%.*]], %S* [[DST]], i64 1
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast %S* [[DST2]] to i8*
-; CHECK-NEXT: [[TMP3:%.*]] = bitcast %S* [[SRC:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memmove.p0i8.p0i8.i64(i8* align 8 [[TMP2]], i8* align 8 [[TMP3]], i64 16, i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP1]], i8 undef, i64 16, i1 false)
+; CHECK-NEXT: [[DST2:%.*]] = getelementptr [[S:%.*]], ptr [[DST]], i64 1
+; CHECK-NEXT: call void @llvm.memmove.p0.p0.i64(ptr align 8 [[DST2]], ptr align 8 [[SRC:%.*]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[DST:%.*]], i8 undef, i64 16, i1 false)
; CHECK-NEXT: ret void
;
- %1 = load %S, %S* %src
- store %S undef, %S* %dst
- %dst2 = getelementptr %S , %S* %dst, i64 1
- store %S %1, %S* %dst2
+ %1 = load %S, ptr %src
+ store %S undef, ptr %dst
+ %dst2 = getelementptr %S , ptr %dst, i64 1
+ store %S %1, ptr %dst2
ret void
}
-define void @aliasaddrproducer(%S* %src, %S* %dst, i32* %dstidptr) {
+define void @aliasaddrproducer(ptr %src, ptr %dst, ptr %dstidptr) {
; CHECK-LABEL: @aliasaddrproducer(
-; CHECK-NEXT: [[TMP1:%.*]] = load [[S:%.*]], %S* [[SRC:%.*]], align 8
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast %S* [[DST:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP2]], i8 undef, i64 16, i1 false)
-; CHECK-NEXT: [[DSTINDEX:%.*]] = load i32, i32* [[DSTIDPTR:%.*]], align 4
-; CHECK-NEXT: [[DST2:%.*]] = getelementptr [[S]], %S* [[DST]], i32 [[DSTINDEX]]
-; CHECK-NEXT: store [[S]] [[TMP1]], %S* [[DST2]], align 8
+; CHECK-NEXT: [[TMP1:%.*]] = load [[S:%.*]], ptr [[SRC:%.*]], align 8
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[DST:%.*]], i8 undef, i64 16, i1 false)
+; CHECK-NEXT: [[DSTINDEX:%.*]] = load i32, ptr [[DSTIDPTR:%.*]], align 4
+; CHECK-NEXT: [[DST2:%.*]] = getelementptr [[S]], ptr [[DST]], i32 [[DSTINDEX]]
+; CHECK-NEXT: store [[S]] [[TMP1]], ptr [[DST2]], align 8
; CHECK-NEXT: ret void
;
- %1 = load %S, %S* %src
- store %S undef, %S* %dst
- %dstindex = load i32, i32* %dstidptr
- %dst2 = getelementptr %S , %S* %dst, i32 %dstindex
- store %S %1, %S* %dst2
+ %1 = load %S, ptr %src
+ store %S undef, ptr %dst
+ %dstindex = load i32, ptr %dstidptr
+ %dst2 = getelementptr %S , ptr %dst, i32 %dstindex
+ store %S %1, ptr %dst2
ret void
}
-define void @noaliasaddrproducer(%S* %src, %S* noalias %dst, i32* noalias %dstidptr) {
+define void @noaliasaddrproducer(ptr %src, ptr noalias %dst, ptr noalias %dstidptr) {
; CHECK-LABEL: @noaliasaddrproducer(
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast %S* [[SRC:%.*]] to i8*
-; CHECK-NEXT: [[TMP2:%.*]] = load i32, i32* [[DSTIDPTR:%.*]], align 4
+; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[DSTIDPTR:%.*]], align 4
; CHECK-NEXT: [[DSTINDEX:%.*]] = or i32 [[TMP2]], 1
-; CHECK-NEXT: [[DST2:%.*]] = getelementptr [[S:%.*]], %S* [[DST:%.*]], i32 [[DSTINDEX]]
-; CHECK-NEXT: [[TMP3:%.*]] = bitcast %S* [[DST2]] to i8*
-; CHECK-NEXT: [[TMP4:%.*]] = bitcast %S* [[SRC]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[TMP3]], i8* align 8 [[TMP4]], i64 16, i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP1]], i8 undef, i64 16, i1 false)
+; CHECK-NEXT: [[DST2:%.*]] = getelementptr [[S:%.*]], ptr [[DST:%.*]], i32 [[DSTINDEX]]
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DST2]], ptr align 8 [[SRC]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[SRC:%.*]], i8 undef, i64 16, i1 false)
; CHECK-NEXT: ret void
;
- %1 = load %S, %S* %src
- store %S undef, %S* %src
- %2 = load i32, i32* %dstidptr
+ %1 = load %S, ptr %src
+ store %S undef, ptr %src
+ %2 = load i32, ptr %dstidptr
%dstindex = or i32 %2, 1
- %dst2 = getelementptr %S , %S* %dst, i32 %dstindex
- store %S %1, %S* %dst2
+ %dst2 = getelementptr %S , ptr %dst, i32 %dstindex
+ store %S %1, ptr %dst2
ret void
}
-define void @throwing_call(%S* noalias %src, %S* %dst) {
+define void @throwing_call(ptr noalias %src, ptr %dst) {
; CHECK-LABEL: @throwing_call(
-; CHECK-NEXT: [[TMP1:%.*]] = load [[S:%.*]], %S* [[SRC:%.*]], align 8
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast %S* [[SRC]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP2]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: [[TMP1:%.*]] = load [[S:%.*]], ptr [[SRC:%.*]], align 8
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[SRC]], i8 0, i64 16, i1 false)
; CHECK-NEXT: call void @call() [[ATTR2:#.*]]
-; CHECK-NEXT: store [[S]] [[TMP1]], %S* [[DST:%.*]], align 8
+; CHECK-NEXT: store [[S]] [[TMP1]], ptr [[DST:%.*]], align 8
; CHECK-NEXT: ret void
;
- %1 = load %S, %S* %src
- store %S zeroinitializer, %S* %src
+ %1 = load %S, ptr %src
+ store %S zeroinitializer, ptr %src
call void @call() readnone
- store %S %1, %S* %dst
+ store %S %1, ptr %dst
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/form-memset.ll b/llvm/test/Transforms/MemCpyOpt/form-memset.ll
index 416df663a8b8..862dcec9e92c 100644
--- a/llvm/test/Transforms/MemCpyOpt/form-memset.ll
+++ b/llvm/test/Transforms/MemCpyOpt/form-memset.ll
@@ -10,70 +10,70 @@ define void @test1(i8 signext %c) nounwind {
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[X:%.*]] = alloca [19 x i8], align 1
-; CHECK-NEXT: [[TMP:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 0
-; CHECK-NEXT: [[TMP5:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 1
-; CHECK-NEXT: [[TMP9:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 2
-; CHECK-NEXT: [[TMP13:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 3
-; CHECK-NEXT: [[TMP17:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 4
-; CHECK-NEXT: [[TMP21:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 5
-; CHECK-NEXT: [[TMP25:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 6
-; CHECK-NEXT: [[TMP29:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 7
-; CHECK-NEXT: [[TMP33:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 8
-; CHECK-NEXT: [[TMP37:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 9
-; CHECK-NEXT: [[TMP41:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 10
-; CHECK-NEXT: [[TMP45:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 11
-; CHECK-NEXT: [[TMP49:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 12
-; CHECK-NEXT: [[TMP53:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 13
-; CHECK-NEXT: [[TMP57:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 14
-; CHECK-NEXT: [[TMP61:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 15
-; CHECK-NEXT: [[TMP65:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 16
-; CHECK-NEXT: [[TMP69:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 17
-; CHECK-NEXT: [[TMP73:%.*]] = getelementptr [19 x i8], [19 x i8]* [[X]], i32 0, i32 18
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP]], i8 [[C:%.*]], i64 19, i1 false)
-; CHECK-NEXT: [[TMP76:%.*]] = call i32 (...) @bar([19 x i8]* [[X]]) [[ATTR0:#.*]]
+; CHECK-NEXT: [[TMP:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 0
+; CHECK-NEXT: [[TMP5:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 1
+; CHECK-NEXT: [[TMP9:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 2
+; CHECK-NEXT: [[TMP13:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 3
+; CHECK-NEXT: [[TMP17:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 4
+; CHECK-NEXT: [[TMP21:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 5
+; CHECK-NEXT: [[TMP25:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 6
+; CHECK-NEXT: [[TMP29:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 7
+; CHECK-NEXT: [[TMP33:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 8
+; CHECK-NEXT: [[TMP37:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 9
+; CHECK-NEXT: [[TMP41:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 10
+; CHECK-NEXT: [[TMP45:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 11
+; CHECK-NEXT: [[TMP49:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 12
+; CHECK-NEXT: [[TMP53:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 13
+; CHECK-NEXT: [[TMP57:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 14
+; CHECK-NEXT: [[TMP61:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 15
+; CHECK-NEXT: [[TMP65:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 16
+; CHECK-NEXT: [[TMP69:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 17
+; CHECK-NEXT: [[TMP73:%.*]] = getelementptr [19 x i8], ptr [[X]], i32 0, i32 18
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP]], i8 [[C:%.*]], i64 19, i1 false)
+; CHECK-NEXT: [[TMP76:%.*]] = call i32 (...) @bar(ptr [[X]]) #[[ATTR0:[0-9]+]]
; CHECK-NEXT: ret void
;
entry:
- %x = alloca [19 x i8] ; <[19 x i8]*> [#uses=20]
- %tmp = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 0 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp, align 1
- %tmp5 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 1 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp5, align 1
- %tmp9 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 2 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp9, align 1
- %tmp13 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 3 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp13, align 1
- %tmp17 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 4 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp17, align 1
- %tmp21 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 5 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp21, align 1
- %tmp25 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 6 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp25, align 1
- %tmp29 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 7 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp29, align 1
- %tmp33 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 8 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp33, align 1
- %tmp37 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 9 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp37, align 1
- %tmp41 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 10 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp41, align 1
- %tmp45 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 11 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp45, align 1
- %tmp49 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 12 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp49, align 1
- %tmp53 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 13 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp53, align 1
- %tmp57 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 14 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp57, align 1
- %tmp61 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 15 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp61, align 1
- %tmp65 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 16 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp65, align 1
- %tmp69 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 17 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp69, align 1
- %tmp73 = getelementptr [19 x i8], [19 x i8]* %x, i32 0, i32 18 ; <i8*> [#uses=1]
- store i8 %c, i8* %tmp73, align 1
- %tmp76 = call i32 (...) @bar( [19 x i8]* %x ) nounwind
+ %x = alloca [19 x i8] ; <ptr> [#uses=20]
+ %tmp = getelementptr [19 x i8], ptr %x, i32 0, i32 0 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp, align 1
+ %tmp5 = getelementptr [19 x i8], ptr %x, i32 0, i32 1 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp5, align 1
+ %tmp9 = getelementptr [19 x i8], ptr %x, i32 0, i32 2 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp9, align 1
+ %tmp13 = getelementptr [19 x i8], ptr %x, i32 0, i32 3 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp13, align 1
+ %tmp17 = getelementptr [19 x i8], ptr %x, i32 0, i32 4 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp17, align 1
+ %tmp21 = getelementptr [19 x i8], ptr %x, i32 0, i32 5 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp21, align 1
+ %tmp25 = getelementptr [19 x i8], ptr %x, i32 0, i32 6 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp25, align 1
+ %tmp29 = getelementptr [19 x i8], ptr %x, i32 0, i32 7 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp29, align 1
+ %tmp33 = getelementptr [19 x i8], ptr %x, i32 0, i32 8 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp33, align 1
+ %tmp37 = getelementptr [19 x i8], ptr %x, i32 0, i32 9 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp37, align 1
+ %tmp41 = getelementptr [19 x i8], ptr %x, i32 0, i32 10 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp41, align 1
+ %tmp45 = getelementptr [19 x i8], ptr %x, i32 0, i32 11 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp45, align 1
+ %tmp49 = getelementptr [19 x i8], ptr %x, i32 0, i32 12 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp49, align 1
+ %tmp53 = getelementptr [19 x i8], ptr %x, i32 0, i32 13 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp53, align 1
+ %tmp57 = getelementptr [19 x i8], ptr %x, i32 0, i32 14 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp57, align 1
+ %tmp61 = getelementptr [19 x i8], ptr %x, i32 0, i32 15 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp61, align 1
+ %tmp65 = getelementptr [19 x i8], ptr %x, i32 0, i32 16 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp65, align 1
+ %tmp69 = getelementptr [19 x i8], ptr %x, i32 0, i32 17 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp69, align 1
+ %tmp73 = getelementptr [19 x i8], ptr %x, i32 0, i32 18 ; <ptr> [#uses=1]
+ store i8 %c, ptr %tmp73, align 1
+ %tmp76 = call i32 (...) @bar( ptr %x ) nounwind
ret void
}
@@ -88,251 +88,234 @@ define void @test2() nounwind {
; CHECK-NEXT: [[REF_IDX:%.*]] = alloca [8 x i8], align 1
; CHECK-NEXT: [[LEFT_MVD:%.*]] = alloca [8 x %struct.MV], align 8
; CHECK-NEXT: [[UP_MVD:%.*]] = alloca [8 x %struct.MV], align 8
-; CHECK-NEXT: [[TMP20:%.*]] = getelementptr [8 x i8], [8 x i8]* [[REF_IDX]], i32 0, i32 7
-; CHECK-NEXT: [[TMP23:%.*]] = getelementptr [8 x i8], [8 x i8]* [[REF_IDX]], i32 0, i32 6
-; CHECK-NEXT: [[TMP26:%.*]] = getelementptr [8 x i8], [8 x i8]* [[REF_IDX]], i32 0, i32 5
-; CHECK-NEXT: [[TMP29:%.*]] = getelementptr [8 x i8], [8 x i8]* [[REF_IDX]], i32 0, i32 4
-; CHECK-NEXT: [[TMP32:%.*]] = getelementptr [8 x i8], [8 x i8]* [[REF_IDX]], i32 0, i32 3
-; CHECK-NEXT: [[TMP35:%.*]] = getelementptr [8 x i8], [8 x i8]* [[REF_IDX]], i32 0, i32 2
-; CHECK-NEXT: [[TMP38:%.*]] = getelementptr [8 x i8], [8 x i8]* [[REF_IDX]], i32 0, i32 1
-; CHECK-NEXT: [[TMP41:%.*]] = getelementptr [8 x i8], [8 x i8]* [[REF_IDX]], i32 0, i32 0
-; CHECK-NEXT: [[TMP43:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 7, i32 0
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP41]], i8 -1, i64 8, i1 false)
-; CHECK-NEXT: [[TMP46:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 7, i32 1
-; CHECK-NEXT: [[TMP57:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 6, i32 0
-; CHECK-NEXT: [[TMP60:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 6, i32 1
-; CHECK-NEXT: [[TMP71:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 5, i32 0
-; CHECK-NEXT: [[TMP74:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 5, i32 1
-; CHECK-NEXT: [[TMP85:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 4, i32 0
-; CHECK-NEXT: [[TMP88:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 4, i32 1
-; CHECK-NEXT: [[TMP99:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 3, i32 0
-; CHECK-NEXT: [[TMP102:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 3, i32 1
-; CHECK-NEXT: [[TMP113:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 2, i32 0
-; CHECK-NEXT: [[TMP116:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 2, i32 1
-; CHECK-NEXT: [[TMP127:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 1, i32 0
-; CHECK-NEXT: [[TMP130:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 1, i32 1
-; CHECK-NEXT: [[TMP141:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 0, i32 0
-; CHECK-NEXT: [[TMP144:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 0, i32 1
-; CHECK-NEXT: [[TMP148:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 7, i32 0
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast i16* [[TMP141]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP0]], i8 0, i64 32, i1 false)
-; CHECK-NEXT: [[TMP151:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 7, i32 1
-; CHECK-NEXT: [[TMP162:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 6, i32 0
-; CHECK-NEXT: [[TMP165:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 6, i32 1
-; CHECK-NEXT: [[TMP176:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 5, i32 0
-; CHECK-NEXT: [[TMP179:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 5, i32 1
-; CHECK-NEXT: [[TMP190:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 4, i32 0
-; CHECK-NEXT: [[TMP193:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 4, i32 1
-; CHECK-NEXT: [[TMP204:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 3, i32 0
-; CHECK-NEXT: [[TMP207:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 3, i32 1
-; CHECK-NEXT: [[TMP218:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 2, i32 0
-; CHECK-NEXT: [[TMP221:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 2, i32 1
-; CHECK-NEXT: [[TMP232:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 1, i32 0
-; CHECK-NEXT: [[TMP235:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 1, i32 1
-; CHECK-NEXT: [[TMP246:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 0, i32 0
-; CHECK-NEXT: [[TMP249:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 0, i32 1
-; CHECK-NEXT: [[UP_MVD252:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[UP_MVD]], i32 0, i32 0
-; CHECK-NEXT: [[LEFT_MVD253:%.*]] = getelementptr [8 x %struct.MV], [8 x %struct.MV]* [[LEFT_MVD]], i32 0, i32 0
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i16* [[TMP246]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP1]], i8 0, i64 32, i1 false)
-; CHECK-NEXT: call void @foo(%struct.MV* [[UP_MVD252]], %struct.MV* [[LEFT_MVD253]], i8* [[TMP41]]) [[ATTR0]]
+; CHECK-NEXT: [[TMP20:%.*]] = getelementptr [8 x i8], ptr [[REF_IDX]], i32 0, i32 7
+; CHECK-NEXT: [[TMP23:%.*]] = getelementptr [8 x i8], ptr [[REF_IDX]], i32 0, i32 6
+; CHECK-NEXT: [[TMP26:%.*]] = getelementptr [8 x i8], ptr [[REF_IDX]], i32 0, i32 5
+; CHECK-NEXT: [[TMP29:%.*]] = getelementptr [8 x i8], ptr [[REF_IDX]], i32 0, i32 4
+; CHECK-NEXT: [[TMP32:%.*]] = getelementptr [8 x i8], ptr [[REF_IDX]], i32 0, i32 3
+; CHECK-NEXT: [[TMP35:%.*]] = getelementptr [8 x i8], ptr [[REF_IDX]], i32 0, i32 2
+; CHECK-NEXT: [[TMP38:%.*]] = getelementptr [8 x i8], ptr [[REF_IDX]], i32 0, i32 1
+; CHECK-NEXT: [[TMP41:%.*]] = getelementptr [8 x i8], ptr [[REF_IDX]], i32 0, i32 0
+; CHECK-NEXT: [[TMP43:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 7, i32 0
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP41]], i8 -1, i64 8, i1 false)
+; CHECK-NEXT: [[TMP46:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 7, i32 1
+; CHECK-NEXT: [[TMP57:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 6, i32 0
+; CHECK-NEXT: [[TMP60:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 6, i32 1
+; CHECK-NEXT: [[TMP71:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 5, i32 0
+; CHECK-NEXT: [[TMP74:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 5, i32 1
+; CHECK-NEXT: [[TMP85:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 4, i32 0
+; CHECK-NEXT: [[TMP88:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 4, i32 1
+; CHECK-NEXT: [[TMP99:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 3, i32 0
+; CHECK-NEXT: [[TMP102:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 3, i32 1
+; CHECK-NEXT: [[TMP113:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 2, i32 0
+; CHECK-NEXT: [[TMP116:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 2, i32 1
+; CHECK-NEXT: [[TMP127:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 1, i32 0
+; CHECK-NEXT: [[TMP130:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 1, i32 1
+; CHECK-NEXT: [[TMP141:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 0, i32 0
+; CHECK-NEXT: [[TMP144:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 0, i32 1
+; CHECK-NEXT: [[TMP148:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 7, i32 0
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[TMP141]], i8 0, i64 32, i1 false)
+; CHECK-NEXT: [[TMP151:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 7, i32 1
+; CHECK-NEXT: [[TMP162:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 6, i32 0
+; CHECK-NEXT: [[TMP165:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 6, i32 1
+; CHECK-NEXT: [[TMP176:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 5, i32 0
+; CHECK-NEXT: [[TMP179:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 5, i32 1
+; CHECK-NEXT: [[TMP190:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 4, i32 0
+; CHECK-NEXT: [[TMP193:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 4, i32 1
+; CHECK-NEXT: [[TMP204:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 3, i32 0
+; CHECK-NEXT: [[TMP207:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 3, i32 1
+; CHECK-NEXT: [[TMP218:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 2, i32 0
+; CHECK-NEXT: [[TMP221:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 2, i32 1
+; CHECK-NEXT: [[TMP232:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 1, i32 0
+; CHECK-NEXT: [[TMP235:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 1, i32 1
+; CHECK-NEXT: [[TMP246:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 0, i32 0
+; CHECK-NEXT: [[TMP249:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 0, i32 1
+; CHECK-NEXT: [[UP_MVD252:%.*]] = getelementptr [8 x %struct.MV], ptr [[UP_MVD]], i32 0, i32 0
+; CHECK-NEXT: [[LEFT_MVD253:%.*]] = getelementptr [8 x %struct.MV], ptr [[LEFT_MVD]], i32 0, i32 0
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[TMP246]], i8 0, i64 32, i1 false)
+; CHECK-NEXT: call void @foo(ptr [[UP_MVD252]], ptr [[LEFT_MVD253]], ptr [[TMP41]]) #[[ATTR0]]
; CHECK-NEXT: ret void
;
entry:
- %ref_idx = alloca [8 x i8] ; <[8 x i8]*> [#uses=8]
- %left_mvd = alloca [8 x %struct.MV] ; <[8 x %struct.MV]*> [#uses=17]
- %up_mvd = alloca [8 x %struct.MV] ; <[8 x %struct.MV]*> [#uses=17]
- %tmp20 = getelementptr [8 x i8], [8 x i8]* %ref_idx, i32 0, i32 7 ; <i8*> [#uses=1]
- store i8 -1, i8* %tmp20, align 1
- %tmp23 = getelementptr [8 x i8], [8 x i8]* %ref_idx, i32 0, i32 6 ; <i8*> [#uses=1]
- store i8 -1, i8* %tmp23, align 1
- %tmp26 = getelementptr [8 x i8], [8 x i8]* %ref_idx, i32 0, i32 5 ; <i8*> [#uses=1]
- store i8 -1, i8* %tmp26, align 1
- %tmp29 = getelementptr [8 x i8], [8 x i8]* %ref_idx, i32 0, i32 4 ; <i8*> [#uses=1]
- store i8 -1, i8* %tmp29, align 1
- %tmp32 = getelementptr [8 x i8], [8 x i8]* %ref_idx, i32 0, i32 3 ; <i8*> [#uses=1]
- store i8 -1, i8* %tmp32, align 1
- %tmp35 = getelementptr [8 x i8], [8 x i8]* %ref_idx, i32 0, i32 2 ; <i8*> [#uses=1]
- store i8 -1, i8* %tmp35, align 1
- %tmp38 = getelementptr [8 x i8], [8 x i8]* %ref_idx, i32 0, i32 1 ; <i8*> [#uses=1]
- store i8 -1, i8* %tmp38, align 1
- %tmp41 = getelementptr [8 x i8], [8 x i8]* %ref_idx, i32 0, i32 0 ; <i8*> [#uses=2]
- store i8 -1, i8* %tmp41, align 1
- %tmp43 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 7, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp43, align 2
- %tmp46 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 7, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp46, align 2
- %tmp57 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 6, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp57, align 2
- %tmp60 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 6, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp60, align 2
- %tmp71 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 5, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp71, align 2
- %tmp74 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 5, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp74, align 2
- %tmp85 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 4, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp85, align 2
- %tmp88 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 4, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp88, align 2
- %tmp99 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 3, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp99, align 2
- %tmp102 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 3, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp102, align 2
- %tmp113 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 2, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp113, align 2
- %tmp116 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 2, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp116, align 2
- %tmp127 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 1, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp127, align 2
- %tmp130 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 1, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp130, align 2
- %tmp141 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 0, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp141, align 8
- %tmp144 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 0, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp144, align 2
- %tmp148 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 7, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp148, align 2
- %tmp151 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 7, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp151, align 2
- %tmp162 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 6, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp162, align 2
- %tmp165 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 6, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp165, align 2
- %tmp176 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 5, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp176, align 2
- %tmp179 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 5, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp179, align 2
- %tmp190 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 4, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp190, align 2
- %tmp193 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 4, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp193, align 2
- %tmp204 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 3, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp204, align 2
- %tmp207 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 3, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp207, align 2
- %tmp218 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 2, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp218, align 2
- %tmp221 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 2, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp221, align 2
- %tmp232 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 1, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp232, align 2
- %tmp235 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 1, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp235, align 2
- %tmp246 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 0, i32 0 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp246, align 8
- %tmp249 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 0, i32 1 ; <i16*> [#uses=1]
- store i16 0, i16* %tmp249, align 2
- %up_mvd252 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %up_mvd, i32 0, i32 0 ; <%struct.MV*> [#uses=1]
- %left_mvd253 = getelementptr [8 x %struct.MV], [8 x %struct.MV]* %left_mvd, i32 0, i32 0 ; <%struct.MV*> [#uses=1]
- call void @foo( %struct.MV* %up_mvd252, %struct.MV* %left_mvd253, i8* %tmp41 ) nounwind
+ %ref_idx = alloca [8 x i8] ; <ptr> [#uses=8]
+ %left_mvd = alloca [8 x %struct.MV] ; <ptr> [#uses=17]
+ %up_mvd = alloca [8 x %struct.MV] ; <ptr> [#uses=17]
+ %tmp20 = getelementptr [8 x i8], ptr %ref_idx, i32 0, i32 7 ; <ptr> [#uses=1]
+ store i8 -1, ptr %tmp20, align 1
+ %tmp23 = getelementptr [8 x i8], ptr %ref_idx, i32 0, i32 6 ; <ptr> [#uses=1]
+ store i8 -1, ptr %tmp23, align 1
+ %tmp26 = getelementptr [8 x i8], ptr %ref_idx, i32 0, i32 5 ; <ptr> [#uses=1]
+ store i8 -1, ptr %tmp26, align 1
+ %tmp29 = getelementptr [8 x i8], ptr %ref_idx, i32 0, i32 4 ; <ptr> [#uses=1]
+ store i8 -1, ptr %tmp29, align 1
+ %tmp32 = getelementptr [8 x i8], ptr %ref_idx, i32 0, i32 3 ; <ptr> [#uses=1]
+ store i8 -1, ptr %tmp32, align 1
+ %tmp35 = getelementptr [8 x i8], ptr %ref_idx, i32 0, i32 2 ; <ptr> [#uses=1]
+ store i8 -1, ptr %tmp35, align 1
+ %tmp38 = getelementptr [8 x i8], ptr %ref_idx, i32 0, i32 1 ; <ptr> [#uses=1]
+ store i8 -1, ptr %tmp38, align 1
+ %tmp41 = getelementptr [8 x i8], ptr %ref_idx, i32 0, i32 0 ; <ptr> [#uses=2]
+ store i8 -1, ptr %tmp41, align 1
+ %tmp43 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 7, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp43, align 2
+ %tmp46 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 7, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp46, align 2
+ %tmp57 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 6, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp57, align 2
+ %tmp60 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 6, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp60, align 2
+ %tmp71 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 5, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp71, align 2
+ %tmp74 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 5, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp74, align 2
+ %tmp85 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 4, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp85, align 2
+ %tmp88 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 4, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp88, align 2
+ %tmp99 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 3, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp99, align 2
+ %tmp102 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 3, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp102, align 2
+ %tmp113 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 2, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp113, align 2
+ %tmp116 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 2, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp116, align 2
+ %tmp127 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 1, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp127, align 2
+ %tmp130 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 1, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp130, align 2
+ %tmp141 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 0, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp141, align 8
+ %tmp144 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 0, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp144, align 2
+ %tmp148 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 7, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp148, align 2
+ %tmp151 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 7, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp151, align 2
+ %tmp162 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 6, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp162, align 2
+ %tmp165 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 6, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp165, align 2
+ %tmp176 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 5, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp176, align 2
+ %tmp179 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 5, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp179, align 2
+ %tmp190 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 4, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp190, align 2
+ %tmp193 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 4, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp193, align 2
+ %tmp204 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 3, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp204, align 2
+ %tmp207 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 3, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp207, align 2
+ %tmp218 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 2, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp218, align 2
+ %tmp221 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 2, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp221, align 2
+ %tmp232 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 1, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp232, align 2
+ %tmp235 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 1, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp235, align 2
+ %tmp246 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 0, i32 0 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp246, align 8
+ %tmp249 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 0, i32 1 ; <ptr> [#uses=1]
+ store i16 0, ptr %tmp249, align 2
+ %up_mvd252 = getelementptr [8 x %struct.MV], ptr %up_mvd, i32 0, i32 0 ; <ptr> [#uses=1]
+ %left_mvd253 = getelementptr [8 x %struct.MV], ptr %left_mvd, i32 0, i32 0 ; <ptr> [#uses=1]
+ call void @foo( ptr %up_mvd252, ptr %left_mvd253, ptr %tmp41 ) nounwind
ret void
}
-declare void @foo(%struct.MV*, %struct.MV*, i8*)
+declare void @foo(ptr, ptr, ptr)
; Store followed by memset.
-define void @test3(i32* nocapture %P) nounwind ssp {
+define void @test3(ptr nocapture %P) nounwind ssp {
; CHECK-LABEL: @test3(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[P:%.*]], i64 1
-; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, i32* [[P]], i64 2
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[ADD_PTR]] to i8*
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32* [[ARRAYIDX]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[TMP1]], i8 0, i64 15, i1 false)
+; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[P:%.*]], i64 1
+; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[P]], i64 2
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[ARRAYIDX]], i8 0, i64 15, i1 false)
; CHECK-NEXT: ret void
;
entry:
- %arrayidx = getelementptr inbounds i32, i32* %P, i64 1
- store i32 0, i32* %arrayidx, align 4
- %add.ptr = getelementptr inbounds i32, i32* %P, i64 2
- %0 = bitcast i32* %add.ptr to i8*
- tail call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 11, i1 false)
+ %arrayidx = getelementptr inbounds i32, ptr %P, i64 1
+ store i32 0, ptr %arrayidx, align 4
+ %add.ptr = getelementptr inbounds i32, ptr %P, i64 2
+ tail call void @llvm.memset.p0.i64(ptr %add.ptr, i8 0, i64 11, i1 false)
ret void
}
; store followed by memset,
diff erent offset scenario
-define void @test4(i32* nocapture %P) nounwind ssp {
+define void @test4(ptr nocapture %P) nounwind ssp {
; CHECK-LABEL: @test4(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, i32* [[P:%.*]], i64 1
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[ADD_PTR]] to i8*
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32* [[P]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[TMP1]], i8 0, i64 15, i1 false)
+; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[P:%.*]], i64 1
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[P]], i8 0, i64 15, i1 false)
; CHECK-NEXT: ret void
;
entry:
- store i32 0, i32* %P, align 4
- %add.ptr = getelementptr inbounds i32, i32* %P, i64 1
- %0 = bitcast i32* %add.ptr to i8*
- tail call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 11, i1 false)
+ store i32 0, ptr %P, align 4
+ %add.ptr = getelementptr inbounds i32, ptr %P, i64 1
+ tail call void @llvm.memset.p0.i64(ptr %add.ptr, i8 0, i64 11, i1 false)
ret void
}
-declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) nounwind
+declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind
; Memset followed by store.
-define void @test5(i32* nocapture %P) nounwind ssp {
+define void @test5(ptr nocapture %P) nounwind ssp {
; CHECK-LABEL: @test5(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, i32* [[P:%.*]], i64 2
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[ADD_PTR]] to i8*
-; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[P]], i64 1
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32* [[ARRAYIDX]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[TMP1]], i8 0, i64 15, i1 false)
+; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[P:%.*]], i64 2
+; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[P]], i64 1
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[ARRAYIDX]], i8 0, i64 15, i1 false)
; CHECK-NEXT: ret void
;
entry:
- %add.ptr = getelementptr inbounds i32, i32* %P, i64 2
- %0 = bitcast i32* %add.ptr to i8*
- tail call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 11, i1 false)
- %arrayidx = getelementptr inbounds i32, i32* %P, i64 1
- store i32 0, i32* %arrayidx, align 4
+ %add.ptr = getelementptr inbounds i32, ptr %P, i64 2
+ tail call void @llvm.memset.p0.i64(ptr %add.ptr, i8 0, i64 11, i1 false)
+ %arrayidx = getelementptr inbounds i32, ptr %P, i64 1
+ store i32 0, ptr %arrayidx, align 4
ret void
}
;; Memset followed by memset.
-define void @test6(i32* nocapture %P) nounwind ssp {
+define void @test6(ptr nocapture %P) nounwind ssp {
; CHECK-LABEL: @test6(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[P:%.*]] to i8*
-; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, i32* [[P]], i64 3
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32* [[ADD_PTR]] to i8*
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast i32* [[P]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[TMP2]], i8 0, i64 24, i1 false)
+; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[P:%.*]], i64 3
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[P]], i8 0, i64 24, i1 false)
; CHECK-NEXT: ret void
;
entry:
- %0 = bitcast i32* %P to i8*
- tail call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 12, i1 false)
- %add.ptr = getelementptr inbounds i32, i32* %P, i64 3
- %1 = bitcast i32* %add.ptr to i8*
- tail call void @llvm.memset.p0i8.i64(i8* %1, i8 0, i64 12, i1 false)
+ tail call void @llvm.memset.p0.i64(ptr %P, i8 0, i64 12, i1 false)
+ %add.ptr = getelementptr inbounds i32, ptr %P, i64 3
+ tail call void @llvm.memset.p0.i64(ptr %add.ptr, i8 0, i64 12, i1 false)
ret void
}
; More aggressive heuristic
; rdar://9892684
-define void @test7(i32* nocapture %c) nounwind optsize {
+define void @test7(ptr nocapture %c) nounwind optsize {
; CHECK-LABEL: @test7(
-; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, i32* [[C:%.*]], i32 1
-; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, i32* [[C]], i32 2
-; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i32, i32* [[C]], i32 3
-; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i32, i32* [[C]], i32 4
-; CHECK-NEXT: [[TMP5:%.*]] = bitcast i32* [[C]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[TMP5]], i8 -1, i64 20, i1 false)
+; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, ptr [[C:%.*]], i32 1
+; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, ptr [[C]], i32 2
+; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i32, ptr [[C]], i32 3
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i32, ptr [[C]], i32 4
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[C]], i8 -1, i64 20, i1 false)
; CHECK-NEXT: ret void
;
- store i32 -1, i32* %c, align 4
- %1 = getelementptr inbounds i32, i32* %c, i32 1
- store i32 -1, i32* %1, align 4
- %2 = getelementptr inbounds i32, i32* %c, i32 2
- store i32 -1, i32* %2, align 4
- %3 = getelementptr inbounds i32, i32* %c, i32 3
- store i32 -1, i32* %3, align 4
- %4 = getelementptr inbounds i32, i32* %c, i32 4
- store i32 -1, i32* %4, align 4
+ store i32 -1, ptr %c, align 4
+ %1 = getelementptr inbounds i32, ptr %c, i32 1
+ store i32 -1, ptr %1, align 4
+ %2 = getelementptr inbounds i32, ptr %c, i32 2
+ store i32 -1, ptr %2, align 4
+ %3 = getelementptr inbounds i32, ptr %c, i32 3
+ store i32 -1, ptr %3, align 4
+ %4 = getelementptr inbounds i32, ptr %c, i32 4
+ store i32 -1, ptr %4, align 4
ret void
}
@@ -342,14 +325,12 @@ define void @test8() {
; CHECK-LABEL: @test8(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[MEMTMP:%.*]] = alloca [[STRUCT_TEST8:%.*]], align 16
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast %struct.test8* [[MEMTMP]] to <4 x i32>*
-; CHECK-NEXT: store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, <4 x i32>* [[TMP0]], align 16
+; CHECK-NEXT: store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr [[MEMTMP]], align 16
; CHECK-NEXT: ret void
;
entry:
%memtmp = alloca %struct.test8, align 16
- %0 = bitcast %struct.test8* %memtmp to <4 x i32>*
- store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, <4 x i32>* %0, align 16
+ store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr %memtmp, align 16
ret void
}
@@ -357,75 +338,65 @@ entry:
define void @test9() nounwind {
; CHECK-LABEL: @test9(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 16 bitcast ([16 x i64]* @test9buf to i8*), i8 -1, i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 16 @test9buf, i8 -1, i64 16, i1 false)
; CHECK-NEXT: ret void
;
- store i8 -1, i8* bitcast ([16 x i64]* @test9buf to i8*), align 16
- store i8 -1, i8* getelementptr (i8, i8* bitcast ([16 x i64]* @test9buf to i8*), i64 1), align 1
- store i8 -1, i8* getelementptr (i8, i8* bitcast ([16 x i64]* @test9buf to i8*), i64 2), align 2
- store i8 -1, i8* getelementptr (i8, i8* bitcast ([16 x i64]* @test9buf to i8*), i64 3), align 1
- store i8 -1, i8* getelementptr (i8, i8* bitcast ([16 x i64]* @test9buf to i8*), i64 4), align 4
- store i8 -1, i8* getelementptr (i8, i8* bitcast ([16 x i64]* @test9buf to i8*), i64 5), align 1
- store i8 -1, i8* getelementptr (i8, i8* bitcast ([16 x i64]* @test9buf to i8*), i64 6), align 2
- store i8 -1, i8* getelementptr (i8, i8* bitcast ([16 x i64]* @test9buf to i8*), i64 7), align 1
- store i8 -1, i8* bitcast (i64* getelementptr inbounds ([16 x i64], [16 x i64]* @test9buf, i64 0, i64 1) to i8*), align 8
- store i8 -1, i8* getelementptr (i8, i8* bitcast ([16 x i64]* @test9buf to i8*), i64 9), align 1
- store i8 -1, i8* getelementptr (i8, i8* bitcast ([16 x i64]* @test9buf to i8*), i64 10), align 2
- store i8 -1, i8* getelementptr (i8, i8* bitcast ([16 x i64]* @test9buf to i8*), i64 11), align 1
- store i8 -1, i8* getelementptr (i8, i8* bitcast ([16 x i64]* @test9buf to i8*), i64 12), align 4
- store i8 -1, i8* getelementptr (i8, i8* bitcast ([16 x i64]* @test9buf to i8*), i64 13), align 1
- store i8 -1, i8* getelementptr (i8, i8* bitcast ([16 x i64]* @test9buf to i8*), i64 14), align 2
- store i8 -1, i8* getelementptr (i8, i8* bitcast ([16 x i64]* @test9buf to i8*), i64 15), align 1
+ store i8 -1, ptr @test9buf, align 16
+ store i8 -1, ptr getelementptr (i8, ptr @test9buf, i64 1), align 1
+ store i8 -1, ptr getelementptr (i8, ptr @test9buf, i64 2), align 2
+ store i8 -1, ptr getelementptr (i8, ptr @test9buf, i64 3), align 1
+ store i8 -1, ptr getelementptr (i8, ptr @test9buf, i64 4), align 4
+ store i8 -1, ptr getelementptr (i8, ptr @test9buf, i64 5), align 1
+ store i8 -1, ptr getelementptr (i8, ptr @test9buf, i64 6), align 2
+ store i8 -1, ptr getelementptr (i8, ptr @test9buf, i64 7), align 1
+ store i8 -1, ptr getelementptr inbounds ([16 x i64], ptr @test9buf, i64 0, i64 1), align 8
+ store i8 -1, ptr getelementptr (i8, ptr @test9buf, i64 9), align 1
+ store i8 -1, ptr getelementptr (i8, ptr @test9buf, i64 10), align 2
+ store i8 -1, ptr getelementptr (i8, ptr @test9buf, i64 11), align 1
+ store i8 -1, ptr getelementptr (i8, ptr @test9buf, i64 12), align 4
+ store i8 -1, ptr getelementptr (i8, ptr @test9buf, i64 13), align 1
+ store i8 -1, ptr getelementptr (i8, ptr @test9buf, i64 14), align 2
+ store i8 -1, ptr getelementptr (i8, ptr @test9buf, i64 15), align 1
ret void
}
; PR19092
-define void @test10(i8* nocapture %P) nounwind {
+define void @test10(ptr nocapture %P) nounwind {
; CHECK-LABEL: @test10(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[P:%.*]], i8 0, i64 42, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[P:%.*]], i8 0, i64 42, i1 false)
; CHECK-NEXT: ret void
;
- tail call void @llvm.memset.p0i8.i64(i8* %P, i8 0, i64 42, i1 false)
- tail call void @llvm.memset.p0i8.i64(i8* %P, i8 0, i64 23, i1 false)
+ tail call void @llvm.memset.p0.i64(ptr %P, i8 0, i64 42, i1 false)
+ tail call void @llvm.memset.p0.i64(ptr %P, i8 0, i64 23, i1 false)
ret void
}
; Memset followed by odd store.
-define void @test11(i32* nocapture %P) nounwind ssp {
+define void @test11(ptr nocapture %P) nounwind ssp {
; CHECK-LABEL: @test11(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, i32* [[P:%.*]], i64 3
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[ADD_PTR]] to i8*
-; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[P]], i64 0
-; CHECK-NEXT: [[ARRAYIDX_CAST:%.*]] = bitcast i32* [[ARRAYIDX]] to i96*
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i96* [[ARRAYIDX_CAST]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[TMP1]], i8 1, i64 23, i1 false)
+; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[P:%.*]], i64 3
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[P]], i8 1, i64 23, i1 false)
; CHECK-NEXT: ret void
;
entry:
- %add.ptr = getelementptr inbounds i32, i32* %P, i64 3
- %0 = bitcast i32* %add.ptr to i8*
- tail call void @llvm.memset.p0i8.i64(i8* %0, i8 1, i64 11, i1 false)
- %arrayidx = getelementptr inbounds i32, i32* %P, i64 0
- %arrayidx.cast = bitcast i32* %arrayidx to i96*
- store i96 310698676526526814092329217, i96* %arrayidx.cast, align 4
+ %add.ptr = getelementptr inbounds i32, ptr %P, i64 3
+ tail call void @llvm.memset.p0.i64(ptr %add.ptr, i8 1, i64 11, i1 false)
+ store i96 310698676526526814092329217, ptr %P, align 4
ret void
}
; Alignment should be preserved when there is a store with default align
-define void @test12(i32* nocapture %P) nounwind ssp {
+define void @test12(ptr nocapture %P) nounwind ssp {
; CHECK-LABEL: @test12(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, i32* [[P:%.*]], i64 1
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[ADD_PTR]] to i8*
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32* [[P]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[TMP1]], i8 0, i64 15, i1 false)
+; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[P:%.*]], i64 1
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[P]], i8 0, i64 15, i1 false)
; CHECK-NEXT: ret void
;
entry:
- store i32 0, i32* %P
- %add.ptr = getelementptr inbounds i32, i32* %P, i64 1
- %0 = bitcast i32* %add.ptr to i8*
- tail call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 11, i1 false)
+ store i32 0, ptr %P
+ %add.ptr = getelementptr inbounds i32, ptr %P, i64 1
+ tail call void @llvm.memset.p0.i64(ptr %add.ptr, i8 0, i64 11, i1 false)
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/invariant.start.ll b/llvm/test/Transforms/MemCpyOpt/invariant.start.ll
index 61bdf2f7bcf9..b4a2fc469ff0 100644
--- a/llvm/test/Transforms/MemCpyOpt/invariant.start.ll
+++ b/llvm/test/Transforms/MemCpyOpt/invariant.start.ll
@@ -7,43 +7,41 @@ 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 = "i686-apple-darwin9"
%0 = type { x86_fp80, x86_fp80 }
-declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1)
-declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1)
+declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1)
+declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1)
-declare {}* @llvm.invariant.start.p0i8(i64, i8* nocapture) nounwind readonly
+declare ptr @llvm.invariant.start.p0(i64, ptr nocapture) nounwind readonly
; The intermediate alloca and one of the memcpy's should be eliminated, the
; other should be transformed to a memmove.
-define void @test1(i8* %P, i8* %Q) nounwind {
+define void @test1(ptr %P, ptr %Q) nounwind {
; CHECK-LABEL: @test1(
; CHECK-NEXT: [[MEMTMP:%.*]] = alloca [[TMP0:%.*]], align 16
-; CHECK-NEXT: [[R:%.*]] = bitcast %0* [[MEMTMP]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 [[R]], i8* align 16 [[P:%.*]], i32 32, i1 false)
-; CHECK-NEXT: [[I:%.*]] = call {}* @llvm.invariant.start.p0i8(i64 32, i8* [[P]])
-; CHECK-NEXT: call void @llvm.memmove.p0i8.p0i8.i32(i8* align 16 [[Q:%.*]], i8* align 16 [[P]], i32 32, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 16 [[MEMTMP]], ptr align 16 [[P:%.*]], i32 32, i1 false)
+; CHECK-NEXT: [[I:%.*]] = call ptr @llvm.invariant.start.p0(i64 32, ptr [[P]])
+; CHECK-NEXT: call void @llvm.memmove.p0.p0.i32(ptr align 16 [[Q:%.*]], ptr align 16 [[P]], i32 32, i1 false)
; CHECK-NEXT: ret void
;
%memtmp = alloca %0, align 16
- %R = bitcast %0* %memtmp to i8*
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %R, i8* align 16 %P, i32 32, i1 false)
- %i = call {}* @llvm.invariant.start.p0i8(i64 32, i8* %P)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %Q, i8* align 16 %R, i32 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 16 %memtmp, ptr align 16 %P, i32 32, i1 false)
+ %i = call ptr @llvm.invariant.start.p0(i64 32, ptr %P)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 16 %Q, ptr align 16 %memtmp, i32 32, i1 false)
ret void
}
; The invariant.start intrinsic does not inhibit tranforming the memcpy to a
; memset.
-define void @test2(i8* %dst1, i8* %dst2, i8 %c) {
+define void @test2(ptr %dst1, ptr %dst2, i8 %c) {
; CHECK-LABEL: @test2(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DST1:%.*]], i8 [[C:%.*]], i64 128, i1 false)
-; CHECK-NEXT: [[I:%.*]] = call {}* @llvm.invariant.start.p0i8(i64 32, i8* [[DST1]])
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[DST2:%.*]], i8 [[C]], i64 128, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DST1:%.*]], i8 [[C:%.*]], i64 128, i1 false)
+; CHECK-NEXT: [[I:%.*]] = call ptr @llvm.invariant.start.p0(i64 32, ptr [[DST1]])
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[DST2:%.*]], i8 [[C]], i64 128, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst1, i8 %c, i64 128, i1 false)
- %i = call {}* @llvm.invariant.start.p0i8(i64 32, i8* %dst1)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst2, i8* align 8 %dst1, i64 128, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst1, i8 %c, i64 128, i1 false)
+ %i = call ptr @llvm.invariant.start.p0(i64 32, ptr %dst1)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst2, ptr align 8 %dst1, i64 128, i1 false)
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/lifetime.ll b/llvm/test/Transforms/MemCpyOpt/lifetime.ll
index a4811a62bc85..6281e2f8df88 100644
--- a/llvm/test/Transforms/MemCpyOpt/lifetime.ll
+++ b/llvm/test/Transforms/MemCpyOpt/lifetime.ll
@@ -4,48 +4,45 @@
; performCallSlotOptzn in MemCpy should not exchange the calls to
; @llvm.lifetime.start and @llvm.memcpy.
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1) #1
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1) #1
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1
-define void @call_slot(i8* nocapture dereferenceable(16) %arg1) {
+define void @call_slot(ptr nocapture dereferenceable(16) %arg1) {
; CHECK-LABEL: @call_slot(
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[TMP_SROA_3_0_ARG1_SROA_RAW_IDX:%.*]] = getelementptr inbounds i8, i8* [[ARG1:%.*]], i64 7
-; CHECK-NEXT: store i8 0, i8* [[TMP_SROA_3_0_ARG1_SROA_RAW_IDX]], align 1
+; CHECK-NEXT: [[TMP_SROA_3_0_ARG1_SROA_RAW_IDX:%.*]] = getelementptr inbounds i8, ptr [[ARG1:%.*]], i64 7
+; CHECK-NEXT: store i8 0, ptr [[TMP_SROA_3_0_ARG1_SROA_RAW_IDX]], align 1
; CHECK-NEXT: ret void
;
bb:
%tmp = alloca [8 x i8], align 8
- %tmp5 = bitcast [8 x i8]* %tmp to i8*
- call void @llvm.lifetime.start.p0i8(i64 16, i8* %tmp5)
- %tmp10 = getelementptr inbounds i8, i8* %tmp5, i64 7
- store i8 0, i8* %tmp10, align 1
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %arg1, i8* align 8 %tmp5, i64 16, i1 false)
- call void @llvm.lifetime.end.p0i8(i64 16, i8* %tmp5)
+ call void @llvm.lifetime.start.p0(i64 16, ptr %tmp)
+ %tmp10 = getelementptr inbounds i8, ptr %tmp, i64 7
+ store i8 0, ptr %tmp10, align 1
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %arg1, ptr align 8 %tmp, i64 16, i1 false)
+ call void @llvm.lifetime.end.p0(i64 16, ptr %tmp)
ret void
}
-define void @memcpy_memcpy_across_lifetime(i8* noalias %p1, i8* noalias %p2, i8* noalias %p3) {
+define void @memcpy_memcpy_across_lifetime(ptr noalias %p1, ptr noalias %p2, ptr noalias %p3) {
; CHECK-LABEL: @memcpy_memcpy_across_lifetime(
; CHECK-NEXT: [[A:%.*]] = alloca [16 x i8], align 1
-; CHECK-NEXT: [[A8:%.*]] = getelementptr inbounds [16 x i8], [16 x i8]* [[A]], i64 0, i64 0
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull [[A8]])
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* noundef nonnull align 1 dereferenceable(16) [[A8]], i8* noundef nonnull align 1 dereferenceable(16) [[P1:%.*]], i64 16, i1 false)
-; CHECK-NEXT: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* noundef nonnull align 1 dereferenceable(16) [[P1]], i8* noundef nonnull align 1 dereferenceable(16) [[P2:%.*]], i64 16, i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* noundef nonnull align 1 dereferenceable(16) [[P2]], i8* noundef nonnull align 1 dereferenceable(16) [[A8]], i64 16, i1 false)
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull [[A8]])
-; CHECK-NEXT: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* noundef nonnull align 1 dereferenceable(16) [[P3:%.*]], i8* noundef nonnull align 1 dereferenceable(16) [[P2]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[A]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) [[A]], ptr noundef nonnull align 1 dereferenceable(16) [[P1:%.*]], i64 16, i1 false)
+; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) [[P1]], ptr noundef nonnull align 1 dereferenceable(16) [[P2:%.*]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) [[P2]], ptr noundef nonnull align 1 dereferenceable(16) [[A]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[A]])
+; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) [[P3:%.*]], ptr noundef nonnull align 1 dereferenceable(16) [[P2]], i64 16, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca [16 x i8]
- %a8 = bitcast [16 x i8]* %a to i8*
- call void @llvm.lifetime.start.p0i8(i64 16, i8* %a8)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a8, i8* %p1, i64 16, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p1, i8* %p2, i64 16, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p2, i8* %a8, i64 16, i1 false)
- call void @llvm.lifetime.end.p0i8(i64 16, i8* %a8)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p3, i8* %p2, i64 16, i1 false)
+ call void @llvm.lifetime.start.p0(i64 16, ptr %a)
+ call void @llvm.memcpy.p0.p0.i64(ptr %a, ptr %p1, i64 16, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %p1, ptr %p2, i64 16, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %p2, ptr %a, i64 16, i1 false)
+ call void @llvm.lifetime.end.p0(i64 16, ptr %a)
+ call void @llvm.memcpy.p0.p0.i64(ptr %p3, ptr %p2, i64 16, i1 false)
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/load-store-to-memcpy.ll b/llvm/test/Transforms/MemCpyOpt/load-store-to-memcpy.ll
index 5e8b802a4c2e..425bd0562892 100644
--- a/llvm/test/Transforms/MemCpyOpt/load-store-to-memcpy.ll
+++ b/llvm/test/Transforms/MemCpyOpt/load-store-to-memcpy.ll
@@ -8,62 +8,57 @@
; Ensure load-store forwarding of an aggregate is interpreted as
; a memmove when the source and dest may alias
-define void @test_memmove(%T* align 8 %a, %T* align 16 %b) {
+define void @test_memmove(ptr align 8 %a, ptr align 16 %b) {
; CHECK-LABEL: @test_memmove(
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast %T* [[B:%.*]] to i8*
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast %T* [[A:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memmove.p0i8.p0i8.i64(i8* align 16 [[TMP1]], i8* align 8 [[TMP2]], i64 8, i1 false)
+; CHECK-NEXT: call void @llvm.memmove.p0.p0.i64(ptr align 16 [[B:%.*]], ptr align 8 [[A:%.*]], i64 8, i1 false)
; CHECK-NEXT: ret void
;
- %val = load %T, %T* %a, align 8
- store %T %val, %T* %b, align 16
+ %val = load %T, ptr %a, align 8
+ store %T %val, ptr %b, align 16
ret void
}
; Ensure load-store forwarding of an aggregate is interpreted as
; a memcpy when the source and dest do not alias
-define void @test_memcpy(%T* noalias align 8 %a, %T* noalias align 16 %b) {
+define void @test_memcpy(ptr noalias align 8 %a, ptr noalias align 16 %b) {
; CHECK-LABEL: @test_memcpy(
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast %T* [[B:%.*]] to i8*
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast %T* [[A:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 [[TMP1]], i8* align 8 [[TMP2]], i64 8, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[B:%.*]], ptr align 8 [[A:%.*]], i64 8, i1 false)
; CHECK-NEXT: ret void
;
- %val = load %T, %T* %a, align 8
- store %T %val, %T* %b, align 16
+ %val = load %T, ptr %a, align 8
+ store %T %val, ptr %b, align 16
ret void
}
-define void @test_memcpy_constant(%T* %d) {
+define void @test_memcpy_constant(ptr %d) {
; CHECK-LABEL: @test_memcpy_constant(
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast %T* [[D:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 [[TMP1]], i8* align 8 getelementptr inbounds ([[T:%.*]], %T* @C, i32 0, i32 0), i64 8, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[D:%.*]], ptr align 8 @C, i64 8, i1 false)
; CHECK-NEXT: ret void
;
- %val = load %T, %T* @C, align 8
- store %T %val, %T* %d, align 16
+ %val = load %T, ptr @C, align 8
+ store %T %val, ptr %d, align 16
ret void
}
; memcpy(%d, %a) should not be generated since store2 may-aliases load %a.
-define void @f(%T* %a, %T* %b, %T* %c, %T* %d) {
+define void @f(ptr %a, ptr %b, ptr %c, ptr %d) {
; CHECK-LABEL: @f(
-; CHECK-NEXT: [[VAL:%.*]] = load [[T:%.*]], %T* [[A:%.*]], align 4, !alias.scope !0
-; CHECK-NEXT: store [[T]] { i8 23, i32 23 }, %T* [[B:%.*]], align 4, !alias.scope !3
-; CHECK-NEXT: store [[T]] { i8 44, i32 44 }, %T* [[C:%.*]], align 4, !alias.scope !6, !noalias !3
-; CHECK-NEXT: store [[T]] [[VAL]], %T* [[D:%.*]], align 4, !alias.scope !9, !noalias !12
+; CHECK-NEXT: [[VAL:%.*]] = load [[T:%.*]], ptr [[A:%.*]], align 4, !alias.scope !0
+; CHECK-NEXT: store [[T]] { i8 23, i32 23 }, ptr [[B:%.*]], align 4, !alias.scope !3
+; CHECK-NEXT: store [[T]] { i8 44, i32 44 }, ptr [[C:%.*]], align 4, !alias.scope !6, !noalias !3
+; CHECK-NEXT: store [[T]] [[VAL]], ptr [[D:%.*]], align 4, !alias.scope !9, !noalias !12
; CHECK-NEXT: ret void
;
- %val = load %T, %T* %a, !alias.scope !{!10}
+ %val = load %T, ptr %a, !alias.scope !{!10}
; store1 may-aliases the load
- store %T { i8 23, i32 23 }, %T* %b, !alias.scope !{!11}
+ store %T { i8 23, i32 23 }, ptr %b, !alias.scope !{!11}
; store2 may-aliases the load and store3
- store %T { i8 44, i32 44 }, %T* %c, !alias.scope !{!12}, !noalias !{!11}
+ store %T { i8 44, i32 44 }, ptr %c, !alias.scope !{!12}, !noalias !{!11}
; store3
- store %T %val, %T* %d, !alias.scope !{!13}, !noalias !{!10, !11}
+ store %T %val, ptr %d, !alias.scope !{!13}, !noalias !{!10, !11}
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/loadstore-sret.ll b/llvm/test/Transforms/MemCpyOpt/loadstore-sret.ll
index 4264130a42f3..92d428b5d957 100644
--- a/llvm/test/Transforms/MemCpyOpt/loadstore-sret.ll
+++ b/llvm/test/Transforms/MemCpyOpt/loadstore-sret.ll
@@ -5,25 +5,21 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-darwin10.0.0"
-%"class.std::auto_ptr" = type { i32* }
+%"class.std::auto_ptr" = type { ptr }
-define void @_Z3foov(%"class.std::auto_ptr"* noalias nocapture sret(%"class.std::auto_ptr") %agg.result) ssp {
+define void @_Z3foov(ptr noalias nocapture sret(%"class.std::auto_ptr") %agg.result) ssp {
; CHECK-LABEL: @_Z3foov(
; CHECK-NEXT: _ZNSt8auto_ptrIiED1Ev.exit:
; CHECK-NEXT: [[TEMP_LVALUE:%.*]] = alloca %"class.std::auto_ptr", align 8
-; CHECK-NEXT: call void @_Z3barv(%"class.std::auto_ptr"* sret(%"class.std::auto_ptr") [[AGG_RESULT:%.*]])
-; CHECK-NEXT: [[TMP_I_I:%.*]] = getelementptr inbounds %"class.std::auto_ptr", %"class.std::auto_ptr"* [[TEMP_LVALUE]], i64 0, i32 0
-; CHECK-NEXT: [[TMP_I_I4:%.*]] = getelementptr inbounds %"class.std::auto_ptr", %"class.std::auto_ptr"* [[AGG_RESULT]], i64 0, i32 0
+; CHECK-NEXT: call void @_Z3barv(ptr sret(%"class.std::auto_ptr") [[AGG_RESULT:%.*]])
; CHECK-NEXT: ret void
;
_ZNSt8auto_ptrIiED1Ev.exit:
%temp.lvalue = alloca %"class.std::auto_ptr", align 8
- call void @_Z3barv(%"class.std::auto_ptr"* sret(%"class.std::auto_ptr") %temp.lvalue)
- %tmp.i.i = getelementptr inbounds %"class.std::auto_ptr", %"class.std::auto_ptr"* %temp.lvalue, i64 0, i32 0
- %tmp2.i.i = load i32*, i32** %tmp.i.i, align 8
- %tmp.i.i4 = getelementptr inbounds %"class.std::auto_ptr", %"class.std::auto_ptr"* %agg.result, i64 0, i32 0
- store i32* %tmp2.i.i, i32** %tmp.i.i4, align 8
+ call void @_Z3barv(ptr sret(%"class.std::auto_ptr") %temp.lvalue)
+ %tmp2.i.i = load ptr, ptr %temp.lvalue, align 8
+ store ptr %tmp2.i.i, ptr %agg.result, align 8
ret void
}
-declare void @_Z3barv(%"class.std::auto_ptr"* nocapture sret(%"class.std::auto_ptr")) nounwind
+declare void @_Z3barv(ptr nocapture sret(%"class.std::auto_ptr")) nounwind
diff --git a/llvm/test/Transforms/MemCpyOpt/memcpy-byval-forwarding-clobbers.ll b/llvm/test/Transforms/MemCpyOpt/memcpy-byval-forwarding-clobbers.ll
index 818034275a45..c28754ebe422 100644
--- a/llvm/test/Transforms/MemCpyOpt/memcpy-byval-forwarding-clobbers.ll
+++ b/llvm/test/Transforms/MemCpyOpt/memcpy-byval-forwarding-clobbers.ll
@@ -1,15 +1,15 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=memcpyopt -S %s | FileCheck %s
-declare void @init(i64* nocapture sret(i64) align 8)
+declare void @init(ptr nocapture sret(i64) align 8)
-declare i1 @check(i64* readonly byval(i64) align 8) readonly argmemonly
+declare i1 @check(ptr readonly byval(i64) align 8) readonly argmemonly
-declare void @clobber(i8*) argmemonly
+declare void @clobber(ptr) argmemonly
-declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
-declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg)
+declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)
+declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)
+declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg)
; %a.2's lifetime ends before the call to @check. Cannot replace
; %a.1 with %a.2 in the call to @check.
@@ -18,28 +18,24 @@ define i1 @alloca_forwarding_lifetime_end_clobber() {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[A_1:%.*]] = alloca i64, align 8
; CHECK-NEXT: [[A_2:%.*]] = alloca i64, align 8
-; CHECK-NEXT: [[BC_A_1:%.*]] = bitcast i64* [[A_1]] to i8*
-; CHECK-NEXT: [[BC_A_2:%.*]] = bitcast i64* [[A_2]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[BC_A_2]])
-; CHECK-NEXT: call void @init(i64* sret(i64) align 8 [[A_2]])
-; CHECK-NEXT: store i8 0, i8* [[BC_A_2]], align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[BC_A_1]], i8* [[BC_A_2]], i64 8, i1 false)
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[BC_A_2]])
-; CHECK-NEXT: [[CALL:%.*]] = call i1 @check(i64* byval(i64) align 8 [[A_1]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 8, ptr [[A_2]])
+; CHECK-NEXT: call void @init(ptr sret(i64) align 8 [[A_2]])
+; CHECK-NEXT: store i8 0, ptr [[A_2]], align 1
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[A_1]], ptr [[A_2]], i64 8, i1 false)
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 8, ptr [[A_2]])
+; CHECK-NEXT: [[CALL:%.*]] = call i1 @check(ptr byval(i64) align 8 [[A_1]])
; CHECK-NEXT: ret i1 [[CALL]]
;
entry:
%a.1 = alloca i64, align 8
%a.2 = alloca i64, align 8
- %bc.a.1 = bitcast i64* %a.1 to i8*
- %bc.a.2 = bitcast i64* %a.2 to i8*
- call void @llvm.lifetime.start.p0i8(i64 8, i8* %bc.a.2)
- call void @init(i64* sret(i64) align 8 %a.2)
- store i8 0, i8* %bc.a.2
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %bc.a.1, i8* %bc.a.2, i64 8, i1 false)
- call void @llvm.lifetime.end.p0i8(i64 8, i8* %bc.a.2)
- ;call void @clobber(i8* %bc.a.2)
- %call = call i1 @check(i64* byval(i64) align 8 %a.1)
+ call void @llvm.lifetime.start.p0(i64 8, ptr %a.2)
+ call void @init(ptr sret(i64) align 8 %a.2)
+ store i8 0, ptr %a.2
+ call void @llvm.memcpy.p0.p0.i64(ptr %a.1, ptr %a.2, i64 8, i1 false)
+ call void @llvm.lifetime.end.p0(i64 8, ptr %a.2)
+ ;call void @clobber(ptr %a.2)
+ %call = call i1 @check(ptr byval(i64) align 8 %a.1)
ret i1 %call
}
@@ -50,27 +46,23 @@ define i1 @alloca_forwarding_call_clobber() {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[A_1:%.*]] = alloca i64, align 8
; CHECK-NEXT: [[A_2:%.*]] = alloca i64, align 8
-; CHECK-NEXT: [[BC_A_1:%.*]] = bitcast i64* [[A_1]] to i8*
-; CHECK-NEXT: [[BC_A_2:%.*]] = bitcast i64* [[A_2]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[BC_A_2]])
-; CHECK-NEXT: call void @init(i64* sret(i64) align 8 [[A_2]])
-; CHECK-NEXT: store i8 0, i8* [[BC_A_2]], align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[BC_A_1]], i8* [[BC_A_2]], i64 8, i1 false)
-; CHECK-NEXT: call void @clobber(i8* [[BC_A_2]])
-; CHECK-NEXT: [[CALL:%.*]] = call i1 @check(i64* byval(i64) align 8 [[A_1]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 8, ptr [[A_2]])
+; CHECK-NEXT: call void @init(ptr sret(i64) align 8 [[A_2]])
+; CHECK-NEXT: store i8 0, ptr [[A_2]], align 1
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[A_1]], ptr [[A_2]], i64 8, i1 false)
+; CHECK-NEXT: call void @clobber(ptr [[A_2]])
+; CHECK-NEXT: [[CALL:%.*]] = call i1 @check(ptr byval(i64) align 8 [[A_1]])
; CHECK-NEXT: ret i1 [[CALL]]
;
entry:
%a.1 = alloca i64, align 8
%a.2 = alloca i64, align 8
- %bc.a.1 = bitcast i64* %a.1 to i8*
- %bc.a.2 = bitcast i64* %a.2 to i8*
- call void @llvm.lifetime.start.p0i8(i64 8, i8* %bc.a.2)
- call void @init(i64* sret(i64) align 8 %a.2)
- store i8 0, i8* %bc.a.2
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %bc.a.1, i8* %bc.a.2, i64 8, i1 false)
- call void @clobber(i8* %bc.a.2)
- %call = call i1 @check(i64* byval(i64) align 8 %a.1)
+ call void @llvm.lifetime.start.p0(i64 8, ptr %a.2)
+ call void @init(ptr sret(i64) align 8 %a.2)
+ store i8 0, ptr %a.2
+ call void @llvm.memcpy.p0.p0.i64(ptr %a.1, ptr %a.2, i64 8, i1 false)
+ call void @clobber(ptr %a.2)
+ %call = call i1 @check(ptr byval(i64) align 8 %a.1)
ret i1 %call
}
@@ -79,27 +71,23 @@ define i1 @alloca_forwarding_call_clobber_after() {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[A_1:%.*]] = alloca i64, align 8
; CHECK-NEXT: [[A_2:%.*]] = alloca i64, align 8
-; CHECK-NEXT: [[BC_A_1:%.*]] = bitcast i64* [[A_1]] to i8*
-; CHECK-NEXT: [[BC_A_2:%.*]] = bitcast i64* [[A_2]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[BC_A_2]])
-; CHECK-NEXT: call void @init(i64* sret(i64) align 8 [[A_2]])
-; CHECK-NEXT: store i8 0, i8* [[BC_A_2]], align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[BC_A_1]], i8* [[BC_A_2]], i64 8, i1 false)
-; CHECK-NEXT: [[CALL:%.*]] = call i1 @check(i64* byval(i64) align 8 [[A_2]])
-; CHECK-NEXT: call void @clobber(i8* [[BC_A_2]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 8, ptr [[A_2]])
+; CHECK-NEXT: call void @init(ptr sret(i64) align 8 [[A_2]])
+; CHECK-NEXT: store i8 0, ptr [[A_2]], align 1
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[A_1]], ptr [[A_2]], i64 8, i1 false)
+; CHECK-NEXT: [[CALL:%.*]] = call i1 @check(ptr byval(i64) align 8 [[A_2]])
+; CHECK-NEXT: call void @clobber(ptr [[A_2]])
; CHECK-NEXT: ret i1 [[CALL]]
;
entry:
%a.1 = alloca i64, align 8
%a.2 = alloca i64, align 8
- %bc.a.1 = bitcast i64* %a.1 to i8*
- %bc.a.2 = bitcast i64* %a.2 to i8*
- call void @llvm.lifetime.start.p0i8(i64 8, i8* %bc.a.2)
- call void @init(i64* sret(i64) align 8 %a.2)
- store i8 0, i8* %bc.a.2
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %bc.a.1, i8* %bc.a.2, i64 8, i1 false)
- %call = call i1 @check(i64* byval(i64) align 8 %a.1)
- call void @clobber(i8* %bc.a.2)
+ call void @llvm.lifetime.start.p0(i64 8, ptr %a.2)
+ call void @init(ptr sret(i64) align 8 %a.2)
+ store i8 0, ptr %a.2
+ call void @llvm.memcpy.p0.p0.i64(ptr %a.1, ptr %a.2, i64 8, i1 false)
+ %call = call i1 @check(ptr byval(i64) align 8 %a.1)
+ call void @clobber(ptr %a.2)
ret i1 %call
}
@@ -109,30 +97,24 @@ define i1 @alloca_forwarding_unrelated_call_noclobber() {
; CHECK-NEXT: [[A_1:%.*]] = alloca i64, align 8
; CHECK-NEXT: [[A_2:%.*]] = alloca i64, align 8
; CHECK-NEXT: [[A_3:%.*]] = alloca i64, align 8
-; CHECK-NEXT: [[BC_A_1:%.*]] = bitcast i64* [[A_1]] to i8*
-; CHECK-NEXT: [[BC_A_2:%.*]] = bitcast i64* [[A_2]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[BC_A_2]])
-; CHECK-NEXT: call void @init(i64* sret(i64) align 8 [[A_2]])
-; CHECK-NEXT: store i8 0, i8* [[BC_A_2]], align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[BC_A_1]], i8* [[BC_A_2]], i64 8, i1 false)
-; CHECK-NEXT: [[BC_A_3:%.*]] = bitcast i64* [[A_3]] to i8*
-; CHECK-NEXT: call void @clobber(i8* [[BC_A_3]])
-; CHECK-NEXT: [[CALL:%.*]] = call i1 @check(i64* byval(i64) align 8 [[A_2]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 8, ptr [[A_2]])
+; CHECK-NEXT: call void @init(ptr sret(i64) align 8 [[A_2]])
+; CHECK-NEXT: store i8 0, ptr [[A_2]], align 1
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[A_1]], ptr [[A_2]], i64 8, i1 false)
+; CHECK-NEXT: call void @clobber(ptr [[A_3]])
+; CHECK-NEXT: [[CALL:%.*]] = call i1 @check(ptr byval(i64) align 8 [[A_2]])
; CHECK-NEXT: ret i1 [[CALL]]
;
entry:
%a.1 = alloca i64, align 8
%a.2 = alloca i64, align 8
%a.3 = alloca i64, align 8
- %bc.a.1 = bitcast i64* %a.1 to i8*
- %bc.a.2 = bitcast i64* %a.2 to i8*
- call void @llvm.lifetime.start.p0i8(i64 8, i8* %bc.a.2)
- call void @init(i64* sret(i64) align 8 %a.2)
- store i8 0, i8* %bc.a.2
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %bc.a.1, i8* %bc.a.2, i64 8, i1 false)
- %bc.a.3 = bitcast i64* %a.3 to i8*
- call void @clobber(i8* %bc.a.3)
- %call = call i1 @check(i64* byval(i64) align 8 %a.1)
+ call void @llvm.lifetime.start.p0(i64 8, ptr %a.2)
+ call void @init(ptr sret(i64) align 8 %a.2)
+ store i8 0, ptr %a.2
+ call void @llvm.memcpy.p0.p0.i64(ptr %a.1, ptr %a.2, i64 8, i1 false)
+ call void @clobber(ptr %a.3)
+ %call = call i1 @check(ptr byval(i64) align 8 %a.1)
ret i1 %call
}
diff --git a/llvm/test/Transforms/MemCpyOpt/memcpy-in-loop.ll b/llvm/test/Transforms/MemCpyOpt/memcpy-in-loop.ll
index 1d806b83c280..405583d7ea71 100644
--- a/llvm/test/Transforms/MemCpyOpt/memcpy-in-loop.ll
+++ b/llvm/test/Transforms/MemCpyOpt/memcpy-in-loop.ll
@@ -1,80 +1,68 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -memcpyopt < %s | FileCheck %s
-define void @test_copy_uninit([1000 x [1000 x i32]]* %arg) {
+define void @test_copy_uninit(ptr %arg) {
; CHECK-LABEL: @test_copy_uninit(
; CHECK-NEXT: start:
; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [1000 x i32], align 4
-; CHECK-NEXT: [[ALLOCA_I8:%.*]] = bitcast [1000 x i32]* [[ALLOCA]] to i8*
-; CHECK-NEXT: [[BEGIN:%.*]] = getelementptr inbounds [1000 x [1000 x i32]], [1000 x [1000 x i32]]* [[ARG:%.*]], i64 0, i64 0
-; CHECK-NEXT: [[END:%.*]] = getelementptr inbounds [1000 x [1000 x i32]], [1000 x [1000 x i32]]* [[ARG]], i64 0, i64 1000
+; CHECK-NEXT: [[END:%.*]] = getelementptr inbounds [1000 x [1000 x i32]], ptr [[ARG:%.*]], i64 0, i64 1000
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
-; CHECK-NEXT: [[CURRENT:%.*]] = phi [1000 x i32]* [ [[BEGIN]], [[START:%.*]] ], [ [[NEXT:%.*]], [[LOOP]] ]
-; CHECK-NEXT: [[CURRENT_I8:%.*]] = bitcast [1000 x i32]* [[CURRENT]] to i8*
-; CHECK-NEXT: [[NEXT]] = getelementptr inbounds [1000 x i32], [1000 x i32]* [[CURRENT]], i64 1
-; CHECK-NEXT: [[COND:%.*]] = icmp eq [1000 x i32]* [[NEXT]], [[END]]
+; CHECK-NEXT: [[CURRENT:%.*]] = phi ptr [ [[ARG]], [[START:%.*]] ], [ [[NEXT:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[NEXT]] = getelementptr inbounds [1000 x i32], ptr [[CURRENT]], i64 1
+; CHECK-NEXT: [[COND:%.*]] = icmp eq ptr [[NEXT]], [[END]]
; CHECK-NEXT: br i1 [[COND]], label [[EXIT:%.*]], label [[LOOP]]
; CHECK: exit:
; CHECK-NEXT: ret void
;
start:
%alloca = alloca [1000 x i32], align 4
- %alloca.i8 = bitcast [1000 x i32]* %alloca to i8*
- %begin = getelementptr inbounds [1000 x [1000 x i32]], [1000 x [1000 x i32]]* %arg, i64 0, i64 0
- %end = getelementptr inbounds [1000 x [1000 x i32]], [1000 x [1000 x i32]]* %arg, i64 0, i64 1000
+ %end = getelementptr inbounds [1000 x [1000 x i32]], ptr %arg, i64 0, i64 1000
br label %loop
loop: ; preds = %loop, %start
- %current = phi [1000 x i32]* [ %begin, %start ], [ %next, %loop ]
- %current.i8 = bitcast [1000 x i32]* %current to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 4 dereferenceable(4000) %current.i8, i8* nonnull align 4 dereferenceable(4000) %alloca.i8, i64 4000, i1 false)
- %next = getelementptr inbounds [1000 x i32], [1000 x i32]* %current, i64 1
- %cond = icmp eq [1000 x i32]* %next, %end
+ %current = phi ptr [ %arg, %start ], [ %next, %loop ]
+ call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 dereferenceable(4000) %current, ptr nonnull align 4 dereferenceable(4000) %alloca, i64 4000, i1 false)
+ %next = getelementptr inbounds [1000 x i32], ptr %current, i64 1
+ %cond = icmp eq ptr %next, %end
br i1 %cond, label %exit, label %loop
exit: ; preds = %loop
ret void
}
-define void @test_copy_zero([1000 x [1000 x i32]]* %arg) {
+define void @test_copy_zero(ptr %arg) {
; CHECK-LABEL: @test_copy_zero(
; CHECK-NEXT: start:
; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [1000 x i32], align 4
-; CHECK-NEXT: [[ALLOCA_I8:%.*]] = bitcast [1000 x i32]* [[ALLOCA]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* nonnull align 4 dereferenceable(4000) [[ALLOCA_I8]], i8 0, i64 4000, i1 false)
-; CHECK-NEXT: [[BEGIN:%.*]] = getelementptr inbounds [1000 x [1000 x i32]], [1000 x [1000 x i32]]* [[ARG:%.*]], i64 0, i64 0
-; CHECK-NEXT: [[END:%.*]] = getelementptr inbounds [1000 x [1000 x i32]], [1000 x [1000 x i32]]* [[ARG]], i64 0, i64 1000
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr nonnull align 4 dereferenceable(4000) [[ALLOCA]], i8 0, i64 4000, i1 false)
+; CHECK-NEXT: [[END:%.*]] = getelementptr inbounds [1000 x [1000 x i32]], ptr [[ARG:%.*]], i64 0, i64 1000
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
-; CHECK-NEXT: [[CURRENT:%.*]] = phi [1000 x i32]* [ [[BEGIN]], [[START:%.*]] ], [ [[NEXT:%.*]], [[LOOP]] ]
-; CHECK-NEXT: [[CURRENT_I8:%.*]] = bitcast [1000 x i32]* [[CURRENT]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[CURRENT_I8]], i8 0, i64 4000, i1 false)
-; CHECK-NEXT: [[NEXT]] = getelementptr inbounds [1000 x i32], [1000 x i32]* [[CURRENT]], i64 1
-; CHECK-NEXT: [[COND:%.*]] = icmp eq [1000 x i32]* [[NEXT]], [[END]]
+; CHECK-NEXT: [[CURRENT:%.*]] = phi ptr [ [[ARG]], [[START:%.*]] ], [ [[NEXT:%.*]], [[LOOP]] ]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[CURRENT]], i8 0, i64 4000, i1 false)
+; CHECK-NEXT: [[NEXT]] = getelementptr inbounds [1000 x i32], ptr [[CURRENT]], i64 1
+; CHECK-NEXT: [[COND:%.*]] = icmp eq ptr [[NEXT]], [[END]]
; CHECK-NEXT: br i1 [[COND]], label [[EXIT:%.*]], label [[LOOP]]
; CHECK: exit:
; CHECK-NEXT: ret void
;
start:
%alloca = alloca [1000 x i32], align 4
- %alloca.i8 = bitcast [1000 x i32]* %alloca to i8*
- call void @llvm.memset.p0i8.i64(i8* nonnull align 4 dereferenceable(4000) %alloca.i8, i8 0, i64 4000, i1 false)
- %begin = getelementptr inbounds [1000 x [1000 x i32]], [1000 x [1000 x i32]]* %arg, i64 0, i64 0
- %end = getelementptr inbounds [1000 x [1000 x i32]], [1000 x [1000 x i32]]* %arg, i64 0, i64 1000
+ call void @llvm.memset.p0.i64(ptr nonnull align 4 dereferenceable(4000) %alloca, i8 0, i64 4000, i1 false)
+ %end = getelementptr inbounds [1000 x [1000 x i32]], ptr %arg, i64 0, i64 1000
br label %loop
loop: ; preds = %loop, %start
- %current = phi [1000 x i32]* [ %begin, %start ], [ %next, %loop ]
- %current.i8 = bitcast [1000 x i32]* %current to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 4 dereferenceable(4000) %current.i8, i8* nonnull align 4 dereferenceable(4000) %alloca.i8, i64 4000, i1 false)
- %next = getelementptr inbounds [1000 x i32], [1000 x i32]* %current, i64 1
- %cond = icmp eq [1000 x i32]* %next, %end
+ %current = phi ptr [ %arg, %start ], [ %next, %loop ]
+ call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 dereferenceable(4000) %current, ptr nonnull align 4 dereferenceable(4000) %alloca, i64 4000, i1 false)
+ %next = getelementptr inbounds [1000 x i32], ptr %current, i64 1
+ %cond = icmp eq ptr %next, %end
br i1 %cond, label %exit, label %loop
exit: ; preds = %loop
ret void
}
-declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg)
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg)
+declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg)
+declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg)
diff --git a/llvm/test/Transforms/MemCpyOpt/memcpy-invoke-memcpy.ll b/llvm/test/Transforms/MemCpyOpt/memcpy-invoke-memcpy.ll
index 435689d69107..0740de91ccf0 100644
--- a/llvm/test/Transforms/MemCpyOpt/memcpy-invoke-memcpy.ll
+++ b/llvm/test/Transforms/MemCpyOpt/memcpy-invoke-memcpy.ll
@@ -5,70 +5,70 @@
; Test that memcpyopt works across the non-unwind edge of an invoke.
-define hidden void @test_normal(i8* noalias %dst, i8* %src) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+define hidden void @test_normal(ptr noalias %dst, ptr %src) personality ptr @__gxx_personality_v0 {
; CHECK-LABEL: @test_normal(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TEMP:%.*]] = alloca i8, i32 64, align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[TEMP]], i8* nonnull align 8 [[SRC:%.*]], i64 64, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[TEMP]], ptr nonnull align 8 [[SRC:%.*]], i64 64, i1 false)
; CHECK-NEXT: invoke void @invoke_me()
; CHECK-NEXT: to label [[TRY_CONT:%.*]] unwind label [[LPAD:%.*]]
; CHECK: lpad:
-; CHECK-NEXT: [[TMP0:%.*]] = landingpad { i8*, i32 }
-; CHECK-NEXT: catch i8* null
+; CHECK-NEXT: [[TMP0:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: catch ptr null
; CHECK-NEXT: ret void
; CHECK: try.cont:
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[DST:%.*]], i8* align 8 [[SRC]], i64 64, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DST:%.*]], ptr align 8 [[SRC]], i64 64, i1 false)
; CHECK-NEXT: ret void
;
entry:
%temp = alloca i8, i32 64
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %temp, i8* nonnull align 8 %src, i64 64, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %temp, ptr nonnull align 8 %src, i64 64, i1 false)
invoke void @invoke_me()
to label %try.cont unwind label %lpad
lpad:
- landingpad { i8*, i32 }
- catch i8* null
+ landingpad { ptr, i32 }
+ catch ptr null
ret void
try.cont:
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %temp, i64 64, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst, ptr align 8 %temp, i64 64, i1 false)
ret void
}
; Test that memcpyopt works across the unwind edge of an invoke.
-define hidden void @test_unwind(i8* noalias %dst, i8* %src) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+define hidden void @test_unwind(ptr noalias %dst, ptr %src) personality ptr @__gxx_personality_v0 {
; CHECK-LABEL: @test_unwind(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TEMP:%.*]] = alloca i8, i32 64, align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[TEMP]], i8* nonnull align 8 [[SRC:%.*]], i64 64, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[TEMP]], ptr nonnull align 8 [[SRC:%.*]], i64 64, i1 false)
; CHECK-NEXT: invoke void @invoke_me()
; CHECK-NEXT: to label [[TRY_CONT:%.*]] unwind label [[LPAD:%.*]]
; CHECK: lpad:
-; CHECK-NEXT: [[TMP0:%.*]] = landingpad { i8*, i32 }
-; CHECK-NEXT: catch i8* null
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[DST:%.*]], i8* align 8 [[SRC]], i64 64, i1 false)
+; CHECK-NEXT: [[TMP0:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: catch ptr null
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DST:%.*]], ptr align 8 [[SRC]], i64 64, i1 false)
; CHECK-NEXT: ret void
; CHECK: try.cont:
; CHECK-NEXT: ret void
;
entry:
%temp = alloca i8, i32 64
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %temp, i8* nonnull align 8 %src, i64 64, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %temp, ptr nonnull align 8 %src, i64 64, i1 false)
invoke void @invoke_me()
to label %try.cont unwind label %lpad
lpad:
- landingpad { i8*, i32 }
- catch i8* null
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %temp, i64 64, i1 false)
+ landingpad { ptr, i32 }
+ catch ptr null
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst, ptr align 8 %temp, i64 64, i1 false)
ret void
try.cont:
ret void
}
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1)
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1)
declare i32 @__gxx_personality_v0(...)
declare void @invoke_me() readnone
diff --git a/llvm/test/Transforms/MemCpyOpt/memcpy-to-memset-with-lifetimes.ll b/llvm/test/Transforms/MemCpyOpt/memcpy-to-memset-with-lifetimes.ll
index 6a70ce24d8cf..1b0f3b8d7d93 100644
--- a/llvm/test/Transforms/MemCpyOpt/memcpy-to-memset-with-lifetimes.ll
+++ b/llvm/test/Transforms/MemCpyOpt/memcpy-to-memset-with-lifetimes.ll
@@ -4,57 +4,48 @@
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-define void @foo([8 x i64]* noalias nocapture sret([8 x i64]) dereferenceable(64) %sret) {
+define void @foo(ptr noalias nocapture sret([8 x i64]) dereferenceable(64) %sret) {
; CHECK-LABEL: @foo(
; CHECK-NEXT: entry-block:
-; CHECK-NEXT: [[SRET1:%.*]] = bitcast [8 x i64]* [[SRET:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* noundef nonnull align 8 dereferenceable(64) [[SRET1]], i8 0, i64 64, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) [[SRET:%.*]], i8 0, i64 64, i1 false)
; CHECK-NEXT: ret void
;
entry-block:
%a = alloca [8 x i64], align 8
- %a.cast = bitcast [8 x i64]* %a to i8*
- call void @llvm.lifetime.start.p0i8(i64 64, i8* %a.cast)
- call void @llvm.memset.p0i8.i64(i8* align 8 %a.cast, i8 0, i64 64, i1 false)
- %sret.cast = bitcast [8 x i64]* %sret to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %sret.cast, i8* align 8 %a.cast, i64 64, i1 false)
- call void @llvm.lifetime.end.p0i8(i64 64, i8* %a.cast)
+ call void @llvm.lifetime.start.p0(i64 64, ptr %a)
+ call void @llvm.memset.p0.i64(ptr align 8 %a, i8 0, i64 64, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %sret, ptr align 8 %a, i64 64, i1 false)
+ call void @llvm.lifetime.end.p0(i64 64, ptr %a)
ret void
}
-define void @bar([8 x i64]* noalias nocapture sret([8 x i64]) dereferenceable(64) %sret, [8 x i64]* noalias nocapture dereferenceable(64) %out) {
+define void @bar(ptr noalias nocapture sret([8 x i64]) dereferenceable(64) %sret, ptr noalias nocapture dereferenceable(64) %out) {
; CHECK-LABEL: @bar(
; CHECK-NEXT: entry-block:
; CHECK-NEXT: [[A:%.*]] = alloca [8 x i64], align 8
-; CHECK-NEXT: [[A_CAST:%.*]] = bitcast [8 x i64]* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 64, i8* nonnull [[A_CAST]])
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* noundef nonnull align 8 dereferenceable(64) [[A_CAST]], i8 0, i64 64, i1 false)
-; CHECK-NEXT: [[SRET_CAST:%.*]] = bitcast [8 x i64]* [[SRET:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* noundef nonnull align 8 dereferenceable(64) [[SRET_CAST]], i8 0, i64 64, i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* noundef nonnull align 8 dereferenceable(32) [[A_CAST]], i8 42, i64 32, i1 false)
-; CHECK-NEXT: [[OUT_CAST:%.*]] = bitcast [8 x i64]* [[OUT:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* noundef nonnull align 8 dereferenceable(64) [[OUT_CAST]], i8* noundef nonnull align 8 dereferenceable(64) [[A_CAST]], i64 64, i1 false)
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 64, i8* nonnull [[A_CAST]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 64, ptr nonnull [[A]])
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) [[A]], i8 0, i64 64, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) [[SRET:%.*]], i8 0, i64 64, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) [[A]], i8 42, i64 32, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) [[OUT:%.*]], ptr noundef nonnull align 8 dereferenceable(64) [[A]], i64 64, i1 false)
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 64, ptr nonnull [[A]])
; CHECK-NEXT: ret void
;
entry-block:
%a = alloca [8 x i64], align 8
- %a.cast = bitcast [8 x i64]* %a to i8*
- call void @llvm.lifetime.start.p0i8(i64 64, i8* %a.cast)
- call void @llvm.memset.p0i8.i64(i8* align 8 %a.cast, i8 0, i64 64, i1 false)
- %sret.cast = bitcast [8 x i64]* %sret to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %sret.cast, i8* align 8 %a.cast, i64 64, i1 false)
- call void @llvm.memset.p0i8.i64(i8* align 8 %a.cast, i8 42, i64 32, i1 false)
- %out.cast = bitcast [8 x i64]* %out to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %out.cast, i8* align 8 %a.cast, i64 64, i1 false)
- call void @llvm.lifetime.end.p0i8(i64 64, i8* %a.cast)
+ call void @llvm.lifetime.start.p0(i64 64, ptr %a)
+ call void @llvm.memset.p0.i64(ptr align 8 %a, i8 0, i64 64, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %sret, ptr align 8 %a, i64 64, i1 false)
+ call void @llvm.memset.p0.i64(ptr align 8 %a, i8 42, i64 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %out, ptr align 8 %a, i64 64, i1 false)
+ call void @llvm.lifetime.end.p0(i64 64, ptr %a)
ret void
}
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) nounwind
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) nounwind
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture) nounwind
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture) nounwind
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1) nounwind
-declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) nounwind
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1) nounwind
+declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind
diff --git a/llvm/test/Transforms/MemCpyOpt/memcpy-to-memset.ll b/llvm/test/Transforms/MemCpyOpt/memcpy-to-memset.ll
index dc5d3b1e31f4..3313722d2964 100644
--- a/llvm/test/Transforms/MemCpyOpt/memcpy-to-memset.ll
+++ b/llvm/test/Transforms/MemCpyOpt/memcpy-to-memset.ll
@@ -1,19 +1,17 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -memcpyopt -S < %s -verify-memoryssa | FileCheck %s
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind
@undef = internal constant i32 undef, align 4
define void @test_undef() nounwind {
; CHECK-LABEL: @test_undef(
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
-; CHECK-NEXT: [[I8:%.*]] = bitcast i32* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[I8]], i8 undef, i64 4, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[A]], i8 undef, i64 4, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca i32, align 4
- %i8 = bitcast i32* %a to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %i8, i8* align 4 bitcast (i32* @undef to i8*), i64 4, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a, ptr align 4 @undef, i64 4, i1 false)
ret void
}
@@ -21,13 +19,11 @@ define void @test_undef() nounwind {
define void @test_i32x3() nounwind {
; CHECK-LABEL: @test_i32x3(
; CHECK-NEXT: [[A:%.*]] = alloca [3 x i32], align 4
-; CHECK-NEXT: [[I8:%.*]] = bitcast [3 x i32]* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[I8]], i8 -1, i64 12, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[A]], i8 -1, i64 12, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca [3 x i32], align 4
- %i8 = bitcast [3 x i32]* %a to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %i8, i8* align 4 bitcast ([3 x i32]* @i32x3 to i8*), i64 12, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a, ptr align 4 @i32x3, i64 12, i1 false)
ret void
}
@@ -35,13 +31,11 @@ define void @test_i32x3() nounwind {
define void @test_i32x3_undef() nounwind {
; CHECK-LABEL: @test_i32x3_undef(
; CHECK-NEXT: [[A:%.*]] = alloca [3 x i32], align 4
-; CHECK-NEXT: [[I8:%.*]] = bitcast [3 x i32]* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[I8]], i8 -1, i64 12, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[A]], i8 -1, i64 12, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca [3 x i32], align 4
- %i8 = bitcast [3 x i32]* %a to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %i8, i8* align 4 bitcast ([3 x i32]* @i32x3_undef to i8*), i64 12, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a, ptr align 4 @i32x3_undef, i64 12, i1 false)
ret void
}
@@ -50,13 +44,11 @@ define void @test_i32x3_undef() nounwind {
define void @test_bitfield() nounwind {
; CHECK-LABEL: @test_bitfield(
; CHECK-NEXT: [[A:%.*]] = alloca [[STRUCT_BITFIELD:%.*]], align 4
-; CHECK-NEXT: [[I8:%.*]] = bitcast %struct.bitfield* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[I8]], i8 -86, i64 4, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[A]], i8 -86, i64 4, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca %struct.bitfield, align 4
- %i8 = bitcast %struct.bitfield* %a to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %i8, i8* align 4 bitcast (%struct.bitfield* @bitfield to i8*), i64 4, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a, ptr align 4 @bitfield, i64 4, i1 false)
ret void
}
@@ -64,13 +56,11 @@ define void @test_bitfield() nounwind {
define void @test_i1x16_zero() nounwind {
; CHECK-LABEL: @test_i1x16_zero(
; CHECK-NEXT: [[A:%.*]] = alloca <16 x i1>, align 4
-; CHECK-NEXT: [[I8:%.*]] = bitcast <16 x i1>* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[I8]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[A]], i8 0, i64 16, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca <16 x i1>, align 4
- %i8 = bitcast <16 x i1>* %a to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %i8, i8* align 4 bitcast (<16 x i1>* @i1x16_zero to i8*), i64 16, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a, ptr align 4 @i1x16_zero, i64 16, i1 false)
ret void
}
@@ -79,13 +69,11 @@ define void @test_i1x16_zero() nounwind {
define void @test_i1x16_one() nounwind {
; CHECK-LABEL: @test_i1x16_one(
; CHECK-NEXT: [[A:%.*]] = alloca <16 x i1>, align 4
-; CHECK-NEXT: [[I8:%.*]] = bitcast <16 x i1>* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[I8]], i8* align 4 bitcast (<16 x i1>* @i1x16_one to i8*), i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[A]], ptr align 4 @i1x16_one, i64 16, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca <16 x i1>, align 4
- %i8 = bitcast <16 x i1>* %a to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %i8, i8* align 4 bitcast (<16 x i1>* @i1x16_one to i8*), i64 16, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a, ptr align 4 @i1x16_one, i64 16, i1 false)
ret void
}
@@ -93,12 +81,10 @@ define void @test_i1x16_one() nounwind {
define void @test_half() nounwind {
; CHECK-LABEL: @test_half(
; CHECK-NEXT: [[A:%.*]] = alloca half, align 4
-; CHECK-NEXT: [[I8:%.*]] = bitcast half* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[I8]], i8 0, i64 2, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[A]], i8 0, i64 2, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca half, align 4
- %i8 = bitcast half* %a to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %i8, i8* align 4 bitcast (half* @half to i8*), i64 2, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a, ptr align 4 @half, i64 2, i1 false)
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/memcpy-undef.ll b/llvm/test/Transforms/MemCpyOpt/memcpy-undef.ll
index 6b7d27c9f4c2..feef90cf535c 100644
--- a/llvm/test/Transforms/MemCpyOpt/memcpy-undef.ll
+++ b/llvm/test/Transforms/MemCpyOpt/memcpy-undef.ll
@@ -7,133 +7,121 @@ target triple = "x86_64-apple-macosx10.8.0"
%struct.foo = type { i8, [7 x i8], i32 }
; Check that the memcpy is removed.
-define i32 @test1(%struct.foo* nocapture %foobie) nounwind noinline ssp uwtable {
+define i32 @test1(ptr nocapture %foobie) nounwind noinline ssp uwtable {
; CHECK-LABEL: @test1(
; CHECK-NEXT: [[BLETCH_SROA_1:%.*]] = alloca [7 x i8], align 1
-; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_FOO:%.*]], %struct.foo* [[FOOBIE:%.*]], i64 0, i32 0
-; CHECK-NEXT: store i8 98, i8* [[TMP1]], align 4
-; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[STRUCT_FOO]], %struct.foo* [[FOOBIE]], i64 0, i32 1, i64 0
-; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds [7 x i8], [7 x i8]* [[BLETCH_SROA_1]], i64 0, i64 0
-; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[STRUCT_FOO]], %struct.foo* [[FOOBIE]], i64 0, i32 2
-; CHECK-NEXT: store i32 20, i32* [[TMP4]], align 4
+; CHECK-NEXT: store i8 98, ptr [[FOOBIE:%.*]], align 4
+; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_FOO:%.*]], ptr [[FOOBIE]], i64 0, i32 1, i64 0
+; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[STRUCT_FOO]], ptr [[FOOBIE]], i64 0, i32 2
+; CHECK-NEXT: store i32 20, ptr [[TMP2]], align 4
; CHECK-NEXT: ret i32 undef
;
%bletch.sroa.1 = alloca [7 x i8], align 1
- %1 = getelementptr inbounds %struct.foo, %struct.foo* %foobie, i64 0, i32 0
- store i8 98, i8* %1, align 4
- %2 = getelementptr inbounds %struct.foo, %struct.foo* %foobie, i64 0, i32 1, i64 0
- %3 = getelementptr inbounds [7 x i8], [7 x i8]* %bletch.sroa.1, i64 0, i64 0
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* %3, i64 7, i1 false)
- %4 = getelementptr inbounds %struct.foo, %struct.foo* %foobie, i64 0, i32 2
- store i32 20, i32* %4, align 4
+ store i8 98, ptr %foobie, align 4
+ %1 = getelementptr inbounds %struct.foo, ptr %foobie, i64 0, i32 1, i64 0
+ call void @llvm.memcpy.p0.p0.i64(ptr %1, ptr %bletch.sroa.1, i64 7, i1 false)
+ %2 = getelementptr inbounds %struct.foo, ptr %foobie, i64 0, i32 2
+ store i32 20, ptr %2, align 4
ret i32 undef
}
; Check that the memcpy is removed.
-define void @test2(i8* sret(i8) noalias nocapture %out, i8* %in) nounwind noinline ssp uwtable {
+define void @test2(ptr sret(i8) noalias nocapture %out, ptr %in) nounwind noinline ssp uwtable {
; CHECK-LABEL: @test2(
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[IN:%.*]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 8, ptr [[IN:%.*]])
; CHECK-NEXT: ret void
;
- call void @llvm.lifetime.start.p0i8(i64 8, i8* %in)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %out, i8* %in, i64 8, i1 false)
+ call void @llvm.lifetime.start.p0(i64 8, ptr %in)
+ call void @llvm.memcpy.p0.p0.i64(ptr %out, ptr %in, i64 8, i1 false)
ret void
}
; Check that the memcpy is not removed.
-define void @test3(i8* sret(i8) noalias nocapture %out, i8* %in) nounwind noinline ssp uwtable {
+define void @test3(ptr sret(i8) noalias nocapture %out, ptr %in) nounwind noinline ssp uwtable {
; CHECK-LABEL: @test3(
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* [[IN:%.*]])
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[OUT:%.*]], i8* [[IN]], i64 8, i1 false)
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr [[IN:%.*]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[OUT:%.*]], ptr [[IN]], i64 8, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.lifetime.start.p0i8(i64 4, i8* %in)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %out, i8* %in, i64 8, i1 false)
+ call void @llvm.lifetime.start.p0(i64 4, ptr %in)
+ call void @llvm.memcpy.p0.p0.i64(ptr %out, ptr %in, i64 8, i1 false)
ret void
}
; Check that the memcpy is not removed.
-define void @test_lifetime_may_alias(i8* %lifetime, i8* %src, i8* %dst) {
+define void @test_lifetime_may_alias(ptr %lifetime, ptr %src, ptr %dst) {
; CHECK-LABEL: @test_lifetime_may_alias(
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[LIFETIME:%.*]])
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST:%.*]], i8* [[SRC:%.*]], i64 8, i1 false)
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 8, ptr [[LIFETIME:%.*]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST:%.*]], ptr [[SRC:%.*]], i64 8, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.lifetime.start.p0i8(i64 8, i8* %lifetime)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 8, i1 false)
+ call void @llvm.lifetime.start.p0(i64 8, ptr %lifetime)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 8, i1 false)
ret void
}
; lifetime.start on full alloca size, copy in range.
-define void @test_lifetime_partial_alias_1(i8* noalias %dst) {
+define void @test_lifetime_partial_alias_1(ptr noalias %dst) {
; CHECK-LABEL: @test_lifetime_partial_alias_1(
; CHECK-NEXT: [[A:%.*]] = alloca [16 x i8], align 1
-; CHECK-NEXT: [[A_I8:%.*]] = bitcast [16 x i8]* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 16, i8* [[A_I8]])
-; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, i8* [[A_I8]], i64 8
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr [[A]])
+; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, ptr [[A]], i64 8
; CHECK-NEXT: ret void
;
%a = alloca [16 x i8]
- %a.i8 = bitcast [16 x i8]* %a to i8*
- call void @llvm.lifetime.start.p0i8(i64 16, i8* %a.i8)
- %gep = getelementptr i8, i8* %a.i8, i64 8
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %gep, i64 8, i1 false)
+ call void @llvm.lifetime.start.p0(i64 16, ptr %a)
+ %gep = getelementptr i8, ptr %a, i64 8
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %gep, i64 8, i1 false)
ret void
}
; lifetime.start on full alloca size, copy out of range.
-define void @test_lifetime_partial_alias_2(i8* noalias %dst) {
+define void @test_lifetime_partial_alias_2(ptr noalias %dst) {
; CHECK-LABEL: @test_lifetime_partial_alias_2(
; CHECK-NEXT: [[A:%.*]] = alloca [16 x i8], align 1
-; CHECK-NEXT: [[A_I8:%.*]] = bitcast [16 x i8]* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 16, i8* [[A_I8]])
-; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, i8* [[A_I8]], i64 8
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr [[A]])
+; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, ptr [[A]], i64 8
; CHECK-NEXT: ret void
;
%a = alloca [16 x i8]
- %a.i8 = bitcast [16 x i8]* %a to i8*
- call void @llvm.lifetime.start.p0i8(i64 16, i8* %a.i8)
- %gep = getelementptr i8, i8* %a.i8, i64 8
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %gep, i64 16, i1 false)
+ call void @llvm.lifetime.start.p0(i64 16, ptr %a)
+ %gep = getelementptr i8, ptr %a, i64 8
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %gep, i64 16, i1 false)
ret void
}
; lifetime.start on part of alloca, copy in range.
-define void @test_lifetime_partial_alias_3(i8* noalias %dst) {
+define void @test_lifetime_partial_alias_3(ptr noalias %dst) {
; CHECK-LABEL: @test_lifetime_partial_alias_3(
; CHECK-NEXT: [[A:%.*]] = alloca [16 x i8], align 1
-; CHECK-NEXT: [[A_I8:%.*]] = bitcast [16 x i8]* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 12, i8* [[A_I8]])
-; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, i8* [[A_I8]], i64 8
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST:%.*]], i8* [[GEP]], i64 4, i1 false)
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 12, ptr [[A]])
+; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, ptr [[A]], i64 8
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST:%.*]], ptr [[GEP]], i64 4, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca [16 x i8]
- %a.i8 = bitcast [16 x i8]* %a to i8*
- call void @llvm.lifetime.start.p0i8(i64 12, i8* %a.i8)
- %gep = getelementptr i8, i8* %a.i8, i64 8
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %gep, i64 4, i1 false)
+ call void @llvm.lifetime.start.p0(i64 12, ptr %a)
+ %gep = getelementptr i8, ptr %a, i64 8
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %gep, i64 4, i1 false)
ret void
}
; lifetime.start on part of alloca, copy out of range.
-define void @test_lifetime_partial_alias_4(i8* noalias %dst) {
+define void @test_lifetime_partial_alias_4(ptr noalias %dst) {
; CHECK-LABEL: @test_lifetime_partial_alias_4(
; CHECK-NEXT: [[A:%.*]] = alloca [16 x i8], align 1
-; CHECK-NEXT: [[A_I8:%.*]] = bitcast [16 x i8]* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 12, i8* [[A_I8]])
-; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, i8* [[A_I8]], i64 8
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST:%.*]], i8* [[GEP]], i64 8, i1 false)
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 12, ptr [[A]])
+; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, ptr [[A]], i64 8
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST:%.*]], ptr [[GEP]], i64 8, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca [16 x i8]
- %a.i8 = bitcast [16 x i8]* %a to i8*
- call void @llvm.lifetime.start.p0i8(i64 12, i8* %a.i8)
- %gep = getelementptr i8, i8* %a.i8, i64 8
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %gep, i64 8, i1 false)
+ call void @llvm.lifetime.start.p0(i64 12, ptr %a)
+ %gep = getelementptr i8, ptr %a, i64 8
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %gep, i64 8, i1 false)
ret void
}
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) nounwind
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture) nounwind
diff --git a/llvm/test/Transforms/MemCpyOpt/memcpy.ll b/llvm/test/Transforms/MemCpyOpt/memcpy.ll
index 8ba7772b3178..dafdba9ce1c5 100644
--- a/llvm/test/Transforms/MemCpyOpt/memcpy.ll
+++ b/llvm/test/Transforms/MemCpyOpt/memcpy.ll
@@ -9,132 +9,118 @@ target triple = "i686-apple-darwin9"
@C = external constant [0 x i8]
-declare void @llvm.memcpy.p1i8.p0i8.i64(i8 addrspace(1)* nocapture, i8* nocapture, i64, i1) nounwind
-declare void @llvm.memcpy.p0i8.p1i8.i64(i8* nocapture, i8 addrspace(1)* nocapture, i64, i1) nounwind
-declare void @llvm.memcpy.p1i8.p1i8.i64(i8 addrspace(1)* nocapture, i8 addrspace(1)* nocapture, i64, i1) nounwind
-declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind
-declare void @llvm.memcpy.inline.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind
-declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) nounwind
+declare void @llvm.memcpy.p1.p0.i64(ptr addrspace(1) nocapture, ptr nocapture, i64, i1) nounwind
+declare void @llvm.memcpy.p0.p1.i64(ptr nocapture, ptr addrspace(1) nocapture, i64, i1) nounwind
+declare void @llvm.memcpy.p1.p1.i64(ptr addrspace(1) nocapture, ptr addrspace(1) nocapture, i64, i1) nounwind
+declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind
+declare void @llvm.memcpy.inline.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind
+declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind
; Check that one of the memcpy's are removed.
;; FIXME: PR 8643 We should be able to eliminate the last memcpy here.
-define void @test1(%0* sret(%0) %agg.result, x86_fp80 %z.0, x86_fp80 %z.1) nounwind {
+define void @test1(ptr sret(%0) %agg.result, x86_fp80 %z.0, x86_fp80 %z.1) nounwind {
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP2:%.*]] = alloca [[TMP0:%.*]], align 16
; CHECK-NEXT: [[MEMTMP:%.*]] = alloca [[TMP0]], align 16
; CHECK-NEXT: [[TMP5:%.*]] = fsub x86_fp80 0xK80000000000000000000, [[Z_1:%.*]]
-; CHECK-NEXT: call void @ccoshl(%0* sret([[TMP0]]) [[TMP2]], x86_fp80 [[TMP5]], x86_fp80 [[Z_0:%.*]]) #[[ATTR2:[0-9]+]]
-; CHECK-NEXT: [[TMP219:%.*]] = bitcast %0* [[TMP2]] to i8*
-; CHECK-NEXT: [[MEMTMP20:%.*]] = bitcast %0* [[MEMTMP]] to i8*
-; CHECK-NEXT: [[AGG_RESULT21:%.*]] = bitcast %0* [[AGG_RESULT:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 [[AGG_RESULT21]], i8* align 16 [[TMP219]], i32 32, i1 false)
+; CHECK-NEXT: call void @ccoshl(ptr sret([[TMP0]]) [[TMP2]], x86_fp80 [[TMP5]], x86_fp80 [[Z_0:%.*]]) #[[ATTR2:[0-9]+]]
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 16 [[AGG_RESULT:%.*]], ptr align 16 [[TMP2]], i32 32, i1 false)
; CHECK-NEXT: ret void
;
entry:
%tmp2 = alloca %0
%memtmp = alloca %0, align 16
%tmp5 = fsub x86_fp80 0xK80000000000000000000, %z.1
- call void @ccoshl(%0* sret(%0) %memtmp, x86_fp80 %tmp5, x86_fp80 %z.0) nounwind
- %tmp219 = bitcast %0* %tmp2 to i8*
- %memtmp20 = bitcast %0* %memtmp to i8*
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %tmp219, i8* align 16 %memtmp20, i32 32, i1 false)
- %agg.result21 = bitcast %0* %agg.result to i8*
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %agg.result21, i8* align 16 %tmp219, i32 32, i1 false)
+ call void @ccoshl(ptr sret(%0) %memtmp, x86_fp80 %tmp5, x86_fp80 %z.0) nounwind
+ call void @llvm.memcpy.p0.p0.i32(ptr align 16 %tmp2, ptr align 16 %memtmp, i32 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 16 %agg.result, ptr align 16 %tmp2, i32 32, i1 false)
ret void
}
-declare void @ccoshl(%0* nocapture sret(%0), x86_fp80, x86_fp80) nounwind
+declare void @ccoshl(ptr nocapture sret(%0), x86_fp80, x86_fp80) nounwind
; The intermediate alloca and one of the memcpy's should be eliminated, the
; other should be related with a memmove.
-define void @test2(i8* %P, i8* %Q) nounwind {
+define void @test2(ptr %P, ptr %Q) nounwind {
; CHECK-LABEL: @test2(
-; CHECK-NEXT: call void @llvm.memmove.p0i8.p0i8.i32(i8* align 16 [[Q:%.*]], i8* align 16 [[P:%.*]], i32 32, i1 false)
+; CHECK-NEXT: call void @llvm.memmove.p0.p0.i32(ptr align 16 [[Q:%.*]], ptr align 16 [[P:%.*]], i32 32, i1 false)
; CHECK-NEXT: ret void
;
%memtmp = alloca %0, align 16
- %R = bitcast %0* %memtmp to i8*
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %R, i8* align 16 %P, i32 32, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %Q, i8* align 16 %R, i32 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 16 %memtmp, ptr align 16 %P, i32 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 16 %Q, ptr align 16 %memtmp, i32 32, i1 false)
ret void
}
; The intermediate alloca and one of the memcpy's should be eliminated, the
; other should be related with a memcpy.
-define void @test2_constant(i8* %Q) nounwind {
+define void @test2_constant(ptr %Q) nounwind {
; CHECK-LABEL: @test2_constant(
-; CHECK-NEXT: [[P:%.*]] = getelementptr inbounds [0 x i8], [0 x i8]* @C, i64 0, i64 0
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 [[Q:%.*]], i8* align 16 [[P]], i32 32, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 16 [[Q:%.*]], ptr align 16 @C, i32 32, i1 false)
; CHECK-NEXT: ret void
;
%memtmp = alloca %0, align 16
- %R = bitcast %0* %memtmp to i8*
- %P = getelementptr inbounds [0 x i8], [0 x i8]* @C, i64 0, i64 0
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %R, i8* align 16 %P, i32 32, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %Q, i8* align 16 %R, i32 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 16 %memtmp, ptr align 16 @C, i32 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 16 %Q, ptr align 16 %memtmp, i32 32, i1 false)
ret void
}
; The intermediate alloca and one of the memcpy's should be eliminated, the
; other should be related with a memcpy.
-define void @test2_memcpy(i8* noalias %P, i8* noalias %Q) nounwind {
+define void @test2_memcpy(ptr noalias %P, ptr noalias %Q) nounwind {
; CHECK-LABEL: @test2_memcpy(
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 [[Q:%.*]], i8* align 16 [[P:%.*]], i32 32, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 16 [[Q:%.*]], ptr align 16 [[P:%.*]], i32 32, i1 false)
; CHECK-NEXT: ret void
;
%memtmp = alloca %0, align 16
- %R = bitcast %0* %memtmp to i8*
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %R, i8* align 16 %P, i32 32, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %Q, i8* align 16 %R, i32 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 16 %memtmp, ptr align 16 %P, i32 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 16 %Q, ptr align 16 %memtmp, i32 32, i1 false)
ret void
}
; Same as @test2_memcpy, but the remaining memcpy should remain non-inline even
; if the one eliminated was inline.
-define void @test3_memcpy(i8* noalias %P, i8* noalias %Q) nounwind {
+define void @test3_memcpy(ptr noalias %P, ptr noalias %Q) nounwind {
; CHECK-LABEL: @test3_memcpy(
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 [[Q:%.*]], i8* align 16 [[P:%.*]], i32 32, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 16 [[Q:%.*]], ptr align 16 [[P:%.*]], i32 32, i1 false)
; CHECK-NEXT: ret void
;
%memtmp = alloca %0, align 16
- %R = bitcast %0* %memtmp to i8*
- call void @llvm.memcpy.inline.p0i8.p0i8.i32(i8* align 16 %R, i8* align 16 %P, i32 32, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %Q, i8* align 16 %R, i32 32, i1 false)
+ call void @llvm.memcpy.inline.p0.p0.i32(ptr align 16 %memtmp, ptr align 16 %P, i32 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 16 %Q, ptr align 16 %memtmp, i32 32, i1 false)
ret void
}
; Same as @test2_memcpy, but the remaining memcpy should remain inline even
; if the one eliminated was not inline.
-define void @test4_memcpy(i8* noalias %P, i8* noalias %Q) nounwind {
+define void @test4_memcpy(ptr noalias %P, ptr noalias %Q) nounwind {
; CHECK-LABEL: @test4_memcpy(
-; CHECK-NEXT: call void @llvm.memcpy.inline.p0i8.p0i8.i32(i8* align 16 [[Q:%.*]], i8* align 16 [[P:%.*]], i32 32, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.inline.p0.p0.i32(ptr align 16 [[Q:%.*]], ptr align 16 [[P:%.*]], i32 32, i1 false)
; CHECK-NEXT: ret void
;
%memtmp = alloca %0, align 16
- %R = bitcast %0* %memtmp to i8*
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %R, i8* align 16 %P, i32 32, i1 false)
- call void @llvm.memcpy.inline.p0i8.p0i8.i32(i8* align 16 %Q, i8* align 16 %R, i32 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 16 %memtmp, ptr align 16 %P, i32 32, i1 false)
+ call void @llvm.memcpy.inline.p0.p0.i32(ptr align 16 %Q, ptr align 16 %memtmp, i32 32, i1 false)
ret void
}
; Same as @test2_memcpy, and the inline-ness should be preserved.
-define void @test5_memcpy(i8* noalias %P, i8* noalias %Q) nounwind {
+define void @test5_memcpy(ptr noalias %P, ptr noalias %Q) nounwind {
; CHECK-LABEL: @test5_memcpy(
-; CHECK-NEXT: call void @llvm.memcpy.inline.p0i8.p0i8.i32(i8* align 16 [[Q:%.*]], i8* align 16 [[P:%.*]], i32 32, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.inline.p0.p0.i32(ptr align 16 [[Q:%.*]], ptr align 16 [[P:%.*]], i32 32, i1 false)
; CHECK-NEXT: ret void
;
%memtmp = alloca %0, align 16
- %R = bitcast %0* %memtmp to i8*
- call void @llvm.memcpy.inline.p0i8.p0i8.i32(i8* align 16 %R, i8* align 16 %P, i32 32, i1 false)
- call void @llvm.memcpy.inline.p0i8.p0i8.i32(i8* align 16 %Q, i8* align 16 %R, i32 32, i1 false)
+ call void @llvm.memcpy.inline.p0.p0.i32(ptr align 16 %memtmp, ptr align 16 %P, i32 32, i1 false)
+ call void @llvm.memcpy.inline.p0.p0.i32(ptr align 16 %Q, ptr align 16 %memtmp, i32 32, i1 false)
ret void
}
@@ -142,116 +128,103 @@ define void @test5_memcpy(i8* noalias %P, i8* noalias %Q) nounwind {
@x = external global %0
-define void @test3(%0* noalias sret(%0) %agg.result) nounwind {
+define void @test3(ptr noalias sret(%0) %agg.result) nounwind {
; CHECK-LABEL: @test3(
; CHECK-NEXT: [[X_0:%.*]] = alloca [[TMP0:%.*]], align 16
-; CHECK-NEXT: [[X_01:%.*]] = bitcast %0* [[X_0]] to i8*
-; CHECK-NEXT: [[AGG_RESULT1:%.*]] = bitcast %0* [[AGG_RESULT:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 [[AGG_RESULT1]], i8* align 16 bitcast (%0* @x to i8*), i32 32, i1 false)
-; CHECK-NEXT: [[AGG_RESULT2:%.*]] = bitcast %0* [[AGG_RESULT]] to i8*
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 16 [[AGG_RESULT:%.*]], ptr align 16 @x, i32 32, i1 false)
; CHECK-NEXT: ret void
;
%x.0 = alloca %0
- %x.01 = bitcast %0* %x.0 to i8*
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %x.01, i8* align 16 bitcast (%0* @x to i8*), i32 32, i1 false)
- %agg.result2 = bitcast %0* %agg.result to i8*
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %agg.result2, i8* align 16 %x.01, i32 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 16 %x.0, ptr align 16 @x, i32 32, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 16 %agg.result, ptr align 16 %x.0, i32 32, i1 false)
ret void
}
; PR8644
-define void @test4(i8 *%P) {
+define void @test4(ptr %P) {
; CHECK-LABEL: @test4(
-; CHECK-NEXT: call void @test4a(i8* byval(i8) align 1 [[P:%.*]])
+; CHECK-NEXT: call void @test4a(ptr byval(i8) align 1 [[P:%.*]])
; CHECK-NEXT: ret void
;
%A = alloca %1
- %a = bitcast %1* %A to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4 %P, i64 8, i1 false)
- call void @test4a(i8* align 1 byval(i8) %a)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %A, ptr align 4 %P, i64 8, i1 false)
+ call void @test4a(ptr align 1 byval(i8) %A)
ret void
}
; Make sure we don't remove the memcpy if the source address space doesn't match the byval argument
-define void @test4_addrspace(i8 addrspace(1)* %P) {
+define void @test4_addrspace(ptr addrspace(1) %P) {
; CHECK-LABEL: @test4_addrspace(
; CHECK-NEXT: [[A1:%.*]] = alloca [[TMP1:%.*]], align 8
-; CHECK-NEXT: [[A2:%.*]] = bitcast %1* [[A1]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p1i8.i64(i8* align 4 [[A2]], i8 addrspace(1)* align 4 [[P:%.*]], i64 8, i1 false)
-; CHECK-NEXT: call void @test4a(i8* byval(i8) align 1 [[A2]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p1.i64(ptr align 4 [[A1]], ptr addrspace(1) align 4 [[P:%.*]], i64 8, i1 false)
+; CHECK-NEXT: call void @test4a(ptr byval(i8) align 1 [[A1]])
; CHECK-NEXT: ret void
;
%a1 = alloca %1
- %a2 = bitcast %1* %a1 to i8*
- call void @llvm.memcpy.p0i8.p1i8.i64(i8* align 4 %a2, i8 addrspace(1)* align 4 %P, i64 8, i1 false)
- call void @test4a(i8* align 1 byval(i8) %a2)
+ call void @llvm.memcpy.p0.p1.i64(ptr align 4 %a1, ptr addrspace(1) align 4 %P, i64 8, i1 false)
+ call void @test4a(ptr align 1 byval(i8) %a1)
ret void
}
-define void @test4_write_between(i8 *%P) {
+define void @test4_write_between(ptr %P) {
; CHECK-LABEL: @test4_write_between(
; CHECK-NEXT: [[A1:%.*]] = alloca [[TMP1:%.*]], align 8
-; CHECK-NEXT: [[A2:%.*]] = bitcast %1* [[A1]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[A2]], i8* align 4 [[P:%.*]], i64 8, i1 false)
-; CHECK-NEXT: store i8 0, i8* [[A2]], align 1
-; CHECK-NEXT: call void @test4a(i8* byval(i8) align 1 [[A2]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[A1]], ptr align 4 [[P:%.*]], i64 8, i1 false)
+; CHECK-NEXT: store i8 0, ptr [[A1]], align 1
+; CHECK-NEXT: call void @test4a(ptr byval(i8) align 1 [[A1]])
; CHECK-NEXT: ret void
;
%a1 = alloca %1
- %a2 = bitcast %1* %a1 to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a2, i8* align 4 %P, i64 8, i1 false)
- store i8 0, i8* %a2
- call void @test4a(i8* align 1 byval(i8) %a2)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a1, ptr align 4 %P, i64 8, i1 false)
+ store i8 0, ptr %a1
+ call void @test4a(ptr align 1 byval(i8) %a1)
ret void
}
-define i8 @test4_read_between(i8 *%P) {
+define i8 @test4_read_between(ptr %P) {
; CHECK-LABEL: @test4_read_between(
; CHECK-NEXT: [[A1:%.*]] = alloca [[TMP1:%.*]], align 8
-; CHECK-NEXT: [[A2:%.*]] = bitcast %1* [[A1]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[A2]], i8* align 4 [[P:%.*]], i64 8, i1 false)
-; CHECK-NEXT: [[X:%.*]] = load i8, i8* [[A2]], align 1
-; CHECK-NEXT: call void @test4a(i8* byval(i8) align 1 [[P]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[A1]], ptr align 4 [[P:%.*]], i64 8, i1 false)
+; CHECK-NEXT: [[X:%.*]] = load i8, ptr [[A1]], align 1
+; CHECK-NEXT: call void @test4a(ptr byval(i8) align 1 [[P]])
; CHECK-NEXT: ret i8 [[X]]
;
%a1 = alloca %1
- %a2 = bitcast %1* %a1 to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a2, i8* align 4 %P, i64 8, i1 false)
- %x = load i8, i8* %a2
- call void @test4a(i8* align 1 byval(i8) %a2)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a1, ptr align 4 %P, i64 8, i1 false)
+ %x = load i8, ptr %a1
+ call void @test4a(ptr align 1 byval(i8) %a1)
ret i8 %x
}
-define void @test4_non_local(i8 *%P, i1 %c) {
+define void @test4_non_local(ptr %P, i1 %c) {
; CHECK-LABEL: @test4_non_local(
; CHECK-NEXT: br i1 [[C:%.*]], label [[CALL:%.*]], label [[EXIT:%.*]]
; CHECK: call:
-; CHECK-NEXT: call void @test4a(i8* byval(i8) align 1 [[P:%.*]])
+; CHECK-NEXT: call void @test4a(ptr byval(i8) align 1 [[P:%.*]])
; CHECK-NEXT: br label [[EXIT]]
; CHECK: exit:
; CHECK-NEXT: ret void
;
%a1 = alloca %1
- %a2 = bitcast %1* %a1 to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a2, i8* align 4 %P, i64 8, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a1, ptr align 4 %P, i64 8, i1 false)
br i1 %c, label %call, label %exit
call:
- call void @test4a(i8* align 1 byval(i8) %a2)
+ call void @test4a(ptr align 1 byval(i8) %a1)
br label %exit
exit:
ret void
}
-declare void @test4a(i8* align 1 byval(i8))
+declare void @test4a(ptr align 1 byval(i8))
%struct.S = type { i128, [4 x i8]}
@sS = external global %struct.S, align 16
-declare void @test5a(%struct.S* align 16 byval(%struct.S)) nounwind ssp
+declare void @test5a(ptr align 16 byval(%struct.S)) nounwind ssp
; rdar://8713376 - This memcpy can't be eliminated.
@@ -259,29 +232,27 @@ define i32 @test5(i32 %x) nounwind ssp {
; CHECK-LABEL: @test5(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[Y:%.*]] = alloca [[STRUCT_S:%.*]], align 16
-; CHECK-NEXT: [[TMP:%.*]] = bitcast %struct.S* [[Y]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 [[TMP]], i8* align 16 bitcast (%struct.S* @sS to i8*), i64 32, i1 false)
-; CHECK-NEXT: [[A:%.*]] = getelementptr [[STRUCT_S]], %struct.S* [[Y]], i64 0, i32 1, i64 0
-; CHECK-NEXT: store i8 4, i8* [[A]], align 1
-; CHECK-NEXT: call void @test5a(%struct.S* byval([[STRUCT_S]]) align 16 [[Y]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[Y]], ptr align 16 @sS, i64 32, i1 false)
+; CHECK-NEXT: [[A:%.*]] = getelementptr [[STRUCT_S]], ptr [[Y]], i64 0, i32 1, i64 0
+; CHECK-NEXT: store i8 4, ptr [[A]], align 1
+; CHECK-NEXT: call void @test5a(ptr byval([[STRUCT_S]]) align 16 [[Y]])
; CHECK-NEXT: ret i32 0
;
entry:
%y = alloca %struct.S, align 16
- %tmp = bitcast %struct.S* %y to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 %tmp, i8* align 16 bitcast (%struct.S* @sS to i8*), i64 32, i1 false)
- %a = getelementptr %struct.S, %struct.S* %y, i64 0, i32 1, i64 0
- store i8 4, i8* %a
- call void @test5a(%struct.S* align 16 byval(%struct.S) %y)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 16 %y, ptr align 16 @sS, i64 32, i1 false)
+ %a = getelementptr %struct.S, ptr %y, i64 0, i32 1, i64 0
+ store i8 4, ptr %a
+ call void @test5a(ptr align 16 byval(%struct.S) %y)
ret i32 0
}
;; Noop memcpy should be zapped.
-define void @test6(i8 *%P) {
+define void @test6(ptr %P) {
; CHECK-LABEL: @test6(
; CHECK-NEXT: ret void
;
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %P, i8* align 4 %P, i64 8, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %P, ptr align 4 %P, i64 8, i1 false)
ret void
}
@@ -290,22 +261,20 @@ define void @test6(i8 *%P) {
; isn't itself 8 byte aligned.
%struct.p = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
-define i32 @test7(%struct.p* nocapture align 8 byval(%struct.p) %q) nounwind ssp {
+define i32 @test7(ptr nocapture align 8 byval(%struct.p) %q) nounwind ssp {
; CHECK-LABEL: @test7(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[CALL:%.*]] = call i32 @g(%struct.p* byval([[STRUCT_P:%.*]]) align 8 [[Q:%.*]]) #[[ATTR2]]
+; CHECK-NEXT: [[CALL:%.*]] = call i32 @g(ptr byval([[STRUCT_P:%.*]]) align 8 [[Q:%.*]]) #[[ATTR2]]
; CHECK-NEXT: ret i32 [[CALL]]
;
entry:
%agg.tmp = alloca %struct.p, align 4
- %tmp = bitcast %struct.p* %agg.tmp to i8*
- %tmp1 = bitcast %struct.p* %q to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %tmp, i8* align 4 %tmp1, i64 48, i1 false)
- %call = call i32 @g(%struct.p* align 8 byval(%struct.p) %agg.tmp) nounwind
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %agg.tmp, ptr align 4 %q, i64 48, i1 false)
+ %call = call i32 @g(ptr align 8 byval(%struct.p) %agg.tmp) nounwind
ret i32 %call
}
-declare i32 @g(%struct.p* align 8 byval(%struct.p))
+declare i32 @g(ptr align 8 byval(%struct.p))
; PR11142 - When looking for a memcpy-memcpy dependency, don't get stuck on
@@ -316,16 +285,16 @@ define void @test8() {
; CHECK-LABEL: @test8(
; CHECK-NEXT: ret void
;
- %A = tail call i8* @malloc(i32 10)
- %B = getelementptr inbounds i8, i8* %A, i64 2
- tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %B, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @test8.str, i64 0, i64 0), i32 7, i1 false)
- %C = tail call i8* @malloc(i32 10)
- %D = getelementptr inbounds i8, i8* %C, i64 2
- tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %D, i8* %B, i32 7, i1 false)
+ %A = tail call ptr @malloc(i32 10)
+ %B = getelementptr inbounds i8, ptr %A, i64 2
+ tail call void @llvm.memcpy.p0.p0.i32(ptr %B, ptr @test8.str, i32 7, i1 false)
+ %C = tail call ptr @malloc(i32 10)
+ %D = getelementptr inbounds i8, ptr %C, i64 2
+ tail call void @llvm.memcpy.p0.p0.i32(ptr %D, ptr %B, i32 7, i1 false)
ret void
}
-declare noalias i8* @malloc(i32) willreturn allockind("alloc,uninitialized") allocsize(0)
+declare noalias ptr @malloc(i32) willreturn allockind("alloc,uninitialized") allocsize(0)
; rdar://11341081
%struct.big = type { [50 x i32] }
@@ -335,20 +304,20 @@ define void @test9_addrspacecast() nounwind ssp uwtable {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[B:%.*]] = alloca [[STRUCT_BIG:%.*]], align 4
; CHECK-NEXT: [[TMP:%.*]] = alloca [[STRUCT_BIG]], align 4
-; CHECK-NEXT: call void @f1(%struct.big* sret([[STRUCT_BIG]]) [[B]])
-; CHECK-NEXT: [[TMP0:%.*]] = addrspacecast %struct.big* [[B]] to i8 addrspace(1)*
-; CHECK-NEXT: [[TMP1:%.*]] = addrspacecast %struct.big* [[TMP]] to i8 addrspace(1)*
-; CHECK-NEXT: call void @f2(%struct.big* [[B]])
+; CHECK-NEXT: call void @f1(ptr sret([[STRUCT_BIG]]) [[B]])
+; CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr [[B]] to ptr addrspace(1)
+; CHECK-NEXT: [[TMP1:%.*]] = addrspacecast ptr [[TMP]] to ptr addrspace(1)
+; CHECK-NEXT: call void @f2(ptr [[B]])
; CHECK-NEXT: ret void
;
entry:
%b = alloca %struct.big, align 4
%tmp = alloca %struct.big, align 4
- call void @f1(%struct.big* sret(%struct.big) %tmp)
- %0 = addrspacecast %struct.big* %b to i8 addrspace(1)*
- %1 = addrspacecast %struct.big* %tmp to i8 addrspace(1)*
- call void @llvm.memcpy.p1i8.p1i8.i64(i8 addrspace(1)* align 4 %0, i8 addrspace(1)* align 4 %1, i64 200, i1 false)
- call void @f2(%struct.big* %b)
+ call void @f1(ptr sret(%struct.big) %tmp)
+ %0 = addrspacecast ptr %b to ptr addrspace(1)
+ %1 = addrspacecast ptr %tmp to ptr addrspace(1)
+ call void @llvm.memcpy.p1.p1.i64(ptr addrspace(1) align 4 %0, ptr addrspace(1) align 4 %1, i64 200, i1 false)
+ call void @f2(ptr %b)
ret void
}
@@ -357,20 +326,16 @@ define void @test9() nounwind ssp uwtable {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[B:%.*]] = alloca [[STRUCT_BIG:%.*]], align 4
; CHECK-NEXT: [[TMP:%.*]] = alloca [[STRUCT_BIG]], align 4
-; CHECK-NEXT: call void @f1(%struct.big* sret([[STRUCT_BIG]]) [[B]])
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast %struct.big* [[B]] to i8*
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast %struct.big* [[TMP]] to i8*
-; CHECK-NEXT: call void @f2(%struct.big* [[B]])
+; CHECK-NEXT: call void @f1(ptr sret([[STRUCT_BIG]]) [[B]])
+; CHECK-NEXT: call void @f2(ptr [[B]])
; CHECK-NEXT: ret void
;
entry:
%b = alloca %struct.big, align 4
%tmp = alloca %struct.big, align 4
- call void @f1(%struct.big* sret(%struct.big) %tmp)
- %0 = bitcast %struct.big* %b to i8*
- %1 = bitcast %struct.big* %tmp to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %0, i8* align 4 %1, i64 200, i1 false)
- call void @f2(%struct.big* %b)
+ call void @f1(ptr sret(%struct.big) %tmp)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %b, ptr align 4 %tmp, i64 200, i1 false)
+ call void @f2(ptr %b)
ret void
}
@@ -379,41 +344,36 @@ entry:
; opaque type of *x, where the x is the formal argument with attribute 'sret'.
%opaque = type opaque
-declare void @foo(i32* noalias nocapture)
+declare void @foo(ptr noalias nocapture)
-define void @test10(%opaque* noalias nocapture sret(%opaque) %x, i32 %y) {
+define void @test10(ptr noalias nocapture sret(%opaque) %x, i32 %y) {
; CHECK-LABEL: @test10(
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
-; CHECK-NEXT: store i32 [[Y:%.*]], i32* [[A]], align 4
-; CHECK-NEXT: call void @foo(i32* noalias nocapture [[A]])
-; CHECK-NEXT: [[C:%.*]] = load i32, i32* [[A]], align 4
-; CHECK-NEXT: [[D:%.*]] = bitcast %opaque* [[X:%.*]] to i32*
-; CHECK-NEXT: store i32 [[C]], i32* [[D]], align 4
+; CHECK-NEXT: store i32 [[Y:%.*]], ptr [[A]], align 4
+; CHECK-NEXT: call void @foo(ptr noalias nocapture [[A]])
+; CHECK-NEXT: [[C:%.*]] = load i32, ptr [[A]], align 4
+; CHECK-NEXT: store i32 [[C]], ptr [[X:%.*]], align 4
; CHECK-NEXT: ret void
;
%a = alloca i32, align 4
- store i32 %y, i32* %a
- call void @foo(i32* noalias nocapture %a)
- %c = load i32, i32* %a
- %d = bitcast %opaque* %x to i32*
- store i32 %c, i32* %d
+ store i32 %y, ptr %a
+ call void @foo(ptr noalias nocapture %a)
+ %c = load i32, ptr %a
+ store i32 %c, ptr %x
ret void
}
; don't create new addressspacecasts when we don't know they're safe for the target
-define void @test11([20 x i32] addrspace(1)* nocapture dereferenceable(80) %P) {
+define void @test11(ptr addrspace(1) nocapture dereferenceable(80) %P) {
; CHECK-LABEL: @test11(
-; CHECK-NEXT: [[B:%.*]] = bitcast [20 x i32] addrspace(1)* [[P:%.*]] to i8 addrspace(1)*
-; CHECK-NEXT: call void @llvm.memset.p1i8.i64(i8 addrspace(1)* align 4 [[B]], i8 0, i64 80, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p1.i64(ptr addrspace(1) align 4 [[P:%.*]], i8 0, i64 80, i1 false)
; CHECK-NEXT: ret void
;
%A = alloca [20 x i32], align 4
- %a = bitcast [20 x i32]* %A to i8*
- %b = bitcast [20 x i32] addrspace(1)* %P to i8 addrspace(1)*
- call void @llvm.memset.p0i8.i64(i8* align 4 %a, i8 0, i64 80, i1 false)
- call void @llvm.memcpy.p1i8.p0i8.i64(i8 addrspace(1)* align 4 %b, i8* align 4 %a, i64 80, i1 false)
+ call void @llvm.memset.p0.i64(ptr align 4 %A, i8 0, i64 80, i1 false)
+ call void @llvm.memcpy.p1.p0.i64(ptr addrspace(1) align 4 %P, ptr align 4 %A, i64 80, i1 false)
ret void
}
-declare void @f1(%struct.big* nocapture sret(%struct.big))
-declare void @f2(%struct.big*)
+declare void @f1(ptr nocapture sret(%struct.big))
+declare void @f2(ptr)
diff --git a/llvm/test/Transforms/MemCpyOpt/memmove.ll b/llvm/test/Transforms/MemCpyOpt/memmove.ll
index 003494591fce..7c61c4aa5a59 100644
--- a/llvm/test/Transforms/MemCpyOpt/memmove.ll
+++ b/llvm/test/Transforms/MemCpyOpt/memmove.ll
@@ -7,62 +7,56 @@ target triple = "x86_64-apple-darwin9.0"
@C = external constant [0 x i8]
-declare void @llvm.memmove.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind
+declare void @llvm.memmove.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind
-define i8* @test1(i8* nocapture %src) nounwind {
+define ptr @test1(ptr nocapture %src) nounwind {
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[MALLOCCALL:%.*]] = tail call i8* @malloc(i32 trunc (i64 mul nuw (i64 ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64), i64 13) to i32))
-; CHECK-NEXT: [[CALL3:%.*]] = bitcast i8* [[MALLOCCALL]] to [13 x i8]*
-; CHECK-NEXT: [[CALL3_SUB:%.*]] = getelementptr inbounds [13 x i8], [13 x i8]* [[CALL3]], i64 0, i64 0
-; CHECK-NEXT: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[CALL3_SUB]], i8* [[SRC:%.*]], i64 13, i1 false)
-; CHECK-NEXT: ret i8* [[CALL3_SUB]]
+; CHECK-NEXT: [[MALLOCCALL:%.*]] = tail call ptr @malloc(i32 trunc (i64 mul nuw (i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), i64 13) to i32))
+; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr [[MALLOCCALL]], ptr [[SRC:%.*]], i64 13, i1 false)
+; CHECK-NEXT: ret ptr [[MALLOCCALL]]
;
entry:
- %malloccall = tail call i8* @malloc(i32 trunc (i64 mul nuw (i64 ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64), i64 13) to i32))
- %call3 = bitcast i8* %malloccall to [13 x i8]*
- %call3.sub = getelementptr inbounds [13 x i8], [13 x i8]* %call3, i64 0, i64 0
- tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %call3.sub, i8* %src, i64 13, i1 false)
- ret i8* %call3.sub
+ %malloccall = tail call ptr @malloc(i32 trunc (i64 mul nuw (i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), i64 13) to i32))
+ tail call void @llvm.memmove.p0.p0.i64(ptr %malloccall, ptr %src, i64 13, i1 false)
+ ret ptr %malloccall
}
-declare noalias i8* @malloc(i32)
+declare noalias ptr @malloc(i32)
-define void @test2(i8* %P) nounwind {
+define void @test2(ptr %P) nounwind {
; CHECK-LABEL: @test2(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr i8, i8* [[P:%.*]], i64 16
-; CHECK-NEXT: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[P]], i8* [[ADD_PTR]], i64 16, i1 false)
+; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr i8, ptr [[P:%.*]], i64 16
+; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr [[P]], ptr [[ADD_PTR]], i64 16, i1 false)
; CHECK-NEXT: ret void
;
entry:
- %add.ptr = getelementptr i8, i8* %P, i64 16
- tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %P, i8* %add.ptr, i64 16, i1 false)
+ %add.ptr = getelementptr i8, ptr %P, i64 16
+ tail call void @llvm.memmove.p0.p0.i64(ptr %P, ptr %add.ptr, i64 16, i1 false)
ret void
}
; This cannot be optimize because the src/dst really do overlap.
-define void @test3(i8* %P) nounwind {
+define void @test3(ptr %P) nounwind {
; CHECK-LABEL: @test3(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr i8, i8* [[P:%.*]], i64 16
-; CHECK-NEXT: tail call void @llvm.memmove.p0i8.p0i8.i64(i8* [[P]], i8* [[ADD_PTR]], i64 17, i1 false)
+; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr i8, ptr [[P:%.*]], i64 16
+; CHECK-NEXT: tail call void @llvm.memmove.p0.p0.i64(ptr [[P]], ptr [[ADD_PTR]], i64 17, i1 false)
; CHECK-NEXT: ret void
;
entry:
- %add.ptr = getelementptr i8, i8* %P, i64 16
- tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %P, i8* %add.ptr, i64 17, i1 false)
+ %add.ptr = getelementptr i8, ptr %P, i64 16
+ tail call void @llvm.memmove.p0.p0.i64(ptr %P, ptr %add.ptr, i64 17, i1 false)
ret void
}
-define void @test4(i8* %P) nounwind {
+define void @test4(ptr %P) nounwind {
; CHECK-LABEL: @test4(
-; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds [0 x i8], [0 x i8]* @C, i64 0, i64 0
-; CHECK-NEXT: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[P:%.*]], i8* [[ADD_PTR]], i64 17, i1 false)
+; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr [[P:%.*]], ptr @C, i64 17, i1 false)
; CHECK-NEXT: ret void
;
- %add.ptr = getelementptr inbounds [0 x i8], [0 x i8]* @C, i64 0, i64 0
- tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %P, i8* %add.ptr, i64 17, i1 false)
+ tail call void @llvm.memmove.p0.p0.i64(ptr %P, ptr @C, i64 17, i1 false)
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/memset-memcpy-oversized.ll b/llvm/test/Transforms/MemCpyOpt/memset-memcpy-oversized.ll
index ab85e4de5c56..6bc824a148dd 100644
--- a/llvm/test/Transforms/MemCpyOpt/memset-memcpy-oversized.ll
+++ b/llvm/test/Transforms/MemCpyOpt/memset-memcpy-oversized.ll
@@ -7,207 +7,191 @@
%T = type { i64, i32, i32 }
-define void @test_alloca(i8* %result) {
+define void @test_alloca(ptr %result) {
; CHECK-LABEL: @test_alloca(
; CHECK-NEXT: [[A:%.*]] = alloca [[T:%.*]], align 8
-; CHECK-NEXT: [[B:%.*]] = bitcast %T* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[B]], i8 0, i64 12, i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[RESULT:%.*]], i8 0, i64 12, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[A]], i8 0, i64 12, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[RESULT:%.*]], i8 0, i64 12, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca %T, align 8
- %b = bitcast %T* %a to i8*
- call void @llvm.memset.p0i8.i64(i8* align 8 %b, i8 0, i64 12, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %result, i8* align 8 %b, i64 16, i1 false)
+ call void @llvm.memset.p0.i64(ptr align 8 %a, i8 0, i64 12, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %result, ptr align 8 %a, i64 16, i1 false)
ret void
}
-define void @test_alloca_with_lifetimes(i8* %result) {
+define void @test_alloca_with_lifetimes(ptr %result) {
; CHECK-LABEL: @test_alloca_with_lifetimes(
; CHECK-NEXT: [[A:%.*]] = alloca [[T:%.*]], align 8
-; CHECK-NEXT: [[B:%.*]] = bitcast %T* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 16, i8* [[B]])
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[B]], i8 0, i64 12, i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[RESULT:%.*]], i8 0, i64 12, i1 false)
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 16, i8* [[B]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr [[A]])
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[A]], i8 0, i64 12, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[RESULT:%.*]], i8 0, i64 12, i1 false)
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr [[A]])
; CHECK-NEXT: ret void
;
%a = alloca %T, align 8
- %b = bitcast %T* %a to i8*
- call void @llvm.lifetime.start.p0i8(i64 16, i8* %b)
- call void @llvm.memset.p0i8.i64(i8* align 8 %b, i8 0, i64 12, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %result, i8* align 8 %b, i64 16, i1 false)
- call void @llvm.lifetime.end.p0i8(i64 16, i8* %b)
+ call void @llvm.lifetime.start.p0(i64 16, ptr %a)
+ call void @llvm.memset.p0.i64(ptr align 8 %a, i8 0, i64 12, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %result, ptr align 8 %a, i64 16, i1 false)
+ call void @llvm.lifetime.end.p0(i64 16, ptr %a)
ret void
}
-define void @test_malloc_with_lifetimes(i8* %result) {
+define void @test_malloc_with_lifetimes(ptr %result) {
; CHECK-LABEL: @test_malloc_with_lifetimes(
-; CHECK-NEXT: [[A:%.*]] = call i8* @malloc(i64 16)
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 16, i8* [[A]])
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[A]], i8 0, i64 12, i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[RESULT:%.*]], i8 0, i64 12, i1 false)
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 16, i8* [[A]])
-; CHECK-NEXT: call void @free(i8* [[A]])
+; CHECK-NEXT: [[A:%.*]] = call ptr @malloc(i64 16)
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr [[A]])
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[A]], i8 0, i64 12, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[RESULT:%.*]], i8 0, i64 12, i1 false)
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr [[A]])
+; CHECK-NEXT: call void @free(ptr [[A]])
; CHECK-NEXT: ret void
;
- %a = call i8* @malloc(i64 16)
- call void @llvm.lifetime.start.p0i8(i64 16, i8* %a)
- call void @llvm.memset.p0i8.i64(i8* align 8 %a, i8 0, i64 12, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %result, i8* align 8 %a, i64 16, i1 false)
- call void @llvm.lifetime.end.p0i8(i64 16, i8* %a)
- call void @free(i8* %a)
+ %a = call ptr @malloc(i64 16)
+ call void @llvm.lifetime.start.p0(i64 16, ptr %a)
+ call void @llvm.memset.p0.i64(ptr align 8 %a, i8 0, i64 12, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %result, ptr align 8 %a, i64 16, i1 false)
+ call void @llvm.lifetime.end.p0(i64 16, ptr %a)
+ call void @free(ptr %a)
ret void
}
; memcpy size is larger than lifetime, don't optimize.
-define void @test_copy_larger_than_lifetime_size(i8* %result) {
+define void @test_copy_larger_than_lifetime_size(ptr %result) {
; CHECK-LABEL: @test_copy_larger_than_lifetime_size(
-; CHECK-NEXT: [[A:%.*]] = call i8* @malloc(i64 16)
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 12, i8* [[A]])
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[A]], i8 0, i64 12, i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[RESULT:%.*]], i8* align 8 [[A]], i64 16, i1 false)
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 12, i8* [[A]])
-; CHECK-NEXT: call void @free(i8* [[A]])
+; CHECK-NEXT: [[A:%.*]] = call ptr @malloc(i64 16)
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 12, ptr [[A]])
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[A]], i8 0, i64 12, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[RESULT:%.*]], ptr align 8 [[A]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 12, ptr [[A]])
+; CHECK-NEXT: call void @free(ptr [[A]])
; CHECK-NEXT: ret void
;
- %a = call i8* @malloc(i64 16)
- call void @llvm.lifetime.start.p0i8(i64 12, i8* %a)
- call void @llvm.memset.p0i8.i64(i8* align 8 %a, i8 0, i64 12, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %result, i8* align 8 %a, i64 16, i1 false)
- call void @llvm.lifetime.end.p0i8(i64 12, i8* %a)
- call void @free(i8* %a)
+ %a = call ptr @malloc(i64 16)
+ call void @llvm.lifetime.start.p0(i64 12, ptr %a)
+ call void @llvm.memset.p0.i64(ptr align 8 %a, i8 0, i64 12, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %result, ptr align 8 %a, i64 16, i1 false)
+ call void @llvm.lifetime.end.p0(i64 12, ptr %a)
+ call void @free(ptr %a)
ret void
}
; The trailing bytes are not known to be undef, we can't ignore them.
-define void @test_not_undef_memory(i8* %result, i8* %input) {
+define void @test_not_undef_memory(ptr %result, ptr %input) {
; CHECK-LABEL: @test_not_undef_memory(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[INPUT:%.*]], i8 0, i64 12, i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[RESULT:%.*]], i8* align 8 [[INPUT]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[INPUT:%.*]], i8 0, i64 12, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[RESULT:%.*]], ptr align 8 [[INPUT]], i64 16, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* align 8 %input, i8 0, i64 12, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %result, i8* align 8 %input, i64 16, i1 false)
+ call void @llvm.memset.p0.i64(ptr align 8 %input, i8 0, i64 12, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %result, ptr align 8 %input, i64 16, i1 false)
ret void
}
; Memset is volatile, memcpy is not. Can be optimized.
-define void @test_volatile_memset(i8* %result) {
+define void @test_volatile_memset(ptr %result) {
; CHECK-LABEL: @test_volatile_memset(
; CHECK-NEXT: [[A:%.*]] = alloca [[T:%.*]], align 8
-; CHECK-NEXT: [[B:%.*]] = bitcast %T* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[B]], i8 0, i64 12, i1 true)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[RESULT:%.*]], i8 0, i64 12, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[A]], i8 0, i64 12, i1 true)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[RESULT:%.*]], i8 0, i64 12, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca %T, align 8
- %b = bitcast %T* %a to i8*
- call void @llvm.memset.p0i8.i64(i8* align 8 %b, i8 0, i64 12, i1 true)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %result, i8* align 8 %b, i64 16, i1 false)
+ call void @llvm.memset.p0.i64(ptr align 8 %a, i8 0, i64 12, i1 true)
+ call void @llvm.memcpy.p0.p0.i64(ptr %result, ptr align 8 %a, i64 16, i1 false)
ret void
}
; Memcpy is volatile, memset is not. Cannot be optimized.
-define void @test_volatile_memcpy(i8* %result) {
+define void @test_volatile_memcpy(ptr %result) {
; CHECK-LABEL: @test_volatile_memcpy(
; CHECK-NEXT: [[A:%.*]] = alloca [[T:%.*]], align 8
-; CHECK-NEXT: [[B:%.*]] = bitcast %T* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[B]], i8 0, i64 12, i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[RESULT:%.*]], i8* align 8 [[B]], i64 16, i1 true)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[A]], i8 0, i64 12, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[RESULT:%.*]], ptr align 8 [[A]], i64 16, i1 true)
; CHECK-NEXT: ret void
;
%a = alloca %T, align 8
- %b = bitcast %T* %a to i8*
- call void @llvm.memset.p0i8.i64(i8* align 8 %b, i8 0, i64 12, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %result, i8* align 8 %b, i64 16, i1 true)
+ call void @llvm.memset.p0.i64(ptr align 8 %a, i8 0, i64 12, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %result, ptr align 8 %a, i64 16, i1 true)
ret void
}
; Write between memset and memcpy, can't optimize.
-define void @test_write_between(i8* %result) {
+define void @test_write_between(ptr %result) {
; CHECK-LABEL: @test_write_between(
; CHECK-NEXT: [[A:%.*]] = alloca [[T:%.*]], align 8
-; CHECK-NEXT: [[B:%.*]] = bitcast %T* [[A]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[B]], i8 0, i64 12, i1 false)
-; CHECK-NEXT: store i8 -1, i8* [[B]], align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[RESULT:%.*]], i8* align 8 [[B]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[A]], i8 0, i64 12, i1 false)
+; CHECK-NEXT: store i8 -1, ptr [[A]], align 1
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[RESULT:%.*]], ptr align 8 [[A]], i64 16, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca %T, align 8
- %b = bitcast %T* %a to i8*
- call void @llvm.memset.p0i8.i64(i8* align 8 %b, i8 0, i64 12, i1 false)
- store i8 -1, i8* %b
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %result, i8* align 8 %b, i64 16, i1 false)
+ call void @llvm.memset.p0.i64(ptr align 8 %a, i8 0, i64 12, i1 false)
+ store i8 -1, ptr %a
+ call void @llvm.memcpy.p0.p0.i64(ptr %result, ptr align 8 %a, i64 16, i1 false)
ret void
}
; A write prior to the memset, which is part of the memset region.
; We could optimize this, but currently don't, because the used memory location is imprecise.
-define void @test_write_before_memset_in_memset_region(i8* %result) {
+define void @test_write_before_memset_in_memset_region(ptr %result) {
; CHECK-LABEL: @test_write_before_memset_in_memset_region(
; CHECK-NEXT: [[A:%.*]] = alloca [[T:%.*]], align 8
-; CHECK-NEXT: [[B:%.*]] = bitcast %T* [[A]] to i8*
-; CHECK-NEXT: store i8 -1, i8* [[B]], align 1
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[B]], i8 0, i64 8, i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[RESULT:%.*]], i8* align 8 [[B]], i64 16, i1 false)
+; CHECK-NEXT: store i8 -1, ptr [[A]], align 1
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[A]], i8 0, i64 8, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[RESULT:%.*]], ptr align 8 [[A]], i64 16, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca %T, align 8
- %b = bitcast %T* %a to i8*
- store i8 -1, i8* %b
- call void @llvm.memset.p0i8.i64(i8* align 8 %b, i8 0, i64 8, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %result, i8* align 8 %b, i64 16, i1 false)
+ store i8 -1, ptr %a
+ call void @llvm.memset.p0.i64(ptr align 8 %a, i8 0, i64 8, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %result, ptr align 8 %a, i64 16, i1 false)
ret void
}
; A write prior to the memset, which is part of the memcpy (but not memset) region.
; This cannot be optimized.
-define void @test_write_before_memset_in_memcpy_region(i8* %result) {
+define void @test_write_before_memset_in_memcpy_region(ptr %result) {
; CHECK-LABEL: @test_write_before_memset_in_memcpy_region(
; CHECK-NEXT: [[A:%.*]] = alloca [[T:%.*]], align 8
-; CHECK-NEXT: [[B:%.*]] = bitcast %T* [[A]] to i8*
-; CHECK-NEXT: [[C:%.*]] = getelementptr inbounds [[T]], %T* [[A]], i64 0, i32 2
-; CHECK-NEXT: store i32 -1, i32* [[C]], align 4
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[B]], i8 0, i64 8, i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[RESULT:%.*]], i8* align 8 [[B]], i64 16, i1 false)
+; CHECK-NEXT: [[C:%.*]] = getelementptr inbounds [[T]], ptr [[A]], i64 0, i32 2
+; CHECK-NEXT: store i32 -1, ptr [[C]], align 4
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[A]], i8 0, i64 8, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[RESULT:%.*]], ptr align 8 [[A]], i64 16, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca %T, align 8
- %b = bitcast %T* %a to i8*
- %c = getelementptr inbounds %T, %T* %a, i64 0, i32 2
- store i32 -1, i32* %c
- call void @llvm.memset.p0i8.i64(i8* align 8 %b, i8 0, i64 8, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %result, i8* align 8 %b, i64 16, i1 false)
+ %c = getelementptr inbounds %T, ptr %a, i64 0, i32 2
+ store i32 -1, ptr %c
+ call void @llvm.memset.p0.i64(ptr align 8 %a, i8 0, i64 8, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %result, ptr align 8 %a, i64 16, i1 false)
ret void
}
; A write prior to the memset, which is part of both the memset and memcpy regions.
; This cannot be optimized.
-define void @test_write_before_memset_in_both_regions(i8* %result) {
+define void @test_write_before_memset_in_both_regions(ptr %result) {
; CHECK-LABEL: @test_write_before_memset_in_both_regions(
; CHECK-NEXT: [[A:%.*]] = alloca [[T:%.*]], align 8
-; CHECK-NEXT: [[B:%.*]] = bitcast %T* [[A]] to i8*
-; CHECK-NEXT: [[C:%.*]] = getelementptr inbounds [[T]], %T* [[A]], i64 0, i32 1
-; CHECK-NEXT: store i32 -1, i32* [[C]], align 4
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[B]], i8 0, i64 10, i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[RESULT:%.*]], i8* align 8 [[B]], i64 16, i1 false)
+; CHECK-NEXT: [[C:%.*]] = getelementptr inbounds [[T]], ptr [[A]], i64 0, i32 1
+; CHECK-NEXT: store i32 -1, ptr [[C]], align 4
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[A]], i8 0, i64 10, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[RESULT:%.*]], ptr align 8 [[A]], i64 16, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca %T, align 8
- %b = bitcast %T* %a to i8*
- %c = getelementptr inbounds %T, %T* %a, i64 0, i32 1
- store i32 -1, i32* %c
- call void @llvm.memset.p0i8.i64(i8* align 8 %b, i8 0, i64 10, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %result, i8* align 8 %b, i64 16, i1 false)
+ %c = getelementptr inbounds %T, ptr %a, i64 0, i32 1
+ store i32 -1, ptr %c
+ call void @llvm.memset.p0.i64(ptr align 8 %a, i8 0, i64 10, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %result, ptr align 8 %a, i64 16, i1 false)
ret void
}
-declare i8* @malloc(i64)
-declare void @free(i8*)
+declare ptr @malloc(i64)
+declare void @free(ptr)
-declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1)
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1)
+declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1)
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1)
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
diff --git a/llvm/test/Transforms/MemCpyOpt/memset-memcpy-redundant-memset.ll b/llvm/test/Transforms/MemCpyOpt/memset-memcpy-redundant-memset.ll
index e9f11fed01cc..ae9749ba60d5 100644
--- a/llvm/test/Transforms/MemCpyOpt/memset-memcpy-redundant-memset.ll
+++ b/llvm/test/Transforms/MemCpyOpt/memset-memcpy-redundant-memset.ll
@@ -5,349 +5,340 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
@C = external constant [0 x i8]
-define void @test_constant(i64 %src_size, i8* %dst, i64 %dst_size, i8 %c) {
+define void @test_constant(i64 %src_size, ptr %dst, i64 %dst_size, i8 %c) {
; CHECK-LABEL: @test_constant(
-; CHECK-NEXT: [[SRC:%.*]] = getelementptr inbounds [0 x i8], [0 x i8]* @C, i64 0, i64 0
; CHECK-NEXT: [[TMP1:%.*]] = icmp ule i64 [[DST_SIZE:%.*]], [[SRC_SIZE:%.*]]
; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[DST_SIZE]], [[SRC_SIZE]]
; CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP1]], i64 0, i64 [[TMP2]]
-; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, i8* [[DST:%.*]], i64 [[SRC_SIZE]]
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP4]], i8 [[C:%.*]], i64 [[TMP3]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST]], i8* [[SRC]], i64 [[SRC_SIZE]], i1 false)
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, ptr [[DST:%.*]], i64 [[SRC_SIZE]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP4]], i8 [[C:%.*]], i64 [[TMP3]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST]], ptr @C, i64 [[SRC_SIZE]], i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst, i8 %c, i64 %dst_size, i1 false)
- %src = getelementptr inbounds [0 x i8], [0 x i8]* @C, i64 0, i64 0
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %src_size, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst, i8 %c, i64 %dst_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr @C, i64 %src_size, i1 false)
ret void
}
-define void @test(i8* %src, i64 %src_size, i8* noalias %dst, i64 %dst_size, i8 %c) {
+define void @test(ptr %src, i64 %src_size, ptr noalias %dst, i64 %dst_size, i8 %c) {
; CHECK-LABEL: @test(
; CHECK-NEXT: [[TMP1:%.*]] = icmp ule i64 [[DST_SIZE:%.*]], [[SRC_SIZE:%.*]]
; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[DST_SIZE]], [[SRC_SIZE]]
; CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP1]], i64 0, i64 [[TMP2]]
-; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, i8* [[DST:%.*]], i64 [[SRC_SIZE]]
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP4]], i8 [[C:%.*]], i64 [[TMP3]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST]], i8* [[SRC:%.*]], i64 [[SRC_SIZE]], i1 false)
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, ptr [[DST:%.*]], i64 [[SRC_SIZE]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP4]], i8 [[C:%.*]], i64 [[TMP3]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST]], ptr [[SRC:%.*]], i64 [[SRC_SIZE]], i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst, i8 %c, i64 %dst_size, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %src_size, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst, i8 %c, i64 %dst_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %src_size, i1 false)
ret void
}
-define void @test_
diff erent_types_i32_i64(i8* noalias %dst, i8* %src, i32 %dst_size, i64 %src_size, i8 %c) {
+define void @test_
diff erent_types_i32_i64(ptr noalias %dst, ptr %src, i32 %dst_size, i64 %src_size, i8 %c) {
; CHECK-LABEL: @test_
diff erent_types_i32_i64(
; CHECK-NEXT: [[TMP1:%.*]] = zext i32 [[DST_SIZE:%.*]] to i64
; CHECK-NEXT: [[TMP2:%.*]] = icmp ule i64 [[TMP1]], [[SRC_SIZE:%.*]]
; CHECK-NEXT: [[TMP3:%.*]] = sub i64 [[TMP1]], [[SRC_SIZE]]
; CHECK-NEXT: [[TMP4:%.*]] = select i1 [[TMP2]], i64 0, i64 [[TMP3]]
-; CHECK-NEXT: [[TMP5:%.*]] = getelementptr i8, i8* [[DST:%.*]], i64 [[SRC_SIZE]]
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP5]], i8 [[C:%.*]], i64 [[TMP4]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST]], i8* [[SRC:%.*]], i64 [[SRC_SIZE]], i1 false)
+; CHECK-NEXT: [[TMP5:%.*]] = getelementptr i8, ptr [[DST:%.*]], i64 [[SRC_SIZE]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP5]], i8 [[C:%.*]], i64 [[TMP4]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST]], ptr [[SRC:%.*]], i64 [[SRC_SIZE]], i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i32(i8* %dst, i8 %c, i32 %dst_size, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %src_size, i1 false)
+ call void @llvm.memset.p0.i32(ptr %dst, i8 %c, i32 %dst_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %src_size, i1 false)
ret void
}
-define void @test_
diff erent_types_i128_i32(i8* noalias %dst, i8* %src, i128 %dst_size, i32 %src_size, i8 %c) {
+define void @test_
diff erent_types_i128_i32(ptr noalias %dst, ptr %src, i128 %dst_size, i32 %src_size, i8 %c) {
; CHECK-LABEL: @test_
diff erent_types_i128_i32(
; CHECK-NEXT: [[TMP1:%.*]] = zext i32 [[SRC_SIZE:%.*]] to i128
; CHECK-NEXT: [[TMP2:%.*]] = icmp ule i128 [[DST_SIZE:%.*]], [[TMP1]]
; CHECK-NEXT: [[TMP3:%.*]] = sub i128 [[DST_SIZE]], [[TMP1]]
; CHECK-NEXT: [[TMP4:%.*]] = select i1 [[TMP2]], i128 0, i128 [[TMP3]]
-; CHECK-NEXT: [[TMP5:%.*]] = getelementptr i8, i8* [[DST:%.*]], i128 [[TMP1]]
-; CHECK-NEXT: call void @llvm.memset.p0i8.i128(i8* align 1 [[TMP5]], i8 [[C:%.*]], i128 [[TMP4]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[DST]], i8* [[SRC:%.*]], i32 [[SRC_SIZE]], i1 false)
+; CHECK-NEXT: [[TMP5:%.*]] = getelementptr i8, ptr [[DST:%.*]], i128 [[TMP1]]
+; CHECK-NEXT: call void @llvm.memset.p0.i128(ptr align 1 [[TMP5]], i8 [[C:%.*]], i128 [[TMP4]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[DST]], ptr [[SRC:%.*]], i32 [[SRC_SIZE]], i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i128(i8* %dst, i8 %c, i128 %dst_size, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, i32 %src_size, i1 false)
+ call void @llvm.memset.p0.i128(ptr %dst, i8 %c, i128 %dst_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr %dst, ptr %src, i32 %src_size, i1 false)
ret void
}
-define void @test_
diff erent_types_i32_i128(i8* noalias %dst, i8* %src, i32 %dst_size, i128 %src_size, i8 %c) {
+define void @test_
diff erent_types_i32_i128(ptr noalias %dst, ptr %src, i32 %dst_size, i128 %src_size, i8 %c) {
; CHECK-LABEL: @test_
diff erent_types_i32_i128(
; CHECK-NEXT: [[TMP1:%.*]] = zext i32 [[DST_SIZE:%.*]] to i128
; CHECK-NEXT: [[TMP2:%.*]] = icmp ule i128 [[TMP1]], [[SRC_SIZE:%.*]]
; CHECK-NEXT: [[TMP3:%.*]] = sub i128 [[TMP1]], [[SRC_SIZE]]
; CHECK-NEXT: [[TMP4:%.*]] = select i1 [[TMP2]], i128 0, i128 [[TMP3]]
-; CHECK-NEXT: [[TMP5:%.*]] = getelementptr i8, i8* [[DST:%.*]], i128 [[SRC_SIZE]]
-; CHECK-NEXT: call void @llvm.memset.p0i8.i128(i8* align 1 [[TMP5]], i8 [[C:%.*]], i128 [[TMP4]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i128(i8* [[DST]], i8* [[SRC:%.*]], i128 [[SRC_SIZE]], i1 false)
+; CHECK-NEXT: [[TMP5:%.*]] = getelementptr i8, ptr [[DST:%.*]], i128 [[SRC_SIZE]]
+; CHECK-NEXT: call void @llvm.memset.p0.i128(ptr align 1 [[TMP5]], i8 [[C:%.*]], i128 [[TMP4]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i128(ptr [[DST]], ptr [[SRC:%.*]], i128 [[SRC_SIZE]], i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i32(i8* %dst, i8 %c, i32 %dst_size, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i128(i8* %dst, i8* %src, i128 %src_size, i1 false)
+ call void @llvm.memset.p0.i32(ptr %dst, i8 %c, i32 %dst_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i128(ptr %dst, ptr %src, i128 %src_size, i1 false)
ret void
}
-define void @test_
diff erent_types_i64_i32(i8* noalias %dst, i8* %src, i64 %dst_size, i32 %src_size, i8 %c) {
+define void @test_
diff erent_types_i64_i32(ptr noalias %dst, ptr %src, i64 %dst_size, i32 %src_size, i8 %c) {
; CHECK-LABEL: @test_
diff erent_types_i64_i32(
; CHECK-NEXT: [[TMP1:%.*]] = zext i32 [[SRC_SIZE:%.*]] to i64
; CHECK-NEXT: [[TMP2:%.*]] = icmp ule i64 [[DST_SIZE:%.*]], [[TMP1]]
; CHECK-NEXT: [[TMP3:%.*]] = sub i64 [[DST_SIZE]], [[TMP1]]
; CHECK-NEXT: [[TMP4:%.*]] = select i1 [[TMP2]], i64 0, i64 [[TMP3]]
-; CHECK-NEXT: [[TMP5:%.*]] = getelementptr i8, i8* [[DST:%.*]], i64 [[TMP1]]
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP5]], i8 [[C:%.*]], i64 [[TMP4]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[DST]], i8* [[SRC:%.*]], i32 [[SRC_SIZE]], i1 false)
+; CHECK-NEXT: [[TMP5:%.*]] = getelementptr i8, ptr [[DST:%.*]], i64 [[TMP1]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP5]], i8 [[C:%.*]], i64 [[TMP4]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[DST]], ptr [[SRC:%.*]], i32 [[SRC_SIZE]], i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst, i8 %c, i64 %dst_size, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, i32 %src_size, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst, i8 %c, i64 %dst_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr %dst, ptr %src, i32 %src_size, i1 false)
ret void
}
-define void @test_align_same(i8* %src, i8* noalias %dst, i64 %dst_size) {
+define void @test_align_same(ptr %src, ptr noalias %dst, i64 %dst_size) {
; CHECK-LABEL: @test_align_same(
; CHECK-NEXT: [[TMP1:%.*]] = icmp ule i64 [[DST_SIZE:%.*]], 80
; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[DST_SIZE]], 80
; CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP1]], i64 0, i64 [[TMP2]]
-; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, i8* [[DST:%.*]], i64 80
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP4]], i8 0, i64 [[TMP3]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST]], i8* [[SRC:%.*]], i64 80, i1 false)
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, ptr [[DST:%.*]], i64 80
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[TMP4]], i8 0, i64 [[TMP3]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST]], ptr [[SRC:%.*]], i64 80, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* align 8 %dst, i8 0, i64 %dst_size, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 80, i1 false)
+ call void @llvm.memset.p0.i64(ptr align 8 %dst, i8 0, i64 %dst_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 80, i1 false)
ret void
}
-define void @test_align_min(i8* %src, i8* noalias %dst, i64 %dst_size) {
+define void @test_align_min(ptr %src, ptr noalias %dst, i64 %dst_size) {
; CHECK-LABEL: @test_align_min(
; CHECK-NEXT: [[TMP1:%.*]] = icmp ule i64 [[DST_SIZE:%.*]], 36
; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[DST_SIZE]], 36
; CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP1]], i64 0, i64 [[TMP2]]
-; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, i8* [[DST:%.*]], i64 36
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[TMP4]], i8 0, i64 [[TMP3]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST]], i8* [[SRC:%.*]], i64 36, i1 false)
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, ptr [[DST:%.*]], i64 36
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[TMP4]], i8 0, i64 [[TMP3]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST]], ptr [[SRC:%.*]], i64 36, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* align 8 %dst, i8 0, i64 %dst_size, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 36, i1 false)
+ call void @llvm.memset.p0.i64(ptr align 8 %dst, i8 0, i64 %dst_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 36, i1 false)
ret void
}
-define void @test_align_memcpy(i8* %src, i8* noalias %dst, i64 %dst_size) {
+define void @test_align_memcpy(ptr %src, ptr noalias %dst, i64 %dst_size) {
; CHECK-LABEL: @test_align_memcpy(
; CHECK-NEXT: [[TMP1:%.*]] = icmp ule i64 [[DST_SIZE:%.*]], 80
; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[DST_SIZE]], 80
; CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP1]], i64 0, i64 [[TMP2]]
-; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, i8* [[DST:%.*]], i64 80
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP4]], i8 0, i64 [[TMP3]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[DST]], i8* align 8 [[SRC:%.*]], i64 80, i1 false)
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, ptr [[DST:%.*]], i64 80
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[TMP4]], i8 0, i64 [[TMP3]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DST]], ptr align 8 [[SRC:%.*]], i64 80, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst, i8 0, i64 %dst_size, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %src, i64 80, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 %dst_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst, ptr align 8 %src, i64 80, i1 false)
ret void
}
-define void @test_non_i8_dst_type(i8* %src, i64 %src_size, i64* noalias %dst_pi64, i64 %dst_size, i8 %c) {
+define void @test_non_i8_dst_type(ptr %src, i64 %src_size, ptr noalias %dst_pi64, i64 %dst_size, i8 %c) {
; CHECK-LABEL: @test_non_i8_dst_type(
-; CHECK-NEXT: [[DST:%.*]] = bitcast i64* [[DST_PI64:%.*]] to i8*
; CHECK-NEXT: [[TMP1:%.*]] = icmp ule i64 [[DST_SIZE:%.*]], [[SRC_SIZE:%.*]]
; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[DST_SIZE]], [[SRC_SIZE]]
; CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP1]], i64 0, i64 [[TMP2]]
-; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, i8* [[DST]], i64 [[SRC_SIZE]]
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP4]], i8 [[C:%.*]], i64 [[TMP3]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST]], i8* [[SRC:%.*]], i64 [[SRC_SIZE]], i1 false)
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, ptr [[DST_PI64:%.*]], i64 [[SRC_SIZE]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP4]], i8 [[C:%.*]], i64 [[TMP3]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST_PI64:%.*]], ptr [[SRC:%.*]], i64 [[SRC_SIZE]], i1 false)
; CHECK-NEXT: ret void
;
- %dst = bitcast i64* %dst_pi64 to i8*
- call void @llvm.memset.p0i8.i64(i8* %dst, i8 %c, i64 %dst_size, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %src_size, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst_pi64, i8 %c, i64 %dst_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst_pi64, ptr %src, i64 %src_size, i1 false)
ret void
}
-define void @test_
diff erent_dst(i8* noalias %dst2, i8* %src, i64 %src_size, i8* noalias %dst, i64 %dst_size) {
+define void @test_
diff erent_dst(ptr noalias %dst2, ptr %src, i64 %src_size, ptr noalias %dst, i64 %dst_size) {
; CHECK-LABEL: @test_
diff erent_dst(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DST:%.*]], i8 0, i64 [[DST_SIZE:%.*]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST2:%.*]], i8* [[SRC:%.*]], i64 [[SRC_SIZE:%.*]], i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DST:%.*]], i8 0, i64 [[DST_SIZE:%.*]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST2:%.*]], ptr [[SRC:%.*]], i64 [[SRC_SIZE:%.*]], i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst, i8 0, i64 %dst_size, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst2, i8* %src, i64 %src_size, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 %dst_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst2, ptr %src, i64 %src_size, i1 false)
ret void
}
; Make sure we also take into account dependencies on the destination.
-define i8 @test_intermediate_read(i8* noalias %a, i8* %b) #0 {
+define i8 @test_intermediate_read(ptr noalias %a, ptr %b) #0 {
; CHECK-LABEL: @test_intermediate_read(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[A:%.*]], i8 0, i64 64, i1 false)
-; CHECK-NEXT: [[R:%.*]] = load i8, i8* [[A]], align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[A]], i8* [[B:%.*]], i64 24, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[A:%.*]], i8 0, i64 64, i1 false)
+; CHECK-NEXT: [[R:%.*]] = load i8, ptr [[A]], align 1
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[A]], ptr [[B:%.*]], i64 24, i1 false)
; CHECK-NEXT: ret i8 [[R]]
;
- call void @llvm.memset.p0i8.i64(i8* %a, i8 0, i64 64, i1 false)
- %r = load i8, i8* %a
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* %b, i64 24, i1 false)
+ call void @llvm.memset.p0.i64(ptr %a, i8 0, i64 64, i1 false)
+ %r = load i8, ptr %a
+ call void @llvm.memcpy.p0.p0.i64(ptr %a, ptr %b, i64 24, i1 false)
ret i8 %r
}
%struct = type { [8 x i8], [8 x i8] }
-define void @test_intermediate_write(i8* %b) #0 {
+define void @test_intermediate_write(ptr %b) #0 {
; CHECK-LABEL: @test_intermediate_write(
; CHECK-NEXT: [[A:%.*]] = alloca [[STRUCT:%.*]], align 8
-; CHECK-NEXT: [[A0:%.*]] = getelementptr [[STRUCT]], %struct* [[A]], i32 0, i32 0, i32 0
-; CHECK-NEXT: [[A1:%.*]] = getelementptr [[STRUCT]], %struct* [[A]], i32 0, i32 1, i32 0
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[A0]], i8 0, i64 16, i1 false)
-; CHECK-NEXT: store i8 1, i8* [[A1]], align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[A0]], i8* [[B:%.*]], i64 8, i1 false)
+; CHECK-NEXT: [[A1:%.*]] = getelementptr [[STRUCT]], ptr [[A]], i32 0, i32 1, i32 0
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[A]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: store i8 1, ptr [[A1]], align 1
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[A]], ptr [[B:%.*]], i64 8, i1 false)
; CHECK-NEXT: ret void
;
%a = alloca %struct
- %a0 = getelementptr %struct, %struct* %a, i32 0, i32 0, i32 0
- %a1 = getelementptr %struct, %struct* %a, i32 0, i32 1, i32 0
- call void @llvm.memset.p0i8.i64(i8* %a0, i8 0, i64 16, i1 false)
- store i8 1, i8* %a1
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a0, i8* %b, i64 8, i1 false)
+ %a1 = getelementptr %struct, ptr %a, i32 0, i32 1, i32 0
+ call void @llvm.memset.p0.i64(ptr %a, i8 0, i64 16, i1 false)
+ store i8 1, ptr %a1
+ call void @llvm.memcpy.p0.p0.i64(ptr %a, ptr %b, i64 8, i1 false)
ret void
}
-define void @test_throwing_call(i8* %src, i64 %src_size, i8* noalias %dst, i64 %dst_size, i8 %c) {
+define void @test_throwing_call(ptr %src, i64 %src_size, ptr noalias %dst, i64 %dst_size, i8 %c) {
; CHECK-LABEL: @test_throwing_call(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DST:%.*]], i8 [[C:%.*]], i64 [[DST_SIZE:%.*]], i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DST:%.*]], i8 [[C:%.*]], i64 [[DST_SIZE:%.*]], i1 false)
; CHECK-NEXT: call void @call() #[[ATTR2:[0-9]+]]
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST]], i8* [[SRC:%.*]], i64 [[SRC_SIZE:%.*]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST]], ptr [[SRC:%.*]], i64 [[SRC_SIZE:%.*]], i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst, i8 %c, i64 %dst_size, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst, i8 %c, i64 %dst_size, i1 false)
call void @call() readnone
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %src_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %src_size, i1 false)
ret void
}
-define void @test_throwing_call_alloca(i8* %src, i64 %src_size, i64 %dst_size, i8 %c) {
+define void @test_throwing_call_alloca(ptr %src, i64 %src_size, i64 %dst_size, i8 %c) {
; CHECK-LABEL: @test_throwing_call_alloca(
; CHECK-NEXT: [[DST:%.*]] = alloca i8, align 1
; CHECK-NEXT: call void @call() #[[ATTR2]]
; CHECK-NEXT: [[TMP1:%.*]] = icmp ule i64 [[DST_SIZE:%.*]], [[SRC_SIZE:%.*]]
; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[DST_SIZE]], [[SRC_SIZE]]
; CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP1]], i64 0, i64 [[TMP2]]
-; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, i8* [[DST]], i64 [[SRC_SIZE]]
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP4]], i8 [[C:%.*]], i64 [[TMP3]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST]], i8* [[SRC:%.*]], i64 [[SRC_SIZE]], i1 false)
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, ptr [[DST]], i64 [[SRC_SIZE]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP4]], i8 [[C:%.*]], i64 [[TMP3]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST]], ptr [[SRC:%.*]], i64 [[SRC_SIZE]], i1 false)
; CHECK-NEXT: ret void
;
%dst = alloca i8
- call void @llvm.memset.p0i8.i64(i8* %dst, i8 %c, i64 %dst_size, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst, i8 %c, i64 %dst_size, i1 false)
call void @call() readnone
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %src_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %src_size, i1 false)
ret void
}
; %dst and %src in the memcpy may be equal, in which case shorting the memset
; is not legal.
-define void @test_missing_noalias(i8* %src, i64 %src_size, i8* %dst, i64 %dst_size, i8 %c) {
+define void @test_missing_noalias(ptr %src, i64 %src_size, ptr %dst, i64 %dst_size, i8 %c) {
; CHECK-LABEL: @test_missing_noalias(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DST:%.*]], i8 [[C:%.*]], i64 [[DST_SIZE:%.*]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST]], i8* [[SRC:%.*]], i64 [[SRC_SIZE:%.*]], i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DST:%.*]], i8 [[C:%.*]], i64 [[DST_SIZE:%.*]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST]], ptr [[SRC:%.*]], i64 [[SRC_SIZE:%.*]], i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst, i8 %c, i64 %dst_size, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %src_size, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst, i8 %c, i64 %dst_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %src_size, i1 false)
ret void
}
-define void @test_same_const_size(i8* noalias %src, i8* noalias %dst, i8 %c) {
+define void @test_same_const_size(ptr noalias %src, ptr noalias %dst, i8 %c) {
; CHECK-LABEL: @test_same_const_size(
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST:%.*]], i8* [[SRC:%.*]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST:%.*]], ptr [[SRC:%.*]], i64 16, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst, i8 %c, i64 16, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 16, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst, i8 %c, i64 16, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 16, i1 false)
ret void
}
-define void @test_same_dynamic_size(i8* noalias %src, i8* noalias %dst, i64 %size, i8 %c) {
+define void @test_same_dynamic_size(ptr noalias %src, ptr noalias %dst, i64 %size, i8 %c) {
; CHECK-LABEL: @test_same_dynamic_size(
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST:%.*]], i8* [[SRC:%.*]], i64 [[SIZE:%.*]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST:%.*]], ptr [[SRC:%.*]], i64 [[SIZE:%.*]], i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst, i8 %c, i64 %size, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %size, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst, i8 %c, i64 %size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %size, i1 false)
ret void
}
; Destinations must alias, but are not trivially equal.
-define void @test_must_alias_same_size(i8* noalias %src, i8* noalias %dst, i8 %c) {
+define void @test_must_alias_same_size(ptr noalias %src, ptr noalias %dst, i8 %c) {
; CHECK-LABEL: @test_must_alias_same_size(
-; CHECK-NEXT: [[GEP1:%.*]] = getelementptr i8, i8* [[DST:%.*]], i64 16
-; CHECK-NEXT: [[GEP2:%.*]] = getelementptr i8, i8* [[DST]], i64 16
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[GEP2]], i8* [[SRC:%.*]], i64 16, i1 false)
+; CHECK-NEXT: [[GEP1:%.*]] = getelementptr i8, ptr [[DST:%.*]], i64 16
+; CHECK-NEXT: [[GEP2:%.*]] = getelementptr i8, ptr [[DST]], i64 16
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[GEP2]], ptr [[SRC:%.*]], i64 16, i1 false)
; CHECK-NEXT: ret void
;
- %gep1 = getelementptr i8, i8* %dst, i64 16
- call void @llvm.memset.p0i8.i64(i8* %gep1, i8 %c, i64 16, i1 false)
- %gep2 = getelementptr i8, i8* %dst, i64 16
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %gep2, i8* %src, i64 16, i1 false)
+ %gep1 = getelementptr i8, ptr %dst, i64 16
+ call void @llvm.memset.p0.i64(ptr %gep1, i8 %c, i64 16, i1 false)
+ %gep2 = getelementptr i8, ptr %dst, i64 16
+ call void @llvm.memcpy.p0.p0.i64(ptr %gep2, ptr %src, i64 16, i1 false)
ret void
}
-define void @test_must_alias_
diff erent_size(i8* noalias %src, i64 %src_size, i8* noalias %dst, i64 %dst_size, i8 %c) {
+define void @test_must_alias_
diff erent_size(ptr noalias %src, i64 %src_size, ptr noalias %dst, i64 %dst_size, i8 %c) {
; CHECK-LABEL: @test_must_alias_
diff erent_size(
-; CHECK-NEXT: [[GEP1:%.*]] = getelementptr i8, i8* [[DST:%.*]], i64 16
-; CHECK-NEXT: [[GEP2:%.*]] = getelementptr i8, i8* [[DST]], i64 16
+; CHECK-NEXT: [[GEP1:%.*]] = getelementptr i8, ptr [[DST:%.*]], i64 16
+; CHECK-NEXT: [[GEP2:%.*]] = getelementptr i8, ptr [[DST]], i64 16
; CHECK-NEXT: [[TMP1:%.*]] = icmp ule i64 [[DST_SIZE:%.*]], [[SRC_SIZE:%.*]]
; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[DST_SIZE]], [[SRC_SIZE]]
; CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP1]], i64 0, i64 [[TMP2]]
-; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, i8* [[GEP2]], i64 [[SRC_SIZE]]
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP4]], i8 [[C:%.*]], i64 [[TMP3]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[GEP2]], i8* [[SRC:%.*]], i64 [[SRC_SIZE]], i1 false)
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, ptr [[GEP2]], i64 [[SRC_SIZE]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP4]], i8 [[C:%.*]], i64 [[TMP3]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[GEP2]], ptr [[SRC:%.*]], i64 [[SRC_SIZE]], i1 false)
; CHECK-NEXT: ret void
;
- %gep1 = getelementptr i8, i8* %dst, i64 16
- call void @llvm.memset.p0i8.i64(i8* %gep1, i8 %c, i64 %dst_size, i1 false)
- %gep2 = getelementptr i8, i8* %dst, i64 16
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %gep2, i8* %src, i64 %src_size, i1 false)
+ %gep1 = getelementptr i8, ptr %dst, i64 16
+ call void @llvm.memset.p0.i64(ptr %gep1, i8 %c, i64 %dst_size, i1 false)
+ %gep2 = getelementptr i8, ptr %dst, i64 16
+ call void @llvm.memcpy.p0.p0.i64(ptr %gep2, ptr %src, i64 %src_size, i1 false)
ret void
}
-define void @test_weird_element_type(i16* %src, i64 %src_size, i16* noalias %dst, i64 %dst_size, i8 %c) {
+define void @test_weird_element_type(ptr %src, i64 %src_size, ptr noalias %dst, i64 %dst_size, i8 %c) {
; CHECK-LABEL: @test_weird_element_type(
; CHECK-NEXT: [[TMP1:%.*]] = icmp ule i64 [[DST_SIZE:%.*]], [[SRC_SIZE:%.*]]
; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[DST_SIZE]], [[SRC_SIZE]]
; CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP1]], i64 0, i64 [[TMP2]]
-; CHECK-NEXT: [[TMP4:%.*]] = bitcast i16* [[DST:%.*]] to i8*
-; CHECK-NEXT: [[TMP5:%.*]] = getelementptr i8, i8* [[TMP4]], i64 [[SRC_SIZE]]
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP5]], i8 [[C:%.*]], i64 [[TMP3]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i16.p0i16.i64(i16* [[DST]], i16* [[SRC:%.*]], i64 [[SRC_SIZE]], i1 false)
+; CHECK-NEXT: [[TMP5:%.*]] = getelementptr i8, ptr [[DST:%.*]], i64 [[SRC_SIZE]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP5]], i8 [[C:%.*]], i64 [[TMP3]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST]], ptr [[SRC:%.*]], i64 [[SRC_SIZE]], i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i16.i64(i16* %dst, i8 %c, i64 %dst_size, i1 false)
- call void @llvm.memcpy.p0i16.p0i16.i64(i16* %dst, i16* %src, i64 %src_size, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst, i8 %c, i64 %dst_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %src_size, i1 false)
ret void
}
-define void @test_addrspace(i8 addrspace(1)* %src, i64 %src_size, i8 addrspace(1)* noalias %dst, i64 %dst_size, i8 %c) {
+define void @test_addrspace(ptr addrspace(1) %src, i64 %src_size, ptr addrspace(1) noalias %dst, i64 %dst_size, i8 %c) {
; CHECK-LABEL: @test_addrspace(
; CHECK-NEXT: [[TMP1:%.*]] = icmp ule i64 [[DST_SIZE:%.*]], [[SRC_SIZE:%.*]]
; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[DST_SIZE]], [[SRC_SIZE]]
; CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP1]], i64 0, i64 [[TMP2]]
-; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, i8 addrspace(1)* [[DST:%.*]], i64 [[SRC_SIZE]]
-; CHECK-NEXT: call void @llvm.memset.p1i8.i64(i8 addrspace(1)* align 1 [[TMP4]], i8 [[C:%.*]], i64 [[TMP3]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p1i8.p1i8.i64(i8 addrspace(1)* [[DST]], i8 addrspace(1)* [[SRC:%.*]], i64 [[SRC_SIZE]], i1 false)
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i8, ptr addrspace(1) [[DST:%.*]], i64 [[SRC_SIZE]]
+; CHECK-NEXT: call void @llvm.memset.p1.i64(ptr addrspace(1) align 1 [[TMP4]], i8 [[C:%.*]], i64 [[TMP3]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p1.p1.i64(ptr addrspace(1) [[DST]], ptr addrspace(1) [[SRC:%.*]], i64 [[SRC_SIZE]], i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p1i8.i64(i8 addrspace(1)* %dst, i8 %c, i64 %dst_size, i1 false)
- call void @llvm.memcpy.p1i8.p1i8.i64(i8 addrspace(1)* %dst, i8 addrspace(1)* %src, i64 %src_size, i1 false)
+ call void @llvm.memset.p1.i64(ptr addrspace(1) %dst, i8 %c, i64 %dst_size, i1 false)
+ call void @llvm.memcpy.p1.p1.i64(ptr addrspace(1) %dst, ptr addrspace(1) %src, i64 %src_size, i1 false)
ret void
}
-declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1)
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1)
-declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i1)
-declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i1)
-declare void @llvm.memset.p0i8.i128(i8* nocapture, i8, i128, i1)
-declare void @llvm.memcpy.p0i8.p0i8.i128(i8* nocapture, i8* nocapture readonly, i128, i1)
-declare void @llvm.memset.p0i16.i64(i16* nocapture, i8, i64, i1)
-declare void @llvm.memcpy.p0i16.p0i16.i64(i16* nocapture, i16* nocapture readonly, i64, i1)
-declare void @llvm.memset.p1i8.i64(i8 addrspace(1)* nocapture, i8, i64, i1)
-declare void @llvm.memcpy.p1i8.p1i8.i64(i8 addrspace(1)* nocapture, i8 addrspace(1)* nocapture readonly, i64, i1)
+declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1)
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1)
+declare void @llvm.memset.p0.i32(ptr nocapture, i8, i32, i1)
+declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture readonly, i32, i1)
+declare void @llvm.memset.p0.i128(ptr nocapture, i8, i128, i1)
+declare void @llvm.memcpy.p0.p0.i128(ptr nocapture, ptr nocapture readonly, i128, i1)
+declare void @llvm.memset.p1.i64(ptr addrspace(1) nocapture, i8, i64, i1)
+declare void @llvm.memcpy.p1.p1.i64(ptr addrspace(1) nocapture, ptr addrspace(1) nocapture readonly, i64, i1)
declare void @call()
diff --git a/llvm/test/Transforms/MemCpyOpt/memset-memcpy-to-2x-memset.ll b/llvm/test/Transforms/MemCpyOpt/memset-memcpy-to-2x-memset.ll
index e6e74926c3e2..6131d4188ea3 100644
--- a/llvm/test/Transforms/MemCpyOpt/memset-memcpy-to-2x-memset.ll
+++ b/llvm/test/Transforms/MemCpyOpt/memset-memcpy-to-2x-memset.ll
@@ -3,109 +3,109 @@
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-define void @test(i8* %dst1, i8* %dst2, i8 %c) {
+define void @test(ptr %dst1, ptr %dst2, i8 %c) {
; CHECK-LABEL: @test(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DST1:%.*]], i8 [[C:%.*]], i64 128, i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[DST2:%.*]], i8 [[C]], i64 128, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DST1:%.*]], i8 [[C:%.*]], i64 128, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[DST2:%.*]], i8 [[C]], i64 128, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst1, i8 %c, i64 128, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst2, i8* align 8 %dst1, i64 128, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst1, i8 %c, i64 128, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst2, ptr align 8 %dst1, i64 128, i1 false)
ret void
}
-define void @test_smaller_memcpy(i8* %dst1, i8* %dst2, i8 %c) {
+define void @test_smaller_memcpy(ptr %dst1, ptr %dst2, i8 %c) {
; CHECK-LABEL: @test_smaller_memcpy(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DST1:%.*]], i8 [[C:%.*]], i64 128, i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DST2:%.*]], i8 [[C]], i64 100, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DST1:%.*]], i8 [[C:%.*]], i64 128, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DST2:%.*]], i8 [[C]], i64 100, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst1, i8 %c, i64 128, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst2, i8* %dst1, i64 100, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst1, i8 %c, i64 128, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst2, ptr %dst1, i64 100, i1 false)
ret void
}
-define void @test_smaller_memset(i8* %dst1, i8* %dst2, i8 %c) {
+define void @test_smaller_memset(ptr %dst1, ptr %dst2, i8 %c) {
; CHECK-LABEL: @test_smaller_memset(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DST1:%.*]], i8 [[C:%.*]], i64 100, i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST2:%.*]], i8* [[DST1]], i64 128, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DST1:%.*]], i8 [[C:%.*]], i64 100, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST2:%.*]], ptr [[DST1]], i64 128, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst1, i8 %c, i64 100, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst2, i8* %dst1, i64 128, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst1, i8 %c, i64 100, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst2, ptr %dst1, i64 128, i1 false)
ret void
}
-define void @test_align_memset(i8* %dst1, i8* %dst2, i8 %c) {
+define void @test_align_memset(ptr %dst1, ptr %dst2, i8 %c) {
; CHECK-LABEL: @test_align_memset(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[DST1:%.*]], i8 [[C:%.*]], i64 128, i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DST2:%.*]], i8 [[C]], i64 128, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[DST1:%.*]], i8 [[C:%.*]], i64 128, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DST2:%.*]], i8 [[C]], i64 128, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* align 8 %dst1, i8 %c, i64 128, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst2, i8* %dst1, i64 128, i1 false)
+ call void @llvm.memset.p0.i64(ptr align 8 %dst1, i8 %c, i64 128, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst2, ptr %dst1, i64 128, i1 false)
ret void
}
-define void @test_
diff erent_types(i8* %dst1, i8* %dst2, i8 %c) {
+define void @test_
diff erent_types(ptr %dst1, ptr %dst2, i8 %c) {
; CHECK-LABEL: @test_
diff erent_types(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[DST1:%.*]], i8 [[C:%.*]], i64 128, i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* [[DST2:%.*]], i8 [[C]], i32 100, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[DST1:%.*]], i8 [[C:%.*]], i64 128, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i32(ptr [[DST2:%.*]], i8 [[C]], i32 100, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* align 8 %dst1, i8 %c, i64 128, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst2, i8* %dst1, i32 100, i1 false)
+ call void @llvm.memset.p0.i64(ptr align 8 %dst1, i8 %c, i64 128, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr %dst2, ptr %dst1, i32 100, i1 false)
ret void
}
-define void @test_
diff erent_types_2(i8* %dst1, i8* %dst2, i8 %c) {
+define void @test_
diff erent_types_2(ptr %dst1, ptr %dst2, i8 %c) {
; CHECK-LABEL: @test_
diff erent_types_2(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* align 8 [[DST1:%.*]], i8 [[C:%.*]], i32 128, i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DST2:%.*]], i8 [[C]], i64 100, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i32(ptr align 8 [[DST1:%.*]], i8 [[C:%.*]], i32 128, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DST2:%.*]], i8 [[C]], i64 100, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i32(i8* align 8 %dst1, i8 %c, i32 128, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst2, i8* %dst1, i64 100, i1 false)
+ call void @llvm.memset.p0.i32(ptr align 8 %dst1, i8 %c, i32 128, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst2, ptr %dst1, i64 100, i1 false)
ret void
}
-define void @test_
diff erent_source_gep(i8* %dst1, i8* %dst2, i8 %c) {
+define void @test_
diff erent_source_gep(ptr %dst1, ptr %dst2, i8 %c) {
; CHECK-LABEL: @test_
diff erent_source_gep(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DST1:%.*]], i8 [[C:%.*]], i64 128, i1 false)
-; CHECK-NEXT: [[P:%.*]] = getelementptr i8, i8* [[DST1]], i64 64
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST2:%.*]], i8* [[P]], i64 64, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DST1:%.*]], i8 [[C:%.*]], i64 128, i1 false)
+; CHECK-NEXT: [[P:%.*]] = getelementptr i8, ptr [[DST1]], i64 64
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST2:%.*]], ptr [[P]], i64 64, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst1, i8 %c, i64 128, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst1, i8 %c, i64 128, i1 false)
; FIXME: We could optimize this as well.
- %p = getelementptr i8, i8* %dst1, i64 64
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst2, i8* %p, i64 64, i1 false)
+ %p = getelementptr i8, ptr %dst1, i64 64
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst2, ptr %p, i64 64, i1 false)
ret void
}
-define void @test_variable_size_1(i8* %dst1, i64 %dst1_size, i8* %dst2, i8 %c) {
+define void @test_variable_size_1(ptr %dst1, i64 %dst1_size, ptr %dst2, i8 %c) {
; CHECK-LABEL: @test_variable_size_1(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DST1:%.*]], i8 [[C:%.*]], i64 [[DST1_SIZE:%.*]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST2:%.*]], i8* [[DST1]], i64 128, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DST1:%.*]], i8 [[C:%.*]], i64 [[DST1_SIZE:%.*]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST2:%.*]], ptr [[DST1]], i64 128, i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst1, i8 %c, i64 %dst1_size, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst2, i8* %dst1, i64 128, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst1, i8 %c, i64 %dst1_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst2, ptr %dst1, i64 128, i1 false)
ret void
}
-define void @test_variable_size_2(i8* %dst1, i8* %dst2, i64 %dst2_size, i8 %c) {
+define void @test_variable_size_2(ptr %dst1, ptr %dst2, i64 %dst2_size, i8 %c) {
; CHECK-LABEL: @test_variable_size_2(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[DST1:%.*]], i8 [[C:%.*]], i64 128, i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DST2:%.*]], i8* [[DST1]], i64 [[DST2_SIZE:%.*]], i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[DST1:%.*]], i8 [[C:%.*]], i64 128, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[DST2:%.*]], ptr [[DST1]], i64 [[DST2_SIZE:%.*]], i1 false)
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i64(i8* %dst1, i8 %c, i64 128, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst2, i8* %dst1, i64 %dst2_size, i1 false)
+ call void @llvm.memset.p0.i64(ptr %dst1, i8 %c, i64 128, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %dst2, ptr %dst1, i64 %dst2_size, i1 false)
ret void
}
-declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1)
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1)
-declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i1)
-declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i1)
+declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1)
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1)
+declare void @llvm.memset.p0.i32(ptr nocapture, i8, i32, i1)
+declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture readonly, i32, i1)
diff --git a/llvm/test/Transforms/MemCpyOpt/merge-into-memset.ll b/llvm/test/Transforms/MemCpyOpt/merge-into-memset.ll
index 076dbfed870a..0b40d2d9a8cf 100644
--- a/llvm/test/Transforms/MemCpyOpt/merge-into-memset.ll
+++ b/llvm/test/Transforms/MemCpyOpt/merge-into-memset.ll
@@ -6,37 +6,35 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
; Don't delete the memcpy in %if.then, even though it depends on an instruction
; which will be deleted.
-define void @foo(i1 %c, i8* %d, i8* %e, i8* %f) {
+define void @foo(i1 %c, ptr %d, ptr %e, ptr %f) {
; CHECK-LABEL: @foo(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP:%.*]] = alloca [50 x i8], align 8
-; CHECK-NEXT: [[TMP4:%.*]] = bitcast [50 x i8]* [[TMP]] to i8*
-; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 1
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* nonnull [[D:%.*]], i8 0, i64 10, i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP4]], i8 0, i64 11, i1 false)
+; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[TMP]], i64 1
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr nonnull [[D:%.*]], i8 0, i64 10, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[TMP]], i8 0, i64 11, i1 false)
; CHECK-NEXT: br i1 [[C:%.*]], label [[IF_THEN:%.*]], label [[EXIT:%.*]]
; CHECK: if.then:
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[F:%.*]], i8 0, i64 11, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[F:%.*]], i8 0, i64 11, i1 false)
; CHECK-NEXT: br label [[EXIT]]
; CHECK: exit:
; CHECK-NEXT: ret void
;
entry:
%tmp = alloca [50 x i8], align 8
- %tmp4 = bitcast [50 x i8]* %tmp to i8*
- %tmp1 = getelementptr inbounds i8, i8* %tmp4, i64 1
- call void @llvm.memset.p0i8.i64(i8* nonnull %d, i8 0, i64 10, i1 false)
- store i8 0, i8* %tmp4, align 8
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull %tmp1, i8* nonnull %d, i64 10, i1 false)
+ %tmp1 = getelementptr inbounds i8, ptr %tmp, i64 1
+ call void @llvm.memset.p0.i64(ptr nonnull %d, i8 0, i64 10, i1 false)
+ store i8 0, ptr %tmp, align 8
+ call void @llvm.memcpy.p0.p0.i64(ptr nonnull %tmp1, ptr nonnull %d, i64 10, i1 false)
br i1 %c, label %if.then, label %exit
if.then:
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %f, i8* nonnull align 8 %tmp4, i64 30, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %f, ptr nonnull align 8 %tmp, i64 30, i1 false)
br label %exit
exit:
ret void
}
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i1)
-declare void @llvm.memset.p0i8.i64(i8*, i8, i64, i1)
+declare void @llvm.memcpy.p0.p0.i64(ptr, ptr, i64, i1)
+declare void @llvm.memset.p0.i64(ptr, i8, i64, i1)
diff --git a/llvm/test/Transforms/MemCpyOpt/mixed-sizes.ll b/llvm/test/Transforms/MemCpyOpt/mixed-sizes.ll
index 96a71d26e0e2..a5f6b8a75917 100644
--- a/llvm/test/Transforms/MemCpyOpt/mixed-sizes.ll
+++ b/llvm/test/Transforms/MemCpyOpt/mixed-sizes.ll
@@ -12,42 +12,34 @@ define i32 @foo(i1 %z) {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[A:%.*]] = alloca [10 x i32], align 4
; CHECK-NEXT: [[S:%.*]] = alloca [10 x i32], align 4
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast [10 x i32]* [[A]] to i8*
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast [10 x i32]* [[S]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* nonnull align 16 [[TMP1]], i8 0, i64 40, i1 false)
-; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [10 x i32], [10 x i32]* [[A]], i64 0, i64 0
-; CHECK-NEXT: store i32 1, i32* [[ARRAYIDX]], align 4
-; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr [10 x i32], [10 x i32]* [[S]], i64 0, i64 1
-; CHECK-NEXT: [[SCEVGEP7:%.*]] = bitcast i32* [[SCEVGEP]] to i8*
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr nonnull align 16 [[S]], i8 0, i64 40, i1 false)
+; CHECK-NEXT: store i32 1, ptr [[A]], align 4
+; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr [10 x i32], ptr [[S]], i64 0, i64 1
; CHECK-NEXT: br i1 [[Z:%.*]], label [[FOR_BODY3_LR_PH:%.*]], label [[FOR_INC7_1:%.*]]
; CHECK: for.body3.lr.ph:
; CHECK-NEXT: br label [[FOR_INC7_1]]
; CHECK: for.inc7.1:
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[TMP0]], i8* align 4 [[SCEVGEP7]], i64 4, i1 false)
-; CHECK-NEXT: [[TMP2:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[A]], ptr align 4 [[SCEVGEP]], i64 4, i1 false)
+; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[A]], align 4
; CHECK-NEXT: ret i32 [[TMP2]]
;
entry:
%a = alloca [10 x i32]
%s = alloca [10 x i32]
- %0 = bitcast [10 x i32]* %a to i8*
- %1 = bitcast [10 x i32]* %s to i8*
- call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %1, i8 0, i64 40, i1 false)
- %arrayidx = getelementptr inbounds [10 x i32], [10 x i32]* %a, i64 0, i64 0
- store i32 1, i32* %arrayidx
- %scevgep = getelementptr [10 x i32], [10 x i32]* %s, i64 0, i64 1
- %scevgep7 = bitcast i32* %scevgep to i8*
+ call void @llvm.memset.p0.i64(ptr nonnull align 16 %s, i8 0, i64 40, i1 false)
+ store i32 1, ptr %a
+ %scevgep = getelementptr [10 x i32], ptr %s, i64 0, i64 1
br i1 %z, label %for.body3.lr.ph, label %for.inc7.1
for.body3.lr.ph: ; preds = %entry
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %0, i8* align 4 %scevgep7, i64 17179869180, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a, ptr align 4 %scevgep, i64 17179869180, i1 false)
br label %for.inc7.1
for.inc7.1:
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %0, i8* align 4 %scevgep7, i64 4, i1 false)
- %2 = load i32, i32* %arrayidx
- ret i32 %2
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a, ptr align 4 %scevgep, i64 4, i1 false)
+ %0 = load i32, ptr %a
+ ret i32 %0
}
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i1)
-declare void @llvm.memset.p0i8.i64(i8*, i8, i64, i1)
+declare void @llvm.memcpy.p0.p0.i64(ptr, ptr, i64, i1)
+declare void @llvm.memset.p0.i64(ptr, i8, i64, i1)
diff --git a/llvm/test/Transforms/MemCpyOpt/non-integral.ll b/llvm/test/Transforms/MemCpyOpt/non-integral.ll
index 06f99cfea552..f8eb1cb579dd 100644
--- a/llvm/test/Transforms/MemCpyOpt/non-integral.ll
+++ b/llvm/test/Transforms/MemCpyOpt/non-integral.ll
@@ -3,34 +3,32 @@
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128-ni:1"
-define void @illegal_memset(i64 addrspace(1)** %p) {
+define void @illegal_memset(ptr %p) {
; CHECK-LABEL: @illegal_memset(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[P1:%.*]] = bitcast i64 addrspace(1)** [[P:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[P1]], i8 0, i64 8, i1 false)
-; CHECK-NEXT: [[GEP:%.*]] = getelementptr i64 addrspace(1)*, i64 addrspace(1)** [[P]], i64 1
-; CHECK-NEXT: store i64 addrspace(1)* null, i64 addrspace(1)** [[GEP]], align 8
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[P:%.*]], i8 0, i64 8, i1 false)
+; CHECK-NEXT: [[GEP:%.*]] = getelementptr ptr addrspace(1), ptr [[P]], i64 1
+; CHECK-NEXT: store ptr addrspace(1) null, ptr [[GEP]], align 8
; CHECK-NEXT: ret void
;
entry:
- %p1 = bitcast i64 addrspace(1)** %p to i8*
- call void @llvm.memset.p0i8.i64(i8* %p1, i8 0, i64 8, i32 0, i1 false)
- %gep = getelementptr i64 addrspace(1)*, i64 addrspace(1)** %p, i64 1
- store i64 addrspace(1)* null, i64 addrspace(1)** %gep
+ call void @llvm.memset.p0.i64(ptr %p, i8 0, i64 8, i32 0, i1 false)
+ %gep = getelementptr ptr addrspace(1), ptr %p, i64 1
+ store ptr addrspace(1) null, ptr %gep
ret void
}
-define void @illegal_memcpy(<2 x i8 addrspace(1)*>* noalias align 16 %a,
+define void @illegal_memcpy(ptr noalias align 16 %a,
; CHECK-LABEL: @illegal_memcpy(
-; CHECK-NEXT: [[VAL:%.*]] = load <2 x i8 addrspace(1)*>, <2 x i8 addrspace(1)*>* [[A:%.*]], align 16
-; CHECK-NEXT: store <2 x i8 addrspace(1)*> [[VAL]], <2 x i8 addrspace(1)*>* [[B:%.*]], align 16
+; CHECK-NEXT: [[VAL:%.*]] = load <2 x ptr addrspace(1)>, ptr [[A:%.*]], align 16
+; CHECK-NEXT: store <2 x ptr addrspace(1)> [[VAL]], ptr [[B:%.*]], align 16
; CHECK-NEXT: ret void
;
- <2 x i8 addrspace(1)*>* noalias align 16 %b) {
- %val = load <2 x i8 addrspace(1)*>, <2 x i8 addrspace(1)*>* %a, align 16
- store <2 x i8 addrspace(1)*> %val, <2 x i8 addrspace(1)*>* %b, align 16
+ ptr noalias align 16 %b) {
+ %val = load <2 x ptr addrspace(1)>, ptr %a, align 16
+ store <2 x ptr addrspace(1)> %val, ptr %b, align 16
ret void
}
-declare void @llvm.memset.p1i8.i64(i8 addrspace(1)*, i8, i64, i32, i1)
-declare void @llvm.memset.p0i8.i64(i8*, i8, i64, i32, i1)
+declare void @llvm.memset.p1.i64(ptr addrspace(1), i8, i64, i32, i1)
+declare void @llvm.memset.p0.i64(ptr, i8, i64, i32, i1)
diff --git a/llvm/test/Transforms/MemCpyOpt/nonlocal-memcpy-memcpy.ll b/llvm/test/Transforms/MemCpyOpt/nonlocal-memcpy-memcpy.ll
index 6d4cde348a55..718f511e3245 100644
--- a/llvm/test/Transforms/MemCpyOpt/nonlocal-memcpy-memcpy.ll
+++ b/llvm/test/Transforms/MemCpyOpt/nonlocal-memcpy-memcpy.ll
@@ -9,33 +9,33 @@
@s_foo = private unnamed_addr constant %struct.s { i32 1, i32 2 }, align 4
@s_baz = private unnamed_addr constant %struct.s { i32 1, i32 2 }, align 4
- at i = external constant i8*
+ at i = external constant ptr
declare void @qux()
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1)
-declare void @__cxa_throw(i8*, i8*, i8*)
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1)
+declare void @__cxa_throw(ptr, ptr, ptr)
declare i32 @__gxx_personality_v0(...)
-declare i8* @__cxa_begin_catch(i8*)
+declare ptr @__cxa_begin_catch(ptr)
; A simple partial redundancy. Test that the second memcpy is optimized
; to copy directly from the original source rather than from the temporary.
-define void @wobble(i8* noalias %dst, i8* %src, i1 %some_condition) {
+define void @wobble(ptr noalias %dst, ptr %src, i1 %some_condition) {
; CHECK-LABEL: @wobble(
; CHECK-NEXT: bb:
; CHECK-NEXT: [[TEMP:%.*]] = alloca i8, i32 64, align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[TEMP]], i8* nonnull align 8 [[SRC:%.*]], i64 64, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[TEMP]], ptr nonnull align 8 [[SRC:%.*]], i64 64, i1 false)
; CHECK-NEXT: br i1 [[SOME_CONDITION:%.*]], label [[MORE:%.*]], label [[OUT:%.*]]
; CHECK: out:
; CHECK-NEXT: call void @qux()
; CHECK-NEXT: unreachable
; CHECK: more:
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[DST:%.*]], i8* align 8 [[SRC]], i64 64, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DST:%.*]], ptr align 8 [[SRC]], i64 64, i1 false)
; CHECK-NEXT: ret void
;
bb:
%temp = alloca i8, i32 64
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %temp, i8* nonnull align 8%src, i64 64, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %temp, ptr nonnull align 8%src, i64 64, i1 false)
br i1 %some_condition, label %more, label %out
out:
@@ -43,7 +43,7 @@ out:
unreachable
more:
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %temp, i64 64, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst, ptr align 8 %temp, i64 64, i1 false)
ret void
}
@@ -56,40 +56,32 @@ define i32 @foo(i1 %t3) {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[S:%.*]] = alloca [[STRUCT_S:%.*]], align 4
; CHECK-NEXT: [[T:%.*]] = alloca [[STRUCT_S]], align 4
-; CHECK-NEXT: [[S1:%.*]] = bitcast %struct.s* [[S]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[S1]], i8* align 4 bitcast (%struct.s* @s_foo to i8*), i64 8, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[S]], ptr align 4 @s_foo, i64 8, i1 false)
; CHECK-NEXT: br i1 [[T3:%.*]], label [[BB4:%.*]], label [[BB7:%.*]]
; CHECK: bb4:
-; CHECK-NEXT: [[T5:%.*]] = bitcast %struct.s* [[T]] to i8*
-; CHECK-NEXT: [[S6:%.*]] = bitcast %struct.s* [[S]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[T5]], i8* align 4 bitcast (%struct.s* @s_foo to i8*), i64 8, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[T]], ptr align 4 @s_foo, i64 8, i1 false)
; CHECK-NEXT: br label [[BB7]]
; CHECK: bb7:
-; CHECK-NEXT: [[T8:%.*]] = getelementptr [[STRUCT_S]], %struct.s* [[T]], i32 0, i32 0
-; CHECK-NEXT: [[T9:%.*]] = load i32, i32* [[T8]], align 4
-; CHECK-NEXT: [[T10:%.*]] = getelementptr [[STRUCT_S]], %struct.s* [[T]], i32 0, i32 1
-; CHECK-NEXT: [[T11:%.*]] = load i32, i32* [[T10]], align 4
+; CHECK-NEXT: [[T9:%.*]] = load i32, ptr [[T]], align 4
+; CHECK-NEXT: [[T10:%.*]] = getelementptr [[STRUCT_S]], ptr [[T]], i32 0, i32 1
+; CHECK-NEXT: [[T11:%.*]] = load i32, ptr [[T10]], align 4
; CHECK-NEXT: [[T12:%.*]] = add i32 [[T9]], [[T11]]
; CHECK-NEXT: ret i32 [[T12]]
;
bb:
%s = alloca %struct.s, align 4
%t = alloca %struct.s, align 4
- %s1 = bitcast %struct.s* %s to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %s1, i8* align 4 bitcast (%struct.s* @s_foo to i8*), i64 8, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s, ptr align 4 @s_foo, i64 8, i1 false)
br i1 %t3, label %bb4, label %bb7
bb4: ; preds = %bb
- %t5 = bitcast %struct.s* %t to i8*
- %s6 = bitcast %struct.s* %s to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %t5, i8* align 4 %s6, i64 8, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %t, ptr align 4 %s, i64 8, i1 false)
br label %bb7
bb7: ; preds = %bb4, %bb
- %t8 = getelementptr %struct.s, %struct.s* %t, i32 0, i32 0
- %t9 = load i32, i32* %t8, align 4
- %t10 = getelementptr %struct.s, %struct.s* %t, i32 0, i32 1
- %t11 = load i32, i32* %t10, align 4
+ %t9 = load i32, ptr %t, align 4
+ %t10 = getelementptr %struct.s, ptr %t, i32 0, i32 1
+ %t11 = load i32, ptr %t10, align 4
%t12 = add i32 %t9, %t11
ret i32 %t12
}
@@ -100,34 +92,30 @@ bb7: ; preds = %bb4, %bb
; temporary. This more complex test represents a relatively common usage
; pattern.
-define i32 @baz(i1 %t5) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+define i32 @baz(i1 %t5) personality ptr @__gxx_personality_v0 {
; CHECK-LABEL: @baz(
; CHECK-NEXT: bb:
; CHECK-NEXT: [[S:%.*]] = alloca [[STRUCT_S:%.*]], align 4
; CHECK-NEXT: [[T:%.*]] = alloca [[STRUCT_S]], align 4
-; CHECK-NEXT: [[S3:%.*]] = bitcast %struct.s* [[S]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[S3]], i8* align 4 bitcast (%struct.s* @s_baz to i8*), i64 8, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[S]], ptr align 4 @s_baz, i64 8, i1 false)
; CHECK-NEXT: br i1 [[T5:%.*]], label [[BB6:%.*]], label [[BB22:%.*]]
; CHECK: bb6:
-; CHECK-NEXT: invoke void @__cxa_throw(i8* null, i8* bitcast (i8** @i to i8*), i8* null)
+; CHECK-NEXT: invoke void @__cxa_throw(ptr null, ptr @i, ptr null)
; CHECK-NEXT: to label [[BB25:%.*]] unwind label [[BB9:%.*]]
; CHECK: bb9:
-; CHECK-NEXT: [[T10:%.*]] = landingpad { i8*, i32 }
-; CHECK-NEXT: catch i8* null
+; CHECK-NEXT: [[T10:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: catch ptr null
; CHECK-NEXT: br label [[BB13:%.*]]
; CHECK: bb13:
-; CHECK-NEXT: [[T15:%.*]] = call i8* @__cxa_begin_catch(i8* null)
+; CHECK-NEXT: [[T15:%.*]] = call ptr @__cxa_begin_catch(ptr null)
; CHECK-NEXT: br label [[BB23:%.*]]
; CHECK: bb22:
-; CHECK-NEXT: [[T23:%.*]] = bitcast %struct.s* [[T]] to i8*
-; CHECK-NEXT: [[S24:%.*]] = bitcast %struct.s* [[S]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[T23]], i8* align 4 bitcast (%struct.s* @s_baz to i8*), i64 8, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[T]], ptr align 4 @s_baz, i64 8, i1 false)
; CHECK-NEXT: br label [[BB23]]
; CHECK: bb23:
-; CHECK-NEXT: [[T17:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.s* [[T]], i32 0, i32 0
-; CHECK-NEXT: [[T18:%.*]] = load i32, i32* [[T17]], align 4
-; CHECK-NEXT: [[T19:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.s* [[T]], i32 0, i32 1
-; CHECK-NEXT: [[T20:%.*]] = load i32, i32* [[T19]], align 4
+; CHECK-NEXT: [[T18:%.*]] = load i32, ptr [[T]], align 4
+; CHECK-NEXT: [[T19:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[T]], i32 0, i32 1
+; CHECK-NEXT: [[T20:%.*]] = load i32, ptr [[T19]], align 4
; CHECK-NEXT: [[T21:%.*]] = add nsw i32 [[T18]], [[T20]]
; CHECK-NEXT: ret i32 [[T21]]
; CHECK: bb25:
@@ -136,34 +124,30 @@ define i32 @baz(i1 %t5) personality i8* bitcast (i32 (...)* @__gxx_personality_v
bb:
%s = alloca %struct.s, align 4
%t = alloca %struct.s, align 4
- %s3 = bitcast %struct.s* %s to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %s3, i8* align 4 bitcast (%struct.s* @s_baz to i8*), i64 8, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s, ptr align 4 @s_baz, i64 8, i1 false)
br i1 %t5, label %bb6, label %bb22
bb6: ; preds = %bb
- invoke void @__cxa_throw(i8* null, i8* bitcast (i8** @i to i8*), i8* null)
+ invoke void @__cxa_throw(ptr null, ptr @i, ptr null)
to label %bb25 unwind label %bb9
bb9: ; preds = %bb6
- %t10 = landingpad { i8*, i32 }
- catch i8* null
+ %t10 = landingpad { ptr, i32 }
+ catch ptr null
br label %bb13
bb13: ; preds = %bb9
- %t15 = call i8* @__cxa_begin_catch(i8* null)
+ %t15 = call ptr @__cxa_begin_catch(ptr null)
br label %bb23
bb22: ; preds = %bb
- %t23 = bitcast %struct.s* %t to i8*
- %s24 = bitcast %struct.s* %s to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %t23, i8* align 4 %s24, i64 8, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %t, ptr align 4 %s, i64 8, i1 false)
br label %bb23
bb23: ; preds = %bb22, %bb13
- %t17 = getelementptr inbounds %struct.s, %struct.s* %t, i32 0, i32 0
- %t18 = load i32, i32* %t17, align 4
- %t19 = getelementptr inbounds %struct.s, %struct.s* %t, i32 0, i32 1
- %t20 = load i32, i32* %t19, align 4
+ %t18 = load i32, ptr %t, align 4
+ %t19 = getelementptr inbounds %struct.s, ptr %t, i32 0, i32 1
+ %t20 = load i32, ptr %t19, align 4
%t21 = add nsw i32 %t18, %t20
ret i32 %t21
@@ -171,27 +155,27 @@ bb25: ; preds = %bb6
unreachable
}
-define void @memphi_with_unrelated_clobber(i1 %cond, i64* %arg, i8* noalias %a, i8* noalias %b, i8* noalias %c) {
+define void @memphi_with_unrelated_clobber(i1 %cond, ptr %arg, ptr noalias %a, ptr noalias %b, ptr noalias %c) {
; CHECK-LABEL: @memphi_with_unrelated_clobber(
; CHECK-NEXT: entry:
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[A:%.*]], i8* [[B:%.*]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[A:%.*]], ptr [[B:%.*]], i64 16, i1 false)
; CHECK-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[EXIT:%.*]]
; CHECK: then:
-; CHECK-NEXT: store i64 0, i64* [[ARG:%.*]], align 4
+; CHECK-NEXT: store i64 0, ptr [[ARG:%.*]], align 4
; CHECK-NEXT: br label [[EXIT]]
; CHECK: exit:
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[C:%.*]], i8* [[B]], i64 16, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[C:%.*]], ptr [[B]], i64 16, i1 false)
; CHECK-NEXT: ret void
;
entry:
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* %b, i64 16, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %a, ptr %b, i64 16, i1 false)
br i1 %cond, label %then, label %exit
then:
- store i64 0, i64* %arg
+ store i64 0, ptr %arg
br label %exit
exit:
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %c, i8* %a, i64 16, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr %c, ptr %a, i64 16, i1 false)
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/nontemporal.ll b/llvm/test/Transforms/MemCpyOpt/nontemporal.ll
index e2a8f6c1f33f..7bb7227e932f 100644
--- a/llvm/test/Transforms/MemCpyOpt/nontemporal.ll
+++ b/llvm/test/Transforms/MemCpyOpt/nontemporal.ll
@@ -5,57 +5,57 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
; Verify that we don't combine nontemporal stores into memset calls.
-define void @nontemporal_stores_1(<4 x float>* nocapture %dst) {
+define void @nontemporal_stores_1(ptr nocapture %dst) {
; CHECK-LABEL: @nontemporal_stores_1(
; CHECK-NEXT: entry:
-; CHECK-NEXT: store <4 x float> zeroinitializer, <4 x float>* [[DST:%.*]], align 16, !nontemporal !0
-; CHECK-NEXT: [[PTR1:%.*]] = getelementptr inbounds <4 x float>, <4 x float>* [[DST]], i64 1
-; CHECK-NEXT: store <4 x float> zeroinitializer, <4 x float>* [[PTR1]], align 16, !nontemporal !0
-; CHECK-NEXT: [[PTR2:%.*]] = getelementptr inbounds <4 x float>, <4 x float>* [[DST]], i64 2
-; CHECK-NEXT: store <4 x float> zeroinitializer, <4 x float>* [[PTR2]], align 16, !nontemporal !0
-; CHECK-NEXT: [[PTR3:%.*]] = getelementptr inbounds <4 x float>, <4 x float>* [[DST]], i64 3
-; CHECK-NEXT: store <4 x float> zeroinitializer, <4 x float>* [[PTR3]], align 16, !nontemporal !0
-; CHECK-NEXT: [[PTR4:%.*]] = getelementptr inbounds <4 x float>, <4 x float>* [[DST]], i64 4
-; CHECK-NEXT: store <4 x float> zeroinitializer, <4 x float>* [[PTR4]], align 16, !nontemporal !0
-; CHECK-NEXT: [[PTR5:%.*]] = getelementptr inbounds <4 x float>, <4 x float>* [[DST]], i64 5
-; CHECK-NEXT: store <4 x float> zeroinitializer, <4 x float>* [[PTR5]], align 16, !nontemporal !0
-; CHECK-NEXT: [[PTR6:%.*]] = getelementptr inbounds <4 x float>, <4 x float>* [[DST]], i64 6
-; CHECK-NEXT: store <4 x float> zeroinitializer, <4 x float>* [[PTR6]], align 16, !nontemporal !0
-; CHECK-NEXT: [[PTR7:%.*]] = getelementptr inbounds <4 x float>, <4 x float>* [[DST]], i64 7
-; CHECK-NEXT: store <4 x float> zeroinitializer, <4 x float>* [[PTR7]], align 16, !nontemporal !0
+; CHECK-NEXT: store <4 x float> zeroinitializer, ptr [[DST:%.*]], align 16, !nontemporal !0
+; CHECK-NEXT: [[PTR1:%.*]] = getelementptr inbounds <4 x float>, ptr [[DST]], i64 1
+; CHECK-NEXT: store <4 x float> zeroinitializer, ptr [[PTR1]], align 16, !nontemporal !0
+; CHECK-NEXT: [[PTR2:%.*]] = getelementptr inbounds <4 x float>, ptr [[DST]], i64 2
+; CHECK-NEXT: store <4 x float> zeroinitializer, ptr [[PTR2]], align 16, !nontemporal !0
+; CHECK-NEXT: [[PTR3:%.*]] = getelementptr inbounds <4 x float>, ptr [[DST]], i64 3
+; CHECK-NEXT: store <4 x float> zeroinitializer, ptr [[PTR3]], align 16, !nontemporal !0
+; CHECK-NEXT: [[PTR4:%.*]] = getelementptr inbounds <4 x float>, ptr [[DST]], i64 4
+; CHECK-NEXT: store <4 x float> zeroinitializer, ptr [[PTR4]], align 16, !nontemporal !0
+; CHECK-NEXT: [[PTR5:%.*]] = getelementptr inbounds <4 x float>, ptr [[DST]], i64 5
+; CHECK-NEXT: store <4 x float> zeroinitializer, ptr [[PTR5]], align 16, !nontemporal !0
+; CHECK-NEXT: [[PTR6:%.*]] = getelementptr inbounds <4 x float>, ptr [[DST]], i64 6
+; CHECK-NEXT: store <4 x float> zeroinitializer, ptr [[PTR6]], align 16, !nontemporal !0
+; CHECK-NEXT: [[PTR7:%.*]] = getelementptr inbounds <4 x float>, ptr [[DST]], i64 7
+; CHECK-NEXT: store <4 x float> zeroinitializer, ptr [[PTR7]], align 16, !nontemporal !0
; CHECK-NEXT: ret void
;
entry:
- store <4 x float> zeroinitializer, <4 x float>* %dst, align 16, !nontemporal !0
- %ptr1 = getelementptr inbounds <4 x float>, <4 x float>* %dst, i64 1
- store <4 x float> zeroinitializer, <4 x float>* %ptr1, align 16, !nontemporal !0
- %ptr2 = getelementptr inbounds <4 x float>, <4 x float>* %dst, i64 2
- store <4 x float> zeroinitializer, <4 x float>* %ptr2, align 16, !nontemporal !0
- %ptr3 = getelementptr inbounds <4 x float>, <4 x float>* %dst, i64 3
- store <4 x float> zeroinitializer, <4 x float>* %ptr3, align 16, !nontemporal !0
- %ptr4 = getelementptr inbounds <4 x float>, <4 x float>* %dst, i64 4
- store <4 x float> zeroinitializer, <4 x float>* %ptr4, align 16, !nontemporal !0
- %ptr5 = getelementptr inbounds <4 x float>, <4 x float>* %dst, i64 5
- store <4 x float> zeroinitializer, <4 x float>* %ptr5, align 16, !nontemporal !0
- %ptr6 = getelementptr inbounds <4 x float>, <4 x float>* %dst, i64 6
- store <4 x float> zeroinitializer, <4 x float>* %ptr6, align 16, !nontemporal !0
- %ptr7 = getelementptr inbounds <4 x float>, <4 x float>* %dst, i64 7
- store <4 x float> zeroinitializer, <4 x float>* %ptr7, align 16, !nontemporal !0
+ store <4 x float> zeroinitializer, ptr %dst, align 16, !nontemporal !0
+ %ptr1 = getelementptr inbounds <4 x float>, ptr %dst, i64 1
+ store <4 x float> zeroinitializer, ptr %ptr1, align 16, !nontemporal !0
+ %ptr2 = getelementptr inbounds <4 x float>, ptr %dst, i64 2
+ store <4 x float> zeroinitializer, ptr %ptr2, align 16, !nontemporal !0
+ %ptr3 = getelementptr inbounds <4 x float>, ptr %dst, i64 3
+ store <4 x float> zeroinitializer, ptr %ptr3, align 16, !nontemporal !0
+ %ptr4 = getelementptr inbounds <4 x float>, ptr %dst, i64 4
+ store <4 x float> zeroinitializer, ptr %ptr4, align 16, !nontemporal !0
+ %ptr5 = getelementptr inbounds <4 x float>, ptr %dst, i64 5
+ store <4 x float> zeroinitializer, ptr %ptr5, align 16, !nontemporal !0
+ %ptr6 = getelementptr inbounds <4 x float>, ptr %dst, i64 6
+ store <4 x float> zeroinitializer, ptr %ptr6, align 16, !nontemporal !0
+ %ptr7 = getelementptr inbounds <4 x float>, ptr %dst, i64 7
+ store <4 x float> zeroinitializer, ptr %ptr7, align 16, !nontemporal !0
ret void
}
-define void @nontemporal_stores_2(<4 x float>* nocapture %dst) {
+define void @nontemporal_stores_2(ptr nocapture %dst) {
; CHECK-LABEL: @nontemporal_stores_2(
; CHECK-NEXT: entry:
-; CHECK-NEXT: store <4 x float> zeroinitializer, <4 x float>* [[DST:%.*]], align 16, !nontemporal !0
-; CHECK-NEXT: [[PTR1:%.*]] = getelementptr inbounds <4 x float>, <4 x float>* [[DST]], i64 1
-; CHECK-NEXT: store <4 x float> zeroinitializer, <4 x float>* [[PTR1]], align 16, !nontemporal !0
+; CHECK-NEXT: store <4 x float> zeroinitializer, ptr [[DST:%.*]], align 16, !nontemporal !0
+; CHECK-NEXT: [[PTR1:%.*]] = getelementptr inbounds <4 x float>, ptr [[DST]], i64 1
+; CHECK-NEXT: store <4 x float> zeroinitializer, ptr [[PTR1]], align 16, !nontemporal !0
; CHECK-NEXT: ret void
;
entry:
- store <4 x float> zeroinitializer, <4 x float>* %dst, align 16, !nontemporal !0
- %ptr1 = getelementptr inbounds <4 x float>, <4 x float>* %dst, i64 1
- store <4 x float> zeroinitializer, <4 x float>* %ptr1, align 16, !nontemporal !0
+ store <4 x float> zeroinitializer, ptr %dst, align 16, !nontemporal !0
+ %ptr1 = getelementptr inbounds <4 x float>, ptr %dst, i64 1
+ store <4 x float> zeroinitializer, ptr %ptr1, align 16, !nontemporal !0
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/pr29105.ll b/llvm/test/Transforms/MemCpyOpt/pr29105.ll
index d8070f9c4cd0..dd9f3c34a916 100644
--- a/llvm/test/Transforms/MemCpyOpt/pr29105.ll
+++ b/llvm/test/Transforms/MemCpyOpt/pr29105.ll
@@ -7,42 +7,38 @@ define void @baz() unnamed_addr #0 {
; CHECK-LABEL: @baz(
; CHECK-NEXT: entry-block:
; CHECK-NEXT: [[TMP2:%.*]] = alloca [[FOO:%.*]], align 8
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast %Foo* [[TMP2]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 16384, i8* nonnull [[TMP0]])
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* noundef nonnull align 8 dereferenceable(16384) [[TMP0]], i8 0, i64 16384, i1 false)
-; CHECK-NEXT: call void @bar(%Foo* noalias nocapture nonnull dereferenceable(16384) [[TMP2]])
-; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 16384, i8* nonnull [[TMP0]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 16384, ptr nonnull [[TMP2]])
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16384) [[TMP2]], i8 0, i64 16384, i1 false)
+; CHECK-NEXT: call void @bar(ptr noalias nocapture nonnull dereferenceable(16384) [[TMP2]])
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 16384, ptr nonnull [[TMP2]])
; CHECK-NEXT: ret void
;
entry-block:
%x.sroa.0 = alloca [2048 x i64], align 8
%tmp0 = alloca [2048 x i64], align 8
- %0 = bitcast [2048 x i64]* %tmp0 to i8*
%tmp2 = alloca %Foo, align 8
- %x.sroa.0.0..sroa_cast6 = bitcast [2048 x i64]* %x.sroa.0 to i8*
- call void @llvm.lifetime.start.p0i8(i64 16384, i8* %x.sroa.0.0..sroa_cast6)
- call void @llvm.lifetime.start.p0i8(i64 16384, i8* %0)
- call void @llvm.memset.p0i8.i64(i8* align 8 %0, i8 0, i64 16384, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %x.sroa.0.0..sroa_cast6, i8* align 8 %0, i64 16384, i1 false)
- call void @llvm.lifetime.end.p0i8(i64 16384, i8* %0)
- %1 = bitcast %Foo* %tmp2 to i8*
- call void @llvm.lifetime.start.p0i8(i64 16384, i8* %1)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %1, i8* align 8 %x.sroa.0.0..sroa_cast6, i64 16384, i1 false)
- call void @bar(%Foo* noalias nocapture nonnull dereferenceable(16384) %tmp2)
- call void @llvm.lifetime.end.p0i8(i64 16384, i8* %1)
- call void @llvm.lifetime.end.p0i8(i64 16384, i8* %x.sroa.0.0..sroa_cast6)
+ call void @llvm.lifetime.start.p0(i64 16384, ptr %x.sroa.0)
+ call void @llvm.lifetime.start.p0(i64 16384, ptr %tmp0)
+ call void @llvm.memset.p0.i64(ptr align 8 %tmp0, i8 0, i64 16384, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %x.sroa.0, ptr align 8 %tmp0, i64 16384, i1 false)
+ call void @llvm.lifetime.end.p0(i64 16384, ptr %tmp0)
+ call void @llvm.lifetime.start.p0(i64 16384, ptr %tmp2)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %tmp2, ptr align 8 %x.sroa.0, i64 16384, i1 false)
+ call void @bar(ptr noalias nocapture nonnull dereferenceable(16384) %tmp2)
+ call void @llvm.lifetime.end.p0(i64 16384, ptr %tmp2)
+ call void @llvm.lifetime.end.p0(i64 16384, ptr %x.sroa.0)
ret void
}
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
+declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) #1
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1) #1
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
+declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1
-declare void @bar(%Foo* noalias nocapture readonly dereferenceable(16384)) unnamed_addr #0
+declare void @bar(ptr noalias nocapture readonly dereferenceable(16384)) unnamed_addr #0
-declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1) #1
+declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1) #1
attributes #0 = { uwtable }
attributes #1 = { argmemonly nounwind }
diff --git a/llvm/test/Transforms/MemCpyOpt/pr37967.ll b/llvm/test/Transforms/MemCpyOpt/pr37967.ll
index 0fedd37e1613..ad3c9a88ae8f 100644
--- a/llvm/test/Transforms/MemCpyOpt/pr37967.ll
+++ b/llvm/test/Transforms/MemCpyOpt/pr37967.ll
@@ -5,29 +5,25 @@
%struct.Foo = type { i64, i64, i64 }
- at a = dso_local global %struct.Foo* null, align 8
+ at a = dso_local global ptr null, align 8
-define dso_local void @_Z3bar3Foo(%struct.Foo* byval(%struct.Foo) align 8 %0) {
+define dso_local void @_Z3bar3Foo(ptr byval(%struct.Foo) align 8 %0) {
; CHECK-LABEL: @_Z3bar3Foo(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[AGG_TMP:%.*]] = alloca [[STRUCT_FOO:%.*]], align 8, [[DBG13:!dbg !.*]]
-; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.Foo* [[AGG_TMP]], [[META9:metadata !.*]], metadata !DIExpression()), [[DBG13]]
-; CHECK-NEXT: [[TMP1:%.*]] = load i8*, i8** bitcast (%struct.Foo** @a to i8**), align 8, [[DBG14:!dbg !.*]]
-; CHECK-NEXT: call void @llvm.dbg.value(metadata i8* [[TMP1]], [[META11:metadata !.*]], metadata !DIExpression()), [[DBG14]]
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast %struct.Foo* [[AGG_TMP]] to i8*, [[DBG15:!dbg !.*]]
-; CHECK-NEXT: call void @llvm.dbg.value(metadata i8* [[TMP2]], [[META12:metadata !.*]], metadata !DIExpression()), [[DBG15]]
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8 dereferenceable(24) [[TMP2]], i8* nonnull align 8 dereferenceable(24) [[TMP1]], i64 24, i1 false), [[DBG16:!dbg !.*]]
-; CHECK-NEXT: [[TMPCAST:%.*]] = bitcast i8* [[TMP1]] to %struct.Foo*, [[DBG16]]
-; CHECK-NEXT: call void @_Z3bar3Foo(%struct.Foo* nonnull byval(%struct.Foo) align 8 [[TMPCAST]]), [[DBG17:!dbg !.*]]
-; CHECK-NEXT: ret void, [[DBG18:!dbg !.*]]
+; CHECK-NEXT: [[AGG_TMP:%.*]] = alloca [[STRUCT_FOO:%.*]], align 8, !dbg [[DBG12:![0-9]+]]
+; CHECK-NEXT: call void @llvm.dbg.value(metadata ptr [[AGG_TMP]], metadata [[META9:![0-9]+]], metadata !DIExpression()), !dbg [[DBG12]]
+; CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr @a, align 8, !dbg [[DBG13:![0-9]+]]
+; CHECK-NEXT: call void @llvm.dbg.value(metadata ptr [[TMP1]], metadata [[META11:![0-9]+]], metadata !DIExpression()), !dbg [[DBG13]]
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 dereferenceable(24) [[AGG_TMP]], ptr nonnull align 8 dereferenceable(24) [[TMP1]], i64 24, i1 false), !dbg [[DBG14:![0-9]+]]
+; CHECK-NEXT: call void @_Z3bar3Foo(ptr nonnull byval([[STRUCT_FOO]]) align 8 [[TMP1]]), !dbg [[DBG15:![0-9]+]]
+; CHECK-NEXT: ret void, !dbg [[DBG16:![0-9]+]]
;
entry:
%agg.tmp = alloca %struct.Foo, align 8
- %1 = load i8*, i8** bitcast (%struct.Foo** @a to i8**), align 8
- %2 = bitcast %struct.Foo* %agg.tmp to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8 dereferenceable(24) %2, i8* nonnull align 8 dereferenceable(24) %1, i64 24, i1 false)
- call void @_Z3bar3Foo(%struct.Foo* nonnull byval(%struct.Foo) align 8 %agg.tmp)
+ %1 = load ptr, ptr @a, align 8
+ call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 dereferenceable(24) %agg.tmp, ptr nonnull align 8 dereferenceable(24) %1, i64 24, i1 false)
+ call void @_Z3bar3Foo(ptr nonnull byval(%struct.Foo) align 8 %agg.tmp)
ret void
}
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0
+declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0
diff --git a/llvm/test/Transforms/MemCpyOpt/pr54682.ll b/llvm/test/Transforms/MemCpyOpt/pr54682.ll
index 2f18382636f8..e60a75faa7d9 100644
--- a/llvm/test/Transforms/MemCpyOpt/pr54682.ll
+++ b/llvm/test/Transforms/MemCpyOpt/pr54682.ll
@@ -4,7 +4,7 @@
; The memcpy here is *not* dead, because it reads memory written in a previous
; loop iteration.
-define void @test(i1 %c, i8* nocapture noundef readonly %path, i8* noundef writeonly %name) {
+define void @test(i1 %c, ptr nocapture noundef readonly %path, ptr noundef writeonly %name) {
; CHECK-LABEL: @test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP:%.*]] = alloca [260 x i8], align 16
@@ -12,13 +12,13 @@ define void @test(i1 %c, i8* nocapture noundef readonly %path, i8* noundef write
; CHECK: while.body:
; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[IV_NEXT:%.*]], [[WHILE_BODY]] ], [ 259, [[ENTRY:%.*]] ]
; CHECK-NEXT: [[IV_NEXT]] = add nsw i64 [[IV]], -1
-; CHECK-NEXT: [[TMP_IV:%.*]] = getelementptr inbounds [260 x i8], [260 x i8]* [[TMP]], i64 0, i64 [[IV]]
-; CHECK-NEXT: store i8 42, i8* [[TMP_IV]], align 1
+; CHECK-NEXT: [[TMP_IV:%.*]] = getelementptr inbounds [260 x i8], ptr [[TMP]], i64 0, i64 [[IV]]
+; CHECK-NEXT: store i8 42, ptr [[TMP_IV]], align 1
; CHECK-NEXT: br i1 [[C:%.*]], label [[WHILE_BODY]], label [[EXIT:%.*]]
; CHECK: exit:
-; CHECK-NEXT: [[TMP_IV_1:%.*]] = getelementptr inbounds i8, i8* [[TMP_IV]], i64 1
+; CHECK-NEXT: [[TMP_IV_1:%.*]] = getelementptr inbounds i8, ptr [[TMP_IV]], i64 1
; CHECK-NEXT: [[LEN:%.*]] = sub nsw i64 259, [[IV]]
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 [[NAME:%.*]], i8* nonnull align 1 [[TMP_IV_1]], i64 [[LEN]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 [[NAME:%.*]], ptr nonnull align 1 [[TMP_IV_1]], i64 [[LEN]], i1 false)
; CHECK-NEXT: ret void
;
entry:
@@ -28,15 +28,15 @@ entry:
while.body:
%iv = phi i64 [ %iv.next, %while.body ], [ 259, %entry ]
%iv.next = add nsw i64 %iv, -1
- %tmp.iv = getelementptr inbounds [260 x i8], [260 x i8]* %tmp, i64 0, i64 %iv
- store i8 42, i8* %tmp.iv, align 1
+ %tmp.iv = getelementptr inbounds [260 x i8], ptr %tmp, i64 0, i64 %iv
+ store i8 42, ptr %tmp.iv, align 1
br i1 %c, label %while.body, label %exit
exit:
- %tmp.iv.1 = getelementptr inbounds i8, i8* %tmp.iv, i64 1
+ %tmp.iv.1 = getelementptr inbounds i8, ptr %tmp.iv, i64 1
%len = sub nsw i64 259, %iv
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %name, i8* nonnull align 1 %tmp.iv.1, i64 %len, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 1 %name, ptr nonnull align 1 %tmp.iv.1, i64 %len, i1 false)
ret void
}
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly %0, i8* noalias nocapture readonly %1, i64 %2, i1 immarg %3)
+declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly %0, ptr noalias nocapture readonly %1, i64 %2, i1 immarg %3)
diff --git a/llvm/test/Transforms/MemCpyOpt/preserve-memssa.ll b/llvm/test/Transforms/MemCpyOpt/preserve-memssa.ll
index a4b11078cd7b..b654319b9432 100644
--- a/llvm/test/Transforms/MemCpyOpt/preserve-memssa.ll
+++ b/llvm/test/Transforms/MemCpyOpt/preserve-memssa.ll
@@ -6,172 +6,156 @@
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.15.0"
-%t = type <{ i8*, [4 x i8], i8*, i8*, i32, [8192 x i8] }>
+%t = type <{ ptr, [4 x i8], ptr, ptr, i32, [8192 x i8] }>
-define i32 @test1(%t* %ptr) {
+define i32 @test1(ptr %ptr) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: invoke.cont6:
-; CHECK-NEXT: [[P_1:%.*]] = getelementptr inbounds [[T:%.*]], %t* [[PTR:%.*]], i64 0, i32 0
-; CHECK-NEXT: [[P_1_C:%.*]] = bitcast i8** [[P_1]] to i8*
-; CHECK-NEXT: [[P_2:%.*]] = getelementptr inbounds [[T]], %t* [[PTR]], i64 0, i32 4
-; CHECK-NEXT: [[P_3:%.*]] = getelementptr inbounds [[T]], %t* [[PTR]], i64 0, i32 5, i64 0
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast i8** [[P_1]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP0]], i8 0, i64 20, i1 false)
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32* [[P_2]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP1]], i8 0, i64 8195, i1 false)
+; CHECK-NEXT: [[P_2:%.*]] = getelementptr inbounds [[T:%.*]], ptr [[PTR:%.*]], i64 0, i32 4
+; CHECK-NEXT: [[P_3:%.*]] = getelementptr inbounds [[T]], ptr [[PTR]], i64 0, i32 5, i64 0
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[PTR]], i8 0, i64 20, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[P_2]], i8 0, i64 8195, i1 false)
; CHECK-NEXT: ret i32 0
;
invoke.cont6:
- %p.1 = getelementptr inbounds %t, %t* %ptr, i64 0, i32 0
- %p.1.c = bitcast i8** %p.1 to i8*
- call void @llvm.memset.p0i8.i64(i8* %p.1.c, i8 0, i64 20, i1 false)
- store i8* null, i8** %p.1, align 8
- %p.2 = getelementptr inbounds %t, %t* %ptr, i64 0, i32 4
- store i32 0, i32* %p.2, align 8
- %p.3 = getelementptr inbounds %t, %t* %ptr, i64 0, i32 5, i64 0
- call void @llvm.memset.p0i8.i64(i8* %p.3, i8 0, i64 8191, i1 false)
+ call void @llvm.memset.p0.i64(ptr %ptr, i8 0, i64 20, i1 false)
+ store ptr null, ptr %ptr, align 8
+ %p.2 = getelementptr inbounds %t, ptr %ptr, i64 0, i32 4
+ store i32 0, ptr %p.2, align 8
+ %p.3 = getelementptr inbounds %t, ptr %ptr, i64 0, i32 5, i64 0
+ call void @llvm.memset.p0.i64(ptr %p.3, i8 0, i64 8191, i1 false)
ret i32 0
}
-declare i8* @get_ptr()
+declare ptr @get_ptr()
-define void @test2(i8* noalias %in) {
+define void @test2(ptr noalias %in) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[CALL_I1_I:%.*]] = tail call i8* @get_ptr()
-; CHECK-NEXT: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[CALL_I1_I]], i8* [[IN:%.*]], i64 10, i1 false)
+; CHECK-NEXT: [[CALL_I1_I:%.*]] = tail call ptr @get_ptr()
+; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr [[CALL_I1_I]], ptr [[IN:%.*]], i64 10, i1 false)
; CHECK-NEXT: ret void
;
entry:
- %call.i1.i = tail call i8* @get_ptr()
- tail call void @llvm.memset.p0i8.i64(i8* %call.i1.i, i8 0, i64 10, i1 false)
- tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %call.i1.i, i8* %in, i64 10, i1 false)
+ %call.i1.i = tail call ptr @get_ptr()
+ tail call void @llvm.memset.p0.i64(ptr %call.i1.i, i8 0, i64 10, i1 false)
+ tail call void @llvm.memcpy.p0.p0.i64(ptr %call.i1.i, ptr %in, i64 10, i1 false)
ret void
}
-declare i8* @malloc(i64)
+declare ptr @malloc(i64)
-define i32 @test3(i8* noalias %in) {
+define i32 @test3(ptr noalias %in) {
; CHECK-LABEL: @test3(
-; CHECK-NEXT: [[CALL_I_I_I:%.*]] = tail call i8* @malloc(i64 20)
-; CHECK-NEXT: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[CALL_I_I_I]], i8* [[IN:%.*]], i64 20, i1 false)
+; CHECK-NEXT: [[CALL_I_I_I:%.*]] = tail call ptr @malloc(i64 20)
+; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr [[CALL_I_I_I]], ptr [[IN:%.*]], i64 20, i1 false)
; CHECK-NEXT: ret i32 10
;
- %call.i.i.i = tail call i8* @malloc(i64 20)
- tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %call.i.i.i, i8* %in, i64 20, i1 false)
+ %call.i.i.i = tail call ptr @malloc(i64 20)
+ tail call void @llvm.memmove.p0.p0.i64(ptr %call.i.i.i, ptr %in, i64 20, i1 false)
ret i32 10
}
-define void @test4(i32 %n, i8* noalias %ptr.0, i8* noalias %ptr.1, i32* %ptr.2) unnamed_addr {
+define void @test4(i32 %n, ptr noalias %ptr.0, ptr noalias %ptr.1, ptr %ptr.2) unnamed_addr {
; CHECK-LABEL: @test4(
-; CHECK-NEXT: [[ELEM_I:%.*]] = getelementptr i8, i8* [[PTR_0:%.*]], i64 8
-; CHECK-NEXT: store i32 [[N:%.*]], i32* [[PTR_2:%.*]], align 8
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[ELEM_I]], i8* [[PTR_1:%.*]], i64 10, i1 false)
+; CHECK-NEXT: [[ELEM_I:%.*]] = getelementptr i8, ptr [[PTR_0:%.*]], i64 8
+; CHECK-NEXT: store i32 [[N:%.*]], ptr [[PTR_2:%.*]], align 8
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[ELEM_I]], ptr [[PTR_1:%.*]], i64 10, i1 false)
; CHECK-NEXT: ret void
;
- %elem.i = getelementptr i8, i8* %ptr.0, i64 8
- call void @llvm.memset.p0i8.i64(i8* %elem.i, i8 0, i64 10, i1 false)
- store i32 %n, i32* %ptr.2, align 8
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %elem.i, i8* %ptr.1, i64 10, i1 false)
+ %elem.i = getelementptr i8, ptr %ptr.0, i64 8
+ call void @llvm.memset.p0.i64(ptr %elem.i, i8 0, i64 10, i1 false)
+ store i32 %n, ptr %ptr.2, align 8
+ call void @llvm.memcpy.p0.p0.i64(ptr %elem.i, ptr %ptr.1, i64 10, i1 false)
ret void
}
-declare void @decompose(%t* nocapture)
+declare void @decompose(ptr nocapture)
-define void @test5(i32* %ptr) {
+define void @test5(ptr %ptr) {
; CHECK-LABEL: @test5(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[EARLY_DATA:%.*]] = alloca [128 x i8], align 8
; CHECK-NEXT: [[TMP:%.*]] = alloca [[T:%.*]], align 8
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast [128 x i8]* [[EARLY_DATA]] to i8*
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast %t* [[TMP]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 32, i8* [[TMP0]])
-; CHECK-NEXT: [[TMP2:%.*]] = load i32, i32* [[PTR:%.*]], align 8
-; CHECK-NEXT: call fastcc void @decompose(%t* [[TMP]])
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[TMP0]], i8* [[TMP1]], i64 32, i1 false)
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 32, ptr [[EARLY_DATA]])
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[PTR:%.*]], align 8
+; CHECK-NEXT: call fastcc void @decompose(ptr [[TMP]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[EARLY_DATA]], ptr [[TMP]], i64 32, i1 false)
; CHECK-NEXT: ret void
;
entry:
%early_data = alloca [128 x i8], align 8
%tmp = alloca %t, align 8
- %0 = bitcast [128 x i8]* %early_data to i8*
- %1 = bitcast %t* %tmp to i8*
- call void @llvm.lifetime.start.p0i8(i64 32, i8* %0)
- %2 = load i32, i32* %ptr, align 8
- call fastcc void @decompose(%t* %tmp)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 32, i1 false)
+ call void @llvm.lifetime.start.p0(i64 32, ptr %early_data)
+ %0 = load i32, ptr %ptr, align 8
+ call fastcc void @decompose(ptr %tmp)
+ call void @llvm.memcpy.p0.p0.i64(ptr %early_data, ptr %tmp, i64 32, i1 false)
ret void
}
-define i8 @test6(i8* %ptr, i8* noalias %ptr.1) {
+define i8 @test6(ptr %ptr, ptr noalias %ptr.1) {
; CHECK-LABEL: @test6(
; CHECK-NEXT: entry:
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 24, i8* [[PTR:%.*]])
-; CHECK-NEXT: [[TMP0:%.*]] = load i8, i8* [[PTR]], align 8
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[PTR]], i8* [[PTR_1:%.*]], i64 24, i1 false)
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 24, ptr [[PTR:%.*]])
+; CHECK-NEXT: [[TMP0:%.*]] = load i8, ptr [[PTR]], align 8
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[PTR]], ptr [[PTR_1:%.*]], i64 24, i1 false)
; CHECK-NEXT: ret i8 [[TMP0]]
;
entry:
- call void @llvm.lifetime.start.p0i8(i64 24, i8* %ptr)
- %0 = load i8, i8* %ptr, align 8
- call void @llvm.memmove.p0i8.p0i8.i64(i8* %ptr, i8* %ptr.1, i64 24, i1 false)
+ call void @llvm.lifetime.start.p0(i64 24, ptr %ptr)
+ %0 = load i8, ptr %ptr, align 8
+ call void @llvm.memmove.p0.p0.i64(ptr %ptr, ptr %ptr.1, i64 24, i1 false)
ret i8 %0
}
-define void @test7([4 x i32]* %ptr) {
+define void @test7(ptr %ptr) {
; CHECK-LABEL: @test7(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [4 x i32], [4 x i32]* [[PTR:%.*]], i64 0, i32 0
-; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [4 x i32], [4 x i32]* [[PTR]], i64 0, i32 1
-; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [4 x i32], [4 x i32]* [[PTR]], i64 0, i32 2
-; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds [4 x i32], [4 x i32]* [[PTR]], i64 0, i32 3
-; CHECK-NEXT: [[TMP4:%.*]] = bitcast i32* [[TMP0]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP4]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [4 x i32], ptr [[PTR:%.*]], i64 0, i32 1
+; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [4 x i32], ptr [[PTR]], i64 0, i32 2
+; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [4 x i32], ptr [[PTR]], i64 0, i32 3
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[PTR]], i8 0, i64 16, i1 false)
; CHECK-NEXT: call void @clobber()
; CHECK-NEXT: ret void
;
entry:
- %0 = getelementptr inbounds [4 x i32], [4 x i32]* %ptr, i64 0, i32 0
- store i32 0, i32* %0, align 1
- %1 = getelementptr inbounds [4 x i32], [4 x i32]* %ptr, i64 0, i32 1
- store i32 0, i32* %1, align 1
- %2 = getelementptr inbounds [4 x i32], [4 x i32]* %ptr, i64 0, i32 2
- store i32 0, i32* %2, align 1
- %3 = getelementptr inbounds [4 x i32], [4 x i32]* %ptr, i64 0, i32 3
- store i32 0, i32* %3, align 1
+ store i32 0, ptr %ptr, align 1
+ %0 = getelementptr inbounds [4 x i32], ptr %ptr, i64 0, i32 1
+ store i32 0, ptr %0, align 1
+ %1 = getelementptr inbounds [4 x i32], ptr %ptr, i64 0, i32 2
+ store i32 0, ptr %1, align 1
+ %2 = getelementptr inbounds [4 x i32], ptr %ptr, i64 0, i32 3
+ store i32 0, ptr %2, align 1
call void @clobber()
ret void
}
-define void @test8(%t* noalias %src, %t* %dst) {
+define void @test8(ptr noalias %src, ptr %dst) {
; CHECK-LABEL: @test8(
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast %t* [[SRC:%.*]] to i8*
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast %t* [[DST:%.*]] to i8*
-; CHECK-NEXT: [[TMP3:%.*]] = bitcast %t* [[SRC]] to i8*
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 [[TMP2]], i8* align 1 [[TMP3]], i64 8224, i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP1]], i8 0, i64 8224, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 [[DST:%.*]], ptr align 1 [[SRC:%.*]], i64 8224, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[SRC]], i8 0, i64 8224, i1 false)
; CHECK-NEXT: ret void
;
- %1 = load %t, %t* %src
- store %t zeroinitializer, %t* %src
- store %t %1, %t* %dst
+ %1 = load %t, ptr %src
+ store %t zeroinitializer, ptr %src
+ store %t %1, ptr %dst
ret void
}
declare void @clobber()
; Function Attrs: argmemonly nounwind willreturn
-declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #0
+declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0
; Function Attrs: argmemonly nounwind willreturn
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0
+declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0
; Function Attrs: argmemonly nounwind willreturn writeonly
-declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1
+declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1
; Function Attrs: argmemonly nounwind willreturn
-declare void @llvm.memmove.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1 immarg) #0
+declare void @llvm.memmove.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1 immarg) #0
attributes #0 = { argmemonly nounwind willreturn }
attributes #1 = { argmemonly nounwind willreturn writeonly }
diff --git a/llvm/test/Transforms/MemCpyOpt/process_store.ll b/llvm/test/Transforms/MemCpyOpt/process_store.ll
index ce8bef8ecdd4..2c793427283c 100644
--- a/llvm/test/Transforms/MemCpyOpt/process_store.ll
+++ b/llvm/test/Transforms/MemCpyOpt/process_store.ll
@@ -13,24 +13,24 @@ declare dso_local i32 @f1()
define dso_local void @f2() {
; CHECK-LABEL: @f2(
; CHECK-NEXT: for.end:
-; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @b, align 4
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr @b, align 4
; CHECK-NEXT: ret void
; CHECK: for.body:
-; CHECK-NEXT: store i32 [[TMP1:%.*]], i32* @a, align 4
+; CHECK-NEXT: store i32 [[TMP1:%.*]], ptr @a, align 4
; CHECK-NEXT: [[CALL:%.*]] = call i32 @f1()
; CHECK-NEXT: [[CMP:%.*]] = icmp sge i32 [[CALL]], 0
-; CHECK-NEXT: [[TMP1]] = load i32, i32* @b, align 4
+; CHECK-NEXT: [[TMP1]] = load i32, ptr @b, align 4
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
;
for.end:
- %0 = load i32, i32* @b, align 4
+ %0 = load i32, ptr @b, align 4
ret void
for.body:
- store i32 %1, i32* @a, align 4
+ store i32 %1, ptr @a, align 4
%call = call i32 @f1()
%cmp = icmp sge i32 %call, 0
- %1 = load i32, i32* @b, align 4
+ %1 = load i32, ptr @b, align 4
br label %for.body
}
@@ -38,27 +38,27 @@ for.body:
define dso_local void @f3() {
; CHECK-LABEL: @f3(
; CHECK-NEXT: for.end:
-; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @b, align 4
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr @b, align 4
; CHECK-NEXT: ret void
; CHECK: for.body:
; CHECK-NEXT: [[T:%.*]] = add i32 [[T2:%.*]], 1
-; CHECK-NEXT: store i32 [[TMP1:%.*]], i32* @a, align 4
+; CHECK-NEXT: store i32 [[TMP1:%.*]], ptr @a, align 4
; CHECK-NEXT: [[CALL:%.*]] = call i32 @f1()
; CHECK-NEXT: [[CMP:%.*]] = icmp sge i32 [[CALL]], 0
-; CHECK-NEXT: [[TMP1]] = load i32, i32* @b, align 4
+; CHECK-NEXT: [[TMP1]] = load i32, ptr @b, align 4
; CHECK-NEXT: [[T2]] = xor i32 [[T]], 5
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
;
for.end:
- %0 = load i32, i32* @b, align 4
+ %0 = load i32, ptr @b, align 4
ret void
for.body:
%t = add i32 %t2, 1
- store i32 %1, i32* @a, align 4
+ store i32 %1, ptr @a, align 4
%call = call i32 @f1()
%cmp = icmp sge i32 %call, 0
- %1 = load i32, i32* @b, align 4
+ %1 = load i32, ptr @b, align 4
%t2 = xor i32 %t, 5
br label %for.body
}
diff --git a/llvm/test/Transforms/MemCpyOpt/profitable-memset.ll b/llvm/test/Transforms/MemCpyOpt/profitable-memset.ll
index ec65e67b77fb..8bf58ced6f58 100644
--- a/llvm/test/Transforms/MemCpyOpt/profitable-memset.ll
+++ b/llvm/test/Transforms/MemCpyOpt/profitable-memset.ll
@@ -3,25 +3,20 @@
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
-define void @foo(i64* nocapture %P) {
+define void @foo(ptr nocapture %P) {
; CHECK-LABEL: @foo(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TMP0:%.*]] = bitcast i64* [[P:%.*]] to i16*
-; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i16, i16* [[TMP0]], i64 1
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i16* [[ARRAYIDX]] to i32*
-; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i16, i16* [[TMP0]], i64 3
-; CHECK-NEXT: [[TMP2:%.*]] = bitcast i16* [[TMP0]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 2 [[TMP2]], i8 0, i64 8, i1 false)
+; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i16, ptr [[P:%.*]], i64 1
+; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i16, ptr [[P:%.*]], i64 3
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 2 [[P:%.*]], i8 0, i64 8, i1 false)
; CHECK-NEXT: ret void
;
entry:
- %0 = bitcast i64* %P to i16*
- %arrayidx = getelementptr inbounds i16, i16* %0, i64 1
- %1 = bitcast i16* %arrayidx to i32*
- %arrayidx1 = getelementptr inbounds i16, i16* %0, i64 3
- store i16 0, i16* %0, align 2
- store i32 0, i32* %1, align 4
- store i16 0, i16* %arrayidx1, align 2
+ %arrayidx = getelementptr inbounds i16, ptr %P, i64 1
+ %arrayidx1 = getelementptr inbounds i16, ptr %P, i64 3
+ store i16 0, ptr %P, align 2
+ store i32 0, ptr %arrayidx, align 4
+ store i16 0, ptr %arrayidx1, align 2
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/smaller.ll b/llvm/test/Transforms/MemCpyOpt/smaller.ll
index 90eb487f5067..d39ccf23800d 100644
--- a/llvm/test/Transforms/MemCpyOpt/smaller.ll
+++ b/llvm/test/Transforms/MemCpyOpt/smaller.ll
@@ -13,26 +13,24 @@ target datalayout = "e-p:32:32:32"
@.str = private constant [11 x i8] c"0123456789\00"
@cell = external global %struct.s
-declare void @check(%struct.s* byval(%struct.s) %p) nounwind
-declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind
+declare void @check(ptr byval(%struct.s) %p) nounwind
+declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind
define void @foo() nounwind {
; CHECK-LABEL: @foo(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[AGG_TMP:%.*]] = alloca [[STRUCT_S:%.*]], align 4
-; CHECK-NEXT: store i32 99, i32* getelementptr inbounds (%struct.s, %struct.s* @cell, i32 0, i32 1), align 4
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 getelementptr inbounds (%struct.s, %struct.s* @cell, i32 0, i32 0, i32 0), i8* align 1 getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0), i32 11, i1 false)
-; CHECK-NEXT: [[TMP:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.s* [[AGG_TMP]], i32 0, i32 0, i32 0
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 [[TMP]], i8* align 4 getelementptr inbounds (%struct.s, %struct.s* @cell, i32 0, i32 0, i32 0), i32 16, i1 false)
-; CHECK-NEXT: call void @check(%struct.s* byval(%struct.s) [[AGG_TMP]])
+; CHECK-NEXT: store i32 99, ptr getelementptr inbounds (%struct.s, ptr @cell, i32 0, i32 1), align 4
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 @cell, ptr align 1 @.str, i32 11, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[AGG_TMP]], ptr align 4 @cell, i32 16, i1 false)
+; CHECK-NEXT: call void @check(ptr byval(%struct.s) [[AGG_TMP]])
; CHECK-NEXT: ret void
;
entry:
%agg.tmp = alloca %struct.s, align 4
- store i32 99, i32* getelementptr inbounds (%struct.s, %struct.s* @cell, i32 0, i32 1), align 4
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 getelementptr inbounds (%struct.s, %struct.s* @cell, i32 0, i32 0, i32 0), i8* align 1 getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0), i32 11, i1 false)
- %tmp = getelementptr inbounds %struct.s, %struct.s* %agg.tmp, i32 0, i32 0, i32 0
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %tmp, i8* align 4 getelementptr inbounds (%struct.s, %struct.s* @cell, i32 0, i32 0, i32 0), i32 16, i1 false)
- call void @check(%struct.s* byval(%struct.s) %agg.tmp)
+ store i32 99, ptr getelementptr inbounds (%struct.s, ptr @cell, i32 0, i32 1), align 4
+ call void @llvm.memcpy.p0.p0.i32(ptr align 1 @cell, ptr align 1 @.str, i32 11, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr align 4 %agg.tmp, ptr align 4 @cell, i32 16, i1 false)
+ call void @check(ptr byval(%struct.s) %agg.tmp)
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/sret.ll b/llvm/test/Transforms/MemCpyOpt/sret.ll
index 5ba3e6a7519e..5240a1b42e0f 100644
--- a/llvm/test/Transforms/MemCpyOpt/sret.ll
+++ b/llvm/test/Transforms/MemCpyOpt/sret.ll
@@ -6,44 +6,36 @@ target triple = "i686-apple-darwin9"
%0 = type { x86_fp80, x86_fp80 }
-define void @ccosl(%0* noalias sret(%0) %agg.result, %0* byval(%0) align 8 %z) nounwind {
+define void @ccosl(ptr noalias sret(%0) %agg.result, ptr byval(%0) align 8 %z) nounwind {
; CHECK-LABEL: @ccosl(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[IZ:%.*]] = alloca [[TMP0:%.*]], align 16
; CHECK-NEXT: [[MEMTMP:%.*]] = alloca [[TMP0]], align 16
-; CHECK-NEXT: [[TMP1:%.*]] = getelementptr [[TMP0]], %0* [[Z:%.*]], i32 0, i32 1
-; CHECK-NEXT: [[TMP2:%.*]] = load x86_fp80, x86_fp80* [[TMP1]], align 16
+; CHECK-NEXT: [[TMP1:%.*]] = getelementptr [[TMP0]], ptr [[Z:%.*]], i32 0, i32 1
+; CHECK-NEXT: [[TMP2:%.*]] = load x86_fp80, ptr [[TMP1]], align 16
; CHECK-NEXT: [[TMP3:%.*]] = fsub x86_fp80 0xK80000000000000000000, [[TMP2]]
-; CHECK-NEXT: [[TMP4:%.*]] = getelementptr [[TMP0]], %0* [[IZ]], i32 0, i32 1
-; CHECK-NEXT: [[REAL:%.*]] = getelementptr [[TMP0]], %0* [[IZ]], i32 0, i32 0
-; CHECK-NEXT: [[TMP7:%.*]] = getelementptr [[TMP0]], %0* [[Z]], i32 0, i32 0
-; CHECK-NEXT: [[TMP8:%.*]] = load x86_fp80, x86_fp80* [[TMP7]], align 16
-; CHECK-NEXT: store x86_fp80 [[TMP3]], x86_fp80* [[REAL]], align 16
-; CHECK-NEXT: store x86_fp80 [[TMP8]], x86_fp80* [[TMP4]], align 16
-; CHECK-NEXT: call void @ccoshl(%0* noalias sret([[TMP0]]) [[AGG_RESULT:%.*]], %0* byval([[TMP0]]) align 8 [[IZ]]) #[[ATTR0:[0-9]+]]
-; CHECK-NEXT: [[MEMTMP14:%.*]] = bitcast %0* [[MEMTMP]] to i8*
-; CHECK-NEXT: [[AGG_RESULT15:%.*]] = bitcast %0* [[AGG_RESULT]] to i8*
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr [[TMP0]], ptr [[IZ]], i32 0, i32 1
+; CHECK-NEXT: [[TMP8:%.*]] = load x86_fp80, ptr [[Z]], align 16
+; CHECK-NEXT: store x86_fp80 [[TMP3]], ptr [[IZ]], align 16
+; CHECK-NEXT: store x86_fp80 [[TMP8]], ptr [[TMP4]], align 16
+; CHECK-NEXT: call void @ccoshl(ptr noalias sret([[TMP0]]) [[AGG_RESULT:%.*]], ptr byval([[TMP0]]) align 8 [[IZ]]) #[[ATTR0:[0-9]+]]
; CHECK-NEXT: ret void
;
entry:
%iz = alloca %0
%memtmp = alloca %0, align 16
- %tmp1 = getelementptr %0, %0* %z, i32 0, i32 1
- %tmp2 = load x86_fp80, x86_fp80* %tmp1, align 16
+ %tmp1 = getelementptr %0, ptr %z, i32 0, i32 1
+ %tmp2 = load x86_fp80, ptr %tmp1, align 16
%tmp3 = fsub x86_fp80 0xK80000000000000000000, %tmp2
- %tmp4 = getelementptr %0, %0* %iz, i32 0, i32 1
- %real = getelementptr %0, %0* %iz, i32 0, i32 0
- %tmp7 = getelementptr %0, %0* %z, i32 0, i32 0
- %tmp8 = load x86_fp80, x86_fp80* %tmp7, align 16
- store x86_fp80 %tmp3, x86_fp80* %real, align 16
- store x86_fp80 %tmp8, x86_fp80* %tmp4, align 16
- call void @ccoshl(%0* noalias sret(%0) %memtmp, %0* byval(%0) align 8 %iz) nounwind
- %memtmp14 = bitcast %0* %memtmp to i8*
- %agg.result15 = bitcast %0* %agg.result to i8*
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %agg.result15, i8* align 16 %memtmp14, i32 32, i1 false)
+ %tmp4 = getelementptr %0, ptr %iz, i32 0, i32 1
+ %tmp8 = load x86_fp80, ptr %z, align 16
+ store x86_fp80 %tmp3, ptr %iz, align 16
+ store x86_fp80 %tmp8, ptr %tmp4, align 16
+ call void @ccoshl(ptr noalias sret(%0) %memtmp, ptr byval(%0) align 8 %iz) nounwind
+ call void @llvm.memcpy.p0.p0.i32(ptr align 16 %agg.result, ptr align 16 %memtmp, i32 32, i1 false)
ret void
}
-declare void @ccoshl(%0* noalias nocapture sret(%0), %0* byval(%0)) nounwind
+declare void @ccoshl(ptr noalias nocapture sret(%0), ptr byval(%0)) nounwind
-declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind
+declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind
diff --git a/llvm/test/Transforms/MemCpyOpt/stackrestore.ll b/llvm/test/Transforms/MemCpyOpt/stackrestore.ll
index 2e59431ea858..0407b4e8aebc 100644
--- a/llvm/test/Transforms/MemCpyOpt/stackrestore.ll
+++ b/llvm/test/Transforms/MemCpyOpt/stackrestore.ll
@@ -17,34 +17,32 @@ target triple = "i686-unknown-windows-msvc19.14.26433"
define i32 @test_norestore(i32 %n) {
; CHECK-LABEL: @test_norestore(
; CHECK-NEXT: [[TMPMEM:%.*]] = alloca [10 x i8], align 4
-; CHECK-NEXT: [[TMP:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[TMPMEM]], i32 0, i32 0
; CHECK-NEXT: [[P:%.*]] = alloca i8, i32 [[N:%.*]], align 4
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[P]], i8* align 1 getelementptr inbounds ([9 x i8], [9 x i8]* @str, i32 0, i32 0), i32 9, i1 false)
-; CHECK-NEXT: [[P10:%.*]] = getelementptr inbounds i8, i8* [[P]], i32 9
-; CHECK-NEXT: store i8 0, i8* [[P10]], align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[TMP]], i8* [[P]], i32 10, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[P]], ptr align 1 @str, i32 9, i1 false)
+; CHECK-NEXT: [[P10:%.*]] = getelementptr inbounds i8, ptr [[P]], i32 9
+; CHECK-NEXT: store i8 0, ptr [[P10]], align 1
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[TMPMEM]], ptr [[P]], i32 10, i1 false)
; CHECK-NEXT: call void @external()
-; CHECK-NEXT: [[HEAP:%.*]] = call i8* @malloc(i32 9)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[HEAP]], i8* align 1 getelementptr inbounds ([9 x i8], [9 x i8]* @str, i32 0, i32 0), i32 9, i1 false)
-; CHECK-NEXT: call void @useit(i8* [[HEAP]])
+; CHECK-NEXT: [[HEAP:%.*]] = call ptr @malloc(i32 9)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[HEAP]], ptr align 1 @str, i32 9, i1 false)
+; CHECK-NEXT: call void @useit(ptr [[HEAP]])
; CHECK-NEXT: ret i32 0
;
%tmpmem = alloca [10 x i8], align 4
- %tmp = getelementptr inbounds [10 x i8], [10 x i8]* %tmpmem, i32 0, i32 0
; Make a dynamic alloca, initialize it.
%p = alloca i8, i32 %n, align 4
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %p, i8* align 1 getelementptr inbounds ([9 x i8], [9 x i8]* @str, i32 0, i32 0), i32 9, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr %p, ptr align 1 @str, i32 9, i1 false)
; This extra byte exists to prevent memcpyopt from propagating @str.
- %p10 = getelementptr inbounds i8, i8* %p, i32 9
- store i8 0, i8* %p10
+ %p10 = getelementptr inbounds i8, ptr %p, i32 9
+ store i8 0, ptr %p10
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp, i8* %p, i32 10, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr %tmpmem, ptr %p, i32 10, i1 false)
call void @external()
- %heap = call i8* @malloc(i32 9)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %heap, i8* %tmp, i32 9, i1 false)
- call void @useit(i8* %heap)
+ %heap = call ptr @malloc(i32 9)
+ call void @llvm.memcpy.p0.p0.i32(ptr %heap, ptr %tmpmem, i32 9, i1 false)
+ call void @useit(ptr %heap)
ret i32 0
}
@@ -53,42 +51,38 @@ define i32 @test_norestore(i32 %n) {
define i32 @test_stackrestore() {
; CHECK-LABEL: @test_stackrestore(
; CHECK-NEXT: [[TMPMEM:%.*]] = alloca [10 x i8], align 4
-; CHECK-NEXT: [[TMP:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[TMPMEM]], i32 0, i32 0
-; CHECK-NEXT: [[INALLOCA_SAVE:%.*]] = tail call i8* @llvm.stacksave()
+; CHECK-NEXT: [[INALLOCA_SAVE:%.*]] = tail call ptr @llvm.stacksave()
; CHECK-NEXT: [[ARGMEM:%.*]] = alloca inalloca [10 x i8], align 4
-; CHECK-NEXT: [[P:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[ARGMEM]], i32 0, i32 0
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[P]], i8* align 1 getelementptr inbounds ([9 x i8], [9 x i8]* @str, i32 0, i32 0), i32 9, i1 false)
-; CHECK-NEXT: [[P10:%.*]] = getelementptr inbounds [10 x i8], [10 x i8]* [[ARGMEM]], i32 0, i32 9
-; CHECK-NEXT: store i8 0, i8* [[P10]], align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[TMP]], i8* [[P]], i32 10, i1 false)
-; CHECK-NEXT: call void @llvm.stackrestore(i8* [[INALLOCA_SAVE]])
-; CHECK-NEXT: [[HEAP:%.*]] = call i8* @malloc(i32 9)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[HEAP]], i8* [[TMP]], i32 9, i1 false)
-; CHECK-NEXT: call void @useit(i8* [[HEAP]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[ARGMEM]], ptr align 1 @str, i32 9, i1 false)
+; CHECK-NEXT: [[P10:%.*]] = getelementptr inbounds [10 x i8], ptr [[ARGMEM]], i32 0, i32 9
+; CHECK-NEXT: store i8 0, ptr [[P10]], align 1
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[TMPMEM]], ptr [[ARGMEM]], i32 10, i1 false)
+; CHECK-NEXT: call void @llvm.stackrestore(ptr [[INALLOCA_SAVE]])
+; CHECK-NEXT: [[HEAP:%.*]] = call ptr @malloc(i32 9)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[HEAP]], ptr [[TMPMEM]], i32 9, i1 false)
+; CHECK-NEXT: call void @useit(ptr [[HEAP]])
; CHECK-NEXT: ret i32 0
;
%tmpmem = alloca [10 x i8], align 4
- %tmp = getelementptr inbounds [10 x i8], [10 x i8]* %tmpmem, i32 0, i32 0
- %inalloca.save = tail call i8* @llvm.stacksave()
+ %inalloca.save = tail call ptr @llvm.stacksave()
%argmem = alloca inalloca [10 x i8], align 4
- %p = getelementptr inbounds [10 x i8], [10 x i8]* %argmem, i32 0, i32 0
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %p, i8* align 1 getelementptr inbounds ([9 x i8], [9 x i8]* @str, i32 0, i32 0), i32 9, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr %argmem, ptr align 1 @str, i32 9, i1 false)
; This extra byte exists to prevent memcpyopt from propagating @str.
- %p10 = getelementptr inbounds [10 x i8], [10 x i8]* %argmem, i32 0, i32 9
- store i8 0, i8* %p10
+ %p10 = getelementptr inbounds [10 x i8], ptr %argmem, i32 0, i32 9
+ store i8 0, ptr %p10
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp, i8* %p, i32 10, i1 false)
- call void @llvm.stackrestore(i8* %inalloca.save)
- %heap = call i8* @malloc(i32 9)
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %heap, i8* %tmp, i32 9, i1 false)
- call void @useit(i8* %heap)
+ call void @llvm.memcpy.p0.p0.i32(ptr %tmpmem, ptr %argmem, i32 10, i1 false)
+ call void @llvm.stackrestore(ptr %inalloca.save)
+ %heap = call ptr @malloc(i32 9)
+ call void @llvm.memcpy.p0.p0.i32(ptr %heap, ptr %tmpmem, i32 9, i1 false)
+ call void @useit(ptr %heap)
ret i32 0
}
-declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i1)
-declare i8* @llvm.stacksave()
-declare void @llvm.stackrestore(i8*)
-declare i8* @malloc(i32)
-declare void @useit(i8*)
+declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture readonly, i32, i1)
+declare ptr @llvm.stacksave()
+declare void @llvm.stackrestore(ptr)
+declare ptr @malloc(i32)
+declare void @useit(ptr)
declare void @external()
diff --git a/llvm/test/Transforms/MemCpyOpt/store-to-memset-is-nonzero-type.ll b/llvm/test/Transforms/MemCpyOpt/store-to-memset-is-nonzero-type.ll
index 94d59a010d70..7cad877243a3 100644
--- a/llvm/test/Transforms/MemCpyOpt/store-to-memset-is-nonzero-type.ll
+++ b/llvm/test/Transforms/MemCpyOpt/store-to-memset-is-nonzero-type.ll
@@ -3,44 +3,40 @@
; Array
-define void @array_zero([0 x i8]* %p) {
+define void @array_zero(ptr %p) {
; CHECK-LABEL: @array_zero(
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast [0 x i8]* [[P:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP1]], i8 undef, i64 0, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[P:%.*]], i8 undef, i64 0, i1 false)
; CHECK-NEXT: ret void
;
- store [0 x i8] zeroinitializer, [0 x i8]* %p
+ store [0 x i8] zeroinitializer, ptr %p
ret void
}
-define void @array_nonzero([1 x i8]* %p) {
+define void @array_nonzero(ptr %p) {
; CHECK-LABEL: @array_nonzero(
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast [1 x i8]* [[P:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP1]], i8 0, i64 1, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[P:%.*]], i8 0, i64 1, i1 false)
; CHECK-NEXT: ret void
;
- store [1 x i8] zeroinitializer, [1 x i8]* %p
+ store [1 x i8] zeroinitializer, ptr %p
ret void
}
; Structure
-define void @struct_zero({ }* %p) {
+define void @struct_zero(ptr %p) {
; CHECK-LABEL: @struct_zero(
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast {}* [[P:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP1]], i8 undef, i64 0, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[P:%.*]], i8 undef, i64 0, i1 false)
; CHECK-NEXT: ret void
;
- store { } zeroinitializer, { }* %p
+ store { } zeroinitializer, ptr %p
ret void
}
-define void @struct_nonzero({ i8 }* %p) {
+define void @struct_nonzero(ptr %p) {
; CHECK-LABEL: @struct_nonzero(
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast { i8 }* [[P:%.*]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP1]], i8 0, i64 1, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[P:%.*]], i8 0, i64 1, i1 false)
; CHECK-NEXT: ret void
;
- store { i8 } zeroinitializer, { i8 }* %p
+ store { i8 } zeroinitializer, ptr %p
ret void
}
@@ -48,26 +44,23 @@ define void @struct_nonzero({ i8 }* %p) {
; Test only non-zero vector. Zero element vector is illegal
-define void @vector_fixed_length_nonzero(<16 x i8>* %p) {
+define void @vector_fixed_length_nonzero(ptr %p) {
; CHECK-LABEL: @vector_fixed_length_nonzero(
-; CHECK-NEXT: [[TMP0:%.*]] = getelementptr <16 x i8>, <16 x i8>* [[P:%.*]], i64 0
-; CHECK-NEXT: [[TMP1:%.*]] = getelementptr <16 x i8>, <16 x i8>* [[P]], i64 1
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast <16 x i8>* [[TMP0]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 16 [[TMP1]], i8 0, i64 32, i1 false)
+; CHECK-NEXT: [[TMP1:%.*]] = getelementptr <16 x i8>, ptr [[P]], i64 1
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 16 [[P:%.*]], i8 0, i64 32, i1 false)
; CHECK-NEXT: ret void
;
- %tmp0 = getelementptr <16 x i8>, <16 x i8>* %p, i64 0
- store <16 x i8> zeroinitializer, <16 x i8>* %tmp0
- %tmp1 = getelementptr <16 x i8>, <16 x i8>* %p, i64 1
- store <16 x i8> zeroinitializer, <16 x i8>* %tmp1
+ store <16 x i8> zeroinitializer, ptr %p
+ %tmp1 = getelementptr <16 x i8>, ptr %p, i64 1
+ store <16 x i8> zeroinitializer, ptr %tmp1
ret void
}
-define void @vector_scalable_nonzero(<vscale x 4 x i32>* %p) {
+define void @vector_scalable_nonzero(ptr %p) {
; CHECK-LABEL: @vector_scalable_nonzero(
-; CHECK-NEXT: store <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32>* [[P:%.*]], align 16
+; CHECK-NEXT: store <vscale x 4 x i32> zeroinitializer, ptr [[P:%.*]], align 16
; CHECK-NEXT: ret void
;
- store <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32>* %p
+ store <vscale x 4 x i32> zeroinitializer, ptr %p
ret void
}
diff --git a/llvm/test/Transforms/MemCpyOpt/store-to-memset.ll b/llvm/test/Transforms/MemCpyOpt/store-to-memset.ll
index 9be2b30fcbbc..44de707c752a 100644
--- a/llvm/test/Transforms/MemCpyOpt/store-to-memset.ll
+++ b/llvm/test/Transforms/MemCpyOpt/store-to-memset.ll
@@ -3,113 +3,113 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-define i8* @foo(i8* returned %0, i32 %1, i64 %2) {
+define ptr @foo(ptr returned %0, i32 %1, i64 %2) {
; CHECK-LABEL: @foo(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, i8* [[TMP0:%.*]], i64 [[TMP2:%.*]]
-; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, i8* [[TMP3]], i64 -32
+; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[TMP0:%.*]], i64 [[TMP2:%.*]]
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[TMP3]], i64 -32
; CHECK-NEXT: [[VV:%.*]] = trunc i32 [[TMP1:%.*]] to i8
-; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 1
-; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 2
-; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 3
-; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 4
-; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 5
-; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 6
-; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 7
-; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 8
-; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 9
-; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 10
-; CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 11
-; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 12
-; CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 13
-; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 14
-; CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 15
-; CHECK-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i64 16
-; CHECK-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, i8* [[TMP20]], i64 1
-; CHECK-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, i8* [[TMP20]], i64 2
-; CHECK-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, i8* [[TMP20]], i64 3
-; CHECK-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, i8* [[TMP20]], i64 4
-; CHECK-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, i8* [[TMP20]], i64 5
-; CHECK-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, i8* [[TMP20]], i64 6
-; CHECK-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, i8* [[TMP20]], i64 7
-; CHECK-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, i8* [[TMP20]], i64 8
-; CHECK-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, i8* [[TMP20]], i64 9
-; CHECK-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, i8* [[TMP20]], i64 10
-; CHECK-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, i8* [[TMP20]], i64 11
-; CHECK-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, i8* [[TMP20]], i64 12
-; CHECK-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, i8* [[TMP20]], i64 13
-; CHECK-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, i8* [[TMP20]], i64 14
-; CHECK-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, i8* [[TMP20]], i64 15
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP4]], i8 [[VV]], i64 32, i1 false)
-; CHECK-NEXT: ret i8* [[TMP0]]
+; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 1
+; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 2
+; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 3
+; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 4
+; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 5
+; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 6
+; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 7
+; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 8
+; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 9
+; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 10
+; CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 11
+; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 12
+; CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 13
+; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 14
+; CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 15
+; CHECK-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 16
+; CHECK-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 1
+; CHECK-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 2
+; CHECK-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 3
+; CHECK-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 4
+; CHECK-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 5
+; CHECK-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 6
+; CHECK-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 7
+; CHECK-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 8
+; CHECK-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 9
+; CHECK-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 10
+; CHECK-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 11
+; CHECK-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 12
+; CHECK-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 13
+; CHECK-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 14
+; CHECK-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 15
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP4]], i8 [[VV]], i64 32, i1 false)
+; CHECK-NEXT: ret ptr [[TMP0]]
;
entry:
- %3 = getelementptr inbounds i8, i8* %0, i64 %2
- %4 = getelementptr inbounds i8, i8* %3, i64 -32
+ %3 = getelementptr inbounds i8, ptr %0, i64 %2
+ %4 = getelementptr inbounds i8, ptr %3, i64 -32
%vv = trunc i32 %1 to i8
- store i8 %vv, i8* %4, align 1
- %5 = getelementptr inbounds i8, i8* %4, i64 1
- store i8 %vv, i8* %5, align 1
- %6= getelementptr inbounds i8, i8* %4, i64 2
- store i8 %vv, i8* %6, align 1
- %7= getelementptr inbounds i8, i8* %4, i64 3
- store i8 %vv, i8* %7, align 1
- %8= getelementptr inbounds i8, i8* %4, i64 4
- store i8 %vv, i8* %8, align 1
- %9= getelementptr inbounds i8, i8* %4, i64 5
- store i8 %vv, i8* %9, align 1
- %10= getelementptr inbounds i8, i8* %4, i64 6
- store i8 %vv, i8* %10, align 1
- %11= getelementptr inbounds i8, i8* %4, i64 7
- store i8 %vv, i8* %11, align 1
- %12= getelementptr inbounds i8, i8* %4, i64 8
- store i8 %vv, i8* %12, align 1
- %13= getelementptr inbounds i8, i8* %4, i64 9
- store i8 %vv, i8* %13, align 1
- %14= getelementptr inbounds i8, i8* %4, i64 10
- store i8 %vv, i8* %14, align 1
- %15= getelementptr inbounds i8, i8* %4, i64 11
- store i8 %vv, i8* %15, align 1
- %16= getelementptr inbounds i8, i8* %4, i64 12
- store i8 %vv, i8* %16, align 1
- %17= getelementptr inbounds i8, i8* %4, i64 13
- store i8 %vv, i8* %17, align 1
- %18= getelementptr inbounds i8, i8* %4, i64 14
- store i8 %vv, i8* %18, align 1
- %19= getelementptr inbounds i8, i8* %4, i64 15
- store i8 %vv, i8* %19, align 1
- %20= getelementptr inbounds i8, i8* %4, i64 16
- store i8 %vv, i8* %20, align 1
- %21= getelementptr inbounds i8, i8* %20, i64 1
- store i8 %vv, i8* %21, align 1
- %22= getelementptr inbounds i8, i8* %20, i64 2
- store i8 %vv, i8* %22, align 1
- %23= getelementptr inbounds i8, i8* %20, i64 3
- store i8 %vv, i8* %23, align 1
- %24= getelementptr inbounds i8, i8* %20, i64 4
- store i8 %vv, i8* %24, align 1
- %25= getelementptr inbounds i8, i8* %20, i64 5
- store i8 %vv, i8* %25, align 1
- %26= getelementptr inbounds i8, i8* %20, i64 6
- store i8 %vv, i8* %26, align 1
- %27= getelementptr inbounds i8, i8* %20, i64 7
- store i8 %vv, i8* %27, align 1
- %28= getelementptr inbounds i8, i8* %20, i64 8
- store i8 %vv, i8* %28, align 1
- %29= getelementptr inbounds i8, i8* %20, i64 9
- store i8 %vv, i8* %29, align 1
- %30= getelementptr inbounds i8, i8* %20, i64 10
- store i8 %vv, i8* %30, align 1
- %31 = getelementptr inbounds i8, i8* %20, i64 11
- store i8 %vv, i8* %31, align 1
- %32 = getelementptr inbounds i8, i8* %20, i64 12
- store i8 %vv, i8* %32, align 1
- %33 = getelementptr inbounds i8, i8* %20, i64 13
- store i8 %vv, i8* %33, align 1
- %34 = getelementptr inbounds i8, i8* %20, i64 14
- store i8 %vv, i8* %34, align 1
- %35 = getelementptr inbounds i8, i8* %20, i64 15
- store i8 %vv, i8* %35, align 1
- ret i8* %0
+ store i8 %vv, ptr %4, align 1
+ %5 = getelementptr inbounds i8, ptr %4, i64 1
+ store i8 %vv, ptr %5, align 1
+ %6= getelementptr inbounds i8, ptr %4, i64 2
+ store i8 %vv, ptr %6, align 1
+ %7= getelementptr inbounds i8, ptr %4, i64 3
+ store i8 %vv, ptr %7, align 1
+ %8= getelementptr inbounds i8, ptr %4, i64 4
+ store i8 %vv, ptr %8, align 1
+ %9= getelementptr inbounds i8, ptr %4, i64 5
+ store i8 %vv, ptr %9, align 1
+ %10= getelementptr inbounds i8, ptr %4, i64 6
+ store i8 %vv, ptr %10, align 1
+ %11= getelementptr inbounds i8, ptr %4, i64 7
+ store i8 %vv, ptr %11, align 1
+ %12= getelementptr inbounds i8, ptr %4, i64 8
+ store i8 %vv, ptr %12, align 1
+ %13= getelementptr inbounds i8, ptr %4, i64 9
+ store i8 %vv, ptr %13, align 1
+ %14= getelementptr inbounds i8, ptr %4, i64 10
+ store i8 %vv, ptr %14, align 1
+ %15= getelementptr inbounds i8, ptr %4, i64 11
+ store i8 %vv, ptr %15, align 1
+ %16= getelementptr inbounds i8, ptr %4, i64 12
+ store i8 %vv, ptr %16, align 1
+ %17= getelementptr inbounds i8, ptr %4, i64 13
+ store i8 %vv, ptr %17, align 1
+ %18= getelementptr inbounds i8, ptr %4, i64 14
+ store i8 %vv, ptr %18, align 1
+ %19= getelementptr inbounds i8, ptr %4, i64 15
+ store i8 %vv, ptr %19, align 1
+ %20= getelementptr inbounds i8, ptr %4, i64 16
+ store i8 %vv, ptr %20, align 1
+ %21= getelementptr inbounds i8, ptr %20, i64 1
+ store i8 %vv, ptr %21, align 1
+ %22= getelementptr inbounds i8, ptr %20, i64 2
+ store i8 %vv, ptr %22, align 1
+ %23= getelementptr inbounds i8, ptr %20, i64 3
+ store i8 %vv, ptr %23, align 1
+ %24= getelementptr inbounds i8, ptr %20, i64 4
+ store i8 %vv, ptr %24, align 1
+ %25= getelementptr inbounds i8, ptr %20, i64 5
+ store i8 %vv, ptr %25, align 1
+ %26= getelementptr inbounds i8, ptr %20, i64 6
+ store i8 %vv, ptr %26, align 1
+ %27= getelementptr inbounds i8, ptr %20, i64 7
+ store i8 %vv, ptr %27, align 1
+ %28= getelementptr inbounds i8, ptr %20, i64 8
+ store i8 %vv, ptr %28, align 1
+ %29= getelementptr inbounds i8, ptr %20, i64 9
+ store i8 %vv, ptr %29, align 1
+ %30= getelementptr inbounds i8, ptr %20, i64 10
+ store i8 %vv, ptr %30, align 1
+ %31 = getelementptr inbounds i8, ptr %20, i64 11
+ store i8 %vv, ptr %31, align 1
+ %32 = getelementptr inbounds i8, ptr %20, i64 12
+ store i8 %vv, ptr %32, align 1
+ %33 = getelementptr inbounds i8, ptr %20, i64 13
+ store i8 %vv, ptr %33, align 1
+ %34 = getelementptr inbounds i8, ptr %20, i64 14
+ store i8 %vv, ptr %34, align 1
+ %35 = getelementptr inbounds i8, ptr %20, i64 15
+ store i8 %vv, ptr %35, align 1
+ ret ptr %0
}
diff --git a/llvm/test/Transforms/MemCpyOpt/variable-sized-memcpy-memcpy.ll b/llvm/test/Transforms/MemCpyOpt/variable-sized-memcpy-memcpy.ll
index 6ab54d1cd7f2..862f0ac7a3b4 100644
--- a/llvm/test/Transforms/MemCpyOpt/variable-sized-memcpy-memcpy.ll
+++ b/llvm/test/Transforms/MemCpyOpt/variable-sized-memcpy-memcpy.ll
@@ -2,37 +2,37 @@
; RUN: opt < %s -memcpyopt -S -verify-memoryssa | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-define void @test(i8* %src, i64 %size) {
+define void @test(ptr %src, i64 %size) {
; CHECK-LABEL: @test(
; CHECK-NEXT: [[TMP:%.*]] = alloca i8, i64 [[SIZE:%.*]], align 1
; CHECK-NEXT: [[DST:%.*]] = alloca i8, i64 [[SIZE]], align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[TMP]], i8* align 8 [[SRC:%.*]], i64 [[SIZE]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[DST]], i8* align 8 [[SRC]], i64 [[SIZE]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[TMP]], ptr align 8 [[SRC:%.*]], i64 [[SIZE]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DST]], ptr align 8 [[SRC]], i64 [[SIZE]], i1 false)
; CHECK-NEXT: ret void
;
%tmp = alloca i8, i64 %size
%dst = alloca i8, i64 %size
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %tmp, i8* align 8 %src, i64 %size, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %tmp, i64 %size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %tmp, ptr align 8 %src, i64 %size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst, ptr align 8 %tmp, i64 %size, i1 false)
ret void
}
; Differing sizes, so left as it is.
-define void @negative_test(i8* %src, i64 %size1, i64 %size2) {
+define void @negative_test(ptr %src, i64 %size1, i64 %size2) {
; CHECK-LABEL: @negative_test(
; CHECK-NEXT: [[TMP:%.*]] = alloca i8, i64 [[SIZE1:%.*]], align 1
; CHECK-NEXT: [[DST:%.*]] = alloca i8, i64 [[SIZE2:%.*]], align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[TMP]], i8* align 8 [[SRC:%.*]], i64 [[SIZE1]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[DST]], i8* align 8 [[TMP]], i64 [[SIZE2]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[TMP]], ptr align 8 [[SRC:%.*]], i64 [[SIZE1]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DST]], ptr align 8 [[TMP]], i64 [[SIZE2]], i1 false)
; CHECK-NEXT: ret void
;
%tmp = alloca i8, i64 %size1
%dst = alloca i8, i64 %size2
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %tmp, i8* align 8 %src, i64 %size1, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %tmp, i64 %size2, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %tmp, ptr align 8 %src, i64 %size1, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst, ptr align 8 %tmp, i64 %size2, i1 false)
ret void
}
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i1)
+declare void @llvm.memcpy.p0.p0.i64(ptr, ptr, i64, i1)
diff --git a/llvm/test/Transforms/MemCpyOpt/variable-sized-memcpy-uninit.ll b/llvm/test/Transforms/MemCpyOpt/variable-sized-memcpy-uninit.ll
index 71ae6b59f2f8..37aff7b1e7a8 100644
--- a/llvm/test/Transforms/MemCpyOpt/variable-sized-memcpy-uninit.ll
+++ b/llvm/test/Transforms/MemCpyOpt/variable-sized-memcpy-uninit.ll
@@ -10,7 +10,7 @@ define void @test(i64 %size) {
;
%src = alloca i8, i64 %size
%dst = alloca i8, i64 %size
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %src, i64 %size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst, ptr align 8 %src, i64 %size, i1 false)
ret void
}
@@ -23,9 +23,9 @@ define void @test2(i64 %size1, i64 %size2, i64 %cpy_size) {
;
%src = alloca i8, i64 %size1
%dst = alloca i8, i64 %size2
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %src, i64 %cpy_size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst, ptr align 8 %src, i64 %cpy_size, i1 false)
ret void
}
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i1)
+declare void @llvm.memcpy.p0.p0.i64(ptr, ptr, i64, i1)
diff --git a/llvm/test/Transforms/MemCpyOpt/variable-sized-memset-memcpy.ll b/llvm/test/Transforms/MemCpyOpt/variable-sized-memset-memcpy.ll
index 4bbc4243932c..48d8e26dfee3 100644
--- a/llvm/test/Transforms/MemCpyOpt/variable-sized-memset-memcpy.ll
+++ b/llvm/test/Transforms/MemCpyOpt/variable-sized-memset-memcpy.ll
@@ -2,38 +2,38 @@
; RUN: opt < %s -memcpyopt -S -verify-memoryssa | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-define void @test(i8* %src, i8 %c, i64 %size) {
+define void @test(ptr %src, i8 %c, i64 %size) {
; CHECK-LABEL: @test(
; CHECK-NEXT: [[DST1:%.*]] = alloca i8, i64 [[SIZE:%.*]], align 1
; CHECK-NEXT: [[DST2:%.*]] = alloca i8, i64 [[SIZE]], align 1
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[DST1]], i8 [[C:%.*]], i64 [[SIZE]], i1 false)
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[DST2]], i8 [[C]], i64 [[SIZE]], i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[DST1]], i8 [[C:%.*]], i64 [[SIZE]], i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[DST2]], i8 [[C]], i64 [[SIZE]], i1 false)
; CHECK-NEXT: ret void
;
%dst1 = alloca i8, i64 %size
%dst2 = alloca i8, i64 %size
- call void @llvm.memset.p0i8.i64(i8* align 8 %dst1, i8 %c, i64 %size, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst2, i8* align 8 %dst1, i64 %size, i1 false)
+ call void @llvm.memset.p0.i64(ptr align 8 %dst1, i8 %c, i64 %size, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst2, ptr align 8 %dst1, i64 %size, i1 false)
ret void
}
; Differing sizes, so left as it is.
-define void @negative_test(i8* %src, i8 %c, i64 %size1, i64 %size2) {
+define void @negative_test(ptr %src, i8 %c, i64 %size1, i64 %size2) {
; CHECK-LABEL: @negative_test(
; CHECK-NEXT: [[DST1:%.*]] = alloca i8, i64 [[SIZE1:%.*]], align 1
; CHECK-NEXT: [[DST2:%.*]] = alloca i8, i64 [[SIZE2:%.*]], align 1
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 8 [[DST1]], i8 [[C:%.*]], i64 [[SIZE1]], i1 false)
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 [[DST2]], i8* align 8 [[DST1]], i64 [[SIZE2]], i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 8 [[DST1]], i8 [[C:%.*]], i64 [[SIZE1]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DST2]], ptr align 8 [[DST1]], i64 [[SIZE2]], i1 false)
; CHECK-NEXT: ret void
;
%dst1 = alloca i8, i64 %size1
%dst2 = alloca i8, i64 %size2
- call void @llvm.memset.p0i8.i64(i8* align 8 %dst1, i8 %c, i64 %size1, i1 false)
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst2, i8* align 8 %dst1, i64 %size2, i1 false)
+ call void @llvm.memset.p0.i64(ptr align 8 %dst1, i8 %c, i64 %size1, i1 false)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %dst2, ptr align 8 %dst1, i64 %size2, i1 false)
ret void
}
-declare void @llvm.memset.p0i8.i64(i8*, i8, i64, i1)
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i1)
+declare void @llvm.memset.p0.i64(ptr, i8, i64, i1)
+declare void @llvm.memcpy.p0.p0.i64(ptr, ptr, i64, i1)
diff --git a/llvm/test/Transforms/MemCpyOpt/vscale-crashes.ll b/llvm/test/Transforms/MemCpyOpt/vscale-crashes.ll
index 6b81fb52c631..d2347f96dd61 100644
--- a/llvm/test/Transforms/MemCpyOpt/vscale-crashes.ll
+++ b/llvm/test/Transforms/MemCpyOpt/vscale-crashes.ll
@@ -4,98 +4,86 @@
; Check that a call featuring a scalable-vector byval argument fed by a memcpy
; doesn't crash the compiler. It previously assumed the byval type's size could
; be represented as a known constant amount.
-define void @byval_caller(i8 *%P) {
+define void @byval_caller(ptr %P) {
; CHECK-LABEL: @byval_caller(
; CHECK-NEXT: [[A:%.*]] = alloca i8, align 1
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[A]], i8* align 4 [[P:%.*]], i64 8, i1 false)
-; CHECK-NEXT: [[VA:%.*]] = bitcast i8* [[A]] to <vscale x 1 x i8>*
-; CHECK-NEXT: call void @byval_callee(<vscale x 1 x i8>* byval(<vscale x 1 x i8>) align 1 [[VA]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[A]], ptr align 4 [[P:%.*]], i64 8, i1 false)
+; CHECK-NEXT: call void @byval_callee(ptr byval(<vscale x 1 x i8>) align 1 [[A]])
; CHECK-NEXT: ret void
;
%a = alloca i8
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4 %P, i64 8, i1 false)
- %va = bitcast i8* %a to <vscale x 1 x i8>*
- call void @byval_callee(<vscale x 1 x i8>* align 1 byval(<vscale x 1 x i8>) %va)
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a, ptr align 4 %P, i64 8, i1 false)
+ call void @byval_callee(ptr align 1 byval(<vscale x 1 x i8>) %a)
ret void
}
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4, i8* align 4, i64, i1)
-declare void @byval_callee(<vscale x 1 x i8>* align 1 byval(<vscale x 1 x i8>))
+declare void @llvm.memcpy.p0.p0.i64(ptr align 4, ptr align 4, i64, i1)
+declare void @byval_callee(ptr align 1 byval(<vscale x 1 x i8>))
; Check that two scalable-vector stores (overlapping, with a constant offset)
; do not crash the compiler when checked whether or not they can be merged into
; a single memset. There was previously an assumption that the stored values'
; sizes could be represented by a known constant amount.
-define void @merge_stores_both_scalable(<vscale x 1 x i8>* %ptr) {
+define void @merge_stores_both_scalable(ptr %ptr) {
; CHECK-LABEL: @merge_stores_both_scalable(
-; CHECK-NEXT: store <vscale x 1 x i8> zeroinitializer, <vscale x 1 x i8>* [[PTR:%.*]], align 1
-; CHECK-NEXT: [[PTRI8:%.*]] = bitcast <vscale x 1 x i8>* [[PTR]] to i8*
-; CHECK-NEXT: [[PTR_NEXT:%.*]] = getelementptr i8, i8* [[PTRI8]], i64 1
-; CHECK-NEXT: [[PTR_NEXT_2:%.*]] = bitcast i8* [[PTR_NEXT]] to <vscale x 1 x i8>*
-; CHECK-NEXT: store <vscale x 1 x i8> zeroinitializer, <vscale x 1 x i8>* [[PTR_NEXT_2]], align 1
+; CHECK-NEXT: store <vscale x 1 x i8> zeroinitializer, ptr [[PTR:%.*]], align 1
+; CHECK-NEXT: [[PTR_NEXT:%.*]] = getelementptr i8, ptr [[PTR]], i64 1
+; CHECK-NEXT: store <vscale x 1 x i8> zeroinitializer, ptr [[PTR_NEXT]], align 1
; CHECK-NEXT: ret void
;
- store <vscale x 1 x i8> zeroinitializer, <vscale x 1 x i8>* %ptr
- %ptri8 = bitcast <vscale x 1 x i8>* %ptr to i8*
- %ptr.next = getelementptr i8, i8* %ptri8, i64 1
- %ptr.next.2 = bitcast i8* %ptr.next to <vscale x 1 x i8>*
- store <vscale x 1 x i8> zeroinitializer, <vscale x 1 x i8>* %ptr.next.2
+ store <vscale x 1 x i8> zeroinitializer, ptr %ptr
+ %ptr.next = getelementptr i8, ptr %ptr, i64 1
+ store <vscale x 1 x i8> zeroinitializer, ptr %ptr.next
ret void
}
; As above, but where the base is scalable but the subsequent store(s) are not.
-define void @merge_stores_first_scalable(<vscale x 1 x i8>* %ptr) {
+define void @merge_stores_first_scalable(ptr %ptr) {
; CHECK-LABEL: @merge_stores_first_scalable(
-; CHECK-NEXT: store <vscale x 1 x i8> zeroinitializer, <vscale x 1 x i8>* [[PTR:%.*]], align 1
-; CHECK-NEXT: [[PTRI8:%.*]] = bitcast <vscale x 1 x i8>* [[PTR]] to i8*
-; CHECK-NEXT: [[PTR_NEXT:%.*]] = getelementptr i8, i8* [[PTRI8]], i64 1
-; CHECK-NEXT: store i8 0, i8* [[PTR_NEXT]], align 1
+; CHECK-NEXT: store <vscale x 1 x i8> zeroinitializer, ptr [[PTR:%.*]], align 1
+; CHECK-NEXT: [[PTR_NEXT:%.*]] = getelementptr i8, ptr [[PTR]], i64 1
+; CHECK-NEXT: store i8 0, ptr [[PTR_NEXT]], align 1
; CHECK-NEXT: ret void
;
- store <vscale x 1 x i8> zeroinitializer, <vscale x 1 x i8>* %ptr
- %ptri8 = bitcast <vscale x 1 x i8>* %ptr to i8*
- %ptr.next = getelementptr i8, i8* %ptri8, i64 1
- store i8 zeroinitializer, i8* %ptr.next
+ store <vscale x 1 x i8> zeroinitializer, ptr %ptr
+ %ptr.next = getelementptr i8, ptr %ptr, i64 1
+ store i8 zeroinitializer, ptr %ptr.next
ret void
}
; As above, but where the base is not scalable but the subsequent store(s) are.
-define void @merge_stores_second_scalable(i8* %ptr) {
+define void @merge_stores_second_scalable(ptr %ptr) {
; CHECK-LABEL: @merge_stores_second_scalable(
-; CHECK-NEXT: store i8 0, i8* [[PTR:%.*]], align 1
-; CHECK-NEXT: [[PTR_NEXT:%.*]] = getelementptr i8, i8* [[PTR]], i64 1
-; CHECK-NEXT: [[PTR_NEXT_2:%.*]] = bitcast i8* [[PTR_NEXT]] to <vscale x 1 x i8>*
-; CHECK-NEXT: store <vscale x 1 x i8> zeroinitializer, <vscale x 1 x i8>* [[PTR_NEXT_2]], align 1
+; CHECK-NEXT: store i8 0, ptr [[PTR:%.*]], align 1
+; CHECK-NEXT: [[PTR_NEXT:%.*]] = getelementptr i8, ptr [[PTR]], i64 1
+; CHECK-NEXT: store <vscale x 1 x i8> zeroinitializer, ptr [[PTR_NEXT]], align 1
; CHECK-NEXT: ret void
;
- store i8 zeroinitializer, i8* %ptr
- %ptr.next = getelementptr i8, i8* %ptr, i64 1
- %ptr.next.2 = bitcast i8* %ptr.next to <vscale x 1 x i8>*
- store <vscale x 1 x i8> zeroinitializer, <vscale x 1 x i8>* %ptr.next.2
+ store i8 zeroinitializer, ptr %ptr
+ %ptr.next = getelementptr i8, ptr %ptr, i64 1
+ store <vscale x 1 x i8> zeroinitializer, ptr %ptr.next
ret void
}
; Check that the call-slot optimization doesn't crash when encountering scalable types.
-define void @callslotoptzn(<vscale x 4 x float> %val, <vscale x 4 x float>* %out) {
+define void @callslotoptzn(<vscale x 4 x float> %val, ptr %out) {
; CHECK-LABEL: @callslotoptzn(
; CHECK-NEXT: [[ALLOC:%.*]] = alloca <vscale x 4 x float>, align 16
; CHECK-NEXT: [[IDX:%.*]] = tail call <vscale x 4 x i32> @llvm.experimental.stepvector.nxv4i32()
-; CHECK-NEXT: [[BALLOC:%.*]] = getelementptr inbounds <vscale x 4 x float>, <vscale x 4 x float>* [[ALLOC]], i64 0, i64 0
-; CHECK-NEXT: [[STRIDE:%.*]] = getelementptr inbounds float, float* [[BALLOC]], <vscale x 4 x i32> [[IDX]]
-; CHECK-NEXT: call void @llvm.masked.scatter.nxv4f32.nxv4p0f32(<vscale x 4 x float> [[VAL:%.*]], <vscale x 4 x float*> [[STRIDE]], i32 4, <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i32 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer))
-; CHECK-NEXT: [[LI:%.*]] = load <vscale x 4 x float>, <vscale x 4 x float>* [[ALLOC]], align 4
-; CHECK-NEXT: store <vscale x 4 x float> [[LI]], <vscale x 4 x float>* [[OUT:%.*]], align 4
+; CHECK-NEXT: [[STRIDE:%.*]] = getelementptr inbounds float, ptr [[ALLOC]], <vscale x 4 x i32> [[IDX]]
+; CHECK-NEXT: call void @llvm.masked.scatter.nxv4f32.nxv4p0(<vscale x 4 x float> [[VAL:%.*]], <vscale x 4 x ptr> [[STRIDE]], i32 4, <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i32 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer))
+; CHECK-NEXT: [[LI:%.*]] = load <vscale x 4 x float>, ptr [[ALLOC]], align 4
+; CHECK-NEXT: store <vscale x 4 x float> [[LI]], ptr [[OUT:%.*]], align 4
; CHECK-NEXT: ret void
;
%alloc = alloca <vscale x 4 x float>, align 16
%idx = tail call <vscale x 4 x i32> @llvm.experimental.stepvector.nxv4i32()
- %balloc = getelementptr inbounds <vscale x 4 x float>, <vscale x 4 x float>* %alloc, i64 0, i64 0
- %stride = getelementptr inbounds float, float* %balloc, <vscale x 4 x i32> %idx
- call void @llvm.masked.scatter.nxv4f32.nxv4p0f32(<vscale x 4 x float> %val, <vscale x 4 x float*> %stride, i32 4, <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i32 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer))
- %li = load <vscale x 4 x float>, <vscale x 4 x float>* %alloc, align 4
- store <vscale x 4 x float> %li, <vscale x 4 x float>* %out, align 4
+ %stride = getelementptr inbounds float, ptr %alloc, <vscale x 4 x i32> %idx
+ call void @llvm.masked.scatter.nxv4f32.nxv4p0f32(<vscale x 4 x float> %val, <vscale x 4 x ptr> %stride, i32 4, <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i32 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer))
+ %li = load <vscale x 4 x float>, ptr %alloc, align 4
+ store <vscale x 4 x float> %li, ptr %out, align 4
ret void
}
declare <vscale x 4 x i32> @llvm.experimental.stepvector.nxv4i32()
-declare void @llvm.masked.scatter.nxv4f32.nxv4p0f32(<vscale x 4 x float> , <vscale x 4 x float*> , i32, <vscale x 4 x i1>)
+declare void @llvm.masked.scatter.nxv4f32.nxv4p0f32(<vscale x 4 x float> , <vscale x 4 x ptr> , i32, <vscale x 4 x i1>)
diff --git a/llvm/test/Transforms/MemCpyOpt/vscale-memset.ll b/llvm/test/Transforms/MemCpyOpt/vscale-memset.ll
index f197c6f4491a..7bed1a617477 100644
--- a/llvm/test/Transforms/MemCpyOpt/vscale-memset.ll
+++ b/llvm/test/Transforms/MemCpyOpt/vscale-memset.ll
@@ -5,111 +5,101 @@
; Check this test is not transformed into memset, or cause a compiler warning
; warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
-define void @foo(i8* %p) {
+define void @foo(ptr %p) {
; CHECK-LABEL: @foo(
-; CHECK-NEXT: [[A:%.*]] = bitcast i8* [[P:%.*]] to <vscale x 16 x i8>*
-; CHECK-NEXT: [[TMP0:%.*]] = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* [[A]], i64 0
-; CHECK-NEXT: store <vscale x 16 x i8> zeroinitializer, <vscale x 16 x i8>* [[TMP0]], align 16
-; CHECK-NEXT: [[TMP1:%.*]] = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* [[A]], i64 1
-; CHECK-NEXT: store <vscale x 16 x i8> zeroinitializer, <vscale x 16 x i8>* [[TMP1]], align 16
+; CHECK-NEXT: store <vscale x 16 x i8> zeroinitializer, ptr [[P:%.*]], align 16
+; CHECK-NEXT: [[TMP1:%.*]] = getelementptr <vscale x 16 x i8>, ptr [[P:%.*]], i64 1
+; CHECK-NEXT: store <vscale x 16 x i8> zeroinitializer, ptr [[TMP1]], align 16
; CHECK-NEXT: ret void
;
- %a = bitcast i8* %p to <vscale x 16 x i8>*
- %tmp0 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i64 0
- store <vscale x 16 x i8> zeroinitializer, <vscale x 16 x i8>* %tmp0
- %tmp1 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i64 1
- store <vscale x 16 x i8> zeroinitializer, <vscale x 16 x i8>* %tmp1
+ store <vscale x 16 x i8> zeroinitializer, ptr %p
+ %tmp1 = getelementptr <vscale x 16 x i8>, ptr %p, i64 1
+ store <vscale x 16 x i8> zeroinitializer, ptr %tmp1
ret void
}
; Positive test
-define void @memset_vscale_index_zero(i8* %p, i8 %z) {
+define void @memset_vscale_index_zero(ptr %p, i8 %z) {
; CHECK-LABEL: @memset_vscale_index_zero(
-; CHECK-NEXT: [[A:%.*]] = bitcast i8* [[P:%.*]] to <vscale x 16 x i8>*
-; CHECK-NEXT: [[TMP0:%.*]] = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* [[A]], i32 0, i32 0
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP0]], i8 [[Z:%.*]], i64 17, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[P:%.*]], i8 [[Z:%.*]], i64 17, i1 false)
; CHECK-NEXT: ret void
;
- %a = bitcast i8* %p to <vscale x 16 x i8>*
- %tmp0 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 0
- store i8 %z, i8* %tmp0
- %tmp1 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 1
- store i8 %z, i8* %tmp1
- %tmp2 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 2
- store i8 %z, i8* %tmp2
- %tmp3 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 3
- store i8 %z, i8* %tmp3
- %tmp4 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 4
- store i8 %z, i8* %tmp4
- %tmp5 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 5
- store i8 %z, i8* %tmp5
- %tmp6 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 6
- store i8 %z, i8* %tmp6
- %tmp7 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 7
- store i8 %z, i8* %tmp7
- %tmp8 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 8
- store i8 %z, i8* %tmp8
- %tmp9 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 9
- store i8 %z, i8* %tmp9
- %tmp10 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 10
- store i8 %z, i8* %tmp10
- %tmp11 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 11
- store i8 %z, i8* %tmp11
- %tmp12 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 12
- store i8 %z, i8* %tmp12
- %tmp13 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 13
- store i8 %z, i8* %tmp13
- %tmp14 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 14
- store i8 %z, i8* %tmp14
- %tmp15 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 15
- store i8 %z, i8* %tmp15
- %tmp16 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 16
- store i8 %z, i8* %tmp16
+ store i8 %z, ptr %p
+ %tmp1 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 1
+ store i8 %z, ptr %tmp1
+ %tmp2 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 2
+ store i8 %z, ptr %tmp2
+ %tmp3 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 3
+ store i8 %z, ptr %tmp3
+ %tmp4 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 4
+ store i8 %z, ptr %tmp4
+ %tmp5 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 5
+ store i8 %z, ptr %tmp5
+ %tmp6 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 6
+ store i8 %z, ptr %tmp6
+ %tmp7 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 7
+ store i8 %z, ptr %tmp7
+ %tmp8 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 8
+ store i8 %z, ptr %tmp8
+ %tmp9 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 9
+ store i8 %z, ptr %tmp9
+ %tmp10 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 10
+ store i8 %z, ptr %tmp10
+ %tmp11 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 11
+ store i8 %z, ptr %tmp11
+ %tmp12 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 12
+ store i8 %z, ptr %tmp12
+ %tmp13 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 13
+ store i8 %z, ptr %tmp13
+ %tmp14 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 14
+ store i8 %z, ptr %tmp14
+ %tmp15 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 15
+ store i8 %z, ptr %tmp15
+ %tmp16 = getelementptr <vscale x 16 x i8>, ptr %p, i32 0, i32 16
+ store i8 %z, ptr %tmp16
ret void
}
-define void @memset_vscale_index_nonzero(i8* %p, i8 %z) {
+define void @memset_vscale_index_nonzero(ptr %p, i8 %z) {
; CHECK-LABEL: @memset_vscale_index_nonzero(
-; CHECK-NEXT: [[A:%.*]] = bitcast i8* [[P:%.*]] to <vscale x 16 x i8>*
-; CHECK-NEXT: [[TMP0:%.*]] = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* [[A]], i32 1, i32 0
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 1 [[TMP0]], i8 [[Z:%.*]], i64 17, i1 false)
+; CHECK-NEXT: [[TMP0:%.*]] = getelementptr <vscale x 16 x i8>, ptr [[P:%.*]], i32 1, i32 0
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP0]], i8 [[Z:%.*]], i64 17, i1 false)
; CHECK-NEXT: ret void
;
- %a = bitcast i8* %p to <vscale x 16 x i8>*
- %tmp0 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 0
- store i8 %z, i8* %tmp0
- %tmp1 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 1
- store i8 %z, i8* %tmp1
- %tmp2 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 2
- store i8 %z, i8* %tmp2
- %tmp3 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 3
- store i8 %z, i8* %tmp3
- %tmp4 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 4
- store i8 %z, i8* %tmp4
- %tmp5 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 5
- store i8 %z, i8* %tmp5
- %tmp6 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 6
- store i8 %z, i8* %tmp6
- %tmp7 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 7
- store i8 %z, i8* %tmp7
- %tmp8 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 8
- store i8 %z, i8* %tmp8
- %tmp9 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 9
- store i8 %z, i8* %tmp9
- %tmp10 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 10
- store i8 %z, i8* %tmp10
- %tmp11 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 11
- store i8 %z, i8* %tmp11
- %tmp12 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 12
- store i8 %z, i8* %tmp12
- %tmp13 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 13
- store i8 %z, i8* %tmp13
- %tmp14 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 14
- store i8 %z, i8* %tmp14
- %tmp15 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 15
- store i8 %z, i8* %tmp15
- %tmp16 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 1, i32 16
- store i8 %z, i8* %tmp16
+ %tmp0 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 0
+ store i8 %z, ptr %tmp0
+ %tmp1 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 1
+ store i8 %z, ptr %tmp1
+ %tmp2 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 2
+ store i8 %z, ptr %tmp2
+ %tmp3 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 3
+ store i8 %z, ptr %tmp3
+ %tmp4 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 4
+ store i8 %z, ptr %tmp4
+ %tmp5 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 5
+ store i8 %z, ptr %tmp5
+ %tmp6 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 6
+ store i8 %z, ptr %tmp6
+ %tmp7 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 7
+ store i8 %z, ptr %tmp7
+ %tmp8 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 8
+ store i8 %z, ptr %tmp8
+ %tmp9 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 9
+ store i8 %z, ptr %tmp9
+ %tmp10 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 10
+ store i8 %z, ptr %tmp10
+ %tmp11 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 11
+ store i8 %z, ptr %tmp11
+ %tmp12 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 12
+ store i8 %z, ptr %tmp12
+ %tmp13 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 13
+ store i8 %z, ptr %tmp13
+ %tmp14 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 14
+ store i8 %z, ptr %tmp14
+ %tmp15 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 15
+ store i8 %z, ptr %tmp15
+ %tmp16 = getelementptr <vscale x 16 x i8>, ptr %p, i32 1, i32 16
+ store i8 %z, ptr %tmp16
ret void
}
More information about the llvm-commits
mailing list