[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
Tue Jan 21 05:17:55 PST 2025


================
@@ -1274,6 +1274,15 @@ 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()) {
+          ConstantInt *i =
+              mdconst::extract<ConstantInt>(MMO.getRanges()->getOperand(0));
+          if (i->getIntegerType()->getBitWidth() !=
+              ValTy.getScalarType().getSizeInBits()) {
----------------
arsenm wrote:

```suggestion
              MMO.getMemoryType().getScalarSizeInBits()) {
```

This should continue to permit the extending load case to use range metadata. Verifying the result type is trickier since we need to account for valid extending loads 

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


More information about the llvm-commits mailing list