https://github.com/tblah commented:

Codex found that DCE can remove side-effect free non-terminating loop bodies, 
leaving just the finite fir.do_loop.

```
subroutine self_loop(n)
  integer :: n, i
  do i = 1, n
10   goto 10
  end do

  call never_executed()
end subroutine
```

`flang -fc1 -emit-hlfir ...` produces

```
...
fir.do_loop ... {
  fir.store ...
}
...
fir.call ...
return
```

I think the problem is the recursive memory effects on the scf.execute_region 
turning up nothing. If this instead used a fully unstructured lowering, the 
unstructured branches would all be terminators, which are never removed by DCE.

https://github.com/llvm/llvm-project/pull/225758
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to