diff options
| author | Kristof Beyls <kristof.beyls@arm.com> | 2019-12-11 14:45:48 +0000 |
|---|---|---|
| committer | Kristof Beyls <kristof.beyls@arm.com> | 2019-12-17 10:56:09 +0000 |
| commit | 870f39d310d6a575fb5d303f4027e988bec9e78e (patch) | |
| tree | eaf5f0b7fdaa489e1b47172797362c5cfe018e4e /llvm/lib/Target/RISCV | |
| parent | ddd0bb8dba2a367c6aa8a25e98915509847745ce (diff) | |
| download | bcm5719-llvm-870f39d310d6a575fb5d303f4027e988bec9e78e.tar.gz bcm5719-llvm-870f39d310d6a575fb5d303f4027e988bec9e78e.zip | |
Fix assertion failure in getMemOperandWithOffsetWidth
This fixes an assertion failure that triggers inside
getMemOperandWithOffset when Machine Sinking calls it on a MachineInstr
that is not a memory operation.
Different backends implement getMemOperandWithOffset differently: some
return false on non-memory MachineInstrs, others assert.
The Machine Sinking pass in at least SinkingPreventsImplicitNullCheck
relies on getMemOperandWithOffset to return false on non-memory
MachineInstrs, instead of asserting.
This patch updates the documentation on getMemOperandWithOffset that it
should return false on any MachineInstr it cannot handle, instead of
asserting. It also adapts the in-tree backends accordingly where
necessary.
Differential Revision: https://reviews.llvm.org/D71359
Diffstat (limited to 'llvm/lib/Target/RISCV')
| -rw-r--r-- | llvm/lib/Target/RISCV/RISCVInstrInfo.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp index 11c446386ca..e41af1f462b 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp @@ -562,7 +562,8 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI, bool RISCVInstrInfo::getMemOperandWithOffsetWidth( const MachineInstr &LdSt, const MachineOperand *&BaseReg, int64_t &Offset, unsigned &Width, const TargetRegisterInfo *TRI) const { - assert(LdSt.mayLoadOrStore() && "Expected a memory operation."); + if (!LdSt.mayLoadOrStore()) + return false; // Here we assume the standard RISC-V ISA, which uses a base+offset // addressing mode. You'll need to relax these conditions to support custom |

