Punt if we see gigantic PHI nodes. This improves a huge interpreter loop
authorChris Lattner <sabre@nondot.org>
Tue, 16 Mar 2004 19:52:53 +0000 (19:52 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 16 Mar 2004 19:52:53 +0000 (19:52 +0000)
testcase from 32.5s in -raise to take .3s

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

lib/Transforms/ExprTypeConvert.cpp

index 9fc9c93d4bfc09ae28fc6878edf04b73544f8594..b30ddf1f293c59519a38fbc5a9bfca6986a9ef56 100644 (file)
@@ -206,6 +206,9 @@ bool llvm::ExpressionConvertibleToType(Value *V, const Type *Ty,
   }
   case Instruction::PHI: {
     PHINode *PN = cast<PHINode>(I);
+    // Be conservative if we find a giant PHI node.
+    if (PN->getNumIncomingValues() > 32) return false;
+
     for (unsigned i = 0; i < PN->getNumIncomingValues(); ++i)
       if (!ExpressionConvertibleToType(PN->getIncomingValue(i), Ty, CTMap, TD))
         return false;
@@ -815,6 +818,9 @@ static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty,
 
   case Instruction::PHI: {
     PHINode *PN = cast<PHINode>(I);
+    // Be conservative if we find a giant PHI node.
+    if (PN->getNumIncomingValues() > 32) return false;
+
     for (unsigned i = 0; i < PN->getNumIncomingValues(); ++i)
       if (!ExpressionConvertibleToType(PN->getIncomingValue(i), Ty, CTMap, TD))
         return false;