aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineVerifier.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2025-01-30 10:56:12 +0700
committerGitHub <noreply@github.com>2025-01-30 10:56:12 +0700
commit60174804611a2543c757d274b293c139412ab41c (patch)
treebeaf723796b403356d68dc33977c2de13bf6694b /llvm/lib/CodeGen/MachineVerifier.cpp
parent97a1f494a6778df24cfca817a30b73b1f0a7228a (diff)
downloadllvm-60174804611a2543c757d274b293c139412ab41c.zip
llvm-60174804611a2543c757d274b293c139412ab41c.tar.gz
llvm-60174804611a2543c757d274b293c139412ab41c.tar.bz2
MachineVerifier: Fix check for range type (#124894)
We need to permit scalar extending loads with range annotations. Fix expensive_checks failures after 11db7fb09b36e656a801117d6a2492133e9c2e46
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);
}
}