[PATCH] D108114: [LoopPeel] Peel if it turns invariant loads dereferenceable.
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 17 09:21:45 PDT 2021
reames added a comment.
Before reviewing the patch, a high level question. Fair warning, I am a bit worried about cost heuristic changes here, they tend to be delicate.
Why do we need to peel this? LICM is generally good at using speculation to hoist, and trivial unswitching is good at versioning the conditions to remove them. I'd expect to see the motivating case already handled by some combination of existing transforms. (You might have to iterate them a few times. So is this working around a pass ordering issue?)
================
Comment at: llvm/lib/Transforms/Utils/LoopPeel.cpp:200
+ if (auto *LI = dyn_cast<LoadInst>(&I)) {
+ if (DT.dominates(BB, Latch) &&
+ SE.isLoopInvariant(SE.getSCEV(LI->getPointerOperand()), &L))
----------------
You don't appear to be requiring the load controls an exit. It's much less obvious that "just" removing a load is worthwhile. Consider a huge loop with one potentially invariant load.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108114/new/
https://reviews.llvm.org/D108114
More information about the llvm-commits
mailing list