Index: llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp =================================================================== --- llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -2180,13 +2180,7 @@ bool IRTranslator::translate(const Instruction &Inst) { CurBuilder->setDebugLoc(Inst.getDebugLoc()); - // We only emit constants into the entry block from here. To prevent jumpy - // debug behaviour set the line to 0. - if (const DebugLoc &DL = Inst.getDebugLoc()) - EntryBuilder->setDebugLoc( - DebugLoc::get(0, 0, DL.getScope(), DL.getInlinedAt())); - else - EntryBuilder->setDebugLoc(DebugLoc()); + EntryBuilder->setDebugLoc(DebugLoc()); auto &TLI = *MF->getSubtarget().getTargetLowering(); if (TLI.fallBackToDAGISel(Inst)) Index: llvm/test/CodeGen/AArch64/GlobalISel/constant-dbg-loc.ll =================================================================== --- llvm/test/CodeGen/AArch64/GlobalISel/constant-dbg-loc.ll +++ llvm/test/CodeGen/AArch64/GlobalISel/constant-dbg-loc.ll @@ -12,10 +12,10 @@ ; CHECK: bb.1.entry: ; CHECK: successors: %bb.2(0x40000000), %bb.3(0x40000000) ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 - ; CHECK: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @var1, debug-location !DILocation(line: 0, scope: !18) + ; CHECK: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @var1 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 2 - ; CHECK: [[GV1:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @var2, debug-location !DILocation(line: 0, scope: !22) + ; CHECK: [[GV1:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @var2 ; CHECK: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.0.retval ; CHECK: G_STORE [[C]](s32), [[FRAME_INDEX]](p0) :: (store 4 into %ir.retval) ; CHECK: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[GV]](p0), debug-location !17 :: (dereferenceable load 4 from @var1) Index: llvm/test/DebugInfo/debugline-no-prologue_end.ll =================================================================== --- /dev/null +++ llvm/test/DebugInfo/debugline-no-prologue_end.ll @@ -0,0 +1,41 @@ +; RUN: llc -march=arm64 -filetype=obj -O0 %s -o - | llvm-dwarfdump -debug-line - | FileCheck %s +; CHECK-NOT: 0x{{.*}} 0 0 1 0 is_stmt prologue_end + +; ModuleID = 'debugline-no-prologue_end.c' +source_filename = "debugline-no-prologue_end.c" +target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" +target triple = "arm64" + +@.str = private unnamed_addr constant [7 x i8] c"Hello\0A\00", align 1 + +; Function Attrs: noinline nounwind optnone +define dso_local i32 @main() #0 !dbg !7 { +entry: + %retval = alloca i32, align 4 + store i32 0, i32* %retval, align 4 + %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)), !dbg !11 + ret i32 0, !dbg !12 +} + +declare dso_local i32 @printf(i8*, ...) #1 + +attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="non-leaf" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="non-leaf" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4, !5} +!llvm.ident = !{!6} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git bd87c6bce1c30cc089ffdea5e0f3cf5407ed37c5)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) +!1 = !DIFile(filename: "debugline-no-prologue_end.c", directory: "/home/bft/Jaydeep/llvm_all/debug/llvm-project/build/bin") +!2 = !{} +!3 = !{i32 7, !"Dwarf Version", i32 4} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !{i32 1, !"wchar_size", i32 4} +!6 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git bd87c6bce1c30cc089ffdea5e0f3cf5407ed37c5)"} +!7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 2, type: !8, scopeLine: 3, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) +!8 = !DISubroutineType(types: !9) +!9 = !{!10} +!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!11 = !DILocation(line: 4, column: 4, scope: !7) +!12 = !DILocation(line: 5, column: 4, scope: !7)