[clang] dafaa84 - [XRay] Make llvm.xray.customevent parameter type match __xray_customevent
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 19 20:38:22 PDT 2023
Author: Fangrui Song
Date: 2023-06-19T20:38:16-07:00
New Revision: dafaa8463ef6991055c2fcee799757fa46965625
URL: https://github.com/llvm/llvm-project/commit/dafaa8463ef6991055c2fcee799757fa46965625
DIFF: https://github.com/llvm/llvm-project/commit/dafaa8463ef6991055c2fcee799757fa46965625.diff
LOG: [XRay] Make llvm.xray.customevent parameter type match __xray_customevent
The intrinsic has a smaller integer type than the parameter type of
builtin-function/API. Fix this similar to commit 3fa3cb408d8d0f1365b322262e501b6945f7ead9.
Added:
Modified:
clang/test/CodeGen/xray-always-emit-customevent.cpp
clang/test/CodeGen/xray-customevent.cpp
clang/test/CodeGen/xray-instrumentation-bundles.cpp
llvm/include/llvm/IR/Intrinsics.td
llvm/test/CodeGen/X86/xray-custom-log.ll
Removed:
################################################################################
diff --git a/clang/test/CodeGen/xray-always-emit-customevent.cpp b/clang/test/CodeGen/xray-always-emit-customevent.cpp
index 63d4b91f81908..289111c90ff0a 100644
--- a/clang/test/CodeGen/xray-always-emit-customevent.cpp
+++ b/clang/test/CodeGen/xray-always-emit-customevent.cpp
@@ -6,5 +6,5 @@
[[clang::xray_never_instrument]] void neverInstrument() {
static constexpr char kPhase[] = "never";
__xray_customevent(kPhase, 5);
- // CHECK: call void @llvm.xray.customevent(ptr{{.*}}, i32 5)
+ // CHECK: call void @llvm.xray.customevent(ptr{{.*}}, i64 5)
}
diff --git a/clang/test/CodeGen/xray-customevent.cpp b/clang/test/CodeGen/xray-customevent.cpp
index efaa26d633109..c64cbbd7c4236 100644
--- a/clang/test/CodeGen/xray-customevent.cpp
+++ b/clang/test/CodeGen/xray-customevent.cpp
@@ -4,14 +4,14 @@
[[clang::xray_always_instrument]] void alwaysInstrument() {
static constexpr char kPhase[] = "instrument";
__xray_customevent(kPhase, 10);
- // CHECK: call void @llvm.xray.customevent(ptr{{.*}}, i32 10)
+ // CHECK: call void @llvm.xray.customevent(ptr{{.*}}, i64 10)
}
// CHECK-LABEL: @_Z15neverInstrumentv
[[clang::xray_never_instrument]] void neverInstrument() {
static constexpr char kPhase[] = "never";
__xray_customevent(kPhase, 5);
- // CHECK-NOT: call void @llvm.xray.customevent(ptr{{.*}}, i32 5)
+ // CHECK-NOT: call void @llvm.xray.customevent(
}
// CHECK-LABEL: @_Z21conditionalInstrumenti
@@ -23,6 +23,6 @@
else
__xray_customevent(kUntrue, 6);
- // CHECK: call void @llvm.xray.customevent(ptr{{.*}}, i32 4)
- // CHECK: call void @llvm.xray.customevent(ptr{{.*}}, i32 6)
+ // CHECK: call void @llvm.xray.customevent(ptr{{.*}}, i64 4)
+ // CHECK: call void @llvm.xray.customevent(ptr{{.*}}, i64 6)
}
diff --git a/clang/test/CodeGen/xray-instrumentation-bundles.cpp b/clang/test/CodeGen/xray-instrumentation-bundles.cpp
index 45ea6e514e6cc..7b9ccb25a3b52 100644
--- a/clang/test/CodeGen/xray-instrumentation-bundles.cpp
+++ b/clang/test/CodeGen/xray-instrumentation-bundles.cpp
@@ -52,8 +52,8 @@
static constexpr char kPhase[] = "always";
__xray_customevent(kPhase, 6);
__xray_typedevent(1, kPhase, 6);
- // CUSTOM: call void @llvm.xray.customevent(ptr{{.*}}, i32 6)
- // NOCUSTOM-NOT: call void @llvm.xray.customevent(ptr{{.*}}, i32 6)
+ // CUSTOM: call void @llvm.xray.customevent(ptr {{.*}}, i64 6)
+ // NOCUSTOM-NOT: call void @llvm.xray.customevent(
// TYPED: call void @llvm.xray.typedevent(i64 {{.*}}, ptr{{.*}}, i64 6)
// NOTYPED-NOT: call void @llvm.xray.typedevent(
}
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index fbb2fa9a65646..c03eafea2438b 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -2253,7 +2253,7 @@ def int_hwasan_check_memaccess_shortgranules :
//===----------------------------------------------------------------------===//
// Custom event logging for x-ray.
// Takes a pointer to a string and the length of the string.
-def int_xray_customevent : Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty],
+def int_xray_customevent : Intrinsic<[], [llvm_ptr_ty, llvm_i64_ty],
[IntrWriteMem, NoCapture<ArgIndex<0>>,
ReadOnly<ArgIndex<0>>]>;
// Typed event logging for x-ray.
diff --git a/llvm/test/CodeGen/X86/xray-custom-log.ll b/llvm/test/CodeGen/X86/xray-custom-log.ll
index ea0d14b9cc7a2..c41aa1e986815 100644
--- a/llvm/test/CodeGen/X86/xray-custom-log.ll
+++ b/llvm/test/CodeGen/X86/xray-custom-log.ll
@@ -6,10 +6,10 @@
define i32 @customevent() nounwind "function-instrument"="xray-always" !dbg !1 {
%eventptr = alloca i8
- %eventsize = alloca i32
- store i32 3, ptr %eventsize
- %val = load i32, ptr %eventsize
- call void @llvm.xray.customevent(ptr %eventptr, i32 %val), !dbg !8
+ %eventsize = alloca i64
+ store i64 3, ptr %eventsize
+ %val = load i64, ptr %eventsize
+ call void @llvm.xray.customevent(ptr %eventptr, i64 %val), !dbg !8
; CHECK-LABEL: Lxray_event_sled_0:
; CHECK: .byte 0xeb, 0x0f
; CHECK-NEXT: pushq %rdi
@@ -75,7 +75,7 @@ define i32 @typedevent() nounwind "function-instrument"="xray-always" !dbg !2 {
; CHECK-LABEL: Lxray_sleds_start1:
; CHECK: .quad {{.*}}xray_typed_event_sled_0
-declare void @llvm.xray.customevent(ptr, i32)
+declare void @llvm.xray.customevent(ptr, i64)
declare void @llvm.xray.typedevent(i64, ptr, i64)
;; Construct call site entries for PATCHABLE_EVENT_CALL.
More information about the cfe-commits
mailing list