1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/lib/Analysis
Sanjay Patel ab96742bc5 [InstSimplify] fold extractelement of splat with variable extract index
We already have a fold for variable index with constant vector,
but if we can determine a scalar splat value, then it does not
matter whether that value is constant or not.

We overlooked this fold in D102404 and earlier patches,
but the fixed vector variant is shown in:
https://llvm.org/PR50817

Alive2 agrees on that:
https://alive2.llvm.org/ce/z/HpijPC

The same logic applies to scalable vectors.

Differential Revision: https://reviews.llvm.org/D104867
2021-07-05 08:19:40 -04:00
..
models Unpack the CostEstimate feature in ML inlining models. 2021-07-02 16:57:16 +00:00
AliasAnalysis.cpp [AA] Support callCapturesBefore() on BatchAA (NFCI) 2021-05-14 21:48:08 +02:00
AliasAnalysisEvaluator.cpp [AA] Updates for D95543. 2021-04-15 12:22:03 +03:00
AliasAnalysisSummary.cpp
AliasAnalysisSummary.h
AliasSetTracker.cpp [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset. 2021-04-09 12:54:22 +03:00
Analysis.cpp
AssumeBundleQueries.cpp AssumeBundleQueries.cpp - don't dereference a dyn_cast<> result. NFCI. 2021-06-06 15:25:03 +01:00
AssumptionCache.cpp Use AssumeInst in a few more places [nfc] 2021-04-06 13:18:53 -07:00
BasicAliasAnalysis.cpp [BasicAA] Fix typo ScaleForGDC -> ScaleForGCD. 2021-07-01 09:58:38 +01:00
BlockFrequencyInfo.cpp Internalize some cl::opt global variables or move them under namespace llvm 2021-05-07 11:15:43 -07:00
BlockFrequencyInfoImpl.cpp A post-processing for BFI inference 2021-06-11 21:46:04 -07:00
BranchProbabilityInfo.cpp Fix some -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=off build 2021-06-04 23:34:43 -07:00
CallGraph.cpp Set IgnoreLLVMUsed to false in CallGraph::addToCallGraph() 2021-04-08 11:14:09 -07:00
CallGraphSCCPass.cpp Internalize some cl::opt global variables or move them under namespace llvm 2021-05-07 11:15:43 -07:00
CallPrinter.cpp Support: Stop using F_{None,Text,Append} compatibility synonyms, NFC 2021-04-30 11:00:03 -07:00
CaptureTracking.cpp [CaptureTracking] Simplify reachability check (NFCI) 2021-05-16 16:04:10 +02:00
CFG.cpp [CFG] Move reachable from entry checks into basic block variant 2021-05-15 15:42:02 +02:00
CFGPrinter.cpp Use -cfg-func-name value as filter for -view-cfg, etc. 2021-06-16 23:54:51 +02:00
CFLAndersAliasAnalysis.cpp [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset. 2021-04-09 12:54:22 +03:00
CFLGraph.h [CFLGraph] Fix a crash due to missing handling of freeze 2021-03-21 02:14:13 +09:00
CFLSteensAliasAnalysis.cpp [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset. 2021-04-09 12:54:22 +03:00
CGSCCPassManager.cpp Revert "[NewPM] Only invalidate modified functions' analyses in CGSCC passes" 2021-05-21 16:38:03 -07:00
CMakeLists.txt [MLGO] Update Oz model url. 2021-07-02 17:29:15 +00:00
CmpInstAnalysis.cpp
CodeMetrics.cpp
ConstantFolding.cpp [ConstantFold] Delay fetching pointer element type 2021-06-22 15:51:00 +02: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 Support: Stop using F_{None,Text,Append} compatibility synonyms, NFC 2021-04-30 11:00:03 -07:00
Delinearization.cpp
DemandedBits.cpp Add getDemandedBits for uses. 2021-06-02 10:07:40 -04:00
DependenceAnalysis.cpp [Dependence Analysis] Enable delinearization of fixed sized arrays 2021-05-10 10:30:15 -07:00
DependenceGraphBuilder.cpp
DevelopmentModeInlineAdvisor.cpp [MLGO] Fix use of AM.invalidate post D100519 2021-04-15 18:45:39 -07:00
DivergenceAnalysis.cpp
DominanceFrontier.cpp
DomPrinter.cpp
DomTreeUpdater.cpp [NFCI][DomTreeUpdater] applyUpdates(): reserve space for updates first 2021-04-11 23:56:22 +03:00
EHPersonalities.cpp [XCOFF] Handle the case when personality routine is an alias 2021-04-29 22:03:30 +00:00
FunctionPropertiesAnalysis.cpp
GlobalsModRef.cpp [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset. 2021-04-09 12:54:22 +03:00
GuardUtils.cpp
HeatUtils.cpp
ImportedFunctionsInliningStatistics.cpp [Analysis] ImportedFunctionsInliningStatistics.h - add <memory> and remove unused <string> include. NFCI. 2021-04-19 16:20:56 +01:00
IndirectCallPromotionAnalysis.cpp
InlineAdvisor.cpp
InlineCost.cpp Unpack the CostEstimate feature in ML inlining models. 2021-07-02 16:57:16 +00:00
InlineSizeEstimatorAnalysis.cpp
InstCount.cpp
InstructionPrecedenceTracking.cpp [GVN] Properly invalidate ICF cache when we simplify a value 2021-04-08 14:01:57 -07:00
InstructionSimplify.cpp [InstSimplify] fold extractelement of splat with variable extract index 2021-07-05 08:19:40 -04:00
Interval.cpp
IntervalPartition.cpp
IRSimilarityIdentifier.cpp [IRSim] Strip out the findSimilarity call from the constructor 2021-06-11 18:41:28 -05:00
IVDescriptors.cpp [NFC] Fix a few whitespace issues and typos. 2021-07-04 11:49:58 +01:00
IVUsers.cpp [IVUsers] Check LoopSimplify cache earlier (NFC) 2021-04-10 22:58:13 +02:00
LazyBlockFrequencyInfo.cpp Make dependency between certain analysis passes transitive (reapply) 2021-05-05 15:17:55 +02:00
LazyBranchProbabilityInfo.cpp Make dependency between certain analysis passes transitive (reapply) 2021-05-05 15:17:55 +02:00
LazyCallGraph.cpp Allow building for release with EXPENSIVE_CHECKS 2021-06-19 17:02:11 +01:00
LazyValueInfo.cpp [LVI] Remove recursion from getValueForCondition (NFCI) 2021-06-24 09:58:22 +09:00
LegacyDivergenceAnalysis.cpp
Lint.cpp [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset. 2021-04-09 12:54:22 +03:00
Loads.cpp [CSSPGO] Unblock optimizations with pseudo probe instrumentation part 2. 2021-04-26 16:52:33 -07:00
LoopAccessAnalysis.cpp [LAA] Make getPointersDiff() API compatible with opaque pointers 2021-06-23 18:44:34 +02:00
LoopAnalysisManager.cpp [NewPM] Don't mark AA analyses as preserved 2021-05-18 13:49:03 -07:00
LoopCacheAnalysis.cpp [SCEV] Add a utility for converting from "exit count" to "trip count" 2021-05-26 10:41:49 -07:00
LoopInfo.cpp [LI] Add a cover function for checking if a loop is mustprogress [nfc] 2021-06-10 13:37:32 -07:00
LoopNestAnalysis.cpp [LoopNest] Consider loop nest with inner loop guard using outer loop 2021-05-07 16:04:18 +00:00
LoopPass.cpp
LoopUnrollAnalyzer.cpp [unroll] Use value domain for symbolic execution based cost model 2021-05-26 08:41:25 -07:00
MemDepPrinter.cpp
MemDerefPrinter.cpp Minor format tweak to deref analysis printer 2021-03-22 18:44:18 -07:00
MemoryBuiltins.cpp [Analysis] use better version of getLibFunc to check for alloc/free calls 2021-06-25 12:14:07 -04:00
MemoryDependenceAnalysis.cpp [NFC] MemoryDependenceAnalysis cleanup. 2021-05-31 18:07:55 +03:00
MemoryLocation.cpp
MemorySSA.cpp [IR] Add BasicBlock::isEntryBlock() (NFC) 2021-05-15 12:41:58 +02:00
MemorySSAUpdater.cpp [MSSA] Rename uses in IDF regardless of new def position in basic block. 2021-04-09 12:32:37 -07:00
MLInlineAdvisor.cpp Unpack the CostEstimate feature in ML inlining models. 2021-07-02 16:57:16 +00:00
ModuleDebugInfoPrinter.cpp
ModuleSummaryAnalysis.cpp [Support] Don't include VirtualFileSystem.h in CommandLine.h 2021-04-21 10:19:01 -04:00
MustExecute.cpp
ObjCARCAliasAnalysis.cpp [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset. 2021-04-09 12:54:22 +03:00
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp
OptimizationRemarkEmitter.cpp
OverflowInstAnalysis.cpp Fix MSan crash after 1977c53b 2021-05-02 13:44:43 +09:00
PHITransAddr.cpp
PhiValues.cpp
PostDominators.cpp
ProfileSummaryInfo.cpp [CSSPGO][llvm-profdata] Support trimming cold context when merging profiles 2021-04-22 00:42:37 -07:00
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp
RegionPrinter.cpp
ReleaseModeModelRunner.cpp
ReplayInlineAdvisor.cpp
ScalarEvolution.cpp [SCEV] Fold (0 udiv %x) to 0 2021-06-30 08:31:13 -07:00
ScalarEvolutionAliasAnalysis.cpp [NewPM] Don't mark AA analyses as preserved 2021-05-18 13:49:03 -07:00
ScalarEvolutionDivision.cpp
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset. 2021-04-09 12:54:22 +03:00
StackLifetime.cpp
StackSafetyAnalysis.cpp
StratifiedSets.h
SyncDependenceAnalysis.cpp
SyntheticCountsUtils.cpp
TargetLibraryInfo.cpp [Analysis] improve function signature checking for calloc 2021-06-27 08:19:00 -04:00
TargetTransformInfo.cpp [Analysis] Pass RecurrenceDescriptor as const reference. NFCI. 2021-06-11 10:24:14 +01:00
TFUtils.cpp
Trace.cpp
TypeBasedAliasAnalysis.cpp [SROA][TBAA] Handle shift of regular TBAA nodes 2021-04-14 14:35:20 -04:00
TypeMetadataUtils.cpp Revert "Allow invokable sub-classes of IntrinsicInst" 2021-04-20 15:38:38 -07:00
ValueLattice.cpp
ValueLatticeUtils.cpp
ValueTracking.cpp [SimplifyCFG] simplifyUnreachable(): erase instructions iff they are guaranteed to transfer execution to unreachable 2021-07-03 10:45:44 +03:00
VectorUtils.cpp [NFC] Fix a few whitespace issues and typos. 2021-07-04 11:49:58 +01: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))

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