summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp2
-rw-r--r--llvm/test/Transforms/CodeExtractor/PartialInlineVarArg.ll23
2 files changed, 24 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index 5b4b45a69b4..9ad59315c32 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -1843,7 +1843,7 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
// Collect attributes for non-vararg parameters.
AttributeList Attrs = CI->getAttributes();
SmallVector<AttributeSet, 8> ArgAttrs;
- if (!Attrs.isEmpty()) {
+ if (!Attrs.isEmpty() || !VarArgsAttrs.empty()) {
for (unsigned ArgNo = 0;
ArgNo < CI->getFunctionType()->getNumParams(); ++ArgNo)
ArgAttrs.push_back(Attrs.getParamAttributes(ArgNo));
diff --git a/llvm/test/Transforms/CodeExtractor/PartialInlineVarArg.ll b/llvm/test/Transforms/CodeExtractor/PartialInlineVarArg.ll
index 415eb9ba175..fec37711fd9 100644
--- a/llvm/test/Transforms/CodeExtractor/PartialInlineVarArg.ll
+++ b/llvm/test/Transforms/CodeExtractor/PartialInlineVarArg.ll
@@ -81,3 +81,26 @@ bb:
%res = tail call i32 (i32, ...) @vararg_not_legal(i32 %arg, i32 %arg)
ret i32 %res
}
+
+declare i32* @err(i32*)
+
+define signext i32 @vararg2(i32 * %l, ...) {
+entry:
+ br i1 undef, label %cleanup, label %cond.end
+
+cond.end: ; preds = %entry
+ %call51 = call i32* @err(i32* nonnull %l)
+ unreachable
+
+cleanup: ; preds = %entry
+ ret i32 0
+}
+
+define i32* @caller_with_signext(i32* %foo) {
+entry:
+ %call1 = tail call signext i32 (i32*, ...) @varargs2(i32* %foo, i32 signext 8)
+ unreachable
+}
+; CHECK-LABEL: @caller_with_signext
+; CHECK: codeRepl.i:
+; CHECK-NEXT: call void (i32*, ...) @callee.1_cond.end(i32* %foo, i32 signext 8)
OpenPOWER on IntegriCloud