[PATCH] D113349: [SCEV] Fix and validate ValueExprMap/ExprValueMap consistency
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 29 07:44:36 PST 2021
nikic added a comment.
@sberg Thanks for the report! Here's a reduction for `opt -passes='print<scalar-evolution>'`:
define void @test(i32* %p) {
entry:
br label %loop.header
loop.header:
%iv = phi i32 [ 0, %entry ], [ %iv.next, %loop.latch ]
br label %loop2
loop2:
%iv2 = phi i32 [ %iv, %loop.header ], [ %iv2.next, %loop2 ]
%iv2.next = add i32 %iv2, 1
%v = load i32, i32* %p
%cmp = icmp slt i32 %iv2, %v
br i1 %cmp, label %loop2, label %loop2.end
loop2.end:
%iv2.ext = sext i32 %iv2 to i64
br label %loop3
loop3:
%iv3 = phi i64 [ %iv2.ext, %loop2.end ], [ %iv3.next, %loop3 ]
%iv3.next = add nsw i64 %iv3, 1
br i1 false, label %loop3, label %loop.latch
loop.latch:
%iv.next = trunc i64 %iv3 to i32
br label %loop.header
}
I'll probably just drop the assert -- while it should be the same in an ideal world, lazy nowrap flag updates mean that it can be a different (but equivalent) SCEV expression, as is the case here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113349/new/
https://reviews.llvm.org/D113349
More information about the llvm-commits
mailing list