[llvm] [InstCombine] Fixup commit 7253c6f (PR #123315)

Sushant Gokhale via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 02:13:58 PST 2025


https://github.com/sushgokh created https://github.com/llvm/llvm-project/pull/123315

This should fix the assert failure we were getting for the darwin OS.

>From 543caf16aa54ddeb85535e65de0d6f4644f311b7 Mon Sep 17 00:00:00 2001
From: sgokhale <sgokhale at nvidia.com>
Date: Fri, 17 Jan 2025 15:41:36 +0530
Subject: [PATCH] [InstCombine] Fixup commit 7253c6f

This should fix the assert failure we were getting for the darwin OS.
---
 llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index b6acde9bdd1104..df5f9833a2ff92 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -2067,8 +2067,7 @@ convertFSqrtDivIntoFMul(CallInst *CI, Instruction *X,
   FMul->copyMetadata(*X);
   FMul->copyFastMathFlags(FastMathFlags::intersectRewrite(R1FMF, R2FMF) |
                           FastMathFlags::unionValue(R1FMF, R2FMF));
-  IC->replaceInstUsesWith(*X, FMul);
-  return IC->eraseInstFromFunction(*X);
+  return IC->replaceInstUsesWith(*X, FMul);
 }
 
 Instruction *InstCombinerImpl::visitFDiv(BinaryOperator &I) {



More information about the llvm-commits mailing list