[LLVMdev] Broke my tail (call)

Dan Gohman
Tue, 24 Feb 2009 20:05:52 -0000

On Feb 24, 2009, at 2:50 AM, Jon Harrop wrote:

> On Monday 23 February 2009 16:14:57 Arnold Schwaighofer wrote:
>>
>>
>> So the current situation is that tail calls on functions that
>> return a
>> struct are not optimized (as you correctly observed ;). Sorry.
>
> Thanks for the clarification. That makes a lot more sense!
>
> LLVM's support for structs is wonderful but I don't think they can
be
> called "first-class structs" until all such arbitrary
restrictions
> have been
> removed, even though the workaround (using sret form) is trivial in
> this
> case.

"first-class" in this context means "Values can have this
type", not
"everything that anyone might want is supported in all backends."

A meta issue is that LLVM IR differs from many virtual machine ISAs in
that it's more of a language for expressing programs than a
specification
of what some particular machine can actually execute.  When a
particular LLVM component doesn't support a particular aspect of the
language, it's considered a bug in the component, and not necessarily
considered a problem in the language.

This arrangement is convenient for people developing LLVM itself,
because new language features can be added without the requirement
that all backends and execution engines support all features in full
generality, which isn't always immediately useful, and sometimes not
even meaningful.  However, it's inconvenient for people using LLVM,
because there's no complete list of which features are actually
supported on any given backend.  Some features that are commonly
unsupported are now mentioned LangRef.html, though it's certainly
not complete.

One way this issue might be addressed is with an LLVM IR
conformance test suite.  Covering the whole language would be a
big project, but the work could be done incrementally.  I wonder if
people would be interested in working on this.

> Shall I file this as a bug against LLVM?

Yes, thanks.

Dan