[llvm] 4038974 - [InstCombine] Return FRem, as opposed to substituteInParent.

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 04:32:52 PDT 2024


Author: David Green
Date: 2024-09-18T12:32:47+01:00
New Revision: 403897484f939cffd9b813eb0b759d7113f5295b

URL: https://github.com/llvm/llvm-project/commit/403897484f939cffd9b813eb0b759d7113f5295b
DIFF: https://github.com/llvm/llvm-project/commit/403897484f939cffd9b813eb0b759d7113f5295b.diff

LOG: [InstCombine] Return FRem, as opposed to substituteInParent.

This attempts to fix the ASan buildbot, which is detecting that CI is used
after it is removed in substituteInParent. The idea was to make sure it was
removed even if it had side-effects writing errno, but that appears to happen
if we return FRem directly as usual.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index 4933b5bf60eea8..6799d333fb2844 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -2820,7 +2820,7 @@ Value *LibCallSimplifier::optimizeFMod(CallInst *CI, IRBuilderBase &B) {
     Value *FRem = B.CreateFRemFMF(CI->getOperand(0), CI->getOperand(1), CI);
     if (auto *FRemI = dyn_cast<Instruction>(FRem))
       FRemI->setHasNoNaNs(true);
-    substituteInParent(CI, FRem);
+    return FRem;
   }
   return nullptr;
 }


        


More information about the llvm-commits mailing list