From: Matthias Braun Date: Fri, 20 Feb 2015 23:43:14 +0000 (+0000) Subject: LiveRangeCalc: Don't start liveranges of PHI instruction at the block begin. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=b2c6bf677604b37bb6a1bddc46c7e6bae7081d6f;p=oota-llvm.git 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230093 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/LiveRangeCalc.cpp b/lib/CodeGen/LiveRangeCalc.cpp index a07c3a35dc7..d804b39c597 100644 --- a/lib/CodeGen/LiveRangeCalc.cpp +++ b/lib/CodeGen/LiveRangeCalc.cpp @@ -43,11 +43,8 @@ void LiveRangeCalc::reset(const MachineFunction *mf, 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);