[PATCH] D73181: [SCEV] Do not use backedge SCEV of PHI if its input is another PHI
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 23 00:39:51 PST 2020
mkazantsev added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:8246
+ const SCEV *OnBackedge = getSCEV(BackedgeVal);
+ if (!isa<PHINode>(BackedgeVal) &&
+ IsAvailableOnEntry(LI, DT, OnBackedge, PN->getParent()))
----------------
Your check is overprotective. If `BackedgeVal` is a Phi from another loop than PN's (e.g. outer loop or some other loop going before it), it is OK to use it as exit value. The problem only happens if `PN->getLoop() == BackedgeVal->getLoop()`, am I correct?
================
Comment at: llvm/test/Analysis/ScalarEvolution/pr44605.ll:46
+ %local_3_31 = mul i32 %local_4_5.pn, %.udiv
+ %0 = mul i32 %local_7_3, %.udiv
+ %1 = sub i32 %0, %local_3_4
----------------
Does the test really need all these computations inside? It's tad too much code, not clear what of it is important. If you can reduce the test please do.
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