diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -1554,8 +1554,12 @@ SmallString<128> Str; raw_svector_ostream OS1(Str); + bool UseDwarfDir = UseDwarfDirectory; + if (getContext().getDwarfVersion() < 5 && !MAI->useIntegratedAssembler()) + UseDwarfDir = false; + printDwarfFileDirective(FileNo, Directory, Filename, Checksum, Source, - UseDwarfDirectory, OS1); + UseDwarfDir, OS1); if (MCTargetStreamer *TS = getTargetStreamer()) TS->emitDwarfFileDirective(OS1.str()); diff --git a/llvm/test/DebugInfo/NVPTX/dbg-declare-alloca.ll b/llvm/test/DebugInfo/NVPTX/dbg-declare-alloca.ll --- a/llvm/test/DebugInfo/NVPTX/dbg-declare-alloca.ll +++ b/llvm/test/DebugInfo/NVPTX/dbg-declare-alloca.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -dwarf-directory=0 | FileCheck %s +; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda | FileCheck %s ; CHECK: .target sm_20, debug diff --git a/llvm/test/DebugInfo/NVPTX/debug-file-loc-only.ll b/llvm/test/DebugInfo/NVPTX/debug-file-loc-only.ll --- a/llvm/test/DebugInfo/NVPTX/debug-file-loc-only.ll +++ b/llvm/test/DebugInfo/NVPTX/debug-file-loc-only.ll @@ -27,8 +27,8 @@ ret void, !dbg !11 } -; CHECK-DAG: .file [[FOO]] "{{.*}}foo.h" -; CHECK-DAG: .file [[BAR]] "{{.*}}bar.cu" +; CHECK-DAG: .file [[FOO]] "/source/dir/foo.h" +; CHECK-DAG: .file [[BAR]] "/source/dir/bar.cu" ; CHECK-NOT: .section .debug{{.*}} diff --git a/llvm/test/DebugInfo/NVPTX/debug-file-loc.ll b/llvm/test/DebugInfo/NVPTX/debug-file-loc.ll --- a/llvm/test/DebugInfo/NVPTX/debug-file-loc.ll +++ b/llvm/test/DebugInfo/NVPTX/debug-file-loc.ll @@ -27,8 +27,8 @@ ret void, !dbg !11 } -; CHECK-DAG: .file [[FOO]] "{{.*}}foo.h" -; CHECK-DAG: .file [[BAR]] "{{.*}}bar.cu" +; CHECK-DAG: .file [[FOO]] "/source/dir/foo.h" +; CHECK-DAG: .file [[BAR]] "/source/dir/bar.cu" ; CHECK: .section .debug_abbrev ; CHECK-NEXT: { ; CHECK-NEXT: .b8 1 // Abbreviation Code diff --git a/llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll b/llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll --- a/llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll +++ b/llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll @@ -1,4 +1,4 @@ -; RUN: llc -mtriple=nvptx64-nvidia-cuda -dwarf-directory=0 < %s | FileCheck %s +; RUN: llc -mtriple=nvptx64-nvidia-cuda < %s | FileCheck %s ; CHECK: .target sm_{{[0-9]+}}, debug