Adrian Prantl | 32da889 | 2014-04-25 20:49:25 +0000 | [diff] [blame] | 1 | ; RUN: opt %s -O2 -S -o - | FileCheck %s |
Adrian Prantl | 29b9de7 | 2013-04-26 17:48:33 +0000 | [diff] [blame] | 2 | ; Verify that we emit the same intrinsic at most once. |
Adrian Prantl | 32da889 | 2014-04-25 20:49:25 +0000 | [diff] [blame] | 3 | ; rdar://problem/13056109 |
| 4 | ; |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 5 | ; CHECK: call void @llvm.dbg.value(metadata %struct.i14** %p |
| 6 | ; CHECK-NOT: call void @llvm.dbg.value(metadata %struct.i14** %p |
Adrian Prantl | 32da889 | 2014-04-25 20:49:25 +0000 | [diff] [blame] | 7 | ; CHECK-NEXT: call i32 @foo |
Adrian Prantl | 29b9de7 | 2013-04-26 17:48:33 +0000 | [diff] [blame] | 8 | ; CHECK: ret |
Adrian Prantl | 32da889 | 2014-04-25 20:49:25 +0000 | [diff] [blame] | 9 | ; |
| 10 | ; |
| 11 | ; typedef struct { |
| 12 | ; long i; |
| 13 | ; } i14; |
| 14 | ; |
| 15 | ; int foo(i14**); |
| 16 | ; |
| 17 | ; void init() { |
| 18 | ; i14* p = 0; |
| 19 | ; foo(&p); |
| 20 | ; p->i |= 4; |
| 21 | ; foo(&p); |
| 22 | ; } |
| 23 | ; |
| 24 | ; ModuleID = 'instcombine_intrinsics.c' |
| 25 | target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
| 26 | target triple = "x86_64-apple-macosx10.9.0" |
Adrian Prantl | 29b9de7 | 2013-04-26 17:48:33 +0000 | [diff] [blame] | 27 | |
Adrian Prantl | 32da889 | 2014-04-25 20:49:25 +0000 | [diff] [blame] | 28 | %struct.i14 = type { i64 } |
Adrian Prantl | 29b9de7 | 2013-04-26 17:48:33 +0000 | [diff] [blame] | 29 | |
Adrian Prantl | 32da889 | 2014-04-25 20:49:25 +0000 | [diff] [blame] | 30 | ; Function Attrs: nounwind ssp uwtable |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 31 | define void @init() #0 !dbg !4 { |
Adrian Prantl | 32da889 | 2014-04-25 20:49:25 +0000 | [diff] [blame] | 32 | %p = alloca %struct.i14*, align 8 |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 33 | call void @llvm.dbg.declare(metadata %struct.i14** %p, metadata !11, metadata !DIExpression()), !dbg !18 |
Adrian Prantl | 32da889 | 2014-04-25 20:49:25 +0000 | [diff] [blame] | 34 | store %struct.i14* null, %struct.i14** %p, align 8, !dbg !18 |
| 35 | %1 = call i32 @foo(%struct.i14** %p), !dbg !19 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 36 | %2 = load %struct.i14*, %struct.i14** %p, align 8, !dbg !20 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 37 | %3 = getelementptr inbounds %struct.i14, %struct.i14* %2, i32 0, i32 0, !dbg !20 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 38 | %4 = load i64, i64* %3, align 8, !dbg !20 |
Adrian Prantl | 32da889 | 2014-04-25 20:49:25 +0000 | [diff] [blame] | 39 | %5 = or i64 %4, 4, !dbg !20 |
| 40 | store i64 %5, i64* %3, align 8, !dbg !20 |
| 41 | %6 = call i32 @foo(%struct.i14** %p), !dbg !21 |
| 42 | ret void, !dbg !22 |
Adrian Prantl | 29b9de7 | 2013-04-26 17:48:33 +0000 | [diff] [blame] | 43 | } |
| 44 | |
Adrian Prantl | 32da889 | 2014-04-25 20:49:25 +0000 | [diff] [blame] | 45 | ; Function Attrs: nounwind readnone |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 46 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
Adrian Prantl | 29b9de7 | 2013-04-26 17:48:33 +0000 | [diff] [blame] | 47 | |
Adrian Prantl | 32da889 | 2014-04-25 20:49:25 +0000 | [diff] [blame] | 48 | declare i32 @foo(%struct.i14**) |
Adrian Prantl | 29b9de7 | 2013-04-26 17:48:33 +0000 | [diff] [blame] | 49 | |
Adrian Prantl | 32da889 | 2014-04-25 20:49:25 +0000 | [diff] [blame] | 50 | attributes #0 = { nounwind ssp uwtable } |
| 51 | attributes #1 = { nounwind readnone } |
Adrian Prantl | 29b9de7 | 2013-04-26 17:48:33 +0000 | [diff] [blame] | 52 | |
| 53 | !llvm.dbg.cu = !{!0} |
Adrian Prantl | 32da889 | 2014-04-25 20:49:25 +0000 | [diff] [blame] | 54 | !llvm.module.flags = !{!8, !9} |
| 55 | !llvm.ident = !{!10} |
Adrian Prantl | 29b9de7 | 2013-04-26 17:48:33 +0000 | [diff] [blame] | 56 | |
Duncan P. N. Exon Smith | 55ca964 | 2015-08-03 17:26:41 +0000 | [diff] [blame] | 57 | !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 58 | !1 = !DIFile(filename: "instcombine_intrinsics.c", directory: "") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 59 | !2 = !{} |
| 60 | !3 = !{!4} |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 61 | !4 = distinct !DISubprogram(name: "init", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 7, file: !1, scope: !5, type: !6, variables: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 62 | !5 = !DIFile(filename: "instcombine_intrinsics.c", directory: "") |
| 63 | !6 = !DISubroutineType(types: !7) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 64 | !7 = !{null} |
| 65 | !8 = !{i32 2, !"Dwarf Version", i32 2} |
Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 66 | !9 = !{i32 1, !"Debug Info Version", i32 3} |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 67 | !10 = !{!"clang version 3.5.0 "} |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 68 | !11 = !DILocalVariable(name: "p", line: 8, scope: !4, file: !5, type: !12) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 69 | !12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !13) |
| 70 | !13 = !DIDerivedType(tag: DW_TAG_typedef, name: "i14", line: 3, file: !1, baseType: !14) |
| 71 | !14 = !DICompositeType(tag: DW_TAG_structure_type, line: 1, size: 64, align: 64, file: !1, elements: !15) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 72 | !15 = !{!16} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 73 | !16 = !DIDerivedType(tag: DW_TAG_member, name: "i", line: 2, size: 64, align: 64, file: !1, scope: !14, baseType: !17) |
| 74 | !17 = !DIBasicType(tag: DW_TAG_base_type, name: "long int", size: 64, align: 64, encoding: DW_ATE_signed) |
| 75 | !18 = !DILocation(line: 8, scope: !4) |
| 76 | !19 = !DILocation(line: 9, scope: !4) |
| 77 | !20 = !DILocation(line: 10, scope: !4) |
| 78 | !21 = !DILocation(line: 11, scope: !4) |
| 79 | !22 = !DILocation(line: 12, scope: !4) |