[llvm] r223203 - R600/SI: Fix live range error hidden by SIFoldOperands

Matt Arsenault Matthew.Arsenault at amd.com
Tue Dec 2 21:22:29 PST 2014


Author: arsenm
Date: Tue Dec  2 23:22:29 2014
New Revision: 223203

URL: http://llvm.org/viewvc/llvm-project?rev=223203&view=rev
Log:
R600/SI: Fix live range error hidden by SIFoldOperands

m0 is treated as a virtual register class with a single register
rather than the physical register it really is. This was updating
the live range of the used virtual copy of m0 from the first ds_read
instruction, and leaving the unused copy unchanged. This resulted in a
"Live segment doesn't end at a valid instruction" verifier error because
the erased instructions. Update the live range of the second copy (which
should be dead).

No test since I'm not sure how to trigger this with SIFoldOperands
enabled.

Modified:
    llvm/trunk/lib/Target/R600/SILoadStoreOptimizer.cpp

Modified: llvm/trunk/lib/Target/R600/SILoadStoreOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/SILoadStoreOptimizer.cpp?rev=223203&r1=223202&r2=223203&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/SILoadStoreOptimizer.cpp (original)
+++ llvm/trunk/lib/Target/R600/SILoadStoreOptimizer.cpp Tue Dec  2 23:22:29 2014
@@ -285,6 +285,15 @@ MachineBasicBlock::iterator  SILoadStore
   LiveInterval &M0RegLI = LIS->getInterval(M0Reg->getReg());
   LIS->shrinkToUses(&M0RegLI);
 
+  // Currently m0 is treated as a register class with one member instead of an
+  // implicit physical register. We are using the virtual register for the first
+  // one, but we still need to update the live range of the now unused second m0
+  // virtual register to avoid verifier errors.
+  const MachineOperand *PairedM0Reg
+    = TII->getNamedOperand(*Paired, AMDGPU::OpName::m0);
+  LiveInterval &PairedM0RegLI = LIS->getInterval(PairedM0Reg->getReg());
+  LIS->shrinkToUses(&PairedM0RegLI);
+
   LIS->getInterval(DestReg); // Create new LI
 
   DEBUG(dbgs() << "Inserted read2: " << *Read2 << '\n');





More information about the llvm-commits mailing list