diff --git a/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h b/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h --- a/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h +++ b/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h @@ -31,27 +31,27 @@ struct WasmEHFuncInfo { // When there is an entry , if an exception is not caught by A, it // should next unwind to the EH pad B. - DenseMap EHPadUnwindMap; + DenseMap SrcToUnwindDest; // Helper functions - const BasicBlock *getEHPadUnwindDest(const BasicBlock *BB) const { - return EHPadUnwindMap.lookup(BB).get(); + const BasicBlock *getUnwindDest(const BasicBlock *BB) const { + return SrcToUnwindDest.lookup(BB).get(); } - void setEHPadUnwindDest(const BasicBlock *BB, const BasicBlock *Dest) { - EHPadUnwindMap[BB] = Dest; + void setUnwindDest(const BasicBlock *BB, const BasicBlock *Dest) { + SrcToUnwindDest[BB] = Dest; } - bool hasEHPadUnwindDest(const BasicBlock *BB) const { - return EHPadUnwindMap.count(BB); + bool hasUnwindDest(const BasicBlock *BB) const { + return SrcToUnwindDest.count(BB); } - MachineBasicBlock *getEHPadUnwindDest(MachineBasicBlock *MBB) const { - return EHPadUnwindMap.lookup(MBB).get(); + MachineBasicBlock *getUnwindDest(MachineBasicBlock *MBB) const { + return SrcToUnwindDest.lookup(MBB).get(); } - void setEHPadUnwindDest(MachineBasicBlock *MBB, MachineBasicBlock *Dest) { - EHPadUnwindMap[MBB] = Dest; + void setUnwindDest(MachineBasicBlock *MBB, MachineBasicBlock *Dest) { + SrcToUnwindDest[MBB] = Dest; } - bool hasEHPadUnwindDest(MachineBasicBlock *MBB) const { - return EHPadUnwindMap.count(MBB); + bool hasUnwindDest(MachineBasicBlock *MBB) const { + return SrcToUnwindDest.count(MBB); } }; diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp --- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp @@ -335,12 +335,12 @@ WasmEHFuncInfo &EHInfo = *MF->getWasmEHFuncInfo(); // Map all BB references in the WinEH data to MBBs. DenseMap NewMap; - for (auto &KV : EHInfo.EHPadUnwindMap) { + for (auto &KV : EHInfo.SrcToUnwindDest) { const auto *Src = KV.first.get(); const auto *Dst = KV.second.get(); NewMap[MBBMap[Src]] = MBBMap[Dst]; } - EHInfo.EHPadUnwindMap = std::move(NewMap); + EHInfo.SrcToUnwindDest = std::move(NewMap); } } diff --git a/llvm/lib/CodeGen/WasmEHPrepare.cpp b/llvm/lib/CodeGen/WasmEHPrepare.cpp --- a/llvm/lib/CodeGen/WasmEHPrepare.cpp +++ b/llvm/lib/CodeGen/WasmEHPrepare.cpp @@ -436,9 +436,9 @@ const Instruction *UnwindPad = UnwindBB->getFirstNonPHI(); if (const auto *CatchSwitch = dyn_cast(UnwindPad)) // Currently there should be only one handler per a catchswitch. - EHInfo.setEHPadUnwindDest(&BB, *CatchSwitch->handlers().begin()); + EHInfo.setUnwindDest(&BB, *CatchSwitch->handlers().begin()); else // cleanuppad - EHInfo.setEHPadUnwindDest(&BB, UnwindBB); + EHInfo.setUnwindDest(&BB, UnwindBB); } } } diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp --- a/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp @@ -1330,7 +1330,7 @@ // This can happen when the unwind dest was removed during the // optimization, e.g. because it was unreachable. - else if (EHPadStack.empty() && EHInfo->hasEHPadUnwindDest(EHPad)) { + else if (EHPadStack.empty() && EHInfo->hasUnwindDest(EHPad)) { LLVM_DEBUG(dbgs() << "EHPad (" << EHPad->getName() << "'s unwind destination does not exist anymore" << "\n\n"); @@ -1338,7 +1338,7 @@ // The EHPad's next unwind destination is the caller, but we incorrectly // unwind to another EH pad. - else if (!EHPadStack.empty() && !EHInfo->hasEHPadUnwindDest(EHPad)) { + else if (!EHPadStack.empty() && !EHInfo->hasUnwindDest(EHPad)) { EHPadToUnwindDest[EHPad] = getFakeCallerBlock(MF); LLVM_DEBUG(dbgs() << "- Catch unwind mismatch:\nEHPad = " << EHPad->getName() @@ -1348,8 +1348,8 @@ // The EHPad's next unwind destination is an EH pad, whereas we // incorrectly unwind to another EH pad. - else if (!EHPadStack.empty() && EHInfo->hasEHPadUnwindDest(EHPad)) { - auto *UnwindDest = EHInfo->getEHPadUnwindDest(EHPad); + else if (!EHPadStack.empty() && EHInfo->hasUnwindDest(EHPad)) { + auto *UnwindDest = EHInfo->getUnwindDest(EHPad); if (EHPadStack.back() != UnwindDest) { EHPadToUnwindDest[EHPad] = UnwindDest; LLVM_DEBUG(dbgs() << "- Catch unwind mismatch:\nEHPad = "