[PATCH] D58490: Be super conservative about atomics in various backends

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 23 16:46:46 PST 2019


reames updated this revision to Diff 188065.
reames added a comment.

Rebase after landing SystemZ and Hexagon portions which had been previously LGTMed.

ping to ARM and Lanai maintainers


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58490/new/

https://reviews.llvm.org/D58490

Files:
  lib/Target/ARM/ARMLoadStoreOptimizer.cpp
  lib/Target/Lanai/LanaiMemAluCombiner.cpp


Index: lib/Target/Lanai/LanaiMemAluCombiner.cpp
===================================================================
--- lib/Target/Lanai/LanaiMemAluCombiner.cpp
+++ lib/Target/Lanai/LanaiMemAluCombiner.cpp
@@ -158,7 +158,8 @@
   const MachineMemOperand *MemOperand = *MI.memoperands_begin();
 
   // Don't move volatile memory accesses
-  if (MemOperand->isVolatile())
+  // TODO: unclear if we need to be as conservative about atomics
+  if (MemOperand->isVolatile() || MemOperand->isAtomic())
     return false;
 
   return true;
Index: lib/Target/ARM/ARMLoadStoreOptimizer.cpp
===================================================================
--- lib/Target/ARM/ARMLoadStoreOptimizer.cpp
+++ lib/Target/ARM/ARMLoadStoreOptimizer.cpp
@@ -1580,7 +1580,8 @@
   const MachineMemOperand &MMO = **MI.memoperands_begin();
 
   // Don't touch volatile memory accesses - we may be changing their order.
-  if (MMO.isVolatile())
+  // TODO: Unclear whether we need to be as defense about atomic operations.
+  if (MMO.isVolatile() || MMO.isAtomic())
     return false;
 
   // Unaligned ldr/str is emulated by some kernels, but unaligned ldm/stm is
@@ -2144,7 +2145,8 @@
   // At the moment, we ignore the memoryoperand's value.
   // If we want to use AliasAnalysis, we should check it accordingly.
   if (!Op0->hasOneMemOperand() ||
-      (*Op0->memoperands_begin())->isVolatile())
+      (*Op0->memoperands_begin())->isVolatile() ||
+      (*Op0->memoperands_begin())->isAtomic())
     return false;
 
   unsigned Align = (*Op0->memoperands_begin())->getAlignment();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58490.188065.patch
Type: text/x-patch
Size: 1566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190224/ad368278/attachment.bin>


More information about the llvm-commits mailing list