[flang] Upstream the lowering of the while loop
authorDiana Picus <diana.picus@linaro.org>
Wed, 25 May 2022 12:51:10 +0000 (12:51 +0000)
committerDiana Picus <diana.picus@linaro.org>
Tue, 31 May 2022 07:27:16 +0000 (07:27 +0000)
commit11fb1aa5a40885188b014b3ccd326cc92e4a3b9e
tree1f0a74f1a3ab0d76a33401bfeb8c2cf070112f84
parent575e297fcb289f0a9b0ac4b01d1d0fa051f5cc29
[flang] Upstream the lowering of the while loop

Upstream the code for handling while loops from the fir-dev branch at
https://github.com/flang-compiler/f18-llvm-project/tree/fir-dev/

Also add tests.

The while loop is lowered to a header block that checks the loop
condition and branches either to the exit block or to the body of the
loop. The body of the loop will unconditionally branch back to the
header.

Differential Revision: https://reviews.llvm.org/D126636

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
flang/lib/Lower/Bridge.cpp
flang/test/Lower/mixed_loops.f90 [new file with mode: 0644]
flang/test/Lower/while_loop.f90 [new file with mode: 0644]