[Attributor][NFCI] Distinguish optional and required dependences
authorJohannes Doerfert <johannes@jdoerfert.de>
Sat, 2 Nov 2019 07:48:05 +0000 (02:48 -0500)
committerJohannes Doerfert <johannes@jdoerfert.de>
Sat, 2 Nov 2019 20:26:22 +0000 (15:26 -0500)
commit680f6380278aa5ce871d912072272b393e53b69d
tree3a7cc1abeacab52fc496a8cbcf4b95b97f987f27
parent99094b9f6eff73373df2d86491c7c2189654cd8e
[Attributor][NFCI] Distinguish optional and required dependences

Dependences between two abstract attributes SRC and TRG come naturally in
two flavors:
  Either (1) "some" information of SRC is *required* for TRG to derive
  information, or (2) SRC is just an *optional* way for TRG to derive
  information.

While it is not strictly necessary to distinguish these types
explicitly, it can help us to converge faster, in terms of iterations,
and also cut down the number of `AbstractAttribute::update` calls.

As far as I can tell, we only use optional dependences for liveness so
far but that might change in the future. With this change the Attributor
can be informed about the "dependence class" and it will perform
appropriate actions when an Attribute is set to an invalid state, thus
one that cannot be used by others to derive information from.
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/test/Transforms/FunctionAttrs/align.ll
llvm/test/Transforms/FunctionAttrs/arg_returned.ll
llvm/test/Transforms/FunctionAttrs/internal-noalias.ll
llvm/test/Transforms/FunctionAttrs/liveness.ll
llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll
llvm/test/Transforms/FunctionAttrs/nonnull.ll
llvm/test/Transforms/FunctionAttrs/read_write_returned_arguments_scc.ll