[cfe-dev] conditional operator

Daniel Dunbar daniel.dunbar at gmail.com
Tue Jul 20 16:24:32 PDT 2010


This is by design, generating a select requires analyzing the operands
in the ?: operator to determine whether they have side effects. We
generally prefer to leave those kinds of optimizations to the backend,
unless there is a clear compile time opportunity.

 - Daniel


On Jul 20, 2010, at 7:39, Jochen Wilhelmy <j.wilhelmy at arcor.de> wrote:

> Hi!
>
> when using something like
> (a < b) ? a : b
>
> I would expect that the select instruction is always used.
> But, if a or b are a global variable, a real branch with multiple
> basic blocks is created. Is this a bug or a feature?
>
> -Jochen
>
> _______________________________________________
> 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