1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00
llvm-mirror/lib/Analysis
Tim Northover 0fd791723d InstructionSimplify: don't speculate about Constants changing.
When presented with an icmp/select pair, we can end up asking what would happen
if we replaced one constant with another in an instruction. This is a mistake,
while non-constant Values could become a constant, constants cannot change and
trying to do so can lead to completely invalid IR (a GEP referencing a
non-existant field in the original case).

llvm-svn: 303580
2017-05-22 21:28:08 +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
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 BasicAA: Uninserted instructions have no parent, and notDifferentParent explicitly allows for this case, but getParent crashes when handed one. 2017-05-19 19:01:21 +00:00
BlockFrequencyInfo.cpp
BlockFrequencyInfoImpl.cpp
BranchProbabilityInfo.cpp [BPI] Reduce the probability of unreachable edge to minimal value greater than 0 2017-05-18 06:11:56 +00:00
CallGraph.cpp CallGraph: Remove almost-unused field 'Root'. 2017-05-11 23:59:05 +00:00
CallGraphSCCPass.cpp [Statistics] Add a method to atomically update a statistic that contains a maximum 2017-05-18 00:51:39 +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 BitVector: add iterators for set bits 2017-05-17 01:07:53 +00:00
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 [Inliner] Do not mix callsite and callee hotness based updates. 2017-05-16 21:18:09 +00:00
InstCount.cpp
InstructionSimplify.cpp InstructionSimplify: don't speculate about Constants changing. 2017-05-22 21:28:08 +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
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
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
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 [IR] De-virtualize ~Value to save a vptr 2017-05-18 17:24:10 +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 IR: Give function GlobalValue::getRealLinkageName() a less misleading name: dropLLVMManglingEscape(). 2017-05-16 00:39:01 +00:00
OrderedBasicBlock.cpp
PHITransAddr.cpp PHITransAddr: Use new SimplifyQuery based API. 2017-04-26 20:56:13 +00:00
PostDominators.cpp
ProfileSummaryInfo.cpp Add hasProfileSummary and has{Sample|Instrumentation}Profile methods 2017-05-16 20:14:39 +00:00
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp
RegionPrinter.cpp
ScalarEvolution.cpp [SCEV] Clarify behavior around max backedge taken count 2017-05-22 06:46:04 +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 Revert "Add pthread_self function prototype and make it speculatable." 2017-05-21 00:37:55 +00:00
TargetTransformInfo.cpp [SLP] Enable 64-bit wide vectorization on AArch64 2017-05-15 21:15:01 +00:00
Trace.cpp
TypeBasedAliasAnalysis.cpp
TypeMetadataUtils.cpp
ValueTracking.cpp SimplifyLibCalls: Optimize wcslen 2017-05-19 22:37:09 +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))

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