[llvm-commits] [llvm-gcc-4.2] r45045 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Duncan Sands
baldrick at free.fr
Sat Dec 15 02:10:06 PST 2007
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.
Ciao,
D.
More information about the llvm-commits
mailing list