From 934fcf4dc68c5ba2efe395c417759af6564039d5 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Sun, 21 Feb 2016 18:50:09 +0000 Subject: [PATCH] ScalerEvolution: Only erase temporary values if they actually have been added This addresses post-review comments from Sanjoy Das for r261485. llvm-svn: 261486 --- llvm/lib/Analysis/ScalarEvolution.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 6e8fa5d..07d72f5 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -3895,13 +3895,14 @@ const SCEV *ScalarEvolution::createAddRecFromPHI(PHINode *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); } - // 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; } -- 2.7.4