[PATCH] D31188: [AntiDepBreaker] Use liveins as well in StartBlock

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 17:04:38 PDT 2017


MatzeB added a comment.



>> I also don't understand the fix here: Adding live-in registers when the code here appears to be searching for live-out registers seem like an odd fix to me (I can see how it helps though as it will just mark more registers as occupied).
> 
> This is based on my inderstanding on "ideal liveins()" I mentioned in the bug:
> 
>   /* Returns all live-ins, including the unspilled callee-saved registers. */
>   iterator_range<concat_iterator<...>> liveins();
>    
> 
> The fix turns "Pristine.test(Reg)" into "Pristine.test(Reg) || BB.IsLiveIn(Reg)" as a refinement (to match the ideal definition of liveins()).
> 
> It means that not only those callee-saved registers (we are iterating over only them) who don't have spill slots are considered, but also those who “have spill slots but not spilled”.

`Pristine.test(Reg) || BB.IsLiveIn(Reg)` would make a lot of sense when searching for **live-ins**. But the comments around it indicate it is actually searching for **live-outs**?

For live-outs you need to:

- Take the union of the successor live-ins + pristines
- In case of the return block without successors take all callee saved register instead

(you may referer to LivePhysRegs::addLiveOuts() / LivePHysRegs::addLiveIns() to see an alternative implementation of this).

>From reading the code here the AntiDepBreaker is already doing the right thing. I only read the code though, and did not actually run/play with it so I may have missed something.


https://reviews.llvm.org/D31188





More information about the llvm-commits mailing list