llvm.org GIT mirror llvm / e73d028
[ArgumentPromotion] Propagate operand bundles to promoted call sites We neglected to transfer operand bundles when performing argument promotion. This fixes PR27568. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267986 91177308-0d34-0410-b5e6-96231b3b80d8 David Majnemer 3 years ago
2 changed file(s) with 36 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
856856 AttributesVec.push_back(AttributeSet::get(Call->getContext(),
857857 CallPAL.getFnAttributes()));
858858
859 SmallVector OpBundles;
860 CS.getOperandBundlesAsDefs(OpBundles);
861
859862 Instruction *New;
860863 if (InvokeInst *II = dyn_cast(Call)) {
861864 New = InvokeInst::Create(NF, II->getNormalDest(), II->getUnwindDest(),
862 Args, "", Call);
865 Args, OpBundles, "", Call);
863866 cast(New)->setCallingConv(CS.getCallingConv());
864867 cast(New)->setAttributes(AttributeSet::get(II->getContext(),
865868 AttributesVec));
866869 } else {
867 New = CallInst::Create(NF, Args, "", Call);
870 New = CallInst::Create(NF, Args, OpBundles, "", Call);
868871 cast(New)->setCallingConv(CS.getCallingConv());
869872 cast(New)->setAttributes(AttributeSet::get(New->getContext(),
870873 AttributesVec));
0 ; RUN: opt -S -argpromotion < %s | FileCheck %s
1 target triple = "x86_64-pc-windows-msvc"
2
3 define internal void @callee(i8*) {
4 entry:
5 call void @thunk()
6 ret void
7 }
8
9 define void @test1() personality i32 (...)* @__CxxFrameHandler3 {
10 entry:
11 invoke void @thunk()
12 to label %out unwind label %cpad
13
14 out:
15 ret void
16
17 cpad:
18 %pad = cleanuppad within none []
19 call void @callee(i8* null) [ "funclet"(token %pad) ]
20 cleanupret from %pad unwind to caller
21 }
22
23 ; CHECK-LABEL: define void @test1(
24 ; CHECK: %[[pad:.*]] = cleanuppad within none []
25 ; CHECK-NEXT: call void @callee() [ "funclet"(token %[[pad]]) ]
26 ; CHECK-NEXT: cleanupret from %[[pad]] unwind to caller
27
28 declare void @thunk()
29
30 declare i32 @__CxxFrameHandler3(...)