[llvm] [InstCombine] Combine ptrauth constants into ptrauth intrinsics. (PR #94705)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 12 07:56:06 PDT 2024
================
@@ -12,6 +12,26 @@ define i64 @test_ptrauth_nop(ptr %p) {
ret i64 %authed
}
+declare void @foo()
+
+define i64 @test_ptrauth_nop_constant() {
+; CHECK-LABEL: @test_ptrauth_nop_constant(
+; CHECK-NEXT: ret i64 ptrtoint (ptr @foo to i64)
+;
+ %authed = call i64 @llvm.ptrauth.auth(i64 ptrtoint(ptr ptrauth(ptr @foo, i32 1, i64 1234) to i64), i32 1, i64 1234)
+ ret i64 %authed
+}
+
+define i64 @test_ptrauth_nop_constant_addrdisc() {
+; CHECK-LABEL: @test_ptrauth_nop_constant_addrdisc(
+; CHECK-NEXT: ret i64 ptrtoint (ptr @foo to i64)
+;
+ %addr = ptrtoint void()* @foo to i64
----------------
nikic wrote:
```suggestion
%addr = ptrtoint ptr @foo to i64
```
https://github.com/llvm/llvm-project/pull/94705
More information about the llvm-commits
mailing list