[llvm] [KnownBits] Make nuw and nsw support in computeForAddSub optimal (PR #83382)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 05:46:56 PST 2024


================
@@ -114,9 +114,12 @@ define i1 @foo_last(<vscale x 4 x float> %a, <vscale x 4 x float> %b) {
 ; CHECK-LABEL: foo_last:
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    ptrue p0.s
-; CHECK-NEXT:    fcmeq p1.s, p0/z, z0.s, z1.s
-; CHECK-NEXT:    ptest p0, p1.b
-; CHECK-NEXT:    cset w0, lo
+; CHECK-NEXT:    mov x8, #-1 // =0xffffffffffffffff
----------------
nikic wrote:

That simplification looks correct to me. The only way `add -1` can the nuw is if the other operand is zero, so the result is -1. This probably wasn't supposed to have a nuw flag?

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


More information about the llvm-commits mailing list