Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame^] | 1 | ; RUN: opt < %s -simplifycfg -S | FileCheck %s |
| 2 | ; RUN: opt < %s -strip-debug -simplifycfg -S | FileCheck %s |
| 3 | |
| 4 | ; Verify that the and.2 instruction is eliminated even in the presence of a |
| 5 | ; preceding debug intrinsic. |
| 6 | |
| 7 | ; CHECK-LABEL: bb1: |
| 8 | ; CHECK: and i1 false, false |
| 9 | ; CHECK-LABEL: bb2: |
| 10 | ; CHECK-NOT: and i1 false, false |
| 11 | |
| 12 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 13 | target triple = "x86_64-unknown-linux-gnu" |
| 14 | |
| 15 | ; Function Attrs: norecurse nounwind |
| 16 | define void @foo() local_unnamed_addr #0 !dbg !4 { |
| 17 | bb1: |
| 18 | %and.1 = and i1 false, false |
| 19 | %cmp = icmp eq i16 0, 0 |
| 20 | br i1 %cmp, label %bb2, label %bb3 |
| 21 | |
| 22 | bb2: ; preds = %bb1 |
| 23 | call void @llvm.dbg.value(metadata i16 0, metadata !8, metadata !DIExpression()), !dbg !9 |
| 24 | %and.2 = and i1 false, false |
| 25 | br label %bb3 |
| 26 | |
| 27 | bb3: ; preds = %bb2, %bb1 |
| 28 | ret void |
| 29 | } |
| 30 | |
| 31 | ; Function Attrs: nounwind readnone speculatable |
| 32 | declare void @llvm.dbg.value(metadata, metadata, metadata) #1 |
| 33 | |
| 34 | attributes #0 = { norecurse nounwind } |
| 35 | attributes #1 = { nounwind readnone speculatable } |
| 36 | |
| 37 | !llvm.dbg.cu = !{!0} |
| 38 | !llvm.module.flags = !{!3} |
| 39 | |
| 40 | !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "Foo", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2) |
| 41 | !1 = !DIFile(filename: "foo.c", directory: "/") |
| 42 | !2 = !{} |
| 43 | !3 = !{i32 2, !"Debug Info Version", i32 3} |
| 44 | !4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 10, type: !5, isLocal: false, isDefinition: true, scopeLine: 10, isOptimized: false, unit: !0, retainedNodes: !2) |
| 45 | !5 = !DISubroutineType(types: !6) |
| 46 | !6 = !{null, !7} |
| 47 | !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 48 | !8 = !DILocalVariable(name: "p_1", arg: 1, scope: !4, line: 4, type: !7) |
| 49 | !9 = distinct !DILocation(line: 11, column: 3, scope: !4) |