[PATCH] D73181: [SCEV] Do not use backedge SCEV of PHI if its input is another PHI
Sanjoy Das (Work Account) via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 22 08:14:03 PST 2020
sanjoy.google added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:8238
}
// Do we have a loop invariant value flowing around the backedge
// for a loop which must execute the backedge?
----------------
This comment needs to be fixed IMO. It isn't necessarily a loop invariant value; we're really checking for a value that can be materialized outside the loop.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:8247
+ if (!isa<PHINode>(BackedgeVal) &&
+ IsAvailableOnEntry(LI, DT, OnBackedge, PN->getParent()))
return OnBackedge;
----------------
dantrushin wrote:
> Bailing out here when any PHI is seen, because I did not find convinient API to get SCEV at previous iteration.
> Is there one?
I don't think you need to go through SCEV here. You can just pick the `llvm::Value` for the PHI for the backedge and get the SCEV for that.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73181/new/
https://reviews.llvm.org/D73181
More information about the llvm-commits
mailing list