Don't consider definitions by other PHIs live-in when trimming a PHI source's
authorCameron Zwarich <zwarich@apple.com>
Tue, 12 Feb 2013 05:48:58 +0000 (05:48 +0000)
committerCameron Zwarich <zwarich@apple.com>
Tue, 12 Feb 2013 05:48:58 +0000 (05:48 +0000)
live range after inserting a copy at the end of a block.

llvm-svn: 174945

llvm/lib/CodeGen/PHIElimination.cpp

index f046ac9..abad5c1 100644 (file)
@@ -467,7 +467,11 @@ void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
         bool isLiveOut = false;
         for (MachineBasicBlock::succ_iterator SI = opBlock.succ_begin(),
              SE = opBlock.succ_end(); SI != SE; ++SI) {
-          if (SrcLI.liveAt(LIS->getMBBStartIdx(*SI))) {
+          SlotIndex startIdx = LIS->getMBBStartIdx(*SI);
+          VNInfo *VNI = SrcLI.getVNInfoAt(startIdx);
+
+          // Definitions by other PHIs are not truly live-in for our purposes.
+          if (VNI && VNI->def != startIdx) {
             isLiveOut = true;
             break;
           }