From 9119e5cb91a81ec07a84dca19b88960f501b46e7 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 24 Sep 2025 09:22:03 -0700 Subject: [PATCH] Revert "[WebAssembly] Remove FAKE_USEs before ExplicitLocals (#160228)" This reverts commit d27654f9d8e2d0637a2f3de0d2aad7d70b3f71f8. --- .../WebAssembly/WebAssemblyExplicitLocals.cpp | 14 -------------- llvm/test/CodeGen/WebAssembly/fake-use.ll | 15 --------------- 2 files changed, 29 deletions(-) delete mode 100644 llvm/test/CodeGen/WebAssembly/fake-use.ll diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp index 5c3127e2d3dc6..e6486e247209b 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp @@ -216,18 +216,6 @@ static MachineInstr *findStartOfTree(MachineOperand &MO, return Def; } -// FAKE_USEs are no-ops, so remove them here so that the values used by them -// will be correctly dropped later. -static void removeFakeUses(MachineFunction &MF) { - SmallVector ToDelete; - for (auto &MBB : MF) - for (auto &MI : MBB) - if (MI.isFakeUse()) - ToDelete.push_back(&MI); - for (auto *MI : ToDelete) - MI->eraseFromParent(); -} - bool WebAssemblyExplicitLocals::runOnMachineFunction(MachineFunction &MF) { LLVM_DEBUG(dbgs() << "********** Make Locals Explicit **********\n" "********** Function: " @@ -238,8 +226,6 @@ bool WebAssemblyExplicitLocals::runOnMachineFunction(MachineFunction &MF) { WebAssemblyFunctionInfo &MFI = *MF.getInfo(); const auto *TII = MF.getSubtarget().getInstrInfo(); - removeFakeUses(MF); - // Map non-stackified virtual registers to their local ids. DenseMap Reg2Local; diff --git a/llvm/test/CodeGen/WebAssembly/fake-use.ll b/llvm/test/CodeGen/WebAssembly/fake-use.ll deleted file mode 100644 index d5732e628440a..0000000000000 --- a/llvm/test/CodeGen/WebAssembly/fake-use.ll +++ /dev/null @@ -1,15 +0,0 @@ -; RUN: llc < %s | llvm-mc -triple=wasm32-unknown-unknown - -target triple = "wasm32-unknown-unknown" - -define void @fake_use_test() { - %t = call i32 @foo() - tail call void (...) @llvm.fake.use(i32 %t) - ret void -} - -declare void @foo() -; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) -declare void @llvm.fake.use(...) #0 - -attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }