-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Closed
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization
Description
https://alive2.llvm.org/ce/z/hfmwgf
The following fold is not performed. Same can be done with GEPs.
define void @src2(i64 %base, i64 %end) {
entry:
br label %loop
loop:
%iv2 = phi i64 [ %iv2.next, %loop ], [ %base, %entry ]
%iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ]
call void @use.i64(i64 %iv2)
%iv.next = add nuw nsw i64 %iv, 4
%iv2.next = add i64 %base, %iv.next
%cmp = icmp eq i64 %iv.next, %end
br i1 %cmp, label %exit, label %loop
exit:
ret void
}
define void @tgt2(i64 %base, i64 %end) {
entry:
br label %loop
loop:
%iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ]
%iv2 = add i64 %base, %iv
call void @use.i64(i64 %iv2)
%iv.next = add nuw nsw i64 %iv, 4
%cmp = icmp eq i64 %iv.next, %end
br i1 %cmp, label %exit, label %loop
exit:
ret void
}
iv2 here is basically just iv+base but written as phi(base, iv.next+base)
Metadata
Metadata
Assignees
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization