[PATCH] D54021: [LoopSimplifyCFG] Teach LoopSimplifyCFG to constant-fold branches and switches
Dave Green via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 19 08:07:29 PST 2018
dmgreen added a comment.
Hello. I have an error from this, which I think may well be a knock-on affect for the code later in the pass. Something like this:
define void @repo(i32 %size) {
entry:
br label %loop
loop:
%i = phi i32 [ 0, %entry ], [ %inc, %loop2 ]
br i1 true, label %loop1, label %loop2
loop1:
call void @something()
br label %loop2
loop2:
%phi = phi i32 [ 1, %loop ], [ 2, %loop1 ]
%inc = add i32 %i, %phi
%cmp = icmp ult i32 %inc, 3900
br i1 %cmp, label %loop, label %end
end:
ret void
}
declare void @something()
The br i1 true is const-folded, but the %phi gets the wrong value, taking the 1 where it should be taking the 2.
Repository:
rL LLVM
https://reviews.llvm.org/D54021
More information about the llvm-commits
mailing list