38#include "llvm/IR/IntrinsicsAMDGPU.h"
44#define DEBUG_TYPE "amdgpu-uniform-intrinsic-combine"
56 if (
auto It = Tracker.
find(V); It != Tracker.
end())
68 case Intrinsic::amdgcn_permlane64:
69 case Intrinsic::amdgcn_readfirstlane:
70 case Intrinsic::amdgcn_readlane: {
71 Value *Src =
II.getArgOperand(0);
75 II.replaceAllUsesWith(Src);
79 case Intrinsic::amdgcn_ballot: {
80 Value *Src =
II.getArgOperand(0);
88 Value *Op0 = ICmp->getOperand(0);
89 Value *Op1 = ICmp->getOperand(1);
91 Value *OtherOp = Op0 == &
II ? Op1 : Op0;
97 Tracker[NotOp] =
true;
99 ICmp->replaceAllUsesWith(NotOp);
100 ICmp->eraseFromParent();
106 ICmp->replaceAllUsesWith(Src);
107 ICmp->eraseFromParent();
114 II.eraseFromParent();
125 bool IsChanged =
false;
131 switch (
F.getIntrinsicID()) {
132 case Intrinsic::amdgcn_permlane64:
133 case Intrinsic::amdgcn_readfirstlane:
134 case Intrinsic::amdgcn_readlane:
135 case Intrinsic::amdgcn_ballot:
AMD GCN specific subclass of TargetSubtarget.
uint64_t IntrinsicInst * II
FunctionAnalysisManager FAM
Target-Independent Code Generator Pass Configuration Options pass.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
static LLVM_ABI BinaryOperator * CreateNot(Value *Op, const Twine &Name="", InsertPosition InsertBefore=nullptr)
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
A wrapper class for inspecting calls to intrinsic functions.
A Module instance is used to store all the information related to an LLVM module.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserve()
Mark an analysis as preserved.
A Use represents the edge between a Value definition and its users.
iterator find(const KeyT &Val)
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool match(Val *V, const Pattern &P)
is_zero m_Zero()
Match any null constant or a vector with all elements equal to 0.
This is an optimization pass for GlobalISel generic memory operations.
GenericUniformityInfo< SSAContext > UniformityInfo
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
InnerAnalysisManagerProxy< FunctionAnalysisManager, Module > FunctionAnalysisManagerModuleProxy
Provide the FunctionAnalysisManager to Module proxy.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.