1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/lib/Analysis
Jun Bum Lim dd78ed1cc5 Use the basic cost if a GEP is not used as addressing mode
Summary:
Currently, getGEPCost() returns TCC_FREE whenever a GEP is a legal addressing mode in the target.
However, since it doesn't check its actual users, it will return FREE even in cases
where the GEP cannot be folded away as a part of actual addressing mode.
For example, if an user of the GEP is a call instruction taking the GEP as a parameter,
then the GEP may not be folded in isel.

Reviewers: hfinkel, efriedma, mcrosier, jingyue, haicheng

Reviewed By: hfinkel

Subscribers: javed.absar, llvm-commits

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

llvm-svn: 314517
2017-09-29 14:50:16 +00:00
..
AliasAnalysis.cpp
AliasAnalysisEvaluator.cpp
AliasAnalysisSummary.cpp
AliasAnalysisSummary.h
AliasSetTracker.cpp
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
BranchProbabilityInfo.cpp
CallGraph.cpp
CallGraphSCCPass.cpp
CallPrinter.cpp
CaptureTracking.cpp
CFG.cpp
CFGPrinter.cpp
CFLAndersAliasAnalysis.cpp
CFLGraph.h
CFLSteensAliasAnalysis.cpp
CGSCCPassManager.cpp Use a BumpPtrAllocator for Loop objects 2017-09-28 02:45:42 +00:00
CMakeLists.txt [LVI] Move LVILatticeVal class to separate header file (NFC). 2017-09-28 11:09:22 +00:00
CmpInstAnalysis.cpp [InstCombine][InstSimplify] Teach decomposeBitTestICmp to look through truncate instructions 2017-09-01 21:27:34 +00:00
CodeMetrics.cpp
ConstantFolding.cpp
CostModel.cpp [TargetTransformInfo] Add a new public interface getInstructionCost 2017-09-08 22:29:17 +00:00
Delinearization.cpp
DemandedBits.cpp
DependenceAnalysis.cpp
DivergenceAnalysis.cpp
DominanceFrontier.cpp
DomPrinter.cpp
EHPersonalities.cpp
GlobalsModRef.cpp
IndirectCallPromotionAnalysis.cpp
InlineCost.cpp [InlineCost] add visitSelectInst() 2017-09-27 14:44:56 +00:00
InstCount.cpp
InstructionSimplify.cpp [InstSimplify] fold sdiv/srem based on compare of dividend and divisor 2017-09-14 14:59:07 +00:00
Interval.cpp
IntervalPartition.cpp
IteratedDominanceFrontier.cpp
IVUsers.cpp
LazyBlockFrequencyInfo.cpp
LazyBranchProbabilityInfo.cpp
LazyCallGraph.cpp
LazyValueInfo.cpp [LVI] Move LVILatticeVal class to separate header file (NFC). 2017-09-28 11:09:22 +00:00
Lint.cpp
LLVMBuild.txt
Loads.cpp Merge isKnownNonNull into isKnownNonZero 2017-09-09 18:23:11 +00:00
LoopAccessAnalysis.cpp Revert r313771 "[SLP] Vectorize jumbled memory loads." 2017-09-20 18:00:03 +00:00
LoopAnalysisManager.cpp Use a BumpPtrAllocator for Loop objects 2017-09-28 02:45:42 +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
MemDerefPrinter.cpp
MemoryBuiltins.cpp
MemoryDependenceAnalysis.cpp
MemoryLocation.cpp
MemorySSA.cpp
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
ModuleSummaryAnalysis.cpp [ThinLTO] AliasSummary should not have any references 2017-09-13 17:10:24 +00:00
ObjCARCAliasAnalysis.cpp
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp
OptimizationDiagnosticInfo.cpp
OrderedBasicBlock.cpp
PHITransAddr.cpp
PostDominators.cpp
ProfileSummaryInfo.cpp
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp
RegionPrinter.cpp
ScalarEvolution.cpp Remove trailing whitespaces. 2017-09-25 16:21:21 +00:00
ScalarEvolutionAliasAnalysis.cpp
ScalarEvolutionExpander.cpp
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp
SparsePropagation.cpp
StratifiedSets.h
TargetLibraryInfo.cpp TargetLibraryInfo: Stop guessing wchar_t size 2017-09-26 02:36:57 +00:00
TargetTransformInfo.cpp Use the basic cost if a GEP is not used as addressing mode 2017-09-29 14:50:16 +00:00
Trace.cpp
TypeBasedAliasAnalysis.cpp
TypeMetadataUtils.cpp
ValueLattice.cpp [LVI] Move LVILatticeVal class to separate header file (NFC). 2017-09-28 11:09:22 +00:00
ValueTracking.cpp Merge isKnownNonNull into isKnownNonZero 2017-09-09 18:23:11 +00:00
VectorUtils.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))

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