[PATCH] D68934: [Attributor] Make value simplify stronger

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 13 23:43:38 PDT 2019


jdoerfert created this revision.
jdoerfert added reviewers: uenoku, sstefan1, hfinkel.
Herald added subscribers: bollu, hiraditya.
Herald added a project: LLVM.

NOTE: This is still under testing on the test-suite

This patch makes value simplify stronger and consolidates features
present in AAReturnedValuesImpl before. The new algorithm does not try
to find a single value which is "simplified" but instead collects
"assumed equivalent" values. If we find an inconsistency in our assumed
equivalent value set, we revert it back to the original value. The trick
is that a value might not look equivalent early but as long as its
AAValueSimplify object is not in a fixpoint state we can optimistically
assume we have not found the link yet that will make the equivalence
obvious. At manifest time we have to verify that all links are present
as we know all AAValueSimplify objects are in a fixpoint state now, even
if they do not know it yet.

In addition, this patch adds simple constant folding and instruction
folding logic.

The reason for this patch was the Adobe-C++/loop_unroll.cpp benchmark in
the test suite. The compile time with the old implementation was bad. A
test case in the spirit of loop_unroll.cpp was added to
value_simplify.ll.

TODO: Other AAs and Attributor routines could use AAValueSimplify when
they look at values.

Use update_test_checks for value_simplify.ll with the following patches
applied and function signature printing enabled: D68851 <https://reviews.llvm.org/D68851>, D68850 <https://reviews.llvm.org/D68850>, D68819 <https://reviews.llvm.org/D68819>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68934

Files:
  llvm/include/llvm/Transforms/IPO/Attributor.h
  llvm/lib/Transforms/IPO/Attributor.cpp
  llvm/test/Transforms/FunctionAttrs/arg_nocapture.ll
  llvm/test/Transforms/FunctionAttrs/arg_returned.ll
  llvm/test/Transforms/FunctionAttrs/value-simplify.ll
  llvm/test/Transforms/FunctionAttrs/willreturn.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68934.224812.patch
Type: text/x-patch
Size: 49256 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191014/91ce33be/attachment.bin>


More information about the llvm-commits mailing list