LLVM: lib/Target/SPIRV/SPIRVStripConvergentIntrinsics.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
22#include "llvm/IR/IntrinsicsSPIRV.h"
25
26using namespace llvm;
27
28namespace llvm {
30}
31
33public:
35
39 };
40
43
44
45
47 if (II->getIntrinsicID() != Intrinsic::experimental_convergence_entry &&
48 II->getIntrinsicID() != Intrinsic::experimental_convergence_loop &&
49 II->getIntrinsicID() != Intrinsic::experimental_convergence_anchor)
50 return false;
51
54 return true;
55 };
56
57
58
59 auto CleanupCall = [&](CallInst *CI) {
61 if (!OB.has_value())
62 return;
63
66 NewCall->copyMetadata(*CI);
67 CI->replaceAllUsesWith(NewCall);
69 };
70
73 if (auto *II = dyn_cast(&I))
74 if (CleanupIntrinsic(II))
75 continue;
76 if (auto *CI = dyn_cast(&I))
77 CleanupCall(CI);
78 }
79 }
80
81
83 I->eraseFromParent();
84
86 }
87};
88
91 "SPIRV strip convergent intrinsics", false, false)
92
95}
ReachingDefAnalysis InstSet & ToRemove
uint64_t IntrinsicInst * II
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
virtual bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
SPIRVStripConvergentIntrinsics()
LLVM Basic Block Representation.
static CallBase * removeOperandBundle(CallBase *CB, uint32_t ID, InsertPosition InsertPt=nullptr)
Create a clone of CB with operand bundle ID removed.
This class represents a function call, abstracting a target machine's calling convention.
Implements a dense probed hash-table based set.
FunctionPass class - This class is used to implement most global optimizations.
A wrapper class for inspecting calls to intrinsic functions.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createSPIRVStripConvergenceIntrinsicsPass()
void initializeSPIRVStripConvergentIntrinsicsPass(PassRegistry &)