File: loop-metadata.mlir

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (117 lines) | stat: -rw-r--r-- 5,424 bytes parent folder | download | duplicates (2)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// RUN: mlir-opt %s --split-input-file | mlir-opt --split-input-file | FileCheck %s

// CHECK-DAG: #[[FOLLOWUP:.*]] = #llvm.loop_annotation<disableNonforced = true>
#followup = #llvm.loop_annotation<disableNonforced = true>

// CHECK-DAG: #[[VECTORIZE:.*]] = #llvm.loop_vectorize<disable = false, predicateEnable = false, scalableEnable = true, width = 16 : i32, followupVectorized = #[[FOLLOWUP]], followupEpilogue = #[[FOLLOWUP]], followupAll = #[[FOLLOWUP]]>
#vectorize = #llvm.loop_vectorize<
  disable = false, predicateEnable = false, scalableEnable = true, width = 16 : i32,
  followupVectorized = #followup, followupEpilogue = #followup, followupAll = #followup
>

// CHECK-DAG: #[[INTERLEAVE:.*]] = #llvm.loop_interleave<count = 32 : i32>
#interleave = #llvm.loop_interleave<count = 32 : i32>

// CHECK-DAG: #[[UNROLL:.*]] = #llvm.loop_unroll<disable = true, count = 32 : i32, runtimeDisable = true, full = false, followupUnrolled = #[[FOLLOWUP]], followupRemainder = #[[FOLLOWUP]], followupAll = #[[FOLLOWUP]]>
#unroll = #llvm.loop_unroll<
  disable = true, count = 32 : i32, runtimeDisable = true, full = false,
  followupUnrolled = #followup, followupRemainder = #followup, followupAll = #followup
>

// CHECK-DAG: #[[UNROLL_AND_JAM:.*]] = #llvm.loop_unroll_and_jam<disable = false, count = 16 : i32, followupOuter = #[[FOLLOWUP]], followupInner = #[[FOLLOWUP]], followupRemainderOuter = #[[FOLLOWUP]], followupRemainderInner = #[[FOLLOWUP]], followupAll = #[[FOLLOWUP]]>
#unrollAndJam = #llvm.loop_unroll_and_jam<
  disable = false, count = 16 : i32, followupOuter = #followup, followupInner = #followup,
  followupRemainderOuter = #followup, followupRemainderInner = #followup, followupAll = #followup
>

// CHECK-DAG: #[[LICM:.*]] = #llvm.loop_licm<disable = false, versioningDisable = true>
#licm = #llvm.loop_licm<disable = false, versioningDisable = true>

// CHECK-DAG: #[[DISTRIBUTE:.*]] = #llvm.loop_distribute<disable = true, followupCoincident = #[[FOLLOWUP]], followupSequential = #[[FOLLOWUP]], followupFallback = #[[FOLLOWUP]], followupAll = #[[FOLLOWUP]]>
#distribute = #llvm.loop_distribute<
  disable = true, followupCoincident = #followup, followupSequential = #followup,
  followupFallback = #followup, followupAll = #followup
>

// CHECK-DAG: #[[PIPELINE:.*]] = #llvm.loop_pipeline<disable = true, initiationinterval = 1 : i32>
#pipeline = #llvm.loop_pipeline<disable = true, initiationinterval = 1 : i32>

// CHECK-DAG: #[[PEELED:.*]] = #llvm.loop_peeled<count = 8 : i32>
#peeled = #llvm.loop_peeled<count = 8 : i32>

// CHECK-DAG: #[[UNSWITCH:.*]] = #llvm.loop_unswitch<partialDisable = true>
#unswitch = #llvm.loop_unswitch<partialDisable = true>

// CHECK-DAG: #[[GROUP1:.*]] = #llvm.access_group<id = {{.*}}>
// CHECK-DAG: #[[GROUP2:.*]] = #llvm.access_group<id = {{.*}}>
#group1 = #llvm.access_group<id = distinct[0]<>>
#group2 = #llvm.access_group<id = distinct[1]<>>

// CHECK: #[[LOOP_ANNOT:.*]] = #llvm.loop_annotation<
// CHECK-DAG: disableNonforced = false
// CHECK-DAG: mustProgress = true
// CHECK-DAG: unroll = #[[UNROLL]]
// CHECK-DAG: unrollAndJam = #[[UNROLL_AND_JAM]]
// CHECK-DAG: licm = #[[LICM]]
// CHECK-DAG: distribute = #[[DISTRIBUTE]]
// CHECK-DAG: pipeline = #[[PIPELINE]]
// CHECK-DAG: peeled = #[[PEELED]]
// CHECK-DAG: unswitch = #[[UNSWITCH]]
// CHECK-DAG: isVectorized = false
// CHECK-DAG: parallelAccesses = #[[GROUP1]], #[[GROUP2]]>
#loopMD = #llvm.loop_annotation<disableNonforced = false,
        mustProgress = true,
        vectorize = #vectorize,
        interleave = #interleave,
        unroll = #unroll,
        unrollAndJam = #unrollAndJam,
        licm = #licm,
        distribute = #distribute,
        pipeline = #pipeline,
        peeled = #peeled,
        unswitch = #unswitch,
        isVectorized = false,
        parallelAccesses = #group1, #group2>

// CHECK: llvm.func @loop_annotation
llvm.func @loop_annotation() {
  // CHECK: llvm.br ^bb1 {llvm.loop = #[[LOOP_ANNOT]]
  llvm.br ^bb1 {llvm.loop = #loopMD}
^bb1:
  llvm.return
}

// -----

#di_file = #llvm.di_file<"metadata-loop.ll" in "/">

// CHECK: #[[START_LOC:.*]] = loc("loop-metadata.mlir":42:4)
#loc1 = loc("loop-metadata.mlir":42:4)
// CHECK: #[[END_LOC:.*]] = loc("loop-metadata.mlir":52:4)
#loc2 = loc("loop-metadata.mlir":52:4)

#di_compile_unit = #llvm.di_compile_unit<sourceLanguage = DW_LANG_C, file = #di_file, isOptimized = false, emissionKind = None>
// CHECK: #[[SUBPROGRAM:.*]] = #llvm.di_subprogram<
#di_subprogram = #llvm.di_subprogram<compileUnit = #di_compile_unit, scope = #di_file, name = "loop_locs", file = #di_file, subprogramFlags = Definition>

// CHECK: #[[START_LOC_FUSED:.*]] = loc(fused<#[[SUBPROGRAM]]>[#[[START_LOC]]]
#start_loc_fused = loc(fused<#di_subprogram>[#loc1])
// CHECK: #[[END_LOC_FUSED:.*]] = loc(fused<#[[SUBPROGRAM]]>[#[[END_LOC]]]
#end_loc_fused= loc(fused<#di_subprogram>[#loc2])

// CHECK: #[[LOOP_ANNOT:.*]] = #llvm.loop_annotation<
// CHECK-DAG: disableNonforced = false
// CHECK-DAG: startLoc = #[[START_LOC_FUSED]]
// CHECK-DAG: endLoc = #[[END_LOC_FUSED]]
#loopMD = #llvm.loop_annotation<disableNonforced = false,
        mustProgress = true,
        startLoc = #start_loc_fused,
        endLoc = #end_loc_fused>

// CHECK: llvm.func @loop_annotation_with_locs
llvm.func @loop_annotation_with_locs() {
  // CHECK: llvm.br ^bb1 {loop_annotation = #[[LOOP_ANNOT]]
  llvm.br ^bb1 {loop_annotation = #loopMD}
^bb1:
  llvm.return
}