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

Dale Johannesen dalej at apple.com
Fri Dec 14 15:17:26 PST 2007


Author: johannes
Date: Fri Dec 14 17:17:25 2007
New Revision: 45045

URL: http://llvm.org/viewvc/llvm-project?rev=45045&view=rev
Log:
Fix a testsuite bug, described in comments.


Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=45045&r1=45044&r2=45045&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Fri Dec 14 17:17:25 2007
@@ -1068,7 +1068,14 @@
     RAttributes |= ParamAttr::NoUnwind;
 
   // 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())





More information about the llvm-commits mailing list