SROA: Silence unused variable warnings in Release builds.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 14 Sep 2012 13:08:09 +0000 (13:08 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 14 Sep 2012 13:08:09 +0000 (13:08 +0000)
The NDEBUG hack is ugly, but I see no better solution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163900 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/SROA.cpp

index 8c999bccf6953a55659821c0b348678df0723e31..9dcf12d2f32dab58b341bdbc86074c4e25debf54 100644 (file)
@@ -303,8 +303,10 @@ private:
   class UseBuilder;
   friend class AllocaPartitioning::UseBuilder;
 
+#ifndef NDEBUG
   /// \brief Handle to alloca instruction to simplify method interfaces.
   AllocaInst &AI;
+#endif
 
   /// \brief The instruction responsible for this alloca having no partitioning.
   ///
@@ -988,7 +990,11 @@ void AllocaPartitioning::splitAndMergePartitions() {
 }
 
 AllocaPartitioning::AllocaPartitioning(const TargetData &TD, AllocaInst &AI)
-    : AI(AI), PointerEscapingInstr(0) {
+    :
+#ifndef NDEBUG
+      AI(AI),
+#endif
+      PointerEscapingInstr(0) {
   PartitionBuilder PB(TD, AI, *this);
   if (!PB())
     return;
@@ -1906,6 +1912,7 @@ private:
       uint64_t OrigEnd = IsDest ? MTO.DestEnd : MTO.SourceEnd;
       // Ensure the start lines up.
       assert(BeginOffset == OrigBegin);
+      (void)OrigBegin;
 
       // Rewrite the size as needed.
       if (EndOffset != OrigEnd)