This patch adds a check that SCEV of main and preloop exit conditions are available in
predecessor where they are expanded. In theory, this may be broken if these values
depend on SCEVUnknown which cannot be expanded to preheader. In practice, such
cases get rejected earlier, but this may change in future.
Details
- Reviewers
anna apilipenko reames
Diff Detail
Event Timeline
lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
1468 | To avoid confusion, call this something like MainL or OriginalL. | |
1485 | 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. :) | |
1512 | Same. | |
test/Transforms/IRCE/bad_expander.ll | ||
169 | What is this trying to test? The potentially faulting load doesn't contribute to any latch or range check, so how would it show up in the split value? | |
200 | Same problem. |
lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | ||
---|---|---|
1485 | 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. |
To avoid confusion, call this something like MainL or OriginalL.