[PATCH] D31821: Remove redundant copy in recurrences

Taewook Oh via llvm-commits llvm-commits at lists.llvm.org
Fri May 19 13:57:54 PDT 2017


Got it. Now I understand your point. Thanks for the explanation!

On 5/19/17, 1:39 PM, "Wei Mi" <wmi at google.com> wrote:

    On Fri, May 19, 2017 at 1:14 PM, Taewook Oh via Phabricator
    <reviews at reviews.llvm.org> wrote:
    > twoh added a comment.
    >
    > @wmi Thank you for your reply. I agree on you that we should consider tied operand group, and as @qcolombet mentioned in the previous comment, if tie operand information is already available before this pass, I'd like to discuss where would be the best place to implement this.
    >
    > I'm afraid I couldn't understand your second point. In the example there is a recurrence cycle of vreg0-->vreg13-->vreg3-->vreg10-->vreg0 as well, and what this patch does is commuting (vreg0, vreg1) and (vreg2, vreg10) to remove the copy. Did I miss something?
    
    I don't think the cycle vreg0-->vreg13-->vreg3-->vreg10-->vreg0 is the
    fundamental reason we have the redundent copy and need to commute the
    operands. vreg3 and vreg10 won't be allocated to the same physical
    register. Only vreg3 and vreg2 have to be allocated to the same
    physical register because of the tied operand group. The fundamental
    reason for the redundent copy is that "vreg0, vreg13, vreg3 and vreg2"
    want the same physical register but vreg2 and vreg0 have interference
    with each other.
    
    Let's change the case a little:
    vreg0 = vreg13
    ...
    vreg10 = add vreg1, vreg0
    vreg2 = load(vreg15)               // vreg2 is moved a little bit downwards.
    vreg3 = add vreg2, vreg10
    vreg13 = vreg3
    
    Now You still have the cycle vreg0-->vreg13-->vreg3-->vreg10-->vreg0,
    but you don't have to commute any operands to remove the redundent
    copies now because vreg2 and vreg0 don't interfere with each other.
    
    >
    >
    > https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D31821&d=DwIFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=kOsLCgQzH7N8ptZ7diJD9g&m=EGyIGl9z8DQlCihli2Hz8tcKPMB5vOIQSBtN7OMDseQ&s=lfo72T5lLqPPu7mwpw8D5_Z6z6bJ0mbbrOO7RXnW-Ig&e= 
    >
    >
    >
    



More information about the llvm-commits mailing list