Skip to content

Commit

Permalink
[OperandBundles] Fix a transform in simplifycfg
Browse files Browse the repository at this point in the history
Reviewers: pcc, majnemer, reames

Subscribers: reames, llvm-commits

Differential Revision: http://reviews.llvm.org/D15345

llvm-svn: 255062
  • Loading branch information
sanjoy committed Dec 8, 2015
1 parent 323e00d commit 8a954a0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
8 changes: 6 additions & 2 deletions llvm/lib/Transforms/Utils/Local.cpp
Expand Up @@ -1210,8 +1210,12 @@ static void changeToUnreachable(Instruction *I, bool UseLLVMTrap) {

/// changeToCall - Convert the specified invoke into a normal call.
static void changeToCall(InvokeInst *II) {
SmallVector<Value*, 8> Args(II->op_begin(), II->op_end() - 3);
CallInst *NewCall = CallInst::Create(II->getCalledValue(), Args, "", II);
CallSite CS(II);
SmallVector<Value*, 8> Args(CS.arg_begin(), CS.arg_end());
SmallVector<OperandBundleDef, 1> OpBundles;
II->getOperandBundlesAsDefs(OpBundles);
CallInst *NewCall = CallInst::Create(II->getCalledValue(), Args, OpBundles,
"", II);
NewCall->takeName(II);
NewCall->setCallingConv(II->getCallingConv());
NewCall->setAttributes(II->getAttributes());
Expand Down
13 changes: 13 additions & 0 deletions llvm/test/Transforms/SimplifyCFG/invoke_unwind.ll
Expand Up @@ -17,4 +17,17 @@ Rethrow:
resume { i8*, i32 } %exn
}

define i32 @test2() personality i32 (...)* @__gxx_personality_v0 {
; CHECK-LABEL: @test2(
; CHECK-NEXT: call void @bar() [ "foo"(i32 100) ]
; CHECK-NEXT: ret i32 0
invoke void @bar( ) [ "foo"(i32 100) ]
to label %1 unwind label %Rethrow
ret i32 0
Rethrow:
%exn = landingpad {i8*, i32}
catch i8* null
resume { i8*, i32 } %exn
}

declare i32 @__gxx_personality_v0(...)

0 comments on commit 8a954a0

Please sign in to comment.