<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 9, 2014 at 5:13 PM, Matthias Braun <span dir="ltr"><<a href="mailto:matze@braunis.de" target="_blank">matze@braunis.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: matze<br>
Date: Tue Dec 9 19:13:08 2014<br>
New Revision: 223894<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=223894&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=223894&view=rev</a><br>
Log:<br>
VirtRegMap: Improve block live-in info if subregister liveness is available.<br>
<br>
Modified:<br>
llvm/trunk/lib/CodeGen/VirtRegMap.cpp<br>
<br>
Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=223894&r1=223893&r2=223894&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=223894&r1=223893&r2=223894&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Tue Dec 9 19:13:08 2014<br>
@@ -252,15 +252,38 @@ void VirtRegRewriter::addMBBLiveIns() {<br>
unsigned PhysReg = VRM->getPhys(VirtReg);<br>
assert(PhysReg != VirtRegMap::NO_PHYS_REG && "Unmapped virtual register.");<br>
<br>
- // Scan the segments of LI.<br>
- for (LiveInterval::const_iterator I = LI.begin(), E = LI.end(); I != E;<br>
- ++I) {<br>
- if (!Indexes->findLiveInMBBs(I->start, I->end, LiveIn))<br>
- continue;<br>
- for (unsigned i = 0, e = LiveIn.size(); i != e; ++i)<br>
- if (!LiveIn[i]->isLiveIn(PhysReg))<br>
- LiveIn[i]->addLiveIn(PhysReg);<br>
- LiveIn.clear();<br>
+ if (LI.hasSubRanges()) {<br>
+ for (LiveInterval::subrange_iterator S = LI.subrange_begin(),<br>
+ SE = LI.subrange_end(); S != SE; ++S) {<br>
+ for (LiveRange::const_iterator I = S->begin(), E = S->end(); I != E;<br>
+ ++I) {<br></blockquote><div><br></div><div>Range-for loops? ^</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ if (!Indexes->findLiveInMBBs(I->start, I->end, LiveIn))<br>
+ continue;<br>
+ for (MCSubRegIndexIterator SR(PhysReg, TRI); SR.isValid(); ++SR) {<br></blockquote><div><br>& perhaps here too (it'd be nice to formulate these custom iterators so they can be used by range-for loops, if possible)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ unsigned SubReg = SR.getSubReg();<br>
+ unsigned SubRegIndex = SR.getSubRegIndex();<br>
+ unsigned SubRegLaneMask = TRI->getSubRegIndexLaneMask(SubRegIndex);<br>
+ if ((SubRegLaneMask & S->LaneMask) == 0)<br>
+ continue;<br>
+ for (unsigned i = 0, e = LiveIn.size(); i != e; ++i) {<br>
+ if (!LiveIn[i]->isLiveIn(SubReg))<br>
+ LiveIn[i]->addLiveIn(SubReg);<br>
+ }<br>
+ }<br>
+ LiveIn.clear();<br>
+ }<br>
+ }<br>
+ } else {<br>
+ // Scan the segments of LI.<br>
+ for (LiveInterval::const_iterator I = LI.begin(), E = LI.end(); I != E;<br>
+ ++I) {<br></blockquote><div><br>& here.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ if (!Indexes->findLiveInMBBs(I->start, I->end, LiveIn))<br>
+ continue;<br>
+ for (unsigned i = 0, e = LiveIn.size(); i != e; ++i)<br></blockquote><div><br>& probably here.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ if (!LiveIn[i]->isLiveIn(PhysReg))<br>
+ LiveIn[i]->addLiveIn(PhysReg);<br>
+ LiveIn.clear();<br>
+ }<br>
}<br>
}<br>
}<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>