[llvm] r230093 - LiveRangeCalc: Don't start liveranges of PHI instruction at the block begin.

Matthias Braun matze at braunis.de
Fri Feb 20 15:43:14 PST 2015


Author: matze
Date: Fri Feb 20 17:43:14 2015
New Revision: 230093

URL: http://llvm.org/viewvc/llvm-project?rev=230093&view=rev
Log:
LiveRangeCalc: Don't start liveranges of PHI instruction at the block begin.

Summary:
Letting them begin at the PHI instruction slightly simplifies the code
but more importantly avoids breaking the assumption that live ranges
starting at the block begin are also live at the end of the predecessor
blocks. The MachineVerifier checks that but was apparently never run in
the few instances where liveranges are calculated for machine-SSA
functions.

Reviewers: qcolombet

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D7779

Modified:
    llvm/trunk/lib/CodeGen/LiveRangeCalc.cpp

Modified: llvm/trunk/lib/CodeGen/LiveRangeCalc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveRangeCalc.cpp?rev=230093&r1=230092&r2=230093&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveRangeCalc.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveRangeCalc.cpp Fri Feb 20 17:43:14 2015
@@ -43,11 +43,8 @@ void LiveRangeCalc::reset(const MachineF
 static void createDeadDef(SlotIndexes &Indexes, VNInfo::Allocator &Alloc,
                           LiveRange &LR, const MachineOperand &MO) {
     const MachineInstr *MI = MO.getParent();
-    SlotIndex DefIdx;
-    if (MI->isPHI())
-      DefIdx = Indexes.getMBBStartIdx(MI->getParent());
-    else
-      DefIdx = Indexes.getInstructionIndex(MI).getRegSlot(MO.isEarlyClobber());
+    SlotIndex DefIdx =
+        Indexes.getInstructionIndex(MI).getRegSlot(MO.isEarlyClobber());
 
     // Create the def in LR. This may find an existing def.
     LR.createDeadDef(DefIdx, Alloc);





More information about the llvm-commits mailing list