[LLVMdev] [RFC] New function attributes for errno-setting functions
hfinkel at anl.gov
Tue Sep 17 12:43:51 PDT 2013
----- Original Message -----
> On 9/12/2013 7:44 PM, Hal Finkel wrote:
> > 1. 'writes-only-errno'
> > 2. 'errno-ignored'
> Do we really need the first one? We already know which standard
> functions could potentially set errno, and we know which standard
> functions don't modify any other storage (other than that which is
> passed via parameters). I think it's safe to assume that standard
> functions can be recognized by name, since the standard prohibits
> objects to use a predefined name.
I agree that we could put a list into LLVM instead of adding attributes in the frontend. We need to be a little careful that -fno-builtin is passed to the backend in this case.
> We could have an attribute like "side-effects-ignored" indicating
> whatever modifications the given function makes, nobody will read
> (at least not without an intervening store). This would include
> but could also be used in more general contexts.
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.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by The Linux Foundation
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
More information about the llvm-dev