LGTM, thanks! Just a load of optional nits inline.
I don't know what the best fix is, but I've verified that this patch solves the problem I saw and I haven't seen anything weird pop up with the patch in some limited testing I've done with it.
Please grep for the SymbolRef and rename the other symbols/comments as well, especially the compound names.
Use the typeid/isa scheme, expose IsA and Get methods for each affine binary operation expression.
Oh yes, added now.
Looks good, (I'm ambivalent on the testing discussion, and will let you and @MaskRay come to a conclusion).
@sbc100 if it's ok for you, feel free to merge, thanks.
Align with local indent style
Sounds like a good idea.
Why the reluctance to actually generate the min/max intrinsics?
I was thinking of vXi8 and vXi16 vectors that can't be used as indices on X86.
If vXi8 and vXi16 are not legal, the type-legaliser will re-add sign/zero extends when doing type-promotion in DAGTypeLegalizer::PromoteIntOp_MSCATTER, for which it uses the signedness of the MemIndexType. The same is also needed for SVE, which only supports nxvXi32 and nxvXi64 indices. But at least this ensures that e.g. a zero-extend of a legal nxv4i32 -> illegal nxv4i64 will get encoded as legal UNSIGNED_[UN]SCALED nxv4i32 for which the architecture will generate the instruction with zero-extending index. Do you think that will be sufficient?
vXi8/vXi16 are legal types on X86 but not supported as indices to gather.
Okay, I see what you mean. That suggests it would be useful to add a target interface to query if the type is legal as an index type for mgather/mscatter.
address comments and add AST tests.
- Addressed review comments.
The common pattern where the CT drops that I ovserve is following: Start is a constant (in most cases zero), Step is also a constant and MaxBECount is a pretty big expression.
FYI, this showed up as a 5% compile-time regression in the NewPM-O3 configuration: https://llvm-compile-time-tracker.com/compare.php?from=3b8d8954bf2c192502d757019b9fe434864068e9&to=3024fe5b55ed72633915f613bd5e2826583c396f&stat=instructions