[patch] Change the .ll syntax for comdats and add a syntactic sugar

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Jan 5 19:51:59 PST 2015


> On 2015 Jan 5, at 11:34, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
> 
> In order to make comdats always explicit in the IR, we decided to make
> the syntax a bit more compact for the case o a GlobalObject in a
> comdat with the same name.
> 
> Just dropping the $name causes problems for
> 
> @foo = globabl i32 0, comdat
> $bar = comdat ...
> 
> and
> 
> declare void @foo() comdat
> $bar = comdat ...
> 
> so the attached patch changes the syntax to
> 
> @foo = comdat $foo global i32 0
> 
> and
> 
> declare comdat $foo void @foo
> 
> and as a syntactic sugar
> 
> $foo = comdat ...
> @foo = comdat global ...
> 
> is now equivalent to
> 
> $foo = comdat ...
> @foo = comdat $foo global ...
> 
> and
> 
> $foo = comdat ...
> declare comdat void @foo(...
> 
> is now equivalent to
> 
> $foo = comdat ...
> declare comdat $foo void @foo(...

This SGTM.

> It would be possible to take this one step further and make
> 
> @foo = comdat global ...
> 
> equivalent to
> 
> $foo = comdat any
> @foo = comdat $foo global ...
> 
> but it is not clear if that is worth it. It would require rejecting things like
> 
> $foo = comdat largest
> @foo = comdat global...

I think this behaviour would be confusing.

> Maybe as an independent patch we could make all
> 
> $foo = comdat any
> 
> optional instead?

Sounds reasonable to me...

> 
> Cheers,
> Rafael
> <llvm.patch><clang.patch>

(Haven't had a chance to look at the patches, will do tomorrow if no one
beats me to it.)







More information about the llvm-commits mailing list