Edmund Grimley Evans
2010-Feb-03 15:55 UTC
[LLVMdev] MI.getNumOperands() < MI.getDesc().getNumOperands()
With a modified copy of LLVM (so it's probably my fault) I'm getting an assertion failure because isTwoAddrUse (in TwoAddressInstructionPass.cpp) is being called with a MachineInstr MI such that MI.getNumOperands() is 2, but MI.getDesc().getNumOperands() is 5. The assertion fails when that function calls MI.getOperand(2). My question is: is isTwoAddrUse doing the right thing here? static bool isTwoAddrUse(MachineInstr &MI, unsigned Reg, unsigned &DstReg) { const TargetInstrDesc &TID = MI.getDesc(); unsigned NumOps = (MI.getOpcode() == TargetInstrInfo::INLINEASM) ? MI.getNumOperands() : TID.getNumOperands(); for (unsigned i = 0; i != NumOps; ++i) { const MachineOperand &MO = MI.getOperand(i); ... This code seems to be written with the assumption that MI.getDesc().getNumOperands() <= MI.getNumOperands() || MI.getOpcode() == TargetInstrInfo::INLINEASM -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Jakob Stoklund Olesen
2010-Feb-03 18:34 UTC
[LLVMdev] MI.getNumOperands() < MI.getDesc().getNumOperands()
On Feb 3, 2010, at 7:55 AM, Edmund Grimley Evans wrote:> With a modified copy of LLVM (so it's probably my fault) I'm getting > an assertion failure because isTwoAddrUse (in > TwoAddressInstructionPass.cpp) is being called with a MachineInstr MI > such that MI.getNumOperands() is 2, but MI.getDesc().getNumOperands() > is 5. The assertion fails when that function calls MI.getOperand(2).Why does your instruction only have 2 operands when the description says it should have 5? That should never happen except when first building the instruction.
Possibly Parallel Threads
- [LLVMdev] Being able to know the jitted code-size before emitting
- Building R on Windows 7 -- No rule to make target `etc/GETDESC', needed by `fixetc'.
- [LLVMdev] Fwd: Prevention register promotion at the isel codegen phase
- [LLVMdev] Fwd: Prevention register promotion at the isel codegen phase
- [LLVMdev] LowerCALL (TargetLowering)