[llvm-commits] [llvm] r171879 - in /llvm/trunk: lib/Target/X86/CMakeLists.txt lib/Target/X86/X86.h lib/Target/X86/X86.td lib/Target/X86/X86PadShortFunction.cpp lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Subtarget.h lib/Target/X86/X86TargetMa...

Zhang, Andy andy.zhang at intel.com
Wed Jan 9 09:44:10 PST 2013


On January 09, 2013 12:05 PM, Evan Cheng wrote:

> Yes. Given the threshold is 4 what are the possibilities? 1. Single BB
> function. 2. Entry BB with an early exit to the exit BB. Can control flow
> go through an intermediate BB before the exit BB? It takes two instructions
> for conditional branch in the entry BB. The only possibility then is for
> the intermediate BB to contain nothing more than a branch to the exit BB.
> That doesn't look like a realistic scenario to me.

At 4 instructions that's true, but at 5 instructions it's certainly possible:

# BB#0:                                 # %entry
        testl   %edi, %edi
        jle     .LBB0_3
# BB#1:                                 # %if.then
        cmpl    $4, %esi
        jg      .LBB0_4
# BB#2:                                 # %if.then2
        movl    %esi, %edi
        jmp     foo                     # TAILCALL
.LBB0_3:                                # %if.else
        addl    %esi, %edi
.LBB0_4:                                # %if.end3
        movl    %edi, %eax
        ret
 
If we want this to work for more than 4 instructions, then I think we need to walk the CFG.


- Andy





More information about the llvm-commits mailing list