[PATCH] D16731: Remove unused stackslots generated in reg spills

Wei Mi via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 29 12:30:25 PST 2016

wmi created this revision.
wmi added a reviewer: qcolombet.
wmi added subscribers: llvm-commits, davidxl, thanm.
wmi set the repository for this revision to rL LLVM.
Herald added a subscriber: qcolombet.

The problem and testcase is described in https://llvm.org/bugs/show_bug.cgi?id=26374.

The cause of the problem is:
LiveRangeEdit::eliminateDeadDef is used to remove dead define instructions after rematerialization.  To remove a VNI for a vreg from its LiveInterval, LiveIntervals::removeVRegDefAt is used. However, after non-PHI VNIs are all removed, PHI VNI are still left in the LiveInterval. Such unused vregs will be kept in RegsToSpill[] at the end of InlineSpiller::reMaterializeAll and spiller will allocate stackslot for them.

The fix is to get rid of unused reg by checking whether it has non-dbg reference instead of whether it has non-empty interval. 

For the 1.c testcase in PR26374, the stack allocated for function GetSkipCostMB dropped from 408 to 344.




-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16731.46403.patch
Type: text/x-patch
Size: 15873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160129/bf849140/attachment.bin>

More information about the llvm-commits mailing list