[PATCH] D154205: [MachineLICM] Handle subloops

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 06:14:32 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineLICM.cpp:778
+          }
+        }
+
----------------
Uff, this looks like a pretty big hack. It is viable to pass the loop as a parameter instead of temporarily changing "global" state?


================
Comment at: llvm/lib/CodeGen/MachineLICM.cpp:1320
+    if (!DT->dominates(PrevMI->getParent(), MI->getParent()))
+      continue;
+
----------------
This seems to work around a larger issue. The problem is that CSEMap will get initialized for whichever preheader we happen to hoist into first. Thanks to this check, we will at least not make invalid replacements, but it means we will miss CSE opportunities if we are hoisting into any other preheader.

Probably the CSE map should be by preheader, instead of having only the one.


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

https://reviews.llvm.org/D154205



More information about the llvm-commits mailing list