[llvm] r261486 - ScalerEvolution: Only erase temporary values if they actually have been added

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 21 10:50:09 PST 2016


Author: grosser
Date: Sun Feb 21 12:50:09 2016
New Revision: 261486

URL: http://llvm.org/viewvc/llvm-project?rev=261486&view=rev
Log:
ScalerEvolution: Only erase temporary values if they actually have been added

This addresses post-review comments from Sanjoy Das for r261485.

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=261486&r1=261485&r2=261486&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sun Feb 21 12:50:09 2016
@@ -3895,13 +3895,14 @@ const SCEV *ScalarEvolution::createAddRe
         }
       }
     }
+
+    // Remove the temporary PHI node SCEV that has been inserted while intending
+    // to create an AddRecExpr for this PHI node. We can not keep this temporary
+    // as it will prevent later (possibly simpler) SCEV expressions to be added
+    // to the ValueExprMap.
+    ValueExprMap.erase(PN);
   }
 
-  // Remove the temporary PHI node SCEV that has been inserted while intending
-  // to create an AddRecExpr for this PHI node. We can not keep this temporary
-  // as it will prevent later (possibly simpler) SCEV expressions to be added
-  // to the ValueExprMap.
-  ValueExprMap.erase(PN);
   return nullptr;
 }
 




More information about the llvm-commits mailing list