From 6a605b97a2006bd391f129a606483656b7c6fb28 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Wed, 12 Jan 2022 12:35:36 +0000 Subject: [DebugInfo] Move flag for instr-ref to LLVM option, from TargetOptions This feature was previously controlled by a TargetOptions flag, and I figured that codegen::InitTargetOptionsFromCodeGenFlags would default it to "on" for all frontends. Enabling by default was discussed here: https://lists.llvm.org/pipermail/llvm-dev/2021-November/153653.html and originally supposed to happen in 3c045070882f3, but it didn't actually take effect, as it turns out frontends initialize TargetOptions themselves. This patch moves the flag from a TargetOptions flag to a global flag to CodeGen, where it isn't immediately affected by the frontend being used. Hopefully this will actually cause instr-ref to be on by default on x86_64 now! This patch is easily reverted, and chances of turbulence are moderately high. If you need to revert, please consider instead commenting out the 'return true' part of llvm::debuginfoShouldUseDebugInstrRef to turn the feature off, and dropping me an email. Differential Revision: https://reviews.llvm.org/D116821 --- llvm/lib/CodeGen/MachineFunction.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/MachineFunction.cpp') diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 81ed3d0..fd5ea5c 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -76,6 +76,8 @@ #include #include +#include "LiveDebugValues/LiveDebugValues.h" + using namespace llvm; #define DEBUG_TYPE "codegen" @@ -1238,7 +1240,7 @@ bool MachineFunction::useDebugInstrRef() const { if (F.hasFnAttribute(Attribute::OptimizeNone)) return false; - if (getTarget().Options.ValueTrackingVariableLocations) + if (llvm::debuginfoShouldUseDebugInstrRef(getTarget().getTargetTriple())) return true; return false; -- cgit v1.1