Index: include/llvm/CodeGen/SelectionDAG.h =================================================================== --- include/llvm/CodeGen/SelectionDAG.h +++ include/llvm/CodeGen/SelectionDAG.h @@ -471,7 +471,9 @@ return Root; } +#ifndef NDEBUG void VerifyDAGDiverence(); +#endif /// This iterates over the nodes in the SelectionDAG, folding /// certain types of nodes together, or eliminating superfluous nodes. The Index: lib/CodeGen/SelectionDAG/SelectionDAG.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -7955,6 +7955,7 @@ } } +#ifndef NDEBUG void SelectionDAG::VerifyDAGDiverence() { std::vector TopoOrder; @@ -7981,6 +7982,7 @@ "Divergence bit inconsistency detected\n"); } } +#endif /// ReplaceAllUsesOfValuesWith - Replace any uses of From with To, leaving Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -714,8 +714,10 @@ int BlockNumber = -1; (void)BlockNumber; bool MatchFilterBB = false; (void)MatchFilterBB; +#ifndef NDEBUG TargetTransformInfo &TTI = getAnalysis().getTTI(*FuncInfo->Fn); +#endif // Pre-type legalization allow creation of any node types. CurDAG->NewNodesMustHaveLegalTypes = false; @@ -750,8 +752,10 @@ CurDAG->Combine(BeforeLegalizeTypes, AA, OptLevel); } +#ifndef NDEBUG if (TTI.hasBranchDivergence()) CurDAG->VerifyDAGDiverence(); +#endif LLVM_DEBUG(dbgs() << "Optimized lowered selection DAG: " << printMBBReference(*FuncInfo->MBB) << " '" << BlockName @@ -770,8 +774,10 @@ Changed = CurDAG->LegalizeTypes(); } +#ifndef NDEBUG if (TTI.hasBranchDivergence()) CurDAG->VerifyDAGDiverence(); +#endif LLVM_DEBUG(dbgs() << "Type-legalized selection DAG: " << printMBBReference(*FuncInfo->MBB) << " '" << BlockName @@ -792,8 +798,10 @@ CurDAG->Combine(AfterLegalizeTypes, AA, OptLevel); } +#ifndef NDEBUG if (TTI.hasBranchDivergence()) CurDAG->VerifyDAGDiverence(); +#endif LLVM_DEBUG(dbgs() << "Optimized type-legalized selection DAG: " << printMBBReference(*FuncInfo->MBB) << " '" << BlockName @@ -839,8 +847,10 @@ << "'\n"; CurDAG->dump()); +#ifndef NDEBUG if (TTI.hasBranchDivergence()) CurDAG->VerifyDAGDiverence(); +#endif } if (ViewLegalizeDAGs && MatchFilterBB) @@ -852,8 +862,10 @@ CurDAG->Legalize(); } +#ifndef NDEBUG if (TTI.hasBranchDivergence()) CurDAG->VerifyDAGDiverence(); +#endif LLVM_DEBUG(dbgs() << "Legalized selection DAG: " << printMBBReference(*FuncInfo->MBB) << " '" << BlockName @@ -870,8 +882,10 @@ CurDAG->Combine(AfterLegalizeDAG, AA, OptLevel); } +#ifndef NDEBUG if (TTI.hasBranchDivergence()) CurDAG->VerifyDAGDiverence(); +#endif LLVM_DEBUG(dbgs() << "Optimized legalized selection DAG: " << printMBBReference(*FuncInfo->MBB) << " '" << BlockName