llvm.org GIT mirror llvm / d0f9a4c
[InlineFunction] Set arg attrs even if there only are VarArg attrs. When using the partial inliner, we might have attributes for forwarded varargs, but the CodeExtractor does not create an empty argument attribute set for regular arguments in that case, because it does not know of the additional arguments. So in case we have attributes for VarArgs, we also have to make sure we create (empty) attributes for all regular arguments. This fixes PR36210. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324197 91177308-0d34-0410-b5e6-96231b3b80d8 Florian Hahn 1 year, 7 months ago
2 changed file(s) with 24 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
18421842 // Collect attributes for non-vararg parameters.
18431843 AttributeList Attrs = CI->getAttributes();
18441844 SmallVector ArgAttrs;
1845 if (!Attrs.isEmpty()) {
1845 if (!Attrs.isEmpty() || !VarArgsAttrs.empty()) {
18461846 for (unsigned ArgNo = 0;
18471847 ArgNo < CI->getFunctionType()->getNumParams(); ++ArgNo)
18481848 ArgAttrs.push_back(Attrs.getParamAttributes(ArgNo));
8080 %res = tail call i32 (i32, ...) @vararg_not_legal(i32 %arg, i32 %arg)
8181 ret i32 %res
8282 }
83
84 declare i32* @err(i32*)
85
86 define signext i32 @vararg2(i32 * %l, ...) {
87 entry:
88 br i1 undef, label %cleanup, label %cond.end
89
90 cond.end: ; preds = %entry
91 %call51 = call i32* @err(i32* nonnull %l)
92 unreachable
93
94 cleanup: ; preds = %entry
95 ret i32 0
96 }
97
98 define i32* @caller_with_signext(i32* %foo) {
99 entry:
100 %call1 = tail call signext i32 (i32*, ...) @varargs2(i32* %foo, i32 signext 8)
101 unreachable
102 }
103 ; CHECK-LABEL: @caller_with_signext
104 ; CHECK: codeRepl.i:
105 ; CHECK-NEXT: call void (i32*, ...) @callee.1_cond.end(i32* %foo, i32 signext 8)