[llvm] 6baf31b - [LoopIdiomRecognize] Reduce variable scope. [NFCI]

Alina Sbirlea via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 22 15:43:37 PST 2020


Author: Alina Sbirlea
Date: 2020-01-22T15:30:08-08:00
New Revision: 6baf31b7c1e11fea00754a99d207ffbc3dbc1086

URL: https://github.com/llvm/llvm-project/commit/6baf31b7c1e11fea00754a99d207ffbc3dbc1086
DIFF: https://github.com/llvm/llvm-project/commit/6baf31b7c1e11fea00754a99d207ffbc3dbc1086.diff

LOG: [LoopIdiomRecognize] Reduce variable scope. [NFCI]

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index 5bdbf303aaa8..e5188d524c61 100644
--- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -339,14 +339,14 @@ bool LoopIdiomRecognize::runOnCountableLoop() {
                     << "] Countable Loop %" << CurLoop->getHeader()->getName()
                     << "\n");
 
-  bool MadeChange = false;
-
   // The following transforms hoist stores/memsets into the loop pre-header.
-  // Give up if the loop has instructions may throw.
+  // Give up if the loop has instructions that may throw.
   SimpleLoopSafetyInfo SafetyInfo;
   SafetyInfo.computeLoopSafetyInfo(CurLoop);
   if (SafetyInfo.anyBlockMayThrow())
-    return MadeChange;
+    return false;
+
+  bool MadeChange = false;
 
   // Scan all the blocks in the loop that are not in subloops.
   for (auto *BB : CurLoop->getBlocks()) {


        


More information about the llvm-commits mailing list