[flang-commits] [flang] [flang] add nsw to operations in subscripts (PR #110060)

via flang-commits flang-commits at lists.llvm.org
Thu Sep 26 01:37:54 PDT 2024


================
@@ -150,6 +151,45 @@ subroutine foo4(at1, vector, i, j, k, l, step)
 ! CHECK:    hlfir.yield_element %[[VAL_50]] : f32
 ! CHECK:  }
 
+subroutine foo5(x, y, z)
+  integer :: x(100)
+  integer(8) :: y(20), z(20)
+  call bar(x(y+z))
+end subroutine
+! CHECK-LABEL:   func.func @_QPfoo5(
----------------
jeanPerier wrote:

If the goal of the test is to show that overflow<nsw> is no generated here, I think it is simpler and more expressive to just go for:

```
! Test that -fwrapv does not add <nsw> flag to arith ops on vector subscripts.
! CHECK-LABEL: func.func @_QPfoo5(
! CHECK-NOT: overflow<nsw>
! CHECK: return
```

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


More information about the flang-commits mailing list