[llvm] [SVE] Fix incorrect offset calculation when rewriting an instruction's frame index. (PR #70315)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 27 05:04:24 PDT 2023


================
@@ -1287,3 +1288,28 @@ body:             |
 
     RET_ReallyLR
 ---
+...
+# CHECK-LABEL: name: fp_relative_that_is_not_a_multiple_of_VLx16
+# CHECK:         - { id: 0, name: '', type: default, offset: -50, size: 50, alignment: 2,
+# CHECK-NEXT:        stack-id: scalable-vector
+# CHECK:         - { id: 1, name: '', type: default, offset: -92, size: 40, alignment: 4,
+# CHECK-NEXT:        stack-id: scalable-vector
+# CHECK:         - { id: 2, name: '', type: default, offset: -102, size: 10, alignment: 2,
+# CHECK-NEXT:        stack-id: scalable-vector
+
+# CHECK:      $x8 = ADDPL_XXI $fp, -14
+# CHECK-NEXT: $z0 = LD1W_D_IMM killed renamable $p0, killed $x8, -8
+
+name:            fp_relative_that_is_not_a_multiple_of_VLx16
+stack:
+  - { id: 0, stack-id: scalable-vector, size: 50, alignment: 2 }
----------------
sdesmalen-arm wrote:

The test can be simplified to have a single object, rather than multiple. Additionally, the extending part of the load makes the test even more confusing because `mul vl` means `mul vscale x 2 x 4 bytes` instead of `mul vscale x 4 x 4 bytes`.

Maybe you can simplify this test to:

```
stack:
  - { id: 0, stack-id: scalable-vector, size: 156, alignment: 1 }
  - { id: 1, stack-id: default, type: variable-sized, alignment: 1 }
...
   renamable $z0 = LD1W_IMM killed renamable $p0, %stack.0, 0
```

where `156` is calculated as `(8 x 16) + (14 x 2)` bytes. I checked that this still exposes the original issue this patch intends to fix.

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


More information about the llvm-commits mailing list