[cfe-dev] conditional operator

Chris Lattner clattner at apple.com
Tue Jul 20 08:26:57 PDT 2010


On Jul 20, 2010, at 7:39 AM, Jochen Wilhelmy 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?

It's a feature.  It is up to the optimizer to form the select.  If a or b is volatile (or if they are other expressions with side effects), the transformation is invalid.

-Chris



More information about the cfe-dev mailing list