Issue 135308
Summary [Flang] The line displayed in the remark of loop-vectorize is incorrect
Labels flang
Assignees
Reporter m-saito-fj
    When compiling the following code with flang (20.1.0) using `-O3 -fopenmp -Rpass=loop-vectorize`, the line displayed in the remark is incorrect. 
The line number of the loop head `do i=1,100` is expected, but the line number of `if (flag==1) then` is output.

```Fortran
subroutine baz()
  implicit none
  integer :: i,flag
  real(8), dimension(100) :: a,b,c
  real(8) pm

  !$omp simd
  do i=1,100
    a(i) = b(i) * c(i) + a(i)
    flag = a(i) - 30

    pm = a(i) + c(i)

    if (flag==1) then
      b(i) = pm
 endif
  enddo
endsubroutine
```

The following is the IR (partial) before LoopVectorizePass.  
I think the problem is that `!36` does not contain DILocation.

```LLVM
...
omp_loop.inc: ; preds = %omp.simd.region1, %omp_loop.body
  %exitcond.not = icmp eq i64 %indvars.iv.next, 100
  br i1 %exitcond.not, label %omp_loop.after, label %omp_loop.body, !llvm.loop !36
...
!36 = distinct !{!36, !37, !38}
!37 = !{!"llvm.loop.parallel_accesses", !28}
!38 = !{!"llvm.loop.vectorize.enable", i1 true}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to