1 # RUN: llc %s -o - -experimental-debug-variable-locations -run-pass=peephole-opt | FileCheck %s
3 # X86 initially produces subtract operations to perform comparisons, and then
4 # downgrades them into cmp instructions if nothing uses the result. It does this
5 # by calling setDesc on the instruction, mutating it from one sort to another,
6 # which makes any debug instruction numbers attached to the number invalid.
7 # This test tests that the relevant instruction number is dropped.
9 # CHECK-NOT: debug-instr-number
11 # CHECK-NOT: debug-instr-number
14 ; ModuleID = '/fast/fs/build34llvm4/reduced.ll'
15 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
16 target triple = "x86_64-unknown-linux-gnu"
18 %"class.std::vector.534" = type { %"struct.std::_Vector_base.535" }
19 %"struct.std::_Vector_base.535" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
20 %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { i8*, i8*, i8* }
22 ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
23 declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
25 define hidden fastcc void @soup() unnamed_addr !dbg !3 {
26 _ZN4llvm11raw_ostreamlsEPKc.exit2752:
27 %0 = load %"class.std::vector.534"*, %"class.std::vector.534"** undef, align 8, !dbg !7
28 %1 = load i8*, i8** undef, align 8, !dbg !7
29 %_M_start.i2756 = getelementptr inbounds %"class.std::vector.534", %"class.std::vector.534"* %0, i64 undef, i32 0, i32 0, i32 0, !dbg !7
30 %2 = load i8*, i8** %_M_start.i2756, align 8, !dbg !7
31 %sub.ptr.lhs.cast.i2757 = ptrtoint i8* %1 to i64, !dbg !7
32 %sub.ptr.rhs.cast.i2758 = ptrtoint i8* %2 to i64, !dbg !7
33 %sub.ptr.sub.i2759 = sub i64 %sub.ptr.lhs.cast.i2757, %sub.ptr.rhs.cast.i2758, !dbg !7
34 %conv373 = trunc i64 %sub.ptr.sub.i2759 to i32, !dbg !7
35 call void @llvm.dbg.value(metadata i32 %conv373, metadata !8, metadata !DIExpression()), !dbg !7
36 %cmp375.not2842 = icmp eq i32 %conv373, 0, !dbg !7
37 br i1 %cmp375.not2842, label %for.cond.cleanup376, label %for.body377, !dbg !7
39 for.cond.cleanup376: ; preds = %_ZN4llvm11raw_ostreamlsEPKc.exit2752
42 for.body377: ; preds = %_ZN4llvm11raw_ostreamlsEPKc.exit2752
46 ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
47 declare void @llvm.dbg.value(metadata, metadata, metadata) #0
49 attributes #0 = { nofree nosync nounwind readnone speculatable willreturn }
51 !llvm.module.flags = !{!0}
54 !0 = !{i32 2, !"Debug Info Version", i32 3}
55 !1 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, producer: "beards", isOptimized: true, runtimeVersion: 4, emissionKind: FullDebug)
56 !2 = !DIFile(filename: "bees.cpp", directory: "")
57 !3 = distinct !DISubprogram(name: "nope", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1)
58 !4 = !DISubroutineType(types: !5)
60 !6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
61 !7 = !DILocation(line: 1, scope: !3)
62 !8 = !DILocalVariable(name: "flannel", scope: !3)
68 tracksRegLiveness: true
71 - { id: 0, class: gr64 }
72 - { id: 1, class: gr64 }
73 - { id: 2, class: gr32 }
74 - { id: 3, class: gr32 }
77 machineFunctionInfo: {}
79 bb.0._ZN4llvm11raw_ostreamlsEPKc.exit2752:
80 successors: %bb.1(0x30000000), %bb.2(0x50000000)
82 %1:gr64 = IMPLICIT_DEF
83 %0:gr64 = MOV64rm killed %1, 1, $noreg, 0, $noreg, debug-location !7 :: (load (s64) from `i8** undef`)
84 %2:gr32 = COPY %0.sub_32bit, debug-location !7
85 %3:gr32 = SUB32rm %2, %0, 1, $noreg, 0, $noreg, implicit-def $eflags, debug-instr-number 1, debug-location !7 :: (load (s32) from %ir._M_start.i2756, align 8)
86 DBG_INSTR_REF !8, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0), debug-location !7
\r
87 JCC_1 %bb.2, 5, implicit $eflags, debug-location !7
88 JMP_1 %bb.1, debug-location !7
90 bb.1.for.cond.cleanup376: