[llvm] [InstCombine] Optimize x * !x to 0 for vector #84608 (PR #84792)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 10:58:43 PDT 2024


================
@@ -2049,3 +2051,13 @@ define i32 @zext_negpow2_use(i8 %x) {
   %r = mul i32 %zx, -16777216 ; -1 << 24
   ret i32 %r
 }
+
+define i32 @mul_icmp_with_zero(i32 %x) {
+; CHECK-LABEL: @mul_icmp_with_zero(
+; CHECK-NEXT:    ret i32 0
+;
+  %cmp = icmp eq i32 %x, zeroinitializer
----------------
dtcxzyw wrote:

```suggestion
  %cmp = icmp eq i32 %x, 0
```

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


More information about the llvm-commits mailing list