[llvm] r309072 - [SCEV] Remove unnecessary call to forgetMemoizedResults

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 25 18:32:19 PDT 2017


Author: sanjoy
Date: Tue Jul 25 18:32:19 2017
New Revision: 309072

URL: http://llvm.org/viewvc/llvm-project?rev=309072&view=rev
Log:
[SCEV] Remove unnecessary call to forgetMemoizedResults

`SCEVUnknown::allUsesReplacedWith` does not need to call `forgetMemoizedResults`
since RAUW does a value-equivalent replacement by assumption.  If this
assumption was false then the later setValPtr(New) call would be incorrect too.

This is a non-trivial performance optimization for functions with a large number
of loops since `forgetMemoizedResults` walks all loop backedge taken counts to
see if any of them use the SCEVUnknown being RAUWed.  However, this improvement
is difficult to demonstrate without checking in an excessively large IR file.

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=309072&r1=309071&r2=309072&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Tue Jul 25 18:32:19 2017
@@ -415,9 +415,6 @@ void SCEVUnknown::deleted() {
 }
 
 void SCEVUnknown::allUsesReplacedWith(Value *New) {
-  // Clear this SCEVUnknown from various maps.
-  SE->forgetMemoizedResults(this);
-
   // Remove this SCEVUnknown from the uniquing map.
   SE->UniqueSCEVs.RemoveNode(this);
 




More information about the llvm-commits mailing list