[llvm] [GlobalISel] Catching inconsistencies in load memory, result, and range metadata type (PR #121247)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 5 19:56:28 PST 2025
================
@@ -1274,6 +1274,12 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) {
if (TypeSize::isKnownGT(MMO.getSize().getValue(),
ValTy.getSizeInBytes()))
report("load memory size cannot exceed result size", MI);
+
+ if (MMO.getRanges() && (ValTy.isVector() != MMO.getType().isVector())) {
----------------
arsenm wrote:
You get the scalar integer type out of `mdconst::extract<ConstantInt>(MMO.getRanges()->getOperand(0))->getType()`. You need to verify the MIR result type has the same scalar type, something like `ValTy.getScalarType()->getSizeInBits() == mdconst::extract<ConstantInt>(MMO.getRanges()->getOperand(0)).getIntegerType()->getBitWidth()`. Whether the MIR type is vector isn't as significant as whether the element type matches the range IR type
https://github.com/llvm/llvm-project/pull/121247
More information about the llvm-commits
mailing list