mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[SanitizerCoverage] Use zeroext for cmp parameters on all targets
Commit 9385aaa84851 ("[sancov] Fix PR33732") added zeroext to __sanitizer_cov_trace(_const)?_cmp[1248] parameters for x86_64 only, however, it is useful on other targets, in particular, on SystemZ: it fixes swap-cmp.test. Therefore, use it on all targets. This is safe: if target ABI does not require zero extension for a particular parameter, zeroext is simply ignored. A similar change has been implemeted as part of commit 3bc439bdff8b ("[MSan] Add instrumentation for SystemZ"), and there were no problems with it. Reviewed By: morehouse Differential Revision: https://reviews.llvm.org/D85689
This commit is contained in:
parent
c9db20b4cf
commit
9b258b83db
@ -425,15 +425,13 @@ bool ModuleSanitizerCoverage::instrumentModule(
|
||||
|
||||
SanCovTracePCIndir =
|
||||
M.getOrInsertFunction(SanCovTracePCIndirName, VoidTy, IntptrTy);
|
||||
// Make sure smaller parameters are zero-extended to i64 as required by the
|
||||
// x86_64 ABI.
|
||||
// Make sure smaller parameters are zero-extended to i64 if required by the
|
||||
// target ABI.
|
||||
AttributeList SanCovTraceCmpZeroExtAL;
|
||||
if (TargetTriple.getArch() == Triple::x86_64) {
|
||||
SanCovTraceCmpZeroExtAL =
|
||||
SanCovTraceCmpZeroExtAL.addParamAttribute(*C, 0, Attribute::ZExt);
|
||||
SanCovTraceCmpZeroExtAL =
|
||||
SanCovTraceCmpZeroExtAL.addParamAttribute(*C, 1, Attribute::ZExt);
|
||||
}
|
||||
SanCovTraceCmpZeroExtAL =
|
||||
SanCovTraceCmpZeroExtAL.addParamAttribute(*C, 0, Attribute::ZExt);
|
||||
SanCovTraceCmpZeroExtAL =
|
||||
SanCovTraceCmpZeroExtAL.addParamAttribute(*C, 1, Attribute::ZExt);
|
||||
|
||||
SanCovTraceCmpFunction[0] =
|
||||
M.getOrInsertFunction(SanCovTraceCmp1, SanCovTraceCmpZeroExtAL, VoidTy,
|
||||
@ -458,8 +456,7 @@ bool ModuleSanitizerCoverage::instrumentModule(
|
||||
|
||||
{
|
||||
AttributeList AL;
|
||||
if (TargetTriple.getArch() == Triple::x86_64)
|
||||
AL = AL.addParamAttribute(*C, 0, Attribute::ZExt);
|
||||
AL = AL.addParamAttribute(*C, 0, Attribute::ZExt);
|
||||
SanCovTraceDivFunction[0] =
|
||||
M.getOrInsertFunction(SanCovTraceDiv4, AL, VoidTy, IRB.getInt32Ty());
|
||||
}
|
||||
|
@ -9,11 +9,15 @@ entry:
|
||||
}
|
||||
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_pc_indir(i64)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_cmp1(i8, i8)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_cmp2(i16, i16)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_cmp4(i32, i32)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_cmp1(i8 zeroext, i8 zeroext)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_cmp2(i16 zeroext, i16 zeroext)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_cmp4(i32 zeroext, i32 zeroext)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_cmp8(i64, i64)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_div4(i32)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_const_cmp1(i8 zeroext, i8 zeroext)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_const_cmp2(i16 zeroext, i16 zeroext)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_const_cmp4(i32 zeroext, i32 zeroext)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_const_cmp8(i64, i64)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_div4(i32 zeroext)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_div8(i64)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_gep(i64)
|
||||
; CHECK-DAG: declare void @__sanitizer_cov_trace_switch(i64, i64*)
|
||||
|
Loading…
Reference in New Issue
Block a user