[LLVMbugs] [Bug 9408] New: Missed optimization: branch to duplicate code
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Mar 5 08:47:27 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=9408
Summary: Missed optimization: branch to duplicate code
Product: libraries
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: Transformation Utilities
AssignedTo: unassignedbugs at nondot.org
ReportedBy: jmuizelaar at mozilla.com
CC: llvmbugs at cs.uiuc.edu
Here's an example of a missed optimization opportunity from
http://blog.reverberate.org/2011/03/03/gcc-the-impressive-and-the-disappointing/
This code:
typedef union {
void (*f1)(int);
void (*f2)(long);
} funcs;
void foo(funcs f, int which) {
int a = 5;
if (which) {
f.f1(a);
} else {
f.f2(a);
}
}
generates the following code which has a branch to duplicate code.
foo: # @foo
# BB#0: # %entry
pushq %rbp
movq %rsp, %rbp
testl %esi, %esi
movq %rdi, %rax
je .LBB0_2
# BB#1: # %if.then
movl $5, %edi
callq *%rax
popq %rbp
ret
.LBB0_2: # %if.else
movl $5, %edi
callq *%rax
popq %rbp
ret
--
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