aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/X86/InstSelectSimple.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-12-13 13:04:04 +0000
committerChris Lattner <sabre@nondot.org>2002-12-13 13:04:04 +0000
commitd7d3872fb0327528c59c0bd441b173abc997a899 (patch)
tree8fbbe83cb6985c651dc654ede1db028fccdbf7aa /lib/Target/X86/InstSelectSimple.cpp
parent0868667f78bb712a1b307cf525df105b35699924 (diff)
Add sanity checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5020 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/InstSelectSimple.cpp')
-rw-r--r--lib/Target/X86/InstSelectSimple.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Target/X86/InstSelectSimple.cpp b/lib/Target/X86/InstSelectSimple.cpp
index cad8e0d912..d9feff1a93 100644
--- a/lib/Target/X86/InstSelectSimple.cpp
+++ b/lib/Target/X86/InstSelectSimple.cpp
@@ -35,6 +35,7 @@ inline static MachineInstrBuilder BMI(MachineBasicBlock *MBB,
MachineOpCode Opcode,
unsigned NumOperands,
unsigned DestReg) {
+ assert(I >= MBB->begin() && I <= MBB->end() && "Bad iterator!");
MachineInstr *MI = new MachineInstr(Opcode, NumOperands+1, true, true);
I = ++MBB->insert(I, MI);
return MachineInstrBuilder(MI).addReg(DestReg, MOTy::Def);
@@ -46,6 +47,7 @@ inline static MachineInstrBuilder BMI(MachineBasicBlock *MBB,
MachineBasicBlock::iterator &I,
MachineOpCode Opcode,
unsigned NumOperands) {
+ assert(I > MBB->begin() && I <= MBB->end() && "Bad iterator!");
MachineInstr *MI = new MachineInstr(Opcode, NumOperands, true, true);
I = ++MBB->insert(I, MI);
return MachineInstrBuilder(MI);