]> granicus.if.org Git - llvm/commitdiff
[SCEV] Remove unnecessary call to forgetMemoizedResults
authorSanjoy Das <sanjoy@playingwithpointers.com>
Wed, 26 Jul 2017 01:32:19 +0000 (01:32 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Wed, 26 Jul 2017 01:32:19 +0000 (01:32 +0000)
`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.

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

lib/Analysis/ScalarEvolution.cpp

index b726fd97b70b389c38152362052d72b6779de6d9..4d7b59c476351aa1d8231acbc1e09d50a3fc827f 100644 (file)
@@ -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);