@@ -160,6 +160,43 @@ define i64 @test_ptrauth_resign_ptrauth_constant(ptr %p) {
160160 ret i64 %authed
161161}
162162
163+ @ds = external global i8
164+
165+ define i64 @test_ptrauth_nop_ds1 (ptr %p ) {
166+ ; CHECK-LABEL: @test_ptrauth_nop_ds1(
167+ ; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[P:%.*]] to i64
168+ ; CHECK-NEXT: [[SIGNED:%.*]] = call i64 @llvm.ptrauth.sign(i64 [[TMP0]], i32 1, i64 1234) [ "deactivation-symbol"(ptr @ds) ]
169+ ; CHECK-NEXT: [[AUTHED:%.*]] = call i64 @llvm.ptrauth.auth(i64 [[SIGNED]], i32 1, i64 1234)
170+ ; CHECK-NEXT: ret i64 [[AUTHED]]
171+ ;
172+ %tmp0 = ptrtoint ptr %p to i64
173+ %signed = call i64 @llvm.ptrauth.sign (i64 %tmp0 , i32 1 , i64 1234 ) [ "deactivation-symbol" (ptr @ds ) ]
174+ %authed = call i64 @llvm.ptrauth.auth (i64 %signed , i32 1 , i64 1234 )
175+ ret i64 %authed
176+ }
177+
178+ define i64 @test_ptrauth_nop_ds2 (ptr %p ) {
179+ ; CHECK-LABEL: @test_ptrauth_nop_ds2(
180+ ; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[P:%.*]] to i64
181+ ; CHECK-NEXT: [[SIGNED:%.*]] = call i64 @llvm.ptrauth.sign(i64 [[TMP0]], i32 1, i64 1234)
182+ ; CHECK-NEXT: [[AUTHED:%.*]] = call i64 @llvm.ptrauth.auth(i64 [[SIGNED]], i32 1, i64 1234) [ "deactivation-symbol"(ptr @ds) ]
183+ ; CHECK-NEXT: ret i64 [[AUTHED]]
184+ ;
185+ %tmp0 = ptrtoint ptr %p to i64
186+ %signed = call i64 @llvm.ptrauth.sign (i64 %tmp0 , i32 1 , i64 1234 )
187+ %authed = call i64 @llvm.ptrauth.auth (i64 %signed , i32 1 , i64 1234 ) [ "deactivation-symbol" (ptr @ds ) ]
188+ ret i64 %authed
189+ }
190+
191+ define i64 @test_ptrauth_nop_ds_constant () {
192+ ; CHECK-LABEL: @test_ptrauth_nop_ds_constant(
193+ ; CHECK-NEXT: [[AUTHED:%.*]] = call i64 @llvm.ptrauth.auth(i64 ptrtoint (ptr ptrauth (ptr @foo, i32 1, i64 1234, ptr null, ptr @ds) to i64), i32 1, i64 1234)
194+ ; CHECK-NEXT: ret i64 [[AUTHED]]
195+ ;
196+ %authed = call i64 @llvm.ptrauth.auth (i64 ptrtoint (ptr ptr auth(ptr @foo , i32 1 , i64 1234 , ptr null , ptr @ds ) to i64 ), i32 1 , i64 1234 )
197+ ret i64 %authed
198+ }
199+
163200declare i64 @llvm.ptrauth.auth (i64 , i32 , i64 )
164201declare i64 @llvm.ptrauth.sign (i64 , i32 , i64 )
165202declare i64 @llvm.ptrauth.resign (i64 , i32 , i64 , i32 , i64 )
0 commit comments