[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
Sat Jan 4 01:56:11 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:

This isn't quite right. You're checking a different condition than #97290 is asking for. Neither of the checked types are from MMO.getRanges. We probably should have a similar check, without requiring ranges, but I believe we're relying on the current behavior so it's beyond the scope of this patch.

Instead you should be verifying the IR type in MMO.getRanges() against ValTy and MMO.getType()

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


More information about the llvm-commits mailing list