[cfe-dev] -fmerge-all-constants enabled by default (PR18538)

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Jan 21 14:05:50 PST 2014


The behavior in clang was added in r85991 by Tanya.

Before we had unnamed_addr llvm used to merge every constant, so this
might be vestigial. Having said that, it is a bit surprising to see a
memcpy in

int g(const unsigned *p);
void f() {
  const unsigned foo[] = {1, 2, 3, 4};
  g(foo);
}

So I think we should introduce a warning for it if we are to change the default.


On 21 January 2014 16:14, Richard Smith <richard at metafoo.co.uk> wrote:
> Hi!
>
> The non-conforming optimization -fmerge-all-constants is currently enabled
> by default. That seems surprising, and against our usual approach of trying
> to be correct by default. Is there some code for which this is critically
> important (perhaps without it, the stack usage at -O0 is unacceptable)?
>
> Can we turn this off by default, or failing that, document very prominently
> that we're not conforming, and explain why? (I'm happy to update the
> documentation if someone can provide a good reason for the behavior.)
>
> Thanks!
> Richard
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>



More information about the cfe-dev mailing list