LLVM 20.0.0git
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::GenericUniformityAnalysisImpl< ContextT > Class Template Reference

Analysis that identifies uniform values in a data-parallel execution. More...

#include "llvm/ADT/GenericUniformityImpl.h"

Classes

struct  PhiInput
 Value/block pair representing a single phi input. More...
 

Public Types

using BlockT = typename ContextT::BlockT
 
using FunctionT = typename ContextT::FunctionT
 
using ValueRefT = typename ContextT::ValueRefT
 
using ConstValueRefT = typename ContextT::ConstValueRefT
 
using UseT = typename ContextT::UseT
 
using InstructionT = typename ContextT::InstructionT
 
using DominatorTreeT = typename ContextT::DominatorTreeT
 
using CycleInfoT = GenericCycleInfo< ContextT >
 
using CycleT = typename CycleInfoT::CycleT
 
using SyncDependenceAnalysisT = GenericSyncDependenceAnalysis< ContextT >
 
using DivergenceDescriptorT = typename SyncDependenceAnalysisT::DivergenceDescriptor
 
using BlockLabelMapT = typename SyncDependenceAnalysisT::BlockLabelMap
 

Public Member Functions

 GenericUniformityAnalysisImpl (const DominatorTreeT &DT, const CycleInfoT &CI, const TargetTransformInfo *TTI)
 
void initialize ()
 
const FunctionTgetFunction () const
 
void addUniformOverride (const InstructionT &Instr)
 Mark UniVal as a value that is always uniform.
 
void markDivergent (const InstructionT &I)
 Examine I for divergent outputs and add to the worklist.
 
bool markDivergent (ConstValueRefT DivVal)
 Mark DivVal as a divergent value.
 
bool markDefsDivergent (const InstructionT &Instr)
 Mark outputs of Instr as divergent.
 
void compute ()
 Propagate divergence to all instructions in the region.
 
bool hasDivergence () const
 Whether any value was marked or analyzed to be divergent.
 
bool isAlwaysUniform (const InstructionT &Instr) const
 Whether Val will always return a uniform value regardless of its operands.
 
bool hasDivergentDefs (const InstructionT &I) const
 
bool isDivergent (const InstructionT &I) const
 
bool isDivergent (ConstValueRefT V) const
 Whether Val is divergent at its definition.
 
bool isDivergentUse (const UseT &U) const
 
bool hasDivergentTerminator (const BlockT &B) const
 
void print (raw_ostream &out) const
 
bool hasDivergentDefs (const Instruction &I) const
 
bool markDefsDivergent (const Instruction &Instr)
 
void initialize ()
 
bool isDivergentUse (const Use &U) const
 
bool hasDivergentDefs (const MachineInstr &I) const
 
bool markDefsDivergent (const MachineInstr &Instr)
 
void initialize ()
 
bool isDivergentUse (const MachineOperand &U) const
 

Protected Member Functions

void analyzeControlDivergence (const InstructionT &Term)
 Mark Term as divergent and push all Instructions that become divergent as a result on the worklist.
 

Protected Attributes

const ContextT & Context
 
const FunctionTF
 
const CycleInfoTCI
 
const TargetTransformInfoTTI = nullptr
 
DenseSet< ConstValueRefTDivergentValues
 
SmallPtrSet< const BlockT *, 32 > DivergentTermBlocks
 
std::vector< const InstructionT * > Worklist
 

Detailed Description

template<typename ContextT>
class llvm::GenericUniformityAnalysisImpl< ContextT >

Analysis that identifies uniform values in a data-parallel execution.

This analysis propagates divergence in a data-parallel context from sources of divergence to all users. It can be instantiated for an IR that provides a suitable SSAContext.

Definition at line 327 of file GenericUniformityImpl.h.

Member Typedef Documentation

◆ BlockLabelMapT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::BlockLabelMapT = typename SyncDependenceAnalysisT::BlockLabelMap

Definition at line 343 of file GenericUniformityImpl.h.

◆ BlockT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::BlockT = typename ContextT::BlockT

Definition at line 329 of file GenericUniformityImpl.h.

◆ ConstValueRefT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::ConstValueRefT = typename ContextT::ConstValueRefT

Definition at line 332 of file GenericUniformityImpl.h.

◆ CycleInfoT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::CycleInfoT = GenericCycleInfo<ContextT>

Definition at line 337 of file GenericUniformityImpl.h.

◆ CycleT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::CycleT = typename CycleInfoT::CycleT

Definition at line 338 of file GenericUniformityImpl.h.

◆ DivergenceDescriptorT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::DivergenceDescriptorT = typename SyncDependenceAnalysisT::DivergenceDescriptor

Definition at line 341 of file GenericUniformityImpl.h.

◆ DominatorTreeT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::DominatorTreeT = typename ContextT::DominatorTreeT

Definition at line 335 of file GenericUniformityImpl.h.

◆ FunctionT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::FunctionT = typename ContextT::FunctionT

Definition at line 330 of file GenericUniformityImpl.h.

◆ InstructionT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::InstructionT = typename ContextT::InstructionT

Definition at line 334 of file GenericUniformityImpl.h.

◆ SyncDependenceAnalysisT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::SyncDependenceAnalysisT = GenericSyncDependenceAnalysis<ContextT>

Definition at line 340 of file GenericUniformityImpl.h.

◆ UseT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::UseT = typename ContextT::UseT

Definition at line 333 of file GenericUniformityImpl.h.

◆ ValueRefT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::ValueRefT = typename ContextT::ValueRefT

Definition at line 331 of file GenericUniformityImpl.h.

Constructor & Destructor Documentation

◆ GenericUniformityAnalysisImpl()

template<typename ContextT >
llvm::GenericUniformityAnalysisImpl< ContextT >::GenericUniformityAnalysisImpl ( const DominatorTreeT DT,
const CycleInfoT CI,
const TargetTransformInfo TTI 
)
inline

Definition at line 345 of file GenericUniformityImpl.h.

Member Function Documentation

◆ addUniformOverride()

template<typename ContextT >
void llvm::GenericUniformityAnalysisImpl< ContextT >::addUniformOverride ( const InstructionT Instr)

Mark UniVal as a value that is always uniform.

Definition at line 811 of file GenericUniformityImpl.h.

◆ analyzeControlDivergence()

template<typename ContextT >
void llvm::GenericUniformityAnalysisImpl< ContextT >::analyzeControlDivergence ( const InstructionT Term)
protected

Mark Term as divergent and push all Instructions that become divergent as a result on the worklist.

Definition at line 1049 of file GenericUniformityImpl.h.

References A, assert(), B, llvm::CallingConv::C, llvm::dbgs(), llvm::getOutermostDivergentCycle(), llvm::insertIfNotContained(), LLVM_DEBUG, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::sort().

◆ compute()

template<typename ContextT >
void llvm::GenericUniformityAnalysisImpl< ContextT >::compute

Propagate divergence to all instructions in the region.

Divergence is seeded by calls to markDivergent.

Definition at line 1105 of file GenericUniformityImpl.h.

References assert(), llvm::dbgs(), I, and LLVM_DEBUG.

◆ getFunction()

template<typename ContextT >
const FunctionT & llvm::GenericUniformityAnalysisImpl< ContextT >::getFunction ( ) const
inline

◆ hasDivergence()

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::hasDivergence ( ) const
inline

Whether any value was marked or analyzed to be divergent.

Definition at line 373 of file GenericUniformityImpl.h.

References llvm::GenericUniformityAnalysisImpl< ContextT >::DivergentValues, and llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::empty().

◆ hasDivergentDefs() [1/3]

Definition at line 22 of file UniformityAnalysis.cpp.

References I.

◆ hasDivergentDefs() [2/3]

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::hasDivergentDefs ( const InstructionT I) const

◆ hasDivergentDefs() [3/3]

Definition at line 21 of file MachineUniformityAnalysis.cpp.

References I, and op.

◆ hasDivergentTerminator()

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::hasDivergentTerminator ( const BlockT B) const
inline

◆ initialize() [1/3]

template<typename ContextT >
void llvm::GenericUniformityAnalysisImpl< ContextT >::initialize ( )

◆ initialize() [2/3]

◆ initialize() [3/3]

Definition at line 49 of file MachineUniformityAnalysis.cpp.

References block, F, instr, and uniformity.

◆ isAlwaysUniform()

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::isAlwaysUniform ( const InstructionT Instr) const

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

Definition at line 1133 of file GenericUniformityImpl.h.

◆ isDivergent() [1/2]

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::isDivergent ( const InstructionT I) const
inline

◆ isDivergent() [2/2]

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::isDivergent ( ConstValueRefT  V) const
inline

◆ isDivergentUse() [1/3]

Definition at line 131 of file MachineUniformityAnalysis.cpp.

References F.

◆ isDivergentUse() [2/3]

bool llvm::GenericUniformityAnalysisImpl< SSAContext >::isDivergentUse ( const Use U) const

Definition at line 94 of file UniformityAnalysis.cpp.

◆ isDivergentUse() [3/3]

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::isDivergentUse ( const UseT U) const

◆ markDefsDivergent() [1/3]

Definition at line 28 of file UniformityAnalysis.cpp.

◆ markDefsDivergent() [2/3]

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::markDefsDivergent ( const InstructionT Instr)

Mark outputs of Instr as divergent.

Returns
Whether the tracked divergence state of any output has changed.

◆ markDefsDivergent() [3/3]

Definition at line 31 of file MachineUniformityAnalysis.cpp.

References assert(), F, MRI, op, and TRI.

◆ markDivergent() [1/2]

template<typename ContextT >
void llvm::GenericUniformityAnalysisImpl< ContextT >::markDivergent ( const InstructionT I)

Examine I for divergent outputs and add to the worklist.

Definition at line 781 of file GenericUniformityImpl.h.

References llvm::dbgs(), I, and LLVM_DEBUG.

◆ markDivergent() [2/2]

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::markDivergent ( ConstValueRefT  DivVal)

Mark DivVal as a divergent value.

Returns
Whether the tracked divergence state of DivVal changed.

Definition at line 801 of file GenericUniformityImpl.h.

References llvm::dbgs(), and LLVM_DEBUG.

◆ print()

template<typename ContextT >
void llvm::GenericUniformityAnalysisImpl< ContextT >::print ( raw_ostream out) const

Definition at line 1146 of file GenericUniformityImpl.h.

References block, F, OS, and value.

Member Data Documentation

◆ CI

template<typename ContextT >
const CycleInfoT& llvm::GenericUniformityAnalysisImpl< ContextT >::CI
protected

Definition at line 411 of file GenericUniformityImpl.h.

◆ Context

template<typename ContextT >
const ContextT& llvm::GenericUniformityAnalysisImpl< ContextT >::Context
protected

Definition at line 409 of file GenericUniformityImpl.h.

◆ DivergentTermBlocks

template<typename ContextT >
SmallPtrSet<const BlockT *, 32> llvm::GenericUniformityAnalysisImpl< ContextT >::DivergentTermBlocks
protected

◆ DivergentValues

template<typename ContextT >
DenseSet<ConstValueRefT> llvm::GenericUniformityAnalysisImpl< ContextT >::DivergentValues
protected

◆ F

template<typename ContextT >
const FunctionT& llvm::GenericUniformityAnalysisImpl< ContextT >::F
protected

◆ TTI

template<typename ContextT >
const TargetTransformInfo* llvm::GenericUniformityAnalysisImpl< ContextT >::TTI = nullptr
protected

Definition at line 412 of file GenericUniformityImpl.h.

◆ Worklist

template<typename ContextT >
std::vector<const InstructionT *> llvm::GenericUniformityAnalysisImpl< ContextT >::Worklist
protected

Definition at line 419 of file GenericUniformityImpl.h.


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