[llvm] [InstCombine] Fold select with signbit idiom into fabs (PR #76342)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 21 20:17:16 PST 2024


================
@@ -2763,6 +2763,41 @@ static Instruction *foldSelectWithFCmpToFabs(SelectInst &SI,
     }
   }
 
+  // Match select with (icmp slt (bitcast X to int), 0)
+  //                or (icmp sgt (bitcast X to int), -1)
----------------
goldsteinn wrote:

I suppose it would also work for `fptosi`?

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


More information about the llvm-commits mailing list