[PATCH] D32563: Add LiveRangeShrink pass to shrink live range within BB.

Dehao Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 11 14:25:56 PDT 2017


danielcdh added inline comments.


================
Comment at: lib/CodeGen/LiveRangeShrink.cpp:211-215
+        MBB.splice(I, &MBB, MI->getIterator());
+        for (MachineInstr *DI : DbgValuesToMove) {
+          IOM[DI] = IOM[MI];
+          MBB.splice(I, &MBB, DI->getIterator());
+        }
----------------
MatzeB wrote:
> danielcdh wrote:
> > MatzeB wrote:
> > > There's a variant of splice that can move a sequence of instructions which should work nicely here.
> > > 
> > > It is also not clear to me if moving the debug instructions is legal here. They are not considered when checking how early an instruction can move so you are possibly moving the debug instruction above a point where the value its operand is defined.
> > Done
> > 
> > For the Debug Value, it should be legal as the same logic is used by MachineLICM.
> I'm not sure why this would work. Maybe you should double check by compiling the llvm-testsuite (or some other set of programs) with a debug compiler and `-g`...
glad that I run this with -g and actually caught a bug: when I move instructions together with debug info, I should increment the Next pointer, otherwise the iterator will iterate to instructions that have already been processed. Updated the implementation and added test coverage.


https://reviews.llvm.org/D32563





More information about the llvm-commits mailing list