From: Dan Gohman Date: Tue, 18 May 2010 22:35:55 +0000 (+0000) Subject: Print an error message in Formula::print if the HasBaseReg flag X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=c4cfbaf2174bc0b0aef080b183b048c9f05c4725;p=oota-llvm.git Print an error message in Formula::print if the HasBaseReg flag is inconsistent with the BaseRegs field. It's not print's job to assert on an invalid condition, but it can make one more obvious. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104077 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index cec397c739c..e2a3c46767c 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -326,6 +326,13 @@ void Formula::print(raw_ostream &OS) const { if (!First) OS << " + "; else First = false; OS << "reg(" << **I << ')'; } + if (AM.HasBaseReg && BaseRegs.empty()) { + if (!First) OS << " + "; else First = false; + OS << "**error: HasBaseReg**"; + } else if (!AM.HasBaseReg && !BaseRegs.empty()) { + if (!First) OS << " + "; else First = false; + OS << "**error: !HasBaseReg**"; + } if (AM.Scale != 0) { if (!First) OS << " + "; else First = false; OS << AM.Scale << "*reg(";