[llvm] 2d2a902 - [SanCov] Properly set ABI parameter attributes
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Thu May 27 15:27:41 PDT 2021
Author: Arthur Eubanks
Date: 2021-05-27T15:27:21-07:00
New Revision: 2d2a9020785c6e02afebc876aa2778fa64c5cafd
URL: https://github.com/llvm/llvm-project/commit/2d2a9020785c6e02afebc876aa2778fa64c5cafd
DIFF: https://github.com/llvm/llvm-project/commit/2d2a9020785c6e02afebc876aa2778fa64c5cafd.diff
LOG: [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
Added:
Modified:
llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
llvm/test/Instrumentation/SanitizerCoverage/const-cmp-tracing.ll
llvm/test/Instrumentation/SanitizerCoverage/div-tracing.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
index 8bce6b82482b5..3de7350ac9530 100644
--- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
+++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
@@ -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());
}
}
}
diff --git a/llvm/test/Instrumentation/SanitizerCoverage/const-cmp-tracing.ll b/llvm/test/Instrumentation/SanitizerCoverage/const-cmp-tracing.ll
index 36919275488b3..111cc1cc2f545 100644
--- a/llvm/test/Instrumentation/SanitizerCoverage/const-cmp-tracing.ll
+++ b/llvm/test/Instrumentation/SanitizerCoverage/const-cmp-tracing.ll
@@ -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
diff --git a/llvm/test/Instrumentation/SanitizerCoverage/div-tracing.ll b/llvm/test/Instrumentation/SanitizerCoverage/div-tracing.ll
index 12394159510a9..d650ac0ee8192 100644
--- a/llvm/test/Instrumentation/SanitizerCoverage/div-tracing.ll
+++ b/llvm/test/Instrumentation/SanitizerCoverage/div-tracing.ll
@@ -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
More information about the llvm-commits
mailing list