• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; XFAIL: *
2; RUN: opt < %s -newgvn -S | FileCheck %s
3; CHECK: {{^}}for.body:
4; CHECK-NEXT: [[VREG1:%[^ ]+]] = phi{{.*}}[[VREG2:%[^ ]+]],{{.*}}%.sink,
5; CHECK-NOT: !dbg
6; CHECK-SAME: {{$}}
7; CHECK: {{^}}for.inc:
8; CHECK-NEXT: [[VREG2]] = phi{{.*}}%inc,{{.*}}[[VREG1]]
9
10target triple = "x86_64-unknown-linux-gnu"
11
12@g = external local_unnamed_addr global i32, align 4
13
14; Function Attrs: nounwind uwtable
15define void @foo(i32 %x, i32 %y, i32 %z) local_unnamed_addr #0 !dbg !4 {
16entry:
17  %not.tobool = icmp eq i32 %x, 0, !dbg !8
18  %.sink = zext i1 %not.tobool to i32, !dbg !8
19  store i32 %.sink, i32* @g, align 4, !tbaa !9
20  %cmp8 = icmp sgt i32 %y, 0, !dbg !13
21  br i1 %cmp8, label %for.body.preheader, label %for.end, !dbg !17
22
23for.body.preheader:                               ; preds = %entry
24  br label %for.body, !dbg !19
25
26for.body:                                         ; preds = %for.body.preheader, %for.inc
27  %i.09 = phi i32 [ %inc4, %for.inc ], [ 0, %for.body.preheader ]
28  %cmp1 = icmp sgt i32 %i.09, %z, !dbg !19
29  br i1 %cmp1, label %if.then2, label %for.inc, !dbg !21
30
31if.then2:                                         ; preds = %for.body
32  %0 = load i32, i32* @g, align 4, !dbg !22, !tbaa !9
33  %inc = add nsw i32 %0, 1, !dbg !22
34  store i32 %inc, i32* @g, align 4, !dbg !22, !tbaa !9
35  br label %for.inc, !dbg !23
36
37for.inc:                                          ; preds = %for.body, %if.then2
38  %inc4 = add nuw nsw i32 %i.09, 1, !dbg !24
39  %exitcond = icmp ne i32 %inc4, %y, !dbg !13
40  br i1 %exitcond, label %for.body, label %for.end.loopexit, !dbg !17
41
42for.end.loopexit:                                 ; preds = %for.inc
43  br label %for.end, !dbg !26
44
45for.end:                                          ; preds = %for.end.loopexit, %entry
46  ret void, !dbg !26
47}
48
49!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1)
50!1 = !DIFile(filename: "foo.c", directory: "b/")
51!2 = !{i32 2, !"Dwarf Version", i32 4}
52!3 = !{i32 2, !"Debug Info Version", i32 3}
53!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0)
54!5 = !DISubroutineType(types: !6)
55!6 = !{null, !7, !7, !7}
56!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
57!8 = !DILocation(line: 4, column: 7, scope: !4)
58!9 = !{!10, !10, i64 0}
59!10 = !{!"int", !11, i64 0}
60!11 = !{!"omnipotent char", !12, i64 0}
61!12 = !{!"Simple C/C++ TBAA"}
62!13 = !DILocation(line: 10, column: 13, scope: !14)
63!14 = !DILexicalBlockFile(scope: !15, file: !1, discriminator: 1)
64!15 = distinct !DILexicalBlock(scope: !16, file: !1, line: 10, column: 3)
65!16 = distinct !DILexicalBlock(scope: !4, file: !1, line: 10, column: 3)
66!17 = !DILocation(line: 10, column: 3, scope: !18)
67!18 = !DILexicalBlockFile(scope: !16, file: !1, discriminator: 1)
68!19 = !DILocation(line: 11, column: 11, scope: !20)
69!20 = distinct !DILexicalBlock(scope: !15, file: !1, line: 11, column: 9)
70!21 = !DILocation(line: 11, column: 9, scope: !15)
71!22 = !DILocation(line: 12, column: 8, scope: !20)
72!23 = !DILocation(line: 12, column: 7, scope: !20)
73!24 = !DILocation(line: 10, column: 20, scope: !25)
74!25 = !DILexicalBlockFile(scope: !15, file: !1, discriminator: 2)
75!26 = !DILocation(line: 13, column: 1, scope: !4)
76
77!llvm.dbg.cu = !{!0}
78!llvm.module.flags = !{!2, !3}
79