1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00
llvm-mirror/lib/Analysis
Nikita Popov 725bd76263 [Loads] Forward constant vector store to load of first element
InstCombine performs simple forwarding from stores to loads, but
currently only handles the case where the load and store have the
same size. This extends it to also handle a store of a constant
with a larger size followed by a load with a smaller size.

This is implemented through ConstantFoldLoadThroughBitcast() which
is fairly primitive (e.g. does not allow storing a large integer
and then loading a small one), but at least can forward the first
element of a vector store. Unfortunately it seems that we currently
don't have a generic helper for "read a constant value as a different
type", it's all tangled up with other logic in either
ConstantFolding or VNCoercion.

Differential Revision: https://reviews.llvm.org/D98114
2021-04-03 12:10:31 +02:00
..
models/inliner
AliasAnalysis.cpp [AA] Cache (optionally) estimated PartialAlias offsets. 2021-03-02 19:04:15 +03:00
AliasAnalysisEvaluator.cpp [Analysis] Use range-based for loops (NFC) 2021-02-06 11:17:10 -08:00
AliasAnalysisSummary.cpp
AliasAnalysisSummary.h
AliasSetTracker.cpp Reapply [LICM] Make promotion faster 2021-03-11 10:50:28 +01:00
Analysis.cpp
AssumeBundleQueries.cpp [FIX] Allow non-constant assume operand bundle operands. 2021-03-11 23:31:09 -06:00
AssumptionCache.cpp Revert "[AssumptionCache] Avoid dangling llvm.assume calls in the cache" 2021-02-11 12:17:38 -06: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 [Analysis] Use range-based for loops (NFC) 2021-02-06 11:17:10 -08:00
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 [Analysis] Use range-based for loops (NFC) 2021-02-06 11:17:10 -08:00
CaptureTracking.cpp Update basic deref API to account for possiblity of free [NFC] 2021-03-19 11:17:19 -07:00
CFG.cpp [Analysis] Use is_contained (NFC) 2020-12-11 21:19:31 -08:00
CFGPrinter.cpp [llvm] Use llvm::all_of (NFC) 2021-01-06 18:27:36 -08:00
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] Fetch models from path / URL 2021-02-16 22:47:14 -08: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 [llvm] Remove redundant string initialization (NFC) 2021-01-12 21:43:46 -08:00
CostModel.cpp [InstructionCost] Don't conflate Invalid costs with Unknown costs. 2021-03-30 09:29:42 +01:00
DDG.cpp [Analysis] Use llvm::append_range (NFC) 2021-01-22 23:25:01 -08:00
DDGPrinter.cpp [DDG] Data Dependence Graph - DOT printer - recommit 2020-12-16 12:37:36 -05:00
Delinearization.cpp [Analysis] Use range-based for loops (NFC) 2021-02-06 11:17:10 -08:00
DemandedBits.cpp [DCE] Don't remove non-willreturn calls 2021-02-19 12:35:40 +01:00
DependenceAnalysis.cpp [AA] Split up LocationSize::unknown() 2020-11-26 18:39:55 +01:00
DependenceGraphBuilder.cpp [Analysis] Use llvm::append_range (NFC) 2021-01-22 23:25:01 -08:00
DevelopmentModeInlineAdvisor.cpp [Analysis] Use llvm::append_range (NFC) 2021-01-22 23:25:01 -08:00
DivergenceAnalysis.cpp [Analysis] Use range-based for loops (NFC) 2021-02-22 20:17:18 -08:00
DominanceFrontier.cpp
DomPrinter.cpp
DomTreeUpdater.cpp [Target, Transforms] Use *Set::contains (NFC) 2021-01-08 18:39:54 -08:00
EHPersonalities.cpp [XCOFF][AIX] Generate LSDA data and compact unwind section on AIX 2020-12-02 18:42:44 +00:00
FunctionPropertiesAnalysis.cpp [llvm] Ensure newlines at the end of files (NFC) 2021-01-10 09:24:57 -08:00
GlobalsModRef.cpp [BasicAA] Always strip single-argument phi nodes 2021-02-18 23:07:50 +01:00
GuardUtils.cpp
HeatUtils.cpp
ImportedFunctionsInliningStatistics.cpp Reland "[NPM][Inliner] Factor ImportedFunctionStats in the InlineAdvisor" 2021-01-20 13:33:43 -08:00
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 [MLGO] Fix build break as result of new InstructionCost (D91174) 2020-12-11 20:28:39 -08:00
InstCount.cpp
InstructionPrecedenceTracking.cpp
InstructionSimplify.cpp Always emit error for wrong interfaces to scalable vectors, unless cmdline flag is passed. 2021-04-02 10:55:22 +01:00
Interval.cpp [Analysis/Interval] Remove isLoop (NFC) 2020-12-12 10:09:35 -08:00
IntervalPartition.cpp
IRSimilarityIdentifier.cpp [Analysis] Use range-based for loops (NFC) 2021-02-22 20:17:18 -08:00
IVDescriptors.cpp [Analysis][LoopVectorize] rename "Unsafe" variables/methods; NFC 2021-03-04 08:53:04 -05: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] Use range metadata on intrinsics 2021-04-02 16:45:31 +02:00
LegacyDivergenceAnalysis.cpp [NewPM] Introduce (GPU)DivergenceAnalysis in the new pass manager 2021-02-16 10:26:45 +05:30
Lint.cpp [AA] Split up LocationSize::unknown() 2020-11-26 18:39:55 +01:00
Loads.cpp [Loads] Forward constant vector store to load of first element 2021-04-03 12:10:31 +02:00
LoopAccessAnalysis.cpp Fix a miscompile introduced by 99203f2. 2021-03-25 16:53:58 -07:00
LoopAnalysisManager.cpp [NFC] Reduce include files dependency. 2020-12-03 18:25:05 +03:00
LoopCacheAnalysis.cpp [Analysis] Use llvm::append_range (NFC) 2021-01-22 23:25:01 -08:00
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 [Analysis] Use llvm::erase_value (NFC) 2020-12-14 22:40:13 -08:00
LoopUnrollAnalyzer.cpp
MemDepPrinter.cpp [Analysis] Remove dead function getInstTypePair (NFC) 2020-12-19 10:57:35 -08:00
MemDerefPrinter.cpp Minor format tweak to deref analysis printer 2021-03-22 18:44:18 -07:00
MemoryBuiltins.cpp [Analysis] Support AIX vec_malloc routines 2021-01-22 16:03:01 -05:00
MemoryDependenceAnalysis.cpp Extract isVolatile helper on Instruction [NFCI] 2021-04-01 11:24:02 -07:00
MemoryLocation.cpp [MemLoc] Fix debug print for LocationSize 2020-12-20 17:52:48 +01:00
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 Reland "[NPM][Inliner] Factor ImportedFunctionStats in the InlineAdvisor" 2021-01-20 13:33:43 -08:00
ModuleDebugInfoPrinter.cpp
ModuleSummaryAnalysis.cpp [ModuleSummaryAnalysis] Avoid duplicate elements in Worklist. NFC 2021-03-06 14:19:22 -08:00
MustExecute.cpp [MustExecute] Use ListSeparator (NFC) 2021-01-28 22:21:16 -08:00
ObjCARCAliasAnalysis.cpp [AA] Split up LocationSize::unknown() 2020-11-26 18:39:55 +01:00
ObjCARCAnalysisUtils.cpp [NFC] Reduce include files dependency. 2020-12-03 18:25:05 +03:00
ObjCARCInstKind.cpp [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of 2021-03-04 11:22:30 -08:00
OptimizationRemarkEmitter.cpp [BPI] Improve static heuristics for "cold" paths. 2020-12-23 22:47:36 +07:00
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 static const char *const foo => const char foo[] 2020-12-01 10:33:18 -08:00
ReplayInlineAdvisor.cpp [InlineAdvisor] Allow replay of inline decisions for the CGSCC inliner from optimization remarks 2021-01-25 15:38:57 -08:00
ScalarEvolution.cpp [SCEV] Handle unreachable binop when matching shift recurrence 2021-03-31 10:33:34 -07:00
ScalarEvolutionAliasAnalysis.cpp [AA] Split up LocationSize::unknown() 2020-11-26 18:39:55 +01:00
ScalarEvolutionDivision.cpp
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp [llvm] Use set_is_subset (NFC) 2021-02-28 10:59:20 -08:00
StackLifetime.cpp
StackSafetyAnalysis.cpp [llvm] Drop unnecessary make_range (NFC) 2021-01-09 09:25:00 -08:00
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
ValueLattice.cpp
ValueLatticeUtils.cpp
ValueTracking.cpp [KnownBits] Add KnownBits::haveNoCommonBitsSet helper. NFCI. 2021-04-02 21:44:33 +01:00
VectorUtils.cpp [Analysis] Use range-based for loops (NFC) 2021-02-22 20:17:18 -08:00
VFABIDemangling.cpp [llvm] Use the default value of drop_begin (NFC) 2021-01-18 10:16:36 -08: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))

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