diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp index d85e0d9946602..5ed912f66c4f1 100644 --- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -397,9 +397,7 @@ Value *LibCallSimplifier::emitStrLenMemCpy(Value *Src, Value *Dst, uint64_t Len, // We have enough information to now generate the memcpy call to do the // concatenation for us. Make a memcpy to copy the nul byte with align = 1. - B.CreateMemCpy( - CpyDst, Align(1), Src, Align(1), - ConstantInt::get(DL.getIntPtrType(Src->getContext()), Len + 1)); + B.CreateMemCpy(CpyDst, Align(1), Src, Align(1), Len + 1); return Dst; } @@ -590,8 +588,11 @@ Value *LibCallSimplifier::optimizeStrCmp(CallInst *CI, IRBuilderBase &B) { if (Len1 && Len2) { return copyFlags( *CI, emitMemCmp(Str1P, Str2P, - ConstantInt::get(DL.getIntPtrType(CI->getContext()), - std::min(Len1, Len2)), + ConstantInt::get( + DL.getIntPtrType( + CI->getContext(), + Str1P->getType()->getPointerAddressSpace()), + std::min(Len1, Len2)), B, DL, TLI)); } @@ -599,17 +600,23 @@ Value *LibCallSimplifier::optimizeStrCmp(CallInst *CI, IRBuilderBase &B) { if (!HasStr1 && HasStr2) { if (canTransformToMemCmp(CI, Str1P, Len2, DL)) return copyFlags( - *CI, - emitMemCmp(Str1P, Str2P, - ConstantInt::get(DL.getIntPtrType(CI->getContext()), Len2), - B, DL, TLI)); + *CI, emitMemCmp(Str1P, Str2P, + ConstantInt::get( + DL.getIntPtrType( + CI->getContext(), + Str1P->getType()->getPointerAddressSpace()), + Len2), + B, DL, TLI)); } else if (HasStr1 && !HasStr2) { if (canTransformToMemCmp(CI, Str2P, Len1, DL)) return copyFlags( - *CI, - emitMemCmp(Str1P, Str2P, - ConstantInt::get(DL.getIntPtrType(CI->getContext()), Len1), - B, DL, TLI)); + *CI, emitMemCmp(Str1P, Str2P, + ConstantInt::get( + DL.getIntPtrType( + CI->getContext(), + Str1P->getType()->getPointerAddressSpace()), + Len1), + B, DL, TLI)); } annotateNonNullNoUndefBasedOnAccess(CI, {0, 1}); @@ -677,18 +684,24 @@ Value *LibCallSimplifier::optimizeStrNCmp(CallInst *CI, IRBuilderBase &B) { Len2 = std::min(Len2, Length); if (canTransformToMemCmp(CI, Str1P, Len2, DL)) return copyFlags( - *CI, - emitMemCmp(Str1P, Str2P, - ConstantInt::get(DL.getIntPtrType(CI->getContext()), Len2), - B, DL, TLI)); + *CI, emitMemCmp(Str1P, Str2P, + ConstantInt::get( + DL.getIntPtrType( + CI->getContext(), + Str1P->getType()->getPointerAddressSpace()), + Len2), + B, DL, TLI)); } else if (HasStr1 && !HasStr2) { Len1 = std::min(Len1, Length); if (canTransformToMemCmp(CI, Str2P, Len1, DL)) return copyFlags( - *CI, - emitMemCmp(Str1P, Str2P, - ConstantInt::get(DL.getIntPtrType(CI->getContext()), Len1), - B, DL, TLI)); + *CI, emitMemCmp(Str1P, Str2P, + ConstantInt::get( + DL.getIntPtrType( + CI->getContext(), + Str1P->getType()->getPointerAddressSpace()), + Len1), + B, DL, TLI)); } return nullptr; @@ -722,9 +735,7 @@ Value *LibCallSimplifier::optimizeStrCpy(CallInst *CI, IRBuilderBase &B) { // We have enough information to now generate the memcpy call to do the // copy for us. Make a memcpy to copy the nul byte with align = 1. - CallInst *NewCI = - B.CreateMemCpy(Dst, Align(1), Src, Align(1), - ConstantInt::get(DL.getIntPtrType(CI->getContext()), Len)); + CallInst *NewCI = B.CreateMemCpy(Dst, Align(1), Src, Align(1), Len); mergeAttributesAndFlags(NewCI, *CI); return Dst; } @@ -819,13 +830,10 @@ Value *LibCallSimplifier::optimizeStrLCpy(CallInst *CI, IRBuilderBase &B) { return ConstantInt::get(CI->getType(), 0); } - Function *Callee = CI->getCalledFunction(); - Type *PT = Callee->getFunctionType()->getParamType(0); // Transform strlcpy(D, S, N) to memcpy(D, S, N') where N' is the lower // bound on strlen(S) + 1 and N, optionally followed by a nul store to // D[N' - 1] if necessary. - CallInst *NewCI = B.CreateMemCpy(Dst, Align(1), Src, Align(1), - ConstantInt::get(DL.getIntPtrType(PT), NBytes)); + CallInst *NewCI = B.CreateMemCpy(Dst, Align(1), Src, Align(1), NBytes); mergeAttributesAndFlags(NewCI, *CI); if (!NulTerm) { @@ -844,7 +852,6 @@ Value *LibCallSimplifier::optimizeStrLCpy(CallInst *CI, IRBuilderBase &B) { // otherwise. Value *LibCallSimplifier::optimizeStringNCpy(CallInst *CI, bool RetEnd, IRBuilderBase &B) { - Function *Callee = CI->getCalledFunction(); Value *Dst = CI->getArgOperand(0); Value *Src = CI->getArgOperand(1); Value *Size = CI->getArgOperand(2); @@ -921,11 +928,9 @@ Value *LibCallSimplifier::optimizeStringNCpy(CallInst *CI, bool RetEnd, /*M=*/nullptr, /*AddNull=*/false); } - Type *PT = Callee->getFunctionType()->getParamType(0); // st{p,r}ncpy(D, S, N) -> memcpy(align 1 D, align 1 S, N) when both // S and N are constant. - CallInst *NewCI = B.CreateMemCpy(Dst, Align(1), Src, Align(1), - ConstantInt::get(DL.getIntPtrType(PT), N)); + CallInst *NewCI = B.CreateMemCpy(Dst, Align(1), Src, Align(1), N); mergeAttributesAndFlags(NewCI, *CI); if (!RetEnd) return Dst; @@ -3357,7 +3362,9 @@ Value *LibCallSimplifier::optimizePrintFString(CallInst *CI, IRBuilderBase &B) { // Create a string literal with no \n on it. We expect the constant merge // pass to be run after this pass, to merge duplicate strings. FormatStr = FormatStr.drop_back(); - Value *GV = B.CreateGlobalString(FormatStr, "str"); + Value *GV = B.CreateGlobalString( + FormatStr, "str", + CI->getArgOperand(0)->getType()->getPointerAddressSpace()); return copyFlags(*CI, emitPutS(GV, B, TLI)); } @@ -3432,10 +3439,8 @@ Value *LibCallSimplifier::optimizeSPrintFString(CallInst *CI, return nullptr; // we found a format specifier, bail out. // sprintf(str, fmt) -> llvm.memcpy(align 1 str, align 1 fmt, strlen(fmt)+1) - B.CreateMemCpy( - Dest, Align(1), CI->getArgOperand(1), Align(1), - ConstantInt::get(DL.getIntPtrType(CI->getContext()), - FormatStr.size() + 1)); // Copy the null byte. + B.CreateMemCpy(Dest, Align(1), CI->getArgOperand(1), Align(1), + FormatStr.size() + 1); // Copy the null byte. return ConstantInt::get(CI->getType(), FormatStr.size()); } @@ -3470,9 +3475,7 @@ Value *LibCallSimplifier::optimizeSPrintFString(CallInst *CI, uint64_t SrcLen = GetStringLength(CI->getArgOperand(2)); if (SrcLen) { - B.CreateMemCpy( - Dest, Align(1), CI->getArgOperand(2), Align(1), - ConstantInt::get(DL.getIntPtrType(CI->getContext()), SrcLen)); + B.CreateMemCpy(Dest, Align(1), CI->getArgOperand(2), Align(1), SrcLen); // Returns total number of characters written without null-character. return ConstantInt::get(CI->getType(), SrcLen - 1); } else if (Value *V = emitStpCpy(Dest, CI->getArgOperand(2), B, TLI)) { @@ -3570,11 +3573,7 @@ Value *LibCallSimplifier::emitSnPrintfMemCpy(CallInst *CI, Value *StrArg, Value *DstArg = CI->getArgOperand(0); if (NCopy && StrArg) // Transform the call to lvm.memcpy(dst, fmt, N). - copyFlags( - *CI, - B.CreateMemCpy( - DstArg, Align(1), StrArg, Align(1), - ConstantInt::get(DL.getIntPtrType(CI->getContext()), NCopy))); + copyFlags(*CI, B.CreateMemCpy(DstArg, Align(1), StrArg, Align(1), NCopy)); if (N > Str.size()) // Return early when the whole format string, including the final nul, diff --git a/llvm/test/Transforms/InstCombine/ARM/strcpy.ll b/llvm/test/Transforms/InstCombine/ARM/strcpy.ll index 519abf2bf78dd..961cb55530aff 100644 --- a/llvm/test/Transforms/InstCombine/ARM/strcpy.ll +++ b/llvm/test/Transforms/InstCombine/ARM/strcpy.ll @@ -16,7 +16,7 @@ define arm_aapcscc void @test_simplify1() { call arm_aapcscc ptr @strcpy(ptr @a, ptr @hello) -; CHECK: @llvm.memcpy.p0.p0.i32 +; CHECK: @llvm.memcpy.p0.p0.i64 ret void } @@ -43,7 +43,7 @@ define arm_aapcs_vfpcc void @test_simplify1_vfp() { call arm_aapcs_vfpcc ptr @strcpy(ptr @a, ptr @hello) -; CHECK: @llvm.memcpy.p0.p0.i32 +; CHECK: @llvm.memcpy.p0.p0.i64 ret void } diff --git a/llvm/test/Transforms/InstCombine/sprintf-1.ll b/llvm/test/Transforms/InstCombine/sprintf-1.ll index b9354bb4b2990..ab67fdd44f9ad 100644 --- a/llvm/test/Transforms/InstCombine/sprintf-1.ll +++ b/llvm/test/Transforms/InstCombine/sprintf-1.ll @@ -26,7 +26,7 @@ declare i32 @sprintf(ptr, ptr, ...) define void @test_simplify1(ptr %dst) { ; CHECK-LABEL: @test_simplify1( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(13) [[DST:%.*]], ptr noundef nonnull align 1 dereferenceable(13) @hello_world, i32 13, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(13) [[DST:%.*]], ptr noundef nonnull align 1 dereferenceable(13) @hello_world, i64 13, i1 false) ; CHECK-NEXT: ret void ; call i32 (ptr, ptr, ...) @sprintf(ptr %dst, ptr @hello_world) @@ -113,7 +113,7 @@ define i32 @test_simplify7(ptr %dst, ptr %str) { ; Check sprintf(dst, "%s", str) -> llvm.memcpy(dest, str, strlen(str) + 1, 1). define i32 @test_simplify8(ptr %dst) { ; CHECK-LABEL: @test_simplify8( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(13) [[DST:%.*]], ptr noundef nonnull align 1 dereferenceable(13) @hello_world, i32 13, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(13) [[DST:%.*]], ptr noundef nonnull align 1 dereferenceable(13) @hello_world, i64 13, i1 false) ; CHECK-NEXT: ret i32 12 ; %r = call i32 (ptr, ptr, ...) @sprintf(ptr %dst, ptr @percent_s, ptr @hello_world) diff --git a/llvm/test/Transforms/InstCombine/stpcpy-1.ll b/llvm/test/Transforms/InstCombine/stpcpy-1.ll index 2ddacb2097442..234ff5ea9ea0a 100644 --- a/llvm/test/Transforms/InstCombine/stpcpy-1.ll +++ b/llvm/test/Transforms/InstCombine/stpcpy-1.ll @@ -34,7 +34,7 @@ define ptr @test_simplify2() { define void @test_simplify3(ptr %dst) { ; CHECK-LABEL: @test_simplify3( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(6) [[DST:%.*]], ptr noundef nonnull align 1 dereferenceable(6) @hello, i32 6, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(6) [[DST:%.*]], ptr noundef nonnull align 1 dereferenceable(6) @hello, i64 6, i1 false) ; CHECK-NEXT: ret void ; call ptr @stpcpy(ptr dereferenceable(80) %dst, ptr @hello) diff --git a/llvm/test/Transforms/InstCombine/strcpy-1.ll b/llvm/test/Transforms/InstCombine/strcpy-1.ll index cf78a64a4fad0..b397affc4810a 100644 --- a/llvm/test/Transforms/InstCombine/strcpy-1.ll +++ b/llvm/test/Transforms/InstCombine/strcpy-1.ll @@ -15,7 +15,7 @@ declare ptr @strcpy(ptr, ptr) define void @test_simplify1() { ; CHECK-LABEL: @test_simplify1( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(6) @a, ptr noundef nonnull align 1 dereferenceable(6) @hello, i32 6, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(6) @a, ptr noundef nonnull align 1 dereferenceable(6) @hello, i64 6, i1 false) ; CHECK-NEXT: ret void ; @@ -37,7 +37,7 @@ define ptr @test_simplify2() { define void @test_simplify3(ptr %dst) { ; CHECK-LABEL: @test_simplify3( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(80) [[DST:%.*]], ptr noundef nonnull align 1 dereferenceable(6) @hello, i32 6, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(80) [[DST:%.*]], ptr noundef nonnull align 1 dereferenceable(6) @hello, i64 6, i1 false) ; CHECK-NEXT: ret void ; @@ -70,7 +70,7 @@ define ptr @test_no_simplify2(ptr %dst, ptr %src) { define void @test_no_incompatible_attr() { ; CHECK-LABEL: @test_no_incompatible_attr( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(6) @a, ptr noundef nonnull align 1 dereferenceable(6) @hello, i32 6, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(6) @a, ptr noundef nonnull align 1 dereferenceable(6) @hello, i64 6, i1 false) ; CHECK-NEXT: ret void ; diff --git a/llvm/test/Transforms/InstCombine/strcpy-nonzero-as.ll b/llvm/test/Transforms/InstCombine/strcpy-nonzero-as.ll index 86b49ffdf04b2..9bde0a3ac3fde 100644 --- a/llvm/test/Transforms/InstCombine/strcpy-nonzero-as.ll +++ b/llvm/test/Transforms/InstCombine/strcpy-nonzero-as.ll @@ -52,7 +52,7 @@ define void @test_strncpy_to_memcpy(ptr addrspace(200) %dst) addrspace(200) noun ; CHECK-LABEL: define {{[^@]+}}@test_strncpy_to_memcpy ; CHECK-SAME: (ptr addrspace(200) [[DST:%.*]]) addrspace(200) #[[ATTR1]] { ; CHECK-NEXT: entry: -; CHECK-NEXT: call addrspace(200) void @llvm.memcpy.p200.p200.i128(ptr addrspace(200) noundef align 1 dereferenceable(17) [[DST]], ptr addrspace(200) noundef align 1 dereferenceable(17) @str, i128 17, i1 false) +; CHECK-NEXT: call addrspace(200) void @llvm.memcpy.p200.p200.i64(ptr addrspace(200) noundef align 1 dereferenceable(17) [[DST]], ptr addrspace(200) noundef align 1 dereferenceable(17) @str, i64 17, i1 false) ; CHECK-NEXT: ret void ; entry: @@ -64,7 +64,7 @@ define void @test_stpncpy_to_memcpy(ptr addrspace(200) %dst) addrspace(200) noun ; CHECK-LABEL: define {{[^@]+}}@test_stpncpy_to_memcpy ; CHECK-SAME: (ptr addrspace(200) [[DST:%.*]]) addrspace(200) #[[ATTR1]] { ; CHECK-NEXT: entry: -; CHECK-NEXT: call addrspace(200) void @llvm.memcpy.p200.p200.i128(ptr addrspace(200) noundef align 1 dereferenceable(17) [[DST]], ptr addrspace(200) noundef align 1 dereferenceable(17) @str, i128 17, i1 false) +; CHECK-NEXT: call addrspace(200) void @llvm.memcpy.p200.p200.i64(ptr addrspace(200) noundef align 1 dereferenceable(17) [[DST]], ptr addrspace(200) noundef align 1 dereferenceable(17) @str, i64 17, i1 false) ; CHECK-NEXT: ret void ; entry: diff --git a/llvm/test/Transforms/InstCombine/strcpy_chk-1.ll b/llvm/test/Transforms/InstCombine/strcpy_chk-1.ll index 7fdfa35e0d138..1cce880b1c468 100644 --- a/llvm/test/Transforms/InstCombine/strcpy_chk-1.ll +++ b/llvm/test/Transforms/InstCombine/strcpy_chk-1.ll @@ -14,7 +14,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3 define ptr @test_simplify1() { ; CHECK-LABEL: @test_simplify1( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(12) @a, ptr noundef nonnull align 1 dereferenceable(12) @.str, i32 12, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(12) @a, ptr noundef nonnull align 1 dereferenceable(12) @.str, i64 12, i1 false) ; CHECK-NEXT: ret ptr @a ; @@ -24,7 +24,7 @@ define ptr @test_simplify1() { define ptr @test_simplify1_tail() { ; CHECK-LABEL: @test_simplify1_tail( -; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(12) @a, ptr noundef nonnull align 1 dereferenceable(12) @.str, i32 12, i1 false) +; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(12) @a, ptr noundef nonnull align 1 dereferenceable(12) @.str, i64 12, i1 false) ; CHECK-NEXT: ret ptr @a ; @@ -34,7 +34,7 @@ define ptr @test_simplify1_tail() { define ptr @test_simplify2() { ; CHECK-LABEL: @test_simplify2( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(12) @a, ptr noundef nonnull align 1 dereferenceable(12) @.str, i32 12, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(12) @a, ptr noundef nonnull align 1 dereferenceable(12) @.str, i64 12, i1 false) ; CHECK-NEXT: ret ptr @a ; @@ -44,7 +44,7 @@ define ptr @test_simplify2() { define ptr @test_simplify3() { ; CHECK-LABEL: @test_simplify3( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(12) @a, ptr noundef nonnull align 1 dereferenceable(12) @.str, i32 12, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(12) @a, ptr noundef nonnull align 1 dereferenceable(12) @.str, i64 12, i1 false) ; CHECK-NEXT: ret ptr @a ; diff --git a/llvm/test/Transforms/InstCombine/strncat-2.ll b/llvm/test/Transforms/InstCombine/strncat-2.ll index 7f1199d908d39..e5d9658701b43 100644 --- a/llvm/test/Transforms/InstCombine/strncat-2.ll +++ b/llvm/test/Transforms/InstCombine/strncat-2.ll @@ -14,7 +14,7 @@ define void @test_simplify1() { ; CHECK-LABEL: @test_simplify1( ; CHECK-NEXT: [[STRLEN:%.*]] = call i32 @strlen(ptr noundef nonnull dereferenceable(1) @a) ; CHECK-NEXT: [[ENDPTR:%.*]] = getelementptr inbounds i8, ptr @a, i32 [[STRLEN]] -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(6) [[ENDPTR]], ptr noundef nonnull align 1 dereferenceable(6) @hello, i32 6, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(6) [[ENDPTR]], ptr noundef nonnull align 1 dereferenceable(6) @hello, i64 6, i1 false) ; CHECK-NEXT: ret void ; @@ -96,7 +96,7 @@ define ptr @test5(ptr %str, i32 %n) { ; CHECK-LABEL: @test5( ; CHECK-NEXT: [[STRLEN:%.*]] = call i32 @strlen(ptr noundef nonnull dereferenceable(1) [[STR:%.*]]) ; CHECK-NEXT: [[ENDPTR:%.*]] = getelementptr inbounds i8, ptr [[STR]], i32 [[STRLEN]] -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(6) [[ENDPTR]], ptr noundef nonnull align 1 dereferenceable(6) @hello, i32 6, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(6) [[ENDPTR]], ptr noundef nonnull align 1 dereferenceable(6) @hello, i64 6, i1 false) ; CHECK-NEXT: ret ptr [[STR]] ; %temp1 = call ptr @strncat(ptr %str, ptr @hello, i32 10) diff --git a/llvm/test/Transforms/InstCombine/strncpy-1.ll b/llvm/test/Transforms/InstCombine/strncpy-1.ll index 7028941e79da7..63be02ea0031e 100644 --- a/llvm/test/Transforms/InstCombine/strncpy-1.ll +++ b/llvm/test/Transforms/InstCombine/strncpy-1.ll @@ -30,7 +30,7 @@ define i32 @test_simplify1() { ; CHECK-LABEL: @test_simplify1( ; CHECK-NEXT: [[TARGET:%.*]] = alloca [1024 x i8], align 1 ; CHECK-NEXT: store i8 0, ptr [[TARGET]], align 1 -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(6) [[TARGET]], ptr noundef nonnull align 1 dereferenceable(6) @hello, i32 6, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(6) [[TARGET]], ptr noundef nonnull align 1 dereferenceable(6) @hello, i64 6, i1 false) ; CHECK-NEXT: call void @llvm.memset.p0.i32(ptr noundef nonnull align 1 dereferenceable(42) [[TARGET]], i8 0, i32 42, i1 false) ; CHECK-NEXT: call void @llvm.memset.p0.i32(ptr noundef nonnull align 1 dereferenceable(42) [[TARGET]], i8 0, i32 42, i1 false) ; CHECK-NEXT: [[TMP1:%.*]] = call i32 @puts(ptr noundef nonnull dereferenceable(1) [[TARGET]]) @@ -76,7 +76,7 @@ define ptr @test_simplify3() { define void @test_simplify4() { ; CHECK-LABEL: @test_simplify4( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(6) @a, ptr noundef nonnull align 1 dereferenceable(6) @hello, i32 6, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(6) @a, ptr noundef nonnull align 1 dereferenceable(6) @hello, i64 6, i1 false) ; CHECK-NEXT: ret void ; @@ -86,7 +86,7 @@ define void @test_simplify4() { define void @test_simplify5(ptr %dst) { ; CHECK-LABEL: @test_simplify5( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(32) [[DST:%.*]], ptr noundef nonnull align 1 dereferenceable(32) @str, i32 32, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(32) [[DST:%.*]], ptr noundef nonnull align 1 dereferenceable(32) @str, i64 32, i1 false) ; CHECK-NEXT: ret void ; call ptr @strncpy(ptr dereferenceable(8) %dst, ptr @hello, i32 32) @@ -95,7 +95,7 @@ define void @test_simplify5(ptr %dst) { define void @test_simplify6(ptr %dst) { ; CHECK-LABEL: @test_simplify6( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(80) [[DST:%.*]], ptr noundef nonnull align 1 dereferenceable(32) @str.1, i32 32, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(80) [[DST:%.*]], ptr noundef nonnull align 1 dereferenceable(32) @str.1, i64 32, i1 false) ; CHECK-NEXT: ret void ; call ptr @strncpy(ptr dereferenceable(80) %dst, ptr @hello, i32 32) @@ -132,7 +132,7 @@ define ptr @test1(ptr %dst, ptr %src, i32 %n) { define ptr @test2(ptr %dst) { ; CHECK-LABEL: @test2( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(5) [[DST:%.*]], ptr noundef nonnull align 1 dereferenceable(6) @hello, i32 5, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) [[DST:%.*]], ptr noundef nonnull align 1 dereferenceable(6) @hello, i64 5, i1 false) ; CHECK-NEXT: ret ptr [[DST]] ; %ret = call ptr @strncpy(ptr nonnull %dst, ptr nonnull @hello, i32 5) @@ -200,7 +200,7 @@ define ptr @test_no_simplify4(ptr %dst, ptr %src, i32 %count) { define void @test_no_incompatible_attr() { ; CHECK-LABEL: @test_no_incompatible_attr( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(6) @a, ptr noundef nonnull align 1 dereferenceable(6) @hello, i32 6, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(6) @a, ptr noundef nonnull align 1 dereferenceable(6) @hello, i64 6, i1 false) ; CHECK-NEXT: ret void ; diff --git a/llvm/test/Transforms/InstCombine/strncpy_chk-1.ll b/llvm/test/Transforms/InstCombine/strncpy_chk-1.ll index e97a317607332..bb82687d5622b 100644 --- a/llvm/test/Transforms/InstCombine/strncpy_chk-1.ll +++ b/llvm/test/Transforms/InstCombine/strncpy_chk-1.ll @@ -14,7 +14,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3 define ptr @test_simplify1() { ; CHECK-LABEL: @test_simplify1( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(12) @a, ptr noundef nonnull align 1 dereferenceable(12) @.str, i32 12, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(12) @a, ptr noundef nonnull align 1 dereferenceable(12) @.str, i64 12, i1 false) ; CHECK-NEXT: ret ptr @a ; @@ -24,7 +24,7 @@ define ptr @test_simplify1() { define ptr @test_simplify2() { ; CHECK-LABEL: @test_simplify2( -; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr noundef nonnull align 1 dereferenceable(12) @a, ptr noundef nonnull align 1 dereferenceable(12) @.str, i32 12, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(12) @a, ptr noundef nonnull align 1 dereferenceable(12) @.str, i64 12, i1 false) ; CHECK-NEXT: ret ptr @a ;