[PATCH] D26263: [WebAssembly] Emit a BasePointer when we have overly-aligned stack objects

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 2 17:45:58 PDT 2016


dschuff added inline comments.


================
Comment at: lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp:40
 
+/// We need a base pointer in the case of having overaligned items on the stack.
+/// Because we need to shift the stack pointer by some unknown amount to force
----------------
Maybe clarify that "overaligned" means more aligned than the stack pointer (rather than more than natural alignment for the slot itself).


================
Comment at: test/CodeGen/WebAssembly/alignment.ll:1
+; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt | FileCheck %s
+
----------------
`alignment.ll` seems a bit generic. It could probably be `stack-aligment` or else these tests could just be added to `userstack.ll`


================
Comment at: test/CodeGen/WebAssembly/alignment.ll:29
+; CHECK:      i32.sub    $push[[L8:.+]]=, $pop[[L9]], $pop{{.+}}
+; CHECK:      i32.and    $push[[L7:.+]]=, $pop[[L8]], $pop{{.+}}
+; CHECK-NEXT: tee_local  $push{{.+}}=, $[[SP:.+]]=, $pop[[L7]]
----------------
Might as well check for the value of the const too, so we know the alignment is 16.


================
Comment at: test/CodeGen/WebAssembly/alignment.ll:34
+
+; CHECK:      copy_local $push[[L5:.+]]=, $[[BP]]
+; CHECK-NEXT: i32.store  __stack_pointer($pop{{.+}}), $pop[[L5]]
----------------
Seems like we should be storing directly from BP. Where does this `copy_local` come from?
The epilog codegen looks ok; I guess this copy is the one generated in the prolog and gets moved down by the stackifier?


https://reviews.llvm.org/D26263





More information about the llvm-commits mailing list