From: Sanjoy Das Date: Tue, 22 Sep 2015 00:10:57 +0000 (+0000) Subject: [SCEV] Use SaveAndRestore instead of a hand rolled struct; NFCI. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=00051c954c0742b9ba856f7372b9abab8309f660;p=oota-llvm.git [SCEV] Use SaveAndRestore instead of a hand rolled struct; NFCI. `ClearWalkingBEDominatingCondsOnExit` is exactly `SaveAndRestore`, so use `SaveAndRestore` instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248227 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 262280c8a9c..df1e3eb183a 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -88,6 +88,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/SaveAndRestore.h" #include using namespace llvm; @@ -6987,24 +6988,12 @@ ScalarEvolution::isLoopBackedgeGuardedByCond(const Loop *L, LoopContinuePredicate->getSuccessor(0) != L->getHeader())) return true; - struct ClearWalkingBEDominatingCondsOnExit { - ScalarEvolution &SE; - - explicit ClearWalkingBEDominatingCondsOnExit(ScalarEvolution &SE) - : SE(SE){} - - ~ClearWalkingBEDominatingCondsOnExit() { - SE.WalkingBEDominatingConds = false; - } - }; - // We don't want more than one activation of the following loops on the stack // -- that can lead to O(n!) time complexity. if (WalkingBEDominatingConds) return false; - WalkingBEDominatingConds = true; - ClearWalkingBEDominatingCondsOnExit ClearOnExit(*this); + SaveAndRestore ClearOnExit(WalkingBEDominatingConds, true); // Check conditions due to any @llvm.assume intrinsics. for (auto &AssumeVH : AC.assumptions()) {