[llvm] [NFC][DXIL] move replace/erase in DXIL intrinsic expansion to caller (PR #104626)
Greg Roth via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 11:42:10 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},
----------------
pow2clk wrote:
The only places the variable is returned are places where something else is done to it before replacing the old one or where it might come from different creation calls depending on the path taken. Defining a variable on one line just to return it on the next seems unnecessary
https://github.com/llvm/llvm-project/pull/104626
More information about the llvm-commits
mailing list