forked from OSchip/llvm-project
[SanCov] Properly set ABI parameter attributes
Arguments need to have the proper ABI parameter attributes set. Followup to D101806. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D103288
This commit is contained in:
parent
ee544b8d86
commit
2d2a902078
|
@ -840,8 +840,9 @@ void ModuleSanitizerCoverage::InjectTraceForDiv(
|
|||
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(CB->getCalledFunction()->getAttributes());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -885,8 +886,10 @@ void ModuleSanitizerCoverage::InjectTraceForCmp(
|
|||
}
|
||||
|
||||
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(CB->getCalledFunction()->getAttributes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,12 +14,12 @@ entry:
|
|||
|
||||
; 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 @@ entry:
|
|||
%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
|
||||
|
|
|
@ -12,7 +12,7 @@ entry:
|
|||
}
|
||||
|
||||
; 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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue