[llvm] a48ee9f - [WebAssembly] Remove dominator dependency in WasmEHPrepare (NFC)
Heejin Ahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 26 14:45:26 PDT 2021
Author: Heejin Ahn
Date: 2021-07-26T14:45:13-07:00
New Revision: a48ee9f25581d0d6cbf2b1205777e7d53023797f
URL: https://github.com/llvm/llvm-project/commit/a48ee9f25581d0d6cbf2b1205777e7d53023797f
DIFF: https://github.com/llvm/llvm-project/commit/a48ee9f25581d0d6cbf2b1205777e7d53023797f.diff
LOG: [WebAssembly] Remove dominator dependency in WasmEHPrepare (NFC)
Dominator trees were previously used for an optimization related to
`wasm.lsda` but the optimization was removed in D97309. Currently
dominators are not doing anything in this pass. Also removes some
`include` lines without which it compiles.
Reviewed By: tlively
Differential Revision: https://reviews.llvm.org/D106811
Added:
Modified:
llvm/lib/CodeGen/WasmEHPrepare.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/WasmEHPrepare.cpp b/llvm/lib/CodeGen/WasmEHPrepare.cpp
index 19ebbe3a1c80..c4c84cd921fa 100644
--- a/llvm/lib/CodeGen/WasmEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WasmEHPrepare.cpp
@@ -77,20 +77,12 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/ADT/SetVector.h"
-#include "llvm/ADT/Statistic.h"
-#include "llvm/ADT/Triple.h"
-#include "llvm/Analysis/DomTreeUpdater.h"
-#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/CodeGen/WasmEHFuncInfo.h"
-#include "llvm/IR/Dominators.h"
#include "llvm/IR/IRBuilder.h"
-#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicsWebAssembly.h"
#include "llvm/InitializePasses.h"
-#include "llvm/Pass.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
using namespace llvm;
@@ -124,7 +116,6 @@ class WasmEHPrepare : public FunctionPass {
static char ID; // Pass identification, replacement for typeid
WasmEHPrepare() : FunctionPass(ID) {}
- void getAnalysisUsage(AnalysisUsage &AU) const override;
bool doInitialization(Module &M) override;
bool runOnFunction(Function &F) override;
@@ -137,16 +128,11 @@ class WasmEHPrepare : public FunctionPass {
char WasmEHPrepare::ID = 0;
INITIALIZE_PASS_BEGIN(WasmEHPrepare, DEBUG_TYPE,
"Prepare WebAssembly exceptions", false, false)
-INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
INITIALIZE_PASS_END(WasmEHPrepare, DEBUG_TYPE, "Prepare WebAssembly exceptions",
false, false)
FunctionPass *llvm::createWasmEHPass() { return new WasmEHPrepare(); }
-void WasmEHPrepare::getAnalysisUsage(AnalysisUsage &AU) const {
- AU.addRequired<DominatorTreeWrapperPass>();
-}
-
bool WasmEHPrepare::doInitialization(Module &M) {
IRBuilder<> IRB(M.getContext());
LPadContextTy = StructType::get(IRB.getInt32Ty(), // lpad_index
@@ -159,14 +145,14 @@ bool WasmEHPrepare::doInitialization(Module &M) {
// Erase the specified BBs if the BB does not have any remaining predecessors,
// and also all its dead children.
template <typename Container>
-static void eraseDeadBBsAndChildren(const Container &BBs, DomTreeUpdater *DTU) {
+static void eraseDeadBBsAndChildren(const Container &BBs) {
SmallVector<BasicBlock *, 8> WL(BBs.begin(), BBs.end());
while (!WL.empty()) {
auto *BB = WL.pop_back_val();
if (!pred_empty(BB))
continue;
WL.append(succ_begin(BB), succ_end(BB));
- DeleteDeadBlock(BB, DTU);
+ DeleteDeadBlock(BB);
}
}
@@ -178,9 +164,6 @@ bool WasmEHPrepare::runOnFunction(Function &F) {
}
bool WasmEHPrepare::prepareThrows(Function &F) {
- auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
- DomTreeUpdater DTU(&DT, /*PostDominatorTree*/ nullptr,
- DomTreeUpdater::UpdateStrategy::Eager);
Module &M = *F.getParent();
IRBuilder<> IRB(F.getContext());
bool Changed = false;
@@ -203,7 +186,7 @@ bool WasmEHPrepare::prepareThrows(Function &F) {
InstList.erase(std::next(BasicBlock::iterator(ThrowI)), InstList.end());
IRB.SetInsertPoint(BB);
IRB.CreateUnreachable();
- eraseDeadBBsAndChildren(Succs, &DTU);
+ eraseDeadBBsAndChildren(Succs);
}
return Changed;
More information about the llvm-commits
mailing list