OSDN Git Service

Update isLCSSAForm to handle PHI nodes specially for live-out detection. This
authorOwen Anderson <resistor@mac.com>
Tue, 13 Jun 2006 20:45:22 +0000 (20:45 +0000)
committerOwen Anderson <resistor@mac.com>
Tue, 13 Jun 2006 20:45:22 +0000 (20:45 +0000)
is the same as the recent patch to LCSSA.cpp.

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

lib/Analysis/LoopInfo.cpp

index eed2cd6..49162a6 100644 (file)
@@ -487,7 +487,12 @@ bool Loop::isLCSSAForm() const {
       for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E;
            ++UI) {
         BasicBlock *UserBB = cast<Instruction>(*UI)->getParent();
-        if (!isa<PHINode>(*UI) && !contains(UserBB)) {
+        if (PHINode* p = dyn_cast<PHINode>(*UI)) {
+          unsigned OperandNo = UI.getOperandNo();
+          UserBB = p->getIncomingBlock(OperandNo/2);
+        }
+        
+        if (!contains(UserBB)) {
           return false;
         }
       }