[llvm] [DXIL] Add GroupMemoryBarrierWithGroupSync intrinsic (PR #111884)

Finn Plummer via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 23 16:56:28 PDT 2024


================
@@ -105,20 +105,46 @@ class OpLowerer {
     return false;
   }
 
-  [[nodiscard]]
-  bool replaceFunctionWithOp(Function &F, dxil::OpCode DXILOp) {
+  struct ArgSelect {
+    enum class Type {
+      Index,
+      I8,
+      I32,
+    };
+    Type Type = Type::Index;
+    int Value = -1;
+  };
+
+  [[nodiscard]] bool replaceFunctionWithOp(Function &F, dxil::OpCode DXILOp,
+                                           ArrayRef<ArgSelect> Args) {
     bool IsVectorArgExpansion = isVectorArgExpansion(F);
     return replaceFunction(F, [&](CallInst *CI) -> Error {
-      SmallVector<Value *> Args;
       OpBuilder.getIRB().SetInsertPoint(CI);
-      if (IsVectorArgExpansion) {
-        SmallVector<Value *> NewArgs = argVectorFlatten(CI, OpBuilder.getIRB());
-        Args.append(NewArgs.begin(), NewArgs.end());
-      } else
-        Args.append(CI->arg_begin(), CI->arg_end());
+      SmallVector<Value *> NewArgs;
+      if (Args.size()) {
----------------
inbelic wrote:

nit: Can we name this `ArgSelects` and change `NewArgs` to `Args`. It tripped me up a couple times when reasoning about the functionality as `Args.size()` denotes there are no selections and not that the operation has no args.

https://github.com/llvm/llvm-project/pull/111884


More information about the llvm-commits mailing list