Skip to content
  • Preston Gurd's avatar
    Pad Short Functions for Intel Atom · a01daace
    Preston Gurd authored
    The current Intel Atom microarchitecture has a feature whereby
    when a function returns early then it is slightly faster to execute
    a sequence of NOP instructions to wait until the return address is ready,
    as opposed to simply stalling on the ret instruction until
    the return address is ready.
    
    When compiling for X86 Atom only, this patch will run a pass,
    called "X86PadShortFunction" which will add NOP instructions where less
    than four cycles elapse between function entry and return.
    
    It includes tests.
    
    This patch has been updated to address Nadav's review comments
    - Optimize only at >= O1 and don't do optimization if -Os is set
    - Stores MachineBasicBlock* instead of BBNum
    - Uses DenseMap instead of std::map
    - Fixes placement of braces
    
    Patch by Andy Zhang.
    
    llvm-svn: 171879
    a01daace
Loading