1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/lib/Analysis
Daniel Neilson 6a302cca5a [SCEV] Properly handle the case of a non-constant start with a zero accum in ScalarEvolution::createAddRecFromPHIWithCastsImpl
Summary:
 This patch fixes an error in the patch to ScalarEvolution::createAddRecFromPHIWithCastsImpl
made in D37265. In that patch we handle the cases where the either the start or accum values can be
zero after truncation. But, we assume that the start value must be a constant if the accum is
zero. This is clearly an erroneous assumption. This change removes that assumption.

Reviewers: sanjoy, dorit, mkazantsev

Reviewed By: sanjoy

Subscribers: llvm-commits

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

llvm-svn: 315491
2017-10-11 19:05:14 +00:00
..
AliasAnalysis.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-08-11 21:30:02 +00:00
AliasAnalysisEvaluator.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
AliasAnalysisSummary.cpp
AliasAnalysisSummary.h
AliasSetTracker.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-07-24 23:16:33 +00:00
Analysis.cpp
AssumptionCache.cpp [Analysis, Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-09-01 21:37:29 +00:00
BasicAliasAnalysis.cpp Fix PR33878: BasicAA incorrectly assumes different address spaces don't alias 2017-09-06 16:55:31 +00:00
BlockFrequencyInfo.cpp Add options to dump PGO counts in text. 2017-09-13 17:20:38 +00:00
BlockFrequencyInfoImpl.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-07-21 21:37:46 +00:00
BranchProbabilityInfo.cpp Add options to dump block frequency/branch probability info in text. 2017-08-26 00:31:00 +00:00
CallGraph.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-07-24 23:16:33 +00:00
CallGraphSCCPass.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes. Also affected in files (NFC). 2017-08-31 21:56:16 +00:00
CallPrinter.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
CaptureTracking.cpp fix trivial typos; NFC 2017-07-09 05:54:44 +00:00
CFG.cpp
CFGPrinter.cpp
CFLAndersAliasAnalysis.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-08-11 21:30:02 +00:00
CFLGraph.h [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-08-11 21:30:02 +00:00
CFLSteensAliasAnalysis.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-08-11 21:30:02 +00:00
CGSCCPassManager.cpp Use a BumpPtrAllocator for Loop objects 2017-09-28 02:45:42 +00:00
CMakeLists.txt Rename OptimizationDiagnosticInfo.* to OptimizationRemarkEmitter.* 2017-10-09 23:19:02 +00:00
CmpInstAnalysis.cpp [InstCombine][InstSimplify] Teach decomposeBitTestICmp to look through truncate instructions 2017-09-01 21:27:34 +00:00
CodeMetrics.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ConstantFolding.cpp Revert "Fix typo [NFC]" 2017-10-01 00:09:53 +00:00
CostModel.cpp [TargetTransformInfo] Add a new public interface getInstructionCost 2017-09-08 22:29:17 +00:00
Delinearization.cpp
DemandedBits.cpp [DemandedBits] simplify call; NFC 2017-08-16 14:28:23 +00:00
DependenceAnalysis.cpp fix typos in comments and error messages; NFC 2017-07-10 12:44:25 +00:00
DivergenceAnalysis.cpp DivergencyAnalysis patch for review 2017-06-15 19:33:10 +00:00
DominanceFrontier.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-07-24 23:16:33 +00:00
DomPrinter.cpp
EHPersonalities.cpp [EH] Recognize __(gxx|gcc)_personality_seh0 as the GNU EH personalities 2017-05-31 22:35:52 +00:00
GlobalsModRef.cpp GlobalsModRef: Ensure optnone+readonly/readnone attributes are respected 2017-06-07 21:37:39 +00:00
IndirectCallPromotionAnalysis.cpp Make ICP uses PSI to check for hotness. 2017-08-08 20:57:33 +00:00
InlineCost.cpp [NFC] Convert OptimizationRemarkEmitter old emit() calls to new closure 2017-10-11 17:12:59 +00:00
InstCount.cpp [Analysis] RemoveTotalMemInst counting in InstCount to avoid reading back other Statistic variables 2017-07-18 02:41:12 +00:00
InstructionSimplify.cpp Rename OptimizationDiagnosticInfo.* to OptimizationRemarkEmitter.* 2017-10-09 23:19:02 +00:00
Interval.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-07-24 23:16:33 +00:00
IntervalPartition.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-07-24 23:16:33 +00:00
IteratedDominanceFrontier.cpp [Dominators] Make IsPostDominator a template parameter 2017-07-14 18:26:09 +00:00
IVUsers.cpp
LazyBlockFrequencyInfo.cpp
LazyBranchProbabilityInfo.cpp [BPI] Don't assume that strcmp returning >0 is more likely than <0 2017-06-08 09:44:40 +00:00
LazyCallGraph.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-08-11 21:30:02 +00:00
LazyValueInfo.cpp [LVI] Move LVILatticeVal class to separate header file (NFC). 2017-09-28 11:09:22 +00:00
Lint.cpp [Lint] Avoid failed assertion by fetching the proper pointer type 2017-10-03 06:03:49 +00:00
LLVMBuild.txt Update libdeps to add BinaryFormat, introduced in r304864. 2017-06-07 04:48:49 +00:00
Loads.cpp Merge isKnownNonNull into isKnownNonZero 2017-09-09 18:23:11 +00:00
LoopAccessAnalysis.cpp Rename OptimizationDiagnosticInfo.* to OptimizationRemarkEmitter.* 2017-10-09 23:19:02 +00:00
LoopAnalysisManager.cpp Do not call Loop::getName on possibly dead loops 2017-10-04 22:02:27 +00:00
LoopInfo.cpp Use a BumpPtrAllocator for Loop objects 2017-09-28 02:45:42 +00:00
LoopPass.cpp Use a BumpPtrAllocator for Loop objects 2017-09-28 02:45:42 +00:00
LoopUnrollAnalyzer.cpp
MemDepPrinter.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
MemDerefPrinter.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
MemoryBuiltins.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-08-16 22:07:40 +00:00
MemoryDependenceAnalysis.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-08-16 22:07:40 +00:00
MemoryLocation.cpp
MemorySSA.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-08-16 22:07:40 +00:00
MemorySSAUpdater.cpp MemorySSAUpdater: Only add phis to insertedphis if we actually inserted them, not if we just found existing ones 2017-09-27 05:35:19 +00:00
ModuleDebugInfoPrinter.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ModuleSummaryAnalysis.cpp [ThinLTO] AliasSummary should not have any references 2017-09-13 17:10:24 +00:00
ObjCARCAliasAnalysis.cpp
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
OptimizationRemarkEmitter.cpp Rename OptimizationDiagnosticInfo.* to OptimizationRemarkEmitter.* 2017-10-09 23:19:02 +00:00
OrderedBasicBlock.cpp [OrderedBasicBlock] Return false for comesBefore(A, A) 2017-06-02 13:10:31 +00:00
PHITransAddr.cpp PHITransAddr: Use new SimplifyQuery based API. 2017-04-26 20:56:13 +00:00
PostDominators.cpp [Dominators] Remove redundant explicit template instantiation. 2017-08-26 21:08:51 +00:00
ProfileSummaryInfo.cpp Move accurate-sample-profile into the function attribute. 2017-08-24 21:37:04 +00:00
PtrUseVisitor.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-08-18 23:51:26 +00:00
README.txt
RegionInfo.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-06-27 21:52:05 +00:00
RegionPass.cpp Normlize to LF line endings. 2017-08-25 12:38:53 +00:00
RegionPrinter.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ScalarEvolution.cpp [SCEV] Properly handle the case of a non-constant start with a zero accum in ScalarEvolution::createAddRecFromPHIWithCastsImpl 2017-10-11 19:05:14 +00:00
ScalarEvolutionAliasAnalysis.cpp
ScalarEvolutionExpander.cpp [SCEV] Teach SCEVExpander to expand BinPow 2017-06-19 06:24:53 +00:00
ScalarEvolutionNormalization.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ScopedNoAliasAA.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-08-18 23:51:26 +00:00
StratifiedSets.h
TargetLibraryInfo.cpp TargetLibraryInfo: Stop guessing wchar_t size 2017-09-26 02:36:57 +00:00
TargetTransformInfo.cpp Recommit : Use the basic cost if a GEP is not used as addressing mode 2017-10-04 18:33:52 +00:00
Trace.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-07-21 21:37:46 +00:00
TypeBasedAliasAnalysis.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-08-18 23:51:26 +00:00
TypeMetadataUtils.cpp
ValueLattice.cpp [LVI] Move LVILatticeVal class to separate header file (NFC). 2017-09-28 11:09:22 +00:00
ValueTracking.cpp [NFC] Convert OptimizationRemarkEmitter old emit() calls to new closure 2017-10-11 17:12:59 +00:00
VectorUtils.cpp [Constants] If we already have a ConstantInt*, prefer to use isZero/isOne/isMinusOne instead of isNullValue/isOneValue/isAllOnesValue inherited from Constant. NFCI 2017-07-06 18:39:47 +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))

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