llvm-project/llvm/test/Transforms/Attributor/ArgumentPromotion
Phoebe Wang 7c04454227 [ArgPromotion][Attributor] Update min-legal-vector-width when do promotion
X86 codegen uses function attribute `min-legal-vector-width` to select the proper ABI. The intention of the attribute is to reflect user's requirement when they passing or returning vector arguments. So Clang front-end will iterate the vector arguments and set `min-legal-vector-width` to the width of the maximum for both caller and callee.

It is assumed any middle end optimizations won't care of the attribute expect inlining and argument promotion.
- For inlining, we will propagate the attribute of inlined functions because the inlining functions become the newer caller.
- For argument promotion, we check the `min-legal-vector-width` of the caller and callee and refuse to promote when they don't match.

The problem comes from the optimizations' combination, as shown by https://godbolt.org/z/zo3hba8xW. The caller `foo` has two callees `bar` and `baz`. When doing argument promotion, both `foo` and `bar` has the same `min-legal-vector-width`. So the argument was promoted to vector. Then the inlining inlines `baz` to `foo` and updates `min-legal-vector-width`, which results in ABI mismatch between `foo` and `bar`.

This patch fixes the problem by expanding the concept of `min-legal-vector-width` to indicator of functions arguments. That says, any passes touch functions arguments have to set `min-legal-vector-width` to the value reflects the width of vector arguments. It makes sense to me because any arguments modifications are ABI related and should response for the ABI compatibility.

Differential Revision: https://reviews.llvm.org/D123284
2022-05-02 14:13:05 +08:00
..
X86 [ArgPromotion][Attributor] Update min-legal-vector-width when do promotion 2022-05-02 14:13:05 +08:00
2008-02-01-ReturnAttrs.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
2008-07-02-array-indexing.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
2008-09-07-CGUpdate.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
2008-09-08-CGUpdateSelfEdge.ll [Attributor] Introduce the concept of query AAs 2022-02-01 01:40:44 -06:00
aggregate-promote.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
alignment.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
alloca-as.ll Revert "[Attributor] CGSCC pass should not recompute results outside the SCC" 2022-04-15 15:29:51 -05:00
array.ll Revert "[Attributor] CGSCC pass should not recompute results outside the SCC" 2022-04-15 15:29:51 -05:00
attrs.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
basictest.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
byval-2.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
byval.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
chained.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
control-flow.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
control-flow2.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
crash.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
dbg.ll [Attributor] Introduce the concept of query AAs 2022-02-01 01:40:44 -06:00
fp80.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
inalloca.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
invalidation.ll [Attributor] Use AAFunctionReachability to determine AANoRecurse 2022-02-01 01:40:44 -06:00
live_called_from_dead.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
live_called_from_dead_2.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
musttail.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
naked_functions.ll [Attributor] Introduce the concept of query AAs 2022-02-01 01:40:44 -06:00
nonzero-address-spaces.ll [Attributor] Introduce the concept of query AAs 2022-02-01 01:40:44 -06:00
pr27568.ll [Attributor] Introduce the concept of query AAs 2022-02-01 01:40:44 -06:00
pr32917.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
pr33641_remove_arg_dbgvalue.ll Reapply "[Intrinsics] Add `nocallback` to the default intrinsic attributes" 2022-03-25 09:36:50 -05:00
profile.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
reserve-tbaa.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
sret.ll [Attributor] CGSCC pass should not recompute results outside the SCC (reapply) 2022-04-17 12:48:49 -05:00
tail.ll [Attributor] Cleanup manifest and liveness for CGSCC passes 2022-03-11 16:46:02 -06:00
variadic.ll Revert "[Attributor] CGSCC pass should not recompute results outside the SCC" 2022-04-15 15:29:51 -05:00