diff options
author | Evandro Menezes <emenezes@codeaurora.org> | 2012-11-09 20:29:37 +0000 |
---|---|---|
committer | Evandro Menezes <emenezes@codeaurora.org> | 2012-11-09 20:29:37 +0000 |
commit | f1bb42152a0375f2889bd7329eada2b6422c837e (patch) | |
tree | edd1d33f0c22b01f36f9463879387d9fb6aefdef /utils/TableGen | |
parent | 12cfa119600418d31ceb748d077b3e6f7057a22a (diff) | |
download | external_llvm-f1bb42152a0375f2889bd7329eada2b6422c837e.zip external_llvm-f1bb42152a0375f2889bd7329eada2b6422c837e.tar.gz external_llvm-f1bb42152a0375f2889bd7329eada2b6422c837e.tar.bz2 |
Fix issue with invalid flat operand number
Avoid iterating over list of operands beyond the number of operands in it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167634 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r-- | utils/TableGen/CodeEmitterGen.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp index e60aec9..bcca15c 100644 --- a/utils/TableGen/CodeEmitterGen.cpp +++ b/utils/TableGen/CodeEmitterGen.cpp @@ -134,10 +134,15 @@ AddCodeToMergeInOperand(Record *R, BitsInit *BI, const std::string &VarName, assert(!CGI.Operands.isFlatOperandNotEmitted(OpIdx) && "Explicitly used operand also marked as not emitted!"); } else { + unsigned NumberOps = CGI.Operands.size(); /// If this operand is not supposed to be emitted by the /// generated emitter, skip it. - while (CGI.Operands.isFlatOperandNotEmitted(NumberedOp)) + while (NumberedOp < NumberOps && + CGI.Operands.isFlatOperandNotEmitted(NumberedOp)) ++NumberedOp; + // If this operand has not been found, ignore it. + if (NumberedOp >= NumberOps) + return; OpIdx = NumberedOp++; } |