[llvm] r223894 - VirtRegMap: Improve block live-in info if subregister liveness is available.
David Blaikie
dblaikie at gmail.com
Wed Dec 10 09:27:12 PST 2014
On Tue, Dec 9, 2014 at 5:13 PM, Matthias Braun <matze at braunis.de> wrote:
> Author: matze
> Date: Tue Dec 9 19:13:08 2014
> New Revision: 223894
>
> URL: http://llvm.org/viewvc/llvm-project?rev=223894&view=rev
> Log:
> VirtRegMap: Improve block live-in info if subregister liveness is
> available.
>
> Modified:
> llvm/trunk/lib/CodeGen/VirtRegMap.cpp
>
> Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=223894&r1=223893&r2=223894&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original)
> +++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Tue Dec 9 19:13:08 2014
> @@ -252,15 +252,38 @@ void VirtRegRewriter::addMBBLiveIns() {
> unsigned PhysReg = VRM->getPhys(VirtReg);
> assert(PhysReg != VirtRegMap::NO_PHYS_REG && "Unmapped virtual
> register.");
>
> - // Scan the segments of LI.
> - for (LiveInterval::const_iterator I = LI.begin(), E = LI.end(); I !=
> E;
> - ++I) {
> - if (!Indexes->findLiveInMBBs(I->start, I->end, LiveIn))
> - continue;
> - for (unsigned i = 0, e = LiveIn.size(); i != e; ++i)
> - if (!LiveIn[i]->isLiveIn(PhysReg))
> - LiveIn[i]->addLiveIn(PhysReg);
> - LiveIn.clear();
> + if (LI.hasSubRanges()) {
> + for (LiveInterval::subrange_iterator S = LI.subrange_begin(),
> + SE = LI.subrange_end(); S != SE; ++S) {
> + for (LiveRange::const_iterator I = S->begin(), E = S->end(); I !=
> E;
> + ++I) {
>
Range-for loops? ^
> + if (!Indexes->findLiveInMBBs(I->start, I->end, LiveIn))
> + continue;
> + for (MCSubRegIndexIterator SR(PhysReg, TRI); SR.isValid();
> ++SR) {
>
& perhaps here too (it'd be nice to formulate these custom iterators so
they can be used by range-for loops, if possible)
> + unsigned SubReg = SR.getSubReg();
> + unsigned SubRegIndex = SR.getSubRegIndex();
> + unsigned SubRegLaneMask =
> TRI->getSubRegIndexLaneMask(SubRegIndex);
> + if ((SubRegLaneMask & S->LaneMask) == 0)
> + continue;
> + for (unsigned i = 0, e = LiveIn.size(); i != e; ++i) {
> + if (!LiveIn[i]->isLiveIn(SubReg))
> + LiveIn[i]->addLiveIn(SubReg);
> + }
> + }
> + LiveIn.clear();
> + }
> + }
> + } else {
> + // Scan the segments of LI.
> + for (LiveInterval::const_iterator I = LI.begin(), E = LI.end(); I
> != E;
> + ++I) {
>
& here.
> + if (!Indexes->findLiveInMBBs(I->start, I->end, LiveIn))
> + continue;
> + for (unsigned i = 0, e = LiveIn.size(); i != e; ++i)
>
& probably here.
> + if (!LiveIn[i]->isLiveIn(PhysReg))
> + LiveIn[i]->addLiveIn(PhysReg);
> + LiveIn.clear();
> + }
> }
> }
> }
>
>
> _______________________________________________
> 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/20141210/7c42ecbd/attachment.html>
More information about the llvm-commits
mailing list