[PATCH] D57565: [LSR] Remove overly confident asserts on isZero(). PR40514

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 31 22:17:19 PST 2019


mkazantsev created this revision.
mkazantsev added reviewers: samparker, gilr, timshen, dfukalov, sanjoy.
Herald added a subscriber: javed.absar.

When LSR first adds SCEVs to BaseRegs, it only does it if `isZero()` has returned false.
In the end, in invocation of `InsertFormula`, it asserts that all values there are still not
zero constants. However between these two points, it makes some transformations,
in particular extends them to wider type.

SCEV does not give us guarantee that if `S` is not a constant zero, then `sext(S)` is
also not a constant zero. It might have missed some optimizing transforms when it
was calculating `S` and then made them when it took `sext`. So it is not correct to
demand this and assert this in the end.

Such cases show missed oppotunities in SCEV, but enforcing them with asserts is not
correct. This patch removes these assertions.


https://reviews.llvm.org/D57565

Files:
  lib/Transforms/Scalar/LoopStrengthReduce.cpp
  test/Transforms/LoopStrengthReduce/X86/pr40514.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57565.184681.patch
Type: text/x-patch
Size: 4634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190201/ae36e78d/attachment.bin>


More information about the llvm-commits mailing list