This reverts commit rGa82d3e8a6e67.
CODEGENOPT(DebugPassManager, 1, 0) ///< Prints debug information for the new
///< pass manager.
CODEGENOPT(DisableRedZone , 1, 0) ///< Set when -mno-red-zone is enabled.
+CODEGENOPT(EnableDebugEntryValues, 1, 0) ///< Emit call site parameter dbg info
CODEGENOPT(IndirectTlsSegRefs, 1, 0) ///< Set when -mno-tls-direct-seg-refs
///< is specified.
CODEGENOPT(DisableTailCalls , 1, 0) ///< Do not emit tail calls.
def flto_unit: Flag<["-"], "flto-unit">,
HelpText<"Emit IR to support LTO unit features (CFI, whole program vtable opt)">;
def fno_lto_unit: Flag<["-"], "fno-lto-unit">;
+def femit_debug_entry_values : Flag<["-"], "femit-debug-entry-values">,
+ HelpText<"Enables debug info about call site parameter's entry values">;
def fdebug_pass_manager : Flag<["-"], "fdebug-pass-manager">,
HelpText<"Prints debug information for the new pass manager">;
def fno_debug_pass_manager : Flag<["-"], "fno-debug-pass-manager">,
Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning();
Options.EmitStackSizeSection = CodeGenOpts.StackSizeSection;
Options.EmitAddrsig = CodeGenOpts.Addrsig;
+ Options.EnableDebugEntryValues = CodeGenOpts.EnableDebugEntryValues;
Options.ForceDwarfFrameSection = CodeGenOpts.ForceDwarfFrameSection;
Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile;
(CGM.getCodeGenOpts().getDebuggerTuning() == llvm::DebuggerKind::LLDB ||
CGM.getCodeGenOpts().getDebuggerTuning() == llvm::DebuggerKind::GDB);
- if (!SupportsDWARFv4Ext && CGM.getCodeGenOpts().DwarfVersion < 5)
+ if (!SupportsDWARFv4Ext && CGM.getCodeGenOpts().DwarfVersion < 5 &&
+ !CGM.getCodeGenOpts().EnableDebugEntryValues)
return llvm::DINode::FlagZero;
return llvm::DINode::FlagAllCallsDescribed;
Opts.DisableLLVMPasses = Args.hasArg(OPT_disable_llvm_passes);
Opts.DisableLifetimeMarkers = Args.hasArg(OPT_disable_lifetimemarkers);
+
+ const llvm::Triple::ArchType DebugEntryValueArchs[] = {
+ llvm::Triple::x86, llvm::Triple::x86_64, llvm::Triple::aarch64,
+ llvm::Triple::arm, llvm::Triple::armeb};
+
+ llvm::Triple T(TargetOpts.Triple);
+ if (Opts.OptimizationLevel > 0 && Opts.hasReducedDebugInfo() &&
+ llvm::is_contained(DebugEntryValueArchs, T.getArch()))
+ Opts.EnableDebugEntryValues = Args.hasArg(OPT_femit_debug_entry_values);
+
Opts.DisableO0ImplyOptNone = Args.hasArg(OPT_disable_O0_optnone);
Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
Opts.IndirectTlsSegRefs = Args.hasArg(OPT_mno_tls_direct_seg_refs);
// When entry values are emitted, expect a subprogram for extern decls so that
// the dwarf generator can describe call site parameters at extern call sites.
//
-// RUN: %clang -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - \
+// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - \
// RUN: | FileCheck %s -check-prefix=DECLS-FOR-EXTERN
// Similarly, when the debugger tuning is gdb, expect a subprogram for extern
// RUN: | FileCheck %s -check-prefix=HAS-ATTR \
// RUN: -implicit-check-not=DISubprogram -implicit-check-not=DIFlagAllCallsDescribed
-// Supported: DWARF4 + GDB tuning, -O1
-// RUN: %clang_cc1 -emit-llvm -triple x86_64-linux-gnu \
+// Supported: DWARF4 + GDB tuning by using '-femit-debug-entry-values'
+// RUN: %clang_cc1 -femit-debug-entry-values -emit-llvm -triple x86_64-linux-gnu \
// RUN: %s -o - -O1 -disable-llvm-passes -debugger-tuning=gdb \
// RUN: -debug-info-kind=standalone -dwarf-version=4 \
// RUN: | FileCheck %s -check-prefix=HAS-ATTR \
// RUN: -implicit-check-not=DIFlagAllCallsDescribed
-// Supported: DWARF4 + LLDB tuning, -O1
-// RUN: %clang_cc1 -emit-llvm -triple x86_64-linux-gnu \
+// Supported: DWARF4 + LLDB tuning by using '-femit-debug-entry-values'
+// RUN: %clang_cc1 -femit-debug-entry-values -emit-llvm -triple x86_64-linux-gnu \
// RUN: %s -o - -O1 -disable-llvm-passes -debugger-tuning=lldb \
// RUN: -debug-info-kind=standalone -dwarf-version=4 \
// RUN: | FileCheck %s -check-prefix=HAS-ATTR \
// RUN: -implicit-check-not=DIFlagAllCallsDescribed
-// Unsupported: -O0
-// RUN: %clang_cc1 -emit-llvm -triple x86_64-linux-gnu \
+// Unsupported: -O0 + '-femit-debug-entry-values'
+// RUN: %clang_cc1 -femit-debug-entry-values -emit-llvm -triple x86_64-linux-gnu \
// RUN: %s -o - -O0 -disable-llvm-passes -debugger-tuning=gdb \
// RUN: -debug-info-kind=standalone -dwarf-version=4 \
// RUN: | FileCheck %s -check-prefix=NO-ATTR
f = tempfile.NamedTemporaryFile()
cmd = "echo 'int main() {}' | " \
- "%s -g -glldb -O1 -S -emit-llvm -x c -o %s -" % (compiler_path, f.name)
+ "%s -g -glldb -O1 -Xclang -femit-debug-entry-values -S -emit-llvm -x c -o %s -" % (compiler_path, f.name)
if os.popen(cmd).close() is not None:
return "Compiler can't compile with call site info enabled"
CXX_SOURCES := main.cpp
-CXXFLAGS_EXTRAS := -O2 -glldb
+CXXFLAGS_EXTRAS := -O2 -glldb -Xclang -femit-debug-entry-values
include Makefile.rules
static cl::opt<bool>
EnableDebugEntryValues("debug-entry-values",
- cl::desc("Enable debug info for the debug entry values"),
+ cl::desc("Emit debug info about parameter's entry values"),
cl::init(false));
static cl::opt<bool>
void setSupportsDefaultOutlining(bool Enable) {
Options.SupportsDefaultOutlining = Enable;
}
- void setSupportsDebugEntryValues(bool Enable) {
- Options.SupportsDebugEntryValues = Enable;
- }
bool shouldPrintMachineCode() const { return Options.PrintMachineCode; }
ExplicitEmulatedTLS(false), EnableIPRA(false),
EmitStackSizeSection(false), EnableMachineOutliner(false),
SupportsDefaultOutlining(false), EmitAddrsig(false),
- SupportsDebugEntryValues(false), EnableDebugEntryValues(false),
- ForceDwarfFrameSection(false) {}
+ EnableDebugEntryValues(false), ForceDwarfFrameSection(false) {}
/// PrintMachineCode - This flag is enabled when the -print-machineinstrs
/// option is specified on the command line, and should enable debugging
/// Emit address-significance table.
unsigned EmitAddrsig : 1;
- /// Set if the target supports the debug entry values by default.
- unsigned SupportsDebugEntryValues : 1;
- /// When set to true, the EnableDebugEntryValues option forces production
- /// of debug entry values even if the target does not officially support
- /// it. Useful for testing purposes only. This flag should never be checked
- /// directly, always use \ref ShouldEmitDebugEntryValues instead.
+ /// Emit debug info about parameter's entry values.
unsigned EnableDebugEntryValues : 1;
- /// NOTE: There are targets that still do not support the call site info
- /// production (the info about the arguments passed to the call, necessary
- /// for the debug entry values), so we keep using the experimental option
- /// (-debug-entry-values) to test them as well.
- bool ShouldEmitDebugEntryValues() const;
/// Emit DWARF debug frame section.
unsigned ForceDwarfFrameSection : 1;
"use-dwarf-ranges-base-address-specifier", cl::Hidden,
cl::desc("Use base address specifiers in debug_ranges"), cl::init(false));
-static cl::opt<bool> EmitDwarfDebugEntryValues(
- "emit-debug-entry-values", cl::Hidden,
- cl::desc("Emit the debug entry values"), cl::init(false));
-
static cl::opt<bool> GenerateARangeSection("generate-arange-section",
cl::Hidden,
cl::desc("Generate dwarf aranges"),
// a monolithic string offsets table without any header.
UseSegmentedStringOffsetsTable = DwarfVersion >= 5;
- // Emit call-site-param debug info for GDB and LLDB, if the target supports
- // the debug entry values feature. It can also be enabled explicitly.
- EmitDebugEntryValues = (Asm->TM.Options.ShouldEmitDebugEntryValues() &&
- (tuneForGDB() || tuneForLLDB())) ||
- EmitDwarfDebugEntryValues;
-
Asm->OutStreamer->getContext().setDwarfVersion(DwarfVersion);
}
DIE &CallSiteDIE = CU.constructCallSiteEntryDIE(ScopeDIE, CalleeDIE,
IsTail, PCAddr, CallReg);
- // Optionally emit call-site-param debug info.
- if (emitDebugEntryValues()) {
+ // GDB and LLDB support call site parameter debug info.
+ if (Asm->TM.Options.EnableDebugEntryValues &&
+ (tuneForGDB() || tuneForLLDB())) {
ParamSet Params;
// Try to interpret values of call site parameters.
collectCallSiteParameters(&MI, Params);
/// a monolithic sequence of string offsets.
bool UseSegmentedStringOffsetsTable;
- /// Enable production of call site parameters needed to print the debug entry
- /// values. Useful for testing purposes when a debugger does not support the
- /// feature yet.
- bool EmitDebugEntryValues;
-
/// Separated Dwarf Variables
/// In general these will all be for bits that are left in the
/// original object file, rather than things that are meant
return UseSegmentedStringOffsetsTable;
}
- bool emitDebugEntryValues() const {
- return EmitDebugEntryValues;
- }
-
bool shareAcrossDWOCUs() const;
/// Returns the Dwarf Version.
if (auto *TPC = getAnalysisIfAvailable<TargetPassConfig>()) {
auto &TM = TPC->getTM<TargetMachine>();
- if (TM.Options.ShouldEmitDebugEntryValues())
+ if (TM.Options.EnableDebugEntryValues)
emitEntryValues(MI, OpenRanges, VarLocIDs, Transfers, KillSet);
}
}
VarLocMap &VarLocIDs) {
if (auto *TPC = getAnalysisIfAvailable<TargetPassConfig>()) {
auto &TM = TPC->getTM<TargetMachine>();
- if (!TM.Options.ShouldEmitDebugEntryValues())
+ if (!TM.Options.EnableDebugEntryValues)
return;
}
CSInfo.emplace_back(Reg, ArgRegPair.ArgNo);
}
- if (TM.Options.ShouldEmitDebugEntryValues())
+ if (TM.Options.EnableDebugEntryValues)
MF.addCallArgsForwardingRegs(&*CallI, std::move(CSInfo));
}
- if (YamlMF.CallSitesInfo.size() && !TM.Options.ShouldEmitDebugEntryValues())
+ if (YamlMF.CallSitesInfo.size() && !TM.Options.EnableDebugEntryValues)
return error(Twine("Call site info provided but not used"));
return false;
}
MachineFunction::getCallSiteInfo(const MachineInstr *MI) {
assert(MI->isCandidateForCallSiteEntry() &&
"Call site info refers only to call (MI) candidates");
- if (!Target.Options.ShouldEmitDebugEntryValues())
+
+ if (!Target.Options.EnableDebugEntryValues)
return CallSitesInfo.end();
return CallSitesInfo.find(MI);
}
}
if (MI->isCandidateForCallSiteEntry() &&
- DAG->getTarget().Options.ShouldEmitDebugEntryValues())
+ DAG->getTarget().Options.EnableDebugEntryValues)
MF.addCallArgsForwardingRegs(MI, DAG->getSDCallSiteInfo(Node));
return MI;
bool TargetOptions::HonorSignDependentRoundingFPMath() const {
return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption;
}
-
-/// NOTE: There are targets that still do not support the call site info
-/// production (the info about the arguments passed to the call, necessary
-/// for the debug entry values), so we keep using the experimental option
-/// (-debug-entry-values) to test them as well.
-bool TargetOptions::ShouldEmitDebugEntryValues() const {
- return SupportsDebugEntryValues || EnableDebugEntryValues;
-}
RegsToPass.emplace_back(VA.getLocReg(), Arg);
RegsUsed.insert(VA.getLocReg());
const TargetOptions &Options = DAG.getTarget().Options;
- if (Options.SupportsDebugEntryValues)
+ if (Options.EnableDebugEntryValues)
CSInfo.emplace_back(VA.getLocReg(), i);
}
} else {
// AArch64 supports default outlining behaviour.
setSupportsDefaultOutlining(true);
-
- // AArch64 supports the debug entry values.
- setSupportsDebugEntryValues(true);
}
AArch64TargetMachine::~AArch64TargetMachine() = default;
isThisReturn = true;
}
const TargetOptions &Options = DAG.getTarget().Options;
- if (Options.SupportsDebugEntryValues)
+ if (Options.EnableDebugEntryValues)
CSInfo.emplace_back(VA.getLocReg(), i);
RegsToPass.push_back(std::make_pair(VA.getLocReg(), Arg));
} else if (isByVal) {
this->Options.NoTrapAfterNoreturn = true;
}
- // ARM supports the debug entry values.
- setSupportsDebugEntryValues(true);
-
initAsmInfo();
}
} else if (VA.isRegLoc()) {
RegsToPass.push_back(std::make_pair(VA.getLocReg(), Arg));
const TargetOptions &Options = DAG.getTarget().Options;
- if (Options.SupportsDebugEntryValues)
+ if (Options.EnableDebugEntryValues)
CSInfo.emplace_back(VA.getLocReg(), I);
if (isVarArg && IsWin64) {
// Win64 ABI requires argument XMM reg to be copied to the corresponding
setMachineOutliner(true);
- // x86 supports the debug entry values.
- setSupportsDebugEntryValues(true);
-
initAsmInfo();
}
-; RUN: llc < %s -mtriple=arm64-apple-darwin | FileCheck %s
+; RUN: llc < %s -debug-entry-values -mtriple=arm64-apple-darwin | FileCheck %s
; Stackmap Header: no constants - 6 callsites
; CHECK-LABEL: .section __LLVM_STACKMAPS,__llvm_stackmaps
-; RUN: llc -mtriple=arm64-apple-darwin -enable-misched=0 -mcpu=cyclone < %s | FileCheck %s
-; RUN: llc -mtriple=arm64-apple-darwin -enable-misched=0 -mcpu=cyclone -fast-isel -fast-isel-abort=1 < %s | FileCheck %s
+; RUN: llc -mtriple=arm64-apple-darwin -debug-entry-values -enable-misched=0 -mcpu=cyclone < %s | FileCheck %s
+; RUN: llc -mtriple=arm64-apple-darwin -debug-entry-values -enable-misched=0 -mcpu=cyclone -fast-isel -fast-isel-abort=1 < %s | FileCheck %s
; Trivial patchpoint codegen
;
; Verify the call site info. If the call site info is not
; in the valid state, an assert should be triggered.
-; RUN: llc < %s -mtriple=arm64-none-linux-gnu -stop-after=machineverifier -relocation-model=pic -aarch64-elf-ldtls-generation=1 < %s
+; RUN: llc < %s -debug-entry-values -mtriple=arm64-none-linux-gnu -stop-after=machineverifier -relocation-model=pic -aarch64-elf-ldtls-generation=1 < %s
; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -verify-machineinstrs < %s | FileCheck %s
; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -filetype=obj < %s | llvm-objdump -r - | FileCheck --check-prefix=CHECK-RELOC %s
; Next test would previously trigger an assertion responsible for verification of
; call site info state.
-; RUN: llc -stop-after=if-converter -mtriple=thumbv6t2-eabi %s -o -| FileCheck %s -check-prefix=CHECK-CALLSITE
+; RUN: llc -stop-after=if-converter -debug-entry-values -mtriple=thumbv6t2-eabi %s -o -| FileCheck %s -check-prefix=CHECK-CALLSITE
; CHECK-CALLSITE: name: test_used_flags
; CHECK-CALLSITE: callSites:
-# We do not support the call site info for the target now, so we use the experimental option (-debug-entry-values).
-
# RUN: llc -debug-entry-values -run-pass=none -verify-machineinstrs -o - %s | FileCheck %s
# Verify that it is possible to read and write MIR where a callSites entry
-# RUN: not llc -mtriple=x86_64-- -run-pass none %s -o - 2>&1 | FileCheck %s
+# RUN: not llc -mtriple=x86_64-- -run-pass none -debug-entry-values %s -o - 2>&1 | FileCheck %s
# CHECK: baa call instruction block out of range. Unable to reference bb:1
--- |
define dso_local i32 @baa(i32 %a) local_unnamed_addr {
-# RUN: not llc -mtriple=x86_64-- -run-pass none %s -o - 2>&1 | FileCheck %s
+# RUN: not llc -mtriple=x86_64-- -run-pass none -debug-entry-values %s -o - 2>&1 | FileCheck %s
# CHECK: baa call instruction offset out of range. Unable to reference instruction at bb: 0 at offset:1
--- |
define dso_local i32 @baa(i32 %a) local_unnamed_addr {
-# RUN: not llc -mtriple=x86_64-- -run-pass none %s -o - 2>&1 | FileCheck %s
+# RUN: not llc -mtriple=x86_64-- -run-pass none -debug-entry-values %s -o - 2>&1 | FileCheck %s
# CHECK: baa call site info should reference call instruction. Instruction at bb:0 at offset:0 is not a call instruction
--- |
define dso_local i32 @baa(i32 %a) local_unnamed_addr {
-# RUN: llc -mtriple=x86_64-- -run-pass none %s -o - 2>&1 | FileCheck %s
-# CHECK-NOT: Call site info provided but not used
+# RUN: not llc -mtriple=x86_64-- -run-pass none %s -o - 2>&1 | FileCheck %s
+# CHECK: Call site info provided but not used
--- |
define dso_local i32 @baa(i32 %a) local_unnamed_addr {
entry:
; Test call site info MIR printer and parser.Parser assertions and machine
; verifier will check the rest;
-; RUN: llc %s -stop-before=finalize-isel -o %t.mir
+; RUN: llc -debug-entry-values %s -stop-before=finalize-isel -o %t.mir
; RUN: cat %t.mir | FileCheck %s
; CHECK: name: fn2
; CHECK: callSites:
; CHECK-NEXT: arg: 0, reg: '$edi'
; CHECK-NEXT: arg: 1, reg: '$esi'
; CHECK-NEXT: arg: 2, reg: '$edx'
-; RUN: llc %t.mir -run-pass=finalize-isel -o -| FileCheck %s --check-prefix=PARSER
+; RUN: llc -debug-entry-values %t.mir -run-pass=finalize-isel -o -| FileCheck %s --check-prefix=PARSER
; Verify that we are able to parse output mir and that we are getting the same result.
; PARSER: name: fn2
; PARSER: callSites:
; Verify the call site info. If the call site info is not
; in the valid state, an assert should be triggered.
-; RUN: llc < %s -stop-after=machineverifier
+; RUN: llc < %s -debug-entry-values -stop-after=machineverifier
; REQUIRES: asserts
; RUN: llc -mcpu=haswell < %s -O2 2>&1 | FileCheck %s
; Verify the call site info. If the call site info is not
; in the valid state, an assert should be triggered.
-; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -x86-speculative-load-hardening -stop-after=machineverifier
+; RUN: llc < %s -debug-entry-values -mtriple=x86_64-unknown-linux-gnu -x86-speculative-load-hardening -stop-after=machineverifier
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -x86-speculative-load-hardening -data-sections | FileCheck %s --check-prefix=X64
; FIXME: Fix machine verifier issues and remove -verify-machineinstrs=0. PR39451.
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc -verify-machineinstrs < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -debug-entry-values < %s | FileCheck %s
; Check that we can lower a use of an alloca both as a deopt value (where the
; exact meaning is up to the consumer of the stackmap) and as an explicit spill
; slot used for GC.
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -debug-entry-values | FileCheck %s
; Function Attrs: uwtable
; When tail-duplicating during placement, we work backward from blocks with
-; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
-; RUN: llc -verify-machineinstrs -filetype=asm -o - \
+; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - \
; RUN: -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC
define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" {
-; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
-; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu \
+; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu \
; RUN: -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC
define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" {
-; RUN: llc -mtriple aarch64-linux-gnu %s -o - -stop-before=finalize-isel | FileCheck %s
+; RUN: llc -mtriple aarch64-linux-gnu -debug-entry-values %s -o - -stop-before=finalize-isel | FileCheck %s
; Verify that Selection DAG knows how to recognize simple function parameter forwarding registers.
; Produced from:
; extern int fn1(int,int,int);
-; RUN: llc -mtriple arm-linux-gnu %s -o - -stop-before=finalize-isel | FileCheck %s
+; RUN: llc -mtriple arm-linux-gnu -debug-entry-values %s -o - -stop-before=finalize-isel | FileCheck %s
; Verify that Selection DAG knows how to recognize simple function parameter forwarding registers.
; Produced from:
; extern int fn1(int,int,int);
-; RUN: llc -filetype=asm -o - %s | FileCheck %s
+; RUN: llc -debug-entry-values -filetype=asm -o - %s | FileCheck %s
; Verify that the size operands of the DW_OP_GNU_entry_value operations are
; correct for the multi-byte DW_OP_regx expressions.
-# RUN: llc -mtriple aarch64-linux-gnu -start-after=machineverifier -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s
+# RUN: llc -mtriple aarch64-linux-gnu -debug-entry-values -start-after=machineverifier -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s
#
# Based on the following C reproducer:
#
-# RUN: llc -mtriple aarch64-linux-gnu -start-after=machineverifier -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s
+# RUN: llc -mtriple aarch64-linux-gnu -debug-entry-values -start-after=machineverifier -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s
# Following code is used for producing this test case. Note that
# some of argument loading instruction are modified in order to
# cover certain cases.
-# RUN: llc -start-after=livedebugvalues -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
+# RUN: llc -debug-entry-values -start-after=livedebugvalues -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
# Based on the following C reproducer:
#
-# RUN: llc -mtriple=arm-linux-gnueabi -filetype=obj -start-after=machineverifier %s -o -| llvm-dwarfdump -| FileCheck %s
+# RUN: llc -mtriple=arm-linux-gnueabi -debug-entry-values -filetype=obj -start-after=machineverifier %s -o -| llvm-dwarfdump -| FileCheck %s
# Following code is used for producing this test case. Note that
# some of argument loading instruction are modified in order to
# cover certain cases.
-# RUN: llc -run-pass=livedebugvalues -o - %s | FileCheck %s
+# RUN: llc -debug-entry-values -run-pass=livedebugvalues -o - %s | FileCheck %s
# Based on the following C reproducer:
#
#
# Generated using:
#
-# clang -Os -fno-inline -g --target=armeb.
+# clang -Os -fno-inline -Xclang -femit-debug-entry-values -g --target=armeb.
--- |
target datalayout = "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
-# RUN: llc -mtriple=arm-linux-gnu -run-pass if-converter %s -o -| FileCheck %s
+# RUN: llc -mtriple=arm-linux-gnu -debug-entry-values -run-pass if-converter %s -o -| FileCheck %s
# Vefify that the call site info will be updated after the optimization.
# This test case would previously trigger an assertion when
#
# With slight change of MIR - substitution of BL instruction with BL_pred
# in order to trigger optimization.
-# clang -target arm-linux-gnu -g -O2 %s -stop-before=if-convert
+# clang -target arm-linux-gnu -g -O2 -Xclang -femit-debug-entry-values
+# %s -stop-before=if-convert
#
# CHECK: callSites:
# CHECK-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs:
-# We do not support the call site info for the target now, so we use the experimental option (-debug-entry-values).
-
-# RUN: llc -debug-entry-values -mtriple hexagon -start-after=machineverifier -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
+# RUN: llc -mtriple hexagon -debug-entry-values -start-after=machineverifier -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
# Based on the following C reproducer:
#
-# We do not support the call site info for the target now, so we use the experimental option (-debug-entry-values).
-
# RUN: llc -debug-entry-values -run-pass=livedebugvalues -o - %s | FileCheck %s
# Verify that the entry values for the input parameters are inserted after the
-# We do not support the call site info for the target now, so we use the experimental option (-debug-entry-values).
-
# RUN: llc -debug-entry-values -start-after=livedebugvalues -o - %s | FileCheck %s
# This test would previously trigger an assertion when trying to describe the
-# RUN: llc -start-before=livedebugvalues -mtriple=x86_64-apple-darwin -o %t %s -filetype=obj
+# RUN: llc -debug-entry-values -start-before=livedebugvalues -mtriple=x86_64-apple-darwin -o %t %s -filetype=obj
# RUN: llvm-dwarfdump %t | FileCheck %s
#
# int global;
# Test the call site encoding in DWARF5 vs GNU extensions.
#
-# RUN: llc -dwarf-version 4 -debugger-tune=gdb -filetype=obj \
+# RUN: llc -dwarf-version 4 -debugger-tune=gdb -debug-entry-values -filetype=obj \
# RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \
# RUN: | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-GNU
#
-# RUN: llc -dwarf-version 5 -debugger-tune=lldb -filetype=obj \
+# RUN: llc -dwarf-version 5 -debugger-tune=lldb -debug-entry-values -filetype=obj \
# RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \
# RUN: | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5
#
-# RUN: llc -dwarf-version 5 -filetype=obj \
-# RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \
-# RUN: | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5
-#
-# RUN: llc -dwarf-version 5 -filetype=obj -debugger-tune=sce -emit-debug-entry-values \
+# RUN: llc -dwarf-version 5 -debug-entry-values -filetype=obj \
# RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \
# RUN: | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5
#
# into the forwarding register has a memory operand and multiple defs.
# The generated code was modified a bit in order to have the scenario.
#
-# RUN: llc -start-after=machineverifier -filetype=obj %s -o - \
+# RUN: llc -debug-entry-values -start-after=machineverifier -filetype=obj %s -o - \
# RUN: | llvm-dwarfdump - | FileCheck %s --implicit-check-not=DW_TAG_GNU_call_site_parameter
#
-# Command: clang -g -O2 test.c
+# Command: clang -g -O2 -Xclang -femit-debug-entry-values test.c
# -mllvm -stop-before=machineverifier -o test.mir -c
# extern void callee(int);
# extern int y;
# Check that llvm can describe a call site parameter which resides in a spill slot.
#
-# RUN: llc -start-after=machineverifier -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
+# RUN: llc -debug-entry-values -start-after=machineverifier -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
#
# Command:
-# $ ~/src/builds/llvm-project-master-RA/bin/clang -g -O2 -c -o spill.o spill.cc -mllvm -stop-before=machineverifier -o spill.mir
+# $ ~/src/builds/llvm-project-master-RA/bin/clang -g -Xclang -femit-debug-entry-values -O2 -c -o spill.o spill.cc -mllvm -stop-before=machineverifier -o spill.mir
#
# Source:
## extern void callee(int);
-# RUN: llc -start-after=livedebugvalues -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s
+# RUN: llc -debug-entry-values -start-after=livedebugvalues -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s
# Based on the following reproducer:
#
-# RUN: llc -start-after=machineverifier -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s
+# RUN: llc -debug-entry-values -start-after=machineverifier -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s
#
# CHECK: DW_TAG_GNU_call_site
# CHECK-NEXT: DW_AT_abstract_origin {{.*}} "foo"
-# RUN: llc -start-after=machineverifier -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s
+# RUN: llc -debug-entry-values -start-after=machineverifier -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s
# CHECK: DW_TAG_GNU_call_site
# CHECK-NEXT: DW_AT_abstract_origin {{.*}} "foo")
# CHECK-NEXT: DW_AT_low_pc {{.*}}
-# RUN: llc -start-before=livedebugvalues -filetype=obj -o - %s \
+# RUN: llc -debug-entry-values -start-before=livedebugvalues -filetype=obj -o - %s \
# RUN: | llvm-dwarfdump - | FileCheck %s --implicit-check-not=DW_TAG_GNU_call_site_parameter
--- |
-# RUN: llc -start-before=livedebugvalues -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
+# RUN: llc -debug-entry-values -start-before=livedebugvalues -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
# Based on the following C++ code:
# struct A { A(A &) {} };
-# RUN: llc -start-before=livedebugvalues -filetype=obj -o - %s \
+# RUN: llc -debug-entry-values -start-before=livedebugvalues -filetype=obj -o - %s \
# RUN: | llvm-dwarfdump - | FileCheck %s --implicit-check-not=DW_TAG_GNU_call_site_parameter
--- |
-# RUN: llc -O1 -start-after=livedebugvalues -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
+# RUN: llc -O1 -debug-entry-values -start-after=livedebugvalues -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
# Based on the following C reproducer:
#
-# RUN: llc -run-pass=livedebugvalues -march=x86-64 -o - %s | FileCheck %s
+# RUN: llc -debug-entry-values -run-pass=livedebugvalues -march=x86-64 -o - %s | FileCheck %s
#
#extern void fn2(int);
#
# When the debugger tuning is set to gdb, use GNU opcodes.
# For lldb, use the standard DWARF5 opcodes.
-# RUN: llc -debugger-tune=gdb -filetype=obj -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-GNU
-# RUN: llc -debugger-tune=lldb -filetype=obj -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5
+# RUN: llc -debug-entry-values -debugger-tune=gdb -filetype=obj -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-GNU
+# RUN: llc -debug-entry-values -debugger-tune=lldb -filetype=obj -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5
#
# extern void foo(int *a, int b, int c, int d, int e, int f);
# extern int getVal();
-# RUN: llc -run-pass=livedebugvalues -march=x86-64 -o - %s | FileCheck %s
+# RUN: llc -debug-entry-values -run-pass=livedebugvalues -march=x86-64 -o - %s | FileCheck %s
#
#extern void fn1 (int, int, int);
#
-# RUN: llc -run-pass=livedebugvalues -march=x86-64 -o - %s | FileCheck %s
+# RUN: llc -debug-entry-values -run-pass=livedebugvalues -march=x86-64 -o - %s | FileCheck %s
#
# The test case was artificially adjusted, in order to make proper diamond basic
# block structure relevant to the debug entry values propagation.
-# RUN: llc -run-pass=livedebugvalues -march=x86-64 -o - %s | FileCheck %s
+# RUN: llc -debug-entry-values -run-pass=livedebugvalues -march=x86-64 -o - %s | FileCheck %s
#
# The test case was artificially adjusted, in order to make proper diamond basic
# block structure relevant to the debug entry values clobbering.
-# RUN: llc -run-pass=livedebugvalues -march=x86-64 -o - %s| FileCheck %s
+# RUN: llc -debug-entry-values -run-pass=livedebugvalues -march=x86-64 -o - %s| FileCheck %s
#
#int global;
#int foo(int p, int q, int r) {
-# RUN: llc -run-pass=livedebugvalues -march=x86-64 -o - %s | FileCheck %s
+# RUN: llc -debug-entry-values -run-pass=livedebugvalues -march=x86-64 -o - %s | FileCheck %s
#
#extern void fn1 (int, int, int);
#__attribute__((noinline))
-# RUN: llc -mtriple=x86_64-pc-linux -run-pass=unreachable-mbb-elimination -o - %s | FileCheck %s
+# RUN: llc -mtriple=x86_64-pc-linux -debug-entry-values -run-pass=unreachable-mbb-elimination -o - %s | FileCheck %s
# Verify that the call site information for the call residing in the eliminated
# block is removed. This test case would previously trigger an assertion when
-; We do not support the call site info for the target now, so we use the experimental option (-debug-entry-values).
-
; RUN: llc -debug-entry-values -filetype=asm -o - %s | FileCheck %s
; Verify that the entry value covers both of the DW_OP_regx pieces. Previously
;CHECK-NEXT: .quad [[CLOBBER_OFF]]
;CHECK-NEXT: .short 1 ## Loc expr size
;CHECK-NEXT: .byte 85 ## DW_OP_reg
-;CHECK: .quad 0
+;CHECK-NEXT: .quad 0
;CHECK-NEXT: .quad 0
!24 = !{i32 1, !"Debug Info Version", i32 3}
; ASM: movl $1, x(%rip)
; ASM: callq clobber
; ASM-NEXT: [[argc_range_end:.Ltmp[0-9]+]]:
-; ASM: #DEBUG_VALUE: main:argc <- [DW_OP_LLVM_entry_value 1] $ecx
+; Previously LiveDebugValues would claim argc was still in ecx after the call.
+; ASM-NOT: #DEBUG_VALUE: main:argc
; argc is the first debug location.
; ASM: .Ldebug_loc1:
; DWARF: .debug_info contents:
; DWARF: DW_TAG_formal_parameter
; DWARF-NEXT: DW_AT_location ({{0x.*}}
-; DWARF-NEXT: [0x0000000000000000, 0x0000000000000013): DW_OP_reg2 RCX
-; DWARF-NEXT: [0x0000000000000013, 0x0000000000000043): DW_OP_GNU_entry_value(DW_OP_reg2 RCX), DW_OP_stack_value
+; DWARF-NEXT: [0x0000000000000000, 0x0000000000000013): DW_OP_reg2 RCX)
; DWARF-NEXT: DW_AT_name ("argc")
; ModuleID = 't.cpp'
-; RUN: llc -O1 -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
+; RUN: llc -O1 -debug-entry-values -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
; Verify that the 64-bit call site immediates are not truncated.
;
-; RUN: llc -O3 -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
+; RUN: llc -O3 -debug-entry-values -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; void b(int i) { asm("" : : : "rdi"); }
; CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000000
-; CHECK-NEXT: DW_LLE_startx_length (0x0000000000000000, 0x0000000000000006): DW_OP_reg5 RDI
-; CHECK-NEXT: DW_LLE_startx_length (0x0000000000000001, 0x0000000000000002): DW_OP_GNU_entry_value(DW_OP_reg5 RDI), DW_OP_stack_value)
+; CHECK-NEXT: DW_LLE_startx_length (0x0000000000000000, 0x0000000000000006): DW_OP_reg5 RDI)
; CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000000
-; CHECK-NEXT: DW_LLE_startx_length (0x0000000000000000, 0x0000000000000000): DW_OP_reg5 RDI
-; CHECK-NEXT: DW_LLE_startx_length (0x0000000000000001, 0x0000000000000001): DW_OP_GNU_entry_value(DW_OP_reg5 RDI), DW_OP_stack_value)
+; CHECK-NEXT: DW_LLE_startx_length (0x0000000000000000, 0x0000000000000000): DW_OP_reg5 RDI)
target triple = "x86_64-unknown-linux-gnu"
+++ /dev/null
-; RUN: llc -O0 -dwarf-version=5 -debugger-tune=lldb -march=x86-64 -filetype=obj < %s \
-; RUN: | llvm-dwarfdump - | FileCheck --implicit-check-not=DW_OP_entry_value %s
-; RUN: llc -O0 -dwarf-version=5 -debugger-tune=gdb -march=x86-64 -filetype=obj < %s \
-; RUN: | llvm-dwarfdump - | FileCheck --implicit-check-not=DW_OP_entry_value %s
-
-; The call-site-params are created iff corresponding DISubprogram contains
-; the AllCallsDescribed DIFlag.
-; CHECK-NOT: DW_TAG_call_site_param
-
-; Genarated with:
-; clang -gdwarf-5 -O0 test.c -S -emit-llvm
-;
-; ModuleID = 'test.c'
-target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-; Function Attrs: noinline nounwind optnone uwtable
-define dso_local void @fn1(i32 %x, i32 %y) !dbg !7 {
-entry:
- %x.addr = alloca i32, align 4
- %y.addr = alloca i32, align 4
- %u = alloca i32, align 4
- %a = alloca i32, align 4
- store i32 %x, i32* %x.addr, align 4
- call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !11, metadata !DIExpression()), !dbg !12
- store i32 %y, i32* %y.addr, align 4
- call void @llvm.dbg.declare(metadata i32* %y.addr, metadata !13, metadata !DIExpression()), !dbg !14
- call void @llvm.dbg.declare(metadata i32* %u, metadata !15, metadata !DIExpression()), !dbg !16
- %0 = load i32, i32* %x.addr, align 4, !dbg !16
- %1 = load i32, i32* %y.addr, align 4, !dbg !16
- %add = add nsw i32 %0, %1, !dbg !16
- store i32 %add, i32* %u, align 4, !dbg !16
- %2 = load i32, i32* %x.addr, align 4, !dbg !17
- %cmp = icmp sgt i32 %2, 1, !dbg !17
- br i1 %cmp, label %if.then, label %if.else, !dbg !16
-
-if.then: ; preds = %entry
- %3 = load i32, i32* %u, align 4, !dbg !17
- %add1 = add nsw i32 %3, 1, !dbg !17
- store i32 %add1, i32* %u, align 4, !dbg !17
- br label %if.end, !dbg !17
-
-if.else: ; preds = %entry
- %4 = load i32, i32* %u, align 4, !dbg !17
- %add2 = add nsw i32 %4, 2, !dbg !17
- store i32 %add2, i32* %u, align 4, !dbg !17
- br label %if.end
-
-if.end: ; preds = %if.else, %if.then
- call void @llvm.dbg.declare(metadata i32* %a, metadata !19, metadata !DIExpression()), !dbg !16
- store i32 7, i32* %a, align 4, !dbg !16
- %5 = load i32, i32* %a, align 4, !dbg !16
- call void @fn2(i32 %5), !dbg !16
- %6 = load i32, i32* %u, align 4, !dbg !16
- %dec = add nsw i32 %6, -1, !dbg !16
- store i32 %dec, i32* %u, align 4, !dbg !16
- ret void, !dbg !16
-}
-
-; Function Attrs: nounwind readnone speculatable willreturn
-declare void @llvm.dbg.declare(metadata, metadata, metadata)
-
-declare dso_local void @fn2(i32)
-
-!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", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
-!1 = !DIFile(filename: "test.c", directory: "/")
-!2 = !{}
-!3 = !{i32 7, !"Dwarf Version", i32 5}
-!4 = !{i32 2, !"Debug Info Version", i32 3}
-!5 = !{i32 1, !"wchar_size", i32 4}
-!6 = !{!"clang version 11.0.0"}
-!7 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
-!8 = !DISubroutineType(types: !9)
-!9 = !{null, !10, !10}
-!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-!11 = !DILocalVariable(name: "x", arg: 1, scope: !7, file: !1, line: 5, type: !10)
-!12 = !DILocation(line: 5, column: 10, scope: !7)
-!13 = !DILocalVariable(name: "y", arg: 2, scope: !7, file: !1, line: 5, type: !10)
-!14 = !DILocation(line: 5, column: 17, scope: !7)
-!15 = !DILocalVariable(name: "u", scope: !7, file: !1, line: 6, type: !10)
-!16 = !DILocation(line: 6, column: 7, scope: !7)
-!17 = !DILocation(line: 7, column: 7, scope: !18)
-!18 = distinct !DILexicalBlock(scope: !7, file: !1, line: 7, column: 7)
-!19 = !DILocalVariable(name: "a", scope: !7, file: !1, line: 11, type: !10)
-; RUN: llc %s -o - -filetype=obj \
+; RUN: llc -debug-entry-values %s -o - -filetype=obj \
; RUN: | llvm-dwarfdump -statistics - | FileCheck %s
;
; CHECK: "entry value scope bytes covered":5
-; RUN: llc %s -o - -filetype=obj \
+; RUN: llc -debug-entry-values %s -o - -filetype=obj \
; RUN: | llvm-dwarfdump -statistics - | FileCheck %s
;
+; The LLVM IR file was generated on this source code by using
+; option '-femit-debug-entry-values'.
+;
; extern void foo(int *a, int b, int c, int d, int e, int f);
; extern int getVal();
;
-; RUN: llc %s -o - -filetype=obj \
+; RUN: llc -debug-entry-values %s -o - -filetype=obj \
; RUN: | llvm-dwarfdump -verify - | FileCheck %s
;
; CHECK: No errors.
; LOCSTATS: [10%,20%) 0 0%
; LOCSTATS: [20%,30%) 1 11%
; LOCSTATS: [30%,40%) 0 0%
-; LOCSTATS: [40%,50%) 0 0%
-; LOCSTATS: [50%,60%) 0 0%
-; LOCSTATS: [60%,70%) 3 33%
+; LOCSTATS: [40%,50%) 1 11%
+; LOCSTATS: [50%,60%) 1 11%
+; LOCSTATS: [60%,70%) 1 11%
; LOCSTATS: [70%,80%) 0 0%
; LOCSTATS: [80%,90%) 2 22%
; LOCSTATS: [90%,100%) 1 11%