diff options
author | Heejin Ahn <aheejin@gmail.com> | 2019-01-30 22:44:45 +0000 |
---|---|---|
committer | Heejin Ahn <aheejin@gmail.com> | 2019-01-30 22:44:45 +0000 |
commit | 0bb9865011731066ddc394f98942fbf959a4039b (patch) | |
tree | 9d5e1e10f54bbea5e869131e6fe7423839aa7f62 /llvm/lib/Target/WebAssembly/WebAssembly.h | |
parent | 9ab23101a82440c91d630596e0e8264103a34f74 (diff) | |
download | bcm5719-llvm-0bb9865011731066ddc394f98942fbf959a4039b.tar.gz bcm5719-llvm-0bb9865011731066ddc394f98942fbf959a4039b.zip |
[WebAssembly] Restore stack pointer right after catch instruction
Summary:
After the staack is unwound due to a thrown exxception,
`__stack_pointer` global can point to an invalid address. So
a `global.set` to restore `__stack_pointer` should be inserted right
after `catch` instruction.
But after r352598 the `global.set` instruction is inserted not right
after `catch` but after `block` - `br-on-exn` - `end_block` -
`extract_exception` sequence. This CL fixes it.
While doing that, we can actually move ReplacePhysRegs pass after
LateEHPrepare and merge EHRestoreStackPointer pass into LateEHPrepare,
and now placing `global.set` to `__stack_pointer` right after `catch` is
much easier. Otherwise it is hard to guarantee that `global.set` is
still right after `catch` and not touched with other transformations, in
which case we have to do something to hoist it.
Reviewers: dschuff
Subscribers: mgorny, sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D57421
llvm-svn: 352681
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssembly.h')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssembly.h | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssembly.h b/llvm/lib/Target/WebAssembly/WebAssembly.h index 27bc156eae8..2a7efe1176f 100644 --- a/llvm/lib/Target/WebAssembly/WebAssembly.h +++ b/llvm/lib/Target/WebAssembly/WebAssembly.h @@ -38,7 +38,6 @@ FunctionPass *createWebAssemblyArgumentMove(); FunctionPass *createWebAssemblySetP2AlignOperands(); // Late passes. -FunctionPass *createWebAssemblyEHRestoreStackPointer(); FunctionPass *createWebAssemblyReplacePhysRegs(); FunctionPass *createWebAssemblyPrepareForLiveIntervals(); FunctionPass *createWebAssemblyOptimizeLiveIntervals(); @@ -63,7 +62,6 @@ void initializeFixFunctionBitcastsPass(PassRegistry &); void initializeOptimizeReturnedPass(PassRegistry &); void initializeWebAssemblyArgumentMovePass(PassRegistry &); void initializeWebAssemblySetP2AlignOperandsPass(PassRegistry &); -void initializeWebAssemblyEHRestoreStackPointerPass(PassRegistry &); void initializeWebAssemblyReplacePhysRegsPass(PassRegistry &); void initializeWebAssemblyPrepareForLiveIntervalsPass(PassRegistry &); void initializeWebAssemblyOptimizeLiveIntervalsPass(PassRegistry &); |