[PATCH] Pass -mglobal-merge as a module flag metadata.

Ahmed Bougacha ahmed.bougacha at gmail.com
Sun Mar 1 16:02:58 PST 2015


On Sun, Mar 1, 2015 at 3:40 PM, Akira Hatanaka <ahatanak at gmail.com> wrote:
> How about the following case:
>
> $ clang foo1.c -S -arch arm64 -o foo1.ll -O3
> $ clang foo2.c -S -arch arm64 -o foo2.ll -mno-global-merge
>
> foo1.ll would get "Enable Global Merge"="true" while foo2.ll would get "Enable Global Merge"="false" and linking the two modules would be an error. Should the linker emit a linked module with "Enable Global Merge"="false" without any errors in this case?
>
> My question is, if -mno-global-merge/-mglobal-merge is provided on the command line, does it mean global-merge pass should be disabled or enabled regardless of what the optimization level is?

Ideally, the explicit flag should override all.  However, I can't
think of a case where it would make sense to put the flag in one place
and not everywhere, so I say this should error, since it has the same
meaning as giving -mglobal-merge for foo1.c and -mno-global-merge for
foo2.c.

But the fact you ask the question makes me think this should be very
explicit in the -m[no-]global-merge flag description:  the fact that
the flag needs to be consistent, and that it is enabled by default in
some situations (say -O3).

-Ahmed

>
> http://reviews.llvm.org/D7968
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>



More information about the cfe-commits mailing list