This is an archive of the discontinued LLVM Phabricator instance.

Declare that musttail calls in variadic functions forward the ellipsis
ClosedPublic

Authored by rnk on Aug 13 2014, 5:39 PM.

Details

Summary

There is no functionality change here except in the way we assemble and
dump musttail calls in variadic functions. There's really no need to
separate out the bits for musttail and "is forwarding varargs" on call
instructions. A musttail call by definition has to forward the ellipsis
or it would fail verification.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk updated this revision to Diff 12474.Aug 13 2014, 5:39 PM
rnk retitled this revision from to Declare that musttail calls in variadic functions forward the ellipsis.
rnk updated this object.
rnk added reviewers: chandlerc, nlewycky.
rnk added a subscriber: Unknown Object (MLST).
nlewycky edited edge metadata.Aug 25 2014, 5:04 PM

I'm concerned that there's no Verifier change. It looks like you don't need one, which means that we failed at code review previously since there was code that was valid but we couldn't print or parse? Or is there a verifier change missing?

docs/LangRef.rst
6539–6541 ↗(On Diff #12474)

"The callee must be varargs iff the caller is varargs"?

rnk added a comment.Aug 25 2014, 5:10 PM
In D4892#5, @nlewycky wrote:

I'm concerned that there's no Verifier change. It looks like you don't need one, which means that we failed at code review previously since there was code that was valid but we couldn't print or parse? Or is there a verifier change missing?

We already have the check for this rule. I think you were the one who asked me to add it:

Assert1(CallerTy->isVarArg() == CalleeTy->isVarArg(),
        "cannot guarantee tail call due to mismatched varargs", &CI);
docs/LangRef.rst
6539–6541 ↗(On Diff #12474)

sure

rnk updated this revision to Diff 12925.Aug 25 2014, 5:15 PM
rnk edited edge metadata.
  • Use iff
nlewycky accepted this revision.Aug 25 2014, 5:16 PM
nlewycky edited edge metadata.

I haven't audited the codebase looking for places that assume that variadic callees must be passing in a discrete list of args, but every place I can think of (DAE, argpromotion, ipsccp) either skips varargs functions entirely or doesn't try to reason about the varargs part. Should be fine.

This revision is now accepted and ready to land.Aug 25 2014, 5:16 PM
rnk added a comment.Aug 25 2014, 5:42 PM
In D4892#9, @nlewycky wrote:

I haven't audited the codebase looking for places that assume that variadic callees must be passing in a discrete list of args, but every place I can think of (DAE, argpromotion, ipsccp) either skips varargs functions entirely or doesn't try to reason about the varargs part. Should be fine.

I see a problem in DAE, actually. I'll handle that in a separate commit. The test case for that feature is based on grep and needs work.

rnk closed this revision.Aug 25 2014, 5:42 PM
rnk updated this revision to Diff 12926.

Closed by commit rL216423 (authored by @rnk).