================
@@ -4608,6 +4614,38 @@ bool AArch64DAGToDAGISel::SelectCMP_SWAP(SDNode *N) {
   return true;
 }
 
+AArch64AtomicStoreHint
+AArch64DAGToDAGISel::decodeAtomicHintFlags(MachineMemOperand *MMO) const {
+  int AtomicHint = -1;
+  const MDNode *MemCacheHint = MMO->getMemCacheHint();
+  if (!MemCacheHint)
+    return AArch64AtomicStoreHint::HINT_NONE;
+
+  for (unsigned I = 0; I + 1 < MemCacheHint->getNumOperands(); I += 2) {
+    const auto *Key = cast<MDString>(MemCacheHint->getOperand(I));
+    StringRef KeyStr = Key->getString();
+    const Metadata *Val = MemCacheHint->getOperand(I + 1).get();
+
+    if (KeyStr != "aarch64.atomic_hint")
+      continue;
+
+    AtomicHint = cast<ConstantInt>(cast<ConstantAsMetadata>(Val)->getValue())
+                     ->getZExtValue();
----------------
Lukacma wrote:

```suggestion
    if ((MemCacheHint->getOperand(I)).equalsStr("aarch64.atomic_hint")){
      const Metadata *Val = MemCacheHint->getOperand(I + 1).get();
      AtomicHint = cast<ConstantInt>(cast<ConstantAsMetadata>(Val)->getValue())
                      ->getZExtValue();
    }
```

Maybe rewriting it like this will be neater.

https://github.com/llvm/llvm-project/pull/198316
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to