[Attributor] Avoid replacing return operands twice
authorJohannes Doerfert <johannes@jdoerfert.de>
Fri, 25 Feb 2022 22:57:18 +0000 (16:57 -0600)
committerJohannes Doerfert <johannes@jdoerfert.de>
Sat, 12 Mar 2022 03:55:19 +0000 (21:55 -0600)
commitf44f60a297c69c603b3d473ca0cf0f8c06b93d32
treeb45f4d11ddd57ebd0b80c4be732133b1e0ed57ef
parent121191cecbf1687a647967e34123f63e85228e99
[Attributor] Avoid replacing return operands twice

As replacements will become more complex it is better to have a single
AA responsible for replacing a use. Before this patch AAValueSimplify*
and AAValueSimplifyReturned could both try to replace the returned
value. The latter was marginally better for the old pass manager
when a function was already carrying a `returned` attribute and when
the context of the return instruction was important. The second
shortcoming was resolved by looking for return attributes in the
AAValueSimplifyCallSiteReturned initialization. The old PM impact is
not concerning.

This is yet another step towards the removal of AAReturnedValues, the
very first AA we should now try to eliminate due to the overlapping
logic with value simplification.
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll
llvm/test/Transforms/Attributor/IPConstantProp/PR26044.ll
llvm/test/Transforms/Attributor/depgraph.ll
llvm/test/Transforms/Attributor/liveness.ll
llvm/test/Transforms/Attributor/lvi-after-jumpthreading.ll
llvm/test/Transforms/Attributor/lvi-for-ashr.ll
llvm/test/Transforms/Attributor/nocapture-2.ll
llvm/test/Transforms/Attributor/nonnull.ll
llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll
llvm/test/Transforms/Attributor/undefined_behavior.ll