[LLVMdev] [RFC] New function attributes for errno-setting functions

Hal Finkel hfinkel at anl.gov
Tue Sep 17 13:45:06 PDT 2013


----- Original Message -----
> On 9/17/2013 2:43 PM, Hal Finkel wrote:
> >
> > That would depend on how this attribute was used; it could only be
> > used by a pass that did actually understand what those side
> > effects were (like the loop vectorizer understanding that, if
> > errno is ignored, then vectorizing cos() is legal). I don't object
> > to making the name generic, but I want to make sure that we're all
> > on the same page regarding what it means.
> 
> In some cases the exact nature of the side effects wouldn't need to
> be
> known.  For example, if the side-effects are known to be ignored, a
> call
> to such a function could be eliminated as dead code.
>

Good point.
 
> 
> Also, the "errno-ignored" or equivalent attribute brings up this
> question:
> given this code
>    x = cos(y);   // assume "errno-ignored"
>    z = global;
> is it safe to infer that "global" is not errno?

Unfortunately, I fear that the answer is no; at least, not without some further target-specific information. In general, any global could be errno. On the other hand, if we know that we're on Darwin, or using glibc, or whatever, then we could likely say something more.

 -Hal

>  In other words,
> could
> this attribute be used to refine alias information with respect to
> errno?
> 
> -K
> 
> 
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by The Linux Foundation
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-dev mailing list