32#include "llvm/IR/IntrinsicsAMDGPU.h" 
   38#define DEBUG_TYPE "amdgpu-uniform-intrinsic-combine" 
   50  if (
auto It = Tracker.
find(V); It != Tracker.
end())
 
 
   62  case Intrinsic::amdgcn_permlane64:
 
   63  case Intrinsic::amdgcn_readfirstlane:
 
   64  case Intrinsic::amdgcn_readlane: {
 
   65    Value *Src = 
II.getArgOperand(0);
 
   69    II.replaceAllUsesWith(Src);
 
   73  case Intrinsic::amdgcn_ballot: {
 
   74    Value *Src = 
II.getArgOperand(0);
 
   82        Value *Op0 = ICmp->getOperand(0);
 
   83        Value *Op1 = ICmp->getOperand(1);
 
   85        Value *OtherOp = Op0 == &
II ? Op1 : Op0;
 
   91          Tracker[NotOp] = 
true; 
 
   93          ICmp->replaceAllUsesWith(NotOp);
 
   99          ICmp->replaceAllUsesWith(Src);
 
  106      II.eraseFromParent();
 
 
  117  bool IsChanged = 
false;
 
  125    switch (
II->getIntrinsicID()) {
 
  126    case Intrinsic::amdgcn_permlane64:
 
  127    case Intrinsic::amdgcn_readfirstlane:
 
  128    case Intrinsic::amdgcn_readlane:
 
  129    case Intrinsic::amdgcn_ballot:
 
 
  152class AMDGPUUniformIntrinsicCombineLegacy : 
public FunctionPass {
 
  170char AMDGPUUniformIntrinsicCombineLegacy::ID = 0;
 
  172    AMDGPUUniformIntrinsicCombineLegacy::ID;
 
  174bool AMDGPUUniformIntrinsicCombineLegacy::runOnFunction(
Function &
F) {
 
  178      getAnalysis<UniformityInfoWrapperPass>().getUniformityInfo();
 
  183                      "AMDGPU Uniform Intrinsic Combine", 
false, 
false)
 
  190  return new AMDGPUUniformIntrinsicCombineLegacy();
 
 
Expand Atomic instructions
static bool runOnFunction(Function &F, bool PostInlining)
AMD GCN specific subclass of TargetSubtarget.
uint64_t IntrinsicInst * II
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
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.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
static LLVM_ABI BinaryOperator * CreateNot(Value *Op, const Twine &Name="", InsertPosition InsertBefore=nullptr)
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
FunctionPass class - This class is used to implement most global optimizations.
A wrapper class for inspecting calls to intrinsic functions.
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
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.
Target-Independent Code Generator Pass Configuration Options.
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.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
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...
FunctionPass * createAMDGPUUniformIntrinsicCombineLegacyPass()
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void initializeAMDGPUUniformIntrinsicCombineLegacyPass(PassRegistry &)
char & AMDGPUUniformIntrinsicCombineLegacyPassID
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.