Fix a severe compile time problem when forming large SCEV expressions.
authorAndrew Trick <atrick@apple.com>
Wed, 31 Jul 2013 02:43:40 +0000 (02:43 +0000)
committerAndrew Trick <atrick@apple.com>
Wed, 31 Jul 2013 02:43:40 +0000 (02:43 +0000)
This fix is very lightweight. The same fix already existed for AddRec
but was missing for NAry expressions.

This is obviously an improvement and I'm unsure how to test compile
time problems.

Patch by Xiaoyi Guo!

llvm-svn: 187475

llvm/lib/Analysis/ScalarEvolution.cpp

index 85290d6..f5d095b 100644 (file)
@@ -585,6 +585,9 @@ namespace {
 
         // Lexicographically compare n-ary expressions.
         unsigned LNumOps = LC->getNumOperands(), RNumOps = RC->getNumOperands();
+        if (LNumOps != RNumOps)
+          return (int)LNumOps - (int)RNumOps;
+
         for (unsigned i = 0; i != LNumOps; ++i) {
           if (i >= RNumOps)
             return 1;