[llvm] fada278 - [llc] Default MCUseDwarfDirectory to true

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 12 17:44:08 PDT 2021


Author: Fangrui Song
Date: 2021-07-12T17:44:02-07:00
New Revision: fada2782cf6f9eab40e1e028b0eca9d85f8800b3

URL: https://github.com/llvm/llvm-project/commit/fada2782cf6f9eab40e1e028b0eca9d85f8800b3
DIFF: https://github.com/llvm/llvm-project/commit/fada2782cf6f9eab40e1e028b0eca9d85f8800b3.diff

LOG: [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

Added: 
    

Modified: 
    llvm/test/CodeGen/Generic/dwarf-md5.ll
    llvm/test/CodeGen/Generic/dwarf-source.ll
    llvm/test/DebugInfo/Generic/lto-comp-dir.ll
    llvm/test/DebugInfo/NVPTX/dbg-declare-alloca.ll
    llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll
    llvm/test/DebugInfo/X86/dbg-file-name.ll
    llvm/test/DebugInfo/X86/inline-asm-locs.ll
    llvm/tools/llc/llc.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/Generic/dwarf-md5.ll b/llvm/test/CodeGen/Generic/dwarf-md5.ll
index 2fc25f3a3ed67..e76a70012a895 100644
--- a/llvm/test/CodeGen/Generic/dwarf-md5.ll
+++ b/llvm/test/CodeGen/Generic/dwarf-md5.ll
@@ -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
 

diff  --git a/llvm/test/CodeGen/Generic/dwarf-source.ll b/llvm/test/CodeGen/Generic/dwarf-source.ll
index 41441110f2f67..bd18eec770902 100644
--- a/llvm/test/CodeGen/Generic/dwarf-source.ll
+++ b/llvm/test/CodeGen/Generic/dwarf-source.ll
@@ -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"
 

diff  --git a/llvm/test/DebugInfo/Generic/lto-comp-dir.ll b/llvm/test/DebugInfo/Generic/lto-comp-dir.ll
index 9e781bd06807c..0eff732eec946 100644
--- a/llvm/test/DebugInfo/Generic/lto-comp-dir.ll
+++ b/llvm/test/DebugInfo/Generic/lto-comp-dir.ll
@@ -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

diff  --git a/llvm/test/DebugInfo/NVPTX/dbg-declare-alloca.ll b/llvm/test/DebugInfo/NVPTX/dbg-declare-alloca.ll
index 6bfc3d1e94c48..d5bd573c3b86d 100644
--- 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 | FileCheck %s
+; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -dwarf-directory=0 | FileCheck %s
 
 ; CHECK: .target sm_20, debug
 

diff  --git a/llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll b/llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll
index c932ea0af460c..43cc586fff198 100644
--- 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 < %s | FileCheck %s
+; RUN: llc -mtriple=nvptx64-nvidia-cuda -dwarf-directory=0 < %s | FileCheck %s
 
 ; CHECK: .target sm_{{[0-9]+}}, debug
 

diff  --git a/llvm/test/DebugInfo/X86/dbg-file-name.ll b/llvm/test/DebugInfo/X86/dbg-file-name.ll
index 633b9c069c542..a26b0f3c1f45a 100644
--- a/llvm/test/DebugInfo/X86/dbg-file-name.ll
+++ b/llvm/test/DebugInfo/X86/dbg-file-name.ll
@@ -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

diff  --git a/llvm/test/DebugInfo/X86/inline-asm-locs.ll b/llvm/test/DebugInfo/X86/inline-asm-locs.ll
index 75c334b61cc17..ef1f89235c54e 100644
--- a/llvm/test/DebugInfo/X86/inline-asm-locs.ll
+++ b/llvm/test/DebugInfo/X86/inline-asm-locs.ll
@@ -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"

diff  --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index c319b7dad813c..6a1e2bae20967 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -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;


        


More information about the llvm-commits mailing list