[CGStmt] Use helper functions to set memory attributes (NFC)
authorNikita Popov <npopov@redhat.com>
Wed, 12 Oct 2022 12:34:03 +0000 (14:34 +0200)
committerNikita Popov <npopov@redhat.com>
Wed, 12 Oct 2022 14:38:39 +0000 (16:38 +0200)
clang/lib/CodeGen/CGStmt.cpp

index ebbc79c..30c955b 100644 (file)
@@ -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.