[PATCH] D60846: [ValueTracking] Improve isKnowNonZero for Ints
Mikael Holmén via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 8 06:49:58 PDT 2019
uabelho added a comment.
This is as far as I've come:
With
opt -S -o - red.ll -simplifycfg -loop-unroll
I get
; ModuleID = 'red.ll'
source_filename = "red.ll"
declare void @foo(i16)
define i16 @main() {
br label %bb1
bb1: ; preds = %0
call void @foo(i16 0)
call void @foo(i16 1000)
ret i16 0
}
which I think is correct, and with
opt -S -o - red.ll -instcombine -simplifycfg -loop-unroll
I get
; ModuleID = 'red.ll'
source_filename = "red.ll"
declare void @foo(i16)
define i16 @main() {
br label %bb1
bb1: ; preds = %0
call void @foo(i16 0)
call void @foo(i16 1)
ret i16 0
}
which I think is incorrect.
And in both cases red.ll is
declare void @foo(i16)
define i16 @main() {
br label %bb1
bb1: ; preds = %bb9, %0
%i.3.0 = phi i16 [ 0, %0 ], [ %_tmp19, %bb9 ]
%_tmp8 = icmp uge i16 %i.3.0, 1
br i1 %_tmp8, label %bb3, label %bb5
bb3: ; preds = %bb1
%_tmp11 = add i16 1, 1
%_tmp12 = icmp ult i16 %i.3.0, %_tmp11
br i1 %_tmp12, label %bb4, label %bb5
bb4: ; preds = %bb3
br label %bb6
bb5: ; preds = %bb3, %bb1
br label %bb6
bb6: ; preds = %bb5, %bb4
%tmp0.5.0 = phi i16 [ 1, %bb4 ], [ 0, %bb5 ]
%_tmp14 = icmp ne i16 %tmp0.5.0, 0
br i1 %_tmp14, label %bb7, label %bb8
bb7: ; preds = %bb6
br label %bb9
bb8: ; preds = %bb6
br label %bb9
bb9: ; preds = %bb8, %bb7
%tmp1.6.0 = phi i16 [ 1000, %bb7 ], [ %i.3.0, %bb8 ]
call void @foo(i16 %tmp1.6.0)
%_tmp19 = add i16 %i.3.0, 1
%_tmp21 = icmp ult i16 %_tmp19, 2
br i1 %_tmp21, label %bb1, label %bb10
bb10: ; preds = %bb9
ret i16 0
}
If I revert this commit I get
call void @foo(i16 0)
call void @foo(i16 1000)
in both cases.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60846/new/
https://reviews.llvm.org/D60846
More information about the llvm-commits
mailing list