[PATCH] D15345: [OperandBundles] Fix a transform in simplifycfg

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 8 14:29:14 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL255062: [OperandBundles] Fix a transform in simplifycfg (authored by sanjoy).

Changed prior to commit:
  http://reviews.llvm.org/D15345?vs=42208&id=42229#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15345

Files:
  llvm/trunk/lib/Transforms/Utils/Local.cpp
  llvm/trunk/test/Transforms/SimplifyCFG/invoke_unwind.ll

Index: llvm/trunk/test/Transforms/SimplifyCFG/invoke_unwind.ll
===================================================================
--- llvm/trunk/test/Transforms/SimplifyCFG/invoke_unwind.ll
+++ llvm/trunk/test/Transforms/SimplifyCFG/invoke_unwind.ll
@@ -17,4 +17,17 @@
         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(...)
Index: llvm/trunk/lib/Transforms/Utils/Local.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/Local.cpp
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp
@@ -1210,8 +1210,12 @@
 
 /// 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());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15345.42229.patch
Type: text/x-patch
Size: 1677 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151208/1e59bceb/attachment.bin>


More information about the llvm-commits mailing list