Skip to content

Commit 6f44be9

Browse files
authored
IR: Make llvm.fake.use a DefaultAttrsIntrinsic (#131743)
This shouldn't be special and is just an ordinary sideeffect.
1 parent ecae8d0 commit 6f44be9

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

clang/test/CodeGen/fake-use-determinism.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
// but that it remains the same between different test runs.
66

77
// CHECK: [[K_FAKE_USE:%[a-zA-Z0-9\.]+]] = load i32, ptr %k.addr
8-
// CHECK-NEXT: call void (...) @llvm.fake.use(i32 [[K_FAKE_USE]]) #2
8+
// CHECK-NEXT: call void (...) @llvm.fake.use(i32 [[K_FAKE_USE]])
99
// CHECK-NEXT: [[J_FAKE_USE:%[a-zA-Z0-9\.]+]] = load i32, ptr %j.addr
10-
// CHECK-NEXT: call void (...) @llvm.fake.use(i32 [[J_FAKE_USE]]) #2
10+
// CHECK-NEXT: call void (...) @llvm.fake.use(i32 [[J_FAKE_USE]])
1111
// CHECK-NEXT: [[I_FAKE_USE:%[a-zA-Z0-9\.]+]] = load i32, ptr %i.addr
12-
// CHECK-NEXT: call void (...) @llvm.fake.use(i32 [[I_FAKE_USE]]) #2
12+
// CHECK-NEXT: call void (...) @llvm.fake.use(i32 [[I_FAKE_USE]])
1313

1414
void bar();
1515
void foo(int i, int j, int k)

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,8 @@ def int_is_constant : DefaultAttrsIntrinsic<[llvm_i1_ty], [llvm_any_ty],
18811881
"llvm.is.constant">;
18821882

18831883
// Introduce a use of the argument without generating any code.
1884-
def int_fake_use : Intrinsic<[], [llvm_vararg_ty]>;
1884+
def int_fake_use : DefaultAttrsIntrinsic<[], [llvm_vararg_ty],
1885+
[IntrHasSideEffects, IntrInaccessibleMemOnly, IntrWillReturn]>;
18851886

18861887
// Intrinsic to mask out bits of a pointer.
18871888
// First argument must be pointer or vector of pointer. This is checked by the

llvm/test/CodeGen/AMDGPU/lower-kernargs.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,13 +1837,13 @@ attributes #2 = { nounwind "target-cpu"="tahiti" }
18371837
!llvm.module.flags = !{!0}
18381838
!0 = !{i32 1, !"amdhsa_code_object_version", i32 500}
18391839
;.
1840-
; HSA: attributes #[[ATTR0:[0-9]+]] = { nounwind }
1840+
; HSA: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }
18411841
; HSA: attributes #[[ATTR1:[0-9]+]] = { nounwind "target-cpu"="kaveri" }
18421842
; HSA: attributes #[[ATTR2:[0-9]+]] = { nounwind "amdgpu-implicitarg-num-bytes"="40" "target-cpu"="kaveri" }
18431843
; HSA: attributes #[[ATTR3:[0-9]+]] = { nounwind "target-cpu"="tahiti" }
18441844
; HSA: attributes #[[ATTR4:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
18451845
;.
1846-
; MESA: attributes #[[ATTR0:[0-9]+]] = { nounwind }
1846+
; MESA: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }
18471847
; MESA: attributes #[[ATTR1:[0-9]+]] = { nounwind "target-cpu"="kaveri" }
18481848
; MESA: attributes #[[ATTR2:[0-9]+]] = { nounwind "amdgpu-implicitarg-num-bytes"="40" "target-cpu"="kaveri" }
18491849
; MESA: attributes #[[ATTR3:[0-9]+]] = { nounwind "target-cpu"="tahiti" }

0 commit comments

Comments
 (0)