-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in unroller's phi entries #796
Labels
loops
Loops
Comments
cc @zhengyang92 |
Another case that the unroller gets wrong (unroll=2): ; Minimized from Transforms/LoopInterchange/pr43326.ll
define void @pr43326(i32 %a.promoted, [1 x [1 x i32]]* %e, i8* %b) {
for.body.lr.ph:
br label %for.body
for.body:
%inc1312 = phi i32 [ %a.promoted, %for.body.lr.ph ], [ %inc13, %for.inc12 ]
br label %for.body3
for.body3:
%xor.lcssa9 = phi i32 [ 0, %for.body ], [ %xor5, %for.end ]
%dec7 = phi i8 [ 0, %for.body ], [ %dec, %for.end ]
br label %for.body7
for.body7:
%xor5 = phi i32 [ %xor.lcssa9, %for.body3 ], [ %xor5, %for.inc ]
%inc4 = phi i32 [ 0, %for.body3 ], [ %inc, %for.inc ]
%arrayidx9 = getelementptr inbounds [1 x [1 x i32]], [1 x [1 x i32]]* %e, i64 0, i32 %inc4, i8 %dec7
br label %for.inc
for.inc:
%inc = add nsw i32 %inc4, 1
br i1 false, label %for.body7, label %for.end
for.end:
%dec = add i8 %dec7, 1
br i1 false, label %for.body3, label %for.end11
for.end11:
%dec.lcssa = phi i8 [ 0, %for.end ]
br label %for.inc12
for.inc12:
%inc13 = add nsw i32 %inc1312, 1
%tobool.not = icmp eq i32 %inc1312, 0
br i1 %tobool.not, label %for.cond.for.end14_crit_edge, label %for.body
for.cond.for.end14_crit_edge:
store i8 %dec.lcssa, i8* %b, align 1
ret void
} The unroller produces this (wrong); %for.inc.split#2:
%0#2 = add nsw i32 %inc4#2, 1
br i1 0, label %for.body7#1#2#2, label %for.end11#2
%for.end11#2:
%dec.lcssa#2 = phi i8 [ 0, %for.inc.split ], [ 0, %for.inc.split#1#2 ]
br label %for.inc12#2 |
I'd really like to turn on the unroller in some mutation fuzzing runs but I've been reluctant to do it until we have these known bugs fixed. alas Zhengyang is fighting to finish up a paper before going to an internship, argh. |
Another case from LLVM's test suite:
the last phi is wrong: %for.body8:
%add#phi#0 = phi float [ %add, %for.body ], [ %add#2, %for.body#2 ]
%for.body8#2:
; no %add, should use the one above as it dominates this BB
%for.cond.cleanup7:
%sum1.0.lcssa36 = phi float [ 0.000000, %entry ], [ %add#phi#0, %for.body8 ], [ %add, %for.body8#2 ]
ret float %sum1.0.lcssa36 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
unroller produces this:
Both entries of
%for.body8*
should point to the phi.The text was updated successfully, but these errors were encountered: