diff options
| author | Roman Tereshin <rtereshin@apple.com> | 2018-08-27 21:41:37 +0000 |
|---|---|---|
| committer | Roman Tereshin <rtereshin@apple.com> | 2018-08-27 21:41:37 +0000 |
| commit | 02320eee6bd056c04655edd5cb83940662cc3237 (patch) | |
| tree | a3975989aae5f0b942070f6e0478f9b35a6b23da /llvm/test/Transforms/LoopVectorize/X86 | |
| parent | 4e039d64e26e242674a5fe324d3be11cfe56c096 (diff) | |
| download | bcm5719-llvm-02320eee6bd056c04655edd5cb83940662cc3237.tar.gz bcm5719-llvm-02320eee6bd056c04655edd5cb83940662cc3237.zip | |
Revert "[SCEV][NFC] Check NoWrap flags before lexicographical comparison of SCEVs"
This reverts r319889.
Unfortunately, wrapping flags are not a part of SCEV's identity (they
do not participate in computing a hash value or in equality
comparisons) and in fact they could be assigned after the fact w/o
rebuilding a SCEV.
Grep for const_cast's to see quite a few of examples, apparently all
for AddRec's at the moment.
So, if 2 expressions get built in 2 slightly different ways: one with
flags set in the beginning, the other with the flags attached later
on, we may end up with 2 expressions which are exactly the same but
have their operands swapped in one of the commutative N-ary
expressions, and at least one of them will have "sorted by complexity"
invariant broken.
2 identical SCEV's won't compare equal by pointer comparison as they
are supposed to.
A real-world reproducer is added as a regression test: the issue
described causes 2 identical SCEV expressions to have different order
of operands and therefore compare not equal, which in its turn
prevents LoadStoreVectorizer from vectorizing a pair of consecutive
loads.
On a larger example (the source of the test attached, which is a
bugpoint) I have seen even weirder behavior: adding a constant to an
existing SCEV changes the order of the existing terms, for instance,
getAddExpr(1, ((A * B) + (C * D))) returns (1 + (C * D) + (A * B)).
Differential Revision: https://reviews.llvm.org/D40645
llvm-svn: 340777
Diffstat (limited to 'llvm/test/Transforms/LoopVectorize/X86')
| -rw-r--r-- | llvm/test/Transforms/LoopVectorize/X86/pr35432.ll | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/test/Transforms/LoopVectorize/X86/pr35432.ll b/llvm/test/Transforms/LoopVectorize/X86/pr35432.ll index b8760cb8d50..1f2a2061586 100644 --- a/llvm/test/Transforms/LoopVectorize/X86/pr35432.ll +++ b/llvm/test/Transforms/LoopVectorize/X86/pr35432.ll @@ -40,8 +40,8 @@ define i32 @main() local_unnamed_addr #0 { ; CHECK-NEXT: [[TMP4:%.*]] = add i8 [[CONV3]], -1 ; CHECK-NEXT: [[TMP5:%.*]] = zext i8 [[TMP4]] to i32 ; CHECK-NEXT: [[TMP6:%.*]] = sub i32 -1, [[TMP5]] -; CHECK-NEXT: [[TMP7:%.*]] = icmp ugt i32 [[TMP6]], [[TMP3]] -; CHECK-NEXT: [[UMAX:%.*]] = select i1 [[TMP7]], i32 [[TMP6]], i32 [[TMP3]] +; CHECK-NEXT: [[TMP7:%.*]] = icmp ugt i32 [[TMP3]], [[TMP6]] +; CHECK-NEXT: [[UMAX:%.*]] = select i1 [[TMP7]], i32 [[TMP3]], i32 [[TMP6]] ; CHECK-NEXT: [[TMP8:%.*]] = add i32 [[UMAX]], 2 ; CHECK-NEXT: [[TMP9:%.*]] = add i32 [[TMP8]], [[TMP5]] ; CHECK-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ult i32 [[TMP9]], 8 @@ -50,8 +50,8 @@ define i32 @main() local_unnamed_addr #0 { ; CHECK-NEXT: [[TMP10:%.*]] = add i8 [[CONV3]], -1 ; CHECK-NEXT: [[TMP11:%.*]] = zext i8 [[TMP10]] to i32 ; CHECK-NEXT: [[TMP12:%.*]] = sub i32 -1, [[TMP11]] -; CHECK-NEXT: [[TMP13:%.*]] = icmp ugt i32 [[TMP12]], [[TMP3]] -; CHECK-NEXT: [[UMAX1:%.*]] = select i1 [[TMP13]], i32 [[TMP12]], i32 [[TMP3]] +; CHECK-NEXT: [[TMP13:%.*]] = icmp ugt i32 [[TMP3]], [[TMP12]] +; CHECK-NEXT: [[UMAX1:%.*]] = select i1 [[TMP13]], i32 [[TMP3]], i32 [[TMP12]] ; CHECK-NEXT: [[TMP14:%.*]] = add i32 [[UMAX1]], 1 ; CHECK-NEXT: [[TMP15:%.*]] = add i32 [[TMP14]], [[TMP11]] ; CHECK-NEXT: [[TMP16:%.*]] = trunc i32 [[TMP15]] to i8 |

