LLVM 22.0.0git
AMDGPUCodeGenPrepare.cpp File Reference

This pass does misc. More...

Go to the source code of this file.

Classes

class  VectorSlice
 Helper class for "break large PHIs" (visitPHINode). More...

Macros

#define DEBUG_TYPE   "amdgpu-codegenprepare"

Functions

static void extractValues (IRBuilder<> &Builder, SmallVectorImpl< Value * > &Values, Value *V)
static ValueinsertValues (IRBuilder<> &Builder, Type *Ty, SmallVectorImpl< Value * > &Values)
static SelectInstfindSelectThroughCast (Value *V, CastInst *&Cast)
static ValueemitRsqIEEE1ULP (IRBuilder<> &Builder, Value *Src, bool IsNegative)
 Emit an expansion of 1.0 / sqrt(Src) good for 1ulp that supports denormals.
static std::pair< Value *, Value * > getMul64 (IRBuilder<> &Builder, Value *LHS, Value *RHS)
static ValuegetMulHu (IRBuilder<> &Builder, Value *LHS, Value *RHS)
static ValuegetSign32 (Value *V, IRBuilder<> &Builder, const DataLayout DL)
static bool tryNarrowMathIfNoOverflow (Instruction *I, const SITargetLowering *TLI, const TargetTransformInfo &TTI, const DataLayout &DL)
static bool areInSameBB (const Value *A, const Value *B)
static bool isInterestingPHIIncomingValue (const Value *V)
static void collectPHINodes (const PHINode &I, SmallPtrSet< const PHINode *, 8 > &SeenPHIs)
static bool isPtrKnownNeverNull (const Value *V, const DataLayout &DL, const AMDGPUTargetMachine &TM, unsigned AS)
static bool isOneOrNegOne (const Value *Val)
 INITIALIZE_PASS_BEGIN (AMDGPUCodeGenPrepare, DEBUG_TYPE, "AMDGPU IR optimizations", false, false) INITIALIZE_PASS_END(AMDGPUCodeGenPrepare

Variables

 DEBUG_TYPE
AMDGPU IR optimizations
AMDGPU IR false

Detailed Description

This pass does misc.

AMDGPU optimizations on IR before instruction selection.

Definition in file AMDGPUCodeGenPrepare.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "amdgpu-codegenprepare"

Definition at line 37 of file AMDGPUCodeGenPrepare.cpp.

Function Documentation

◆ areInSameBB()

bool areInSameBB ( const Value * A,
const Value * B )
static

Definition at line 1541 of file AMDGPUCodeGenPrepare.cpp.

References A(), B(), and llvm::dyn_cast().

Referenced by isInterestingPHIIncomingValue().

◆ collectPHINodes()

void collectPHINodes ( const PHINode & I,
SmallPtrSet< const PHINode *, 8 > & SeenPHIs )
static

◆ emitRsqIEEE1ULP()

Value * emitRsqIEEE1ULP ( IRBuilder<> & Builder,
Value * Src,
bool IsNegative )
static

Emit an expansion of 1.0 / sqrt(Src) good for 1ulp that supports denormals.

Definition at line 601 of file AMDGPUCodeGenPrepare.cpp.

References llvm::APFloat::getSmallestNormalized().

◆ extractValues()

void extractValues ( IRBuilder<> & Builder,
SmallVectorImpl< Value * > & Values,
Value * V )
static

◆ findSelectThroughCast()

SelectInst * findSelectThroughCast ( Value * V,
CastInst *& Cast )
static

Definition at line 432 of file AMDGPUCodeGenPrepare.cpp.

References llvm::dyn_cast(), and llvm::User::getOperand().

◆ getMul64()

std::pair< Value *, Value * > getMul64 ( IRBuilder<> & Builder,
Value * LHS,
Value * RHS )
static

Definition at line 904 of file AMDGPUCodeGenPrepare.cpp.

References llvm::Type::getInt32Ty(), llvm::Type::getInt64Ty(), llvm::Hi, LHS, llvm::Lo, and RHS.

Referenced by getMulHu().

◆ getMulHu()

Value * getMulHu ( IRBuilder<> & Builder,
Value * LHS,
Value * RHS )
static

Definition at line 918 of file AMDGPUCodeGenPrepare.cpp.

References getMul64(), LHS, and RHS.

◆ getSign32()

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( AMDGPUCodeGenPrepare ,
DEBUG_TYPE ,
"AMDGPU IR optimizations" ,
false ,
false  )

◆ insertValues()

Value * insertValues ( IRBuilder<> & Builder,
Type * Ty,
SmallVectorImpl< Value * > & Values )
static

◆ isInterestingPHIIncomingValue()

bool isInterestingPHIIncomingValue ( const Value * V)
static

◆ isOneOrNegOne()

bool isOneOrNegOne ( const Value * Val)
static

◆ isPtrKnownNeverNull()

bool isPtrKnownNeverNull ( const Value * V,
const DataLayout & DL,
const AMDGPUTargetMachine & TM,
unsigned AS )
static
Parameters
VValue to check
DLDataLayout
TMTargetMachine (TODO: remove once DL contains nullptr values)
ASTarget Address Space
Returns
true if V cannot be the null value of AS, false otherwise.

Definition at line 1834 of file AMDGPUCodeGenPrepare.cpp.

References assert(), llvm::cast(), llvm::computeKnownBits(), DL, llvm::dyn_cast(), and llvm::isa().

◆ tryNarrowMathIfNoOverflow()

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 2113 of file AMDGPUCodeGenPrepare.cpp.

◆ false

AMDGPU IR false

Definition at line 2114 of file AMDGPUCodeGenPrepare.cpp.

◆ optimizations

AMDGPU IR optimizations

Definition at line 2113 of file AMDGPUCodeGenPrepare.cpp.