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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174945 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/PHIElimination.cpp

index f046ac9627d92719fd17747d18a6154353cfb955..abad5c1e850f2640568b183445ad451f6cc0fbc5 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;
           }