llvm/lib/Analysis
Craig Topper 32a237d8c0 [ValueTracking] Replace all uses of ComputeSignBit with computeKnownBits.
This patch finishes off the conversion of ComputeSignBit to computeKnownBits.

Differential Revision: https://reviews.llvm.org/D33166

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303035 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-15 06:39:41 +00:00
..
AliasAnalysis.cpp [IR] Make paramHasAttr to use arg indices instead of attr indices 2017-04-14 20:19:02 +00:00
AliasAnalysisEvaluator.cpp
AliasAnalysisSummary.cpp
AliasAnalysisSummary.h
AliasSetTracker.cpp Use a WeakVH for UnknownInstructions in AliasSetTracker 2017-03-11 01:15:48 +00:00
Analysis.cpp MemorySSA: Move to Analysis, from Transforms/Utils. It's used as 2017-04-11 20:06:36 +00:00
AssumptionCache.cpp Rename WeakVH to WeakTrackingVH; NFC 2017-05-01 17:07:49 +00:00
BasicAliasAnalysis.cpp [ValueTracking] Replace all uses of ComputeSignBit with computeKnownBits. 2017-05-15 06:39:41 +00:00
BlockFrequencyInfo.cpp
BlockFrequencyInfoImpl.cpp
BranchProbabilityInfo.cpp [BPI] Ignore remainder while distributing the remaining probability from unreachanble 2017-05-12 07:50:06 +00:00
CallGraph.cpp CallGraph: Remove almost-unused field 'Root'. 2017-05-11 23:59:05 +00:00
CallGraphSCCPass.cpp Rename WeakVH to WeakTrackingVH; NFC 2017-05-01 17:07:49 +00:00
CallPrinter.cpp
CaptureTracking.cpp
CFG.cpp
CFGPrinter.cpp
CFLAndersAliasAnalysis.cpp
CFLGraph.h [IR] Abstract away ArgNo+1 attribute indexing as much as possible 2017-05-03 18:17:31 +00:00
CFLSteensAliasAnalysis.cpp
CGSCCPassManager.cpp
CMakeLists.txt MemorySSA: Move to Analysis, from Transforms/Utils. It's used as 2017-04-11 20:06:36 +00:00
CodeMetrics.cpp
ConstantFolding.cpp [ConstantFolding] Add folding for various math '__<func>_finite' routines generated from -ffast-math 2017-05-12 22:11:20 +00:00
CostModel.cpp [SystemZ] TargetTransformInfo cost functions implemented. 2017-04-12 11:49:08 +00:00
Delinearization.cpp
DemandedBits.cpp [ValueTracking] Remove const_casts on several calls to computeKnownBits and ComputeSignBit. NFC 2017-05-13 17:22:16 +00:00
DependenceAnalysis.cpp
DivergenceAnalysis.cpp
DominanceFrontier.cpp
DomPrinter.cpp [DomPrinter] Add a way to programmatically dump a dot representation. 2017-04-24 17:48:44 +00:00
EHPersonalities.cpp
GlobalsModRef.cpp
IndirectCallPromotionAnalysis.cpp
InlineCost.cpp Decrease inlinecold-threshold to 45 2017-05-11 21:36:28 +00:00
InstCount.cpp
InstructionSimplify.cpp [ValueTracking] Replace all uses of ComputeSignBit with computeKnownBits. 2017-05-15 06:39:41 +00:00
Interval.cpp
IntervalPartition.cpp
IteratedDominanceFrontier.cpp
IVUsers.cpp [IVUsers] Don't bail out of normalizing non-affine add recs 2017-04-25 06:53:25 +00:00
LazyBlockFrequencyInfo.cpp
LazyBranchProbabilityInfo.cpp
LazyCallGraph.cpp [LCG] Fix EXPENSIVE_CHECKS typo. NFC 2017-02-28 18:34:55 +00:00
LazyValueInfo.cpp [LazyValueInfo] Avoid unnecessary copies of ConstantRanges 2017-05-06 03:35:15 +00:00
Lint.cpp [KnownBits] Add wrapper methods for setting and clear all bits in the underlying APInts in KnownBits. 2017-05-05 17:36:09 +00:00
LLVMBuild.txt
Loads.cpp Extract FindAvailablePtrLoadStore out of FindAvailableLoadedValue. NFCI 2017-03-19 15:27:52 +00:00
LoopAccessAnalysis.cpp [LAA] Correctly return a half-open range in expandBounds 2017-04-05 09:24:26 +00:00
LoopAnalysisManager.cpp
LoopInfo.cpp
LoopPass.cpp Implement getPassName() for IR printing passes. 2017-03-10 07:09:20 +00:00
LoopUnrollAnalyzer.cpp
MemDepPrinter.cpp
MemDerefPrinter.cpp
MemoryBuiltins.cpp [MemoryBuiltins] Add isMallocOrCallocLikeFn so BasicAA can check for both at the same time 2017-04-18 21:43:46 +00:00
MemoryDependenceAnalysis.cpp
MemoryLocation.cpp
MemorySSA.cpp MemorySSA: Stop tracking def-or-use blocks. 2017-04-16 19:45:51 +00:00
MemorySSAUpdater.cpp [MSSA] Clean up the updater a bit. NFC 2017-04-21 04:54:52 +00:00
ModuleDebugInfoPrinter.cpp
ModuleSummaryAnalysis.cpp Ensure non-null ProfileSummaryInfo passed to ModuleSummaryIndex builder 2017-05-10 18:52:16 +00:00
ObjCARCAliasAnalysis.cpp
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp
OptimizationDiagnosticInfo.cpp [ORE] Remove ORE.emit{{.+}} functions 2017-02-23 21:32:53 +00:00
OrderedBasicBlock.cpp
PHITransAddr.cpp PHITransAddr: Use new SimplifyQuery based API. 2017-04-26 20:56:13 +00:00
PostDominators.cpp
ProfileSummaryInfo.cpp Restrict call metadata based hotness detection to Sample PGO mode 2017-05-11 23:18:05 +00:00
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp Implement getPassName() for IR printing passes. 2017-03-10 07:09:20 +00:00
RegionPrinter.cpp
ScalarEvolution.cpp [ValueTracking] Replace all uses of ComputeSignBit with computeKnownBits. 2017-05-15 06:39:41 +00:00
ScalarEvolutionAliasAnalysis.cpp
ScalarEvolutionExpander.cpp Rename WeakVH to WeakTrackingVH; NFC 2017-05-01 17:07:49 +00:00
ScalarEvolutionNormalization.cpp Teach SCEV normalization to de/normalize non-affine add recs 2017-04-25 00:09:19 +00:00
ScopedNoAliasAA.cpp
SparsePropagation.cpp [IR] Redesign the case iterator in SwitchInst to actually be an iterator 2017-04-12 07:27:28 +00:00
StratifiedSets.h
TargetLibraryInfo.cpp [TLI] Add mapping for various '__<func>_finite' forms of the math routines to SVML routines 2017-05-12 22:11:26 +00:00
TargetTransformInfo.cpp Add a late IR expansion pass for the experimental reduction intrinsics. 2017-05-10 09:42:49 +00:00
Trace.cpp
TypeBasedAliasAnalysis.cpp
TypeMetadataUtils.cpp
ValueTracking.cpp [ValueTracking] Replace all uses of ComputeSignBit with computeKnownBits. 2017-05-15 06:39:41 +00:00
VectorUtils.cpp Introduce experimental generic intrinsics for horizontal vector reductions. 2017-05-09 10:43:25 +00:00

Analysis Opportunities:

//===---------------------------------------------------------------------===//

In test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll, the
ScalarEvolution expression for %r is this:

  {1,+,3,+,2}<loop>

Outside the loop, this could be evaluated simply as (%n * %n), however
ScalarEvolution currently evaluates it as

  (-2 + (2 * (trunc i65 (((zext i64 (-2 + %n) to i65) * (zext i64 (-1 + %n) to i65)) /u 2) to i64)) + (3 * %n))

In addition to being much more complicated, it involves i65 arithmetic,
which is very inefficient when expanded into code.

//===---------------------------------------------------------------------===//

In formatValue in test/CodeGen/X86/lsr-delayed-fold.ll,

ScalarEvolution is forming this expression:

((trunc i64 (-1 * %arg5) to i32) + (trunc i64 %arg5 to i32) + (-1 * (trunc i64 undef to i32)))

This could be folded to

(-1 * (trunc i64 undef to i32))

//===---------------------------------------------------------------------===//