[llvm] [NFC][DXIL] move replace/erase in DXIL intrinsic expansion to caller (PR #104626)

Joshua Batista via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 11:31:00 PDT 2024


================
@@ -182,30 +174,23 @@ static bool expandLengthIntrinsic(CallInst *Orig) {
     Value *Mul = Builder.CreateFMul(Elt, Elt);
     Sum = Builder.CreateFAdd(Sum, Mul);
   }
-  Value *Result = Builder.CreateIntrinsic(
-      EltTy, Intrinsic::sqrt, ArrayRef<Value *>{Sum}, nullptr, "elt.sqrt");
-
-  Orig->replaceAllUsesWith(Result);
-  Orig->eraseFromParent();
-  return true;
+  return Builder.CreateIntrinsic(EltTy, Intrinsic::sqrt, ArrayRef<Value *>{Sum},
----------------
bob80905 wrote:

Sometimes the createIntrinsic call itself is returned, and sometimes the Value * variable that was assigned to this call is returned instead. Should we stick to returning the variable?

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


More information about the llvm-commits mailing list