From 2d44e02533cdc2ae011121ef651dda93769ced2b Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Tue, 3 Jan 2012 22:34:31 +0000 Subject: [PATCH] Assert when reserved registers have been assigned. This can only happen if the set of reserved registers changes during register allocation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147486 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/VirtRegMap.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/CodeGen/VirtRegMap.cpp b/lib/CodeGen/VirtRegMap.cpp index 1a78db7107f..35834aa205c 100644 --- a/lib/CodeGen/VirtRegMap.cpp +++ b/lib/CodeGen/VirtRegMap.cpp @@ -112,6 +112,9 @@ void VirtRegMap::rewrite(SlotIndexes *Indexes) { SmallVector SuperDeads; SmallVector SuperDefs; SmallVector SuperKills; +#ifndef NDEBUG + BitVector Reserved = TRI->getReservedRegs(*MF); +#endif for (MachineFunction::iterator MBBI = MF->begin(), MBBE = MF->end(); MBBI != MBBE; ++MBBI) { @@ -129,6 +132,7 @@ void VirtRegMap::rewrite(SlotIndexes *Indexes) { unsigned VirtReg = MO.getReg(); unsigned PhysReg = getPhys(VirtReg); assert(PhysReg != NO_PHYS_REG && "Instruction uses unmapped VirtReg"); + assert(!Reserved.test(PhysReg) && "Reserved register assignment"); // Preserve semantics of sub-register operands. if (MO.getSubReg()) {