[llvm-commits] [llvm] r124282 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Nick Lewycky nicholas at mxc.ca
Wed Jan 26 00:40:22 PST 2011


Author: nicholas
Date: Wed Jan 26 02:40:22 2011
New Revision: 124282

URL: http://llvm.org/viewvc/llvm-project?rev=124282&view=rev
Log:
Fix memory corruption. If one of the SCEV creation functions calls another but
doesn't return immediately after then the insert position in UniqueSCEVs will
be out of date. No test because this is a memory corruption issue. Fixes PR9051!

Modified:
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=124282&r1=124281&r2=124282&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Jan 26 02:40:22 2011
@@ -831,6 +831,7 @@
     }
     if (!hasTrunc)
       return getAddExpr(Operands, false, false);
+    UniqueSCEVs.FindNodeOrInsertPos(ID, IP);  // Mutates IP, returns NULL.
   }
 
   // trunc(x1*x2*...*xN) --> trunc(x1)*trunc(x2)*...*trunc(xN) if we can
@@ -845,6 +846,7 @@
     }
     if (!hasTrunc)
       return getMulExpr(Operands, false, false);
+    UniqueSCEVs.FindNodeOrInsertPos(ID, IP);  // Mutates IP, returns NULL.
   }
 
   // If the input value is a chrec scev, truncate the chrec's operands.





More information about the llvm-commits mailing list