[SCCP] Remove forcedconstant, go to overdefined instead
authorFlorian Hahn <flo@fhahn.com>
Tue, 11 Feb 2020 15:06:59 +0000 (15:06 +0000)
committerFlorian Hahn <flo@fhahn.com>
Tue, 11 Feb 2020 15:24:15 +0000 (15:24 +0000)
commitaadb635e04854220064b77cc10d0e6772f5492fd
tree9cfdf8eecccabec5b39c183066b6c3d4ff114463
parent6b0ed508fa3947ec1f3a1bd87a08b598e98423e3
[SCCP] Remove forcedconstant, go to overdefined instead

This patch removes forcedconstant to simplify things for the
move to ValueLattice, which includes constant ranges, but no
forced constants.

This patch removes forcedconstant and changes ResolvedUndefsIn
to mark instructions with unknown operands as overdefined. This
means we do not do simplifications based on undef directly in SCCP
any longer, but this seems to hardly come up in practice (see stats
below), presumably because InstCombine & others take care
of most of the relevant folds already.

It is still beneficial to keep ResolvedUndefIn, as it allows us delaying
going to overdefined until we propagated all known information.

I also built MultiSource, SPEC2000 and SPEC2006 and compared
sccp.IPNumInstRemoved and sccp.NumInstRemoved. It looks like the impact
is quite low:

Tests: 244
Same hash: 238 (filtered out)
Remaining: 6
Metric: sccp.IPNumInstRemoved

Program                                        base     patch    diff
 test-suite...arks/VersaBench/dbms/dbms.test     4.00    3.00  -25.0%
 test-suite...TimberWolfMC/timberwolfmc.test    38.00   34.00  -10.5%
 test-suite...006/453.povray/453.povray.test   158.00  155.00  -1.9%
 test-suite.../CINT2000/176.gcc/176.gcc.test   668.00  668.00   0.0%
 test-suite.../CINT2006/403.gcc/403.gcc.test   1209.00 1209.00  0.0%
 test-suite...arks/mafft/pairlocalalign.test    76.00   76.00   0.0%

Tests: 244
Same hash: 238 (filtered out)
Remaining: 6
Metric: sccp.NumInstRemoved

Program                                        base    patch     diff
 test-suite...arks/mafft/pairlocalalign.test   185.00  175.00  -5.4%
 test-suite.../CINT2006/403.gcc/403.gcc.test   2059.00 2056.00 -0.1%
 test-suite.../CINT2000/176.gcc/176.gcc.test   2358.00 2357.00 -0.0%
 test-suite...006/453.povray/453.povray.test   317.00  317.00   0.0%
 test-suite...TimberWolfMC/timberwolfmc.test    12.00   12.00   0.0%

Reviewers: davide, efriedma, mssimpso

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D61314
13 files changed:
llvm/lib/Transforms/Scalar/SCCP.cpp
llvm/test/Transforms/IPConstantProp/PR16052.ll
llvm/test/Transforms/IPConstantProp/PR26044.ll
llvm/test/Transforms/SCCP/2006-12-19-UndefBug.ll
llvm/test/Transforms/SCCP/apint-bigint2.ll
llvm/test/Transforms/SCCP/apint-ipsccp3.ll
llvm/test/Transforms/SCCP/apint-select.ll
llvm/test/Transforms/SCCP/ip-constant-ranges.ll
llvm/test/Transforms/SCCP/ipsccp-basic.ll
llvm/test/Transforms/SCCP/logical-nuke.ll
llvm/test/Transforms/SCCP/switch-multiple-undef.ll
llvm/test/Transforms/SCCP/ub-shift.ll
llvm/test/Transforms/SCCP/undef-resolve.ll