1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00
llvm-mirror/lib/Analysis
Max Kazantsev c4958f4b06 [SCEV] Fix false-positive recognition of simple recurrences. PR49856
A value from reachable block may come to a Phi node as its input from
unreachable block. This may confuse matchSimpleRecurrence  which
has no access to DomTree and can falsely recognize something as a recurrency
because of this effect, as the attached test shows.

Patch `ae7b1e` deals with half of this problem, but it only accounts from
the case when an unreachable instruction comes to Phi as an input.

This patch provides a generalization by checking that no Phi block's
predecessor is unreachable (no matter what the input is).

Differential Revision: https://reviews.llvm.org/D99929
Reviewed By: reames
2021-04-07 13:55:17 +07:00
..
models/inliner
AliasAnalysis.cpp [AA] Cache (optionally) estimated PartialAlias offsets. 2021-03-02 19:04:15 +03:00
AliasAnalysisEvaluator.cpp
AliasAnalysisSummary.cpp
AliasAnalysisSummary.h
AliasSetTracker.cpp Reapply [LICM] Make promotion faster 2021-03-11 10:50:28 +01:00
Analysis.cpp
AssumeBundleQueries.cpp Plumb AssumeInst through operand bundle apis [nfc] 2021-04-06 12:53:53 -07:00
AssumptionCache.cpp Use AssumeInst in a few more places [nfc] 2021-04-06 13:18:53 -07:00
BasicAliasAnalysis.cpp [BasicAA] Don't store AATags in cache key (NFC) 2021-04-03 11:32:01 +02:00
BlockFrequencyInfo.cpp
BlockFrequencyInfoImpl.cpp
BranchProbabilityInfo.cpp
CallGraph.cpp Option to ignore llvm[.compiler].used uses in hasAddressTaken() 2021-02-25 10:06:24 -08:00
CallGraphSCCPass.cpp [Analysis] Use ListSeparator (NFC) 2021-02-22 20:17:15 -08:00
CallPrinter.cpp
CaptureTracking.cpp Update basic deref API to account for possiblity of free [NFC] 2021-03-19 11:17:19 -07:00
CFG.cpp
CFGPrinter.cpp
CFLAndersAliasAnalysis.cpp
CFLGraph.h [CFLGraph] Fix a crash due to missing handling of freeze 2021-03-21 02:14:13 +09:00
CFLSteensAliasAnalysis.cpp
CGSCCPassManager.cpp Reapply "[NPM][CGSCC] FunctionAnalysisManagerCGSCCProxy: do not clear immutable function passes" 2021-03-18 09:44:34 -07:00
CMakeLists.txt [mlgo] fix build rules 2021-04-03 12:49:03 -07:00
CmpInstAnalysis.cpp
CodeMetrics.cpp Revert "[AssumptionCache] Avoid dangling llvm.assume calls in the cache" 2021-02-11 12:17:38 -06:00
ConstantFolding.cpp [ConstantFolding] Fixing addo/subo with undef 2021-03-31 21:47:29 +03:00
ConstraintSystem.cpp
CostModel.cpp [InstructionCost] Don't conflate Invalid costs with Unknown costs. 2021-03-30 09:29:42 +01:00
DDG.cpp
DDGPrinter.cpp
Delinearization.cpp
DemandedBits.cpp [DCE] Don't remove non-willreturn calls 2021-02-19 12:35:40 +01:00
DependenceAnalysis.cpp
DependenceGraphBuilder.cpp
DevelopmentModeInlineAdvisor.cpp
DivergenceAnalysis.cpp [Analysis] Use range-based for loops (NFC) 2021-02-22 20:17:18 -08:00
DominanceFrontier.cpp
DomPrinter.cpp
DomTreeUpdater.cpp
EHPersonalities.cpp
FunctionPropertiesAnalysis.cpp
GlobalsModRef.cpp [BasicAA] Always strip single-argument phi nodes 2021-02-18 23:07:50 +01:00
GuardUtils.cpp
HeatUtils.cpp
ImportedFunctionsInliningStatistics.cpp
IndirectCallPromotionAnalysis.cpp [SampleFDO] Another fix to prevent repeated indirect call promotion in 2021-03-04 18:44:12 -08:00
InlineAdvisor.cpp [NFC] Use llvm::raw_string_ostream instead of std::stringstream 2021-03-12 18:43:59 +01:00
InlineCost.cpp [InlineCost] Remove TODO comment that consider other forms of savings in the cost-benefit analysis 2021-03-31 20:11:32 +08:00
InlineSizeEstimatorAnalysis.cpp
InstCount.cpp
InstructionPrecedenceTracking.cpp
InstructionSimplify.cpp [SimplifyInst] Use correct type for GEPs with vector indices. 2021-04-06 17:56:10 +01:00
Interval.cpp
IntervalPartition.cpp
IRSimilarityIdentifier.cpp [Analysis] Use range-based for loops (NFC) 2021-02-22 20:17:18 -08:00
IVDescriptors.cpp [LoopVectorize] Add strict in-order reduction support for fixed-width vectorization 2021-04-06 14:45:34 +01:00
IVUsers.cpp
LazyBlockFrequencyInfo.cpp
LazyBranchProbabilityInfo.cpp
LazyCallGraph.cpp Only verify LazyCallGraph under expensive checks 2021-02-22 20:18:59 -08:00
LazyValueInfo.cpp [LVI] Don't bail on overdefined value in select 2021-04-04 11:11:01 +02:00
LegacyDivergenceAnalysis.cpp [NewPM] Introduce (GPU)DivergenceAnalysis in the new pass manager 2021-02-16 10:26:45 +05:30
Lint.cpp
Loads.cpp Move GCRelocateInst and GCResultInst to IntrinsicInst.h [nfc] 2021-04-06 08:33:15 -07:00
LoopAccessAnalysis.cpp Fix a miscompile introduced by 99203f2. 2021-03-25 16:53:58 -07:00
LoopAnalysisManager.cpp
LoopCacheAnalysis.cpp
LoopInfo.cpp [LCSSA] Extract a utility for deciding if a new use requires a new lcssa phi [NFC] 2021-03-17 12:14:01 -07:00
LoopNestAnalysis.cpp Revert "[LoopInterchange] Replace tightly-nesting-ness check with the one from LoopNest" 2021-03-11 01:24:43 +08:00
LoopPass.cpp
LoopUnrollAnalyzer.cpp
MemDepPrinter.cpp
MemDerefPrinter.cpp Minor format tweak to deref analysis printer 2021-03-22 18:44:18 -07:00
MemoryBuiltins.cpp
MemoryDependenceAnalysis.cpp Extract isVolatile helper on Instruction [NFCI] 2021-04-01 11:24:02 -07:00
MemoryLocation.cpp
MemorySSA.cpp [MSSA] Extending IsGuaranteedLoopInvariant to support an instruction defined in the entry block 2021-03-23 21:50:56 +00:00
MemorySSAUpdater.cpp [Analysis] Use range-based for loops (NFC) 2021-02-22 20:17:18 -08:00
MLInlineAdvisor.cpp
ModuleDebugInfoPrinter.cpp
ModuleSummaryAnalysis.cpp Use AssumeInst in a few more places [nfc] 2021-04-06 13:18:53 -07:00
MustExecute.cpp
ObjCARCAliasAnalysis.cpp
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of 2021-03-04 11:22:30 -08:00
OptimizationRemarkEmitter.cpp
PHITransAddr.cpp
PhiValues.cpp
PostDominators.cpp
ProfileSummaryInfo.cpp [CSSPGO][llvm-profgen] Use profile summary based threshold for context trimming and merging 2021-03-22 08:56:59 -07:00
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp
RegionPrinter.cpp
ReleaseModeModelRunner.cpp
ReplayInlineAdvisor.cpp
ScalarEvolution.cpp [SCEV] Fix false-positive recognition of simple recurrences. PR49856 2021-04-07 13:55:17 +07:00
ScalarEvolutionAliasAnalysis.cpp
ScalarEvolutionDivision.cpp
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp [llvm] Use set_is_subset (NFC) 2021-02-28 10:59:20 -08:00
StackLifetime.cpp
StackSafetyAnalysis.cpp
StratifiedSets.h
SyncDependenceAnalysis.cpp [Analysis] Use ListSeparator (NFC) 2021-02-14 08:36:14 -08:00
SyntheticCountsUtils.cpp
TargetLibraryInfo.cpp [NVPTX] CUDA does provide malloc/free since compute capability 2.X 2021-03-15 22:45:56 -05:00
TargetTransformInfo.cpp NFC: Change getIntrinsicInstrCost to return InstructionCost 2021-03-31 14:04:41 +01:00
TFUtils.cpp [Analysis] Use ListSeparator (NFC) 2021-02-21 19:58:04 -08:00
Trace.cpp
TypeBasedAliasAnalysis.cpp [llvm] Ensure newlines at the end of files (NFC) 2021-02-17 23:58:44 -08:00
TypeMetadataUtils.cpp Use AssumeInst in a few more places [nfc] 2021-04-06 13:18:53 -07:00
ValueLattice.cpp
ValueLatticeUtils.cpp
ValueTracking.cpp [KnownBits] Rename KnownBits::computeForMul to KnownBits::mul. NFCI. 2021-04-06 10:11:41 +01:00
VectorUtils.cpp [Analysis] Use range-based for loops (NFC) 2021-02-22 20:17:18 -08:00
VFABIDemangling.cpp

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))

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