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

Mikhail Gudim via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 00:45:16 PST 2024


================
@@ -234,7 +301,10 @@ void ReachingDefAnalysis::reset() {
 
 void ReachingDefAnalysis::init() {
   NumRegUnits = TRI->getNumRegUnits();
+  NumStackObjects = MF->getFrameInfo().getNumObjects();
----------------
mgudim wrote:

> Do you need to make them member variables?

We don't need to. But on the other hand, do you want to call `MI.getParent()->getFrameInfo().getNumObjects()` every time just to save a little bit of space? I think a separate variable makes the code more readable and also it is consistent with `NumRegUnits`.

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


More information about the llvm-commits mailing list