From a91a56353086b8cd70ace87a4e290ac278ff345b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 28 Oct 2009 05:14:34 +0000 Subject: Previously, all operands to Constant were themselves constant. In the new world order, BlockAddress can have a BasicBlock operand. This doesn't permute much, because if you have a ConstantExpr (or anything more specific than Constant) we still know the operand has to be a Constant. llvm-svn: 85375 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 692c289b833..98f782ff5ba 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -751,10 +751,11 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, assert (0 && "Unknown FP type!"); } } else if (isa(C) && cast(C)->isString()) { + const ConstantArray *CA = cast(C); // Emit constant strings specially. - unsigned NumOps = C->getNumOperands(); + unsigned NumOps = CA->getNumOperands(); // If this is a null-terminated string, use the denser CSTRING encoding. - if (C->getOperand(NumOps-1)->isNullValue()) { + if (CA->getOperand(NumOps-1)->isNullValue()) { Code = bitc::CST_CODE_CSTRING; --NumOps; // Don't encode the null, which isn't allowed by char6. } else { @@ -764,7 +765,7 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, bool isCStr7 = Code == bitc::CST_CODE_CSTRING; bool isCStrChar6 = Code == bitc::CST_CODE_CSTRING; for (unsigned i = 0; i != NumOps; ++i) { - unsigned char V = cast(C->getOperand(i))->getZExtValue(); + unsigned char V = cast(CA->getOperand(i))->getZExtValue(); Record.push_back(V); isCStr7 &= (V & 128) == 0; if (isCStrChar6) -- cgit v1.2.3