LLVM  14.0.0git
Public Member Functions | List of all members
llvm::DivergenceAnalysisImpl Class Reference

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. More...
 
const LoopgetRegionLoop () const
 The loop that defines the analyzed region (if any). More...
 
const FunctiongetFunction () const
 
bool inRegion (const BasicBlock &BB) const
 Whether BB is part of the region. More...
 
bool inRegion (const Instruction &I) const
 Whether I is part of the region. More...
 
void addUniformOverride (const Value &UniVal)
 Mark UniVal as a value that is always uniform. More...
 
bool markDivergent (const Value &DivVal)
 Mark DivVal as a value that is always divergent. More...
 
void compute ()
 Propagate divergence to all instructions in the region. More...
 
bool hasDetectedDivergence () const
 Whether any value was marked or analyzed to be divergent. More...
 
bool isAlwaysUniform (const Value &Val) const
 Whether Val will always return a uniform value regardless of its operands. More...
 
bool isDivergent (const Value &Val) const
 Whether Val is divergent at its definition. More...
 
bool isDivergentUse (const Use &U) const
 Whether U is divergent. More...
 

Detailed Description

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 37 of file DivergenceAnalysis.h.

Constructor & Destructor Documentation

◆ DivergenceAnalysisImpl()

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.

Parameters
RegionLoopif non-null the analysis is restricted to RegionLoop. Otherwise the whole function is analyzed.
IsLCSSAFormwhether the analysis may assume that the IR in the region in in LCSSA form.

Definition at line 93 of file DivergenceAnalysis.cpp.

Member Function Documentation

◆ addUniformOverride()

void DivergenceAnalysisImpl::addUniformOverride ( const Value UniVal)

Mark UniVal as a value that is always uniform.

Definition at line 107 of file DivergenceAnalysis.cpp.

References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert().

◆ compute()

void DivergenceAnalysisImpl::compute ( )

Propagate divergence to all instructions in the region.

Divergence is seeded by calls to markDivergent.

Definition at line 313 of file DivergenceAnalysis.cpp.

References assert(), I, and isDivergent().

◆ getFunction()

const Function& llvm::DivergenceAnalysisImpl::getFunction ( ) const
inline

Definition at line 52 of file DivergenceAnalysis.h.

References F.

◆ getRegionLoop()

const Loop* llvm::DivergenceAnalysisImpl::getRegionLoop ( ) const
inline

The loop that defines the analyzed region (if any).

Definition at line 51 of file DivergenceAnalysis.h.

◆ hasDetectedDivergence()

bool llvm::DivergenceAnalysisImpl::hasDetectedDivergence ( ) const
inline

Whether any value was marked or analyzed to be divergent.

Definition at line 72 of file DivergenceAnalysis.h.

References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::empty().

◆ inRegion() [1/2]

bool DivergenceAnalysisImpl::inRegion ( const BasicBlock BB) const

Whether BB is part of the region.

Definition at line 132 of file DivergenceAnalysis.cpp.

References BB, and llvm::LoopBase< BlockT, LoopT >::contains().

Referenced by inRegion().

◆ inRegion() [2/2]

bool DivergenceAnalysisImpl::inRegion ( const Instruction I) const

Whether I is part of the region.

Definition at line 128 of file DivergenceAnalysis.cpp.

References I, and inRegion().

◆ isAlwaysUniform()

bool DivergenceAnalysisImpl::isAlwaysUniform ( const Value Val) const

Whether Val will always return a uniform value regardless of its operands.

Definition at line 333 of file DivergenceAnalysis.cpp.

References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::contains().

Referenced by markDivergent().

◆ isDivergent()

bool DivergenceAnalysisImpl::isDivergent ( const Value Val) const

Whether Val is divergent at its definition.

Definition at line 337 of file DivergenceAnalysis.cpp.

References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::contains().

Referenced by compute(), and isDivergentUse().

◆ isDivergentUse()

bool DivergenceAnalysisImpl::isDivergentUse ( const Use U) const

Whether U is divergent.

Uses of a uniform value can be divergent.

Definition at line 341 of file DivergenceAnalysis.cpp.

References llvm::Use::get(), llvm::Use::getUser(), I, and isDivergent().

◆ markDivergent()

bool DivergenceAnalysisImpl::markDivergent ( const Value DivVal)

Mark DivVal as a value that is always divergent.

Will not do so if isAlwaysUniform(DivVal).

Returns
Whether the tracked divergence state of DivVal changed.

Definition at line 99 of file DivergenceAnalysis.cpp.

References assert(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), and isAlwaysUniform().


The documentation for this class was generated from the following files: