[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
Sun Jan 5 08:00:57 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())) {
----------------
parsifal-47 wrote:

This is something I likely do not understand,
I can get a type from range for example like this:
`mdconst::dyn_extract<ConstantInt>(MMO.getRanges()->getOperand(0))->getType()`
but there is no other option but ConstantInt, so it cannot be vector, and that was the reason I checked for range presence because I was thinking it indicates scalar nature of the value.
Let's assume, I have this type now, what should I check for, should int type of the range be equal to ValTy?
Should I check all three to be the same? Or should I just check for vector vs scalar mismatches?

Thank you for your help!

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


More information about the llvm-commits mailing list