Go to the documentation of this file.
15 #ifndef LLVM_ANALYSIS_DIVERGENCEANALYSIS_H
16 #define LLVM_ANALYSIS_DIVERGENCEANALYSIS_H
28 class TargetTransformInfo;
90 void taintAndPushPhiNodes(
const BasicBlock &JoinBlock);
95 void propagateLoopExitDivergence(
const BasicBlock &DivExit,
99 void analyzeLoopExitDivergence(
const BasicBlock &DivExit,
100 const Loop &OuterDivLoop);
105 const Loop &OuterDivLoop);
108 void pushUsers(
const Value &
I);
111 bool isTemporalDivergent(
const BasicBlock &ObservingBlock,
112 const Value &Val)
const;
118 const Loop *RegionLoop;
139 std::vector<const Instruction *> Worklist;
149 bool ContainsIrreducible =
false;
150 std::unique_ptr<SyncDependenceAnalysis> SDA;
151 std::unique_ptr<DivergenceAnalysisImpl> DA;
160 return ContainsIrreducible || DA->hasDetectedDivergence();
168 return ContainsIrreducible || DA->isDivergent(V);
173 return ContainsIrreducible || DA->isDivergentUse(U);
210 #endif // LLVM_ANALYSIS_DIVERGENCEANALYSIS_H
A set of analyses that are preserved following a run of a transformation pass.
This is an optimization pass for GlobalISel generic memory operations.
bool isDivergentUse(const Use &U) const
Whether U is divergent.
A CRTP mix-in to automatically provide informational APIs needed for passes.
Represents a single loop in the control flow graph.
const Loop * getRegionLoop() const
The loop that defines the analyzed region (if any).
bool isAlwaysUniform(const Value &Val) const
Whether Val will always return a uniform value regardless of its operands.
void addUniformOverride(const Value &UniVal)
Mark UniVal as a value that is always uniform.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
FunctionAnalysisManager FAM
DivergenceInfo(Function &F, const DominatorTree &DT, const PostDominatorTree &PDT, const LoopInfo &LI, const TargetTransformInfo &TTI, bool KnownReducible)
bool inRegion(const BasicBlock &BB) const
Whether BB is part of the region.
Result run(Function &F, FunctionAnalysisManager &AM)
Runs the divergence analysis on @F, a GPU kernel.
bool isUniform(const Value &V) const
Whether V is uniform/non-divergent.
Printer pass to dump divergence analysis results.
void compute()
Propagate divergence to all instructions in the region.
LLVM Basic Block Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
Implements a dense probed hash-table based set.
bool hasDivergence() const
Whether any divergence was detected.
bool isUniformUse(const Use &U) const
Whether U is uniform/non-divergent.
A special type used by analysis passes to provide an address that identifies that particular analysis...
bool isDivergent(const Value &V) const
Whether V is divergent at its definition.
Generic divergence analysis for reducible CFGs.
A CRTP mix-in that provides informational APIs needed for analysis passes.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM)
PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...
bool isDivergentUse(const Use &U) const
Whether U is divergent. Uses of a uniform value can be divergent.
Relates points of divergent control to join points in reducible CFGs.
DivergenceAnalysisImpl(const Function &F, const Loop *RegionLoop, const DominatorTree &DT, const LoopInfo &LI, SyncDependenceAnalysis &SDA, bool IsLCSSAForm)
This instance will analyze the whole function F or the loop RegionLoop.
const Function & getFunction() const
The GPU kernel this analysis result is for.
bool isDivergent(const Value &Val) const
Whether Val is divergent at its definition.
bool hasDetectedDivergence() const
Whether any value was marked or analyzed to be divergent.
Divergence analysis frontend for GPU kernels.
A container for analyses that lazily runs them and caches their results.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
DivergenceAnalysisPrinterPass(raw_ostream &OS)
bool markDivergent(const Value &DivVal)
Mark DivVal as a value that is always divergent.
LLVM Value Representation.
A Use represents the edge between a Value definition and its users.
const Function & getFunction() const