Don't set both readnone and readonly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68833 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index f3021dc..bad7640 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -1654,10 +1654,10 @@
       FuncAttrs |= llvm::Attribute::NoUnwind;
     if (TargetDecl->getAttr<NoReturnAttr>())
       FuncAttrs |= llvm::Attribute::NoReturn;
-    if (TargetDecl->getAttr<PureAttr>())
-      FuncAttrs |= llvm::Attribute::ReadOnly;
     if (TargetDecl->getAttr<ConstAttr>())
       FuncAttrs |= llvm::Attribute::ReadNone;
+    else if (TargetDecl->getAttr<PureAttr>())
+      FuncAttrs |= llvm::Attribute::ReadOnly;
   }
 
   QualType RetTy = FI.getReturnType();