97 lines · plain
1# RUN: llc %s -o - -experimental-debug-variable-locations -run-pass=peephole-opt | FileCheck %s2#3# X86 initially produces subtract operations to perform comparisons, and then4# downgrades them into cmp instructions if nothing uses the result. It does this5# 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.8#9# CHECK-NOT: debug-instr-number10# CHECK: CMP32rm11# CHECK-NOT: debug-instr-number12#13--- |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"17 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 { ptr, ptr, ptr }21 22 ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn23 declare void @llvm.dbg.declare(metadata, metadata, metadata) #024 25 define hidden fastcc void @soup() unnamed_addr !dbg !3 {26 _ZN4llvm11raw_ostreamlsEPKc.exit2752:27 %0 = load ptr, ptr undef, align 8, !dbg !728 %1 = load ptr, ptr undef, align 8, !dbg !729 %_M_start.i2756 = getelementptr inbounds %"class.std::vector.534", ptr %0, i64 undef, i32 0, i32 0, i32 0, !dbg !730 %2 = load ptr, ptr %_M_start.i2756, align 8, !dbg !731 %sub.ptr.lhs.cast.i2757 = ptrtoint ptr %1 to i64, !dbg !732 %sub.ptr.rhs.cast.i2758 = ptrtoint ptr %2 to i64, !dbg !733 %sub.ptr.sub.i2759 = sub i64 %sub.ptr.lhs.cast.i2757, %sub.ptr.rhs.cast.i2758, !dbg !734 %conv373 = trunc i64 %sub.ptr.sub.i2759 to i32, !dbg !735 call void @llvm.dbg.value(metadata i32 %conv373, metadata !8, metadata !DIExpression()), !dbg !736 %cmp375.not2842 = icmp eq i32 %conv373, 0, !dbg !737 br i1 %cmp375.not2842, label %for.cond.cleanup376, label %for.body377, !dbg !738 39 for.cond.cleanup376: ; preds = %_ZN4llvm11raw_ostreamlsEPKc.exit275240 ret void41 42 for.body377: ; preds = %_ZN4llvm11raw_ostreamlsEPKc.exit275243 ret void44 }45 46 ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn47 declare void @llvm.dbg.value(metadata, metadata, metadata) #048 49 attributes #0 = { nofree nosync nounwind readnone speculatable willreturn }50 51 !llvm.module.flags = !{!0}52 !llvm.dbg.cu = !{!1}53 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)59 !5 = !{!6}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)63 64...65---66name: soup67alignment: 1668tracksRegLiveness: true69debugInstrRef: true70registers:71 - { id: 0, class: gr64 }72 - { id: 1, class: gr64 }73 - { id: 2, class: gr32 }74 - { id: 3, class: gr32 }75frameInfo:76 maxAlignment: 177machineFunctionInfo: {}78body: |79 bb.0._ZN4llvm11raw_ostreamlsEPKc.exit2752:80 successors: %bb.1(0x30000000), %bb.2(0x50000000)81 82 %1:gr64 = IMPLICIT_DEF83 %0:gr64 = MOV64rm killed %1, 1, $noreg, 0, $noreg, debug-location !7 :: (load (s64) from `ptr undef`)84 %2:gr32 = COPY %0.sub_32bit, debug-location !785 %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 !787 JCC_1 %bb.2, 5, implicit $eflags, debug-location !788 JMP_1 %bb.1, debug-location !789 90 bb.1.for.cond.cleanup376:91 RET 092 93 bb.2.for.body377:94 RET 095 96...97