[llvm] [GlobalISel] Catching inconsistencies in load memory, result, and range metadata type (PR #121247)

Renat Idrisov via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 07:34:10 PST 2025


================
@@ -1274,6 +1274,24 @@ 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()) {
+          auto operandBits = [](const MDOperand &o) -> unsigned {
+            ConstantInt *i = mdconst::dyn_extract<ConstantInt>(o);
+            if (!i->isNegative())
+              return i->getValue().getActiveBits();
+            APInt reversed(i->getValue());
----------------
parsifal-47 wrote:

updated, please take a look

https://github.com/llvm/llvm-project/pull/121247


More information about the llvm-commits mailing list