[LLVMbugs] [Bug 13612] New: MachineBlockPlacement doesn't consider exceptions as cold

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 15 04:44:19 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13612

             Bug #: 13612
           Summary: MachineBlockPlacement doesn't consider exceptions as
                    cold
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: benny.kra at gmail.com
                CC: chandlerc at gmail.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


For this simple c++ test case

void foo();
void bar(int);
void qux();

void test() {
  try {
    foo();
  } catch (int i) {
    bar(i);
  }
  qux();
}

We end up with code like (x86_64)

    callq    __Z3foov
Ltmp1:
    jmp    LBB0_4
LBB0_1:                                 ## %lpad
Ltmp2:
    movq    %rax, %rbx
    cmpl    $1, %edx
    jne    LBB0_6
## BB#2:                                ## %catch
    movq    %rbx, %rdi
    callq    ___cxa_begin_catch
    movl    (%rax), %edi
Ltmp3:
    callq    __Z3bari
Ltmp4:
## BB#3:                                ## %invoke.cont2
    callq    ___cxa_end_catch
LBB0_4:                                 ## %try.cont
    popq    %rbx
    jmp    __Z3quxv                ## TAILCALL
LBB0_5:                                 ## %lpad1
Ltmp5:
    movq    %rax, %rbx
    callq    ___cxa_end_catch
LBB0_6:                                 ## %eh.resume
    movq    %rbx, %rdi
    callq    __Unwind_Resume

Note that the normal execution path is embedded within the exceptional path. It
would be better if the normal path was emitted as a block at the beginning of
the function. This can probably be solved with a simple InvokeInst heuristic in
BranchProbabilityInfo.

-- 
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