aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/WasmEHPrepare.cpp
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2019-03-03 22:35:56 +0000
committerHeejin Ahn <aheejin@gmail.com>2019-03-03 22:35:56 +0000
commit195a62e9ae50594e469398631a24f4bc26061c56 (patch)
treeb6300c14bf840459ffd9c4878158386305358345 /llvm/lib/CodeGen/WasmEHPrepare.cpp
parente9e4a0f5b48aed30669e731d3f54f96fd1dacff0 (diff)
downloadllvm-195a62e9ae50594e469398631a24f4bc26061c56.zip
llvm-195a62e9ae50594e469398631a24f4bc26061c56.tar.gz
llvm-195a62e9ae50594e469398631a24f4bc26061c56.tar.bz2
[WebAssembly] Delete ThrowUnwindDest map from WasmEHFuncInfo
Summary: Before when we implemented the first EH proposal, 'catch <tag>' instruction may not catch an exception so there were multiple EH pads an exception can unwind to. That means a BB could have multiple EH pad successors. Now after we switched to the new proposal, every 'catch' instruction catches an exception, and there is only one catchpad per catchswitch, so we at most have one EH pad successor, making `ThrowUnwindDest` map in `WasmEHInfo` unnecessary. Keeping `ThrowUnwindDest` map in `WasmEHInfo` has its own problems, because other optimization passes can split a BB that contains possibly throwing calls (previously invokes), and we have to update the map every time that happens, which is not easy for common CodeGen passes. This also correctly updates successor info in LateEHPrepare when we add a rethrow instruction. Reviewers: dschuff Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58486 llvm-svn: 355296
Diffstat (limited to 'llvm/lib/CodeGen/WasmEHPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/WasmEHPrepare.cpp18
1 files changed, 0 insertions, 18 deletions
diff --git a/llvm/lib/CodeGen/WasmEHPrepare.cpp b/llvm/lib/CodeGen/WasmEHPrepare.cpp
index e9986f5..a58da13 100644
--- a/llvm/lib/CodeGen/WasmEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WasmEHPrepare.cpp
@@ -376,22 +376,4 @@ void llvm::calculateWasmEHInfo(const Function *F, WasmEHFuncInfo &EHInfo) {
EHInfo.setEHPadUnwindDest(&BB, UnwindBB);
}
}
-
- // Record the unwind destination for invoke and cleanupret instructions.
- for (const auto &BB : *F) {
- const Instruction *TI = BB.getTerminator();
- BasicBlock *UnwindBB = nullptr;
- if (const auto *Invoke = dyn_cast<InvokeInst>(TI))
- UnwindBB = Invoke->getUnwindDest();
- else if (const auto *CleanupRet = dyn_cast<CleanupReturnInst>(TI))
- UnwindBB = CleanupRet->getUnwindDest();
- if (!UnwindBB)
- continue;
- const Instruction *UnwindPad = UnwindBB->getFirstNonPHI();
- if (const auto *CatchSwitch = dyn_cast<CatchSwitchInst>(UnwindPad))
- // Currently there should be only one handler per a catchswitch.
- EHInfo.setThrowUnwindDest(&BB, *CatchSwitch->handlers().begin());
- else // cleanuppad
- EHInfo.setThrowUnwindDest(&BB, UnwindBB);
- }
}