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

Adam Yang via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 14:40:53 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()) {
----------------
adam-yang wrote:

Done. Thanks for the suggestion.

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


More information about the llvm-commits mailing list