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

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 09:44:27 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 agree the bitcast one is probably alot more likely, but could imagine some template code casting float -> int for a compare.

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


More information about the llvm-commits mailing list