Lowering of FailImage statement generates a runtime call and the unreachable operation. The unreachable operation cannot terminate a structured operation like the IF operation, hence mark as unstructured. Note: This patch is part of upstreaming code from the fir-dev branch of https://github.com/flang-compiler/f18-llvm-project. Reviewed By: clementval Differential Revision: https://reviews.llvm.org/D124520 Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
21 lines
610 B
Fortran
21 lines
610 B
Fortran
! RUN: bbc -emit-fir -o - %s | FileCheck %s
|
|
! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s
|
|
|
|
! CHECK-LABEL: func @_QPfail_image_test
|
|
subroutine fail_image_test(fail)
|
|
logical :: fail
|
|
! CHECK: cond_br {{.*}}, ^[[BB1:.*]], ^[[BB2:.*]]
|
|
! CHECK: ^[[BB1]]:
|
|
if (fail) then
|
|
! CHECK: {{.*}} = fir.call @_FortranAFailImageStatement() : () -> none
|
|
! CHECK-NEXT: fir.unreachable
|
|
FAIL IMAGE
|
|
end if
|
|
! CHECK: ^[[BB2]]:
|
|
! CHECK-NEXT: br ^[[BB3:.*]]
|
|
! CHECK-NEXT: ^[[BB3]]
|
|
! CEHCK-NEXT: return
|
|
return
|
|
end subroutine
|
|
! CHECK-LABEL: func private @_FortranAFailImageStatement() -> none attributes {fir.runtime}
|