Page MenuHomePhabricator

[Attributor] Make value simplify stronger
Needs ReviewPublic

Authored by jdoerfert on Oct 13 2019, 11:42 PM.


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

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, D68850, D68819