File: lower-workshare-copyprivate.mlir

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (73 lines) | stat: -rw-r--r-- 2,053 bytes parent folder | download | duplicates (5)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// RUN: fir-opt --split-input-file --lower-workshare --allow-unregistered-dialect %s | FileCheck %s


// Check if we store the correct values

func.func @wsfunc() {
  omp.parallel {
  // CHECK: fir.alloca
  // CHECK: fir.alloca
  // CHECK: fir.alloca
  // CHECK: fir.alloca
  // CHECK: fir.alloca
  // CHECK-NOT: fir.alloca
    omp.workshare {

      %t1 = "test.test1"() : () -> i32
      // CHECK: %[[T1:.*]] = "test.test1"
      // CHECK: fir.store %[[T1]]
      %t2 = "test.test2"() : () -> i32
      // CHECK: %[[T2:.*]] = "test.test2"
      // CHECK: fir.store %[[T2]]
      %t3 = "test.test3"() : () -> i32
      // CHECK: %[[T3:.*]] = "test.test3"
      // CHECK-NOT: fir.store %[[T3]]
      %t4 = "test.test4"() : () -> i32
      // CHECK: %[[T4:.*]] = "test.test4"
      // CHECK: fir.store %[[T4]]
      %t5 = "test.test5"() : () -> i32
      // CHECK: %[[T5:.*]] = "test.test5"
      // CHECK: fir.store %[[T5]]
      %t6 = "test.test6"() : () -> i32
      // CHECK: %[[T6:.*]] = "test.test6"
      // CHECK-NOT: fir.store %[[T6]]


      "test.test1"(%t1) : (i32) -> ()
      "test.test1"(%t2) : (i32) -> ()
      "test.test1"(%t3) : (i32) -> ()

      %true = arith.constant true
      fir.if %true {
        "test.test2"(%t3) : (i32) -> ()
      }

      %c1_i32 = arith.constant 1 : i32

      %t5_pure_use = arith.addi %t5, %c1_i32 : i32

      %t6_mem_effect_use = "test.test8"(%t6) : (i32) -> i32
      // CHECK: %[[T6_USE:.*]] = "test.test8"
      // CHECK: fir.store %[[T6_USE]]

      %c42 = arith.constant 42 : index
      %c1 = arith.constant 1 : index
      omp.workshare.loop_wrapper {
        omp.loop_nest (%arg1) : index = (%c1) to (%c42) inclusive step (%c1) {
          "test.test10"(%t1) : (i32) -> ()
          "test.test10"(%t5_pure_use) : (i32) -> ()
          "test.test10"(%t6_mem_effect_use) : (i32) -> ()
          omp.yield
        }
      }

      "test.test10"(%t2) : (i32) -> ()
      fir.if %true {
        "test.test10"(%t4) : (i32) -> ()
      }
      omp.terminator
    }
    omp.terminator
  }
  return
}