[PATCH] D56094: [WebAssembly] Fix stack pointer store check in RegStackify
Heejin Ahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 10 15:16:20 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL350906: [WebAssembly] Fix stack pointer store check in RegStackify (authored by aheejin, committed by ).
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56094/new/
https://reviews.llvm.org/D56094
Files:
llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
llvm/trunk/test/CodeGen/WebAssembly/reg-stackify.ll
Index: llvm/trunk/test/CodeGen/WebAssembly/reg-stackify.ll
===================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/reg-stackify.ll
+++ llvm/trunk/test/CodeGen/WebAssembly/reg-stackify.ll
@@ -634,7 +634,7 @@
; NOREGS-LABEL: stackpointer_dependency:
; NOREGS: call stackpointer_callee at FUNCTION
; NOREGS: global.set __stack_pointer
-declare i32 @stackpointer_callee(i8* readnone, i8* readnone)
+declare i32 @stackpointer_callee(i8* readnone, i8* readnone) nounwind readnone
declare i8* @llvm.frameaddress(i32)
define i32 @stackpointer_dependency(i8* readnone) {
%2 = tail call i8* @llvm.frameaddress(i32 0)
Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
===================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
@@ -181,19 +181,6 @@
// Check for stores.
if (MI.mayStore()) {
Write = true;
-
- // Check for stores to __stack_pointer.
- for (auto MMO : MI.memoperands()) {
- const MachinePointerInfo &MPI = MMO->getPointerInfo();
- if (MPI.V.is<const PseudoSourceValue *>()) {
- auto PSV = MPI.V.get<const PseudoSourceValue *>();
- if (const ExternalSymbolPseudoSourceValue *EPSV =
- dyn_cast<ExternalSymbolPseudoSourceValue>(PSV))
- if (StringRef(EPSV->getSymbol()) == "__stack_pointer") {
- StackPointer = true;
- }
- }
- }
} else if (MI.hasOrderedMemoryRef()) {
switch (MI.getOpcode()) {
case WebAssembly::DIV_S_I32:
@@ -258,6 +245,11 @@
}
}
+ // Check for writes to __stack_pointer global.
+ if (MI.getOpcode() == WebAssembly::GLOBAL_SET_I32 &&
+ strcmp(MI.getOperand(0).getSymbolName(), "__stack_pointer") == 0)
+ StackPointer = true;
+
// Analyze calls.
if (MI.isCall()) {
unsigned CalleeOpNo = WebAssembly::getCalleeOpNo(MI);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56094.181173.patch
Type: text/x-patch
Size: 1996 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190110/bbf92c27/attachment.bin>
More information about the llvm-commits
mailing list