1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00
llvm-mirror/lib/Analysis
Nikita Popov 42e283c87a [InstSimplify] Protect against more poison in SimplifyWithOpReplaced (PR47322)
Replace the check for poison-producing instructions in
SimplifyWithOpReplaced() with the generic helper canCreatePoison()
that properly handles poisonous shifts and thus avoids the problem
from PR47322.

This additionally fixes a bug in IIQ.UseInstrInfo=false mode, which
previously could have caused this code to ignore poison flags.
Setting UseInstrInfo=false should reduce the possible optimizations,
not increase them.

This is not a full solution to the problem, as poison could be
introduced more indirectly. This is just a minimal, easy to backport
fix.

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

(cherry picked from commit a5be86fde5de2c253aa19704bf4e4854f1936f8c)
2020-08-31 16:09:42 +02:00
..
models/inliner [llvm][NFC] ML Policies: changed the saved_model protobuf to text 2020-07-13 11:07:07 -07:00
AliasAnalysis.cpp [BasicAA] Rename -disable-basicaa to -disable-basic-aa to be consistent with the canonical name "basic-aa" 2020-06-26 20:55:44 -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 [NFC] Remove trailing space 2020-02-18 10:49:13 +08:00
Analysis.cpp [MustExec] Add a generic "must-be-executed-context" explorer 2019-08-23 15:17:27 +00:00
AssumeBundleQueries.cpp Temporarily Revert "[AssumeBundles] Use operand bundles to encode alignment assumptions" 2020-07-17 10:32:03 +02:00
AssumptionCache.cpp [NFC][DwarfDebug] Add test for variables with a single location which 2020-05-11 11:49:11 +02:00
BasicAliasAnalysis.cpp [BasicAA] Fix -basicaa-recphi for geps with negative offsets 2020-07-27 17:02:13 +02: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 [BFI] Add a debug check for unknown block queries. 2020-02-04 10:05:28 -08:00
BranchProbabilityInfo.cpp [BPI] Compile time improvement when erasing blocks (NFC) 2020-07-10 16:55:54 -07:00
CallGraph.cpp [CallGraph] Ignore callback uses 2020-07-14 13:08:49 -07:00
CallGraphSCCPass.cpp [CallGraph] Update callback call sites in RefreshCallGraph 2020-07-14 22:33:57 -05:00
CallPrinter.cpp [CallPrinter] Adding heat coloring to CallPrinter 2020-06-16 21:15:29 +00:00
CaptureTracking.cpp [Analysis] Ensure we include CommandLine.h if we declare any cl::opt flags. NFC. 2020-06-23 12:29:51 +01: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 [CFLGraph] Add support for unary fneg instruction. 2019-06-06 19:21:23 +00:00
CFLSteensAliasAnalysis.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
CGSCCPassManager.cpp [NewPM] Move debugging log printing after PassInstrumentation before-pass-callbacks 2020-06-25 10:03:25 -07:00
CMakeLists.txt Reapply "[llvm] Native size estimator for training -Oz inliner" 2020-07-13 16:26:26 -07:00
CmpInstAnalysis.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CodeMetrics.cpp CodeMetrics.cpp - remove unused includes. NFC. 2020-05-10 16:59:55 +01:00
ConstantFolding.cpp [ConstantFolding] check applicability of AllOnes constant creation first 2020-07-21 16:38:47 +02:00
CostModel.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
DDG.cpp [DDG] Data Dependence Graph - Graph Simplification 2020-02-19 13:41:51 -05:00
Delinearization.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
DemandedBits.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
DependenceAnalysis.cpp DependenceAnalysis.h - reduce AliasAnalysis.h include to forward declaration. NFC. 2020-06-07 12:47:37 +01:00
DependenceGraphBuilder.cpp SmallPtrSet::find -> SmallPtrSet::count 2020-06-07 22:38:08 +02:00
DivergenceAnalysis.cpp [DA] conservatively mark the join of every divergent branch 2020-06-18 17:39:20 +05:30
DominanceFrontier.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
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 Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
GlobalsModRef.cpp GlobalsModRef.h - reduce CallGraph.h include to forward declarations. NFC. 2020-06-25 16:00:43 +01:00
GuardUtils.cpp [NFC] Remove trailing space 2020-02-18 10:49:13 +08:00
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][NFC] Factored the default inlining advice 2020-07-13 12:20:35 -07:00
InlineCost.cpp [InlineCost] GetElementPtr with constant operands 2020-06-25 18:09:51 +00:00
InlineFeaturesAnalysis.cpp [llvm][NFC] Fix license on InlineFeaturesAnalysis.{h|cpp} 2020-06-15 19:34:33 -07:00
InlineSizeEstimatorAnalysis.cpp [llvm][NFC] Hide the tensorflow dependency from headers. 2020-07-14 21:14:11 -07:00
InstCount.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
InstructionPrecedenceTracking.cpp [IPT] Don't use OrderedInstructions (NFC) 2020-04-20 18:25:31 +02:00
InstructionSimplify.cpp [InstSimplify] Protect against more poison in SimplifyWithOpReplaced (PR47322) 2020-08-31 16:09:42 +02:00
Interval.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
IntervalPartition.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
IVDescriptors.cpp [IVDescriptors] Remove unnecessary DemandedBits.h include; NFC 2020-04-04 12:07:57 +02:00
IVUsers.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LazyBlockFrequencyInfo.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LazyBranchProbabilityInfo.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LazyCallGraph.cpp [llvm][NFC][CallSite] Remove Implementation uses of CallSite 2020-04-14 14:49:47 -07:00
LazyValueInfo.cpp [NFC] Add 'override' keyword where missing in include/ and lib/. 2020-07-14 09:47:29 -07:00
LegacyDivergenceAnalysis.cpp Resubmit: [DA][TTI][AMDGPU] Add option to select GPUDA with TTI 2020-01-24 10:39:40 -08:00
Lint.cpp [Alignment] TargetLowering::hasPairedLoad must use Align for RequiredAlignment 2020-07-01 14:32:30 +00: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 [LAA] Avoid adding pointers to the checks if they are not needed. 2020-08-03 15:55:25 +02:00
LoopAnalysisManager.cpp Add PassManagerImpl.h to hide implementation details 2020-02-03 11:15:55 -08:00
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 NFC. Remove obsolete SimpleAnalysis infrastructure 2020-01-23 13:58:30 +07: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 [TLI] Add four C++17 delete variants. 2020-06-16 11:12:02 -07:00
MemoryDependenceAnalysis.cpp [MemDep] Also remove load instructions from NonLocalDesCache. 2020-06-17 09:36:53 +01:00
MemoryLocation.cpp Fix MemoryLocation.h use without Instructions.h 2020-05-26 17:19:14 +01:00
MemorySSA.cpp [MemorySSA] Pass DT to the upward iterator for proper PhiTranslation. 2020-04-29 14:28:31 -07:00
MemorySSAUpdater.cpp MemorySSAUpdater.h - reduce unnecessary includes to forward declarations. NFC. 2020-06-05 10:45:59 +01:00
MLInlineAdvisor.cpp [llvm] Release-mode ML InlineAdvisor 2020-06-24 08:18:42 -07:00
ModuleDebugInfoPrinter.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
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 ObjCARCAnalysisUtils.h - remove unused includes. NFC. 2020-05-26 19:22:15 +01:00
ObjCARCAnalysisUtils.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
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 Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
PhiValues.cpp [PhiValues] Remove redundant map searches 2019-11-23 10:32:56 +02:00
PostDominators.cpp [CodeMoverUtils] Added an API to check if an instruction can be safely 2019-11-22 21:29:08 +00:00
ProfileSummaryInfo.cpp [NFC] Change getEntryForPercentile to be a static function in ProfileSummaryBuilder. 2020-07-09 16:38:19 -07:00
PtrUseVisitor.cpp SROA: Allow eliminating addrspacecasted allocas 2019-06-14 21:38:31 +00:00
README.txt
RegionInfo.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
RegionPass.cpp [IR] Refactor attribute methods in Function class (NFC) 2019-04-04 22:40:06 +00:00
RegionPrinter.cpp [CFGPrinter][CallPrinter][polly] Adding distinct structure for CFGDOTInfo 2020-04-06 17:42:54 +00:00
ReleaseModeModelRunner.cpp [llvm] Release-mode ML InlineAdvisor 2020-06-24 08:18:42 -07:00
ScalarEvolution.cpp [SCEV] Remove premature assert. PR46786 2020-07-23 15:02:00 +02:00
ScalarEvolutionAliasAnalysis.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
ScalarEvolutionDivision.cpp [NFCI] SCEV: promote ScalarEvolutionDivision into an publicly usable class 2020-06-25 00:58:53 +03:00
ScalarEvolutionNormalization.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ScopedNoAliasAA.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
StackLifetime.cpp [StackSafety,NFC] Don't rerun on LiveIn change 2020-06-19 21:29:31 -07:00
StackSafetyAnalysis.cpp StackSafetyAnalysis.cpp - pass ConstantRange arg as const reference. 2020-07-10 12:13:34 +01:00
StratifiedSets.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
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 [TLI] Add four C++17 delete variants. 2020-06-16 11:12:02 -07:00
TargetTransformInfo.cpp [NFC] Separate Peeling Properties into its own struct (re-land after minor fix) 2020-07-10 18:39:30 +00:00
TFUtils.cpp [llvm][NFC] Hide the tensorflow dependency from headers. 2020-07-14 21:14:11 -07:00
Trace.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TypeBasedAliasAnalysis.cpp [Metadata] Add TBAA struct metadata to AAMDNode 2020-01-06 11:05:15 +03:00
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 [ValueTracking] fix library to intrinsic mapping to respect 'nobuiltin' attribute 2020-07-14 10:04:24 -04:00
VectorUtils.cpp [FPEnv] Intrinsic llvm.roundeven 2020-05-26 19:24:58 +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))

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