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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Jan 5 11:34:33 PST 2015


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(...

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...

Maybe as an independent patch we could make all

$foo = comdat any

optional instead?

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm.patch
Type: text/x-patch
Size: 32629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150105/ce38abc9/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang.patch
Type: text/x-patch
Size: 15531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150105/ce38abc9/attachment-0001.bin>


More information about the llvm-commits mailing list