[llvm-branch-commits] [llvm] [BOLT] Gadget scanner: clarify MCPlusBuilder callbacks interface (PR #136147)
Kristof Beyls via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu May 22 06:49:34 PDT 2025
================
@@ -985,6 +985,26 @@ inst_pacnbibsppc:
ret
.size inst_pacnbibsppc, .-inst_pacnbibsppc
+// Test that write-back forms of LDRA(A|B) instructions are handled properly.
+
+ .globl inst_ldraa_wb
+ .type inst_ldraa_wb, at function
+inst_ldraa_wb:
+// CHECK-NOT: inst_ldraa_wb
+ ldraa x2, [x0]!
+ pacda x0, x1
+ ret
+ .size inst_ldraa_wb, .-inst_ldraa_wb
+
+ .globl inst_ldrab_wb
+ .type inst_ldrab_wb, at function
+inst_ldrab_wb:
+// CHECK-NOT: inst_ldrab_wb
+ ldraa x2, [x0]!
+ pacda x0, x1
+ ret
+ .size inst_ldrab_wb, .-inst_ldrab_wb
+
----------------
kbeyls wrote:
Quoting from the ArmARM description for LDRAA, LDRAB:
> The authenticated address is not written back to the base register, unless the pre-indexed variant of the instruction is used.
In this case, the address that is written back to the base register does not include the pointer authentication code.
Given whether the base register is authenticated after executing `ldra{ab}` depends on whether the pre-index addressing mode is used, I'm wondering if it would be a good idea to also add a test that shows that the scanner understands that after executing `ldraa x2, [x0]` `x0` contains a signed address, not an authenticated address?
Could this make a difference to any of the analysis implemented so far?
https://github.com/llvm/llvm-project/pull/136147
More information about the llvm-branch-commits
mailing list