File: unstructured-control-flow.f90

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (31 lines) | stat: -rw-r--r-- 1,076 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
!RUN: bbc -emit-hlfir -o - %s | FileCheck %s

!CHECK-LABEL: func.func @_QPunstructured1
!CHECK:   fir.select %{{[0-9]+}} : i32 [{{.*}}, ^bb[[BLOCK3:[0-9]+]], {{.*}}, ^bb[[BLOCK4:[0-9]+]], {{.*}}, ^bb[[BLOCK5:[0-9]+]], {{.*}}, ^bb[[BLOCK1:[0-9]+]]]
!CHECK: ^bb[[BLOCK1]]:
!CHECK:   cf.cond_br %{{[0-9]+}}, ^bb[[BLOCK2:[0-9]+]], ^bb[[BLOCK4]]
!CHECK: ^bb[[BLOCK2]]:
!CHECK:   fir.if
!CHECK:   cf.br ^bb[[BLOCK3]]
!CHECK: ^bb[[BLOCK3]]:
!CHECK:   %[[C10:[a-z0-9_]+]] = arith.constant 10 : i32
!CHECK:   arith.addi {{.*}}, %[[C10]]
!CHECK:   cf.br ^bb[[BLOCK4]]
!CHECK: ^bb[[BLOCK4]]:
!CHECK:   %[[C100:[a-z0-9_]+]] = arith.constant 100 : i32
!CHECK:   arith.addi {{.*}}, %[[C100]]
!CHECK:   cf.br ^bb[[BLOCK5]]
!CHECK: ^bb[[BLOCK5]]:
!CHECK:   %[[C1000:[a-z0-9_]+]] = arith.constant 1000 : i32
!CHECK:   arith.addi {{.*}}, %[[C1000]]
!CHECK:   return
subroutine unstructured1(j, k)
    goto (11, 22, 33) j-3  ! computed goto - an expression outside [1,3] is a nop
    if (j == 2) goto 22
    if (j == 1) goto 11
    k = k + 1
11  k = k + 10
22  k = k + 100
33  k = k + 1000
end