summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AVR
diff options
context:
space:
mode:
authorDylan McKay <me@dylanmckay.io>2018-11-05 05:49:04 +0000
committerDylan McKay <me@dylanmckay.io>2018-11-05 05:49:04 +0000
commit4c5a5c8db6a9bcfafbb8798e9129e125d1f98155 (patch)
treeec0d22df944094b641fda5d87b5288205d09a236 /llvm/lib/Target/AVR
parent1e255e7a7b3752ef7f786506e695f0f7b58e2339 (diff)
downloadbcm5719-llvm-4c5a5c8db6a9bcfafbb8798e9129e125d1f98155.tar.gz
bcm5719-llvm-4c5a5c8db6a9bcfafbb8798e9129e125d1f98155.zip
[AVR] Fix a backend bug that left extraneous operands after expansion
This patch fixes a bug in the AVR FRMIDX expansion logic. The expansion would leave a leftover operand from the original FRMIDX, but now attached to a MOVWRdRr instruction. The MOVWRdRr instruction did not expect this operand and so LLVM rejected the machine instruction. This would trigger an assertion: Assertion failed: ((isImpReg || Op.isRegMask() || MCID->isVariadic() || OpNo < MCID->getNumOperands() || isMetaDataOp) && "Trying to add an operand to a machine instr that is already done!"), function addOperand, file llvm/lib/CodeGen/MachineInstr.cpp Tim fixed this so that now the FRMIDX is expanded correctly into a well-formed MOVWRdRr. Patch by Tim Neumann llvm-svn: 346117
Diffstat (limited to 'llvm/lib/Target/AVR')
-rw-r--r--llvm/lib/Target/AVR/AVRRegisterInfo.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Target/AVR/AVRRegisterInfo.cpp b/llvm/lib/Target/AVR/AVRRegisterInfo.cpp
index d171a620760..808a85e459c 100644
--- a/llvm/lib/Target/AVR/AVRRegisterInfo.cpp
+++ b/llvm/lib/Target/AVR/AVRRegisterInfo.cpp
@@ -152,6 +152,7 @@ void AVRRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
if (MI.getOpcode() == AVR::FRMIDX) {
MI.setDesc(TII.get(AVR::MOVWRdRr));
MI.getOperand(FIOperandNum).ChangeToRegister(AVR::R29R28, false);
+ MI.RemoveOperand(2);
assert(Offset > 0 && "Invalid offset");
OpenPOWER on IntegriCloud