[llvm] [RISCV][GISel] Reverse the operands the buildStore created in legalizeVAStart. (PR #73989)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 4 17:07:39 PST 2023


================
@@ -0,0 +1,41 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - | FileCheck --check-prefix=RV32 %s
+
+--- |
+  declare void @llvm.va_start(ptr) #0
+
+  define void @test_va_start(ptr %0, ptr %1, ptr %2, ptr %3, ptr %4, ptr %5, ptr %6, ptr %7, ...) {
+    %va = alloca ptr
+    call void @llvm.va_start(ptr %va)
+    ret void
+  }
+
+  attributes #0 = { nocallback nofree nosync nounwind willreturn }
+
+...
+---
+name:            test_va_start
+tracksRegLiveness: true
+fixedStack:
+  - { id: 0, size: 4, alignment: 16, isImmutable: true }
----------------
topperc wrote:

The entry in `fixedStack:` is from the call to createFixedObject in the call lowering code. The stack pointer is 16 byte aligned when a function starts so the alignment is 16.

The entry in the`stack:` section is from the alloca which didn't make an explicit alignment request so got the ABI alignment for a pointer. It's location on the stack isn't decided yet so we only record the requested size and alignment. It's location will be assigned later by the prolog/epilog inserter pass.

Both entries say `id: 0` but they are different objects since one is in `fixedStack` and one is in `stack`.

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


More information about the llvm-commits mailing list