LLVM 17.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.
 
const LoopgetRegionLoop () const
 The loop that defines the analyzed region (if any).
 
const FunctiongetFunction () 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.
 

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 36 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 LCSSA form.

Definition at line 92 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 106 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 312 of file DivergenceAnalysis.cpp.

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

◆ getFunction()

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

Definition at line 51 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 50 of file DivergenceAnalysis.h.

◆ hasDetectedDivergence()

bool llvm::DivergenceAnalysisImpl::hasDetectedDivergence ( ) const
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().

◆ inRegion() [1/2]

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().

◆ inRegion() [2/2]

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().

◆ isAlwaysUniform()

bool DivergenceAnalysisImpl::isAlwaysUniform ( const Value Val) const

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().

◆ isDivergent()

bool DivergenceAnalysisImpl::isDivergent ( const Value Val) const

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().

◆ isDivergentUse()

bool DivergenceAnalysisImpl::isDivergentUse ( const Use U) const

Whether U is divergent.

Uses of a uniform value can be divergent.

Definition at line 340 of file DivergenceAnalysis.cpp.

References 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 98 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: