[PATCH] D135369: [DSE] Relax constraint on isGuaranteedLoopInvariant

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 7 01:06:53 PDT 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1202
     const Loop *CurrentLI = LI.getLoopFor(Current->getParent());
+
     if (!ContainsIrreducibleLoops && CurrentLI &&
----------------
Spurious newline? This should either be one line higher or not exist.


================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1220
     if (auto *I = dyn_cast<Instruction>(Ptr))
-      return I->getParent()->isEntryBlock();
+      return !ContainsIrreducibleLoops && !LI.getLoopFor(I->getParent());
     return true;
----------------
I wonder whether we should retain the entry block check as well. That would make sure that even with irreducible cycles we will at least handle the important case of (constant geps of) allocas.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135369



More information about the llvm-commits mailing list