aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineVerifier.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/MachineVerifier.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineVerifier.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index becf41b0a..db65eba 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/lib/CodeGen/MachineVerifier.cpp
@@ -1285,8 +1285,12 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) {
if (MMO.getRanges()) {
ConstantInt *i =
mdconst::extract<ConstantInt>(MMO.getRanges()->getOperand(0));
- if (i->getIntegerType()->getBitWidth() !=
- ValTy.getScalarType().getSizeInBits()) {
+ const LLT RangeTy = LLT::scalar(i->getIntegerType()->getBitWidth());
+ const LLT MemTy = MMO.getMemoryType();
+ if (MemTy.getScalarType() != RangeTy ||
+ ValTy.isScalar() != MemTy.isScalar() ||
+ (ValTy.isVector() &&
+ ValTy.getNumElements() != MemTy.getNumElements())) {
report("range is incompatible with the result type", MI);
}
}