[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
Thu Jan 9 01:35:51 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());
----------------
arsenm wrote:
> there is a match between 2*32 == 64
This is the problem, it's not a match. The total bitwidth is not what matters, the scalar type does. It would be OK if this was a `<2 x s64>` result and the range was using i64. tttt
i.e. the vectorness doesn't matter, nor the total bit width. The scalar type interpretation on both halves is what matters
https://github.com/llvm/llvm-project/pull/121247
More information about the llvm-commits
mailing list