[llvm] [SPIR-V] Strip convergence intrinsics before ISel (PR #75948)
Ilia Diachkov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 3 01:56:43 PST 2024
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/75948 at github.com>
================
@@ -312,6 +316,54 @@ bool SPIRVPrepareFunctions::substituteIntrinsicCalls(Function *F) {
return Changed;
}
+bool SPIRVPrepareFunctions::stripConvergenceOperands(Function *F) {
+ DenseSet<Instruction *> to_remove;
+ for (BasicBlock &BB : *F) {
+ for (Instruction &I : BB) {
+ auto *CI = dyn_cast<CallInst>(&I);
+ if (CI == nullptr)
+ continue;
+
+ auto OB = CI->getOperandBundle(LLVMContext::OB_convergencectrl);
+ if (!OB.has_value())
+ continue;
+
+ auto *NewCall = CallBase::removeOperandBundle(
+ CI, LLVMContext::OB_convergencectrl, CI);
+ NewCall->copyMetadata(*CI);
+ CI->replaceAllUsesWith(NewCall);
+ to_remove.insert(CI);
+ }
+ }
+
+ for (Instruction *I : to_remove)
+ I->eraseFromParent();
+ return to_remove.size() != 0;
+}
+
+bool SPIRVPrepareFunctions::stripConvergenceIntrinsics(Function *F) {
+ DenseSet<Instruction *> to_remove;
----------------
iliya-diyachkov wrote:
The same.
https://github.com/llvm/llvm-project/pull/75948
More information about the llvm-commits
mailing list