[BUG] Fix -Wunused-variable warning in Release mode. Thnx to Kostya Serebryany for...
authorZinovy Nis <zinovy.nis@gmail.com>
Tue, 29 Apr 2014 09:45:08 +0000 (09:45 +0000)
committerZinovy Nis <zinovy.nis@gmail.com>
Tue, 29 Apr 2014 09:45:08 +0000 (09:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207516 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Vectorize/LoopVectorize.cpp

index 5f27079a96dc6ac37e9230f3239e2dcbcd731947..cf210d679d810749cd185e1f3f24ec7954c20b8f 100644 (file)
@@ -5096,9 +5096,11 @@ LoopVectorizationCostModel::selectVectorizationFactor(bool OptForSize,
   }
 
   float Cost = expectedCost(1);
+#ifndef NDEBUG
   const float ScalarCost = Cost;
+#endif /* NDEBUG */
   unsigned Width = 1;
-  DEBUG(dbgs() << "LV: Scalar loop costs: " << (int)Cost << ".\n");
+  DEBUG(dbgs() << "LV: Scalar loop costs: " << (int)ScalarCost << ".\n");
 
   // Ignore scalar width, because the user explicitly wants vectorization.
   if (ForceVectorization && VF > 1) {
@@ -5122,7 +5124,6 @@ LoopVectorizationCostModel::selectVectorizationFactor(bool OptForSize,
   DEBUG(if (ForceVectorization && Width > 1 && Cost >= ScalarCost) dbgs()
         << "LV: Vectorization seems to be not beneficial, "
         << "but was forced by a user.\n");
-  (void)ScalarCost;
   DEBUG(dbgs() << "LV: Selecting VF: "<< Width << ".\n");
   Factor.Width = Width;
   Factor.Cost = Width * Cost;