[llvm] [LoopUnroll] Add CSE to remove redundant loads after unrolling. (PR #83860)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 19:27:35 PDT 2024


================
@@ -1537,11 +1560,26 @@ void MemorySSA::buildMemorySSA(BatchAAResults &BAA) {
   // Now do regular SSA renaming on the MemoryDef/MemoryUse. Visited will get
   // filled in with all blocks.
   SmallPtrSet<BasicBlock *, 16> Visited;
-  renamePass(DT->getRootNode(), LiveOnEntryDef.get(), Visited);
+  if (L) {
+    if (auto *P = getMemoryAccess(L->getLoopPreheader())) {
+      for (Use &U : make_early_inc_range(P->uses())) {
----------------
nikic wrote:

Braces

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


More information about the llvm-commits mailing list