79 lines · plain
1; XFAIL: *2; RUN: opt < %s -passes=newgvn -S | FileCheck %s3; CHECK: {{^}}for.body:4; CHECK-NEXT: [[VREG1:%[^ ]+]] = phi{{.*}}[[VREG2:%[^ ]+]],{{.*}}%.sink,5; CHECK-NOT: !dbg6; 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 413 14; Function Attrs: nounwind uwtable15define void @foo(i32 %x, i32 %y, i32 %z) local_unnamed_addr #0 !dbg !4 {16entry:17 %not.tobool = icmp eq i32 %x, 0, !dbg !818 %.sink = zext i1 %not.tobool to i32, !dbg !819 store i32 %.sink, ptr @g, align 4, !tbaa !920 %cmp8 = icmp sgt i32 %y, 0, !dbg !1321 br i1 %cmp8, label %for.body.preheader, label %for.end, !dbg !1722 23for.body.preheader: ; preds = %entry24 br label %for.body, !dbg !1925 26for.body: ; preds = %for.body.preheader, %for.inc27 %i.09 = phi i32 [ %inc4, %for.inc ], [ 0, %for.body.preheader ]28 %cmp1 = icmp sgt i32 %i.09, %z, !dbg !1929 br i1 %cmp1, label %if.then2, label %for.inc, !dbg !2130 31if.then2: ; preds = %for.body32 %0 = load i32, ptr @g, align 4, !dbg !22, !tbaa !933 %inc = add nsw i32 %0, 1, !dbg !2234 store i32 %inc, ptr @g, align 4, !dbg !22, !tbaa !935 br label %for.inc, !dbg !2336 37for.inc: ; preds = %for.body, %if.then238 %inc4 = add nuw nsw i32 %i.09, 1, !dbg !2439 %exitcond = icmp ne i32 %inc4, %y, !dbg !1340 br i1 %exitcond, label %for.body, label %for.end.loopexit, !dbg !1741 42for.end.loopexit: ; preds = %for.inc43 br label %for.end, !dbg !2644 45for.end: ; preds = %for.end.loopexit, %entry46 ret void, !dbg !2647}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