[PATCH] D39320: [IRCE] Ensure that expanded exit values are available in loop's preheader

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 21:54:34 PDT 2017


mkazantsev added inline comments.


================
Comment at: lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp:1485
 
-    if (!isSafeToExpandAt(ExitPreLoopAtSCEV, InsertPt, SE)) {
+    if (!isSafeToExpandAt(ExitPreLoopAtSCEV, InsertPt, SE) ||
+        !SE.isAvailableAtLoopEntry(ExitPreLoopAtSCEV, L)) {
----------------
reames wrote:
> Put these in the other order so that we don't run isSafeToExpandAt if the value is not available.  I don't know that it currently does, but isSafeToExpandAt could reasonable have a precondition that the location is available.  :)
We invoke `isSafeToExpandAt` for loop's preheader. From within this function, we don't have any information about the fact that our insertion point is connected to some loop, and whether it is important for us or not. The loop in this particular case is important because we know that we are going to use the expanded value as the entry value of some loop's Phi; in general case, we don't always do so so shouldn't always care about loops in expander.


https://reviews.llvm.org/D39320





More information about the llvm-commits mailing list