Skip to content

Conversation

dschuff
Copy link
Member

@dschuff dschuff commented Sep 24, 2025

@dschuff dschuff enabled auto-merge (squash) September 24, 2025 16:23
@llvmbot
Copy link
Member

llvmbot commented Sep 24, 2025

@llvm/pr-subscribers-backend-webassembly

Author: Derek Schuff (dschuff)

Changes

Reverts llvm/llvm-project#160228
See #160228 (comment)


Full diff: https://github.com/llvm/llvm-project/pull/160553.diff

2 Files Affected:

  • (modified) llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp (-14)
  • (removed) llvm/test/CodeGen/WebAssembly/fake-use.ll (-15)
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<MachineInstr *> 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<WebAssemblyFunctionInfo>();
   const auto *TII = MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo();
 
-  removeFakeUses(MF);
-
   // Map non-stackified virtual registers to their local ids.
   DenseMap<unsigned, unsigned> 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) }

@dschuff dschuff merged commit 3bdf05a into main Sep 24, 2025
11 checks passed
@dschuff dschuff deleted the revert-160228-remove_fake_use branch September 24, 2025 16:55
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants