Skip to content
  • Arnold Schwaighofer's avatar
    swifterror: Don't compute swifterror vregs during instruction selection · 3f256581
    Arnold Schwaighofer authored
    The code used llvm basic block predecessors to decided where to insert phi
    nodes. Instruction selection can and will liberally insert new machine basic
    block predecessors. There is not a guaranteed one-to-one mapping from pred.
    llvm basic blocks and machine basic blocks.
    
    Therefore the current approach does not work as it assumes we can mark
    predecessor machine basic block as needing a copy, and needs to know the set of
    all predecessor machine basic blocks to decide when to insert phis.
    
    Instead of computing the swifterror vregs as we select instructions, propagate
    them at the end of instruction selection when the MBB CFG is complete.
    
    When an instruction needs a swifterror vreg and we don't know the value yet,
    generate a new vreg and remember this "upward exposed" use, and reconcile this
    at the end of instruction selection.
    
    This will only happen if the target supports promoting swifterror parameters to
    registers and the swifterror attribute is used.
    
    rdar://28300923
    
    llvm-svn: 283617
    3f256581
Loading