diff options
author | Reid Kleckner <reid@kleckner.net> | 2015-03-19 22:31:02 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2015-03-19 22:31:02 +0000 |
commit | c759fe90bc19fe408f58b106626b32b790b3de5e (patch) | |
tree | e26b34c868be0fdd7505f81c471181cc4910cfc7 /llvm/lib/CodeGen | |
parent | d5c2d287f98c39968934d4a241a6c1292052e140 (diff) | |
download | bcm5719-llvm-c759fe90bc19fe408f58b106626b32b790b3de5e.tar.gz bcm5719-llvm-c759fe90bc19fe408f58b106626b32b790b3de5e.zip |
WinEH: Make llvm.eh.actions emission match the EH docs
This switches the sense of the i32 values and updates the test cases.
We can also use CHECK-SAME to clean up some tests, and reduce the visual
noise from bitcasts.
llvm-svn: 232774
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/WinEHPrepare.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index 383aaf6613f..3b934bbdb45 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -401,8 +401,7 @@ bool WinEHPrepare::prepareExceptionHandlers( // Look for evidence that this landingpad has already been processed. bool LPadHasActionList = false; BasicBlock *LPadBB = LPad->getParent(); - for (Instruction &Inst : LPadBB->getInstList()) { - // FIXME: Make this an intrinsic. + for (Instruction &Inst : *LPadBB) { if (auto *IntrinCall = dyn_cast<IntrinsicInst>(&Inst)) { if (IntrinCall->getIntrinsicID() == Intrinsic::eh_actions) { LPadHasActionList = true; @@ -469,10 +468,10 @@ bool WinEHPrepare::prepareExceptionHandlers( // Add a call to describe the actions for this landing pad. std::vector<Value *> ActionArgs; - ActionArgs.push_back(NewLPad); for (ActionHandler *Action : Actions) { + // Action codes from docs are: 0 cleanup, 1 catch. if (auto *CatchAction = dyn_cast<CatchHandler>(Action)) { - ActionArgs.push_back(ConstantInt::get(Int32Type, 0)); + ActionArgs.push_back(ConstantInt::get(Int32Type, 1)); ActionArgs.push_back(CatchAction->getSelector()); Value *EHObj = const_cast<Value *>(CatchAction->getExceptionVar()); if (EHObj) @@ -480,11 +479,9 @@ bool WinEHPrepare::prepareExceptionHandlers( else ActionArgs.push_back(ConstantPointerNull::get(Int8PtrType)); } else { - ActionArgs.push_back(ConstantInt::get(Int32Type, 1)); + ActionArgs.push_back(ConstantInt::get(Int32Type, 0)); } - Constant *HandlerPtr = ConstantExpr::getBitCast( - Action->getHandlerBlockOrFunc(), Int8PtrType); - ActionArgs.push_back(HandlerPtr); + ActionArgs.push_back(Action->getHandlerBlockOrFunc()); } CallInst *Recover = CallInst::Create(ActionIntrin, ActionArgs, "recover", NewLPadBB); |