LLVM  8.0.0svn
Public Member Functions | List of all members
llvm::DivergenceAnalysis Class Reference

Generic divergence analysis for reducible CFGs. More...

#include "llvm/Analysis/DivergenceAnalysis.h"

Public Member Functions

 DivergenceAnalysis (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...
 
void 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 a divergent value. More...
 
void print (raw_ostream &OS, const Module *) const
 

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

Constructor & Destructor Documentation

◆ DivergenceAnalysis()

DivergenceAnalysis::DivergenceAnalysis ( 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 95 of file DivergenceAnalysis.cpp.

Member Function Documentation

◆ addUniformOverride()

void DivergenceAnalysis::addUniformOverride ( const Value UniVal)

◆ compute()

void DivergenceAnalysis::compute ( )

Propagate divergence to all instructions in the region.

Divergence is seeded by calls to markDivergent.

Definition at line 364 of file DivergenceAnalysis.cpp.

References llvm::dyn_cast(), I, isAlwaysUniform(), isDivergent(), llvm::Instruction::isTerminator(), and markDivergent().

Referenced by getFunction().

◆ getFunction()

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

Definition at line 53 of file DivergenceAnalysis.h.

References addUniformOverride(), compute(), I, inRegion(), and markDivergent().

◆ getRegionLoop()

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

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

Definition at line 52 of file DivergenceAnalysis.h.

◆ hasDetectedDivergence()

bool llvm::DivergenceAnalysis::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(), isAlwaysUniform(), isDivergent(), and print().

◆ inRegion() [1/2]

bool DivergenceAnalysis::inRegion ( const BasicBlock BB) const

◆ inRegion() [2/2]

bool DivergenceAnalysis::inRegion ( const Instruction I) const

Whether I is part of the region.

Definition at line 180 of file DivergenceAnalysis.cpp.

References llvm::Instruction::getParent(), and inRegion().

◆ isAlwaysUniform()

bool DivergenceAnalysis::isAlwaysUniform ( const Value Val) const

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

Definition at line 408 of file DivergenceAnalysis.cpp.

References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::end(), and llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::find().

Referenced by compute(), hasDetectedDivergence(), inRegion(), and markDivergent().

◆ isDivergent()

bool DivergenceAnalysis::isDivergent ( const Value Val) const

◆ markDivergent()

void DivergenceAnalysis::markDivergent ( const Value DivVal)

Mark DivVal as a value that is always divergent.

Definition at line 101 of file DivergenceAnalysis.cpp.

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

Referenced by compute(), getFunction(), and inRegion().

◆ print()

void DivergenceAnalysis::print ( raw_ostream OS,
const Module  
) const

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