]> granicus.if.org Git - llvm/commitdiff
[Hexagon, SystemZ] Be super conservative about atomics
authorPhilip Reames <listmail@philipreames.com>
Sun, 24 Feb 2019 00:45:09 +0000 (00:45 +0000)
committerPhilip Reames <listmail@philipreames.com>
Sun, 24 Feb 2019 00:45:09 +0000 (00:45 +0000)
As requested during review of D57601, be equally conservative for atomic MMOs as for volatile MMOs in all in tree backends. At the moment, all atomic MMOs are also volatile, but I'm about to change that.

Reviewed as part of https://reviews.llvm.org/D58490, with other backends still pending review.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354740 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Hexagon/HexagonExpandCondsets.cpp
lib/Target/Hexagon/HexagonFrameLowering.cpp
lib/Target/Hexagon/HexagonSplitDouble.cpp
lib/Target/SystemZ/SystemZInstrInfo.cpp

index 2531d790e58e8a296a2bc58dbda6667a0ea64957..c343e426ac7de855192b81ffc74c8db7a3baa81c 100644 (file)
@@ -733,7 +733,7 @@ bool HexagonExpandCondsets::isPredicable(MachineInstr *MI) {
     HasDef = true;
   }
   for (auto &Mo : MI->memoperands())
-    if (Mo->isVolatile())
+    if (Mo->isVolatile() || Mo->isAtomic())
       return false;
   return true;
 }
index 4a47231ddd82ba3a86e7ade635a91ee77feb4cee..1a9ca4e040fdc944a8d65972d4c4c4c529b74a75 100644 (file)
@@ -2101,7 +2101,7 @@ void HexagonFrameLowering::optimizeSpillSlots(MachineFunction &MF,
         }
         if (!Bad) {
           for (auto *Mo : In.memoperands()) {
-            if (!Mo->isVolatile())
+            if (!Mo->isVolatile() && !Mo->isAtomic())
               continue;
             Bad = true;
             break;
index e9a4a0733dbc2e1e920a2e798a4a2fd37838556f..013eede2d414ced3ed4297164d85de6ef33d1c7e 100644 (file)
@@ -152,8 +152,8 @@ bool HexagonSplitDoubleRegs::isInduction(unsigned Reg, LoopRegMap &IRM) const {
 }
 
 bool HexagonSplitDoubleRegs::isVolatileInstr(const MachineInstr *MI) const {
-  for (auto &I : MI->memoperands())
-    if (I->isVolatile())
+  for (auto &MO : MI->memoperands())
+    if (MO->isVolatile() || MO->isAtomic())
       return true;
   return false;
 }
index 3a1747ca1e5cb3c8e3cdd232432e6934fcc664e3..cb963a10010ccd7a64d5d44f2ae116622b4ab652 100644 (file)
@@ -1188,7 +1188,7 @@ MachineInstr *SystemZInstrInfo::foldMemoryOperandImpl(
   // MVCs that turn out to be redundant.
   if (OpNum == 0 && MI.hasOneMemOperand()) {
     MachineMemOperand *MMO = *MI.memoperands_begin();
-    if (MMO->getSize() == Size && !MMO->isVolatile()) {
+    if (MMO->getSize() == Size && !MMO->isVolatile() && !MMO->isAtomic()) {
       // Handle conversion of loads.
       if (isSimpleBD12Move(&MI, SystemZII::SimpleBDXLoad)) {
         return BuildMI(*InsertPt->getParent(), InsertPt, MI.getDebugLoc(),