-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Closed
Labels
Description
Bugzilla Link | 5774 |
Version | trunk |
OS | MacOS X |
Reporter | LLVM Bugzilla Contributor |
CC | @asl |
Extended Description
Consider the following test case:
define i32 @foo1 ( i32 %a, i32 %b ) nounwind
{
entry:
%sub = sub i32 %a, %b
%diff = icmp slt i32 %a, %b
%select = select i1 %diff, i32 %b, i32 %a
%call = call i32 @bar ( i32 %sub, i32 %select )
ret i32 %call
}
define i32 @foo2 ( i32 %a, i32 %b ) nounwind
{
entry:
%sub = sub i32 %a, %b
%diff = icmp slt i32 %sub, 0
%select = select i1 %diff, i32 %b, i32 %a
%call = call i32 @bar ( i32 %sub, i32 %select )
ret i32 %call
}
declare i32 @bar ( i32 %a, i32 %b ) nounwind
Whilst the effect of both foo1 and foo2 are equivalent, foo2 uses the negative flag from the result of the sub for the condition; foo1 instead generates an extra compare instruction (on X86).