[llvm] [ReachingDefAnalysis] Extend the analysis to stack objects. (PR #118097)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 19:27:03 PST 2025


================
@@ -209,19 +235,62 @@ void ReachingDefAnalysis::processBasicBlock(
   leaveBasicBlock(MBB);
 }
 
+void ReachingDefAnalysis::printAllReachingDefs(MachineFunction &MF) {
+  dbgs() << "RDA results for " << MF.getName() << "\n";
+  int Num = 0;
+  DenseMap<MachineInstr *, int> InstToNumMap;
+  SmallPtrSet<MachineInstr *, 2> Defs;
+  for (MachineBasicBlock &MBB : MF) {
+    for (MachineInstr &MI : MBB) {
+      for (MachineOperand &MO : MI.operands()) {
+        Register Reg;
+        if (MO.isFI()) {
+          int FrameIndex = MO.getIndex();
----------------
topperc wrote:

Is it possible for FrameIndex to be negative here? That's not supported by index2StackSlot

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


More information about the llvm-commits mailing list