LLVM 24.0.0git
llvm::AMDGPU::PhiIncomingAnalysis Class Reference

Helper class that determines the relationship between incoming values of a phi in the control flow graph to determine where an incoming value can simply be taken as a scalar lane mask as-is, and where it needs to be merged with another, previously defined lane mask. More...

Public Member Functions

 PhiIncomingAnalysis (MachinePostDominatorTree &PDT, const SIInstrInfo *TII)
bool isSource (MachineBasicBlock &MBB) const
 Returns whether MBB is a source in the induced subgraph of reachable blocks.
ArrayRef< MachineBasicBlock * > predecessors () const
void analyze (MachineBasicBlock &DefBlock, ArrayRef< AMDGPU::Incoming > Incomings)

Detailed Description

Helper class that determines the relationship between incoming values of a phi in the control flow graph to determine where an incoming value can simply be taken as a scalar lane mask as-is, and where it needs to be merged with another, previously defined lane mask.

The approach is as follows:

  • Determine all basic blocks which, starting from the incoming blocks, a wave may reach before entering the def block (the block containing the phi).
  • If an incoming block has no predecessors in this set, we can take the incoming value as a scalar lane mask as-is. – A special case of this is when the def block has a self-loop.
  • Otherwise, the incoming value needs to be merged with a previously defined lane mask.
  • If there is a path into the set of reachable blocks that does not go through an incoming block where we can take the scalar lane mask as-is, we need to invent an available value for the SSAUpdater. Choices are 0 and undef, with differing consequences for how to merge values etc.

TODO: We could use region analysis to quickly skip over SESE regions during the traversal.

Definition at line 111 of file SILowerI1Copies.cpp.

Constructor & Destructor Documentation

◆ PhiIncomingAnalysis()

llvm::AMDGPU::PhiIncomingAnalysis::PhiIncomingAnalysis ( MachinePostDominatorTree & PDT,
const SIInstrInfo * TII )
inline

Definition at line 122 of file SILowerI1Copies.cpp.

Member Function Documentation

◆ analyze()

void llvm::AMDGPU::PhiIncomingAnalysis::analyze ( MachineBasicBlock & DefBlock,
ArrayRef< AMDGPU::Incoming > Incomings )
inline

◆ isSource()

bool llvm::AMDGPU::PhiIncomingAnalysis::isSource ( MachineBasicBlock & MBB) const
inline

Returns whether MBB is a source in the induced subgraph of reachable blocks.

Definition at line 127 of file SILowerI1Copies.cpp.

References MBB.

Referenced by llvm::AMDGPU::PhiLoweringHelper::mergeIncomingLaneMasks().

◆ predecessors()

ArrayRef< MachineBasicBlock * > llvm::AMDGPU::PhiIncomingAnalysis::predecessors ( ) const
inline

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