This is an archive of the discontinued LLVM Phabricator instance.

[Attributor] Deduce memory behavior function attributes
AbandonedPublic

Authored by jdoerfert on Apr 1 2019, 10:45 AM.

Details

Summary

Deduce the memory behavior, aka "read-none", "read-only", or
"write-only", for functions. This also improves argument deduction
(D59980) because it can rely on the function memory behavior which
is derived.

Impact on the statistics (-stats) for LLVM-TS + Spec2006:

CHANGED: attributor                   NumAttributesManifested                77683 ->      87205 (   +12.258%)
CHANGED: attributor                   NumAttributesValidFixpoint            109073 ->     118598 (    +8.733%)
CHANGED: attributor                   NumFnArgumentReadOnly                  16532 ->      16755 (    +1.349%)
  ADDED: attributor                   NumFnReadNone                            n/a ->       2930
  ADDED: attributor                   NumFnReadOnly                            n/a ->       4380
  ADDED: attributor                   NumFnWriteOnly                           n/a ->       1960
CHANGED: functionattrs                NumReadNone                             3095 ->        165 (   -94.669%)
CHANGED: functionattrs                NumReadNoneArg                           216 ->        144 (   -33.333%)
CHANGED: functionattrs                NumReadOnly                             4363 ->        134 (   -96.929%)
CHANGED: functionattrs                NumReadOnlyArg                          1072 ->        945 (   -11.847%)
CHANGED: functionattrs                NumWriteOnly                            2012 ->         52 (   -97.416%)

Note: The deduction will improve with later patches that introduce new

functionality we can utilize. Also, some are a result of a bug, see:
http://llvm.org/PR41328