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

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 05:54:27 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
----------------
sdesmalen-arm wrote:

Doh :) Yes I see it now. It should have been `sub nuw nsw i64 shl2, 1` to avoid any wrapping (or indeed remove the nuw flag). I'll have a look to see if we generate this pattern with nuw flag anywhere. Thanks!

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


More information about the llvm-commits mailing list