[llvm] r235170 - Revert r235154-r235156, they cause asserts when building win64 code (http://crbug.com/477988)
Rafael EspĂndola
rafael.espindola at gmail.com
Fri Apr 17 07:33:25 PDT 2015
Reported as pr23268.
On 17 April 2015 at 06:37, Rafael EspĂndola <rafael.espindola at gmail.com> wrote:
> I have a testcase reducing :-)
>
> On 17 April 2015 at 05:10, Nico Weber <nicolasweber at gmx.de> wrote:
>> Author: nico
>> Date: Fri Apr 17 04:10:43 2015
>> New Revision: 235170
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=235170&view=rev
>> Log:
>> Revert r235154-r235156, they cause asserts when building win64 code (http://crbug.com/477988)
>>
>> Added:
>> llvm/trunk/test/CodeGen/X86/seh-basic.ll
>> - copied unchanged from r235153, llvm/trunk/test/CodeGen/X86/seh-basic.ll
>> llvm/trunk/test/CodeGen/X86/seh-filter.ll
>> - copied unchanged from r235153, llvm/trunk/test/CodeGen/X86/seh-filter.ll
>> Removed:
>> llvm/trunk/test/CodeGen/WinEH/seh-prepared-basic.ll
>> llvm/trunk/test/CodeGen/X86/seh-except-finally.ll
>> Modified:
>> llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h
>> llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
>> llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h
>> llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp
>> llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
>> llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
>> llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
>> llvm/trunk/lib/CodeGen/WinEHPrepare.cpp
>> llvm/trunk/test/CodeGen/WinEH/seh-catch-all.ll
>> llvm/trunk/test/CodeGen/WinEH/seh-inlined-finally.ll
>> llvm/trunk/test/CodeGen/WinEH/seh-outlined-finally.ll
>> llvm/trunk/test/CodeGen/WinEH/seh-simple.ll
>> llvm/trunk/test/CodeGen/X86/seh-finally.ll
>> llvm/trunk/test/CodeGen/X86/seh-safe-div.ll
>> llvm/trunk/test/CodeGen/X86/win_eh_prepare.ll
>>
>> Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h?rev=235170&r1=235169&r2=235170&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h (original)
>> +++ llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h Fri Apr 17 04:10:43 2015
>> @@ -221,8 +221,6 @@ public:
>> int getArgumentFrameIndex(const Argument *A);
>>
>> private:
>> - void addSEHHandlersForLPads();
>> -
>> /// LiveOutRegInfo - Information about live out vregs.
>> IndexedMap<LiveOutInfo, VirtReg2IndexFunctor> LiveOutRegInfo;
>> };
>>
>> Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=235170&r1=235169&r2=235170&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original)
>> +++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Fri Apr 17 04:10:43 2015
>> @@ -51,7 +51,6 @@ namespace llvm {
>> // Forward declarations.
>> class Constant;
>> class GlobalVariable;
>> -class BlockAddress;
>> class MDNode;
>> class MMIAddrLabelMap;
>> class MachineBasicBlock;
>> @@ -61,14 +60,6 @@ class PointerType;
>> class StructType;
>> struct WinEHFuncInfo;
>>
>> -struct SEHHandler {
>> - // Filter or finally function. Null indicates a catch-all.
>> - const Function *FilterOrFinally;
>> -
>> - // Address of block to recover at. Null for a finally handler.
>> - const BlockAddress *RecoverBA;
>> -};
>> -
>> //===----------------------------------------------------------------------===//
>> /// LandingPadInfo - This structure is used to retain landing pad info for
>> /// the current function.
>> @@ -77,7 +68,7 @@ struct LandingPadInfo {
>> MachineBasicBlock *LandingPadBlock; // Landing pad block.
>> SmallVector<MCSymbol *, 1> BeginLabels; // Labels prior to invoke.
>> SmallVector<MCSymbol *, 1> EndLabels; // Labels after invoke.
>> - SmallVector<SEHHandler, 1> SEHHandlers; // SEH handlers active at this lpad.
>> + SmallVector<MCSymbol *, 1> ClauseLabels; // Labels for each clause.
>> MCSymbol *LandingPadLabel; // Label at beginning of landing pad.
>> const Function *Personality; // Personality function.
>> std::vector<int> TypeIds; // List of type ids (filters negative).
>> @@ -360,11 +351,10 @@ public:
>> ///
>> void addCleanup(MachineBasicBlock *LandingPad);
>>
>> - void addSEHCatchHandler(MachineBasicBlock *LandingPad, const Function *Filter,
>> - const BlockAddress *RecoverLabel);
>> -
>> - void addSEHCleanupHandler(MachineBasicBlock *LandingPad,
>> - const Function *Cleanup);
>> + /// Add a clause for a landing pad. Returns a new label for the clause. This
>> + /// is used by EH schemes that have more than one landing pad. In this case,
>> + /// each clause gets its own basic block.
>> + MCSymbol *addClauseForLandingPad(MachineBasicBlock *LandingPad);
>>
>> /// getTypeIDFor - Return the type id for the specified typeinfo. This is
>> /// function wide.
>>
>> Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h?rev=235170&r1=235169&r2=235170&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h (original)
>> +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h Fri Apr 17 04:10:43 2015
>> @@ -260,10 +260,7 @@ private:
>> SDNode *MorphNode(SDNode *Node, unsigned TargetOpc, SDVTList VTs,
>> ArrayRef<SDValue> Ops, unsigned EmitNodeInfo);
>>
>> - /// Prepares the landing pad to take incoming values or do other EH
>> - /// personality specific tasks. Returns true if the block should be
>> - /// instruction selected, false if no code should be emitted for it.
>> - bool PrepareEHLandingPad();
>> + void PrepareEHLandingPad();
>>
>> /// \brief Perform instruction selection on all basic blocks in the function.
>> void SelectAllBasicBlocks(const Function &Fn);
>>
>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp?rev=235170&r1=235169&r2=235170&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp Fri Apr 17 04:10:43 2015
>> @@ -206,14 +206,15 @@ void Win64Exception::emitCSpecificHandle
>> for (const CallSiteEntry &CSE : CallSites) {
>> if (!CSE.LPad)
>> continue; // Ignore gaps.
>> - NumEntries += CSE.LPad->SEHHandlers.size();
>> + for (int Selector : CSE.LPad->TypeIds) {
>> + // Ignore C++ filter clauses in SEH.
>> + // FIXME: Implement cleanup clauses.
>> + if (isCatchEHSelector(Selector))
>> + ++NumEntries;
>> + }
>> }
>> Asm->OutStreamer.EmitIntValue(NumEntries, 4);
>>
>> - // If there are no actions, we don't need to iterate again.
>> - if (NumEntries == 0)
>> - return;
>> -
>> // Emit the four-label records for each call site entry. The table has to be
>> // sorted in layout order, and the call sites should already be sorted.
>> for (const CallSiteEntry &CSE : CallSites) {
>> @@ -239,27 +240,36 @@ void Win64Exception::emitCSpecificHandle
>> End = createImageRel32(EHFuncEndSym);
>> }
>>
>> - // Emit an entry for each action.
>> - for (SEHHandler Handler : LPad->SEHHandlers) {
>> + // These aren't really type info globals, they are actually pointers to
>> + // filter functions ordered by selector. The zero selector is used for
>> + // cleanups, so slot zero corresponds to selector 1.
>> + const std::vector<const GlobalValue *> &SelectorToFilter = MMI->getTypeInfos();
>> +
>> + // Do a parallel iteration across typeids and clause labels, skipping filter
>> + // clauses.
>> + size_t NextClauseLabel = 0;
>> + for (size_t I = 0, E = LPad->TypeIds.size(); I < E; ++I) {
>> + // AddLandingPadInfo stores the clauses in reverse, but there is a FIXME
>> + // to change that.
>> + int Selector = LPad->TypeIds[E - I - 1];
>> +
>> + // Ignore C++ filter clauses in SEH.
>> + // FIXME: Implement cleanup clauses.
>> + if (!isCatchEHSelector(Selector))
>> + continue;
>> +
>> Asm->OutStreamer.EmitValue(Begin, 4);
>> Asm->OutStreamer.EmitValue(End, 4);
>> -
>> - // Emit the filter or finally function pointer, if present. Otherwise,
>> - // emit '1' to indicate a catch-all.
>> - const Function *F = Handler.FilterOrFinally;
>> - if (F)
>> - Asm->OutStreamer.EmitValue(createImageRel32(Asm->getSymbol(F)), 4);
>> - else
>> - Asm->OutStreamer.EmitIntValue(1, 4);
>> -
>> - // Emit the recovery address, if present. Otherwise, this must be a
>> - // finally.
>> - const BlockAddress *BA = Handler.RecoverBA;
>> - if (BA)
>> - Asm->OutStreamer.EmitValue(
>> - createImageRel32(Asm->GetBlockAddressSymbol(BA)), 4);
>> - else
>> - Asm->OutStreamer.EmitIntValue(0, 4);
>> + if (isCatchEHSelector(Selector)) {
>> + assert(unsigned(Selector - 1) < SelectorToFilter.size());
>> + const GlobalValue *TI = SelectorToFilter[Selector - 1];
>> + if (TI) // Emit the filter function pointer.
>> + Asm->OutStreamer.EmitValue(createImageRel32(Asm->getSymbol(TI)), 4);
>> + else // Otherwise, this is a "catch i8* null", or catch all.
>> + Asm->OutStreamer.EmitIntValue(1, 4);
>> + }
>> + MCSymbol *ClauseLabel = LPad->ClauseLabels[NextClauseLabel++];
>> + Asm->OutStreamer.EmitValue(createImageRel32(ClauseLabel), 4);
>> }
>> }
>> }
>>
>> Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=235170&r1=235169&r2=235170&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Fri Apr 17 04:10:43 2015
>> @@ -461,23 +461,12 @@ void MachineModuleInfo::addCleanup(Machi
>> LP.TypeIds.push_back(0);
>> }
>>
>> -void MachineModuleInfo::addSEHCatchHandler(MachineBasicBlock *LandingPad,
>> - const Function *Filter,
>> - const BlockAddress *RecoverBA) {
>> +MCSymbol *
>> +MachineModuleInfo::addClauseForLandingPad(MachineBasicBlock *LandingPad) {
>> + MCSymbol *ClauseLabel = Context.CreateTempSymbol();
>> LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
>> - SEHHandler Handler;
>> - Handler.FilterOrFinally = Filter;
>> - Handler.RecoverBA = RecoverBA;
>> - LP.SEHHandlers.push_back(Handler);
>> -}
>> -
>> -void MachineModuleInfo::addSEHCleanupHandler(MachineBasicBlock *LandingPad,
>> - const Function *Cleanup) {
>> - LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
>> - SEHHandler Handler;
>> - Handler.FilterOrFinally = Cleanup;
>> - Handler.RecoverBA = nullptr;
>> - LP.SEHHandlers.push_back(Handler);
>> + LP.ClauseLabels.push_back(ClauseLabel);
>> + return ClauseLabel;
>> }
>>
>> /// TidyLandingPads - Remap landing pad labels and remove any deleted landing
>>
>> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=235170&r1=235169&r2=235170&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Fri Apr 17 04:10:43 2015
>> @@ -270,21 +270,12 @@ void FunctionLoweringInfo::set(const Fun
>> }
>>
>> // Mark landing pad blocks.
>> - const LandingPadInst *LP = nullptr;
>> - for (BB = Fn->begin(); BB != EB; ++BB) {
>> + for (BB = Fn->begin(); BB != EB; ++BB)
>> if (const auto *Invoke = dyn_cast<InvokeInst>(BB->getTerminator()))
>> MBBMap[Invoke->getSuccessor(1)]->setIsLandingPad();
>> - if (BB->isLandingPad())
>> - LP = BB->getLandingPadInst();
>> - }
>>
>> - // Calculate EH numbers for MSVC C++ EH and save SEH handlers if necessary.
>> - EHPersonality Personality = EHPersonality::Unknown;
>> - if (LP)
>> - Personality = classifyEHPersonality(LP->getPersonalityFn());
>> - if (Personality == EHPersonality::MSVC_Win64SEH) {
>> - addSEHHandlersForLPads();
>> - } else if (Personality == EHPersonality::MSVC_CXX) {
>> + // Calculate EH numbers for WinEH.
>> + if (fn.hasFnAttribute("wineh-parent")) {
>> const Function *WinEHParentFn = MMI.getWinEHParent(&fn);
>> WinEHFuncInfo &FI = MMI.getWinEHFuncInfo(WinEHParentFn);
>> if (FI.LandingPadStateMap.empty()) {
>> @@ -296,47 +287,6 @@ void FunctionLoweringInfo::set(const Fun
>> }
>> }
>>
>> -void FunctionLoweringInfo::addSEHHandlersForLPads() {
>> - MachineModuleInfo &MMI = MF->getMMI();
>> -
>> - // Iterate over all landing pads with llvm.eh.actions calls.
>> - for (const BasicBlock &BB : *Fn) {
>> - const LandingPadInst *LP = BB.getLandingPadInst();
>> - if (!LP)
>> - continue;
>> - const IntrinsicInst *ActionsCall =
>> - dyn_cast<IntrinsicInst>(LP->getNextNode());
>> - if (!ActionsCall ||
>> - ActionsCall->getIntrinsicID() != Intrinsic::eh_actions)
>> - continue;
>> -
>> - // Parse the llvm.eh.actions call we found.
>> - MachineBasicBlock *LPadMBB = MBBMap[LP->getParent()];
>> - SmallVector<ActionHandler *, 4> Actions;
>> - parseEHActions(ActionsCall, Actions);
>> -
>> - // Iterate EH actions from most to least precedence, which means
>> - // iterating in reverse.
>> - for (auto I = Actions.rbegin(), E = Actions.rend(); I != E; ++I) {
>> - ActionHandler *Action = *I;
>> - if (auto *CH = dyn_cast<CatchHandler>(Action)) {
>> - const auto *Filter =
>> - dyn_cast<Function>(CH->getSelector()->stripPointerCasts());
>> - assert((Filter || CH->getSelector()->isNullValue()) &&
>> - "expected function or catch-all");
>> - const auto *RecoverBA =
>> - cast<BlockAddress>(CH->getHandlerBlockOrFunc());
>> - MMI.addSEHCatchHandler(LPadMBB, Filter, RecoverBA);
>> - } else {
>> - assert(isa<CleanupHandler>(Action));
>> - const auto *Fini = cast<Function>(Action->getHandlerBlockOrFunc());
>> - MMI.addSEHCleanupHandler(LPadMBB, Fini);
>> - }
>> - }
>> - DeleteContainerPointers(Actions);
>> - }
>> -}
>> -
>> void WinEHNumbering::createUnwindMapEntry(int ToState, ActionHandler *AH) {
>> WinEHUnwindMapEntry UME;
>> UME.ToState = ToState;
>>
>> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=235170&r1=235169&r2=235170&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Apr 17 04:10:43 2015
>> @@ -911,7 +911,7 @@ void SelectionDAGISel::DoInstructionSele
>>
>> /// PrepareEHLandingPad - Emit an EH_LABEL, set up live-in registers, and
>> /// do other setup for EH landing-pad blocks.
>> -bool SelectionDAGISel::PrepareEHLandingPad() {
>> +void SelectionDAGISel::PrepareEHLandingPad() {
>> MachineBasicBlock *MBB = FuncInfo->MBB;
>>
>> const TargetRegisterClass *PtrRC = TLI->getRegClassFor(TLI->getPointerTy());
>> @@ -937,28 +937,70 @@ bool SelectionDAGISel::PrepareEHLandingP
>>
>> if (isMSVCEHPersonality(Personality)) {
>> SmallVector<MachineBasicBlock *, 4> ClauseBBs;
>> - const IntrinsicInst *ActionsCall =
>> + const IntrinsicInst *Actions =
>> dyn_cast<IntrinsicInst>(LLVMBB->getFirstInsertionPt());
>> // Get all invoke BBs that unwind to this landingpad.
>> SmallVector<MachineBasicBlock *, 4> InvokeBBs(MBB->pred_begin(),
>> MBB->pred_end());
>> - if (!ActionsCall || ActionsCall->getIntrinsicID() != Intrinsic::eh_actions) {
>> - assert(isa<UnreachableInst>(LLVMBB->getFirstInsertionPt()) &&
>> - "found landingpad without unreachable or llvm.eh.actions");
>> - return false;
>> - }
>> -
>> - // If this is a call to llvm.eh.actions followed by indirectbr, then we've
>> - // run WinEHPrepare, and we should remove this block from the machine CFG.
>> - // Mark the targets of the indirectbr as landingpads instead.
>> - for (const BasicBlock *LLVMSucc : successors(LLVMBB)) {
>> - MachineBasicBlock *ClauseBB = FuncInfo->MBBMap[LLVMSucc];
>> - // Add the edge from the invoke to the clause.
>> - for (MachineBasicBlock *InvokeBB : InvokeBBs)
>> - InvokeBB->addSuccessor(ClauseBB);
>> + if (Actions && Actions->getIntrinsicID() == Intrinsic::eh_actions) {
>> + // If this is a call to llvm.eh.actions followed by indirectbr, then we've
>> + // run WinEHPrepare, and we should remove this block from the machine CFG.
>> + // Mark the targets of the indirectbr as landingpads instead.
>> + for (const BasicBlock *LLVMSucc : successors(LLVMBB)) {
>> + MachineBasicBlock *ClauseBB = FuncInfo->MBBMap[LLVMSucc];
>> + // Add the edge from the invoke to the clause.
>> + for (MachineBasicBlock *InvokeBB : InvokeBBs)
>> + InvokeBB->addSuccessor(ClauseBB);
>> + }
>> + } else {
>> + // Otherwise, we haven't done the preparation, and we need to invent some
>> + // clause basic blocks that branch into the landingpad.
>> + // FIXME: Remove this code once SEH preparation works.
>> +
>> + // Make virtual registers and a series of labels that fill in values for
>> + // the clauses.
>> + auto &RI = MF->getRegInfo();
>> + FuncInfo->ExceptionSelectorVirtReg = RI.createVirtualRegister(PtrRC);
>> +
>> + // Emit separate machine basic blocks with separate labels for each clause
>> + // before the main landing pad block.
>> + MachineInstrBuilder SelectorPHI = BuildMI(
>> + *MBB, MBB->begin(), SDB->getCurDebugLoc(),
>> + TII->get(TargetOpcode::PHI), FuncInfo->ExceptionSelectorVirtReg);
>> + for (unsigned I = 0, E = LPadInst->getNumClauses(); I != E; ++I) {
>> + // Skip filter clauses, we can't implement them.
>> + if (LPadInst->isFilter(I))
>> + continue;
>> +
>> + MachineBasicBlock *ClauseBB = MF->CreateMachineBasicBlock(LLVMBB);
>> + MF->insert(MBB, ClauseBB);
>> +
>> + // Add the edge from the invoke to the clause.
>> + for (MachineBasicBlock *InvokeBB : InvokeBBs)
>> + InvokeBB->addSuccessor(ClauseBB);
>> +
>> + // Mark the clause as a landing pad or MI passes will delete it.
>> + ClauseBB->setIsLandingPad();
>> +
>> + GlobalValue *ClauseGV = ExtractTypeInfo(LPadInst->getClause(I));
>> +
>> + // Start the BB with a label.
>> + MCSymbol *ClauseLabel = MF->getMMI().addClauseForLandingPad(MBB);
>> + BuildMI(*ClauseBB, ClauseBB->begin(), SDB->getCurDebugLoc(), II)
>> + .addSym(ClauseLabel);
>> +
>> + // Construct a simple BB that defines a register with the typeid
>> + // constant.
>> + FuncInfo->MBB = ClauseBB;
>> + FuncInfo->InsertPt = ClauseBB->end();
>> + unsigned VReg = SDB->visitLandingPadClauseBB(ClauseGV, MBB);
>> + CurDAG->setRoot(SDB->getRoot());
>> + SDB->clear();
>> + CodeGenAndEmitDAG();
>>
>> - // Mark the clause as a landing pad or MI passes will delete it.
>> - ClauseBB->setIsLandingPad();
>> + // Add the typeid virtual register to the phi in the main landing pad.
>> + SelectorPHI.addReg(VReg).addMBB(ClauseBB);
>> + }
>> }
>>
>> // Remove the edge from the invoke to the lpad.
>> @@ -975,9 +1017,7 @@ bool SelectionDAGISel::PrepareEHLandingP
>> WinEHFuncInfo &FI = MF->getMMI().getWinEHFuncInfo(MF->getFunction());
>> MF->getMMI().addWinEHState(MBB, FI.LandingPadStateMap[LPadInst]);
>> }
>> -
>> - // Don't select instructions for landing pads using llvm.eh.actions.
>> - return false;
>> + return;
>> }
>>
>> // Mark exception register as live in.
>> @@ -987,8 +1027,6 @@ bool SelectionDAGISel::PrepareEHLandingP
>> // Mark exception selector register as live in.
>> if (unsigned Reg = TLI->getExceptionSelectorRegister())
>> FuncInfo->ExceptionSelectorVirtReg = MBB->addLiveIn(Reg, PtrRC);
>> -
>> - return true;
>> }
>>
>> /// isFoldedOrDeadInstruction - Return true if the specified instruction is
>> @@ -1159,8 +1197,7 @@ void SelectionDAGISel::SelectAllBasicBlo
>> FuncInfo->ExceptionPointerVirtReg = 0;
>> FuncInfo->ExceptionSelectorVirtReg = 0;
>> if (LLVMBB->isLandingPad())
>> - if (!PrepareEHLandingPad())
>> - continue;
>> + PrepareEHLandingPad();
>>
>> // Before doing SelectionDAG ISel, see if FastISel has been requested.
>> if (FastIS) {
>>
>> Modified: llvm/trunk/lib/CodeGen/WinEHPrepare.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/WinEHPrepare.cpp?rev=235170&r1=235169&r2=235170&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/WinEHPrepare.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/WinEHPrepare.cpp Fri Apr 17 04:10:43 2015
>> @@ -306,6 +306,11 @@ FunctionPass *llvm::createWinEHPass(cons
>> return new WinEHPrepare(TM);
>> }
>>
>> +// FIXME: Remove this once the backend can handle the prepared IR.
>> +static cl::opt<bool>
>> + SEHPrepare("sehprepare", cl::Hidden,
>> + cl::desc("Prepare functions with SEH personalities"));
>> +
>> bool WinEHPrepare::runOnFunction(Function &Fn) {
>> SmallVector<LandingPadInst *, 4> LPads;
>> SmallVector<ResumeInst *, 4> Resumes;
>> @@ -329,6 +334,16 @@ bool WinEHPrepare::runOnFunction(Functio
>>
>> DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
>>
>> + if (isAsynchronousEHPersonality(Personality) && !SEHPrepare) {
>> + // Replace all resume instructions with unreachable.
>> + // FIXME: Remove this once the backend can handle the prepared IR.
>> + for (ResumeInst *Resume : Resumes) {
>> + IRBuilder<>(Resume).CreateUnreachable();
>> + Resume->eraseFromParent();
>> + }
>> + return true;
>> + }
>> +
>> // If there were any landing pads, prepareExceptionHandlers will make changes.
>> prepareExceptionHandlers(Fn, LPads);
>> return true;
>>
>> Modified: llvm/trunk/test/CodeGen/WinEH/seh-catch-all.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/seh-catch-all.ll?rev=235170&r1=235169&r2=235170&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/WinEH/seh-catch-all.ll (original)
>> +++ llvm/trunk/test/CodeGen/WinEH/seh-catch-all.ll Fri Apr 17 04:10:43 2015
>> @@ -1,4 +1,4 @@
>> -; RUN: opt -S -winehprepare < %s | FileCheck %s
>> +; RUN: opt -S -winehprepare -sehprepare < %s | FileCheck %s
>>
>> target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
>> target triple = "x86_64-pc-windows-msvc"
>>
>> Modified: llvm/trunk/test/CodeGen/WinEH/seh-inlined-finally.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/seh-inlined-finally.ll?rev=235170&r1=235169&r2=235170&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/WinEH/seh-inlined-finally.ll (original)
>> +++ llvm/trunk/test/CodeGen/WinEH/seh-inlined-finally.ll Fri Apr 17 04:10:43 2015
>> @@ -1,4 +1,4 @@
>> -; RUN: opt -S -winehprepare < %s | FileCheck %s
>> +; RUN: opt -S -winehprepare -sehprepare < %s | FileCheck %s
>>
>> ; Check that things work when the mid-level optimizer inlines the finally
>> ; block.
>>
>> Modified: llvm/trunk/test/CodeGen/WinEH/seh-outlined-finally.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/seh-outlined-finally.ll?rev=235170&r1=235169&r2=235170&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/WinEH/seh-outlined-finally.ll (original)
>> +++ llvm/trunk/test/CodeGen/WinEH/seh-outlined-finally.ll Fri Apr 17 04:10:43 2015
>> @@ -1,4 +1,4 @@
>> -; RUN: opt -S -winehprepare -mtriple=x86_64-windows-msvc < %s | FileCheck %s
>> +; RUN: opt -S -winehprepare -sehprepare -mtriple=x86_64-windows-msvc < %s | FileCheck %s
>>
>> ; Test case based on this code:
>> ;
>>
>> Removed: llvm/trunk/test/CodeGen/WinEH/seh-prepared-basic.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/seh-prepared-basic.ll?rev=235169&view=auto
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/WinEH/seh-prepared-basic.ll (original)
>> +++ llvm/trunk/test/CodeGen/WinEH/seh-prepared-basic.ll (removed)
>> @@ -1,83 +0,0 @@
>> -; RUN: llc < %s | FileCheck %s
>> -
>> -; Test case based on this code:
>> -; extern "C" unsigned long _exception_code();
>> -; extern "C" int filt(unsigned long);
>> -; extern "C" void g();
>> -; extern "C" void do_except() {
>> -; __try {
>> -; g();
>> -; } __except(filt(_exception_code())) {
>> -; }
>> -; }
>> -
>> -target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
>> -target triple = "x86_64-pc-windows-msvc"
>> -
>> -; Function Attrs: uwtable
>> -define void @do_except() #0 {
>> -entry:
>> - call void (...) @llvm.frameescape()
>> - invoke void @g() #5
>> - to label %__try.cont unwind label %lpad1
>> -
>> -lpad1: ; preds = %entry
>> - %ehvals = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*)
>> - catch i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0 at 0@do_except@@" to i8*)
>> - %recover = call i8* (...) @llvm.eh.actions(i32 1, i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0 at 0@do_except@@" to i8*), i32 -1, i8* blockaddress(@do_except, %__try.cont))
>> - indirectbr i8* %recover, [label %__try.cont]
>> -
>> -__try.cont: ; preds = %lpad1, %entry
>> - ret void
>> -}
>> -
>> -; CHECK-LABEL: do_except:
>> -; CHECK: .seh_handler __C_specific_handler
>> -; CHECK-NOT: jmpq *
>> -; CHECK: .seh_handlerdata
>> -; CHECK-NEXT: .long 1
>> -; CHECK-NEXT: .long .Ltmp{{.*}}
>> -; CHECK-NEXT: .long .Ltmp{{.*}}
>> -; CHECK-NEXT: .long "?filt$0 at 0@do_except@@"@IMGREL
>> -; CHECK-NEXT: .long .Ltmp{{.*}}@IMGREL
>> -
>> -; Function Attrs: noinline nounwind
>> -define internal i32 @"\01?filt$0 at 0@do_except@@"(i8* nocapture readonly %exception_pointers, i8* nocapture readnone %frame_pointer) #1 {
>> -entry:
>> - %0 = bitcast i8* %exception_pointers to i32**
>> - %1 = load i32*, i32** %0, align 8
>> - %2 = load i32, i32* %1, align 4
>> - %call = tail call i32 @filt(i32 %2) #4
>> - ret i32 %call
>> -}
>> -
>> -declare i32 @filt(i32) #2
>> -
>> -declare void @g() #2
>> -
>> -declare i32 @__C_specific_handler(...)
>> -
>> -; Function Attrs: nounwind readnone
>> -declare i32 @llvm.eh.typeid.for(i8*) #3
>> -
>> -; Function Attrs: nounwind
>> -declare i8* @llvm.eh.actions(...) #4
>> -
>> -; Function Attrs: nounwind
>> -declare void @llvm.frameescape(...) #4
>> -
>> -; Function Attrs: nounwind readnone
>> -declare i8* @llvm.framerecover(i8*, i8*, i32) #3
>> -
>> -attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "unsafe-fp-math"="false" "use-soft-float"="false" "wineh-parent"="do_except" }
>> -attributes #1 = { noinline nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "unsafe-fp-math"="false" "use-soft-float"="false" }
>> -attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "unsafe-fp-math"="false" "use-soft-float"="false" }
>> -attributes #3 = { nounwind readnone }
>> -attributes #4 = { nounwind }
>> -attributes #5 = { noinline }
>> -
>> -!llvm.module.flags = !{!0}
>> -!llvm.ident = !{!1}
>> -
>> -!0 = !{i32 1, !"PIC Level", i32 2}
>> -!1 = !{!"clang version 3.7.0 "}
>>
>> Modified: llvm/trunk/test/CodeGen/WinEH/seh-simple.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/seh-simple.ll?rev=235170&r1=235169&r2=235170&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/WinEH/seh-simple.ll (original)
>> +++ llvm/trunk/test/CodeGen/WinEH/seh-simple.ll Fri Apr 17 04:10:43 2015
>> @@ -1,4 +1,4 @@
>> -; RUN: opt -S -winehprepare -mtriple=x86_64-windows-msvc < %s | FileCheck %s
>> +; RUN: opt -S -winehprepare -sehprepare -mtriple=x86_64-windows-msvc < %s | FileCheck %s
>>
>> target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
>> target triple = "x86_64-pc-windows-msvc"
>>
>> Removed: llvm/trunk/test/CodeGen/X86/seh-except-finally.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/seh-except-finally.ll?rev=235169&view=auto
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/X86/seh-except-finally.ll (original)
>> +++ llvm/trunk/test/CodeGen/X86/seh-except-finally.ll (removed)
>> @@ -1,167 +0,0 @@
>> -; RUN: llc < %s | FileCheck %s
>> -
>> -; Test case based on this source:
>> -; int puts(const char*);
>> -; __declspec(noinline) void crash() {
>> -; *(volatile int*)0 = 42;
>> -; }
>> -; int filt();
>> -; void use_both() {
>> -; __try {
>> -; __try {
>> -; crash();
>> -; } __finally {
>> -; puts("__finally");
>> -; }
>> -; } __except (filt()) {
>> -; puts("__except");
>> -; }
>> -; }
>> -
>> -target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
>> -target triple = "x86_64-pc-windows-msvc"
>> -
>> -$"\01??_C at _09KJEHOMHG@__finally?$AA@" = comdat any
>> -
>> -$"\01??_C at _08MLCMLGHM@__except?$AA@" = comdat any
>> -
>> -@"\01??_C at _09KJEHOMHG@__finally?$AA@" = linkonce_odr unnamed_addr constant [10 x i8] c"__finally\00", comdat, align 1
>> -@"\01??_C at _08MLCMLGHM@__except?$AA@" = linkonce_odr unnamed_addr constant [9 x i8] c"__except\00", comdat, align 1
>> -
>> -declare void @crash()
>> -
>> -declare i32 @filt()
>> -
>> -; Function Attrs: nounwind uwtable
>> -define void @use_both() #1 {
>> -entry:
>> - %exn.slot = alloca i8*
>> - %ehselector.slot = alloca i32
>> - invoke void @crash() #5
>> - to label %invoke.cont unwind label %lpad
>> -
>> -invoke.cont: ; preds = %entry
>> - %0 = call i8* @llvm.frameaddress(i32 0)
>> - invoke void @"\01?fin$0 at 0@use_both@@"(i1 zeroext false, i8* %0) #5
>> - to label %invoke.cont2 unwind label %lpad1
>> -
>> -invoke.cont2: ; preds = %invoke.cont
>> - br label %__try.cont
>> -
>> -lpad: ; preds = %entry
>> - %1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*)
>> - cleanup
>> - catch i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0 at 0@use_both@@" to i8*)
>> - %2 = extractvalue { i8*, i32 } %1, 0
>> - store i8* %2, i8** %exn.slot
>> - %3 = extractvalue { i8*, i32 } %1, 1
>> - store i32 %3, i32* %ehselector.slot
>> - %4 = call i8* @llvm.frameaddress(i32 0)
>> - invoke void @"\01?fin$0 at 0@use_both@@"(i1 zeroext true, i8* %4) #5
>> - to label %invoke.cont3 unwind label %lpad1
>> -
>> -lpad1: ; preds = %lpad, %invoke.cont
>> - %5 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*)
>> - catch i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0 at 0@use_both@@" to i8*)
>> - %6 = extractvalue { i8*, i32 } %5, 0
>> - store i8* %6, i8** %exn.slot
>> - %7 = extractvalue { i8*, i32 } %5, 1
>> - store i32 %7, i32* %ehselector.slot
>> - br label %catch.dispatch
>> -
>> -invoke.cont3: ; preds = %lpad
>> - br label %catch.dispatch
>> -
>> -catch.dispatch: ; preds = %invoke.cont3, %lpad1
>> - %sel = load i32, i32* %ehselector.slot
>> - %8 = call i32 @llvm.eh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0 at 0@use_both@@" to i8*)) #6
>> - %matches = icmp eq i32 %sel, %8
>> - br i1 %matches, label %__except, label %eh.resume
>> -
>> -__except: ; preds = %catch.dispatch
>> - %call = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @"\01??_C at _08MLCMLGHM@__except?$AA@", i32 0, i32 0))
>> - br label %__try.cont
>> -
>> -__try.cont: ; preds = %__except, %invoke.cont2
>> - ret void
>> -
>> -eh.resume: ; preds = %catch.dispatch
>> - %exn = load i8*, i8** %exn.slot
>> - %sel4 = load i32, i32* %ehselector.slot
>> - %lpad.val = insertvalue { i8*, i32 } undef, i8* %exn, 0
>> - %lpad.val5 = insertvalue { i8*, i32 } %lpad.val, i32 %sel4, 1
>> - resume { i8*, i32 } %lpad.val5
>> -}
>> -
>> -; CHECK-LABEL: use_both:
>> -; CHECK: .Ltmp0
>> -; CHECK: callq crash
>> -; CHECK: .Ltmp1
>> -; CHECK: .Ltmp3
>> -; CHECK: callq "?fin$0 at 0@use_both@@"
>> -; CHECK: .Ltmp4
>> -; CHECK: retq
>> -;
>> -; CHECK: .seh_handlerdata
>> -; CHECK-NEXT: .long 3
>> -; CHECK-NEXT: .long .Ltmp0 at IMGREL
>> -; CHECK-NEXT: .long .Ltmp1 at IMGREL+1
>> -; CHECK-NEXT: .long "?fin$0 at 0@use_both@@"@IMGREL
>> -; CHECK-NEXT: .long 0
>> -; CHECK-NEXT: .long .Ltmp0 at IMGREL
>> -; CHECK-NEXT: .long .Ltmp1 at IMGREL+1
>> -; CHECK-NEXT: .long "?filt$0 at 0@use_both@@"@IMGREL
>> -; CHECK-NEXT: .long .Ltmp{{[0-9]+}}@IMGREL
>> -; CHECK-NEXT: .long .Ltmp3 at IMGREL
>> -; CHECK-NEXT: .long .Ltmp4 at IMGREL+1
>> -; CHECK-NEXT: .long "?filt$0 at 0@use_both@@"@IMGREL
>> -; CHECK-NEXT: .long .Ltmp{{[0-9]+}}@IMGREL
>> -
>> -; Function Attrs: noinline nounwind
>> -define internal i32 @"\01?filt$0 at 0@use_both@@"(i8* %exception_pointers, i8* %frame_pointer) #2 {
>> -entry:
>> - %frame_pointer.addr = alloca i8*, align 8
>> - %exception_pointers.addr = alloca i8*, align 8
>> - %exn.slot = alloca i8*
>> - store i8* %frame_pointer, i8** %frame_pointer.addr, align 8
>> - store i8* %exception_pointers, i8** %exception_pointers.addr, align 8
>> - %0 = load i8*, i8** %exception_pointers.addr
>> - %1 = bitcast i8* %0 to { i32*, i8* }*
>> - %2 = getelementptr inbounds { i32*, i8* }, { i32*, i8* }* %1, i32 0, i32 0
>> - %3 = load i32*, i32** %2
>> - %4 = load i32, i32* %3
>> - %5 = zext i32 %4 to i64
>> - %6 = inttoptr i64 %5 to i8*
>> - store i8* %6, i8** %exn.slot
>> - %call = call i32 @filt()
>> - ret i32 %call
>> -}
>> -
>> -define internal void @"\01?fin$0 at 0@use_both@@"(i1 zeroext %abnormal_termination, i8* %frame_pointer) #3 {
>> -entry:
>> - %frame_pointer.addr = alloca i8*, align 8
>> - %abnormal_termination.addr = alloca i8, align 1
>> - store i8* %frame_pointer, i8** %frame_pointer.addr, align 8
>> - %frombool = zext i1 %abnormal_termination to i8
>> - store i8 %frombool, i8* %abnormal_termination.addr, align 1
>> - %call = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @"\01??_C at _09KJEHOMHG@__finally?$AA@", i32 0, i32 0))
>> - ret void
>> -}
>> -
>> -declare i32 @puts(i8*) #3
>> -
>> -declare i32 @__C_specific_handler(...)
>> -
>> -; Function Attrs: nounwind readnone
>> -declare i8* @llvm.frameaddress(i32) #4
>> -
>> -; Function Attrs: nounwind readnone
>> -declare i32 @llvm.eh.typeid.for(i8*) #4
>> -
>> -attributes #0 = { noinline nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "unsafe-fp-math"="false" "use-soft-float"="false" }
>> -attributes #1 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "unsafe-fp-math"="false" "use-soft-float"="false" }
>> -attributes #2 = { noinline nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "unsafe-fp-math"="false" "use-soft-float"="false" }
>> -attributes #3 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "unsafe-fp-math"="false" "use-soft-float"="false" }
>> -attributes #4 = { nounwind readnone }
>> -attributes #5 = { noinline }
>> -attributes #6 = { nounwind }
>>
>> Modified: llvm/trunk/test/CodeGen/X86/seh-finally.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/seh-finally.ll?rev=235170&r1=235169&r2=235170&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/X86/seh-finally.ll (original)
>> +++ llvm/trunk/test/CodeGen/X86/seh-finally.ll Fri Apr 17 04:10:43 2015
>> @@ -32,18 +32,12 @@ terminate.lpad:
>> unreachable
>> }
>>
>> -; CHECK-LABEL: main:
>> +; CHECK: main:
>> +
>> +; FIXME: No handlers yet!
>> ; CHECK: .seh_handlerdata
>> -; CHECK-NEXT: .long 1
>> -; CHECK-NEXT: .long .Ltmp0 at IMGREL
>> -; CHECK-NEXT: .long .Ltmp1 at IMGREL
>> -; CHECK-NEXT: .long main.cleanup at IMGREL
>> ; CHECK-NEXT: .long 0
>>
>> -; CHECK-LABEL: main.cleanup:
>> -; CHECK: callq puts
>> -; CHECK: retq
>> -
>> declare i32 @__C_specific_handler(...)
>>
>> declare i32 @puts(i8*)
>>
>> Modified: llvm/trunk/test/CodeGen/X86/seh-safe-div.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/seh-safe-div.ll?rev=235170&r1=235169&r2=235170&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/X86/seh-safe-div.ll (original)
>> +++ llvm/trunk/test/CodeGen/X86/seh-safe-div.ll Fri Apr 17 04:10:43 2015
>> @@ -71,34 +71,46 @@ __try.cont:
>> ; CHECK: leaq [[rloc:.*\(%rsp\)]], %rcx
>> ; CHECK: callq try_body
>> ; CHECK-NEXT: .Ltmp1
>> -; CHECK: [[cont_bb:\.LBB0_[0-9]+]]:
>> +; CHECK: .LBB0_7:
>> ; CHECK: movl [[rloc]], %eax
>> ; CHECK: retq
>>
>> ; Landing pad code
>>
>> -; CHECK: [[handler0:\.Ltmp[0-9]+]]: # Block address taken
>> +; CHECK: .Ltmp3:
>> +; CHECK: movl $1, %[[sel:[a-z]+]]
>> +; CHECK: .Ltmp4
>> +; CHECK: movl $2, %[[sel]]
>> +; CHECK: .L{{.*}}:
>> +; CHECK: cmpl $1, %[[sel]]
>> +
>> ; CHECK: # %handler0
>> ; CHECK: callq puts
>> ; CHECK: movl $-1, [[rloc]]
>> -; CHECK: jmp [[cont_bb]]
>> +; CHECK: jmp .LBB0_7
>> +
>> +; CHECK: cmpl $2, %[[sel]]
>>
>> -; CHECK: [[handler1:\.Ltmp[0-9]+]]: # Block address taken
>> ; CHECK: # %handler1
>> ; CHECK: callq puts
>> ; CHECK: movl $-2, [[rloc]]
>> -; CHECK: jmp [[cont_bb]]
>> +; CHECK: jmp .LBB0_7
>> +
>> +; FIXME: EH preparation should eliminate the 'resume' instr and we should not do
>> +; the previous 'cmp;jeq'.
>> +; CHECK-NOT: _Unwind_Resume
>> +; CHECK: ud2
>>
>> ; CHECK: .seh_handlerdata
>> -; CHECK-NEXT: .long 2
>> -; CHECK-NEXT: .long .Ltmp0 at IMGREL
>> -; CHECK-NEXT: .long .Ltmp1 at IMGREL+1
>> -; CHECK-NEXT: .long safe_div_filt0 at IMGREL
>> -; CHECK-NEXT: .long [[handler0]]@IMGREL
>> -; CHECK-NEXT: .long .Ltmp0 at IMGREL
>> -; CHECK-NEXT: .long .Ltmp1 at IMGREL+1
>> -; CHECK-NEXT: .long safe_div_filt1 at IMGREL
>> -; CHECK-NEXT: .long [[handler1]]@IMGREL
>> +; CHECK: .long 2
>> +; CHECK: .long .Ltmp0 at IMGREL
>> +; CHECK: .long .Ltmp1 at IMGREL+1
>> +; CHECK: .long safe_div_filt0 at IMGREL
>> +; CHECK: .long .Ltmp3 at IMGREL
>> +; CHECK: .long .Ltmp0 at IMGREL
>> +; CHECK: .long .Ltmp1 at IMGREL+1
>> +; CHECK: .long safe_div_filt1 at IMGREL
>> +; CHECK: .long .Ltmp4 at IMGREL
>> ; CHECK: .text
>> ; CHECK: .seh_endproc
>>
>> @@ -173,6 +185,11 @@ define i32 @main() {
>> ret i32 0
>> }
>>
>> +define void @_Unwind_Resume() {
>> + call void @abort()
>> + unreachable
>> +}
>> +
>> declare i32 @__C_specific_handler(...)
>> declare i32 @llvm.eh.typeid.for(i8*) readnone nounwind
>> declare void @puts(i8*)
>>
>> Modified: llvm/trunk/test/CodeGen/X86/win_eh_prepare.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/win_eh_prepare.ll?rev=235170&r1=235169&r2=235170&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/X86/win_eh_prepare.ll (original)
>> +++ llvm/trunk/test/CodeGen/X86/win_eh_prepare.ll Fri Apr 17 04:10:43 2015
>> @@ -43,10 +43,8 @@ define internal i32 @filt_g(i8*, i8*) {
>> ; CHECK-LABEL: define i32 @use_seh()
>> ; CHECK: invoke void @maybe_throw()
>> ; CHECK-NEXT: to label %cont unwind label %lpad
>> -; CHECK: landingpad
>> -; CHECK-NEXT: cleanup
>> -; CHECK-NEXT: catch
>> -; CHECK-NEXT: call i8* (...) @llvm.eh.actions({{.*}})
>> +; CHECK: eh.resume:
>> +; CHECK-NEXT: unreachable
>>
>>
>> ; A MinGW64-ish EH style. It could happen if a binary uses both MSVC CRT and
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list