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

Mikhail Gudim via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 06:42:45 PST 2025


================
@@ -138,6 +141,13 @@ class ReachingDefAnalysis : public MachineFunctionPass {
   DenseMap<MachineInstr *, int> InstIds;
 
   MBBReachingDefsInfo MBBReachingDefs;
+  using MBBFrameObjsReachingDefsInfo =
+      std::vector<std::vector<std::vector<int>>>;
+  // MBBFrameObjsReachingDefs[i][j] is a list of instruction indicies (relative
+  // to begining of MBB) that define frame index (j +
+  // MF->getFrameInfo().getObjectIndexBegin()) in MBB i. This is used in
+  // answering reaching defenition queries.
+  MBBFrameObjsReachingDefsInfo MBBFrameObjsReachingDefs;
----------------
mgudim wrote:

I agree. I was thinking to do a separate MR to unite `AllReachingDefs` (was used before for physical registers) and the new `MBBFrameObjReachingDefs` into a hashmap indexed by tuple `MBBNum-reg` where `reg` could represent a stack slot too. We would return `SmallVector({-1})` if nothing is found for a given key.

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


More information about the llvm-commits mailing list