aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyNullifyDebugValueLists.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-09-02 21:17:18 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-12-08 17:34:50 +0000
commit06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e (patch)
tree62f873df87c7c675557a179e0c4c83fe9f3087bc /contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyNullifyDebugValueLists.cpp
parentcf037972ea8863e2bab7461d77345367d2c1e054 (diff)
parent7fa27ce4a07f19b07799a767fc29416f3b625afb (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyNullifyDebugValueLists.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyNullifyDebugValueLists.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyNullifyDebugValueLists.cpp b/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyNullifyDebugValueLists.cpp
index 5d8c58dcc334..b58f7a0152ae 100644
--- a/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyNullifyDebugValueLists.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyNullifyDebugValueLists.cpp
@@ -9,7 +9,7 @@
/// \file
/// Nullify DBG_VALUE_LISTs instructions as a temporary measure before we
/// implement DBG_VALUE_LIST handling in WebAssemblyDebugValueManager.
-/// See https://bugs.llvm.org/show_bug.cgi?id=50361.
+/// See https://github.com/llvm/llvm-project/issues/49705.
/// TODO Correctly handle DBG_VALUE_LISTs
///
//===----------------------------------------------------------------------===//
@@ -48,22 +48,17 @@ bool WebAssemblyNullifyDebugValueLists::runOnMachineFunction(
LLVM_DEBUG(dbgs() << "********** Nullify DBG_VALUE_LISTs **********\n"
"********** Function: "
<< MF.getName() << '\n');
- const auto &TII = *MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo();
- SmallVector<MachineInstr *, 2> DbgValueLists;
- for (auto &MBB : MF)
- for (auto &MI : MBB)
- if (MI.getOpcode() == TargetOpcode::DBG_VALUE_LIST)
- DbgValueLists.push_back(&MI);
-
+ bool Changed = false;
// Our backend, including WebAssemblyDebugValueManager, currently cannot
- // handle DBG_VALUE_LISTs correctly. So this converts DBG_VALUE_LISTs to
- // "DBG_VALUE $noreg", which will appear as "optimized out".
- for (auto *DVL : DbgValueLists) {
- BuildMI(*DVL->getParent(), DVL, DVL->getDebugLoc(),
- TII.get(TargetOpcode::DBG_VALUE), false, Register(),
- DVL->getOperand(0).getMetadata(), DVL->getOperand(1).getMetadata());
- DVL->eraseFromParent();
+ // handle DBG_VALUE_LISTs correctly. So this makes them undefined, which will
+ // appear as "optimized out".
+ for (auto &MBB : MF) {
+ for (auto &MI : MBB) {
+ if (MI.getOpcode() == TargetOpcode::DBG_VALUE_LIST) {
+ MI.setDebugValueUndef();
+ Changed = true;
+ }
+ }
}
-
- return !DbgValueLists.empty();
+ return Changed;
}