[llvm] [InstCombine] Propagate ninf from fptrunc when folding `fptrunc fabs(X) -> fabs(fptrunc X)` (PR #143352)
    Nikita Popov via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Jun  9 00:53:26 PDT 2025
    
    
  
================
@@ -1926,6 +1926,9 @@ Instruction *InstCombinerImpl::visitFPTrunc(FPTruncInst &FPT) {
       CallInst *NewCI =
           CallInst::Create(Overload, {InnerTrunc}, OpBundles, II->getName());
       NewCI->copyFastMathFlags(II);
+      // A normal value may be converted to an infinity.
+      if (II->getIntrinsicID() == Intrinsic::fabs)
+        NewCI->setHasNoInfs(FPT.hasNoInfs());
----------------
nikic wrote:
Now that we have FMF on fptrunc, can we always use the fptrunc flags here instead and not bother with the intrinsic flags at all?
https://github.com/llvm/llvm-project/pull/143352
    
    
More information about the llvm-commits
mailing list