Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions llvm/test/tools/llvm-reduce/remove-arguments-preserve-bundles.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
; Check that when removing arguments, existing bundles are preserved

; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=arguments --test FileCheck --test-arg --check-prefixes=INTERESTING --test-arg %s --test-arg --input-file %s -o %t
; RUN: FileCheck --check-prefixes=RESULT %s < %t

; INTERESTING-LABEL: @convergent_callee(
define i32 @convergent_callee(i32 %a, i32 %b) convergent {
ret i32 %a
}

; INTERESTING-LABEL: @convergent_callee_decl(
declare i32 @convergent_callee_decl(i32 %a, i32 %b) convergent

; INTERESTING-LABEL: @convergent_caller(
; INTERESTING: call i32
; INTERESTING: call i32

; RESULT-LABEL: define i32 @convergent_caller()
; RESULT: %call0 = call i32 @convergent_callee() [ "convergencectrl"(token %entry.token) ]
; RESULT: %call1 = call i32 @convergent_callee_decl() [ "convergencectrl"(token %entry.token) ]
define i32 @convergent_caller(i32 %x) convergent {
%entry.token = call token @llvm.experimental.convergence.entry()
%call0 = call i32 @convergent_callee(i32 %x, i32 2) [ "convergencectrl"(token %entry.token) ]
%call1 = call i32 @convergent_callee_decl(i32 %x, i32 2) [ "convergencectrl"(token %entry.token) ]
%result = add i32 %call0, %call1
ret i32 %result
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

6 changes: 4 additions & 2 deletions llvm/tools/llvm-reduce/deltas/ReduceArguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ static void replaceFunctionCalls(Function &OldF, Function &NewF,
}
}

// FIXME: Losing bundles
CallInst *NewCI = CallInst::Create(&NewF, Args);
SmallVector<OperandBundleDef, 2> OpBundles;
CI->getOperandBundlesAsDefs(OpBundles);

CallInst *NewCI = CallInst::Create(&NewF, Args, OpBundles);
NewCI->setCallingConv(NewF.getCallingConv());

AttrBuilder CallSiteAttrs(Ctx, CI->getAttributes().getFnAttrs());
Expand Down
Loading