1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[llc] Default MCUseDwarfDirectory to true

For Clang, `MCUseDwarfDirectory` is true by default for the majority cases
(-fintegrated-as or -gdwarf-5; most targets use -fintegrated-as by default).
Defaulting MCUseDwarfDirectory to true can reduce the differences between clang
and llc.

Reviewed By: #debug-info, dblaikie

Differential Revision: https://reviews.llvm.org/D105856
This commit is contained in:
Fangrui Song 2021-07-12 17:44:02 -07:00
parent 87b700cb10
commit 99778149bd
8 changed files with 21 additions and 16 deletions

View File

@ -3,18 +3,22 @@
; REQUIRES: object-emission
; RUN: %llc_dwarf -dwarf-version 4 -filetype=asm -o - %s | FileCheck %s --check-prefix=ASM-4
; RUN: %llc_dwarf -dwarf-version 4 -filetype=asm -dwarf-directory=0 < %s | FileCheck %s --check-prefix=ASM-4-GAS
; RUN: %llc_dwarf -dwarf-version 5 -filetype=asm -o - %s | FileCheck %s --check-prefix=ASM-5
; RUN: %llc_dwarf -dwarf-version 4 -filetype=obj -o %t4.o %s
; RUN: llvm-dwarfdump -debug-line %t4.o | FileCheck %s --check-prefix=OBJ
; RUN: %llc_dwarf -dwarf-version 5 -filetype=obj -o %t5.o %s
; RUN: llvm-dwarfdump -debug-line %t5.o | FileCheck %s --check-prefixes=OBJ,OBJ-5
; ASM-4-GAS: .file 1 "/scratch{{/|\\\\}}t1.h"
; ASM-4-GAS: .file 2 "/scratch{{/|\\\\}}t2.h"
; ASM-4-NOT: .file 0
; ASM-4: .file 1 "/scratch{{.*[/\\]}}t1.h"
; ASM-4: .file 1 "/scratch" "t1.h"
; ASM-4-NOT: md5
; ASM-4: .file 2 "/scratch{{.*[/\\]}}t2.h"
; ASM-4: .file 2 "/scratch" "t2.h"
; ASM-4-NOT: md5
; ASM-5: .file 0 "/scratch{{.*[/\\]}}t.c" md5 0x00000000000000000000000000000000
; ASM-5: .file 0 "/scratch" "t.c" md5 0x00000000000000000000000000000000
; ASM-5: .file 1 "t1.h" md5 0x11111111111111111111111111111111
; ASM-5: .file 2 "t2.h" md5 0x22222222222222222222222222222222

View File

@ -9,9 +9,9 @@
; RUN: %llc_dwarf -dwarf-version 5 -filetype=obj -o %t5.o %s
; RUN: llvm-dwarfdump -debug-line %t5.o | FileCheck %s --check-prefixes=OBJ,OBJ-5
; ASM-4: .file 1 "/test{{.*[/\\]}}t1.h" source "11111111111111111111111111111111"
; ASM-4: .file 2 "/test{{.*[/\\]}}t2.h" source "22222222222222222222222222222222"
; ASM-5: .file 0 "/test{{.*[/\\]}}t.c" source "00000000000000000000000000000000"
; ASM-4: .file 1 "/test" "t1.h" source "11111111111111111111111111111111"
; ASM-4: .file 2 "/test" "t2.h" source "22222222222222222222222222222222"
; ASM-5: .file 0 "/test" "t.c" source "00000000000000000000000000000000"
; ASM-5: .file 1 "t1.h" source "11111111111111111111111111111111"
; ASM-5: .file 2 "t2.h" source "22222222222222222222222222222222"

View File

@ -27,8 +27,8 @@
; interpretations depending on which CU lead to the table - so ensure that
; full paths are always emitted in this case, never comp_dir relative.
; ASM: .file 1 "/tmp/dbginfo/a{{[/\\]+}}a.cpp"
; ASM: .file 2 "/tmp/dbginfo/b{{[/\\]+}}b.cpp"
; ASM: .file 1 "/tmp/dbginfo/a" "a.cpp"
; ASM: .file 2 "/tmp/dbginfo/b" "b.cpp"
; Generated from the following source compiled to bitcode from within their
; respective directories (with debug info) and linked together with llvm-link

View File

@ -1,4 +1,4 @@
; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda | FileCheck %s
; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -dwarf-directory=0 | FileCheck %s
; CHECK: .target sm_20, debug

View File

@ -1,4 +1,4 @@
; RUN: llc -mtriple=nvptx64-nvidia-cuda < %s | FileCheck %s
; RUN: llc -mtriple=nvptx64-nvidia-cuda -dwarf-directory=0 < %s | FileCheck %s
; CHECK: .target sm_{{[0-9]+}}, debug

View File

@ -1,4 +1,4 @@
; RUN: llc -enable-dwarf-directory -mtriple x86_64-apple-darwin10.0.0 < %s | FileCheck %s
; RUN: llc -mtriple x86_64-apple-darwin10.0.0 < %s | FileCheck %s
; Verify that the file name is relative to the directory.
; rdar://problem/8884898

View File

@ -22,7 +22,7 @@
; CHECK: .file 2 "B.asm"
; CHECK: .loc 1 111
; CHECK: .loc 2 222
; CHECK: .file 3 "{{.*[/\\]}}test.c"
; CHECK: .file 3 "{{.*}}" "test.c"
; CHECK: .loc 3 14 0
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

View File

@ -126,9 +126,10 @@ static cl::opt<bool> DisableSimplifyLibCalls("disable-simplify-libcalls",
static cl::opt<bool> ShowMCEncoding("show-mc-encoding", cl::Hidden,
cl::desc("Show encoding in .s output"));
static cl::opt<bool> EnableDwarfDirectory(
"enable-dwarf-directory", cl::Hidden,
cl::desc("Use .file directives with an explicit directory."));
static cl::opt<bool>
DwarfDirectory("dwarf-directory", cl::Hidden,
cl::desc("Use .file directives with an explicit directory"),
cl::init(true));
static cl::opt<bool> AsmVerbose("asm-verbose",
cl::desc("Add comments to directives."),
@ -473,7 +474,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
TargetMachine::parseBinutilsVersion(BinutilsVersion);
Options.DisableIntegratedAS = NoIntegratedAssembler;
Options.MCOptions.ShowMCEncoding = ShowMCEncoding;
Options.MCOptions.MCUseDwarfDirectory = EnableDwarfDirectory;
Options.MCOptions.MCUseDwarfDirectory = DwarfDirectory;
Options.MCOptions.AsmVerbose = AsmVerbose;
Options.MCOptions.PreserveAsmComments = PreserveComments;
Options.MCOptions.IASSearchPaths = IncludeDirs;