[LLVMbugs] [Bug 5774] New: Missed optimisation from flags on SUB
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Sun Dec 13 01:13:34 PST 2009
http://llvm.org/bugs/show_bug.cgi?id=5774
Summary: Missed optimisation from flags on SUB
Product: libraries
Version: trunk
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P2
Component: Backend: X86
AssignedTo: unassignedbugs at nondot.org
ReportedBy: arplynn at gmail.com
CC: llvmbugs at cs.uiuc.edu
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).
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list