| LLVM 22.0.0git
    | 
This pass simplifies certain intrinsic calls when the arguments are uniform. More...
#include "AMDGPU.h"#include "GCNSubtarget.h"#include "llvm/Analysis/DomTreeUpdater.h"#include "llvm/Analysis/LoopInfo.h"#include "llvm/Analysis/ScalarEvolution.h"#include "llvm/Analysis/TargetLibraryInfo.h"#include "llvm/Analysis/UniformityAnalysis.h"#include "llvm/CodeGen/TargetPassConfig.h"#include "llvm/IR/IRBuilder.h"#include "llvm/IR/InstIterator.h"#include "llvm/IR/InstVisitor.h"#include "llvm/IR/IntrinsicsAMDGPU.h"#include "llvm/IR/PatternMatch.h"#include "llvm/InitializePasses.h"#include "llvm/Target/TargetMachine.h"#include "llvm/Transforms/Utils/BasicBlockUtils.h"Go to the source code of this file.
| Macros | |
| #define | DEBUG_TYPE "amdgpu-uniform-intrinsic-combine" | 
| Functions | |
| static bool | isDivergentUseWithNew (const Use &U, const UniformityInfo &UI, const ValueMap< const Value *, bool > &Tracker) | 
| Wrapper for querying uniformity info that first checks locally tracked instructions. | |
| static bool | optimizeUniformIntrinsic (IntrinsicInst &II, const UniformityInfo &UI, ValueMap< const Value *, bool > &Tracker) | 
| Optimizes uniform intrinsics calls if their operand can be proven uniform. | |
| static bool | runUniformIntrinsicCombine (Function &F, const UniformityInfo &UI) | 
| Iterates over intrinsic calls in the Function to optimize. | |
| INITIALIZE_PASS_BEGIN (AMDGPUUniformIntrinsicCombineLegacy, DEBUG_TYPE, "AMDGPU Uniform Intrinsic Combine", false, false) INITIALIZE_PASS_END(AMDGPUUniformIntrinsicCombineLegacy | |
| Variables | |
| DEBUG_TYPE | |
| AMDGPU Uniform Intrinsic | Combine | 
| AMDGPU Uniform Intrinsic | false | 
This pass simplifies certain intrinsic calls when the arguments are uniform.
It's true that this pass has transforms that can lead to a situation where some instruction whose operand was previously recognized as statically uniform is later on no longer recognized as statically uniform. However, the semantics of how programs execute don't (and must not, for this precise reason) care about static uniformity, they only ever care about dynamic uniformity. And every instruction that's downstream and cares about dynamic uniformity must be convergent (and isel will introduce v_readfirstlane for them if their operands can't be proven statically uniform).
Definition in file AMDGPUUniformIntrinsicCombine.cpp.
| #define DEBUG_TYPE "amdgpu-uniform-intrinsic-combine" | 
Definition at line 38 of file AMDGPUUniformIntrinsicCombine.cpp.
| INITIALIZE_PASS_BEGIN | ( | AMDGPUUniformIntrinsicCombineLegacy | , | 
| DEBUG_TYPE | , | ||
| "AMDGPU Uniform Intrinsic Combine" | , | ||
| false | , | ||
| false | ) | 
References DEBUG_TYPE, and INITIALIZE_PASS_DEPENDENCY.
| 
 | static | 
Wrapper for querying uniformity info that first checks locally tracked instructions.
Definition at line 47 of file AMDGPUUniformIntrinsicCombine.cpp.
References llvm::ValueMap< KeyT, ValueT, Config >::end(), llvm::ValueMap< KeyT, ValueT, Config >::find(), and llvm::GenericUniformityInfo< ContextT >::isDivergentUse().
Referenced by optimizeUniformIntrinsic().
| 
 | static | 
Optimizes uniform intrinsics calls if their operand can be proven uniform.
Definition at line 56 of file AMDGPUUniformIntrinsicCombine.cpp.
References Changed, llvm::BinaryOperator::CreateNot(), llvm::dbgs(), llvm::dyn_cast(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, II, isDivergentUseWithNew(), LLVM_DEBUG, llvm_unreachable, llvm::PatternMatch::m_Zero(), llvm::make_early_inc_range(), and llvm::PatternMatch::match().
Referenced by runUniformIntrinsicCombine().
| 
 | static | 
Iterates over intrinsic calls in the Function to optimize.
Definition at line 116 of file AMDGPUUniformIntrinsicCombine.cpp.
References llvm::dyn_cast(), F, I, II, instructions, llvm::make_early_inc_range(), and optimizeUniformIntrinsic().
Referenced by llvm::AMDGPUUniformIntrinsicCombinePass::run().
| AMDGPU Uniform Intrinsic Combine | 
Definition at line 187 of file AMDGPUUniformIntrinsicCombine.cpp.
| DEBUG_TYPE | 
Definition at line 186 of file AMDGPUUniformIntrinsicCombine.cpp.
| AMDGPU Uniform Intrinsic false | 
Definition at line 187 of file AMDGPUUniformIntrinsicCombine.cpp.