[PATCH] D143641: [MemorySSA] Iteratively check if gep's pointer operand is a guaranteed loop invariant
Alina Sbirlea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 14 00:03:10 PST 2023
asbirlea accepted this revision.
asbirlea added a comment.
This revision is now accepted and ready to land.
lgtm with comments addressed.
================
Comment at: llvm/lib/Analysis/MemorySSA.cpp:2629
+ // TODO: Increase limit?
+ const unsigned MaxGEPToLookup = 2;
+ for (unsigned I = 0; I < MaxGEPToLookup; I++) {
----------------
The AA "look through geps" limit is 6. I don't have a strong preference on the value, I don't have any data on how frequent this will be useful..
Would be good to use a cl::opt instead of a local constant though, for easier testing.
================
Comment at: llvm/lib/Analysis/MemorySSA.cpp:2640
+ }
+ } else
return true;
----------------
nit: Could reduce the if nesting
```
auto *I = dyn_cast<Instruction>(Ptr);
if (!I || isa<AllocaInst>(Ptr) || I->getParent()->isEntryBlock())
return true;
if (auto *GEP = dyn_cast<GEPOperator>(Ptr)) {
if (!GEP->hasAllConstantIndices())
return false;
Ptr = GEP->getPointerOperand();
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143641/new/
https://reviews.llvm.org/D143641
More information about the llvm-commits
mailing list