aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2025-09-02 16:21:35 -0700
committerGitHub <noreply@github.com>2025-09-02 16:21:35 -0700
commita3c41ddcafb93dcb226bdef12b91a192b647e8c4 (patch)
tree0602740bb5f5ee97bdc76cbdefaeb0dd2ba82d01 /llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
parent1cee0e7b6281e5f82154a101eed09a7197a295a6 (diff)
downloadllvm-a3c41ddcafb93dcb226bdef12b91a192b647e8c4.zip
llvm-a3c41ddcafb93dcb226bdef12b91a192b647e8c4.tar.gz
llvm-a3c41ddcafb93dcb226bdef12b91a192b647e8c4.tar.bz2
[WebAssembly] Guard use of getSymbolName with isSymbol (#156105)
WebAssemblyRegStackfy checks for writes to the stack pointer to avoid stackifying across them, but it wasn't prepared for other global_set instructions (such as writes in addrspace 1). Fixes #156055 Thanks to @QuantumSegfault for reporting and identifying the offending code.
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
index bc91c64..08ca20b5 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
@@ -247,7 +247,8 @@ static void query(const MachineInstr &MI, bool &Read, bool &Write,
// Check for writes to __stack_pointer global.
if ((MI.getOpcode() == WebAssembly::GLOBAL_SET_I32 ||
MI.getOpcode() == WebAssembly::GLOBAL_SET_I64) &&
- strcmp(MI.getOperand(0).getSymbolName(), "__stack_pointer") == 0)
+ MI.getOperand(0).isSymbol() &&
+ !strcmp(MI.getOperand(0).getSymbolName(), "__stack_pointer"))
StackPointer = true;
// Analyze calls.