[llvm] LLVMContext: add getSyncScopeName() to lookup individual scope name (PR #109484)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 21:31:30 PDT 2024


================
@@ -16142,11 +16142,8 @@ static bool atomicIgnoresDenormalModeOrFPModeIsFTZ(const AtomicRMWInst *RMW) {
 
 static OptimizationRemark emitAtomicRMWLegalRemark(const AtomicRMWInst *RMW) {
   LLVMContext &Ctx = RMW->getContext();
-  SmallVector<StringRef> SSNs;
-  Ctx.getSyncScopeNames(SSNs);
-  StringRef MemScope = SSNs[RMW->getSyncScopeID()].empty()
-                           ? "system"
-                           : SSNs[RMW->getSyncScopeID()];
+  StringRef SS = Ctx.getSyncScopeName(RMW->getSyncScopeID());
----------------
arsenm wrote:

This returns optional, but this is directly using it as StringRef?

FWIW I think having this return an empty StringRef in the unknown cases is a reasonable behavior vs. optional. I would expect unrecognized names to be treated as system

https://github.com/llvm/llvm-project/pull/109484


More information about the llvm-commits mailing list