diff options
author | Krasimir Georgiev <krasimir@google.com> | 2018-10-16 18:50:09 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2018-10-16 18:50:09 +0000 |
commit | 547d824da661fedaeeda3a4bcb83a3464fa1b7b9 (patch) | |
tree | 008630b0dc9e8141304feb83e81695e22d98b5fe /llvm/lib/CodeGen/SelectionDAG | |
parent | ae4e75fd6e89cb7706b218f54ea16a0bbdb9a0c2 (diff) | |
download | bcm5719-llvm-547d824da661fedaeeda3a4bcb83a3464fa1b7b9.tar.gz bcm5719-llvm-547d824da661fedaeeda3a4bcb83a3464fa1b7b9.zip |
Revert "[WebAssembly] LSDA info generation"
This reverts commit r344575.
Newly introduced test eh-lsda.ll.test fails with use-after-free under
ASAN build.
llvm-svn: 344639
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 83 |
2 files changed, 29 insertions, 64 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 2e0456edef7..be4a219efe5 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -6288,12 +6288,12 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) { return nullptr; } - case Intrinsic::wasm_landingpad_index: - // Information this intrinsic contained has been transferred to - // MachineFunction in SelectionDAGISel::PrepareEHLandingPad. We can safely - // delete it now. + case Intrinsic::wasm_landingpad_index: { + // TODO store landing pad index in a map, which will be used when generating + // LSDA information return nullptr; } + } } void SelectionDAGBuilder::visitConstrainedFPIntrinsic( @@ -6450,7 +6450,7 @@ SelectionDAGBuilder::lowerInvokable(TargetLowering::CallLoweringInfo &CLI, WinEHFuncInfo *EHInfo = DAG.getMachineFunction().getWinEHFuncInfo(); EHInfo->addIPToStateRange(cast<InvokeInst>(CLI.CS.getInstruction()), BeginLabel, EndLabel); - } else if (!isScopedEHPersonality(Pers)) { + } else { MF.addInvoke(FuncInfo.MBBMap[EHPadBB], BeginLabel, EndLabel); } } diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 90bcaa653c3..2b4a590f19f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -27,7 +27,6 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/BranchProbabilityInfo.h" #include "llvm/Analysis/CFG.h" -#include "llvm/Analysis/EHPersonalities.h" #include "llvm/Analysis/OptimizationRemarkEmitter.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" @@ -1129,36 +1128,6 @@ static bool hasExceptionPointerOrCodeUser(const CatchPadInst *CPI) { return false; } -// wasm.landingpad.index intrinsic is for associating a landing pad index number -// with a catchpad instruction. Retrieve the landing pad index in the intrinsic -// and store the mapping in the function. -static void mapWasmLandingPadIndex(MachineBasicBlock *MBB, - const CatchPadInst *CPI) { - MachineFunction *MF = MBB->getParent(); - // In case of single catch (...), we don't emit LSDA, so we don't need - // this information. - bool IsSingleCatchAllClause = - CPI->getNumArgOperands() == 1 && - cast<Constant>(CPI->getArgOperand(0))->isNullValue(); - if (!IsSingleCatchAllClause) { - // Create a mapping from landing pad label to landing pad index. - bool IntrFound = false; - for (const User *U : CPI->users()) { - if (const auto *Call = dyn_cast<IntrinsicInst>(U)) { - Intrinsic::ID IID = Call->getIntrinsicID(); - if (IID == Intrinsic::wasm_landingpad_index) { - Value *IndexArg = Call->getArgOperand(1); - int Index = cast<ConstantInt>(IndexArg)->getZExtValue(); - MF->setWasmLandingPadIndex(MBB, Index); - IntrFound = true; - break; - } - } - } - assert(IntrFound && "wasm.landingpad.index intrinsic not found!"); - } -} - /// PrepareEHLandingPad - Emit an EH_LABEL, set up live-in registers, and /// do other setup for EH landing-pad blocks. bool SelectionDAGISel::PrepareEHLandingPad() { @@ -1168,48 +1137,44 @@ bool SelectionDAGISel::PrepareEHLandingPad() { const TargetRegisterClass *PtrRC = TLI->getRegClassFor(TLI->getPointerTy(CurDAG->getDataLayout())); - auto Pers = classifyEHPersonality(PersonalityFn); - // Catchpads have one live-in register, which typically holds the exception // pointer or code. - if (isFuncletEHPersonality(Pers)) { - if (const auto *CPI = dyn_cast<CatchPadInst>(LLVMBB->getFirstNonPHI())) { - if (hasExceptionPointerOrCodeUser(CPI)) { - // Get or create the virtual register to hold the pointer or code. Mark - // the live in physreg and copy into the vreg. - MCPhysReg EHPhysReg = TLI->getExceptionPointerRegister(PersonalityFn); - assert(EHPhysReg && "target lacks exception pointer register"); - MBB->addLiveIn(EHPhysReg); - unsigned VReg = FuncInfo->getCatchPadExceptionPointerVReg(CPI, PtrRC); - BuildMI(*MBB, FuncInfo->InsertPt, SDB->getCurDebugLoc(), - TII->get(TargetOpcode::COPY), VReg) - .addReg(EHPhysReg, RegState::Kill); - } + if (const auto *CPI = dyn_cast<CatchPadInst>(LLVMBB->getFirstNonPHI())) { + if (hasExceptionPointerOrCodeUser(CPI)) { + // Get or create the virtual register to hold the pointer or code. Mark + // the live in physreg and copy into the vreg. + MCPhysReg EHPhysReg = TLI->getExceptionPointerRegister(PersonalityFn); + assert(EHPhysReg && "target lacks exception pointer register"); + MBB->addLiveIn(EHPhysReg); + unsigned VReg = FuncInfo->getCatchPadExceptionPointerVReg(CPI, PtrRC); + BuildMI(*MBB, FuncInfo->InsertPt, SDB->getCurDebugLoc(), + TII->get(TargetOpcode::COPY), VReg) + .addReg(EHPhysReg, RegState::Kill); } return true; } + if (!LLVMBB->isLandingPad()) + return true; + // Add a label to mark the beginning of the landing pad. Deletion of the // landing pad can thus be detected via the MachineModuleInfo. MCSymbol *Label = MF->addLandingPad(MBB); + // Assign the call site to the landing pad's begin label. + MF->setCallSiteLandingPad(Label, SDB->LPadToCallSiteMap[MBB]); + const MCInstrDesc &II = TII->get(TargetOpcode::EH_LABEL); BuildMI(*MBB, FuncInfo->InsertPt, SDB->getCurDebugLoc(), II) .addSym(Label); - if (Pers == EHPersonality::Wasm_CXX) { - if (const auto *CPI = dyn_cast<CatchPadInst>(LLVMBB->getFirstNonPHI())) - mapWasmLandingPadIndex(MBB, CPI); - } else { - // Assign the call site to the landing pad's begin label. - MF->setCallSiteLandingPad(Label, SDB->LPadToCallSiteMap[MBB]); - // Mark exception register as live in. - if (unsigned Reg = TLI->getExceptionPointerRegister(PersonalityFn)) - FuncInfo->ExceptionPointerVirtReg = MBB->addLiveIn(Reg, PtrRC); - // Mark exception selector register as live in. - if (unsigned Reg = TLI->getExceptionSelectorRegister(PersonalityFn)) - FuncInfo->ExceptionSelectorVirtReg = MBB->addLiveIn(Reg, PtrRC); - } + // Mark exception register as live in. + if (unsigned Reg = TLI->getExceptionPointerRegister(PersonalityFn)) + FuncInfo->ExceptionPointerVirtReg = MBB->addLiveIn(Reg, PtrRC); + + // Mark exception selector register as live in. + if (unsigned Reg = TLI->getExceptionSelectorRegister(PersonalityFn)) + FuncInfo->ExceptionSelectorVirtReg = MBB->addLiveIn(Reg, PtrRC); return true; } |