diff options
| author | Reid Kleckner <rnk@google.com> | 2015-10-07 00:27:33 +0000 | 
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2015-10-07 00:27:33 +0000 | 
| commit | 72ba70418f1d2801c5707768da9533f46d6a773f (patch) | |
| tree | 3fd58552d5a966bedba0c66ee928c0d2ae89dfbe /llvm/lib/CodeGen/WinEHPrepare.cpp | |
| parent | ee59282bfd2dfc0175591176c3e45c8ecf0931cf (diff) | |
| download | bcm5719-llvm-72ba70418f1d2801c5707768da9533f46d6a773f.tar.gz bcm5719-llvm-72ba70418f1d2801c5707768da9533f46d6a773f.zip  | |
[SEH] Add llvm.eh.exceptioncode intrinsic
This will support the Clang __exception_code intrinsic.
llvm-svn: 249492
Diffstat (limited to 'llvm/lib/CodeGen/WinEHPrepare.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/WinEHPrepare.cpp | 17 | 
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index a9fec812071..86b511cfb67 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -1614,7 +1614,7 @@ void WinEHPrepare::processSEHCatchHandler(CatchHandler *CatchAction,    }    IRBuilder<> Builder(HandlerBB->getFirstInsertionPt());    Function *EHCodeFn = Intrinsic::getDeclaration( -      StartBB->getParent()->getParent(), Intrinsic::eh_exceptioncode); +      StartBB->getParent()->getParent(), Intrinsic::eh_exceptioncode_old);    Value *Code = Builder.CreateCall(EHCodeFn, {}, "sehcode");    Code = Builder.CreateIntToPtr(Code, SEHExceptionCodeSlot->getAllocatedType());    Builder.CreateStore(Code, SEHExceptionCodeSlot); @@ -3019,12 +3019,11 @@ colorFunclets(Function &F, SmallVectorImpl<BasicBlock *> &EntryBlocks,        // Mark this as a funclet head as a member of itself.        FuncletBlocks[Visiting].insert(Visiting);        // Queue exits with the parent color. -      for (User *Exit : VisitingHead->users()) { -        for (BasicBlock *Succ : -             successors(cast<Instruction>(Exit)->getParent())) { -          if (BlockColors[Succ].insert(Color).second) { -            Worklist.push_back({Succ, Color}); -          } +      for (User *U : VisitingHead->users()) { +        if (auto *Exit = dyn_cast<TerminatorInst>(U)) { +          for (BasicBlock *Succ : successors(Exit->getParent())) +            if (BlockColors[Succ].insert(Color).second) +              Worklist.push_back({Succ, Color});          }        }        // Handle CatchPad specially since its successors need different colors. @@ -3124,7 +3123,9 @@ void llvm::calculateCatchReturnSuccessorColors(const Function *Fn,      // The users of a catchpad are always catchrets.      for (User *Exit : CatchPad->users()) { -      auto *CatchReturn = cast<CatchReturnInst>(Exit); +      auto *CatchReturn = dyn_cast<CatchReturnInst>(Exit); +      if (!CatchReturn) +        continue;        BasicBlock *CatchRetSuccessor = CatchReturn->getSuccessor();        std::set<BasicBlock *> &SuccessorColors = BlockColors[CatchRetSuccessor];        assert(SuccessorColors.size() == 1 && "Expected BB to be monochrome!");  | 

