diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp --- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp +++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp @@ -840,8 +840,11 @@ TypeSize == 64 ? 1 : -1; if (CallbackIdx < 0) continue; auto Ty = Type::getIntNTy(*C, TypeSize); - IRB.CreateCall(SanCovTraceDivFunction[CallbackIdx], - {IRB.CreateIntCast(A1, Ty, true)}); + auto *CB = IRB.CreateCall(SanCovTraceDivFunction[CallbackIdx], + {IRB.CreateIntCast(A1, Ty, true)}); + CB->setAttributes( + cast(SanCovTraceDivFunction[CallbackIdx].getCallee()) + ->getAttributes()); } } @@ -885,8 +888,11 @@ } auto Ty = Type::getIntNTy(*C, TypeSize); - IRB.CreateCall(CallbackFunc, {IRB.CreateIntCast(A0, Ty, true), - IRB.CreateIntCast(A1, Ty, true)}); + auto *CB = + IRB.CreateCall(CallbackFunc, {IRB.CreateIntCast(A0, Ty, true), + IRB.CreateIntCast(A1, Ty, true)}); + CB->setAttributes( + cast(CallbackFunc.getCallee())->getAttributes()); } } } diff --git a/llvm/test/Instrumentation/SanitizerCoverage/const-cmp-tracing.ll b/llvm/test/Instrumentation/SanitizerCoverage/const-cmp-tracing.ll --- a/llvm/test/Instrumentation/SanitizerCoverage/const-cmp-tracing.ll +++ b/llvm/test/Instrumentation/SanitizerCoverage/const-cmp-tracing.ll @@ -14,12 +14,12 @@ ; compare (const, non-const) icmp slt i32 %a, 1 -; CHECK: call void @__sanitizer_cov_trace_const_cmp4(i32 1, i32 %a) +; CHECK: call void @__sanitizer_cov_trace_const_cmp4(i32 zeroext 1, i32 zeroext %a) ; CHECK-NEXT: icmp slt i32 %a, 1 ; compare (non-const, const) icmp slt i32 1, %a -; CHECK: call void @__sanitizer_cov_trace_const_cmp4(i32 1, i32 %a) +; CHECK: call void @__sanitizer_cov_trace_const_cmp4(i32 zeroext 1, i32 zeroext %a) ; CHECK-NEXT: icmp slt i32 1, %a ; compare (const, const) - should not be instrumented @@ -31,22 +31,22 @@ %x = trunc i32 %a to i8 icmp slt i8 %x, 1 -; CHECK: call void @__sanitizer_cov_trace_const_cmp1(i8 1, i8 %x) +; CHECK: call void @__sanitizer_cov_trace_const_cmp1(i8 zeroext 1, i8 zeroext %x) ; CHECK-NEXT: icmp slt i8 %x, 1 icmp slt i8 1, %x -; CHECK: call void @__sanitizer_cov_trace_const_cmp1(i8 1, i8 %x) +; CHECK: call void @__sanitizer_cov_trace_const_cmp1(i8 zeroext 1, i8 zeroext %x) ; CHECK-NEXT: icmp slt i8 1, %x ; compare variables of word size %y = trunc i32 %a to i16 icmp slt i16 %y, 1 -; CHECK: call void @__sanitizer_cov_trace_const_cmp2(i16 1, i16 %y) +; CHECK: call void @__sanitizer_cov_trace_const_cmp2(i16 zeroext 1, i16 zeroext %y) ; CHECK-NEXT: icmp slt i16 %y, 1 icmp slt i16 1, %y -; CHECK: call void @__sanitizer_cov_trace_const_cmp2(i16 1, i16 %y) +; CHECK: call void @__sanitizer_cov_trace_const_cmp2(i16 zeroext 1, i16 zeroext %y) ; CHECK-NEXT: icmp slt i16 1, %y ; compare variables of qword size diff --git a/llvm/test/Instrumentation/SanitizerCoverage/div-tracing.ll b/llvm/test/Instrumentation/SanitizerCoverage/div-tracing.ll --- a/llvm/test/Instrumentation/SanitizerCoverage/div-tracing.ll +++ b/llvm/test/Instrumentation/SanitizerCoverage/div-tracing.ll @@ -12,7 +12,7 @@ } ; CHECK-LABEL: @div_a_b -; CHECK: call void @__sanitizer_cov_trace_div4(i32 %b) +; CHECK: call void @__sanitizer_cov_trace_div4(i32 zeroext %b) ; CHECK: ret