• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -analyze -polly-detect \
2; RUN:     -pass-remarks-missed="polly-detect" \
3; RUN:     < %s 2>&1| FileCheck %s
4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5
6;void foo(int a, int b) {
7;  if(b == 42) {
8;    if (a > 0) {
9;      LABEL1:
10;      a--;
11;    }
12;
13;    if (a > 0) {
14;      goto LABEL1;
15;    }
16;    b = b + 42;
17;  }
18;}
19
20; CHECK: remark: ReportIrreducibleRegion.c:3:7: The following errors keep this region from being a Scop.
21; CHECK-NEXT: remark: ReportIrreducibleRegion.c:9:4: Irreducible region encountered in control flow.
22; CHECK-NEXT: remark: ReportIrreducibleRegion.c:9:4: Invalid Scop candidate ends here.
23
24
25; Function Attrs: nounwind uwtable
26define void @foo(i32 %a, i32 %b) #0 !dbg !4 {
27entry:
28  %a.addr = alloca i32, align 4
29  %b.addr = alloca i32, align 4
30  store i32 %a, i32* %a.addr, align 4
31  call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !11, metadata !12), !dbg !13
32  store i32 %b, i32* %b.addr, align 4
33  call void @llvm.dbg.declare(metadata i32* %b.addr, metadata !14, metadata !12), !dbg !15
34  %0 = load i32, i32* %b.addr, align 4, !dbg !16
35  %cmp = icmp eq i32 %0, 42, !dbg !18
36  br i1 %cmp, label %if.then, label %if.end6, !dbg !19
37
38if.then:                                          ; preds = %entry
39  %1 = load i32, i32* %a.addr, align 4, !dbg !20
40  %cmp1 = icmp sgt i32 %1, 0, !dbg !23
41  br i1 %cmp1, label %if.then2, label %if.end, !dbg !24
42
43if.then2:                                         ; preds = %if.then
44  br label %LABEL1, !dbg !25
45
46LABEL1:                                           ; preds = %if.then4, %if.then2
47  %2 = load i32, i32* %a.addr, align 4, !dbg !27
48  %dec = add nsw i32 %2, -1, !dbg !27
49  store i32 %dec, i32* %a.addr, align 4, !dbg !27
50  br label %if.end, !dbg !29
51
52if.end:                                           ; preds = %LABEL1, %if.then
53  %3 = load i32, i32* %a.addr, align 4, !dbg !30
54  %cmp3 = icmp sgt i32 %3, 0, !dbg !32
55  br i1 %cmp3, label %if.then4, label %if.end5, !dbg !33
56
57if.then4:                                         ; preds = %if.end
58  br label %LABEL1, !dbg !34
59
60if.end5:                                          ; preds = %if.end
61  %4 = load i32, i32* %b.addr, align 4, !dbg !36
62  %add = add nsw i32 %4, 42, !dbg !37
63  store i32 %add, i32* %b.addr, align 4, !dbg !38
64  br label %if.end6, !dbg !39
65
66if.end6:                                          ; preds = %if.end5, %entry
67  ret void, !dbg !40
68}
69
70; Function Attrs: nounwind readnone
71declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
72
73attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
74attributes #1 = { nounwind readnone }
75
76!llvm.dbg.cu = !{!0}
77!llvm.module.flags = !{!8, !9}
78!llvm.ident = !{!10}
79
80!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2)
81!1 = !DIFile(filename: "ReportIrreducibleRegion.c", directory: "llvm/tools/polly/test/ScopDetectionDiagnostics")
82!2 = !{}
83!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
84!5 = !DISubroutineType(types: !6)
85!6 = !{null, !7, !7}
86!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
87!8 = !{i32 2, !"Dwarf Version", i32 4}
88!9 = !{i32 2, !"Debug Info Version", i32 3}
89!10 = !{!"clang version 3.8.0"}
90!11 = !DILocalVariable(name: "a", arg: 1, scope: !4, file: !1, line: 1, type: !7)
91!12 = !DIExpression()
92!13 = !DILocation(line: 1, column: 14, scope: !4)
93!14 = !DILocalVariable(name: "b", arg: 2, scope: !4, file: !1, line: 1, type: !7)
94!15 = !DILocation(line: 1, column: 21, scope: !4)
95!16 = !DILocation(line: 2, column: 5, scope: !17)
96!17 = distinct !DILexicalBlock(scope: !4, file: !1, line: 2, column: 5)
97!18 = !DILocation(line: 2, column: 7, scope: !17)
98!19 = !DILocation(line: 2, column: 5, scope: !4)
99!20 = !DILocation(line: 3, column: 7, scope: !21)
100!21 = distinct !DILexicalBlock(scope: !22, file: !1, line: 3, column: 7)
101!22 = distinct !DILexicalBlock(scope: !17, file: !1, line: 2, column: 14)
102!23 = !DILocation(line: 3, column: 9, scope: !21)
103!24 = !DILocation(line: 3, column: 7, scope: !22)
104!25 = !DILocation(line: 3, column: 14, scope: !26)
105!26 = !DILexicalBlockFile(scope: !21, file: !1, discriminator: 1)
106!27 = !DILocation(line: 5, column: 5, scope: !28)
107!28 = distinct !DILexicalBlock(scope: !21, file: !1, line: 3, column: 14)
108!29 = !DILocation(line: 6, column: 3, scope: !28)
109!30 = !DILocation(line: 8, column: 7, scope: !31)
110!31 = distinct !DILexicalBlock(scope: !22, file: !1, line: 8, column: 7)
111!32 = !DILocation(line: 8, column: 9, scope: !31)
112!33 = !DILocation(line: 8, column: 7, scope: !22)
113!34 = !DILocation(line: 9, column: 4, scope: !35)
114!35 = distinct !DILexicalBlock(scope: !31, file: !1, line: 8, column: 14)
115!36 = !DILocation(line: 11, column: 7, scope: !22)
116!37 = !DILocation(line: 11, column: 9, scope: !22)
117!38 = !DILocation(line: 11, column: 5, scope: !22)
118!39 = !DILocation(line: 12, column: 2, scope: !22)
119!40 = !DILocation(line: 13, column: 1, scope: !4)
120