http://llvm.org/bugs/show_bug.cgi?id=9475
Summary: branch vs. indirect call
Product: new-bugs
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
These two lines should do the same thing:
return i > 4 ? f() : g();
vs.
return (i > 4 ? f : g)();
The first one produces LLVM IR that does a branch to two blocks each with a
tail call, then branches back to the join block with a phi and ret. On x86, the
final assembly has a branch (not a cmov) to place the call (not tail!) and ret
in each block.
The second one produces LLVM IR that is a single BB with the icmp+select+tail
call. The generated code is branchless and has a single tail call, but it's an
indirect function call.
I think we should fix the codegen of the former to use a tail call, then
optimize the second down to the first.
--
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs