[PATCH] D123284: [ArgPromotion][Attributor] Update min-legal-vector-width when do promotion

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 18 19:28:55 PDT 2022


pengfei added inline comments.


================
Comment at: llvm/test/Transforms/ArgumentPromotion/byval-3.ll:25
+
+attributes #0 = { uwtable "min-legal-vector-width"="0" }
----------------
jdoerfert wrote:
> I don't understand this test. Where does the 512 come from and why does it replace the 0 (which from a min perspective is less). Also, this has no byval even though the name of the test is byval-3.ll. Finally, I'd suggest to avoid the undef and UB.
> Where does the 512 come from

As I described in the summary, `min-legal-vector-width` reflects the maximum vector width in function arguments. TL;DR, it comes from the promotion that changes the maximum vector width.

>  and why does it replace the 0 (which from a min perspective is less)

Because on X86, a `<32 x half>` with different value of `min-legal-vector-width` uses different registers, i.e., different ABI. And we can't prevent later inliner pass to promote the value for single caller or callee, we must promote them at the first phase.

> Also, this has no byval even though the name of the test is byval-3.ll.

I referenced byval-2.ll. The byval doesn't matter, so I removed it. I can add it back or change the filename.

> Finally, I'd suggest to avoid the undef and UB.

Both argument promotion and lining are legal behavior. I think there's no undef/UB for single pass here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123284



More information about the llvm-commits mailing list