[llvm-commits] [llvm-gcc-4.2] r45045 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Dale Johannesen dalej at apple.com
Sat Dec 15 12:53:39 PST 2007


On Dec 15, 2007, at 2:10 AM, Duncan Sands wrote:

> Hi Dale,
>
>>    // Check for 'readnone' function attribute.
>> -  if (flags & ECF_CONST)
>> +  // Both PURE and CONST will be set if the user applied
>> +  // __attribute__((const)) to a function the compiler
>> +  // knows to be pure, such as log.  A user or (more
>> +  // likely) libm implementor might know their local log
>> +  // is in fact const, so this should be valid (and gcc
>> +  // accepts it).  But llvm IR does not allow both, so
>> +  // set only ReadNone.
>> +  if (flags & ECF_CONST && !(flags & ECF_PURE))
>>      // Since they write the return value through a pointer,
>>      // 'sret' functions cannot be 'readnone'.
>>      if (!ABIConverter.isStructReturn())
>
> if it is marked both pure and const, this logic seems to
> mark it pure in LLVM (i.e. readonly).  It would be better
> to mark it readnone since that's stronger.

Right.  Fixed, thanks.




More information about the llvm-commits mailing list