In certain places in llvm/lib/CodeGen we were relying upon the TypeSize
comparison operators when in fact the code was only ever expecting
either scalar values or fixed width vectors. I've changed some of these
places to use the equivalent scalar operator.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Please separate all the "non-functional" (just adding .getFixedSize()) changes into a separate patch from any changes that potentially have functional effects.
Hi @efriedma, sure I can do that. To be honest (and this is probably my lack of understanding of what is meant by a functional change) I thought they were almost all non-functional. That's why I originally put them in this patch together. Just for my understanding, which bits do you consider non-functional? I can definitely see that one change in TargetLowering is non-functional, but in other cases such as mergeTruncStores where I call getScalarSizeInBits() instead of getSizeInBits() to me, naively, this seemed non-functional because we're dealing with scalar values - the function bails out if the type is not a simple integer. Similarly in ReduceLoadWidth we bail out immediately if the type is a vector, so from that point onwards the type is guaranteed to be scalar.
From a fixed-width vector perspective, all the getFixedSize() changes are purely NFC. Changes like getSizeInBits() -> getScalarSizeInBits() are _possibly_ functional if your assumption that the type must be a scalar value, ends up being false. I think the exception here are the cases where it can be trivially seen that the function bails out early when the type is not a scalar.
From a scalable-vector perspective, the getFixedSize() changes are not necessarily non-functional, because if a scalable vector goes down these code-paths things will now break with an assert where it would previously 'just work'. In your patch you're making the assumption that scalable vectors shouldn't go down these code-paths, so they are likely to be non-functional.
I think Eli's point is that you could move out all the getFixedSize changes into a separate patch, as those are known to be NFC for fixed-width vectors and can't break any of the buildbots or impact any other users of LLVM that don't compile for SVE.
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | ||
---|---|---|
7862 | Was this change supposed to be part of this patch? |
Was this change supposed to be part of this patch?