1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
llvm-mirror/include/llvm/Analysis
Nikita Popov 1da83b4649 [BDCE][DemandedBits] Detect dead uses of undead instructions
This (mostly) fixes https://bugs.llvm.org/show_bug.cgi?id=39771.

BDCE currently detects instructions that don't have any demanded bits
and replaces their uses with zero. However, if an instruction has
multiple uses, then some of the uses may be dead (have no demanded bits)
even though the instruction itself is still live. This patch extends
DemandedBits/BDCE to detect such uses and replace them with zero.
While this will not immediately render any instructions dead, it may
lead to simplifications (in the motivating case, by converting a rotate
into a simple shift), break dependencies, etc.

The implementation tries to strike a balance between analysis power and
complexity/memory usage. Originally I wanted to track demanded bits on
a per-use level, but ultimately we're only really interested in whether
a use is entirely dead or not. I'm using an extra set to track which uses
are dead. However, as initially all uses are dead, I'm not storing uses
those user is also dead. This case is checked separately instead.

The test case has a couple of cases that are not simplified yet. In
particular, we're only looking at uses of instructions right now. I think
it would make sense to also extend this to arguments. Furthermore
DemandedBits doesn't yet know some of the tricks that InstCombine does
for the demanded bits or bitwise or/and/xor in combination with known
bits information.

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

llvm-svn: 349674
2018-12-19 19:56:21 +00:00
..
Utils Add missing header 2018-06-04 21:33:56 +00:00
AliasAnalysis.h Allow subclassing ExternalAA 2018-11-07 20:26:42 +00:00
AliasAnalysisEvaluator.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
AliasSetTracker.h [AliasSetTracker] Misc cleanup (NFCI) 2018-11-01 23:37:51 +00:00
AssumptionCache.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
BasicAliasAnalysis.h [BasicAA] Use PhiValuesAnalysis if available when handling phi alias 2018-07-30 11:52:08 +00:00
BlockFrequencyInfo.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
BlockFrequencyInfoImpl.h Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
BranchProbabilityInfo.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
CallGraph.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
CallGraphSCCPass.h [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes. Also affected in files (NFC). 2017-08-31 21:56:16 +00:00
CallPrinter.h
CaptureTracking.h Introduce MaxUsesToExplore argument to capture tracking 2018-11-29 20:08:12 +00:00
CFG.h [TI removal] Remove TerminatorInst as an input parameter from all public 2018-10-15 09:17:09 +00:00
CFGPrinter.h [TI removal] Just use Instruction in the CFG printer code. NFC. 2018-10-15 09:33:40 +00:00
CFLAliasAnalysisUtils.h [CFLAA] Move FunctionHandle to llvm::cflaa. 2017-06-27 02:43:00 +00:00
CFLAndersAliasAnalysis.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
CFLSteensAliasAnalysis.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
CGSCCPassManager.h [NewPM] fixing asserts on deleted loop in -print-after-all 2018-12-11 19:05:35 +00:00
CmpInstAnalysis.h [CmpInstAnalysis] fix function signature for ICmp code to predicate; NFC 2018-12-04 18:53:27 +00:00
CodeMetrics.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
ConstantFolding.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
DemandedBits.h [BDCE][DemandedBits] Detect dead uses of undead instructions 2018-12-19 19:56:21 +00:00
DependenceAnalysis.h [DA] Delinearise AddRecs if we can prove they don't wrap 2018-06-25 15:13:26 +00:00
DivergenceAnalysis.h [DA] GPUDivergenceAnalysis for unstructured GPU kernels 2018-11-30 22:55:20 +00:00
DominanceFrontier.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
DominanceFrontierImpl.h IWYU for llvm-config.h in llvm, additions. 2018-04-30 14:59:11 +00:00
DomPrinter.h
DOTGraphTraitsPass.h Remove @brief commands from doxygen comments, too. 2018-05-01 16:10:38 +00:00
EHPersonalities.h [WebAssembly] Add Wasm personality and isScopedEHPersonality() 2018-05-17 20:52:03 +00:00
GlobalsModRef.h [PM] Change the static object whose address is used to uniquely identify 2016-11-23 17:53:26 +00:00
GuardUtils.h Re-enable "[NFC] Unify guards detection" 2018-08-30 03:39:16 +00:00
IndirectCallPromotionAnalysis.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
IndirectCallSiteVisitor.h Add header guards to some headers that are missing them 2018-09-03 16:22:05 +00:00
InlineCost.h [InlineCost] Remove a dead constant; NFC 2018-10-31 22:45:31 +00:00
InstructionPrecedenceTracking.h [LICM] Hoist guards from non-header blocks 2018-11-12 09:29:58 +00:00
InstructionSimplify.h [InstrSimplify,NewGVN] Add option to ignore additional instr info when simplifying. 2018-08-17 14:39:04 +00:00
Interval.h [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-07-24 23:16:33 +00:00
IntervalIterator.h [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-07-24 23:16:33 +00:00
IntervalPartition.h [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-07-24 23:16:33 +00:00
IteratedDominanceFrontier.h Documentation: add \file markup as needed. 2018-11-27 17:53:03 +00:00
IVDescriptors.h Add a new reduction pattern match 2018-11-30 13:40:10 +00:00
IVUsers.h Rename WeakVH to WeakTrackingVH; NFC 2017-05-01 17:07:49 +00:00
LazyBlockFrequencyInfo.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
LazyBranchProbabilityInfo.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
LazyCallGraph.h [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-08-11 21:30:02 +00:00
LazyValueInfo.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
LegacyDivergenceAnalysis.h [DA] GPUDivergenceAnalysis for unstructured GPU kernels 2018-11-30 22:55:20 +00:00
Lint.h Remove @brief commands from doxygen comments, too. 2018-05-01 16:10:38 +00:00
Loads.h Make visible isDereferenceableAndAlignedPointer(..., const APInt &Size, ...) 2017-06-24 01:35:13 +00:00
LoopAccessAnalysis.h [LAA] Introduce enum for vectorization safety status (NFC). 2018-12-18 22:25:11 +00:00
LoopAnalysisManager.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
LoopInfo.h [LoopInfo] Port loop exit interfaces from Loop to LoopBase 2018-07-09 17:52:49 +00:00
LoopInfoImpl.h llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...) 2018-09-27 02:13:45 +00:00
LoopIterator.h [LV][CFG] Add irreducible CFG detection for outer loops 2018-03-02 12:24:25 +00:00
LoopPass.h Use a BumpPtrAllocator for Loop objects 2017-09-28 02:45:42 +00:00
LoopUnrollAnalyzer.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
MemoryBuiltins.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
MemoryDependenceAnalysis.h Replace most users of UnknownSize with LocationSize::unknown(); NFC 2018-10-10 21:28:44 +00:00
MemoryLocation.h Replace most users of UnknownSize with LocationSize::unknown(); NFC 2018-10-10 21:28:44 +00:00
MemorySSA.h API to update MemorySSA for cloned blocks and added CFG edges. 2018-09-10 20:13:01 +00:00
MemorySSAUpdater.h API to update MemorySSA for cloned blocks and added CFG edges. 2018-09-10 20:13:01 +00:00
ModuleSummaryAnalysis.h [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-08-16 22:07:40 +00:00
MustExecute.h [LICM] Hoist guards from non-header blocks 2018-11-12 09:29:58 +00:00
ObjCARCAliasAnalysis.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
ObjCARCAnalysisUtils.h Change the objc ARC optimizer to use the new objc.* intrinsics 2018-12-18 20:32:49 +00:00
ObjCARCInstKind.h Change the objc ARC optimizer to use the new objc.* intrinsics 2018-12-18 20:32:49 +00:00
OptimizationRemarkEmitter.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
OrderedBasicBlock.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
OrderedInstructions.h [NFC] Move OrderedInstructions and InstructionPrecedenceTracking to Analysis 2018-08-30 04:49:03 +00:00
Passes.h [NFC] Rename the DivergenceAnalysis to LegacyDivergenceAnalysis 2018-08-30 14:21:36 +00:00
PHITransAddr.h [Docs] Escape the @ symbol, so that it appears in documentation output. [NFC] 2018-04-26 21:55:45 +00:00
PhiValues.h [PhiValues] Use callback value handles to invalidate deleted values 2018-08-24 15:48:30 +00:00
PostDominators.h [Dominators] Add PDT constructor from Function 2018-05-23 17:29:21 +00:00
ProfileSummaryInfo.h [ProfileSummary] Standardize methods and fix comment 2018-11-19 05:23:16 +00:00
PtrUseVisitor.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
RegionInfo.h Remove @brief commands from doxygen comments, too. 2018-05-01 16:10:38 +00:00
RegionInfoImpl.h Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
RegionIterator.h Remove @brief commands from doxygen comments, too. 2018-05-01 16:10:38 +00:00
RegionPass.h Remove @brief commands from doxygen comments, too. 2018-05-01 16:10:38 +00:00
RegionPrinter.h Remove @brief commands from doxygen comments, too. 2018-05-01 16:10:38 +00:00
ScalarEvolution.h [NFC] Factor out getOrCreateAddRecExpr method 2018-10-11 08:46:39 +00:00
ScalarEvolutionAliasAnalysis.h [PM] Change the static object whose address is used to uniquely identify 2016-11-23 17:53:26 +00:00
ScalarEvolutionExpander.h [SCEV] Add an expandAddToGEP overload for a single operand. NFC. 2018-07-26 21:55:03 +00:00
ScalarEvolutionExpressions.h Revert "[SCEV] Use LLVM_MARK_AS_BITMASK_ENUM in SCEV." -- breaks MSVC builds. 2018-06-16 00:14:10 +00:00
ScalarEvolutionNormalization.h Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ScopedNoAliasAA.h [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-08-18 23:51:26 +00:00
SparsePropagation.h [TI removal] Remove TerminatorInst from SparsePropagation.h and 2018-10-15 09:47:26 +00:00
StackSafetyAnalysis.h [stack-safety] Empty local passes for Stack Safety Global Analysis 2018-11-26 23:05:48 +00:00
SyncDependenceAnalysis.h [TI removal] Switch some newly added code over to use Instruction 2018-10-19 00:22:10 +00:00
SyntheticCountsUtils.h Remove CallGraphTraits and use equivalent methods in GraphTraits 2018-02-01 19:40:35 +00:00
TargetFolder.h
TargetLibraryInfo.def [GCOV] Flush counters before to avoid counting the execution before fork twice and for exec** functions we must flush before the call 2018-11-07 13:49:17 +00:00
TargetLibraryInfo.h Revert unapproved commit 2018-11-24 07:26:55 +00:00
TargetTransformInfo.h [TTI] Make TargetTransformInfo::getOperandInfo static. NFCI. 2018-11-13 13:45:10 +00:00
TargetTransformInfoImpl.h Add support for llvm.is.constant intrinsic (PR4898) 2018-11-07 15:24:12 +00:00
Trace.h [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-07-21 21:37:46 +00:00
TypeBasedAliasAnalysis.h [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-08-18 23:51:26 +00:00
TypeMetadataUtils.h [WPD] Fix incorrect devirtualization after indirect call promotion 2018-09-27 14:55:32 +00:00
ValueLattice.h [ValueLattice] Return false if value range did not change in mergeIn. 2018-06-27 12:57:51 +00:00
ValueLatticeUtils.h [IPSCCP] Move common functions to ValueLatticeUtils (NFC) 2017-10-13 17:53:44 +00:00
ValueTracking.h [ValueTracking] add helper function for testing implied condition; NFCI 2018-12-02 13:26:03 +00:00
VectorUtils.h [VPlan] VPlan version of InterleavedAccessInfo. 2018-11-13 15:58:18 +00:00