[PATCH] D139627: clang/X86: Don't emit "min-legal-vector-width"="0"

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 13 15:45:17 PST 2022


craig.topper added a comment.

In D139627#3993440 <https://reviews.llvm.org/D139627#3993440>, @arsenm wrote:

> In D139627#3983718 <https://reviews.llvm.org/D139627#3983718>, @pengfei wrote:
>
>>> It also doesn't mean that, because the IR doesn't have to be consistent with the attribute. The IR exists independent of the attribute, and the attribute can only provide performance hints.
>>
>> I don't agree. There are attributes like `zeroext`, `byref` are ABI related see https://llvm.org/docs/LangRef.html#parameter-attributes. I'd take `min-legal-vector-width` as a similar one.
>
> This is not an ABI attribute, it's an optimization hint. If it were an ABI attribute, inferring and propagating it like is done would not be correct. If you treat it like an optimization hint, you only have to consider this one place instead of everywhere the IR may change

If the caller or callee calculate have different values and one of them is less than the width of the vector argument it will cause an ABI break. The type legalizer in SelectionDAG will split one and not the other. Maybe the backend should check the IR for the arguments/returns and increase the min-legal-vector-width if its less than argument width and the argument width is supported by the AVX level.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139627/new/

https://reviews.llvm.org/D139627



More information about the cfe-commits mailing list