llvm-project/llvm/lib/Transforms/Scalar
Florian Hahn 6aabb109be [SCCP] Use ranges for predicate info conditions.
This patch updates the code that deals with conditions from predicate
info to make use of constant ranges.

For ssa_copy instructions inserted by PredicateInfo, we have 2 ranges:
1. The range of the original value.
2. The range imposed by the linked condition.

1. is known, 2. can be determined using makeAllowedICmpRegion. The
intersection of those ranges is the range for the copy.

With this patch, we get a nice increase in the number of instructions
eliminated by both SCCP and IPSCCP for some benchmarks:

For MultiSource, SPEC2000 & SPEC2006:

Tests: 237
Same hash: 170 (filtered out)
Remaining: 67
Metric: sccp.NumInstRemoved
Program                                        base    patch   diff
 test-suite...Source/Benchmarks/sim/sim.test    10.00   71.00  610.0%
 test-suite...CFP2000/177.mesa/177.mesa.test   361.00  1626.00 350.4%
 test-suite...encode/alacconvert-encode.test   141.00  602.00  327.0%
 test-suite...decode/alacconvert-decode.test   141.00  602.00  327.0%
 test-suite...CI_Purple/SMG2000/smg2000.test   1639.00 4093.00 149.7%
 test-suite...peg2/mpeg2dec/mpeg2decode.test    75.00  163.00  117.3%
 test-suite...T2006/401.bzip2/401.bzip2.test   358.00  513.00  43.3%
 test-suite...rks/FreeBench/pifft/pifft.test    11.00   15.00  36.4%
 test-suite...langs-C/unix-tbl/unix-tbl.test     4.00    5.00  25.0%
 test-suite...lications/sqlite3/sqlite3.test   541.00  667.00  23.3%
 test-suite.../CINT2000/254.gap/254.gap.test   243.00  299.00  23.0%
 test-suite...ks/Prolangs-C/agrep/agrep.test    25.00   29.00  16.0%
 test-suite...marks/7zip/7zip-benchmark.test   1135.00 1304.00 14.9%
 test-suite...lications/ClamAV/clamscan.test   1105.00 1268.00 14.8%
 test-suite...urce/Applications/lua/lua.test   398.00  436.00   9.5%

Metric: sccp.IPNumInstRemoved
Program                                        base   patch   diff
 test-suite...C/CFP2000/179.art/179.art.test     1.00   3.00  200.0%
 test-suite...006/447.dealII/447.dealII.test   429.00 1056.00 146.2%
 test-suite...nch/fourinarow/fourinarow.test     3.00   7.00  133.3%
 test-suite...CI_Purple/SMG2000/smg2000.test   818.00 1748.00 113.7%
 test-suite...ks/McCat/04-bisect/bisect.test     3.00   5.00  66.7%
 test-suite...CFP2000/177.mesa/177.mesa.test   165.00 255.00  54.5%
 test-suite...ediabench/gsm/toast/toast.test    18.00  27.00  50.0%
 test-suite...telecomm-gsm/telecomm-gsm.test    18.00  27.00  50.0%
 test-suite...ks/Prolangs-C/agrep/agrep.test    24.00  35.00  45.8%
 test-suite...TimberWolfMC/timberwolfmc.test    43.00  62.00  44.2%
 test-suite...encode/alacconvert-encode.test    46.00  66.00  43.5%
 test-suite...decode/alacconvert-decode.test    46.00  66.00  43.5%
 test-suite...langs-C/unix-tbl/unix-tbl.test    12.00  17.00  41.7%
 test-suite...peg2/mpeg2dec/mpeg2decode.test    31.00  41.00  32.3%
 test-suite.../CINT2000/254.gap/254.gap.test   117.00 154.00  31.6%

Reviewers: efriedma, davide

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D76611
2020-04-07 11:09:18 +01:00
..
ADCE.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
AlignmentFromAssumptions.cpp [Alignment][NFC] Assume AlignmentFromAssumptions::getNewAlignment is always set. 2020-04-06 14:54:57 +00:00
BDCE.cpp Clang-trunk Generates Wrong Debug values with -O1 2019-11-21 13:53:10 -08:00
CMakeLists.txt [Matrix] Add first set of matrix intrinsics and initial lowering pass. 2019-12-12 15:42:18 +00:00
CallSiteSplitting.cpp [CallSiteSplitting] Simplify isPredicateOnPHI & continue checking PHIs. 2020-04-02 10:11:27 +01:00
ConstantHoisting.cpp Allow replacing intrinsic operands with variables 2020-03-23 15:51:57 -04:00
ConstantProp.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
CorrelatedValuePropagation.cpp [ValueLattice] Distinguish between constant ranges with/without undef. 2020-03-31 12:50:20 +01:00
DCE.cpp [BasicBlockUtils] Add utility to remove redundant dbg.value instrs 2019-12-16 11:41:21 +01:00
DeadStoreElimination.cpp [DebugInfo] Ensure dead store elimination can mark an operand 2020-03-30 14:58:14 +01:00
DivRemPairs.cpp [DivRemPairs] Freeze operands if they can be undef values 2020-03-25 03:46:14 +09:00
EarlyCSE.cpp [NFC] Split Knowledge retention and place it more appropriatly 2020-04-02 15:01:41 +02:00
FlattenCFGPass.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
Float2Int.cpp [APFloat] Make use of new overloaded comparison operators. NFC. 2020-03-06 16:42:53 +00:00
GVN.cpp [NFC] Modernize misc. uses of Align/MaybeAlign APIs. 2020-04-06 17:53:04 -07:00
GVNHoist.cpp [MemorySSA] Moving at the end often means before terminator. 2019-11-20 17:11:00 -08:00
GVNSink.cpp [GVNSink] Simplify code. NFC. 2020-04-01 13:13:00 +02:00
GuardWidening.cpp Broaden the definition of a "widenable branch" 2019-11-21 10:46:16 -08:00
IVUsersPrinter.cpp
IndVarSimplify.cpp [IndVarSimplify] Extend previous special case for load use instruction to any narrow type loop variant to avoid extra trunc instruction 2020-03-05 16:27:59 -05:00
InductiveRangeCheckElimination.cpp [IRCE] Use SCEVExpander to modify loop bound 2020-02-06 12:44:43 +03:00
InferAddressSpaces.cpp Resubmit "[Alignment][NFC] Deprecate CreateMemCpy/CreateMemMove" 2019-12-17 10:07:46 +01:00
InstSimplifyPass.cpp [Utils] Use WeakTrackingVH in vector used as scratch storage. 2020-01-23 16:04:57 -08:00
JumpThreading.cpp [NFC] Modernize misc. uses of Align/MaybeAlign APIs. 2020-04-06 17:53:04 -07:00
LICM.cpp [NFC] Modernize misc. uses of Align/MaybeAlign APIs. 2020-04-06 17:53:04 -07:00
LLVMBuild.txt
LoopAccessAnalysisPrinter.cpp
LoopDataPrefetch.cpp [LoopDataPrefetch] Remove unused include that's a layering violation 2020-04-02 17:46:10 +02:00
LoopDeletion.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
LoopDistribute.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopFuse.cpp [LoopFusion] Move instructions from FC1.GuardBlock to FC0.GuardBlock and 2020-01-30 18:02:22 +00:00
LoopIdiomRecognize.cpp Compute ORE, BPI, BFI in Loop passes. 2020-02-12 09:15:18 -08:00
LoopInstSimplify.cpp [Utils] Use WeakTrackingVH in vector used as scratch storage. 2020-01-23 16:04:57 -08:00
LoopInterchange.cpp [LoopInterchange] Fix interchanging contents of preheader BBs 2020-03-13 15:59:37 -04:00
LoopLoadElimination.cpp [NFC] Modernize misc. uses of Align/MaybeAlign APIs. 2020-04-06 17:53:04 -07:00
LoopPassManager.cpp Extend TimeTrace to LLVM's new pass manager 2020-03-06 14:45:19 -08:00
LoopPredication.cpp Compute ORE, BPI, BFI in Loop passes. 2020-02-12 09:15:18 -08:00
LoopRerollPass.cpp Revert "[SCEV] Move ScalarEvolutionExpander.cpp to Transforms/Utils (NFC)." 2020-01-04 18:44:38 +00:00
LoopRotation.cpp [LoopRotate] Get and update MSSA only if available in legacy pass manager. 2020-02-14 10:47:26 -08:00
LoopSimplifyCFG.cpp [IVDescriptors] Remove IRBuilder.h include; NFC 2020-04-04 12:07:57 +02:00
LoopSink.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopStrengthReduce.cpp [LSR] Add masked load and store handling 2020-03-04 18:36:10 +00:00
LoopUnrollAndJamPass.cpp [NFC][LoopUnrollAndJam] clang-format. 2020-03-14 00:04:10 +00:00
LoopUnrollPass.cpp [Loop Peeling] Add possibility to enable peeling on loop nests. 2020-03-02 08:37:11 -08:00
LoopUnswitch.cpp [Loop Peeling] Add possibility to enable peeling on loop nests. 2020-03-02 08:37:11 -08:00
LoopVersioningLICM.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LowerAtomic.cpp [Transforms] Simplify with make_early_inc_range 2020-02-02 00:54:32 -08:00
LowerConstantIntrinsics.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LowerExpectIntrinsic.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LowerGuardIntrinsic.cpp Move widenable branch formation into makeGuardControlFlowExplicit helper 2019-11-20 12:54:05 -08:00
LowerMatrixIntrinsics.cpp [NFC] Modernize misc. uses of Align/MaybeAlign APIs. 2020-04-06 17:53:04 -07:00
LowerWidenableCondition.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
MakeGuardsExplicit.cpp D'oh. Fix assert after a84922916e. 2019-11-20 22:22:51 -05:00
MemCpyOptimizer.cpp [Transform][MemCpyOpt] Add missing DebugLoc to %tmpbitcast 2020-02-28 15:20:51 +00:00
MergeICmps.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
MergedLoadStoreMotion.cpp [Transforms] Simplify with make_early_inc_range 2020-02-02 00:54:32 -08:00
NaryReassociate.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
NewGVN.cpp [CFGPrinter][CallPrinter][polly] Adding distinct structure for CFGDOTInfo 2020-04-06 17:42:54 +00:00
PartiallyInlineLibCalls.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
PlaceSafepoints.cpp [NFC] Refactor InlineResult for readability 2020-01-15 13:34:20 -08:00
Reassociate.cpp [Reassociate] Use IRBuilderBase; NFC 2020-04-04 12:34:16 +02:00
Reg2Mem.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
RewriteStatepointsForGC.cpp Remove "mask" operand from shufflevector. 2020-03-31 13:08:59 -07:00
SCCP.cpp [SCCP] Use ranges for predicate info conditions. 2020-04-07 11:09:18 +01:00
SROA.cpp [NFC] Modernize misc. uses of Align/MaybeAlign APIs. 2020-04-06 17:53:04 -07:00
Scalar.cpp [BasicBlockUtils] Add utility to remove redundant dbg.value instrs 2019-12-16 11:41:21 +01:00
Scalarizer.cpp [Alignment][NFC] Use Align with CreateAlignedStore 2020-01-23 17:34:32 +01:00
SeparateConstOffsetFromGEP.cpp Fix PR45371: SeparateConstOffsetFromGEP clean up bookkeeping 2020-04-01 12:38:15 -06:00
SimpleLoopUnswitch.cpp [IVDescriptors] Remove IRBuilder.h include; NFC 2020-04-04 12:07:57 +02:00
SimplifyCFGPass.cpp [SimplifyCFG] Skip merging return blocks if it would break a CallBr. 2020-03-10 14:59:13 +01:00
Sink.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
SpeculateAroundPHIs.cpp Rename TTI::getIntImmCost for instructions and intrinsics 2019-12-11 18:00:20 -08:00
SpeculativeExecution.cpp SpeculativeExecution: fixed ingoring free execution 2020-02-20 14:45:02 +03:00
StraightLineStrengthReduce.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
StructurizeCFG.cpp Introduce unify-loop-exits pass. 2020-03-30 13:23:56 -04:00
TailRecursionElimination.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
WarnMissedTransforms.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00