[Attributor] Deduce the "returned" argument attribute

Authored by jdoerfert on Jul 8 2019, 4:27 PM.


[Attributor] Deduce the "returned" argument attribute

Deduce the "returned" argument attribute by collecting all potentially
returned values.

Not only the unique return value, if any, can be used by subsequent
attributes but also the set of all potentially returned values as well
as the mapping from returned values to return instructions that they
originate from (see AAReturnedValues::checkForallReturnedValues).

Change in statistics (-stats) for LLVM-TS + Spec2006, totaling ~19% more "returned" arguments.

ADDED: attributor                   NumAttributesManifested                  n/a ->        637
ADDED: attributor                   NumAttributesValidFixpoint               n/a ->      25545
ADDED: attributor                   NumFnArgumentReturned                    n/a ->        637
ADDED: attributor                   NumFnKnownReturns                        n/a ->      25545
ADDED: attributor                   NumFnUniqueReturned                      n/a ->      14118

CHANGED: deadargelim NumRetValsEliminated 470 -> 449 ( -4.468%)
REMOVED: functionattrs NumReturned 535 -> n/a
CHANGED: indvars NumElimIdentity 138 -> 164 ( +18.841%)

Reviewers: homerdin, hfinkel, fedor.sergeev, sanjoy, spatel, nlopes, nicholas, reames, efriedma, chandlerc

Subscribers: hiraditya, bollu, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D59919

llvm-svn: 365407