Manman Ren | 620e978 | 2013-07-29 20:18:19 +0000 | [diff] [blame] | 1 | ; RUN: opt -simplifycfg -S < %s | FileCheck %s |
Devang Patel | bc3d8b2 | 2011-04-07 23:11:25 +0000 | [diff] [blame] | 2 | |
| 3 | %0 = type { i32*, i32* } |
| 4 | |
| 5 | @0 = external hidden constant [5 x %0], align 4 |
| 6 | |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 7 | define void @foo(i32) nounwind ssp !dbg !0 { |
Devang Patel | bc3d8b2 | 2011-04-07 23:11:25 +0000 | [diff] [blame] | 8 | Entry: |
| 9 | %1 = icmp slt i32 %0, 0, !dbg !5 |
| 10 | br i1 %1, label %BB5, label %BB1, !dbg !5 |
| 11 | |
| 12 | BB1: ; preds = %Entry |
| 13 | %2 = icmp sgt i32 %0, 4, !dbg !5 |
| 14 | br i1 %2, label %BB5, label %BB2, !dbg !5 |
| 15 | |
| 16 | BB2: ; preds = %BB1 |
| 17 | %3 = shl i32 1, %0, !dbg !5 |
| 18 | %4 = and i32 %3, 31, !dbg !5 |
| 19 | %5 = icmp eq i32 %4, 0, !dbg !5 |
| 20 | br i1 %5, label %BB5, label %BB3, !dbg !5 |
| 21 | |
| 22 | ;CHECK: icmp eq |
| 23 | ;CHECK-NEXT: getelementptr |
| 24 | ;CHECK-NEXT: icmp eq |
| 25 | |
| 26 | BB3: ; preds = %BB2 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 27 | %6 = getelementptr inbounds [5 x %0], [5 x %0]* @0, i32 0, i32 %0, !dbg !6 |
Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame] | 28 | call void @llvm.dbg.value(metadata %0* %6, metadata !7, metadata !{}), !dbg !12 |
Devang Patel | bc3d8b2 | 2011-04-07 23:11:25 +0000 | [diff] [blame] | 29 | %7 = icmp eq %0* %6, null, !dbg !13 |
| 30 | br i1 %7, label %BB5, label %BB4, !dbg !13 |
| 31 | |
| 32 | BB4: ; preds = %BB3 |
| 33 | %8 = icmp slt i32 %0, 0, !dbg !5 |
| 34 | ret void, !dbg !14 |
| 35 | |
| 36 | BB5: ; preds = %BB3, %BB2, %BB1, %Entry |
| 37 | ret void, !dbg !14 |
| 38 | } |
| 39 | |
Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame] | 40 | declare void @llvm.dbg.value(metadata, metadata, metadata) nounwind readnone |
Devang Patel | bc3d8b2 | 2011-04-07 23:11:25 +0000 | [diff] [blame] | 41 | |
Adrian Prantl | 4a09777 | 2016-03-29 22:34:30 +0000 | [diff] [blame] | 42 | !llvm.dbg.cu = !{!2} |
Devang Patel | bc3d8b2 | 2011-04-07 23:11:25 +0000 | [diff] [blame] | 43 | |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 44 | !0 = distinct !DISubprogram(name: "foo", line: 231, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !2, file: !15, scope: !1, type: !3) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 45 | !1 = !DIFile(filename: "a.c", directory: "/private/tmp") |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 46 | !2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang (trunk 129006)", isOptimized: true, emissionKind: FullDebug, file: !15, enums: !4, retainedTypes: !4) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 47 | !3 = !DISubroutineType(types: !4) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 48 | !4 = !{null} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 49 | !5 = !DILocation(line: 131, column: 2, scope: !0) |
| 50 | !6 = !DILocation(line: 134, column: 2, scope: !0) |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 51 | !7 = !DILocalVariable(name: "bar", line: 232, scope: !8, file: !1, type: !9) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 52 | !8 = distinct !DILexicalBlock(line: 231, column: 1, file: !15, scope: !0) |
| 53 | !9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, scope: !2, baseType: !10) |
| 54 | !10 = !DIDerivedType(tag: DW_TAG_const_type, scope: !2, baseType: !11) |
| 55 | !11 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned) |
| 56 | !12 = !DILocation(line: 232, column: 40, scope: !8) |
| 57 | !13 = !DILocation(line: 234, column: 2, scope: !8) |
| 58 | !14 = !DILocation(line: 274, column: 1, scope: !8) |
| 59 | !15 = !DIFile(filename: "a.c", directory: "/private/tmp") |