[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:45:10 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:
For the following IR:
```
define i64 @foo_last() {
%vscale = call i64 @llvm.vscale.i64()
%shl2 = shl nuw nsw i64 %vscale, 2
%idx = add nuw nsw i64 %shl2, -1
ret i64 %idx
}
declare i64 @llvm.vscale.i64()
```
With the current patch this is incorrectly simplified to:
```
t9: ch,glue = CopyToReg t0, Register:i64 $x0, Constant:i64<-1>
```
I don't think there's anything AArch64-specific going on there.
https://github.com/llvm/llvm-project/pull/83382
More information about the llvm-commits
mailing list