1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00
llvm-mirror/test/Transforms/LoopReroll
Philip Reames 6a45d08863 [SCEV] Fix unsound reasoning in howManyLessThans
This is split from D105216, it handles only a subset of the cases in that patch.

Specifically, the issue being fixed is that the code incorrectly assumed that (Start-Stide) < End implied that the backedge was taken at least once. This is not true when e.g. Start = 4, Stride = 2, and End = 3. Note that we often do produce the right backedge taken count despite the flawed reasoning.

The fix chosen here is to use an alternate form of uceil (ceiling of unsigned divide) lowering which is safe when max(RHS,Start) > Start - Stride.  (Note that signedness of both max expression and comparison depend on the signedness of the comparison being analyzed, and that overflow in the Start - Stride expression is allowed.)  Note that this is weaker than proving the backedge is taken because it allows start - stride < end < start.  Some cases which can't be proven safe are sent down the generic path, and we do end up generating less optimal expressions in a few cases.

Credit for coming up with the approach goes entirely to Eli.  I just split it off, tweaked the comments a bit, and did some additional testing.

Differential Revision: https://reviews.llvm.org/D105942
2021-07-15 10:32:47 -07:00
..
basic32iters.ll
basic.ll [LoopReroll] Add an extra defensive check to avoid SCEV assertion. 2021-07-13 12:17:09 -07:00
complex_reroll.ll
external_use.ll
extra_instr.ll
indvar_with_ext.ll
negative.ll
nonconst_lb.ll [SCEV] Fix unsound reasoning in howManyLessThans 2021-07-15 10:32:47 -07:00
ptrindvar.ll [ScalarEvolution] Ensure backedge-taken counts are not pointers. 2021-06-21 16:24:16 -07:00
reduction.ll
reroll_with_dbg.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00