1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/lib/Analysis
Jessica Paquette e43ddd00f6 [GlobalISel] Fix computing known bits for loads with range metadata
In GlobalISel, if you have a load into a small type with a range, you'll hit
an assert if you try to compute known bits on it starting at a larger type.

e.g.

```
%x:_(s8) = G_LOAD %whatever(p0) :: (load 1 ... !range !n)
...
%y:_(s32) = G_SOMETHING %x
```

When we walk through G_SOMETHING and hit the load, the width of our known bits
is 32. However, the width of the range is going to be 8. This will cause us
to hit an assert.

To fix this, make computeKnownBitsFromRangeMetadata zero extend or truncate
the range type to match the bitwidth of the known bits we're calculating.

Add a testcase in CodeGen/GlobalISel/KnownBitsTest.cpp to reflect that this
works now.

https://reviews.llvm.org/D85375
2020-08-06 16:47:07 -07:00
..
models/inliner [NFC]{MLInliner] Point out the tests' model dependencies 2020-08-06 09:57:26 -07:00
AliasAnalysis.cpp [NFC] Remove unused GetUnderlyingObject paramenter 2020-07-31 02:10:03 -07:00
AliasAnalysisEvaluator.cpp [IR] Replace all uses of CallBase::getCalledValue() with getCalledOperand(). 2020-04-27 22:17:03 -07:00
AliasAnalysisSummary.cpp AliasAnalysisSummary.h - cleanup includes and forward declarations. NFC. 2020-04-21 11:32:58 +01:00
AliasAnalysisSummary.h AliasAnalysisSummary.h - cleanup includes and forward declarations. NFC. 2020-04-21 11:32:58 +01:00
AliasSetTracker.cpp
Analysis.cpp
AssumeBundleQueries.cpp Temporarily Revert "[AssumeBundles] Use operand bundles to encode alignment assumptions" 2020-07-16 11:54:04 -07:00
AssumptionCache.cpp Use llvm::is_contained where appropriate (NFC) 2020-07-27 10:20:44 -07:00
BasicAliasAnalysis.cpp [BasicAA] Enable -basic-aa-recphi by default 2020-08-04 10:43:42 +01:00
BlockFrequencyInfo.cpp [BFI][CGP] Add limited support for detecting missed BFI updates and fix one in CodeGenPrepare. 2020-05-07 11:58:00 -07:00
BlockFrequencyInfoImpl.cpp
BranchProbabilityInfo.cpp [BPI][NFC] Unify handling of normal and SCC based loops 2020-08-05 11:19:24 +07:00
CallGraph.cpp [CallGraph] Preserve call records vector when replacing call edge 2020-07-27 06:02:55 -07:00
CallGraphSCCPass.cpp [CallGraph] Update callback call sites in RefreshCallGraph 2020-07-14 22:33:57 -05:00
CallPrinter.cpp Revert rG5dd566b7c7b78bd- "PassManager.h - remove unnecessary Function.h/Module.h includes. NFCI." 2020-07-24 13:02:33 +01:00
CaptureTracking.cpp [NFC] GetUnderlyingObject -> getUnderlyingObject 2020-07-30 21:08:24 -07:00
CFG.cpp CFG.h - reduce includes to forward declarations. NFC. 2020-06-06 15:06:42 +01:00
CFGPrinter.cpp [CFG] Turning on Heat Colors for CFG by default 2020-04-29 20:44:10 +00:00
CFLAndersAliasAnalysis.cpp [ADT/STLExtras.h] - Add llvm::is_sorted wrapper and update callers. 2020-04-14 14:11:02 +03:00
CFLGraph.h
CFLSteensAliasAnalysis.cpp
CGSCCPassManager.cpp [NewPM][PassInstrument] Add PrintPass callback to StandardInstrumentations 2020-07-30 10:07:57 -07:00
CMakeLists.txt Reapply "Rename InlineFeatureAnalysis to FunctionPropertiesAnalysis" 2020-07-22 10:07:35 -07:00
CmpInstAnalysis.cpp
CodeMetrics.cpp CodeMetrics.cpp - remove unused includes. NFC. 2020-05-10 16:59:55 +01:00
ConstantFolding.cpp [ConstantFolding] fold abs intrinsic 2020-07-31 14:08:44 -04:00
CostModel.cpp
DDG.cpp [DDG] Data Dependence Graph - Graph Simplification 2020-02-19 13:41:51 -05:00
Delinearization.cpp
DemandedBits.cpp
DependenceAnalysis.cpp [NFC] Remove unused GetUnderlyingObject paramenter 2020-07-31 02:10:03 -07:00
DependenceGraphBuilder.cpp SmallPtrSet::find -> SmallPtrSet::count 2020-06-07 22:38:08 +02:00
DevelopmentModeInlineAdvisor.cpp [llvm][MLInliner] Don't log 'mandatory' events 2020-08-06 09:04:15 -07:00
DivergenceAnalysis.cpp [DA] conservatively mark the join of every divergent branch 2020-06-18 17:39:20 +05:30
DominanceFrontier.cpp
DomPrinter.cpp [CFGPrinter][CallPrinter][polly] Adding distinct structure for CFGDOTInfo 2020-04-06 17:42:54 +00:00
DomTreeUpdater.cpp [DomTreeUpdater] Use const auto * when iterating over pointers (NFC). 2020-07-10 16:39:15 +01:00
EHPersonalities.cpp
FunctionPropertiesAnalysis.cpp Use llvm::size rather than an empty loop to get the number of top 2020-07-23 14:55:50 -07:00
GlobalsModRef.cpp [NFC] Remove unused GetUnderlyingObject paramenter 2020-07-31 02:10:03 -07:00
GuardUtils.cpp
HeatUtils.cpp [CallPrinter] Remove static constructor. 2020-06-17 13:02:58 +02:00
IndirectCallPromotionAnalysis.cpp [CallSite removal] Remove unneeded includes of CallSite.h. NFC 2020-04-22 00:07:13 -07:00
InlineAdvisor.cpp [llvm] Development-mode InlineAdvisor 2020-07-20 11:01:56 -07:00
InlineCost.cpp [InlineCost] GetElementPtr with constant operands 2020-06-25 18:09:51 +00:00
InlineSizeEstimatorAnalysis.cpp [llvm][NFC] TensorSpec abstraction for ML evaluator 2020-07-29 16:29:21 -07:00
InstCount.cpp
InstructionPrecedenceTracking.cpp [IPT] Don't use OrderedInstructions (NFC) 2020-04-20 18:25:31 +02:00
InstructionSimplify.cpp [InstSimplify] avoid crashing by trying to rem-by-zero 2020-08-06 16:06:31 -04:00
Interval.cpp
IntervalPartition.cpp
IVDescriptors.cpp [LoopVectorizer] Inloop vector reductions 2020-08-06 10:10:50 +01:00
IVUsers.cpp
LazyBlockFrequencyInfo.cpp
LazyBranchProbabilityInfo.cpp
LazyCallGraph.cpp [llvm][NFC][CallSite] Remove Implementation uses of CallSite 2020-04-14 14:49:47 -07:00
LazyValueInfo.cpp [NFC] Remove unused GetUnderlyingObject paramenter 2020-07-31 02:10:03 -07:00
LegacyDivergenceAnalysis.cpp
Lint.cpp [NFC] Remove unused GetUnderlyingObject paramenter 2020-07-31 02:10:03 -07:00
LLVMBuild.txt [llvm][NFC] Move content of ML subdirectory into Analysis 2020-06-15 14:35:33 -07:00
Loads.cpp [Analysis] isDereferenceableAndAlignedPointer(): don't crash on bitcast <1 x ???*> to ???* 2020-06-27 18:30:59 +03:00
LoopAccessAnalysis.cpp [NFC] Remove unused GetUnderlyingObject paramenter 2020-07-31 02:10:03 -07:00
LoopAnalysisManager.cpp
LoopCacheAnalysis.cpp LoopAnalysisManager.h - reduce includes to forward declarations. NFC. 2020-06-06 14:06:46 +01:00
LoopInfo.cpp [NFC] Add missing 'const' notion to LCSSA-related functions 2020-04-17 17:49:34 +07:00
LoopNestAnalysis.cpp [LoopNest]: Analysis to discover properties of a loop nest. 2020-03-03 18:25:19 +00:00
LoopPass.cpp Revert rG5dd566b7c7b78bd- "PassManager.h - remove unnecessary Function.h/Module.h includes. NFCI." 2020-07-24 13:02:33 +01:00
LoopUnrollAnalyzer.cpp ScalarEvolution.h - reduce LoopInfo.h include to forward declarations. NFC. 2020-06-17 15:48:23 +01:00
MemDepPrinter.cpp GVN.h - reduce AliasAnalysis.h include to forward declaration. NFC. 2020-06-25 16:59:35 +01:00
MemDerefPrinter.cpp Loads.h - reduce AliasAnalysis.h include to forward declarations. NFC. 2020-06-24 13:49:04 +01:00
MemoryBuiltins.cpp IR: Define byref parameter attribute 2020-07-20 10:23:09 -04:00
MemoryDependenceAnalysis.cpp [NFC] Remove unused GetUnderlyingObject paramenter 2020-07-31 02:10:03 -07:00
MemoryLocation.cpp Fix MemoryLocation.h use without Instructions.h 2020-05-26 17:19:14 +01:00
MemorySSA.cpp [MemorySSA] Restrict optimizations after a PhiTranslation. 2020-08-03 14:46:41 -07:00
MemorySSAUpdater.cpp Use llvm::is_contained where appropriate (NFC) 2020-08-01 21:51:06 -07:00
MLInlineAdvisor.cpp Reapply "Rename InlineFeatureAnalysis to FunctionPropertiesAnalysis" 2020-07-22 10:07:35 -07:00
ModuleDebugInfoPrinter.cpp
ModuleSummaryAnalysis.cpp [StackSafety] Pass summary into codegen 2020-06-10 21:02:54 -07:00
MustExecute.cpp MustBeExecutedContextPrinter::runOnModule: Use unique_ptr to simplify/clarify ownership 2020-04-28 11:30:53 -07:00
ObjCARCAliasAnalysis.cpp [NFC] Remove unused GetUnderlyingObject paramenter 2020-07-31 02:10:03 -07:00
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp [Analysis/Transforms/Sanitizers] As part of using inclusive language 2020-06-20 00:42:26 -07:00
OptimizationRemarkEmitter.cpp [BPI][NFC] Reuse post dominantor tree from analysis manager when available 2020-04-30 11:31:03 +07:00
PHITransAddr.cpp
PhiValues.cpp
PostDominators.cpp
ProfileSummaryInfo.cpp [NFC] Change getEntryForPercentile to be a static function in ProfileSummaryBuilder. 2020-07-09 16:38:19 -07:00
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp RegionInfo.cpp - remove duplicate includes that already exist in RegionInfo.h. NFC. 2020-07-23 17:50:22 +01:00
RegionPass.cpp
RegionPrinter.cpp [CFGPrinter][CallPrinter][polly] Adding distinct structure for CFGDOTInfo 2020-04-06 17:42:54 +00:00
ReleaseModeModelRunner.cpp Build: Move TF source file inclusion from build system to source files 2020-07-21 13:02:34 -04:00
ScalarEvolution.cpp [SCEV] If Start>=RHS, simplify (Start smin RHS) = RHS for trip counts. 2020-08-03 17:22:42 +01:00
ScalarEvolutionAliasAnalysis.cpp
ScalarEvolutionDivision.cpp [NFCI] SCEV: promote ScalarEvolutionDivision into an publicly usable class 2020-06-25 00:58:53 +03:00
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp Rename scoped-noalias -> scoped-noalias-aa 2020-07-24 12:14:27 -07:00
StackLifetime.cpp [StackSafety,NFC] Don't rerun on LiveIn change 2020-06-19 21:29:31 -07:00
StackSafetyAnalysis.cpp [StackSafety, NFC] Don't insert empty objects into the map 2020-08-02 13:58:56 -07:00
StratifiedSets.h
SyncDependenceAnalysis.cpp [CFG/BasicBlock] Rename succ_const to const_succ. [NFC] 2020-03-25 12:40:55 -07:00
SyntheticCountsUtils.cpp [CallSite removal] Remove unneeded includes of CallSite.h. NFC 2020-04-22 00:07:13 -07:00
TargetLibraryInfo.cpp [LLVM] Add libatomic load/store functions to TargetLibraryInfo 2020-07-18 03:18:48 +00:00
TargetTransformInfo.cpp [Analysis] TTI: Add CastContextHint for getCastInstrCost 2020-07-29 13:32:53 +01:00
TFUtils.cpp [TFUtils] Expose untyped accessor to evaluation result tensors 2020-08-05 10:22:45 -07:00
Trace.cpp
TypeBasedAliasAnalysis.cpp
TypeMetadataUtils.cpp TypeMetadataUtils.h - reduce Instructions.h include to forward declaration. NFC. 2020-06-05 17:40:33 +01:00
ValueLattice.cpp [ValueLattice] Distinguish between constant ranges with/without undef. 2020-03-31 12:50:20 +01:00
ValueLatticeUtils.cpp [ValueLattice] Simplify canTrackGlobalVariableInterprocedurally (NFC). 2020-07-09 18:33:09 +01:00
ValueTracking.cpp [GlobalISel] Fix computing known bits for loads with range metadata 2020-08-06 16:47:07 -07:00
VectorUtils.cpp [LV] Add abs/smin/smax/umin/umax intrinsics to isTriviallyVectorizable 2020-07-29 10:23:07 -07:00
VFABIDemangling.cpp [VFABI] Fix parsing of uniform parameters that shouldn't expect step or positional data. 2020-05-27 16:07:45 +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))

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