Index: llvm/lib/Transforms/Utils/BuildLibCalls.cpp =================================================================== --- llvm/lib/Transforms/Utils/BuildLibCalls.cpp +++ llvm/lib/Transforms/Utils/BuildLibCalls.cpp @@ -1216,6 +1216,13 @@ return B.CreateBitCast(V, B.getInt8PtrTy(AS), "cstr"); } +static void setCallingConvAndAttrs(CallInst *&CI, const Value *V) { + if (const Function *F = dyn_cast(V)) { + CI->setCallingConv(F->getCallingConv()); + CI->setAttributes(F->getAttributes()); + } +} + static Value *emitLibCall(LibFunc TheLibFunc, Type *ReturnType, ArrayRef ParamTypes, ArrayRef Operands, IRBuilderBase &B, @@ -1230,9 +1237,7 @@ FunctionCallee Callee = M->getOrInsertFunction(FuncName, FuncType); inferLibFuncAttributes(M, FuncName, *TLI); CallInst *CI = B.CreateCall(Callee, Operands, FuncName); - if (const Function *F = - dyn_cast(Callee.getCallee()->stripPointerCasts())) - CI->setCallingConv(F->getCallingConv()); + setCallingConvAndAttrs(CI, Callee.getCallee()->stripPointerCasts()); return CI; } @@ -1312,9 +1317,7 @@ Dst = castToCStr(Dst, B); Src = castToCStr(Src, B); CallInst *CI = B.CreateCall(MemCpy, {Dst, Src, Len, ObjSize}); - if (const Function *F = - dyn_cast(MemCpy.getCallee()->stripPointerCasts())) - CI->setCallingConv(F->getCallingConv()); + setCallingConvAndAttrs(CI, MemCpy.getCallee()->stripPointerCasts()); return CI; } @@ -1456,10 +1459,7 @@ CI->setAttributes(Attrs.removeAttribute(B.getContext(), AttributeList::FunctionIndex, Attribute::Speculatable)); - if (const Function *F = - dyn_cast(Callee.getCallee()->stripPointerCasts())) - CI->setCallingConv(F->getCallingConv()); - + setCallingConvAndAttrs(CI, Callee.getCallee()->stripPointerCasts()); return CI; } @@ -1501,10 +1501,7 @@ CI->setAttributes(Attrs.removeAttribute(B.getContext(), AttributeList::FunctionIndex, Attribute::Speculatable)); - if (const Function *F = - dyn_cast(Callee.getCallee()->stripPointerCasts())) - CI->setCallingConv(F->getCallingConv()); - + setCallingConvAndAttrs(CI, Callee.getCallee()->stripPointerCasts()); return CI; } @@ -1548,9 +1545,7 @@ "chari"), PutCharName); - if (const Function *F = - dyn_cast(PutChar.getCallee()->stripPointerCasts())) - CI->setCallingConv(F->getCallingConv()); + setCallingConvAndAttrs(CI, PutChar.getCallee()->stripPointerCasts()); return CI; } @@ -1565,9 +1560,7 @@ M->getOrInsertFunction(PutsName, B.getInt32Ty(), B.getInt8PtrTy()); inferLibFuncAttributes(M, PutsName, *TLI); CallInst *CI = B.CreateCall(PutS, castToCStr(Str, B), PutsName); - if (const Function *F = - dyn_cast(PutS.getCallee()->stripPointerCasts())) - CI->setCallingConv(F->getCallingConv()); + setCallingConvAndAttrs(CI, PutS.getCallee()->stripPointerCasts()); return CI; } @@ -1585,10 +1578,7 @@ Char = B.CreateIntCast(Char, B.getInt32Ty(), /*isSigned*/true, "chari"); CallInst *CI = B.CreateCall(F, {Char, File}, FPutcName); - - if (const Function *Fn = - dyn_cast(F.getCallee()->stripPointerCasts())) - CI->setCallingConv(Fn->getCallingConv()); + setCallingConvAndAttrs(CI, F.getCallee()->stripPointerCasts()); return CI; } @@ -1604,10 +1594,7 @@ if (File->getType()->isPointerTy()) inferLibFuncAttributes(M, FPutsName, *TLI); CallInst *CI = B.CreateCall(F, {castToCStr(Str, B), File}, FPutsName); - - if (const Function *Fn = - dyn_cast(F.getCallee()->stripPointerCasts())) - CI->setCallingConv(Fn->getCallingConv()); + setCallingConvAndAttrs(CI, F.getCallee()->stripPointerCasts()); return CI; } @@ -1628,10 +1615,7 @@ CallInst *CI = B.CreateCall(F, {castToCStr(Ptr, B), Size, ConstantInt::get(DL.getIntPtrType(Context), 1), File}); - - if (const Function *Fn = - dyn_cast(F.getCallee()->stripPointerCasts())) - CI->setCallingConv(Fn->getCallingConv()); + setCallingConvAndAttrs(CI, F.getCallee()->stripPointerCasts()); return CI; } @@ -1647,11 +1631,7 @@ DL.getIntPtrType(Context)); inferLibFuncAttributes(M, MallocName, *TLI); CallInst *CI = B.CreateCall(Malloc, Num, MallocName); - - if (const Function *F = - dyn_cast(Malloc.getCallee()->stripPointerCasts())) - CI->setCallingConv(F->getCallingConv()); - + setCallingConvAndAttrs(CI, Malloc.getCallee()->stripPointerCasts()); return CI; } @@ -1668,10 +1648,6 @@ CallocName, Attrs, B.getInt8PtrTy(), PtrType, PtrType); inferLibFuncAttributes(M, CallocName, TLI); CallInst *CI = B.CreateCall(Calloc, {Num, Size}, CallocName); - - if (const auto *F = - dyn_cast(Calloc.getCallee()->stripPointerCasts())) - CI->setCallingConv(F->getCallingConv()); - + setCallingConvAndAttrs(CI, Calloc.getCallee()->stripPointerCasts()); return CI; } Index: llvm/test/CodeGen/X86/no-plt-libcalls.ll =================================================================== --- llvm/test/CodeGen/X86/no-plt-libcalls.ll +++ llvm/test/CodeGen/X86/no-plt-libcalls.ll @@ -7,7 +7,7 @@ declare i32 @printf(i8*, ...) define void @printf_call() { ; CHECK-LABEL: @printf_call( -; CHECK-NEXT: [[PUTS:%.*]] = call i32 @puts(i8* nonnull dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i64 0, i64 0)) +; CHECK-NEXT: [[PUTS:%.*]] = call noundef i32 @puts(i8* nocapture noundef nonnull readonly dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i64 0, i64 0)) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: ret void ; %fmt = getelementptr [4 x i8], [4 x i8]* @percent_s, i32 0, i32 0 Index: llvm/test/Other/cgscc-libcall-update.ll =================================================================== --- llvm/test/Other/cgscc-libcall-update.ll +++ llvm/test/Other/cgscc-libcall-update.ll @@ -18,8 +18,7 @@ %tmp3 = call i64 @llvm.objectsize.i64.p0i8(i8* %tmp2, i1 false, i1 true, i1 false) %tmp4 = call i8* @__strncpy_chk(i8* %arg2, i8* %tmp2, i64 1023, i64 %tmp3) ; CHECK-NOT: call -; CHECK: call i8* @strncpy(i8* noundef nonnull dereferenceable(1) %arg2, i8* noundef nonnull dereferenceable(1) %tmp2, i64 1023) - +; CHECK: call i8* @strncpy(i8* noalias noundef nonnull returned writeonly dereferenceable(1) %arg2, i8* noalias nocapture noundef nonnull readonly dereferenceable(1) %tmp2, i64 1023) ; CHECK-NOT: call ret i8* %tmp4 Index: llvm/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll =================================================================== --- llvm/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll +++ llvm/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll @@ -13,7 +13,7 @@ ; CHECK-LABEL: @CopyEventArg( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CSTR:%.*]] = bitcast %union.anon* [[EV:%.*]] to i8* -; CHECK-NEXT: [[STRCPY:%.*]] = call i8* @strcpy(i8* noundef nonnull dereferenceable(1) undef, i8* noundef nonnull dereferenceable(1) [[CSTR]]) +; CHECK-NEXT: [[STRCPY:%.*]] = call i8* @strcpy(i8* noalias noundef nonnull returned writeonly dereferenceable(1) undef, i8* noalias nocapture noundef nonnull readonly dereferenceable(1) [[CSTR]]) #[[ATTR1:[0-9]+]] ; CHECK-NEXT: ret void ; entry: Index: llvm/test/Transforms/InstCombine/ARM/strcmp.ll =================================================================== --- llvm/test/Transforms/InstCombine/ARM/strcmp.ll +++ llvm/test/Transforms/InstCombine/ARM/strcmp.ll @@ -67,7 +67,7 @@ define arm_aapcscc i32 @test5(i1 %b) { ; CHECK-LABEL: @test5( ; CHECK-NEXT: [[STR2:%.*]] = select i1 [[B:%.*]], i8* getelementptr inbounds ([5 x i8], [5 x i8]* @hell, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @bell, i32 0, i32 0) -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(5) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8* noundef nonnull dereferenceable(5) [[STR2]], i32 5) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(5) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8* nocapture noundef nonnull dereferenceable(5) [[STR2]], i32 5) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: ret i32 [[MEMCMP]] ; @@ -145,7 +145,7 @@ define arm_aapcs_vfpcc i32 @test5_vfp(i1 %b) { ; CHECK-LABEL: @test5_vfp( ; CHECK-NEXT: [[STR2:%.*]] = select i1 [[B:%.*]], i8* getelementptr inbounds ([5 x i8], [5 x i8]* @hell, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @bell, i32 0, i32 0) -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(5) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8* noundef nonnull dereferenceable(5) [[STR2]], i32 5) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(5) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8* nocapture noundef nonnull dereferenceable(5) [[STR2]], i32 5) #[[ATTR0]] ; CHECK-NEXT: ret i32 [[MEMCMP]] ; Index: llvm/test/Transforms/InstCombine/debug-line.ll =================================================================== --- llvm/test/Transforms/InstCombine/debug-line.ll +++ llvm/test/Transforms/InstCombine/debug-line.ll @@ -4,7 +4,7 @@ @.str = private constant [3 x i8] c"%c\00" define void @foo() nounwind ssp !dbg !0 { -;CHECK: call i32 @putchar{{.+}} !dbg +;CHECK: call noundef i32 @putchar{{.+}} !dbg %1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i32 97), !dbg !5 ret void, !dbg !7 } Index: llvm/test/Transforms/InstCombine/exp2-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/exp2-1.ll +++ llvm/test/Transforms/InstCombine/exp2-1.ll @@ -15,7 +15,7 @@ define double @test_simplify1(i32 %x) { ; LDEXP32-LABEL: @test_simplify1( -; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[X:%.*]]) +; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[X:%.*]]) #[[ATTR1:[0-9]+]] ; LDEXP32-NEXT: ret double [[LDEXP]] ; ; LDEXP16-LABEL: @test_simplify1( @@ -24,7 +24,7 @@ ; LDEXP16-NEXT: ret double [[RET]] ; ; NOLDEXPF-LABEL: @test_simplify1( -; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[X:%.*]]) +; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[X:%.*]]) #[[ATTR1:[0-9]+]] ; NOLDEXPF-NEXT: ret double [[LDEXP]] ; ; NOLDEXP-LABEL: @test_simplify1( @@ -40,16 +40,16 @@ define double @test_simplify2(i16 signext %x) { ; LDEXP32-LABEL: @test_simplify2( ; LDEXP32-NEXT: [[TMP1:%.*]] = sext i16 [[X:%.*]] to i32 -; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]]) +; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) #[[ATTR1]] ; LDEXP32-NEXT: ret double [[LDEXP]] ; ; LDEXP16-LABEL: @test_simplify2( -; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 [[X:%.*]]) +; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 signext [[X:%.*]]) #[[ATTR1:[0-9]+]] ; LDEXP16-NEXT: ret double [[LDEXP]] ; ; NOLDEXPF-LABEL: @test_simplify2( ; NOLDEXPF-NEXT: [[TMP1:%.*]] = sext i16 [[X:%.*]] to i32 -; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]]) +; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) #[[ATTR1]] ; NOLDEXPF-NEXT: ret double [[LDEXP]] ; ; NOLDEXP-LABEL: @test_simplify2( @@ -65,17 +65,17 @@ define double @test_simplify3(i8 signext %x) { ; LDEXP32-LABEL: @test_simplify3( ; LDEXP32-NEXT: [[TMP1:%.*]] = sext i8 [[X:%.*]] to i32 -; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]]) +; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) #[[ATTR1]] ; LDEXP32-NEXT: ret double [[LDEXP]] ; ; LDEXP16-LABEL: @test_simplify3( ; LDEXP16-NEXT: [[TMP1:%.*]] = sext i8 [[X:%.*]] to i16 -; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 [[TMP1]]) +; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 signext [[TMP1]]) #[[ATTR1]] ; LDEXP16-NEXT: ret double [[LDEXP]] ; ; NOLDEXPF-LABEL: @test_simplify3( ; NOLDEXPF-NEXT: [[TMP1:%.*]] = sext i8 [[X:%.*]] to i32 -; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]]) +; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) #[[ATTR1]] ; NOLDEXPF-NEXT: ret double [[LDEXP]] ; ; NOLDEXP-LABEL: @test_simplify3( @@ -90,7 +90,7 @@ define float @test_simplify4(i32 %x) { ; LDEXP32-LABEL: @test_simplify4( -; LDEXP32-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 [[X:%.*]]) +; LDEXP32-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 signext [[X:%.*]]) #[[ATTR1]] ; LDEXP32-NEXT: ret float [[LDEXPF]] ; ; LDEXP16-LABEL: @test_simplify4( @@ -144,7 +144,7 @@ define double @test_simplify6(i16 zeroext %x) { ; LDEXP32-LABEL: @test_simplify6( ; LDEXP32-NEXT: [[TMP1:%.*]] = zext i16 [[X:%.*]] to i32 -; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]]) +; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) #[[ATTR1]] ; LDEXP32-NEXT: ret double [[LDEXP]] ; ; LDEXP16-LABEL: @test_simplify6( @@ -154,7 +154,7 @@ ; ; NOLDEXPF-LABEL: @test_simplify6( ; NOLDEXPF-NEXT: [[TMP1:%.*]] = zext i16 [[X:%.*]] to i32 -; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]]) +; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) #[[ATTR1]] ; NOLDEXPF-NEXT: ret double [[LDEXP]] ; ; NOLDEXP-LABEL: @test_simplify6( @@ -170,17 +170,17 @@ define double @test_simplify7(i8 zeroext %x) { ; LDEXP32-LABEL: @test_simplify7( ; LDEXP32-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32 -; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]]) +; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) #[[ATTR1]] ; LDEXP32-NEXT: ret double [[LDEXP]] ; ; LDEXP16-LABEL: @test_simplify7( ; LDEXP16-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i16 -; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 [[TMP1]]) +; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 signext [[TMP1]]) #[[ATTR1]] ; LDEXP16-NEXT: ret double [[LDEXP]] ; ; NOLDEXPF-LABEL: @test_simplify7( ; NOLDEXPF-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32 -; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]]) +; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) #[[ATTR1]] ; NOLDEXPF-NEXT: ret double [[LDEXP]] ; ; NOLDEXP-LABEL: @test_simplify7( @@ -196,12 +196,12 @@ define float @test_simplify8(i8 zeroext %x) { ; LDEXP32-LABEL: @test_simplify8( ; LDEXP32-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32 -; LDEXP32-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 [[TMP1]]) +; LDEXP32-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 signext [[TMP1]]) #[[ATTR1]] ; LDEXP32-NEXT: ret float [[LDEXPF]] ; ; LDEXP16-LABEL: @test_simplify8( ; LDEXP16-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i16 -; LDEXP16-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i16 [[TMP1]]) +; LDEXP16-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i16 signext [[TMP1]]) #[[ATTR1]] ; LDEXP16-NEXT: ret float [[LDEXPF]] ; ; NOLDEXPF-LABEL: @test_simplify8( @@ -225,17 +225,17 @@ define double @test_simplify9(i8 zeroext %x) { ; LDEXP32-LABEL: @test_simplify9( ; LDEXP32-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32 -; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]]) +; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) #[[ATTR1]] ; LDEXP32-NEXT: ret double [[LDEXP]] ; ; LDEXP16-LABEL: @test_simplify9( ; LDEXP16-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i16 -; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 [[TMP1]]) +; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 signext [[TMP1]]) #[[ATTR1]] ; LDEXP16-NEXT: ret double [[LDEXP]] ; ; NOLDEXPF-LABEL: @test_simplify9( ; NOLDEXPF-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32 -; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]]) +; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) #[[ATTR1]] ; NOLDEXPF-NEXT: ret double [[LDEXP]] ; ; NOLDEXP-LABEL: @test_simplify9( @@ -251,12 +251,12 @@ define float @test_simplify10(i8 zeroext %x) { ; LDEXP32-LABEL: @test_simplify10( ; LDEXP32-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32 -; LDEXP32-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 [[TMP1]]) +; LDEXP32-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 signext [[TMP1]]) #[[ATTR1]] ; LDEXP32-NEXT: ret float [[LDEXPF]] ; ; LDEXP16-LABEL: @test_simplify10( ; LDEXP16-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i16 -; LDEXP16-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i16 [[TMP1]]) +; LDEXP16-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i16 signext [[TMP1]]) #[[ATTR1]] ; LDEXP16-NEXT: ret float [[LDEXPF]] ; ; NOLDEXPF-LABEL: @test_simplify10( Index: llvm/test/Transforms/InstCombine/fdiv-cos-sin.ll =================================================================== --- llvm/test/Transforms/InstCombine/fdiv-cos-sin.ll +++ llvm/test/Transforms/InstCombine/fdiv-cos-sin.ll @@ -29,7 +29,7 @@ define double @fdiv_reassoc_cos_strict_sin_strict(double %a, i32* dereferenceable(2) %dummy) { ; CHECK-LABEL: @fdiv_reassoc_cos_strict_sin_strict( -; CHECK-NEXT: [[TAN:%.*]] = call reassoc double @tan(double [[A:%.*]]) #1 +; CHECK-NEXT: [[TAN:%.*]] = call reassoc double @tan(double [[A:%.*]]) ; CHECK-NEXT: [[TMP1:%.*]] = fdiv reassoc double 1.000000e+00, [[TAN]] ; CHECK-NEXT: ret double [[TMP1]] ; @@ -41,7 +41,7 @@ define double @fdiv_reassoc_cos_reassoc_sin_strict(double %a) { ; CHECK-LABEL: @fdiv_reassoc_cos_reassoc_sin_strict( -; CHECK-NEXT: [[TAN:%.*]] = call reassoc double @tan(double [[A:%.*]]) #1 +; CHECK-NEXT: [[TAN:%.*]] = call reassoc double @tan(double [[A:%.*]]) ; CHECK-NEXT: [[TMP1:%.*]] = fdiv reassoc double 1.000000e+00, [[TAN]] ; CHECK-NEXT: ret double [[TMP1]] ; @@ -68,7 +68,7 @@ define double @fdiv_cos_sin_reassoc(double %a) { ; CHECK-LABEL: @fdiv_cos_sin_reassoc( -; CHECK-NEXT: [[TAN:%.*]] = call reassoc double @tan(double [[A:%.*]]) #1 +; CHECK-NEXT: [[TAN:%.*]] = call reassoc double @tan(double [[A:%.*]]) ; CHECK-NEXT: [[TMP1:%.*]] = fdiv reassoc double 1.000000e+00, [[TAN]] ; CHECK-NEXT: ret double [[TMP1]] ; @@ -93,7 +93,7 @@ define float @fdiv_cosf_sinf_reassoc(float %a) { ; CHECK-LABEL: @fdiv_cosf_sinf_reassoc( -; CHECK-NEXT: [[TANF:%.*]] = call reassoc float @tanf(float [[A:%.*]]) #1 +; CHECK-NEXT: [[TANF:%.*]] = call reassoc float @tanf(float [[A:%.*]]) ; CHECK-NEXT: [[TMP1:%.*]] = fdiv reassoc float 1.000000e+00, [[TANF]] ; CHECK-NEXT: ret float [[TMP1]] ; @@ -105,7 +105,7 @@ define fp128 @fdiv_cosfp128_sinfp128_reassoc(fp128 %a) { ; CHECK-LABEL: @fdiv_cosfp128_sinfp128_reassoc( -; CHECK-NEXT: [[TANL:%.*]] = call reassoc fp128 @tanl(fp128 [[A:%.*]]) #1 +; CHECK-NEXT: [[TANL:%.*]] = call reassoc fp128 @tanl(fp128 [[A:%.*]]) ; CHECK-NEXT: [[TMP1:%.*]] = fdiv reassoc fp128 0xL00000000000000003FFF000000000000, [[TANL]] ; CHECK-NEXT: ret fp128 [[TMP1]] ; Index: llvm/test/Transforms/InstCombine/fdiv-sin-cos.ll =================================================================== --- llvm/test/Transforms/InstCombine/fdiv-sin-cos.ll +++ llvm/test/Transforms/InstCombine/fdiv-sin-cos.ll @@ -29,7 +29,7 @@ define double @fdiv_reassoc_sin_strict_cos_strict(double %a, i32* dereferenceable(2) %dummy) { ; CHECK-LABEL: @fdiv_reassoc_sin_strict_cos_strict( -; CHECK-NEXT: [[TAN:%.*]] = call reassoc double @tan(double [[A:%.*]]) #1 +; CHECK-NEXT: [[TAN:%.*]] = call reassoc double @tan(double [[A:%.*]]) ; CHECK-NEXT: ret double [[TAN]] ; %1 = call double @llvm.sin.f64(double %a) @@ -40,7 +40,7 @@ define double @fdiv_reassoc_sin_reassoc_cos_strict(double %a) { ; CHECK-LABEL: @fdiv_reassoc_sin_reassoc_cos_strict( -; CHECK-NEXT: [[TAN:%.*]] = call reassoc double @tan(double [[A:%.*]]) #1 +; CHECK-NEXT: [[TAN:%.*]] = call reassoc double @tan(double [[A:%.*]]) ; CHECK-NEXT: ret double [[TAN]] ; %1 = call reassoc double @llvm.sin.f64(double %a) @@ -66,7 +66,7 @@ define double @fdiv_sin_cos_reassoc(double %a) { ; CHECK-LABEL: @fdiv_sin_cos_reassoc( -; CHECK-NEXT: [[TAN:%.*]] = call reassoc double @tan(double [[A:%.*]]) #1 +; CHECK-NEXT: [[TAN:%.*]] = call reassoc double @tan(double [[A:%.*]]) ; CHECK-NEXT: ret double [[TAN]] ; %1 = call reassoc double @llvm.sin.f64(double %a) @@ -77,7 +77,7 @@ define float @fdiv_sinf_cosf_reassoc(float %a) { ; CHECK-LABEL: @fdiv_sinf_cosf_reassoc( -; CHECK-NEXT: [[TANF:%.*]] = call reassoc float @tanf(float [[A:%.*]]) #1 +; CHECK-NEXT: [[TANF:%.*]] = call reassoc float @tanf(float [[A:%.*]]) ; CHECK-NEXT: ret float [[TANF]] ; %1 = call reassoc float @llvm.sin.f32(float %a) @@ -88,7 +88,7 @@ define fp128 @fdiv_sinfp128_cosfp128_reassoc(fp128 %a) { ; CHECK-LABEL: @fdiv_sinfp128_cosfp128_reassoc( -; CHECK-NEXT: [[TANL:%.*]] = call reassoc fp128 @tanl(fp128 [[A:%.*]]) #1 +; CHECK-NEXT: [[TANL:%.*]] = call reassoc fp128 @tanl(fp128 [[A:%.*]]) ; CHECK-NEXT: ret fp128 [[TANL]] ; %1 = call reassoc fp128 @llvm.sin.fp128(fp128 %a) Index: llvm/test/Transforms/InstCombine/float-shrink-compare.ll =================================================================== --- llvm/test/Transforms/InstCombine/float-shrink-compare.ll +++ llvm/test/Transforms/InstCombine/float-shrink-compare.ll @@ -5,8 +5,8 @@ define i1 @test1(float %x, float %y) { ; CHECK-LABEL: @test1( -; CHECK-NEXT: [[CEIL:%.*]] = call float @llvm.ceil.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[CEIL]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.ceil.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -18,8 +18,8 @@ define i1 @test1_intrin(float %x, float %y) { ; CHECK-LABEL: @test1_intrin( -; CHECK-NEXT: [[CEIL:%.*]] = call float @llvm.ceil.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[CEIL]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.ceil.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -31,8 +31,8 @@ define i1 @test2(float %x, float %y) { ; CHECK-LABEL: @test2( -; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[FABS]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -44,8 +44,8 @@ define i1 @test2_intrin(float %x, float %y) { ; CHECK-LABEL: @test2_intrin( -; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[FABS]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -57,8 +57,8 @@ define i1 @fmf_test2(float %x, float %y) { ; CHECK-LABEL: @fmf_test2( -; CHECK-NEXT: [[TMP1:%.*]] = call nnan float @llvm.fabs.f32(float %x) -; CHECK-NEXT: [[TMP2:%.*]] = fcmp oeq float [[TMP1]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call nnan float @llvm.fabs.f32(float [[X:%.*]]) +; CHECK-NEXT: [[TMP2:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[TMP2]] ; %1 = fpext float %x to double @@ -70,8 +70,8 @@ define i1 @test3(float %x, float %y) { ; CHECK-LABEL: @test3( -; CHECK-NEXT: [[FLOOR:%.*]] = call float @llvm.floor.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[FLOOR]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.floor.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -84,8 +84,8 @@ define i1 @test3_intrin(float %x, float %y) { ; CHECK-LABEL: @test3_intrin( -; CHECK-NEXT: [[FLOOR:%.*]] = call float @llvm.floor.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[FLOOR]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.floor.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -97,8 +97,8 @@ define i1 @test4(float %x, float %y) { ; CHECK-LABEL: @test4( -; CHECK-NEXT: [[NEARBYINT:%.*]] = call float @llvm.nearbyint.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[NEARBYINT]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.nearbyint.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -110,8 +110,8 @@ define i1 @shrink_nearbyint_intrin(float %x, float %y) { ; CHECK-LABEL: @shrink_nearbyint_intrin( -; CHECK-NEXT: [[NEARBYINT:%.*]] = call float @llvm.nearbyint.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[NEARBYINT]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.nearbyint.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -123,8 +123,8 @@ define i1 @test5(float %x, float %y) { ; CHECK-LABEL: @test5( -; CHECK-NEXT: [[RINT:%.*]] = call float @llvm.rint.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[RINT]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.rint.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -136,8 +136,8 @@ define i1 @test6(float %x, float %y) { ; CHECK-LABEL: @test6( -; CHECK-NEXT: [[ROUND:%.*]] = call float @llvm.round.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[ROUND]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.round.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -149,8 +149,8 @@ define i1 @test6_intrin(float %x, float %y) { ; CHECK-LABEL: @test6_intrin( -; CHECK-NEXT: [[ROUND:%.*]] = call float @llvm.round.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[ROUND]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.round.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -162,8 +162,8 @@ define i1 @test6a(float %x, float %y) { ; CHECK-LABEL: @test6a( -; CHECK-NEXT: [[ROUND:%.*]] = call float @llvm.roundeven.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[ROUND]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.roundeven.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -175,8 +175,8 @@ define i1 @test6a_intrin(float %x, float %y) { ; CHECK-LABEL: @test6a_intrin( -; CHECK-NEXT: [[ROUND:%.*]] = call float @llvm.roundeven.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[ROUND]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.roundeven.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -188,8 +188,8 @@ define i1 @test7(float %x, float %y) { ; CHECK-LABEL: @test7( -; CHECK-NEXT: [[TRUNC:%.*]] = call float @llvm.trunc.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TRUNC]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.trunc.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -201,8 +201,8 @@ define i1 @test7_intrin(float %x, float %y) { ; CHECK-LABEL: @test7_intrin( -; CHECK-NEXT: [[TRUNC:%.*]] = call float @llvm.trunc.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TRUNC]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.trunc.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -214,8 +214,8 @@ define i1 @test8(float %x, float %y) { ; CHECK-LABEL: @test8( -; CHECK-NEXT: [[CEIL:%.*]] = call float @llvm.ceil.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[CEIL]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.ceil.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -227,8 +227,8 @@ define i1 @test8_intrin(float %x, float %y) { ; CHECK-LABEL: @test8_intrin( -; CHECK-NEXT: [[CEIL:%.*]] = call float @llvm.ceil.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[CEIL]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.ceil.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -240,8 +240,8 @@ define i1 @test9(float %x, float %y) { ; CHECK-LABEL: @test9( -; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[FABS]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -253,8 +253,8 @@ define i1 @test9_intrin(float %x, float %y) { ; CHECK-LABEL: @test9_intrin( -; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[FABS]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -266,8 +266,8 @@ define i1 @test10(float %x, float %y) { ; CHECK-LABEL: @test10( -; CHECK-NEXT: [[FLOOR:%.*]] = call float @llvm.floor.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[FLOOR]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.floor.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -279,8 +279,8 @@ define i1 @test10_intrin(float %x, float %y) { ; CHECK-LABEL: @test10_intrin( -; CHECK-NEXT: [[FLOOR:%.*]] = call float @llvm.floor.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[FLOOR]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.floor.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -292,8 +292,8 @@ define i1 @test11(float %x, float %y) { ; CHECK-LABEL: @test11( -; CHECK-NEXT: [[NEARBYINT:%.*]] = call float @llvm.nearbyint.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[NEARBYINT]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.nearbyint.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -305,8 +305,8 @@ define i1 @test11_intrin(float %x, float %y) { ; CHECK-LABEL: @test11_intrin( -; CHECK-NEXT: [[NEARBYINT:%.*]] = call float @llvm.nearbyint.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[NEARBYINT]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.nearbyint.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -318,8 +318,8 @@ define i1 @test12(float %x, float %y) { ; CHECK-LABEL: @test12( -; CHECK-NEXT: [[RINT:%.*]] = call float @llvm.rint.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[RINT]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.rint.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -331,8 +331,8 @@ define i1 @test13(float %x, float %y) { ; CHECK-LABEL: @test13( -; CHECK-NEXT: [[ROUND:%.*]] = call float @llvm.round.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[ROUND]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.round.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -344,8 +344,8 @@ define i1 @test13_intrin(float %x, float %y) { ; CHECK-LABEL: @test13_intrin( -; CHECK-NEXT: [[ROUND:%.*]] = call float @llvm.round.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[ROUND]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.round.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -357,8 +357,8 @@ define i1 @test13a(float %x, float %y) { ; CHECK-LABEL: @test13a( -; CHECK-NEXT: [[ROUND:%.*]] = call float @llvm.roundeven.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[ROUND]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.roundeven.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -370,8 +370,8 @@ define i1 @test13a_intrin(float %x, float %y) { ; CHECK-LABEL: @test13a_intrin( -; CHECK-NEXT: [[ROUND:%.*]] = call float @llvm.roundeven.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[ROUND]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.roundeven.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -383,8 +383,8 @@ define i1 @test14(float %x, float %y) { ; CHECK-LABEL: @test14( -; CHECK-NEXT: [[TRUNC:%.*]] = call float @llvm.trunc.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TRUNC]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.trunc.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -396,8 +396,8 @@ define i1 @test14_intrin(float %x, float %y) { ; CHECK-LABEL: @test14_intrin( -; CHECK-NEXT: [[TRUNC:%.*]] = call float @llvm.trunc.f32(float %x) -; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TRUNC]], %y +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.trunc.f32(float [[X:%.*]]) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[TMP1]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; %x.ext = fpext float %x to double @@ -465,8 +465,8 @@ define i1 @test19(float %x, float %y, float %z) { ; CHECK-LABEL: @test19( -; CHECK-NEXT: [[COPYSIGNF:%.*]] = call float @copysignf(float %x, float %y) #0 -; CHECK-NEXT: [[TMP1:%.*]] = fcmp oeq float [[COPYSIGNF]], %z +; CHECK-NEXT: [[COPYSIGNF:%.*]] = call float @copysignf(float [[X:%.*]], float [[Y:%.*]]) +; CHECK-NEXT: [[TMP1:%.*]] = fcmp oeq float [[COPYSIGNF]], [[Z:%.*]] ; CHECK-NEXT: ret i1 [[TMP1]] ; %1 = fpext float %x to double Index: llvm/test/Transforms/InstCombine/fortify-folding.ll =================================================================== --- llvm/test/Transforms/InstCombine/fortify-folding.ll +++ llvm/test/Transforms/InstCombine/fortify-folding.ll @@ -11,7 +11,7 @@ define i8* @test_memccpy() { ; CHECK-LABEL: @test_memccpy( -; CHECK-NEXT: [[MEMCCPY:%.*]] = call i8* @memccpy(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i32 0, i64 60) +; CHECK-NEXT: [[MEMCCPY:%.*]] = call i8* @memccpy(i8* noalias writeonly getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* noalias nocapture readonly getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i32 0, i64 60) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: ret i8* [[MEMCCPY]] ; %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0 @@ -55,7 +55,7 @@ define i32 @test_snprintf() { ; CHECK-LABEL: @test_snprintf( -; CHECK-NEXT: [[SNPRINTF:%.*]] = call i32 (i8*, i64, i8*, ...) @snprintf(i8* nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i64 60, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0)) +; CHECK-NEXT: [[SNPRINTF:%.*]] = call noundef i32 (i8*, i64, i8*, ...) @snprintf(i8* noalias nocapture noundef nonnull writeonly dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i64 noundef 60, i8* nocapture noundef readonly getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0)) #[[ATTR1:[0-9]+]] ; CHECK-NEXT: ret i32 [[SNPRINTF]] ; %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0 @@ -79,7 +79,7 @@ define i32 @test_sprintf() { ; CHECK-LABEL: @test_sprintf( -; CHECK-NEXT: [[SPRINTF:%.*]] = call i32 (i8*, i8*, ...) @sprintf(i8* nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0)) +; CHECK-NEXT: [[SPRINTF:%.*]] = call noundef i32 (i8*, i8*, ...) @sprintf(i8* noalias nocapture noundef nonnull writeonly dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* nocapture noundef nonnull readonly dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0)) #[[ATTR1]] ; CHECK-NEXT: ret i32 [[SPRINTF]] ; %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0 @@ -103,7 +103,7 @@ define i8* @test_strcat() { ; CHECK-LABEL: @test_strcat( -; CHECK-NEXT: [[STRCAT:%.*]] = call i8* @strcat(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0)) +; CHECK-NEXT: [[STRCAT:%.*]] = call i8* @strcat(i8* noalias noundef nonnull returned dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* noalias nocapture noundef nonnull readonly dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0)) #[[ATTR0]] ; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0) ; %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0 @@ -125,7 +125,7 @@ define i64 @test_strlcat() { ; CHECK-LABEL: @test_strlcat( -; CHECK-NEXT: [[STRLCAT:%.*]] = call i64 @strlcat(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 22) +; CHECK-NEXT: [[STRLCAT:%.*]] = call i64 @strlcat(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 22) #[[ATTR2:[0-9]+]] ; CHECK-NEXT: ret i64 [[STRLCAT]] ; %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0 @@ -147,7 +147,7 @@ define i8* @test_strncat() { ; CHECK-LABEL: @test_strncat( -; CHECK-NEXT: [[STRNCAT:%.*]] = call i8* @strncat(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 22) +; CHECK-NEXT: [[STRNCAT:%.*]] = call i8* @strncat(i8* noalias noundef nonnull returned dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* noalias nocapture noundef nonnull readonly dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 22) #[[ATTR0]] ; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0) ; %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0 @@ -169,7 +169,7 @@ define i64 @test_strlcpy() { ; CHECK-LABEL: @test_strlcpy( -; CHECK-NEXT: [[STRLCPY:%.*]] = call i64 @strlcpy(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 22) +; CHECK-NEXT: [[STRLCPY:%.*]] = call i64 @strlcpy(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 22) #[[ATTR2]] ; CHECK-NEXT: ret i64 [[STRLCPY]] ; %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0 @@ -191,7 +191,7 @@ define i32 @test_vsnprintf() { ; CHECK-LABEL: @test_vsnprintf( -; CHECK-NEXT: [[VSNPRINTF:%.*]] = call i32 @vsnprintf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i64 4, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), %struct.__va_list_tag* null) +; CHECK-NEXT: [[VSNPRINTF:%.*]] = call noundef i32 @vsnprintf(i8* nocapture noundef getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i64 noundef 4, i8* nocapture noundef readonly getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), %struct.__va_list_tag* noundef null) #[[ATTR1]] ; CHECK-NEXT: ret i32 [[VSNPRINTF]] ; ; ret i32 @@ -217,7 +217,7 @@ define i32 @test_vsprintf() { ; CHECK-LABEL: @test_vsprintf( -; CHECK-NEXT: [[VSPRINTF:%.*]] = call i32 @vsprintf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), %struct.__va_list_tag* null) +; CHECK-NEXT: [[VSPRINTF:%.*]] = call noundef i32 @vsprintf(i8* nocapture noundef getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* nocapture noundef readonly getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), %struct.__va_list_tag* noundef null) #[[ATTR1]] ; CHECK-NEXT: ret i32 [[VSPRINTF]] ; ; ret i32 Index: llvm/test/Transforms/InstCombine/fprintf-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/fprintf-1.ll +++ llvm/test/Transforms/InstCombine/fprintf-1.ll @@ -21,7 +21,7 @@ ; CHECK-LABEL: @test_simplify1( %fmt = getelementptr [13 x i8], [13 x i8]* @hello_world, i32 0, i32 0 call i32 (%FILE*, i8*, ...) @fprintf(%FILE* %fp, i8* %fmt) -; CHECK-NEXT: call i32 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32 0), i32 12, i32 1, %FILE* %fp) +; CHECK-NEXT:call noundef i32 @fwrite(i8* nocapture noundef getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32 0), i32 noundef 12, i32 noundef 1, %FILE* nocapture noundef %fp) #0 ret void ; CHECK-NEXT: ret void } @@ -32,7 +32,7 @@ ; CHECK-LABEL: @test_simplify2( %fmt = getelementptr [3 x i8], [3 x i8]* @percent_c, i32 0, i32 0 call i32 (%FILE*, i8*, ...) @fprintf(%FILE* %fp, i8* %fmt, i8 104) -; CHECK-NEXT: call i32 @fputc(i32 104, %FILE* %fp) +; CHECK-NEXT: call noundef i32 @fputc(i32 noundef 104, %FILE* nocapture noundef %fp) #0 ret void ; CHECK-NEXT: ret void } @@ -45,7 +45,7 @@ %fmt = getelementptr [3 x i8], [3 x i8]* @percent_s, i32 0, i32 0 %str = getelementptr [13 x i8], [13 x i8]* @hello_world, i32 0, i32 0 call i32 (%FILE*, i8*, ...) @fprintf(%FILE* %fp, i8* %fmt, i8* %str) -; CHECK-NEXT: call i32 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32 0), i32 12, i32 1, %FILE* %fp) +; CHECK-NEXT: call noundef i32 @fwrite(i8* nocapture noundef getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32 0), i32 noundef 12, i32 noundef 1, %FILE* nocapture noundef %fp) #0 ret void ; CHECK-NEXT: ret void } @@ -65,7 +65,7 @@ ; CHECK-LABEL: @test_simplify5( %fmt = getelementptr [13 x i8], [13 x i8]* @hello_world, i32 0, i32 0 call i32 (%FILE*, i8*, ...) @fprintf(%FILE* %fp, i8* %fmt) [ "deopt"() ] -; CHECK-NEXT: call i32 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32 0), i32 12, i32 1, %FILE* %fp) [ "deopt"() ] +; CHECK-NEXT: call noundef i32 @fwrite(i8* nocapture noundef getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32 0), i32 noundef 12, i32 noundef 1, %FILE* nocapture noundef %fp) #0 ret void ; CHECK-NEXT: ret void } Index: llvm/test/Transforms/InstCombine/fputs-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/fputs-1.ll +++ llvm/test/Transforms/InstCombine/fputs-1.ll @@ -28,7 +28,7 @@ ; CHECK-LABEL: @test_simplify2( %str = getelementptr [2 x i8], [2 x i8]* @A, i32 0, i32 0 call i32 @fputs(i8* %str, %FILE* %fp) -; CHECK-NEXT: call i32 @fputc(i32 65, %FILE* %fp) +; CHECK-NEXT: call noundef i32 @fputc(i32 noundef 65, %FILE* nocapture noundef %fp) #0 ret void ; CHECK-NEXT: ret void } @@ -37,7 +37,7 @@ ; CHECK-LABEL: @test_simplify3( %str = getelementptr [7 x i8], [7 x i8]* @hello, i32 0, i32 0 call i32 @fputs(i8* %str, %FILE* %fp) -; CHECK-NEXT: call i32 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @hello, i32 0, i32 0), i32 6, i32 1, %FILE* %fp) +; CHECK-NEXT: call noundef i32 @fwrite(i8* nocapture noundef getelementptr inbounds ([7 x i8], [7 x i8]* @hello, i32 0, i32 0), i32 noundef 6, i32 noundef 1, %FILE* nocapture noundef %fp) #0 ret void ; CHECK-NEXT: ret void } Index: llvm/test/Transforms/InstCombine/fputs-opt-size.ll =================================================================== --- llvm/test/Transforms/InstCombine/fputs-opt-size.ll +++ llvm/test/Transforms/InstCombine/fputs-opt-size.ll @@ -36,7 +36,7 @@ ; PGSO-NOT: call i64 @fwrite ; PGSO: call i32 @fputs ; NPGSO-LABEL: @main_pgso( -; NPGSO: call i64 @fwrite +; NPGSO: call noundef i64 @fwrite ; NPGSO-NOT: call i32 @fputs %call = tail call %struct._IO_FILE* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0)) #2 Index: llvm/test/Transforms/InstCombine/fwrite-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/fwrite-1.ll +++ llvm/test/Transforms/InstCombine/fwrite-1.ll @@ -17,7 +17,7 @@ ; CHECK-LABEL: @test_simplify1( %str = getelementptr inbounds [1 x i8], [1 x i8]* @str, i64 0, i64 0 call i64 @fwrite(i8* %str, i64 1, i64 1, %FILE* %fp) -; CHECK-NEXT: call i32 @fputc(i32 0, %FILE* %fp) +; CHECK-NEXT: call noundef i32 @fputc(i32 noundef 0, %FILE* nocapture noundef %fp) #0 ret void ; CHECK-NEXT: ret void } Index: llvm/test/Transforms/InstCombine/libcall-param-attrs.ll =================================================================== --- /dev/null +++ llvm/test/Transforms/InstCombine/libcall-param-attrs.ll @@ -0,0 +1,29 @@ +; RUN: opt < %s -mtriple=s390x-linux-gnu -instcombine -S | FileCheck %s +; +; Check that instcombiner creates libcalls with parameter extensions per the +; prototype. + +declare dso_local i8* @strchr(i8*, i32) local_unnamed_addr #1 +declare dso_local i8* @memchr(i8*, i32 signext, i64) +declare void @llvm.assume(i1 noundef) +@0 = private unnamed_addr constant [21 x i8] c"000000000000000000000", align 2 +define void @fun0(i32 %arg1) { +; CHECK: define void @fun0 +; CHECK: call i8* @memchr{{.*}}, i32 signext %arg1, i64 22) +bb: + %i = call i8* @strchr(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @0, i64 0, i64 0), i32 signext %arg1) + %i3 = icmp ne i8* %i, null + call void @llvm.assume(i1 %i3) + ret void +} + +declare dso_local double @pow(double, double) +define void @fun1(i32* %i5) { +; CHECK: define void @fun1 +; CHECK: call double @ldexp{{.*}}, i32 signext %i19) +bb: + %i19 = load i32, i32* %i5, align 4 + %i20 = sitofp i32 %i19 to double + %i21 = call double @pow(double 2.000000e+00, double %i20) + ret void +} Index: llvm/test/Transforms/InstCombine/memcmp-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/memcmp-1.ll +++ llvm/test/Transforms/InstCombine/memcmp-1.ll @@ -141,7 +141,7 @@ ; NOBCMP-NEXT: ret i1 [[CMP]] ; ; BCMP-LABEL: @test_simplify10( -; BCMP-NEXT: [[CALL:%.*]] = call i32 @bcmp(i8* %mem1, i8* %mem2, i32 %size) +; BCMP-NEXT: [[CALL:%.*]] = call i32 @bcmp(i8* nocapture %mem1, i8* nocapture %mem2, i32 %size) #0 ; BCMP-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0 ; BCMP-NEXT: ret i1 [[CMP]] ; Index: llvm/test/Transforms/InstCombine/memset-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/memset-1.ll +++ llvm/test/Transforms/InstCombine/memset-1.ll @@ -23,7 +23,7 @@ define i8* @pr25892_lite(i32 %size) #0 { ; CHECK-LABEL: @pr25892_lite( -; CHECK-NEXT: [[CALLOC:%.*]] = call i8* @calloc(i32 1, i32 [[SIZE:%.*]]) +; CHECK-NEXT: [[CALLOC:%.*]] = call noalias noundef i8* @calloc(i32 noundef 1, i32 noundef [[SIZE:%.*]]) #[[ATTR3:[0-9]+]] ; CHECK-NEXT: ret i8* [[CALLOC]] ; %call1 = call i8* @malloc(i32 %size) #1 @@ -48,8 +48,8 @@ define i8* @notmalloc_memset(i32 %size, i8*(i32)* %notmalloc) { ; CHECK-LABEL: @notmalloc_memset( -; CHECK-NEXT: [[CALL1:%.*]] = call i8* [[NOTMALLOC:%.*]](i32 [[SIZE:%.*]]) [[ATTR0:#.*]] -; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* align 1 [[CALL1]], i8 0, i32 [[SIZE]], i1 false) [[ATTR0]] +; CHECK-NEXT: [[CALL1:%.*]] = call i8* [[NOTMALLOC:%.*]](i32 [[SIZE:%.*]]) #[[ATTR0:[0-9]+]] +; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* align 1 [[CALL1]], i8 0, i32 [[SIZE]], i1 false) #[[ATTR0]] ; CHECK-NEXT: ret i8* [[CALL1]] ; %call1 = call i8* %notmalloc(i32 %size) #1 @@ -63,12 +63,12 @@ define float* @pr25892(i32 %size) #0 { ; CHECK-LABEL: @pr25892( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @malloc(i32 [[SIZE:%.*]]) [[ATTR0]] +; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @malloc(i32 [[SIZE:%.*]]) #[[ATTR0]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8* [[CALL]], null ; CHECK-NEXT: br i1 [[CMP]], label [[CLEANUP:%.*]], label [[IF_END:%.*]] ; CHECK: if.end: ; CHECK-NEXT: [[BC:%.*]] = bitcast i8* [[CALL]] to float* -; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* nonnull align 1 [[CALL]], i8 0, i32 [[SIZE]], i1 false) [[ATTR0]] +; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* nonnull align 1 [[CALL]], i8 0, i32 [[SIZE]], i1 false) #[[ATTR0]] ; CHECK-NEXT: br label [[CLEANUP]] ; CHECK: cleanup: ; CHECK-NEXT: [[RETVAL_0:%.*]] = phi float* [ [[BC]], [[IF_END]] ], [ null, [[ENTRY:%.*]] ] @@ -91,9 +91,9 @@ define i8* @buffer_is_modified_then_memset(i32 %size) { ; CHECK-LABEL: @buffer_is_modified_then_memset( -; CHECK-NEXT: [[PTR:%.*]] = tail call i8* @malloc(i32 [[SIZE:%.*]]) [[ATTR0]] +; CHECK-NEXT: [[PTR:%.*]] = tail call i8* @malloc(i32 [[SIZE:%.*]]) #[[ATTR0]] ; CHECK-NEXT: store i8 1, i8* [[PTR]], align 1 -; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* nonnull align 1 [[PTR]], i8 0, i32 [[SIZE]], i1 false) [[ATTR0]] +; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* nonnull align 1 [[PTR]], i8 0, i32 [[SIZE]], i1 false) #[[ATTR0]] ; CHECK-NEXT: ret i8* [[PTR]] ; %ptr = tail call i8* @malloc(i32 %size) #1 @@ -105,7 +105,7 @@ define i8* @memset_size_select(i1 %b, i8* %ptr) { ; CHECK-LABEL: @memset_size_select( ; CHECK-NEXT: [[SIZE:%.*]] = select i1 [[B:%.*]], i32 10, i32 50 -; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* noundef nonnull align 1 dereferenceable(10) [[PTR:%.*]], i8 0, i32 [[SIZE]], i1 false) [[ATTR0]] +; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* noundef nonnull align 1 dereferenceable(10) [[PTR:%.*]], i8 0, i32 [[SIZE]], i1 false) #[[ATTR0]] ; CHECK-NEXT: ret i8* [[PTR]] ; %size = select i1 %b, i32 10, i32 50 @@ -117,7 +117,7 @@ define i8* @memset_size_select2(i1 %b, i8* %ptr) { ; CHECK-LABEL: @memset_size_select2( ; CHECK-NEXT: [[SIZE:%.*]] = select i1 [[B:%.*]], i32 10, i32 50 -; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* noundef nonnull align 1 dereferenceable(80) [[PTR:%.*]], i8 0, i32 [[SIZE]], i1 false) [[ATTR0]] +; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* noundef nonnull align 1 dereferenceable(80) [[PTR:%.*]], i8 0, i32 [[SIZE]], i1 false) #[[ATTR0]] ; CHECK-NEXT: ret i8* [[PTR]] ; %size = select i1 %b, i32 10, i32 50 @@ -139,7 +139,7 @@ define i8* @memset_size_select4(i1 %b, i8* %ptr) { ; CHECK-LABEL: @memset_size_select4( ; CHECK-NEXT: [[SIZE:%.*]] = select i1 [[B:%.*]], i32 10, i32 50 -; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* noundef nonnull align 1 dereferenceable(40) [[PTR:%.*]], i8 0, i32 [[SIZE]], i1 false) [[ATTR0]] +; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* noundef nonnull align 1 dereferenceable(40) [[PTR:%.*]], i8 0, i32 [[SIZE]], i1 false) #[[ATTR0]] ; CHECK-NEXT: ret i8* [[PTR]] ; %size = select i1 %b, i32 10, i32 50 @@ -150,7 +150,7 @@ define i8* @memset_size_ashr(i1 %b, i8* %ptr, i32 %v) { ; CHECK-LABEL: @memset_size_ashr( ; CHECK-NEXT: [[SIZE:%.*]] = ashr i32 -2, [[V:%.*]] -; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* noundef nonnull align 1 [[PTR:%.*]], i8 0, i32 [[SIZE]], i1 false) [[ATTR0]] +; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* noundef nonnull align 1 [[PTR:%.*]], i8 0, i32 [[SIZE]], i1 false) #[[ATTR0]] ; CHECK-NEXT: ret i8* [[PTR]] ; %size = ashr i32 -2, %v @@ -160,7 +160,7 @@ define i8* @memset_attrs1(i1 %b, i8* %ptr, i32 %size) { ; CHECK-LABEL: @memset_attrs1( -; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* align 1 dereferenceable_or_null(40) [[PTR:%.*]], i8 0, i32 [[SIZE:%.*]], i1 false) [[ATTR0]] +; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* align 1 dereferenceable_or_null(40) [[PTR:%.*]], i8 0, i32 [[SIZE:%.*]], i1 false) #[[ATTR0]] ; CHECK-NEXT: ret i8* [[PTR]] ; %memset = tail call i8* @memset(i8* dereferenceable_or_null(40) %ptr, i32 0, i32 %size) #1 @@ -171,7 +171,7 @@ ; do not change dereferenceable attribute define i8* @memset_attrs2(i1 %b, i8* %ptr, i32 %size) { ; CHECK-LABEL: @memset_attrs2( -; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* nonnull align 1 dereferenceable(40) [[PTR:%.*]], i8 0, i32 [[SIZE:%.*]], i1 false) [[ATTR0]] +; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* nonnull align 1 dereferenceable(40) [[PTR:%.*]], i8 0, i32 [[SIZE:%.*]], i1 false) #[[ATTR0]] ; CHECK-NEXT: ret i8* [[PTR]] ; %memset = tail call i8* @memset(i8* nonnull dereferenceable(40) %ptr, i32 0, i32 %size) #1 @@ -181,7 +181,7 @@ ; size is unknown, just copy attrs, no changes in attrs define i8* @memset_attrs3(i1 %b, i8* %ptr, i32 %size) { ; CHECK-LABEL: @memset_attrs3( -; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* nonnull align 1 dereferenceable_or_null(40) [[PTR:%.*]], i8 0, i32 [[SIZE:%.*]], i1 false) [[ATTR0]] +; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* nonnull align 1 dereferenceable_or_null(40) [[PTR:%.*]], i8 0, i32 [[SIZE:%.*]], i1 false) #[[ATTR0]] ; CHECK-NEXT: ret i8* [[PTR]] ; %memset = tail call i8* @memset(i8* nonnull dereferenceable_or_null(40) %ptr, i32 0, i32 %size) #1 @@ -191,7 +191,7 @@ ; be sure to drop nonnull since size is unknown and can be 0 define i8* @memset_attrs4(i1 %b, i8* %ptr, i32 %size) { ; CHECK-LABEL: @memset_attrs4( -; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* nonnull align 1 [[PTR:%.*]], i8 0, i32 [[SIZE:%.*]], i1 false) [[ATTR0]] +; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* nonnull align 1 [[PTR:%.*]], i8 0, i32 [[SIZE:%.*]], i1 false) #[[ATTR0]] ; CHECK-NEXT: ret i8* [[PTR]] ; %memset = tail call i8* @memset(i8* nonnull %ptr, i32 0, i32 %size) #1 Index: llvm/test/Transforms/InstCombine/memset_chk-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/memset_chk-1.ll +++ llvm/test/Transforms/InstCombine/memset_chk-1.ll @@ -77,7 +77,7 @@ ; CHECK-NEXT: [[ADD180:%.*]] = add i64 [[CALL49]], 1 ; CHECK-NEXT: [[YO107:%.*]] = call i64 @llvm.objectsize.i64.p0i8(i8* [[B:%.*]], i1 false, i1 false, i1 false) ; CHECK-NEXT: [[CALL50:%.*]] = call i8* @__memmove_chk(i8* [[B]], i8* [[A]], i64 [[ADD180]], i64 [[YO107]]) -; CHECK-NEXT: [[STRLEN:%.*]] = call i64 @strlen(i8* noundef nonnull dereferenceable(1) [[B]]) +; CHECK-NEXT: [[STRLEN:%.*]] = call i64 @strlen(i8* nocapture noundef nonnull dereferenceable(1) [[B]]) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: [[STRCHR1:%.*]] = getelementptr i8, i8* [[B]], i64 [[STRLEN]] ; CHECK-NEXT: [[D:%.*]] = load i8*, i8** [[C:%.*]], align 8 ; CHECK-NEXT: [[SUB182:%.*]] = ptrtoint i8* [[D]] to i64 @@ -114,13 +114,13 @@ define float* @pr25892(i64 %size) #0 { ; CHECK-LABEL: @pr25892( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @malloc(i64 [[SIZE:%.*]]) [[ATTR3:#.*]] +; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @malloc(i64 [[SIZE:%.*]]) #[[ATTR3:[0-9]+]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8* [[CALL]], null ; CHECK-NEXT: br i1 [[CMP]], label [[CLEANUP:%.*]], label [[IF_END:%.*]] ; CHECK: if.end: ; CHECK-NEXT: [[BC:%.*]] = bitcast i8* [[CALL]] to float* ; CHECK-NEXT: [[CALL2:%.*]] = tail call i64 @llvm.objectsize.i64.p0i8(i8* nonnull [[CALL]], i1 false, i1 false, i1 false) -; CHECK-NEXT: [[CALL3:%.*]] = tail call i8* @__memset_chk(i8* nonnull [[CALL]], i32 0, i64 [[SIZE]], i64 [[CALL2]]) [[ATTR3]] +; CHECK-NEXT: [[CALL3:%.*]] = tail call i8* @__memset_chk(i8* nonnull [[CALL]], i32 0, i64 [[SIZE]], i64 [[CALL2]]) #[[ATTR3]] ; CHECK-NEXT: br label [[CLEANUP]] ; CHECK: cleanup: ; CHECK-NEXT: [[RETVAL_0:%.*]] = phi float* [ [[BC]], [[IF_END]] ], [ null, [[ENTRY:%.*]] ] Index: llvm/test/Transforms/InstCombine/objsize.ll =================================================================== --- llvm/test/Transforms/InstCombine/objsize.ll +++ llvm/test/Transforms/InstCombine/objsize.ll @@ -85,7 +85,7 @@ } @.str5 = private constant [9 x i32] [i32 97, i32 98, i32 99, i32 100, i32 0, i32 - 101, i32 102, i32 103, i32 0], align 4 + 101, i32 102, i32 103, i32 0], align 4 define i32 @test2() nounwind { ; CHECK-LABEL: @test2( ; CHECK-NEXT: ret i32 34 @@ -112,7 +112,7 @@ ; CHECK: bb11: ; CHECK-NEXT: unreachable ; CHECK: bb12: -; CHECK-NEXT: [[TMP0:%.*]] = call i8* @__inline_memcpy_chk(i8* bitcast (float* getelementptr inbounds ([480 x float], [480 x float]* @array, i32 0, i32 1) to i8*), i8* undef, i32 512) [[ATTR3:#.*]] +; CHECK-NEXT: [[TMP0:%.*]] = call i8* @__inline_memcpy_chk(i8* bitcast (float* getelementptr inbounds ([480 x float], [480 x float]* @array, i32 0, i32 1) to i8*), i8* undef, i32 512) #[[ATTR3:[0-9]+]] ; CHECK-NEXT: unreachable ; entry: @@ -141,7 +141,7 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: [[TMP0:%.*]] = alloca [[STRUCT_DATA:%.*]], align 8 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast %struct.data* [[TMP0]] to i8* -; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* noundef nonnull align 8 dereferenceable(1824) [[TMP1]], i8 0, i32 1824, i1 false) [[ATTR0:#.*]] +; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* noundef nonnull align 8 dereferenceable(1824) [[TMP1]], i8 0, i32 1824, i1 false) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i8** [[ESC:%.*]] to %struct.data** ; CHECK-NEXT: store %struct.data* [[TMP0]], %struct.data** [[TMP2]], align 4 ; CHECK-NEXT: ret i32 0 @@ -161,9 +161,9 @@ define i8* @test5(i32 %n) nounwind ssp { ; CHECK-LABEL: @test5( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = tail call noalias dereferenceable_or_null(20) i8* @malloc(i32 20) [[ATTR0]] +; CHECK-NEXT: [[TMP0:%.*]] = tail call noalias dereferenceable_or_null(20) i8* @malloc(i32 20) #[[ATTR0]] ; CHECK-NEXT: [[TMP1:%.*]] = load i8*, i8** @s, align 8 -; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* noundef nonnull align 1 dereferenceable(10) [[TMP0]], i8* noundef nonnull align 1 dereferenceable(10) [[TMP1]], i32 10, i1 false) [[ATTR0]] +; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* noundef nonnull align 1 dereferenceable(10) [[TMP0]], i8* noundef nonnull align 1 dereferenceable(10) [[TMP1]], i32 10, i1 false) #[[ATTR0]] ; CHECK-NEXT: ret i8* [[TMP0]] ; entry: @@ -177,9 +177,9 @@ define void @test6(i32 %n) nounwind ssp { ; CHECK-LABEL: @test6( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = tail call noalias dereferenceable_or_null(20) i8* @malloc(i32 20) [[ATTR0]] +; CHECK-NEXT: [[TMP0:%.*]] = tail call noalias dereferenceable_or_null(20) i8* @malloc(i32 20) #[[ATTR0]] ; CHECK-NEXT: [[TMP1:%.*]] = load i8*, i8** @s, align 8 -; CHECK-NEXT: [[TMP2:%.*]] = tail call i8* @__memcpy_chk(i8* [[TMP0]], i8* [[TMP1]], i32 30, i32 20) [[ATTR0]] +; CHECK-NEXT: [[TMP2:%.*]] = tail call i8* @__memcpy_chk(i8* [[TMP0]], i8* [[TMP1]], i32 30, i32 20) #[[ATTR0]] ; CHECK-NEXT: ret void ; entry: @@ -196,7 +196,7 @@ define i32 @test7(i8** %esc) { ; CHECK-LABEL: @test7( -; CHECK-NEXT: [[ALLOC:%.*]] = call noalias dereferenceable_or_null(48) i8* @malloc(i32 48) [[ATTR0]] +; CHECK-NEXT: [[ALLOC:%.*]] = call noalias dereferenceable_or_null(48) i8* @malloc(i32 48) #[[ATTR0]] ; CHECK-NEXT: store i8* [[ALLOC]], i8** [[ESC:%.*]], align 4 ; CHECK-NEXT: ret i32 32 ; @@ -211,7 +211,7 @@ define i32 @test8(i8** %esc) { ; CHECK-LABEL: @test8( -; CHECK-NEXT: [[ALLOC:%.*]] = call noalias dereferenceable_or_null(35) i8* @calloc(i32 5, i32 7) [[ATTR0]] +; CHECK-NEXT: [[ALLOC:%.*]] = call noalias dereferenceable_or_null(35) i8* @calloc(i32 5, i32 7) #[[ATTR0]] ; CHECK-NEXT: store i8* [[ALLOC]], i8** [[ESC:%.*]], align 4 ; CHECK-NEXT: ret i32 30 ; @@ -227,7 +227,7 @@ define i32 @test9(i8** %esc) { ; CHECK-LABEL: @test9( -; CHECK-NEXT: [[CALL:%.*]] = tail call dereferenceable_or_null(8) i8* @strdup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0)) [[ATTR0]] +; CHECK-NEXT: [[CALL:%.*]] = tail call dereferenceable_or_null(8) i8* @strdup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0)) #[[ATTR0]] ; CHECK-NEXT: store i8* [[CALL]], i8** [[ESC:%.*]], align 8 ; CHECK-NEXT: ret i32 8 ; @@ -239,7 +239,7 @@ define i32 @test10(i8** %esc) { ; CHECK-LABEL: @test10( -; CHECK-NEXT: [[CALL:%.*]] = tail call dereferenceable_or_null(4) i8* @strndup(i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i32 3) [[ATTR0]] +; CHECK-NEXT: [[CALL:%.*]] = tail call dereferenceable_or_null(4) i8* @strndup(i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i32 3) #[[ATTR0]] ; CHECK-NEXT: store i8* [[CALL]], i8** [[ESC:%.*]], align 8 ; CHECK-NEXT: ret i32 4 ; @@ -251,7 +251,7 @@ define i32 @test11(i8** %esc) { ; CHECK-LABEL: @test11( -; CHECK-NEXT: [[STRDUP:%.*]] = call dereferenceable_or_null(8) i8* @strdup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0)) +; CHECK-NEXT: [[STRDUP:%.*]] = call noalias dereferenceable_or_null(8) i8* @strdup(i8* nocapture readonly getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0)) #[[ATTR5:[0-9]+]] ; CHECK-NEXT: store i8* [[STRDUP]], i8** [[ESC:%.*]], align 8 ; CHECK-NEXT: ret i32 8 ; @@ -263,7 +263,7 @@ define i32 @test12(i8** %esc) { ; CHECK-LABEL: @test12( -; CHECK-NEXT: [[STRDUP:%.*]] = call dereferenceable_or_null(8) i8* @strdup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0)) +; CHECK-NEXT: [[STRDUP:%.*]] = call noalias dereferenceable_or_null(8) i8* @strdup(i8* nocapture readonly getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0)) #[[ATTR5]] ; CHECK-NEXT: store i8* [[STRDUP]], i8** [[ESC:%.*]], align 8 ; CHECK-NEXT: ret i32 8 ; @@ -275,7 +275,7 @@ define i32 @test13(i8** %esc) { ; CHECK-LABEL: @test13( -; CHECK-NEXT: [[STRDUP:%.*]] = call dereferenceable_or_null(8) i8* @strdup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0)) +; CHECK-NEXT: [[STRDUP:%.*]] = call noalias dereferenceable_or_null(8) i8* @strdup(i8* nocapture readonly getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0)) #[[ATTR5]] ; CHECK-NEXT: store i8* [[STRDUP]], i8** [[ESC:%.*]], align 8 ; CHECK-NEXT: ret i32 8 ; Index: llvm/test/Transforms/InstCombine/pow_fp_int.ll =================================================================== --- llvm/test/Transforms/InstCombine/pow_fp_int.ll +++ llvm/test/Transforms/InstCombine/pow_fp_int.ll @@ -51,7 +51,7 @@ define double @pow_sitofp_double_const_base_2_fast(i32 %x) { ; CHECK-LABEL: @pow_sitofp_double_const_base_2_fast( -; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i32 [[X:%.*]]) +; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i32 signext [[X:%.*]]) #[[ATTR1:[0-9]+]] ; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double ; CHECK-NEXT: ret double [[RES]] ; @@ -78,7 +78,7 @@ define double @pow_uitofp_const_base_2_fast(i31 %x) { ; CHECK-LABEL: @pow_uitofp_const_base_2_fast( ; CHECK-NEXT: [[TMP1:%.*]] = zext i31 [[X:%.*]] to i32 -; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i32 [[TMP1]]) +; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i32 signext [[TMP1]]) #[[ATTR1]] ; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double ; CHECK-NEXT: ret double [[RES]] ; @@ -224,7 +224,7 @@ define double @pow_uitofp_const_base_fast_i32(i32 %x) { ; CHECK-LABEL: @pow_uitofp_const_base_fast_i32( ; CHECK-NEXT: [[SUBFP:%.*]] = uitofp i32 [[X:%.*]] to float -; CHECK-NEXT: [[MUL:%.*]] = fmul fast float [[SUBFP]], 0x4006757{{.*}} +; CHECK-NEXT: [[MUL:%.*]] = fmul fast float [[SUBFP]], 0x4006757680000000 ; CHECK-NEXT: [[EXP2:%.*]] = call fast float @llvm.exp2.f32(float [[MUL]]) ; CHECK-NEXT: [[RES:%.*]] = fpext float [[EXP2]] to double ; CHECK-NEXT: ret double [[RES]] @@ -289,12 +289,12 @@ define double @pow_sitofp_const_base_fast_i64(i64 %x) { ; CHECK-LABEL: @pow_sitofp_const_base_fast_i64( ; CHECK-NEXT: [[SUBFP:%.*]] = sitofp i64 [[X:%.*]] to float -; Do not change 0x400675{{.*}} to the exact constant, see PR42740 -; CHECK-NEXT: [[MUL:%.*]] = fmul fast float [[SUBFP]], 0x400675{{.*}} +; CHECK-NEXT: [[MUL:%.*]] = fmul fast float [[SUBFP]], 0x4006757680000000 ; CHECK-NEXT: [[EXP2:%.*]] = call fast float @llvm.exp2.f32(float [[MUL]]) ; CHECK-NEXT: [[RES:%.*]] = fpext float [[EXP2]] to double ; CHECK-NEXT: ret double [[RES]] ; +; Do not change 0x400675{{.*}} to the exact constant, see PR42740 %subfp = sitofp i64 %x to float %pow = tail call fast float @llvm.pow.f32(float 7.000000e+00, float %subfp) %res = fpext float %pow to double @@ -304,7 +304,7 @@ define double @pow_uitofp_const_base_fast_i64(i64 %x) { ; CHECK-LABEL: @pow_uitofp_const_base_fast_i64( ; CHECK-NEXT: [[SUBFP:%.*]] = uitofp i64 [[X:%.*]] to float -; CHECK-NEXT: [[MUL:%.*]] = fmul fast float [[SUBFP]], 0x400675{{.*}} +; CHECK-NEXT: [[MUL:%.*]] = fmul fast float [[SUBFP]], 0x4006757680000000 ; CHECK-NEXT: [[EXP2:%.*]] = call fast float @llvm.exp2.f32(float [[MUL]]) ; CHECK-NEXT: [[RES:%.*]] = fpext float [[EXP2]] to double ; CHECK-NEXT: ret double [[RES]] @@ -343,7 +343,7 @@ define double @pow_sitofp_const_base_2_no_fast(i32 %x) { ; CHECK-LABEL: @pow_sitofp_const_base_2_no_fast( -; CHECK-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 [[X:%.*]]) +; CHECK-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 signext [[X:%.*]]) #[[ATTR1]] ; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double ; CHECK-NEXT: ret double [[RES]] ; Index: llvm/test/Transforms/InstCombine/pow_fp_int16.ll =================================================================== --- llvm/test/Transforms/InstCombine/pow_fp_int16.ll +++ llvm/test/Transforms/InstCombine/pow_fp_int16.ll @@ -57,7 +57,7 @@ define double @pow_sitofp_double_const_base_2_fast(i16 %x) { ; CHECK-LABEL: @pow_sitofp_double_const_base_2_fast( -; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i16 [[X:%.*]]) +; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i16 signext [[X:%.*]]) #1 ; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double ; CHECK-NEXT: ret double [[RES]] ; @@ -84,7 +84,7 @@ define double @pow_uitofp_const_base_2_fast(i15 %x) { ; CHECK-LABEL: @pow_uitofp_const_base_2_fast( ; CHECK-NEXT: [[TMP1:%.*]] = zext i15 [[X:%.*]] to i16 -; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i16 [[TMP1]]) +; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i16 signext [[TMP1]]) ; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double ; CHECK-NEXT: ret double [[RES]] ; @@ -322,7 +322,7 @@ define double @pow_sitofp_const_base_2_no_fast(i16 %x) { ; CHECK-LABEL: @pow_sitofp_const_base_2_no_fast( -; CHECK-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i16 [[X:%.*]]) +; CHECK-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i16 signext [[X:%.*]]) ; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double ; CHECK-NEXT: ret double [[RES]] ; Index: llvm/test/Transforms/InstCombine/printf-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/printf-1.ll +++ llvm/test/Transforms/InstCombine/printf-1.ll @@ -15,7 +15,6 @@ @percent_f = constant [3 x i8] c"%f\00" @percent_s = constant [4 x i8] c"%s\0A\00" @empty = constant [1 x i8] c"\00" -; CHECK: [[$STR:@[a-z0-9]+]] = private unnamed_addr constant [12 x i8] c"hello world\00", align 1 declare i32 @printf(i8*, ...) @@ -37,11 +36,11 @@ define void @test_simplify2() { ; CHECK-LABEL: @test_simplify2( -; CHECK-NEXT: [[PUTCHAR:%.*]] = call i32 @putchar(i32 104) +; CHECK-NEXT: [[PUTCHAR:%.*]] = call noundef i32 @putchar(i32 noundef 104) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: ret void ; ; CHECK-IPRINTF-LABEL: @test_simplify2( -; CHECK-IPRINTF-NEXT: [[PUTCHAR:%.*]] = call i32 @putchar(i32 104) +; CHECK-IPRINTF-NEXT: [[PUTCHAR:%.*]] = call noundef i32 @putchar(i32 noundef 104) #[[ATTR0:[0-9]+]] ; CHECK-IPRINTF-NEXT: ret void ; %fmt = getelementptr [2 x i8], [2 x i8]* @h, i32 0, i32 0 @@ -53,11 +52,11 @@ define void @test_simplify2b() { ; CHECK-LABEL: @test_simplify2b( -; CHECK-NEXT: [[PUTCHAR:%.*]] = call i32 @putchar(i32 37) +; CHECK-NEXT: [[PUTCHAR:%.*]] = call noundef i32 @putchar(i32 noundef 37) #[[ATTR0]] ; CHECK-NEXT: ret void ; ; CHECK-IPRINTF-LABEL: @test_simplify2b( -; CHECK-IPRINTF-NEXT: [[PUTCHAR:%.*]] = call i32 @putchar(i32 37) +; CHECK-IPRINTF-NEXT: [[PUTCHAR:%.*]] = call noundef i32 @putchar(i32 noundef 37) #[[ATTR0]] ; CHECK-IPRINTF-NEXT: ret void ; %fmt = getelementptr [3 x i8], [3 x i8]* @h2, i32 0, i32 0 @@ -67,11 +66,11 @@ define void @test_simplify3() { ; CHECK-LABEL: @test_simplify3( -; CHECK-NEXT: [[PUTCHAR:%.*]] = call i32 @putchar(i32 37) +; CHECK-NEXT: [[PUTCHAR:%.*]] = call noundef i32 @putchar(i32 noundef 37) #[[ATTR0]] ; CHECK-NEXT: ret void ; ; CHECK-IPRINTF-LABEL: @test_simplify3( -; CHECK-IPRINTF-NEXT: [[PUTCHAR:%.*]] = call i32 @putchar(i32 37) +; CHECK-IPRINTF-NEXT: [[PUTCHAR:%.*]] = call noundef i32 @putchar(i32 noundef 37) #[[ATTR0]] ; CHECK-IPRINTF-NEXT: ret void ; %fmt = getelementptr [2 x i8], [2 x i8]* @percent, i32 0, i32 0 @@ -83,11 +82,11 @@ define void @test_simplify4() { ; CHECK-LABEL: @test_simplify4( -; CHECK-NEXT: [[PUTS:%.*]] = call i32 @puts(i8* nonnull dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i32 0, i32 0)) +; CHECK-NEXT: [[PUTS:%.*]] = call noundef i32 @puts(i8* nocapture noundef nonnull readonly dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i32 0, i32 0)) #[[ATTR0]] ; CHECK-NEXT: ret void ; ; CHECK-IPRINTF-LABEL: @test_simplify4( -; CHECK-IPRINTF-NEXT: [[PUTS:%.*]] = call i32 @puts(i8* nonnull dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i32 0, i32 0)) +; CHECK-IPRINTF-NEXT: [[PUTS:%.*]] = call noundef i32 @puts(i8* nocapture noundef nonnull readonly dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i32 0, i32 0)) #[[ATTR0]] ; CHECK-IPRINTF-NEXT: ret void ; %fmt = getelementptr [13 x i8], [13 x i8]* @hello_world, i32 0, i32 0 @@ -99,11 +98,11 @@ define void @test_simplify5() { ; CHECK-LABEL: @test_simplify5( -; CHECK-NEXT: [[PUTCHAR:%.*]] = call i32 @putchar(i32 104) +; CHECK-NEXT: [[PUTCHAR:%.*]] = call noundef i32 @putchar(i32 noundef 104) #[[ATTR0]] ; CHECK-NEXT: ret void ; ; CHECK-IPRINTF-LABEL: @test_simplify5( -; CHECK-IPRINTF-NEXT: [[PUTCHAR:%.*]] = call i32 @putchar(i32 104) +; CHECK-IPRINTF-NEXT: [[PUTCHAR:%.*]] = call noundef i32 @putchar(i32 noundef 104) #[[ATTR0]] ; CHECK-IPRINTF-NEXT: ret void ; %fmt = getelementptr [3 x i8], [3 x i8]* @percent_c, i32 0, i32 0 @@ -115,11 +114,11 @@ define void @test_simplify6() { ; CHECK-LABEL: @test_simplify6( -; CHECK-NEXT: [[PUTS:%.*]] = call i32 @puts(i8* nonnull dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32 0)) +; CHECK-NEXT: [[PUTS:%.*]] = call noundef i32 @puts(i8* nocapture noundef nonnull readonly dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32 0)) #[[ATTR0]] ; CHECK-NEXT: ret void ; ; CHECK-IPRINTF-LABEL: @test_simplify6( -; CHECK-IPRINTF-NEXT: [[PUTS:%.*]] = call i32 @puts(i8* nonnull dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32 0)) +; CHECK-IPRINTF-NEXT: [[PUTS:%.*]] = call noundef i32 @puts(i8* nocapture noundef nonnull readonly dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32 0)) #[[ATTR0]] ; CHECK-IPRINTF-NEXT: ret void ; %fmt = getelementptr [4 x i8], [4 x i8]* @percent_s, i32 0, i32 0 Index: llvm/test/Transforms/InstCombine/printf-2.ll =================================================================== --- llvm/test/Transforms/InstCombine/printf-2.ll +++ llvm/test/Transforms/InstCombine/printf-2.ll @@ -29,7 +29,7 @@ ;. define void @test_simplify1() { ; CHECK-LABEL: @test_simplify1( -; CHECK-NEXT: [[PUTCHAR:%.*]] = call i32 @putchar(i32 104) +; CHECK-NEXT: [[PUTCHAR:%.*]] = call noundef i32 @putchar(i32 noundef 104) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: ret void ; %fmt = getelementptr [2 x i8], [2 x i8]* @h, i32 0, i32 0 @@ -39,7 +39,7 @@ define void @test_simplify2() { ; CHECK-LABEL: @test_simplify2( -; CHECK-NEXT: [[PUTS:%.*]] = call i32 @puts(i8* nonnull dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i32 0, i32 0)) +; CHECK-NEXT: [[PUTS:%.*]] = call noundef i32 @puts(i8* nocapture noundef nonnull readonly dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i32 0, i32 0)) #[[ATTR0]] ; CHECK-NEXT: ret void ; %fmt = getelementptr [13 x i8], [13 x i8]* @hello_world, i32 0, i32 0 @@ -49,7 +49,7 @@ define void @test_simplify6() { ; CHECK-LABEL: @test_simplify6( -; CHECK-NEXT: [[PUTS:%.*]] = call i32 @puts(i8* nonnull dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32 0)) +; CHECK-NEXT: [[PUTS:%.*]] = call noundef i32 @puts(i8* nocapture noundef nonnull readonly dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32 0)) #[[ATTR0]] ; CHECK-NEXT: ret void ; %fmt = getelementptr [4 x i8], [4 x i8]* @percent_s, i32 0, i32 0 @@ -60,7 +60,7 @@ define void @test_simplify7() { ; CHECK-LABEL: @test_simplify7( -; CHECK-NEXT: [[PUTCHAR:%.*]] = call i32 @putchar(i32 97) +; CHECK-NEXT: [[PUTCHAR:%.*]] = call noundef i32 @putchar(i32 noundef 97) #[[ATTR0]] ; CHECK-NEXT: ret void ; %fmt = getelementptr [3 x i8], [3 x i8]* @format_str, i32 0, i32 0 @@ -85,7 +85,7 @@ define void @test_simplify9() { ; CHECK-LABEL: @test_simplify9( -; CHECK-NEXT: [[PUTS:%.*]] = call i32 @puts(i8* nonnull dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.1, i32 0, i32 0)) +; CHECK-NEXT: [[PUTS:%.*]] = call noundef i32 @puts(i8* nocapture noundef nonnull readonly dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.1, i32 0, i32 0)) #[[ATTR0]] ; CHECK-NEXT: ret void ; %fmt = getelementptr [3 x i8], [3 x i8]* @format_str, i32 0, i32 0 @@ -100,8 +100,8 @@ define void @test_simplify10() { ; CHECK-LABEL: @test_simplify10( -; CHECK-NEXT: [[PUTCHAR:%.*]] = call i32 @putchar(i32 97) -; CHECK-NEXT: [[PUTS:%.*]] = call i32 @puts(i8* nonnull dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.2, i32 0, i32 0)) +; CHECK-NEXT: [[PUTCHAR:%.*]] = call noundef i32 @putchar(i32 noundef 97) #[[ATTR0]] +; CHECK-NEXT: [[PUTS:%.*]] = call noundef i32 @puts(i8* nocapture noundef nonnull readonly dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.2, i32 0, i32 0)) #[[ATTR0]] ; CHECK-NEXT: ret void ; %fmt = getelementptr [3 x i8], [3 x i8]* @format_str, i32 0, i32 0 @@ -114,5 +114,5 @@ ret void } ;. -; CHECK: attributes #[[ATTR0:[0-9]+]] = { nofree nounwind } +; CHECK: attributes #[[ATTR0]] = { nofree nounwind } ;. Index: llvm/test/Transforms/InstCombine/printf-3.ll =================================================================== --- llvm/test/Transforms/InstCombine/printf-3.ll +++ llvm/test/Transforms/InstCombine/printf-3.ll @@ -30,8 +30,7 @@ ; CHECK-DAG: define void @test1( ; CHECK: %[[CS:.*]] = catchswitch within none ; CHECK: %[[CP:.*]] = catchpad within %[[CS]] [i8* null, i32 64, i8* null] -; CHECK: call i32 @putchar(i32 10) [ "funclet"(token %[[CP]]) ] - +; CHECK: call noundef i32 @putchar(i32 noundef 10) #0 [ "funclet"(token %cp) ] declare void @_CxxThrowException(i8*, i8*) declare i32 @__CxxFrameHandler3(...) Index: llvm/test/Transforms/InstCombine/puts-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/puts-1.ll +++ llvm/test/Transforms/InstCombine/puts-1.ll @@ -13,7 +13,7 @@ define void @test_simplify1() { ; CHECK-LABEL: @test_simplify1( -; CHECK-NEXT: [[PUTCHAR:%.*]] = call i32 @putchar(i32 10) +; CHECK-NEXT: [[PUTCHAR:%.*]] = call noundef i32 @putchar(i32 noundef 10) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: ret void ; %str = getelementptr [1 x i8], [1 x i8]* @empty, i32 0, i32 0 Index: llvm/test/Transforms/InstCombine/realloc.ll =================================================================== --- llvm/test/Transforms/InstCombine/realloc.ll +++ llvm/test/Transforms/InstCombine/realloc.ll @@ -7,7 +7,7 @@ define i8* @realloc_null_ptr() #0 { ; CHECK-LABEL: @realloc_null_ptr( -; CHECK-NEXT: [[MALLOC:%.*]] = call dereferenceable_or_null(100) i8* @malloc(i64 100) +; CHECK-NEXT: [[MALLOC:%.*]] = call noalias noundef dereferenceable_or_null(100) i8* @malloc(i64 noundef 100) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: ret i8* [[MALLOC]] ; %call = call i8* @realloc(i8* null, i64 100) #2 Index: llvm/test/Transforms/InstCombine/simplify-libcalls.ll =================================================================== --- llvm/test/Transforms/InstCombine/simplify-libcalls.ll +++ llvm/test/Transforms/InstCombine/simplify-libcalls.ll @@ -190,7 +190,7 @@ } define double @fake_ldexp(i32 %x) { ; CHECK32-LABEL: @fake_ldexp( -; CHECK32-NEXT: [[Z:%.*]] = call double @ldexp(double 1.0{{.*}}, i32 %x) +; CHECK32-NEXT: [[Z:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext %x) #4 ; CHECK32-NEXT: ret double [[Z]] ; CHECK16-LABEL: @fake_ldexp( @@ -205,11 +205,11 @@ define double @fake_ldexp_16(i16 %x) { ; CHECK32-LABEL: @fake_ldexp_16( ; CHECK32-NEXT: [[Y:%.*]] = sext i16 %x to i32 -; CHECK32-NEXT: [[Z:%.*]] = call double @ldexp(double 1.0{{.*}}, i32 [[Y]]) +; CHECK32-NEXT: [[Z:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext %1) #4 ; CHECK32-NEXT: ret double [[Z]] ; CHECK16-LABEL: @fake_ldexp_16( -; CHECK16-NEXT: [[Z:%.*]] = call double @ldexp(double 1.0{{.*}}, i16 %x) +; CHECK16-NEXT: [[Z:%.*]] = call double @ldexp(double 1.000000e+00, i16 signext %x) #4 ; CHECK16-NEXT: ret double [[Z]] %y = sitofp i16 %x to double Index: llvm/test/Transforms/InstCombine/sprintf-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/sprintf-1.ll +++ llvm/test/Transforms/InstCombine/sprintf-1.ll @@ -69,7 +69,7 @@ define void @test_simplify5(i8* %dst, i8* %str) { ; CHECK-LABEL: @test_simplify5( -; CHECK-NEXT: [[STRCPY:%.*]] = call i8* @strcpy(i8* noundef nonnull dereferenceable(1) [[DST:%.*]], i8* noundef nonnull dereferenceable(1) [[STR:%.*]]) +; CHECK-NEXT: [[STRCPY:%.*]] = call i8* @strcpy(i8* noalias noundef nonnull returned writeonly dereferenceable(1) [[DST:%.*]], i8* noalias nocapture noundef nonnull readonly dereferenceable(1) [[STR:%.*]]) #[[ATTR1:[0-9]+]] ; CHECK-NEXT: ret void ; %fmt = getelementptr [3 x i8], [3 x i8]* @percent_s, i32 0, i32 0 @@ -97,14 +97,14 @@ define i32 @test_simplify7(i8* %dst, i8* %str) { ; CHECK-IPRINTF-LABEL: @test_simplify7( -; CHECK-IPRINTF-NEXT: [[STPCPY:%.*]] = call i8* @stpcpy(i8* [[DST:%.*]], i8* [[STR:%.*]]) +; CHECK-IPRINTF-NEXT: [[STPCPY:%.*]] = call i8* @stpcpy(i8* noalias writeonly [[DST:%.*]], i8* noalias nocapture readonly [[STR:%.*]]) #[[ATTR1]] ; CHECK-IPRINTF-NEXT: [[TMP1:%.*]] = ptrtoint i8* [[STPCPY]] to i32 ; CHECK-IPRINTF-NEXT: [[TMP2:%.*]] = ptrtoint i8* [[DST]] to i32 ; CHECK-IPRINTF-NEXT: [[TMP3:%.*]] = sub i32 [[TMP1]], [[TMP2]] ; CHECK-IPRINTF-NEXT: ret i32 [[TMP3]] ; ; WIN-LABEL: @test_simplify7( -; WIN-NEXT: [[STRLEN:%.*]] = call i32 @strlen(i8* noundef nonnull dereferenceable(1) [[STR:%.*]]) +; WIN-NEXT: [[STRLEN:%.*]] = call i32 @strlen(i8* nocapture noundef nonnull dereferenceable(1) [[STR:%.*]]) #[[ATTR2:[0-9]+]] ; WIN-NEXT: [[LENINC:%.*]] = add i32 [[STRLEN]], 1 ; WIN-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 [[DST:%.*]], i8* align 1 [[STR]], i32 [[LENINC]], i1 false) ; WIN-NEXT: ret i32 [[STRLEN]] @@ -130,14 +130,14 @@ define i32 @test_simplify9(i8* %dst, i8* %str) { ; CHECK-IPRINTF-LABEL: @test_simplify9( -; CHECK-IPRINTF-NEXT: [[STPCPY:%.*]] = call i8* @stpcpy(i8* [[DST:%.*]], i8* [[STR:%.*]]) +; CHECK-IPRINTF-NEXT: [[STPCPY:%.*]] = call i8* @stpcpy(i8* noalias writeonly [[DST:%.*]], i8* noalias nocapture readonly [[STR:%.*]]) #[[ATTR1]] ; CHECK-IPRINTF-NEXT: [[TMP1:%.*]] = ptrtoint i8* [[STPCPY]] to i32 ; CHECK-IPRINTF-NEXT: [[TMP2:%.*]] = ptrtoint i8* [[DST]] to i32 ; CHECK-IPRINTF-NEXT: [[TMP3:%.*]] = sub i32 [[TMP1]], [[TMP2]] ; CHECK-IPRINTF-NEXT: ret i32 [[TMP3]] ; ; WIN-LABEL: @test_simplify9( -; WIN-NEXT: [[STRLEN:%.*]] = call i32 @strlen(i8* noundef nonnull dereferenceable(1) [[STR:%.*]]) +; WIN-NEXT: [[STRLEN:%.*]] = call i32 @strlen(i8* nocapture noundef nonnull dereferenceable(1) [[STR:%.*]]) #[[ATTR2]] ; WIN-NEXT: [[LENINC:%.*]] = add i32 [[STRLEN]], 1 ; WIN-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 [[DST:%.*]], i8* align 1 [[STR]], i32 [[LENINC]], i1 false) ; WIN-NEXT: ret i32 [[STRLEN]] @@ -168,7 +168,7 @@ define i32 @test_no_simplify3(i8* %dst, i8* %str) minsize { ; CHECK-IPRINTF-LABEL: @test_no_simplify3( -; CHECK-IPRINTF-NEXT: [[STPCPY:%.*]] = call i8* @stpcpy(i8* [[DST:%.*]], i8* [[STR:%.*]]) +; CHECK-IPRINTF-NEXT: [[STPCPY:%.*]] = call i8* @stpcpy(i8* noalias writeonly [[DST:%.*]], i8* noalias nocapture readonly [[STR:%.*]]) #[[ATTR1]] ; CHECK-IPRINTF-NEXT: [[TMP1:%.*]] = ptrtoint i8* [[STPCPY]] to i32 ; CHECK-IPRINTF-NEXT: [[TMP2:%.*]] = ptrtoint i8* [[DST]] to i32 ; CHECK-IPRINTF-NEXT: [[TMP3:%.*]] = sub i32 [[TMP1]], [[TMP2]] Index: llvm/test/Transforms/InstCombine/sqrt.ll =================================================================== --- llvm/test/Transforms/InstCombine/sqrt.ll +++ llvm/test/Transforms/InstCombine/sqrt.ll @@ -3,7 +3,7 @@ define float @test1(float %x) nounwind readnone ssp { ; CHECK-LABEL: @test1( -; CHECK-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) #3 +; CHECK-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) #[[ATTR3:[0-9]+]] ; CHECK-NEXT: ret float [[SQRTF]] ; %conv = fpext float %x to double @@ -16,7 +16,7 @@ define float @test2(float %x) nounwind readnone ssp { ; CHECK-LABEL: @test2( -; CHECK-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) #3 +; CHECK-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) #[[ATTR3]] ; CHECK-NEXT: ret float [[SQRTF]] ; %conv = fpext float %x to double @@ -31,8 +31,8 @@ define float @test3(float* %v) nounwind uwtable ssp { ; CHECK-LABEL: @test3( -; CHECK-NEXT: [[CALL34:%.*]] = call double @sqrt(double 0x7FF8000000000000) #3 -; CHECK-NEXT: [[CALL36:%.*]] = call i32 @foo(double [[CALL34]]) #4 +; CHECK-NEXT: [[CALL34:%.*]] = call double @sqrt(double 0x7FF8000000000000) #[[ATTR4:[0-9]+]] +; CHECK-NEXT: [[CALL36:%.*]] = call i32 @foo(double [[CALL34]]) #[[ATTR3]] ; CHECK-NEXT: [[CONV38:%.*]] = fptrunc double [[CALL34]] to float ; CHECK-NEXT: ret float [[CONV38]] ; @@ -51,7 +51,7 @@ define void @0(float %f) { ; CHECK-LABEL: @0( -; CHECK-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[F:%.*]]) #2 +; CHECK-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[F:%.*]]) ; CHECK-NEXT: ret void ; %d = fpext float %f to double Index: llvm/test/Transforms/InstCombine/stpcpy-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/stpcpy-1.ll +++ llvm/test/Transforms/InstCombine/stpcpy-1.ll @@ -27,7 +27,7 @@ define i8* @test_simplify2() { ; CHECK-LABEL: @test_simplify2( -; CHECK-NEXT: [[STRLEN:%.*]] = call i32 @strlen(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @a, i32 0, i32 0)) +; CHECK-NEXT: [[STRLEN:%.*]] = call i32 @strlen(i8* nocapture noundef nonnull dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @a, i32 0, i32 0)) #[[ATTR1:[0-9]+]] ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [32 x i8], [32 x i8]* @a, i32 0, i32 [[STRLEN]] ; CHECK-NEXT: ret i8* [[TMP1]] ; Index: llvm/test/Transforms/InstCombine/stpcpy_chk-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/stpcpy_chk-1.ll +++ llvm/test/Transforms/InstCombine/stpcpy_chk-1.ll @@ -14,7 +14,7 @@ define i8* @test_simplify1() { ; CHECK-LABEL: @test_simplify1( -; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* noundef nonnull align 1 dereferenceable(12) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* noundef nonnull align 1 dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias noundef nonnull writeonly align 1 dereferenceable(12) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* noalias nocapture noundef nonnull readonly align 1 dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i1 false) #[[ATTR2:[0-9]+]] ; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 11) ; %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0 @@ -26,7 +26,7 @@ define i8* @test_simplify2() { ; CHECK-LABEL: @test_simplify2( -; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* noundef nonnull align 1 dereferenceable(12) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* noundef nonnull align 1 dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias noundef nonnull writeonly align 1 dereferenceable(12) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* noalias nocapture noundef nonnull readonly align 1 dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i1 false) #[[ATTR2]] ; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 11) ; %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0 @@ -38,7 +38,7 @@ define i8* @test_simplify3() { ; CHECK-LABEL: @test_simplify3( -; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* noundef nonnull align 1 dereferenceable(12) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* noundef nonnull align 1 dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias noundef nonnull writeonly align 1 dereferenceable(12) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* noalias nocapture noundef nonnull readonly align 1 dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i1 false) #[[ATTR2]] ; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 11) ; %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0 @@ -52,7 +52,7 @@ define i8* @test_simplify4() { ; CHECK-LABEL: @test_simplify4( -; CHECK-NEXT: [[STPCPY:%.*]] = call i8* @stpcpy(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i32 0, i32 0)) +; CHECK-NEXT: [[STPCPY:%.*]] = call i8* @stpcpy(i8* noalias writeonly getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* noalias nocapture readonly getelementptr inbounds ([60 x i8], [60 x i8]* @b, i32 0, i32 0)) #[[ATTR2]] ; CHECK-NEXT: ret i8* [[STPCPY]] ; %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0 @@ -67,7 +67,7 @@ define i8* @test_simplify5() { ; CHECK-LABEL: @test_simplify5( ; CHECK-NEXT: [[LEN:%.*]] = call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false, i1 false, i1 false) -; CHECK-NEXT: [[TMP1:%.*]] = call i8* @__memcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 [[LEN]]) +; CHECK-NEXT: [[TMP1:%.*]] = call i8* @__memcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 [[LEN]]) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 11) ; %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0 @@ -82,7 +82,7 @@ define i8* @test_simplify6() { ; CHECK-LABEL: @test_simplify6( -; CHECK-NEXT: [[STRLEN:%.*]] = call i32 @strlen(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0)) +; CHECK-NEXT: [[STRLEN:%.*]] = call i32 @strlen(i8* nocapture noundef nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0)) #[[ATTR3:[0-9]+]] ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 [[STRLEN]] ; CHECK-NEXT: ret i8* [[TMP1]] ; Index: llvm/test/Transforms/InstCombine/strchr-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/strchr-1.ll +++ llvm/test/Transforms/InstCombine/strchr-1.ll @@ -49,7 +49,7 @@ define void @test_simplify4(i32 %chr) { ; CHECK-LABEL: @test_simplify4( -; CHECK-NEXT: [[MEMCHR:%.*]] = call i8* @memchr(i8* noundef nonnull dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @hello, i32 0, i32 0), i32 [[CHR:%.*]], i32 14) +; CHECK-NEXT: [[MEMCHR:%.*]] = call i8* @memchr(i8* noundef nonnull dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @hello, i32 0, i32 0), i32 [[CHR:%.*]], i32 14) #[[ATTR1:[0-9]+]] ; CHECK-NEXT: store i8* [[MEMCHR]], i8** @chp, align 4 ; CHECK-NEXT: ret void ; @@ -75,7 +75,7 @@ ; Check transformation strchr(p, 0) -> p + strlen(p) define void @test_simplify6(i8* %str) { ; CHECK-LABEL: @test_simplify6( -; CHECK-NEXT: [[STRLEN:%.*]] = call i32 @strlen(i8* noundef nonnull dereferenceable(1) [[STR:%.*]]) +; CHECK-NEXT: [[STRLEN:%.*]] = call i32 @strlen(i8* nocapture noundef nonnull dereferenceable(1) [[STR:%.*]]) #[[ATTR1]] ; CHECK-NEXT: [[STRCHR:%.*]] = getelementptr i8, i8* [[STR]], i32 [[STRLEN]] ; CHECK-NEXT: store i8* [[STRCHR]], i8** @chp, align 4 ; CHECK-NEXT: ret void Index: llvm/test/Transforms/InstCombine/strcmp-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/strcmp-1.ll +++ llvm/test/Transforms/InstCombine/strcmp-1.ll @@ -97,12 +97,12 @@ ; CHECK: ret i32 %memcmp ; NOBCMP-LABEL: @test5( ; NOBCMP-NEXT: [[STR2:%.*]] = select i1 [[B:%.*]], i8* getelementptr inbounds ([5 x i8], [5 x i8]* @hell, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @bell, i32 0, i32 0) -; NOBCMP-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(5) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8* noundef nonnull dereferenceable(5) [[STR2]], i32 5) +; NOBCMP-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(5) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8* nocapture noundef nonnull dereferenceable(5) [[STR2]], i32 5) #[[ATTR0:[0-9]+]] ; NOBCMP-NEXT: ret i32 [[MEMCMP]] ; ; BCMP-LABEL: @test5( ; BCMP-NEXT: [[STR2:%.*]] = select i1 [[B:%.*]], i8* getelementptr inbounds ([5 x i8], [5 x i8]* @hell, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @bell, i32 0, i32 0) -; BCMP-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(5) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8* noundef nonnull dereferenceable(5) [[STR2]], i32 5) +; BCMP-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(5) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8* nocapture noundef nonnull dereferenceable(5) [[STR2]], i32 5) #[[ATTR0:[0-9]+]] ; BCMP-NEXT: ret i32 [[MEMCMP]] ; %str1 = getelementptr inbounds [6 x i8], [6 x i8]* @hello, i32 0, i32 0 @@ -131,13 +131,13 @@ define i1 @test7(i1 %b) { ; NOBCMP-LABEL: @test7( ; NOBCMP-NEXT: [[STR2:%.*]] = select i1 [[B:%.*]], i8* getelementptr inbounds ([5 x i8], [5 x i8]* @hell, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @bell, i32 0, i32 0) -; NOBCMP-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(5) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8* noundef nonnull dereferenceable(5) [[STR2]], i32 5) +; NOBCMP-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(5) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8* nocapture noundef nonnull dereferenceable(5) [[STR2]], i32 5) #[[ATTR0]] ; NOBCMP-NEXT: [[RES:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; NOBCMP-NEXT: ret i1 [[RES]] ; ; BCMP-LABEL: @test7( ; BCMP-NEXT: [[STR2:%.*]] = select i1 [[B:%.*]], i8* getelementptr inbounds ([5 x i8], [5 x i8]* @hell, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @bell, i32 0, i32 0) -; BCMP-NEXT: [[BCMP:%.*]] = call i32 @bcmp(i8* noundef nonnull dereferenceable(5) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8* noundef nonnull dereferenceable(5) [[STR2]], i32 5) +; BCMP-NEXT: [[BCMP:%.*]] = call i32 @bcmp(i8* nocapture noundef nonnull dereferenceable(5) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8* nocapture noundef nonnull dereferenceable(5) [[STR2]], i32 5) #[[ATTR0]] ; BCMP-NEXT: [[RES:%.*]] = icmp eq i32 [[BCMP]], 0 ; BCMP-NEXT: ret i1 [[RES]] ; Index: llvm/test/Transforms/InstCombine/strcmp-memcmp.ll =================================================================== --- llvm/test/Transforms/InstCombine/strcmp-memcmp.ll +++ llvm/test/Transforms/InstCombine/strcmp-memcmp.ll @@ -11,7 +11,7 @@ define i32 @strcmp_memcmp([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strcmp_memcmp( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) [[STRING]], i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) #[[ATTR1:[0-9]+]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -28,7 +28,7 @@ define i32 @strcmp_memcmp2([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strcmp_memcmp2( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* noundef nonnull dereferenceable(4) [[STRING]], i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -43,7 +43,7 @@ define i32 @strcmp_memcmp3([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strcmp_memcmp3( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) [[STRING]], i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -58,7 +58,7 @@ define i32 @strcmp_memcmp4([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strcmp_memcmp4( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* noundef nonnull dereferenceable(4) [[STRING]], i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -73,7 +73,7 @@ define i32 @strcmp_memcmp5([5 x i8]* dereferenceable (5) %buf) { ; CHECK-LABEL: @strcmp_memcmp5( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [5 x i8], [5 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) [[STRING]], i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -88,7 +88,7 @@ define i32 @strcmp_memcmp6([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strcmp_memcmp6( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) [[STRING]], i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -103,7 +103,7 @@ define i32 @strcmp_memcmp7([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strcmp_memcmp7( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* noundef nonnull dereferenceable(4) [[STRING]], i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i64 4) #[[ATTR1]] ; CHECK-NEXT: [[MEMCMP_LOBIT:%.*]] = lshr i32 [[MEMCMP]], 31 ; CHECK-NEXT: ret i32 [[MEMCMP_LOBIT]] ; @@ -117,7 +117,7 @@ define i32 @strcmp_memcmp8([4 x i8]* dereferenceable (4) %buf) { ; CHECK-LABEL: @strcmp_memcmp8( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [4 x i8], [4 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) [[STRING]], i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -132,7 +132,7 @@ define i32 @strcmp_memcmp9([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strcmp_memcmp9( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) [[STRING]], i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([8 x i8], [8 x i8]* @abc, i64 0, i64 0), i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([8 x i8], [8 x i8]* @abc, i64 0, i64 0), i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -148,7 +148,7 @@ define i32 @strncmp_memcmp([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strncmp_memcmp( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(2) [[STRING]], i8* noundef nonnull dereferenceable(2) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 2) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(2) [[STRING]], i8* nocapture noundef nonnull dereferenceable(2) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 2) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -165,7 +165,7 @@ define i32 @strncmp_memcmp2([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strncmp_memcmp2( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) [[STRING]], i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -180,7 +180,7 @@ define i32 @strncmp_memcmp3([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strncmp_memcmp3( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* noundef nonnull dereferenceable(4) [[STRING]], i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -195,7 +195,7 @@ define i32 @strncmp_memcmp4([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strncmp_memcmp4( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) [[STRING]], i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -210,7 +210,7 @@ define i32 @strncmp_memcmp5([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strncmp_memcmp5( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* noundef nonnull dereferenceable(4) [[STRING]], i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -226,7 +226,7 @@ define i32 @strncmp_memcmp6([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strncmp_memcmp6( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* noundef nonnull dereferenceable(4) [[STRING]], i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -241,7 +241,7 @@ define i32 @strncmp_memcmp7([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strncmp_memcmp7( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) [[STRING]], i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -256,7 +256,7 @@ define i32 @strncmp_memcmp8([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strncmp_memcmp8( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(3) [[STRING]], i8* noundef nonnull dereferenceable(3) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 3) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(3) [[STRING]], i8* nocapture noundef nonnull dereferenceable(3) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 3) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -271,7 +271,7 @@ define i32 @strncmp_memcmp9([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strncmp_memcmp9( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* noundef nonnull dereferenceable(4) [[STRING]], i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -286,7 +286,7 @@ define i32 @strncmp_memcmp10([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strncmp_memcmp10( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* noundef nonnull dereferenceable(4) [[STRING]], i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i64 4) #[[ATTR1]] ; CHECK-NEXT: [[MEMCMP_LOBIT:%.*]] = lshr i32 [[MEMCMP]], 31 ; CHECK-NEXT: ret i32 [[MEMCMP_LOBIT]] ; @@ -300,7 +300,7 @@ define i32 @strncmp_memcmp11([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strncmp_memcmp11( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* noundef nonnull dereferenceable(4) [[STRING]], i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -315,7 +315,7 @@ define i32 @strncmp_memcmp12([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strncmp_memcmp12( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* noundef nonnull dereferenceable(4) [[STRING]], i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -330,7 +330,7 @@ define i32 @strncmp_memcmp13([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strncmp_memcmp13( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(2) [[STRING]], i8* noundef nonnull dereferenceable(2) getelementptr inbounds ([8 x i8], [8 x i8]* @abc, i64 0, i64 0), i64 2) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(2) [[STRING]], i8* nocapture noundef nonnull dereferenceable(2) getelementptr inbounds ([8 x i8], [8 x i8]* @abc, i64 0, i64 0), i64 2) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] @@ -345,7 +345,7 @@ define i32 @strncmp_memcmp14([12 x i8]* dereferenceable (12) %buf) { ; CHECK-LABEL: @strncmp_memcmp14( ; CHECK-NEXT: [[STRING:%.*]] = getelementptr inbounds [12 x i8], [12 x i8]* [[BUF:%.*]], i64 0, i64 0 -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) [[STRING]], i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([8 x i8], [8 x i8]* @abc, i64 0, i64 0), i64 4) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture noundef nonnull dereferenceable(4) [[STRING]], i8* nocapture noundef nonnull dereferenceable(4) getelementptr inbounds ([8 x i8], [8 x i8]* @abc, i64 0, i64 0), i64 4) #[[ATTR1]] ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 ; CHECK-NEXT: ret i32 [[CONV]] Index: llvm/test/Transforms/InstCombine/strcspn-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/strcspn-1.ll +++ llvm/test/Transforms/InstCombine/strcspn-1.ll @@ -15,7 +15,7 @@ define i64 @test_simplify1(i8* %str) { ; CHECK-LABEL: @test_simplify1( -; CHECK-NEXT: [[STRLEN:%.*]] = call i64 @strlen(i8* noundef nonnull dereferenceable(1) [[STR:%.*]]) +; CHECK-NEXT: [[STRLEN:%.*]] = call i64 @strlen(i8* nocapture noundef nonnull dereferenceable(1) [[STR:%.*]]) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: ret i64 [[STRLEN]] ; %pat = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0 Index: llvm/test/Transforms/InstCombine/strncat-2.ll =================================================================== --- llvm/test/Transforms/InstCombine/strncat-2.ll +++ llvm/test/Transforms/InstCombine/strncat-2.ll @@ -12,7 +12,7 @@ define void @test_simplify1() { ; CHECK-LABEL: @test_simplify1( -; CHECK-NEXT: [[STRLEN:%.*]] = call i32 @strlen(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @a, i32 0, i32 0)) +; CHECK-NEXT: [[STRLEN:%.*]] = call i32 @strlen(i8* nocapture noundef nonnull dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @a, i32 0, i32 0)) #[[ATTR1:[0-9]+]] ; CHECK-NEXT: [[ENDPTR:%.*]] = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 [[STRLEN]] ; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* noundef nonnull align 1 dereferenceable(6) [[ENDPTR]], i8* noundef nonnull align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i32 6, i1 false) ; CHECK-NEXT: ret void @@ -102,7 +102,7 @@ define i8* @test5(i8* %str, i32 %n) { ; CHECK-LABEL: @test5( -; CHECK-NEXT: [[STRLEN:%.*]] = call i32 @strlen(i8* noundef nonnull dereferenceable(1) [[STR:%.*]]) +; CHECK-NEXT: [[STRLEN:%.*]] = call i32 @strlen(i8* nocapture noundef nonnull dereferenceable(1) [[STR:%.*]]) #[[ATTR1]] ; CHECK-NEXT: [[ENDPTR:%.*]] = getelementptr i8, i8* [[STR]], i32 [[STRLEN]] ; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* noundef nonnull align 1 dereferenceable(6) [[ENDPTR]], i8* noundef nonnull align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i32 6, i1 false) ; CHECK-NEXT: ret i8* [[STR]] Index: llvm/test/Transforms/InstCombine/strndup.ll =================================================================== --- llvm/test/Transforms/InstCombine/strndup.ll +++ llvm/test/Transforms/InstCombine/strndup.ll @@ -8,7 +8,7 @@ define i8* @test1() { ; CHECK-LABEL: @test1( -; CHECK-NEXT: [[STRDUP:%.*]] = call dereferenceable_or_null(1) i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @null, i64 0, i64 0)) +; CHECK-NEXT: [[STRDUP:%.*]] = call noalias dereferenceable_or_null(1) i8* @strdup(i8* nocapture readonly getelementptr inbounds ([1 x i8], [1 x i8]* @null, i64 0, i64 0)) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: ret i8* [[STRDUP]] ; %src = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0 @@ -28,7 +28,7 @@ define i8* @test3() { ; CHECK-LABEL: @test3( -; CHECK-NEXT: [[STRDUP:%.*]] = call dereferenceable_or_null(6) i8* @strdup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i64 0, i64 0)) +; CHECK-NEXT: [[STRDUP:%.*]] = call noalias dereferenceable_or_null(6) i8* @strdup(i8* nocapture readonly getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i64 0, i64 0)) #[[ATTR0]] ; CHECK-NEXT: ret i8* [[STRDUP]] ; %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0 @@ -38,7 +38,7 @@ define i8* @test4() { ; CHECK-LABEL: @test4( -; CHECK-NEXT: [[STRDUP:%.*]] = call dereferenceable_or_null(6) i8* @strdup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i64 0, i64 0)) +; CHECK-NEXT: [[STRDUP:%.*]] = call noalias dereferenceable_or_null(6) i8* @strdup(i8* nocapture readonly getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i64 0, i64 0)) #[[ATTR0]] ; CHECK-NEXT: ret i8* [[STRDUP]] ; %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0 @@ -48,7 +48,7 @@ define i8* @test5() { ; CHECK-LABEL: @test5( -; CHECK-NEXT: [[STRDUP:%.*]] = call dereferenceable_or_null(6) i8* @strdup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i64 0, i64 0)) +; CHECK-NEXT: [[STRDUP:%.*]] = call noalias dereferenceable_or_null(6) i8* @strdup(i8* nocapture readonly getelementptr inbounds ([6 x i8], [6 x i8]* @hello, i64 0, i64 0)) #[[ATTR0]] ; CHECK-NEXT: ret i8* [[STRDUP]] ; %src = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0 Index: llvm/test/Transforms/InstCombine/strstr-1.ll =================================================================== --- llvm/test/Transforms/InstCombine/strstr-1.ll +++ llvm/test/Transforms/InstCombine/strstr-1.ll @@ -27,7 +27,7 @@ define i8* @test_simplify2(i8* %str) { ; CHECK-LABEL: @test_simplify2( -; CHECK-NEXT: [[STRCHR:%.*]] = call i8* @strchr(i8* noundef nonnull dereferenceable(1) [[STR:%.*]], i32 97) +; CHECK-NEXT: [[STRCHR:%.*]] = call i8* @strchr(i8* noundef nonnull dereferenceable(1) [[STR:%.*]], i32 97) #[[ATTR1:[0-9]+]] ; CHECK-NEXT: ret i8* [[STRCHR]] ; %pat = getelementptr inbounds [2 x i8], [2 x i8]* @.str1, i32 0, i32 0 @@ -61,8 +61,8 @@ define i1 @test_simplify5(i8* %str, i8* %pat) { ; CHECK-LABEL: @test_simplify5( -; CHECK-NEXT: [[STRLEN:%.*]] = call i64 @strlen(i8* noundef nonnull dereferenceable(1) [[PAT:%.*]]) -; CHECK-NEXT: [[STRNCMP:%.*]] = call i32 @strncmp(i8* [[STR:%.*]], i8* [[PAT]], i64 [[STRLEN]]) +; CHECK-NEXT: [[STRLEN:%.*]] = call i64 @strlen(i8* nocapture noundef nonnull dereferenceable(1) [[PAT:%.*]]) #[[ATTR1]] +; CHECK-NEXT: [[STRNCMP:%.*]] = call i32 @strncmp(i8* nocapture [[STR:%.*]], i8* nocapture [[PAT]], i64 [[STRLEN]]) #[[ATTR1]] ; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[STRNCMP]], 0 ; CHECK-NEXT: ret i1 [[CMP1]] ; Index: llvm/test/Transforms/MergeICmps/X86/alias-merge-blocks.ll =================================================================== --- llvm/test/Transforms/MergeICmps/X86/alias-merge-blocks.ll +++ llvm/test/Transforms/MergeICmps/X86/alias-merge-blocks.ll @@ -12,7 +12,7 @@ ; X86-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 ; X86-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP0]] to i8* ; X86-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP1]] to i8* -; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 16) +; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture [[CSTR]], i8* nocapture [[CSTR1]], i64 16) #[[ATTR0:[0-9]+]] ; X86-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; X86-NEXT: br label [[OPEQ1_EXIT:%.*]] ; X86: opeq1.exit: Index: llvm/test/Transforms/MergeICmps/X86/entry-block-shuffled.ll =================================================================== --- llvm/test/Transforms/MergeICmps/X86/entry-block-shuffled.ll +++ llvm/test/Transforms/MergeICmps/X86/entry-block-shuffled.ll @@ -14,7 +14,7 @@ ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 ; CHECK-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP0]] to i8* ; CHECK-NEXT: [[CSTR3:%.*]] = bitcast i32* [[TMP1]] to i8* -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR3]], i64 8) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture [[CSTR]], i8* nocapture [[CSTR3]], i64 8) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: br i1 [[TMP2]], label [[ENTRY2:%.*]], label [[OPEQ1_EXIT:%.*]] ; CHECK: entry2: Index: llvm/test/Transforms/MergeICmps/X86/gep-references-bb.ll =================================================================== --- llvm/test/Transforms/MergeICmps/X86/gep-references-bb.ll +++ llvm/test/Transforms/MergeICmps/X86/gep-references-bb.ll @@ -24,7 +24,7 @@ ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, i32* [[GEP]], i64 2 ; CHECK-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP0]] to i8* ; CHECK-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP1]] to i8* -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 8) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture [[CSTR]], i8* nocapture [[CSTR1]], i64 8) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: br label [[FINAL]] ; CHECK: final: Index: llvm/test/Transforms/MergeICmps/X86/int64-and-ptr.ll =================================================================== --- llvm/test/Transforms/MergeICmps/X86/int64-and-ptr.ll +++ llvm/test/Transforms/MergeICmps/X86/int64-and-ptr.ll @@ -14,7 +14,7 @@ ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_OUTER]], %struct.outer* [[O2:%.*]], i64 0, i32 0 ; CHECK-NEXT: [[CSTR:%.*]] = bitcast i64* [[TMP0]] to i8* ; CHECK-NEXT: [[CSTR1:%.*]] = bitcast i64* [[TMP1]] to i8* -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 16) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture [[CSTR]], i8* nocapture [[CSTR1]], i64 16) #[[ATTR2:[0-9]+]] ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: br label [[IF_END5:%.*]] ; CHECK: if.end5: Index: llvm/test/Transforms/MergeICmps/X86/multiple-blocks-does-work.ll =================================================================== --- llvm/test/Transforms/MergeICmps/X86/multiple-blocks-does-work.ll +++ llvm/test/Transforms/MergeICmps/X86/multiple-blocks-does-work.ll @@ -29,7 +29,7 @@ ; X86-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 2 ; X86-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP4]] to i8* ; X86-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP5]] to i8* -; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 8) +; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture [[CSTR]], i8* nocapture [[CSTR1]], i64 8) #[[ATTR0:[0-9]+]] ; X86-NEXT: [[TMP6:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; X86-NEXT: br label [[OPEQ1_EXIT]] ; X86: opeq1.exit: Index: llvm/test/Transforms/MergeICmps/X86/pair-int32-int32.ll =================================================================== --- llvm/test/Transforms/MergeICmps/X86/pair-int32-int32.ll +++ llvm/test/Transforms/MergeICmps/X86/pair-int32-int32.ll @@ -11,7 +11,7 @@ ; X86-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 ; X86-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP0]] to i8* ; X86-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP1]] to i8* -; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 8) +; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture [[CSTR]], i8* nocapture [[CSTR1]], i64 8) #[[ATTR0:[0-9]+]] ; X86-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; X86-NEXT: br label [[OPEQ1_EXIT:%.*]] ; X86: opeq1.exit: @@ -71,7 +71,7 @@ ; X86-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 ; X86-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP0]] to i8* ; X86-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP1]] to i8* -; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 8) +; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture [[CSTR]], i8* nocapture [[CSTR1]], i64 8) #[[ATTR0]] ; X86-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; X86-NEXT: br label [[OPEQ1_EXIT:%.*]] ; X86: opeq1.exit: Index: llvm/test/Transforms/MergeICmps/X86/pr41917.ll =================================================================== --- llvm/test/Transforms/MergeICmps/X86/pr41917.ll +++ llvm/test/Transforms/MergeICmps/X86/pr41917.ll @@ -20,7 +20,7 @@ ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[CLASS_A]], %class.a* [[P2:%.*]], i32 0, i32 1 ; CHECK-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP0]] to i8* ; CHECK-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP1]] to i8* -; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i32 8) +; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture [[CSTR]], i8* nocapture [[CSTR1]], i32 8) #[[ATTR2:[0-9]+]] ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; CHECK-NEXT: br label [[LAND_END6:%.*]] ; CHECK: land.end6: Index: llvm/test/Transforms/MergeICmps/X86/split-block-does-work.ll =================================================================== --- llvm/test/Transforms/MergeICmps/X86/split-block-does-work.ll +++ llvm/test/Transforms/MergeICmps/X86/split-block-does-work.ll @@ -14,7 +14,7 @@ ; X86-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0 ; X86-NEXT: [[CSTR:%.*]] = bitcast i32* [[TMP0]] to i8* ; X86-NEXT: [[CSTR1:%.*]] = bitcast i32* [[TMP1]] to i8* -; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 16) +; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* nocapture [[CSTR]], i8* nocapture [[CSTR1]], i64 16) #[[ATTR1:[0-9]+]] ; X86-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0 ; X86-NEXT: br label [[OPEQ1_EXIT:%.*]] ; X86: opeq1.exit: