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

This pass does misc. More...

#include "AMDGPU.h"
#include "AMDGPUSubtarget.h"
#include "AMDGPUTargetMachine.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/LegacyDivergenceAnalysis.h"
#include "llvm/Analysis/Loads.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstVisitor.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Transforms/Utils/IntegerDivision.h"
#include <cassert>
#include <iterator>
Include dependency graph for AMDGPUCodeGenPrepare.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "amdgpu-codegenprepare"
 

Functions

static bool promotedOpIsNSW (const Instruction &I)
 
static bool promotedOpIsNUW (const Instruction &I)
 
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 ValueoptimizeWithRcp (Value *Num, Value *Den, bool AllowInaccurateRcp, bool RcpIsAccurate, IRBuilder<> &Builder, Module *Mod)
 
static ValueoptimizeWithFDivFast (Value *Num, Value *Den, float ReqdAccuracy, bool HasDenormals, IRBuilder<> &Builder, Module *Mod)
 
static bool hasUnsafeFPMath (const Function &F)
 
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)
 
 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 51 of file AMDGPUCodeGenPrepare.cpp.

Referenced by getSign32().

Function Documentation

◆ extractValues()

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

◆ findSelectThroughCast()

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

◆ getMul64()

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

◆ getMulHu()

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

◆ getSign32()

static Value* getSign32 ( Value V,
IRBuilder<> &  Builder,
const DataLayout DL 
)
static

Definition at line 1010 of file AMDGPUCodeGenPrepare.cpp.

References assert(), llvm::BasicBlock::begin(), llvm::Function::begin(), llvm::BitsToFloat(), Builder, llvm::computeKnownBits(), Cond, AMDGPUAS::CONSTANT_ADDRESS, AMDGPUAS::CONSTANT_ADDRESS_32BIT, llvm::Instruction::copyMetadata(), llvm::IRBuilderBase::CreateAdd(), llvm::IRBuilderBase::CreateAShr(), llvm::IRBuilderBase::CreateBinOp(), llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateCall(), llvm::IRBuilderBase::CreateExtractElement(), llvm::IRBuilderBase::CreateFMul(), llvm::IRBuilderBase::CreateFPToUI(), llvm::IRBuilderBase::CreateICmpUGE(), llvm::IRBuilderBase::CreateInsertElement(), llvm::IRBuilderBase::CreateLoad(), llvm::IRBuilderBase::CreateMul(), llvm::IRBuilderBase::CreateSelect(), llvm::IRBuilderBase::CreateSExt(), llvm::IRBuilderBase::CreateSExtOrTrunc(), llvm::IRBuilderBase::CreateSub(), llvm::IRBuilderBase::CreateTrunc(), llvm::IRBuilderBase::CreateUIToFP(), llvm::IRBuilderBase::CreateXor(), llvm::IRBuilderBase::CreateZExt(), llvm::IRBuilderBase::CreateZExtOrTrunc(), DEBUG_TYPE, DL, E, llvm::BasicBlock::end(), llvm::Function::end(), llvm::Instruction::eraseFromParent(), llvm::expandDivisionUpTo64Bits(), llvm::expandRemainderUpTo64Bits(), F(), llvm::ConstantInt::get(), llvm::ConstantFP::get(), llvm::ConstantAsMetadata::get(), llvm::PointerType::get(), llvm::MDNode::get(), llvm::UndefValue::get(), llvm::Constant::getAllOnesValue(), llvm::Instruction::getDebugLoc(), llvm::Intrinsic::getDeclaration(), llvm::IRBuilderBase::getFloatTy(), llvm::IRBuilderBase::getInt32(), llvm::IRBuilderBase::getInt32Ty(), llvm::IRBuilderBase::getIntNTy(), llvm::IntrinsicInst::getIntrinsicID(), llvm::Instruction::getMetadata(), getMulHu(), llvm::Constant::getNullValue(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::LoadInst::getPointerAddressSpace(), llvm::LoadInst::getPointerOperand(), llvm::Type::getScalarSizeInBits(), llvm::TargetMachine::getSubtarget(), llvm::Value::getType(), llvm::ConstantInt::getValue(), hasUnsafeFPMath(), INITIALIZE_PASS_BEGIN(), INITIALIZE_PASS_DEPENDENCY(), llvm::KnownBits::isNegative(), llvm::KnownBits::isNonNegative(), llvm::APInt::isNullValue(), llvm_unreachable, LowAndHigh, llvm::Lower, llvm::Mod, Mode, N, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::Value::replaceAllUsesWith(), runOnFunction(), llvm::IRBuilderBase::SetCurrentDebugLocation(), llvm::FastMathFlags::setFast(), llvm::IRBuilderBase::setFastMathFlags(), llvm::Instruction::setMetadata(), llvm::ARM_MB::ST, llvm::SystemZISD::TM, X, Y, llvm::Z, and llvm::APInt::zext().

◆ hasUnsafeFPMath()

static bool hasUnsafeFPMath ( const Function F)
static

◆ INITIALIZE_PASS_BEGIN()

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

Referenced by getSign32().

◆ insertValues()

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

◆ optimizeWithFDivFast()

static Value* optimizeWithFDivFast ( Value Num,
Value Den,
float  ReqdAccuracy,
bool  HasDenormals,
IRBuilder<> &  Builder,
Module Mod 
)
static

◆ optimizeWithRcp()

static Value* optimizeWithRcp ( Value Num,
Value Den,
bool  AllowInaccurateRcp,
bool  RcpIsAccurate,
IRBuilder<> &  Builder,
Module Mod 
)
static

◆ promotedOpIsNSW()

static bool promotedOpIsNSW ( const Instruction I)
static

◆ promotedOpIsNUW()

static bool promotedOpIsNUW ( const Instruction I)
static

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 1420 of file AMDGPUCodeGenPrepare.cpp.

◆ false

AMDGPU IR false

Definition at line 1420 of file AMDGPUCodeGenPrepare.cpp.

◆ optimizations

AMDGPU IR optimizations

Definition at line 1420 of file AMDGPUCodeGenPrepare.cpp.