Skip to content
  • Chris Lattner's avatar
    Fix a deficiency in the spiller that Evan noticed. In particular, consider · f3aef1b0
    Chris Lattner authored
    this code:
    
      store [stack slot #0],  R10
        = add R14, [stack slot #0]
    
    The spiller didn't know that the store made the value of [stackslot#0] available
    in R10 *IF* the store came from a copy instruction with the store folded into it.
    
    This patch teaches VirtRegMap to look at these stores and recognize the values
    they make available.  In one case Evan provided, this code:
    
            divsd %XMM0, %XMM1
            movsd %XMM1, QWORD PTR [%ESP + 40]
    1)      movsd QWORD PTR [%ESP + 48], %XMM1
    2)      movsd %XMM1, QWORD PTR [%ESP + 48]
            addsd %XMM1, %XMM0
    3)      movsd QWORD PTR [%ESP + 48], %XMM1
            movsd QWORD PTR [%ESP + 4], %XMM0
    
    turns into:
    
            divsd %XMM0, %XMM1
            movsd %XMM1, QWORD PTR [%ESP + 40]
            addsd %XMM1, %XMM0
    3)      movsd QWORD PTR [%ESP + 48], %XMM1
            movsd QWORD PTR [%ESP + 4], %XMM0
    
    In this case, instruction #2 was removed because of the value made
    available by #1, and inst #1 was later deleted because it is now
    never used before the stack slot is redefined by #3.
    
    This occurs here and there in a lot of code with high spilling, on PPC
    most of the removed loads/stores are LSU-reject-causing loads, which is
    nice.
    
    On X86, things are much better (because it spills more), where we nuke
    about 1% of the instructions from SMG2000 and several hundred from eon.
    
    More improvements to come...
    
    llvm-svn: 25917
    f3aef1b0
Loading