Skip to content
  • Evan Cheng's avatar
    Add a late optimization to BranchFolding that hoist common instruction sequences · 05fc35e2
    Evan Cheng authored
    at the start of basic blocks to their common predecessor. It's actually quite
    common (e.g. about 50 times in JM/lencod) and has shown to be a nice code size
    benefit. e.g.
    
            pushq   %rax
            testl   %edi, %edi
            jne     LBB0_2
    ## BB#1:
            xorb    %al, %al
            popq    %rdx
            ret
    LBB0_2:
            xorb    %al, %al
            callq   _foo
            popq    %rdx
            ret
    
    =>
    
            pushq   %rax
            xorb    %al, %al
            testl   %edi, %edi
            je      LBB0_2
    ## BB#1:
            callq   _foo
    LBB0_2:
            popq    %rdx
            ret
    
    rdar://9145558
    
    llvm-svn: 131172
    05fc35e2
Loading