[llvm-commits] [llvm] r117669 - /llvm/trunk/lib/CodeGen/SplitKit.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Oct 29 10:37:25 PDT 2010


Author: stoklund
Date: Fri Oct 29 12:37:25 2010
New Revision: 117669

URL: http://llvm.org/viewvc/llvm-project?rev=117669&view=rev
Log:
Never propagate the idom value out of a block that defines its own value.

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

Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=117669&r1=117668&r2=117669&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SplitKit.cpp (original)
+++ llvm/trunk/lib/CodeGen/SplitKit.cpp Fri Oct 29 12:37:25 2010
@@ -441,7 +441,8 @@
        if (VNInfo *VNI = extendTo(Pred, Last)) {
          MachineBasicBlock *DefMBB = lis_.getMBBFromIndex(VNI->def);
          DEBUG(dbgs() << "    found valno #" << VNI->id
-                      << " at BB#" << DefMBB->getNumber() << '\n');
+                      << " from BB#" << DefMBB->getNumber()
+                      << " at BB#" << Pred->getNumber() << '\n');
          LiveOutPair &LOP = LOIP.first->second;
          LOP.first = VNI;
          LOP.second = mdt_[lis_.getMBBFromIndex(VNI->def)];
@@ -528,11 +529,14 @@
           I->second = LiveOutPair(VNI, Node);
         }
       } else if (IDomValue.first) {
-        // No phi-def here. Propagate IDomValue if needed.
+        // No phi-def here. Remember incoming value for IdxMBB.
         if (MBB == IdxMBB)
           IdxVNI = IDomValue.first;
+        // Propagate IDomValue if needed:
+        // MBB is live-out and doesn't define its own value.
         LiveOutMap::iterator I = liveOutCache_.find(MBB);
-        if (I != liveOutCache_.end() && I->second.first != IDomValue.first) {
+        if (I != liveOutCache_.end() && I->second.second != Node &&
+            I->second.first != IDomValue.first) {
           ++Changes;
           I->second = IDomValue;
           DEBUG(dbgs() << "    - BB#" << MBB->getNumber()





More information about the llvm-commits mailing list