[llvm] [BOLT][AArch64] Implemented createDummyReturnFunction. (PR #96626)

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 1 08:13:11 PDT 2024


================
@@ -706,8 +706,20 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
     unsigned ShiftVal = AArch64_AM::getArithShiftValue(OperandExtension);
     AArch64_AM::ShiftExtendType ExtendType =
         AArch64_AM::getArithExtendType(OperandExtension);
-    if (ShiftVal != 2)
-      llvm_unreachable("Failed to match indirect branch! (fragment 2)");
+    if (ShiftVal != 2) {
+      // TODO: Handle the patten where ShiftVal != 2.
+      // The following code sequence below has no shift amount,
+      // the range could be 0 to 4.
+      // The pattern comes from libc, it occurs when the binary is static.
+      //   adr     x6, 0x219fb0 <sigall_set+0x88>
+      //   add     x6, x6, x14, lsl #2
+      //   ldr     w7, [x6]
+      //   add     x6, x6, w7, sxtw => no shift amount
----------------
paschalis-mpeis wrote:

Hey @samolisov ,

This particular change, and a few others, are **not related** to my patch. :)

I have modified only the files: `dummy-return.test`, `main.c`, and `AArch64MCPlusBuilder.cpp`.
But you are seeing more changes because this is a 'stacked pull-request' meaning, that it depends on:
- https://github.com/llvm/llvm-project/pull/83394

Therefore, it also shows all changes of the above Pull-Request as well.

So, to see only the relevant changes, you must click on individual commits, like [this one](https://github.com/llvm/llvm-project/pull/96626/commits/7719e07d74a98f580836d3e32f6133e994be4f98) from the ['Commits' tab](https://github.com/llvm/llvm-project/pull/96626/commits).
I document this on the section 'NOTES' on my initial comment [here](https://github.com/llvm/llvm-project/pull/96626#issue-2372592692).

PS, even if this gets accepted, it will be merged only after #83394 was merged.

https://github.com/llvm/llvm-project/pull/96626


More information about the llvm-commits mailing list