summaryrefslogtreecommitdiffstats
path: root/lib/Bytecode
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-12-04 21:28:47 +0000
committerChris Lattner <sabre@nondot.org>2004-12-04 21:28:47 +0000
commit129baf69bc46040259d4a85004cadf7d0e4a87e8 (patch)
tree3838930fceb51f6b03c9b420cd45edca447b46f4 /lib/Bytecode
parent6a1a78a478fc1b0f6a1b236cb5cd0cb95e0f42d4 (diff)
downloadexternal_llvm-129baf69bc46040259d4a85004cadf7d0e4a87e8.zip
external_llvm-129baf69bc46040259d4a85004cadf7d0e4a87e8.tar.gz
external_llvm-129baf69bc46040259d4a85004cadf7d0e4a87e8.tar.bz2
Check in some patches for better assertions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18500 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode')
-rw-r--r--lib/Bytecode/Writer/SlotCalculator.cpp3
-rw-r--r--lib/Bytecode/Writer/Writer.cpp1
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp
index 575dd34..4a95c7b 100644
--- a/lib/Bytecode/Writer/SlotCalculator.cpp
+++ b/lib/Bytecode/Writer/SlotCalculator.cpp
@@ -691,6 +691,9 @@ int SlotCalculator::getOrCreateSlot(const Value *V) {
int SlotNo = getSlot(V); // Check to see if it's already in!
if (SlotNo != -1) return SlotNo;
+ if (const GlobalValue *GV = dyn_cast<GlobalValue>(V))
+ assert(GV->getParent() != 0 && "Global not embedded into a module!");
+
if (!isa<GlobalValue>(V)) // Initializers for globals are handled explicitly
if (const Constant *C = dyn_cast<Constant>(V)) {
assert(CompactionNodeMap.empty() &&
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp
index b54a513..98a4234 100644
--- a/lib/Bytecode/Writer/Writer.cpp
+++ b/lib/Bytecode/Writer/Writer.cpp
@@ -295,6 +295,7 @@ void BytecodeWriter::outputConstant(const Constant *CPV) {
if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CPV)) {
// FIXME: Encoding of constant exprs could be much more compact!
assert(CE->getNumOperands() > 0 && "ConstantExpr with 0 operands");
+ assert(CE->getNumOperands() != 1 || CE->getOpcode() == Instruction::Cast);
output_vbr(1+CE->getNumOperands()); // flags as an expr
output_vbr(CE->getOpcode()); // flags as an expr