LLVM  12.0.0git
Macros | Functions | Variables
AMDGPUAtomicOptimizer.cpp File Reference

This pass optimizes atomic operations by using a single lane of a wavefront to perform the atomic operation, thus reducing contention on that memory location. More...

#include "AMDGPU.h"
#include "AMDGPUSubtarget.h"
#include "SIDefines.h"
#include "llvm/Analysis/LegacyDivergenceAnalysis.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstVisitor.h"
#include "llvm/InitializePasses.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
Include dependency graph for AMDGPUAtomicOptimizer.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "amdgpu-atomic-optimizer"
 

Functions

static ValuebuildNonAtomicBinOp (IRBuilder<> &B, AtomicRMWInst::BinOp Op, Value *LHS, Value *RHS)
 
static APInt getIdentityValueForAtomicOp (AtomicRMWInst::BinOp Op, unsigned BitWidth)
 
 INITIALIZE_PASS_BEGIN (AMDGPUAtomicOptimizer, DEBUG_TYPE, "AMDGPU atomic optimizations", false, false) INITIALIZE_PASS_END(AMDGPUAtomicOptimizer
 

Variables

 DEBUG_TYPE
 
AMDGPU atomic optimizations
 
AMDGPU atomic false
 

Detailed Description

This pass optimizes atomic operations by using a single lane of a wavefront to perform the atomic operation, thus reducing contention on that memory location.

Definition in file AMDGPUAtomicOptimizer.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "amdgpu-atomic-optimizer"

Definition at line 26 of file AMDGPUAtomicOptimizer.cpp.

Referenced by getIdentityValueForAtomicOp().

Function Documentation

◆ buildNonAtomicBinOp()

static Value* buildNonAtomicBinOp ( IRBuilder<> &  B,
AtomicRMWInst::BinOp  Op,
Value LHS,
Value RHS 
)
static

◆ getIdentityValueForAtomicOp()

static APInt getIdentityValueForAtomicOp ( AtomicRMWInst::BinOp  Op,
unsigned  BitWidth 
)
static

Definition at line 386 of file AMDGPUAtomicOptimizer.cpp.

References llvm::AtomicRMWInst::Add, llvm::PHINode::addIncoming(), llvm::AtomicRMWInst::And, B, buildNonAtomicBinOp(), llvm::Instruction::clone(), Cond, llvm::IRBuilderBase::CreateAnd(), llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateExtractElement(), llvm::IRBuilderBase::CreateICmpEQ(), llvm::IRBuilderBase::CreateInsertElement(), llvm::IRBuilderBase::CreateIntCast(), llvm::IRBuilderBase::CreateIntrinsic(), llvm::IRBuilderBase::CreateLShr(), llvm::IRBuilderBase::CreateMul(), llvm::IRBuilderBase::CreatePHI(), llvm::IRBuilderBase::CreateSelect(), llvm::IRBuilderBase::CreateTrunc(), llvm::IRBuilderBase::CreateUnaryIntrinsic(), DEBUG_TYPE, DL, llvm::Instruction::eraseFromParent(), llvm::FixedVectorType::get(), llvm::UndefValue::get(), llvm::BasicBlock::getFirstNonPHI(), llvm::IRBuilderBase::getInt(), llvm::IRBuilderBase::getInt32(), llvm::IRBuilderBase::getInt32Ty(), llvm::IRBuilderBase::getIntN(), llvm::IRBuilderBase::getIntNTy(), llvm::APInt::getMaxValue(), llvm::APInt::getMinValue(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), llvm::IRBuilderBase::getTrue(), llvm::Value::getType(), INITIALIZE_PASS_BEGIN(), INITIALIZE_PASS_DEPENDENCY(), llvm::IRBuilderBase::Insert(), llvm_unreachable, llvm::AtomicRMWInst::Max, llvm::AtomicRMWInst::Min, llvm::Instruction::moveBefore(), llvm::AtomicRMWInst::Or, llvm::Value::replaceAllUsesWith(), llvm::IRBuilderBase::SetInsertPoint(), llvm::User::setOperand(), llvm::SplitBlockAndInsertIfThen(), llvm::ARM_MB::ST, llvm::AtomicRMWInst::Sub, llvm::AtomicRMWInst::UMax, llvm::AtomicRMWInst::UMin, llvm::Value::use_empty(), and llvm::AtomicRMWInst::Xor.

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( AMDGPUAtomicOptimizer  ,
DEBUG_TYPE  ,
"AMDGPU atomic optimizations ,
false  ,
false   
)

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 664 of file AMDGPUAtomicOptimizer.cpp.

◆ false

AMDGPU atomic false

Definition at line 664 of file AMDGPUAtomicOptimizer.cpp.

◆ optimizations

AMDGPU atomic optimizations

Definition at line 664 of file AMDGPUAtomicOptimizer.cpp.