[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 9 19:21:12 PDT 2024


================
@@ -264,6 +264,24 @@ class OpLowerer {
     return lowerToBindAndAnnotateHandle(F);
   }
 
+  Error replaceSplitDoubleCallUsages(CallInst *Intrin, CallInst *Op) {
+    IRBuilder<> &IRB = OpBuilder.getIRB();
+
+    for (Use &U : make_early_inc_range(Intrin->uses())) {
+      if (auto *EVI = dyn_cast<ExtractValueInst>(U.getUser())) {
+
+        if (EVI->getNumIndices() != 1)
+          return createStringError(std::errc::invalid_argument,
+                                   "Splitdouble has only 2 elements");
+        EVI->setOperand(0, Op);
+      }
+    }
+
+    Intrin->eraseFromParent();
----------------
bogner wrote:

We'll crash here if any of the uses weren't `ExtractValueInst`.

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


More information about the cfe-commits mailing list