1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/lib/Analysis
Daniil Fukalov fd35b81460 [SCEV] limit recursion depth and operands number in getAddExpr
for a quite big function with source like

%add = add nsw i32 %mul, %conv
%mul1 = mul nsw i32 %add, %conv
%add2 = add nsw i32 %mul1, %add
%mul3 = mul nsw i32 %add2, %add
; repeat couple of thousands times
that can be produced by loop unroll, getAddExpr() tries to recursively construct SCEV and runs almost infinite time.

Added recursion depth restriction (with new parameter to set it)

Reviewers: sanjoy

Subscribers: hfinkel, llvm-commits, mzolotukhin

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

llvm-svn: 294181
2017-02-06 12:38:06 +00:00
..
AliasAnalysis.cpp [AliasAnalysis] Fences do not modify constant memory location 2017-01-20 00:21:33 +00:00
AliasAnalysisEvaluator.cpp
AliasAnalysisSummary.cpp
AliasAnalysisSummary.h
AliasSetTracker.cpp [AliasSetTracker] Make AST smarter about assume intrinsics that don't actually affect memory. 2016-11-07 14:11:45 +00:00
Analysis.cpp [LCSSA] Perform LCSSA verification only for the current loop nest. 2016-10-28 12:57:20 +00:00
AssumptionCache.cpp [ValueTracking] recognize a 'not' of an assumed condition as false 2017-01-17 18:15:49 +00:00
BasicAliasAnalysis.cpp Fix BasicAA incorrect assumption on GEP 2017-01-27 16:12:22 +00:00
BlockFrequencyInfo.cpp [PGO] internal option cleanups 2017-02-02 21:29:17 +00:00
BlockFrequencyInfoImpl.cpp Cleanup dump() functions. 2017-01-28 02:02:38 +00:00
BranchProbabilityInfo.cpp Retry: [BPI] Use a safer constructor to calculate branch probabilities 2016-12-17 01:02:08 +00:00
CallGraph.cpp Cleanup dump() functions. 2017-01-28 02:02:38 +00:00
CallGraphSCCPass.cpp Improve the -filter-print-funcs option to skip the banner for CGSCC pass when nothing is to be printed 2017-01-18 21:37:11 +00:00
CallPrinter.cpp
CaptureTracking.cpp
CFG.cpp
CFGPrinter.cpp
CFLAndersAliasAnalysis.cpp Apply clang-tidy's performance-unnecessary-value-param to LLVM. 2017-01-13 14:39:03 +00:00
CFLGraph.h
CFLSteensAliasAnalysis.cpp [PM] Change the static object whose address is used to uniquely identify 2016-11-23 17:53:26 +00:00
CGSCCPassManager.cpp Rewind instantiations of OuterAnalysisManagerProxy in r289317, r291651, and r291662. 2017-01-25 04:26:29 +00:00
CMakeLists.txt [PM] Separate the LoopAnalysisManager from the LoopPassManager and move 2017-01-11 09:43:56 +00:00
CodeMetrics.cpp Revert @llvm.assume with operator bundles (r289755-r289757) 2016-12-19 08:22:17 +00:00
ConstantFolding.cpp [Analysis] Add LibFunc_ prefix to enums in TargetLibraryInfo. (NFC) 2017-01-23 23:16:46 +00:00
CostModel.cpp [X86] updating TTI costs for arithmetic instructions on X86\SLM arch. 2017-01-11 08:23:37 +00:00
Delinearization.cpp
DemandedBits.cpp Revert @llvm.assume with operator bundles (r289755-r289757) 2016-12-19 08:22:17 +00:00
DependenceAnalysis.cpp Cleanup dump() functions. 2017-01-28 02:02:38 +00:00
DivergenceAnalysis.cpp
DominanceFrontier.cpp [PM] Introduce an analysis set used to preserve all analyses over 2017-01-15 06:32:49 +00:00
DomPrinter.cpp
EHPersonalities.cpp [tsan] Add support for C++ exceptions into TSan (call __tsan_func_exit during unwinding), LLVM part 2016-11-14 21:41:13 +00:00
GlobalsModRef.cpp [PM] Change the static object whose address is used to uniquely identify 2016-11-23 17:53:26 +00:00
IndirectCallPromotionAnalysis.cpp
InlineCost.cpp Improve PGO support for the new inliner 2017-01-20 22:44:04 +00:00
InstCount.cpp
InstructionSimplify.cpp [InstSimplify] try to eliminate icmp Pred (add nsw X, C1), C2 2017-01-24 17:03:24 +00:00
Interval.cpp
IntervalPartition.cpp
IteratedDominanceFrontier.cpp
IVUsers.cpp [PM] Separate the LoopAnalysisManager from the LoopPassManager and move 2017-01-11 09:43:56 +00:00
LazyBlockFrequencyInfo.cpp
LazyBranchProbabilityInfo.cpp
LazyCallGraph.cpp Cleanup dump() functions. 2017-01-28 02:02:38 +00:00
LazyValueInfo.cpp [PM] Use PoisoningVH correctly when merely deleting entries in a map 2017-01-26 08:31:54 +00:00
Lint.cpp Revert @llvm.assume with operator bundles (r289755-r289757) 2016-12-19 08:22:17 +00:00
LLVMBuild.txt Restore "[ThinLTO] Prevent exporting of locals used/defined in module level asm" 2016-11-14 17:12:32 +00:00
Loads.cpp [JumpThread] Enhance finding partial redundant loads by continuing scanning single predecessor 2017-02-02 15:12:34 +00:00
LoopAccessAnalysis.cpp [SLP] Make sortMemAccesses explicitly return an error. NFC. 2017-02-03 19:32:50 +00:00
LoopAnalysisManager.cpp Rewind instantiations of OuterAnalysisManagerProxy in r289317, r291651, and r291662. 2017-01-25 04:26:29 +00:00
LoopInfo.cpp Make VerifyDomInfo and VerifyLoopInfo global variables 2017-01-24 05:52:07 +00:00
LoopPass.cpp Reverted: Track validity of pass results 2017-01-15 10:23:18 +00:00
LoopUnrollAnalyzer.cpp
MemDepPrinter.cpp
MemDerefPrinter.cpp
MemoryBuiltins.cpp [Analysis] Add LibFunc_ prefix to enums in TargetLibraryInfo. (NFC) 2017-01-23 23:16:46 +00:00
MemoryDependenceAnalysis.cpp [Devirtualization] MemDep returns non-local !invariant.group dependencies 2017-01-12 11:33:58 +00:00
MemoryLocation.cpp [Analysis] Add LibFunc_ prefix to enums in TargetLibraryInfo. (NFC) 2017-01-23 23:16:46 +00:00
ModuleDebugInfoPrinter.cpp [IR] Remove the DIExpression field from DIGlobalVariable. 2016-12-20 02:09:43 +00:00
ModuleSummaryAnalysis.cpp Revert "[ThinLTO] Add an auto-hide feature" 2017-02-03 07:41:43 +00:00
ObjCARCAliasAnalysis.cpp
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp Create llvm.addressofreturnaddress intrinsic 2016-10-12 22:13:19 +00:00
OptimizationDiagnosticInfo.cpp [LV] Also port failure remarks to new OptimizationRemarkEmitter API 2017-02-02 05:41:51 +00:00
OrderedBasicBlock.cpp
PHITransAddr.cpp Revert @llvm.assume with operator bundles (r289755-r289757) 2016-12-19 08:22:17 +00:00
PostDominators.cpp [PM] Introduce an analysis set used to preserve all analyses over 2017-01-15 06:32:49 +00:00
ProfileSummaryInfo.cpp Compute summary before calling extractProfTotalWeight 2017-01-14 00:32:37 +00:00
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp [PM] Introduce an analysis set used to preserve all analyses over 2017-01-15 06:32:49 +00:00
RegionPass.cpp Reverted: Track validity of pass results 2017-01-15 10:23:18 +00:00
RegionPrinter.cpp
ScalarEvolution.cpp [SCEV] limit recursion depth and operands number in getAddExpr 2017-02-06 12:38:06 +00:00
ScalarEvolutionAliasAnalysis.cpp [PM] Change the static object whose address is used to uniquely identify 2016-11-23 17:53:26 +00:00
ScalarEvolutionExpander.cpp Revert @llvm.assume with operator bundles (r289755-r289757) 2016-12-19 08:22:17 +00:00
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp [PM] Change the static object whose address is used to uniquely identify 2016-11-23 17:53:26 +00:00
SparsePropagation.cpp
StratifiedSets.h Do a sweep over move ctors and remove those that are identical to the default. 2016-10-20 12:20:28 +00:00
TargetLibraryInfo.cpp [Analysis] Add LibFunc_ prefix to enums in TargetLibraryInfo. (NFC) 2017-01-23 23:16:46 +00:00
TargetTransformInfo.cpp NVPTX: Refactor NVPTXInferAddressSpaces to check TTI 2017-01-30 23:02:12 +00:00
Trace.cpp
TypeBasedAliasAnalysis.cpp [TBAA] Don't generate invalid TBAA when merging nodes 2016-12-11 20:07:25 +00:00
TypeMetadataUtils.cpp Analysis: Add appropriate const qualification to functions in TypeMetadataUtils.cpp. NFC. 2017-01-27 22:55:30 +00:00
ValueTracking.cpp [ValueTracking] remove a FIXME for something we don't want to do; NFC 2017-02-01 22:27:34 +00:00
VectorUtils.cpp [LV] Move interleaved access helper functions to VectorUtils (NFC) 2017-02-01 17:45:46 +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))

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