diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2009-10-24 00:27:00 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2009-10-24 00:27:00 +0000 |
commit | efcd89a5f66826430d077476564afe41109290cb (patch) | |
tree | 3bf0c6caa4c34f7dd0e9dff3f1484396e9150c7a /lib/CodeGen/LowerSubregs.cpp | |
parent | 2f1abe2dae50e7bc29b20fcad3ea127cdb597532 (diff) | |
download | external_llvm-efcd89a5f66826430d077476564afe41109290cb.zip external_llvm-efcd89a5f66826430d077476564afe41109290cb.tar.gz external_llvm-efcd89a5f66826430d077476564afe41109290cb.tar.bz2 |
Add some asserts to catch copyRegToReg() fails early
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84983 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LowerSubregs.cpp')
-rw-r--r-- | lib/CodeGen/LowerSubregs.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/CodeGen/LowerSubregs.cpp b/lib/CodeGen/LowerSubregs.cpp index 8486bb0..8a0785d 100644 --- a/lib/CodeGen/LowerSubregs.cpp +++ b/lib/CodeGen/LowerSubregs.cpp @@ -195,7 +195,9 @@ bool LowerSubregsInstructionPass::LowerSubregToReg(MachineInstr *MI) { // Insert sub-register copy const TargetRegisterClass *TRC0= TRI.getPhysicalRegisterRegClass(DstSubReg); const TargetRegisterClass *TRC1= TRI.getPhysicalRegisterRegClass(InsReg); - TII.copyRegToReg(*MBB, MI, DstSubReg, InsReg, TRC0, TRC1); + bool Emitted = TII.copyRegToReg(*MBB, MI, DstSubReg, InsReg, TRC0, TRC1); + (void)Emitted; + assert(Emitted && "Subreg and Dst must be of compatible register class"); // Transfer the kill/dead flags, if needed. if (MI->getOperand(0).isDead()) TransferDeadFlag(MI, DstSubReg, TRI); @@ -209,7 +211,7 @@ bool LowerSubregsInstructionPass::LowerSubregToReg(MachineInstr *MI) { DEBUG(errs() << '\n'); MBB->erase(MI); - return true; + return true; } bool LowerSubregsInstructionPass::LowerInsert(MachineInstr *MI) { @@ -264,8 +266,11 @@ bool LowerSubregsInstructionPass::LowerInsert(MachineInstr *MI) { // KILL. BuildMI(*MBB, MI, MI->getDebugLoc(), TII.get(TargetInstrInfo::KILL), DstSubReg); - else - TII.copyRegToReg(*MBB, MI, DstSubReg, InsReg, TRC0, TRC1); + else { + bool Emitted = TII.copyRegToReg(*MBB, MI, DstSubReg, InsReg, TRC0, TRC1); + (void)Emitted; + assert(Emitted && "Subreg and Dst must be of compatible register class"); + } MachineBasicBlock::iterator CopyMI = MI; --CopyMI; |