summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Lanai
diff options
context:
space:
mode:
authorKristof Beyls <kristof.beyls@arm.com>2019-12-11 14:45:48 +0000
committerKristof Beyls <kristof.beyls@arm.com>2019-12-17 10:56:09 +0000
commit870f39d310d6a575fb5d303f4027e988bec9e78e (patch)
treeeaf5f0b7fdaa489e1b47172797362c5cfe018e4e /llvm/lib/Target/Lanai
parentddd0bb8dba2a367c6aa8a25e98915509847745ce (diff)
downloadbcm5719-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/Lanai')
-rw-r--r--llvm/lib/Target/Lanai/LanaiInstrInfo.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Target/Lanai/LanaiInstrInfo.cpp b/llvm/lib/Target/Lanai/LanaiInstrInfo.cpp
index 306cdc77d0d..4ce72f9621a 100644
--- a/llvm/lib/Target/Lanai/LanaiInstrInfo.cpp
+++ b/llvm/lib/Target/Lanai/LanaiInstrInfo.cpp
@@ -788,8 +788,10 @@ bool LanaiInstrInfo::getMemOperandWithOffsetWidth(
BaseOp = &LdSt.getOperand(1);
Offset = LdSt.getOperand(2).getImm();
- assert(BaseOp->isReg() && "getMemOperandWithOffset only supports base "
- "operands of type register.");
+
+ if (!BaseOp->isReg())
+ return false;
+
return true;
}
OpenPOWER on IntegriCloud