[PATCH] D90239: [MIR] Fix out of bounds access in MIRPrinter.

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 27 09:12:01 PDT 2020


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/MIRPrinter.cpp:91-92
   unsigned ID;
+  /// Index in StackObjects vector.
+  unsigned Idx;
   bool IsFixed;
----------------
Why does the index need to be stored? It seems like the problem is the printer/parser implicitly deleting dead objects


================
Comment at: llvm/test/CodeGen/MIR/AMDGPU/stack-id-assert.mir:14-20
+  define void @foo() {
+    ret void
+  }
+
+  define void @bar() {
+    ret void
+  }
----------------
Don't need the IR section


================
Comment at: llvm/test/CodeGen/MIR/AMDGPU/stack-id-assert.mir:116-180
+name:            bar
+alignment:       1
+exposesReturnsTwice: false
+legalized:       false
+regBankSelected: false
+selected:        false
+failedISel:      false
----------------
Most of the mir fields can be eliminated


================
Comment at: llvm/test/CodeGen/MIR/AMDGPU/stack-id-assert.mir:220
+    dead $sgpr30_sgpr31 = SI_CALL killed renamable $sgpr4_sgpr5, @foo, csr_amdgpu_highregs, implicit $sgpr0_sgpr1_sgpr2_sgpr3
+    renamable $sgpr30_sgpr31 = SI_SPILL_S64_RESTORE %stack.0, implicit $exec, implicit $sgpr0_sgpr1_sgpr2_sgpr3, implicit $sgpr32
+    ADJCALLSTACKDOWN 0, 0, implicit-def dead $scc, implicit-def $sgpr32, implicit $sgpr32
----------------
You should only need a single block with the spill instructions


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90239/new/

https://reviews.llvm.org/D90239



More information about the llvm-commits mailing list