LLVM 17.0.0git
|
Generic divergence analysis for reducible CFGs. More...
#include "llvm/Analysis/DivergenceAnalysis.h"
Public Member Functions | |
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 Loop * | getRegionLoop () const |
The loop that defines the analyzed region (if any). | |
const Function & | getFunction () const |
bool | inRegion (const BasicBlock &BB) const |
Whether BB is part of the region. | |
bool | inRegion (const Instruction &I) const |
Whether I is part of the region. | |
void | addUniformOverride (const Value &UniVal) |
Mark UniVal as a value that is always uniform. | |
bool | markDivergent (const Value &DivVal) |
Mark DivVal as a value that is always divergent. | |
void | compute () |
Propagate divergence to all instructions in the region. | |
bool | hasDetectedDivergence () const |
Whether any value was marked or analyzed to be divergent. | |
bool | isAlwaysUniform (const Value &Val) const |
Whether Val will always return a uniform value regardless of its operands. | |
bool | isDivergent (const Value &Val) const |
Whether Val is divergent at its definition. | |
bool | isDivergentUse (const Use &U) const |
Whether U is divergent. | |
Generic divergence analysis for reducible CFGs.
This analysis propagates divergence in a data-parallel context from sources of divergence to all users. It requires reducible CFGs. All assignments should be in SSA form.
Definition at line 36 of file DivergenceAnalysis.h.
DivergenceAnalysisImpl::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
.
RegionLoop | if non-null the analysis is restricted to RegionLoop . Otherwise the whole function is analyzed. |
IsLCSSAForm | whether the analysis may assume that the IR in the region in LCSSA form. |
Definition at line 92 of file DivergenceAnalysis.cpp.
Mark UniVal
as a value that is always uniform.
Definition at line 106 of file DivergenceAnalysis.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert().
void DivergenceAnalysisImpl::compute | ( | ) |
Propagate divergence to all instructions in the region.
Divergence is seeded by calls to markDivergent
.
Definition at line 312 of file DivergenceAnalysis.cpp.
References assert(), I, and isDivergent().
Definition at line 51 of file DivergenceAnalysis.h.
References F.
The loop that defines the analyzed region (if any).
Definition at line 50 of file DivergenceAnalysis.h.
|
inline |
Whether any value was marked or analyzed to be divergent.
Definition at line 71 of file DivergenceAnalysis.h.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::empty().
bool DivergenceAnalysisImpl::inRegion | ( | const BasicBlock & | BB | ) | const |
Whether BB
is part of the region.
Definition at line 131 of file DivergenceAnalysis.cpp.
References llvm::LoopBase< BlockT, LoopT >::contains(), and llvm::BasicBlock::getParent().
Referenced by inRegion().
bool DivergenceAnalysisImpl::inRegion | ( | const Instruction & | I | ) | const |
Whether I
is part of the region.
Definition at line 127 of file DivergenceAnalysis.cpp.
References I, and inRegion().
Whether Val
will always return a uniform value regardless of its operands.
Definition at line 332 of file DivergenceAnalysis.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::contains().
Referenced by markDivergent().
Whether Val
is divergent at its definition.
Definition at line 336 of file DivergenceAnalysis.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::contains().
Referenced by compute(), and isDivergentUse().
Whether U
is divergent.
Uses of a uniform value can be divergent.
Definition at line 340 of file DivergenceAnalysis.cpp.
References I, and isDivergent().
Mark DivVal
as a value that is always divergent.
Will not do so if isAlwaysUniform(DivVal)
.
DivVal
changed. Definition at line 98 of file DivergenceAnalysis.cpp.
References assert(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), and isAlwaysUniform().