[clang] 01bbe87 - [CGStmt] Use helper functions to set memory attributes (NFC)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 12 07:38:52 PDT 2022


Author: Nikita Popov
Date: 2022-10-12T16:38:39+02:00
New Revision: 01bbe87fbb66cad9193c97843b0dd20aa2bd24ae

URL: https://github.com/llvm/llvm-project/commit/01bbe87fbb66cad9193c97843b0dd20aa2bd24ae
DIFF: https://github.com/llvm/llvm-project/commit/01bbe87fbb66cad9193c97843b0dd20aa2bd24ae.diff

LOG: [CGStmt] Use helper functions to set memory attributes (NFC)

Added: 
    

Modified: 
    clang/lib/CodeGen/CGStmt.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index ebbc79cc8b4b6..30c955b3d43fd 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -2280,9 +2280,9 @@ static void UpdateAsmCallInst(llvm::CallBase &Result, bool HasSideEffect,
   // Attach readnone and readonly attributes.
   if (!HasSideEffect) {
     if (ReadNone)
-      Result.addFnAttr(llvm::Attribute::ReadNone);
+      Result.setDoesNotAccessMemory();
     else if (ReadOnly)
-      Result.addFnAttr(llvm::Attribute::ReadOnly);
+      Result.setOnlyReadsMemory();
   }
 
   // Add elementtype attribute for indirect constraints.


        


More information about the cfe-commits mailing list