[llvm] [InstCombine] (uitofp bool X) * Y --> X ? Y : 0 (PR #96216)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 02:30:15 PDT 2024


================
@@ -0,0 +1,35 @@
+; RUN: opt < %s -passes=instcombine -S | FileCheck %s
+
+; X * Y (when Y is a boolean) --> Y ? X : 0
+
+define float @fmul_bool(float %x, i1 %y) {
+; CHECK-LABEL: @fmul_bool(
+; CHECK-NEXT:    [[M:%.*]] = select i1 [[Y:%.*]], float [[X:%.*]], float 0.000000e+00
----------------
arsenm wrote:

You can preserve the flags here 

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


More information about the llvm-commits mailing list