[PATCH] Improve machine code correctness in codegen

Andrew Trick atrick at apple.com
Mon Oct 7 13:15:55 PDT 2013


On Oct 7, 2013, at 12:59 PM, Matthias Braun <mbraun at apple.com> wrote:

> 
> On Oct 6, 2013, at 10:52 PM, Andrew Trick <atrick at apple.com> wrote:
> 
>> Thanks for the fix Matthias. It's definitely beyond the call of duty.
>> 
>> In the diamond case, I don't understand why you start with false-block live-ins and walk forward. We only care about liveness generated within the false block, right? We don't care about registers live out of the diamond. Why not start with an empty live set and walk backward from the end of the false-block back to the last duplicated instruction (DI2)? Adding uses and clearing defs. No need to look at kill flags. The more we can remove dependence on kill/dead flags the better.
> Well what I needed is the set of registers live after the last duplicated instruction, these values musn’t be killed in the true block. You are right that instead of using the live-ins and walking forward (using kill and dead flags) I could also use the live-outs and walk backwards. I’ll prepare a changed patch, maybe creating a first version of that “liveness utility”.

That would be nice, but I don’t think we care about the live outs in this case (kill flags on the false path would already be wrong).
-Andy

> 
> Greetings
> 	Matthias
> 
>> 
>> Anyway, I would really like a generic backward liveness analysis utility that works on postRA MI. This seems like the ideal place for it.
>> 
>> -Andy
>> 
>> On Oct 3, 2013, at 4:53 PM, Matthias Braun <mbraun at apple.com> wrote:
>> 
>>> Attach is a revised version of the if conversion patch with a test case included.
>>> 
>>> Description: remove kill flags after if conversion if necessary
>>> When if converting something like:
>>> true:
>>>    ... = R0<kill>
>>> 
>>> false:
>>>    ... = R0<kill>
>>> 
>>> then the instructions of the true block must not have a <kill> flag
>>> anymore, as the instruction of the false block follow and do still read
>>> the R0 value.
>>> Specifically this patch determines the set of register live-in in the
>>> false block (possibly after simulating the liveness changes of the
>>> duplicated instructions). Each of these live-in registers mustn't be
>>> killed.
>>> 
>>> Greetings	
>>> 	Matthias
>>> 
>>> <remove-kill-flags-after-if-conversion-if-necessary.patch>
>>> 
>>> On Oct 3, 2013, at 11:02 AM, Matthias Braun <mbraun at apple.com> wrote:
>>> 
>>>> 
>>>> On Oct 3, 2013, at 10:52 AM, Eric Christopher <echristo at gmail.com> wrote:
>>>> 
>>>>> The standard mechanism is one patch per email. Also, usually more
>>>>> description as well.
>>>> I hope the descriptions in the commit-messages are enough. Here they are again:
>>>> 
>>>> * fix bad kill flags after if conversion:
>>>> If the true block had kill flags on registers being used in the false
>>>> block, then these kill flags must be removed after if conversion.
>>>> 
>>>> * fix post ra scheduler setting wrong kill flags in bundles
>>>> The PostRA scheduler only looked at the BUNDLE marker instruction, which
>>>> resulted in invalid kill flags inside the bundle. This version changes
>>>> it so the kill flags are set inside the bundle at the latest bundle
>>>> instruction possible.
>>>> 
>>>> * MachineVerifier: allow physreg use if just a subreg is defined
>>>> We can't mark partially undefined registers, so we have to allow reading
>>>> a register in the machine verifier if just parts of a register are
>>>> defined.
>>>> 
>>>> Thanks
>>>> 	Matthias
>>>> 
>>>>> 
>>>>> -eric
>>>>> 
>>>>> On Thu, Oct 3, 2013 at 10:44 AM, Matthias Braun <mbraun at apple.com> wrote:
>>>>>> The attached patches improve code correctness (in the sense of -verify-machineinstrs) in codegen. This mainly improves the situation for the arm backend. Please review, thanks.
>>>>>> 
>>>>>> Greetings
>>>>>>       Matthias
>>>>>> 
>>>>>> 
>>>>>> _______________________________________________
>>>>>> llvm-commits mailing list
>>>>>> llvm-commits at cs.uiuc.edu
>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>>> 
>>>> 
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>> 
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131007/ed0e3521/attachment.html>


More information about the llvm-commits mailing list