[llvm] [GlobalISel] Enhance iPTR type support in SDAG patterns (PR #111503)
Evgenii Kudriashov via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 24 17:35:27 PDT 2025
e-kud wrote:
> I think we should just remove the SDTCisPtrTy constraint from the vector nodes. It's simply not correct. If we wanted to, we could have a parallel mechanism for the vector index type
Yes, this is an entry point. After removing or replacing it with `SDTCisIntTy` we start seeing a problem that some patterns couldn't be generated because of `Could not infer all types in pattern!`. It happens because now several types are available for an operand. It is fixable for targets with one type of pointers: 32-bit or 64-bit, we can simply add `i32` or `i64` in patterns, not a problem.
For targets with multi-width pointers we need to set a type `iPTR` so it will always match the result of `getVectorIdxTy` as by default we return the width of the pointer type. Or we need to loop over all pointer widths.
Now, having `iPTR` we can't import patterns because we bail out with `unsupported type` from `addTypeCheckPredicate`.
About x86 in particular. Let's override `getVectorIdxWidth`, so we need to return `i32` so it works with 32 and 64 bit platforms. When I've done it, there is a bunch of tests that start failing because some a row of combines stopped working as they were focused on 64 bit indices. I'm not sure whether it's worth it,
https://github.com/llvm/llvm-project/pull/111503
More information about the llvm-commits
mailing list