[PATCH] D96979: [DSE] Extending IsGuaranteedLoopInvariant to support a GetElementPtrInst defined in the entry block

Matteo Favaro via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 12:34:50 PST 2021


fvrmatteo added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1922
     if (auto *GEP = dyn_cast<GEPOperator>(Ptr)) {
+      if (IsEntryBlockGEP(GEP))
+        return true;
----------------
fhahn wrote:
> this is not really GEP specific right? Any instruction in the entry block should be loop invariant.
You are right, I could rewrite the lambda as **IsEntryBlockInstruction** to do a check on the Ptr (simply casting it to llvm::Instruction and checking if it's part of the entry block) and do that as the really first check of the **IsGuaranteedLoopInvariantBase** function. WDYT?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96979



More information about the llvm-commits mailing list