llvm-project/llvm/test/Transforms/SCCP
Florian Hahn 01f999ae88 [SCCP] Switch to widen at PHIs, stores and call edges.
Currently SCCP does not widen PHIs, stores or along call edges
(arguments/return values), but on operations that directly extend ranges
(like binary operators).

This means PHIs, stores and call edges are not pessimized by widening
currently, while binary operators are. The main reason for widening
operators initially was that opting-out for certain operations was
more straight-forward in the initial implementation (and it did not
matter too much, as range support initially was only implemented for a
very limited set of operations.

During the discussion in D78391, it was suggested to consider flipping
widening to PHIs, stores and along call edges. After adding support for
tracking the number of range extensions in ValueLattice, limiting the
number of range extensions per value is straight forward.

This patch introduces a MaxWidenSteps option to the MergeOptions,
limiting the number of range extensions per value. For PHIs, it seems
natural allow an extension for each (active) incoming value plus 1. For
the other cases, a arbitrary limit of 10 has been chosen initially. It would
potentially make sense to set it depending on the users of a
function/global, but that still needs investigating. This potentially
leads to more state-changes and longer compile-times.

The results look quite promising (MultiSource, SPEC):

Same hash: 179 (filtered out)
Remaining: 58
Metric: sccp.IPNumInstRemoved

Program                                        base    widen-phi diff
 test-suite...ks/Prolangs-C/agrep/agrep.test    58.00   82.00    41.4%
 test-suite...marks/SciMark2-C/scimark2.test    32.00   43.00    34.4%
 test-suite...rks/FreeBench/mason/mason.test     6.00    8.00    33.3%
 test-suite...langs-C/football/football.test   104.00  128.00    23.1%
 test-suite...cations/hexxagon/hexxagon.test    36.00   42.00    16.7%
 test-suite...CFP2000/177.mesa/177.mesa.test   214.00  249.00    16.4%
 test-suite...ngs-C/assembler/assembler.test    14.00   16.00    14.3%
 test-suite...arks/VersaBench/dbms/dbms.test    10.00   11.00    10.0%
 test-suite...oxyApps-C++/miniFE/miniFE.test    43.00   47.00     9.3%
 test-suite...ications/JM/ldecod/ldecod.test   179.00  195.00     8.9%
 test-suite...CFP2006/433.milc/433.milc.test   249.00  265.00     6.4%
 test-suite.../CINT2000/175.vpr/175.vpr.test    98.00  104.00     6.1%
 test-suite...peg2/mpeg2dec/mpeg2decode.test    70.00   74.00     5.7%
 test-suite...CFP2000/188.ammp/188.ammp.test    71.00   75.00     5.6%
 test-suite...ce/Benchmarks/PAQ8p/paq8p.test   111.00  117.00     5.4%
 test-suite...ce/Applications/Burg/burg.test    41.00   43.00     4.9%
 test-suite...000/197.parser/197.parser.test    66.00   69.00     4.5%
 test-suite...tions/lambda-0.1.3/lambda.test    23.00   24.00     4.3%
 test-suite...urce/Applications/lua/lua.test   301.00  313.00     4.0%
 test-suite...TimberWolfMC/timberwolfmc.test    76.00   79.00     3.9%
 test-suite...lications/ClamAV/clamscan.test   991.00  1030.00    3.9%
 test-suite...plications/d/make_dparser.test    53.00   55.00     3.8%
 test-suite...fice-ispell/office-ispell.test    83.00   86.00     3.6%
 test-suite...lications/obsequi/Obsequi.test    28.00   29.00     3.6%
 test-suite.../Prolangs-C/bison/mybison.test    56.00   58.00     3.6%
 test-suite.../CINT2000/254.gap/254.gap.test   170.00  176.00     3.5%
 test-suite.../Applications/lemon/lemon.test    30.00   31.00     3.3%
 test-suite.../CINT2000/176.gcc/176.gcc.test   1202.00 1240.00    3.2%
 test-suite...pplications/treecc/treecc.test    79.00   81.00     2.5%
 test-suite...chmarks/MallocBench/gs/gs.test   357.00  366.00     2.5%
 test-suite...eeBench/analyzer/analyzer.test   103.00  105.00     1.9%
 test-suite...T2006/445.gobmk/445.gobmk.test   1697.00 1724.00    1.6%
 test-suite...006/453.povray/453.povray.test   1812.00 1839.00    1.5%
 test-suite.../Benchmarks/Bullet/bullet.test   337.00  342.00     1.5%
 test-suite.../CINT2000/252.eon/252.eon.test   426.00  432.00     1.4%
 test-suite...T2000/300.twolf/300.twolf.test   214.00  217.00     1.4%
 test-suite...pplications/oggenc/oggenc.test   244.00  247.00     1.2%
 test-suite.../CINT2006/403.gcc/403.gcc.test   4008.00 4055.00    1.2%
 test-suite...T2006/456.hmmer/456.hmmer.test   175.00  177.00     1.1%
 test-suite...nal/skidmarks10/skidmarks.test   430.00  434.00     0.9%
 test-suite.../Applications/sgefa/sgefa.test   115.00  116.00     0.9%
 test-suite...006/447.dealII/447.dealII.test   1082.00 1091.00    0.8%
 test-suite...6/482.sphinx3/482.sphinx3.test   141.00  142.00     0.7%
 test-suite...ocBench/espresso/espresso.test   152.00  153.00     0.7%
 test-suite...3.xalancbmk/483.xalancbmk.test   4003.00 4025.00    0.5%
 test-suite...lications/sqlite3/sqlite3.test   548.00  551.00     0.5%
 test-suite...marks/7zip/7zip-benchmark.test   5522.00 5551.00    0.5%
 test-suite...nsumer-lame/consumer-lame.test   208.00  209.00     0.5%
 test-suite...:: External/Povray/povray.test   1556.00 1563.00    0.4%
 test-suite...000/186.crafty/186.crafty.test   298.00  299.00     0.3%
 test-suite.../Applications/SPASS/SPASS.test   2019.00 2025.00    0.3%
 test-suite...ications/JM/lencod/lencod.test   8427.00 8449.00    0.3%
 test-suite...6/464.h264ref/464.h264ref.test   6797.00 6813.00    0.2%
 test-suite...6/471.omnetpp/471.omnetpp.test   431.00  430.00    -0.2%
 test-suite...006/450.soplex/450.soplex.test   446.00  447.00     0.2%
 test-suite...0.perlbench/400.perlbench.test   1729.00 1727.00   -0.1%
 test-suite...000/255.vortex/255.vortex.test   3815.00 3819.00    0.1%

Reviewers: efriedma, nikic, davide

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D79036
2020-05-29 11:59:17 +01:00
..
2002-05-02-MissSecondInst.ll
2002-05-20-MissedIncomingValue.ll
2002-05-21-InvalidSimplify.ll
2002-08-30-GetElementPtrTest.ll
2003-06-24-OverdefinedPHIValue.ll
2003-08-26-InvokeHandling.ll
2004-11-16-DeadInvoke.ll
2004-12-10-UndefBranchBug.ll
2006-10-23-IPSCCP-Crash.ll
2006-12-04-PackedType.ll
2006-12-19-UndefBug.ll Recommit "[SCCP] Remove forcedconstant, go to overdefined instead" 2020-02-15 18:36:44 +01:00
2007-05-16-InvokeCrash.ll
2008-01-27-UndefCorrelate.ll
2008-04-22-multiple-ret-sccp.ll
2008-05-23-UndefCallFold.ll
2009-01-14-IPSCCP-Invoke.ll
2009-05-27-VectorOperandZero.ll
apfloat-basictest.ll
apint-array.ll
apint-basictest.ll
apint-basictest2.ll
apint-basictest3.ll [NFC] Fix trivial typos in comments 2020-01-06 10:50:26 +00:00
apint-basictest4.ll
apint-bigarray.ll
apint-bigint.ll
apint-bigint2.ll [SCCP] Do not mark unknown loads as overdefined. 2020-02-20 22:48:58 +01:00
apint-ipsccp1.ll
apint-ipsccp2.ll
apint-ipsccp3.ll Recommit "[SCCP] Remove forcedconstant, go to overdefined instead" 2020-02-15 18:36:44 +01:00
apint-ipsccp4.ll
apint-load.ll
apint-phi.ll
apint-select.ll Recommit "[SCCP] Remove forcedconstant, go to overdefined instead" 2020-02-15 18:36:44 +01:00
apint-xor.ll [SCCP] Add a few more tests for conditional propagation,XOR. 2020-03-22 21:43:33 +00:00
atomic-load-store.ll
atomic.ll
binaryops-constexprs.ll [SCCP] Add test case for binary ops with constant expressions. 2020-04-09 13:38:43 +01:00
binaryops-range-special-cases.ll [SCCP] Use constant ranges for PHI nodes. 2020-03-19 12:45:33 +00:00
bitcast.ll
calltest.ll
comdat-ipo.ll
conditions-iter-order.ll [SCCP] Add a few more tests for conditional propagation,XOR. 2020-03-22 21:43:33 +00:00
conditions-ranges-with-undef.ll [SCCP] Use ranges for predicate info conditions. 2020-04-07 11:09:18 +01:00
conditions-ranges.ll Infer alignment of unmarked loads in IR/bitcode parsing. 2020-05-14 13:03:50 -07:00
constant-range-struct.ll [SCCP] Switch to widen at PHIs, stores and call edges. 2020-05-29 11:59:17 +01:00
constant-struct.ll
crash.ll
definite-initializer.ll
dont-zap-return.ll
float-nan-simplification.ll Recommit "[SCCP] Use SimplifyBinOp for non-integer constant/expressions & overdef." 2020-04-14 11:48:52 +01:00
float-phis.ll [ValueLattice] Add new state for undef constants. 2020-03-14 17:19:59 +00:00
global-alias-constprop.ll
indirectbr.ll [IPSCCP] Move callsite check to the beginning of the loop. 2019-07-31 12:57:04 +00:00
int-phis.ll [ValueLattice] Add new state for undef constants. 2020-03-14 17:19:59 +00:00
ip-constant-ranges.ll [SCCP] Use ranges for predicate info conditions. 2020-04-07 11:09:18 +01:00
ip-ranges-binaryops.ll [SCCP] Use constant ranges for binary operators. 2020-03-19 09:35:48 +00:00
ip-ranges-casts.ll [SCCP] Limit use of range info for binops to integers for now. 2020-03-31 17:08:09 +01:00
ip-ranges-phis.ll [SCCP] Use constant ranges for PHI nodes. 2020-03-19 12:45:33 +00:00
ip-ranges-select.ll [SCCP] Use constant ranges for select, if cond is overdefined. 2020-03-18 09:26:02 +00:00
ipsccp-addr-taken.ll
ipsccp-basic.ll Recommit "[SCCP] Remove forcedconstant, go to overdefined instead" 2020-02-15 18:36:44 +01:00
ipsccp-branch-unresolved-undef.ll
ipsccp-cycles.ll [SCCP] Switch to widen at PHIs, stores and call edges. 2020-05-29 11:59:17 +01:00
ipsccp-phi-one-pred-dead.ll
ipsccp-predinfo-order.ll [PredicateInfo] Replace pointer comparisons with deterministic compares. 2019-07-25 20:48:13 +00:00
ipsccp-preserve-analysis.ll
ipsccp-range-crashes.ll [SCCP] Precommit some additional tests for integer ranges. 2020-03-18 11:34:04 +00:00
ipsccp-ssa-copy-nested-conds.ll [SCCP] Add tests with AND/OR branch conditions. 2020-04-09 16:39:13 +01:00
latticeval-invalidate.ll
load-store-range.ll [SCCP] Support ranges for loads and stores. 2020-04-26 13:16:47 +01:00
loadtest.ll [SCCP] Do not mark unknown loads as overdefined. 2020-02-20 22:48:58 +01:00
loadtest2.ll [SCCP] Do not mark unknown loads as overdefined. 2020-02-20 22:48:58 +01:00
logical-nuke.ll Recommit "[SCCP] Remove forcedconstant, go to overdefined instead" 2020-02-15 18:36:44 +01:00
overdefined-div.ll
phi-cycle.ll [ValueLattice] Distinguish between constant ranges with/without undef. 2020-03-31 12:50:20 +01:00
phis.ll [SCCP] Use constant ranges for PHI nodes. 2020-03-19 12:45:33 +00:00
pr27712.ll
pr35357.ll
pr45185-range-predinfo.ll Recommit "[SCCP] Use ValueLatticeElement instead of LatticeVal (NFCI)" 2020-03-13 17:03:22 +00:00
preserve-analysis.ll [BPI][NFC] Reuse post dominantor tree from analysis manager when available 2020-04-30 11:31:03 +07:00
range-and-ip.ll [ValueLattice] Distinguish between constant ranges with/without undef. 2020-03-31 12:50:20 +01:00
range-and.ll [ValueLattice] Distinguish between constant ranges with/without undef. 2020-03-31 12:50:20 +01:00
resolvedundefsin-tracked-fn.ll [SCCP] Switch to widen at PHIs, stores and call edges. 2020-05-29 11:59:17 +01:00
return-zapped.ll
retvalue-undef.ll
sccptest.ll
select.ll [SCCP] Use constant ranges for select, if cond is overdefined. 2020-03-18 09:26:02 +00:00
struct-arg-resolve-undefs.ll [IPSCCP] Move callsite check to the beginning of the loop. 2019-07-31 12:57:04 +00:00
switch-constantfold-crash.ll
switch-multiple-undef.ll Recommit "[SCCP] Remove forcedconstant, go to overdefined instead" 2020-02-15 18:36:44 +01:00
switch-undef-constantfoldterminator.ll
switch.ll
ub-shift.ll Recommit "[SCCP] Use SimplifyBinOp for non-integer constant/expressions & overdef." 2020-04-14 11:48:52 +01:00
ubsan_overflow.ll [SCCP] Update condition to avoid overflow. 2019-07-31 18:22:22 +00:00
undef-resolve.ll Recommit "[SCCP] Remove forcedconstant, go to overdefined instead" 2020-02-15 18:36:44 +01:00
vector-bitcast.ll Recommit "[SCCP] Use SimplifyBinOp for non-integer constant/expressions & overdef." 2020-04-14 11:48:52 +01:00
widening.ll [SCCP] Switch to widen at PHIs, stores and call edges. 2020-05-29 11:59:17 +01:00