[llvm] [ReachingDefAnalysis] Extend the analysis to stack objects. (PR #118097)
Michael Maitland via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 21 05:50:55 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;
----------------
michaelmaitland wrote:
We need to rethink this data structure based on @nikic's findings about memory usage.
Some points that may be helpful in reworking this:
* Use `empty()` instead of `-1`. See https://github.com/llvm/llvm-project/pull/118097#discussion_r1863677010
* NumStackEntries entries are allocated for every single MBB. We can probably optimize this to only the number of instructions that define a frame index in that MBB?
* Do we need to track this information for every single basic block, especially when it doesn't interact with frame objects?
https://github.com/llvm/llvm-project/pull/118097
More information about the llvm-commits
mailing list