[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


           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

This code:

typedef union {
  void (*f1)(int);
  void (*f2)(long);
} funcs;

void foo(funcs f, int which) {
  int a = 5;
  if (which) {
  } else {

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
.LBB0_2:                                # %if.else
        movl    $5, %edi
        callq   *%rax
        popq    %rbp

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