From 89625a62f21d41da8701aa9ed4e526b3b34949f0 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Sun, 24 Feb 2019 00:45:09 +0000 Subject: [PATCH] [Hexagon, SystemZ] Be super conservative about atomics 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 | 2 +- lib/Target/Hexagon/HexagonFrameLowering.cpp | 2 +- lib/Target/Hexagon/HexagonSplitDouble.cpp | 4 ++-- lib/Target/SystemZ/SystemZInstrInfo.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Target/Hexagon/HexagonExpandCondsets.cpp b/lib/Target/Hexagon/HexagonExpandCondsets.cpp index 2531d790e58..c343e426ac7 100644 --- a/lib/Target/Hexagon/HexagonExpandCondsets.cpp +++ b/lib/Target/Hexagon/HexagonExpandCondsets.cpp @@ -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; } diff --git a/lib/Target/Hexagon/HexagonFrameLowering.cpp b/lib/Target/Hexagon/HexagonFrameLowering.cpp index 4a47231ddd8..1a9ca4e040f 100644 --- a/lib/Target/Hexagon/HexagonFrameLowering.cpp +++ b/lib/Target/Hexagon/HexagonFrameLowering.cpp @@ -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; diff --git a/lib/Target/Hexagon/HexagonSplitDouble.cpp b/lib/Target/Hexagon/HexagonSplitDouble.cpp index e9a4a0733db..013eede2d41 100644 --- a/lib/Target/Hexagon/HexagonSplitDouble.cpp +++ b/lib/Target/Hexagon/HexagonSplitDouble.cpp @@ -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; } diff --git a/lib/Target/SystemZ/SystemZInstrInfo.cpp b/lib/Target/SystemZ/SystemZInstrInfo.cpp index 3a1747ca1e5..cb963a10010 100644 --- a/lib/Target/SystemZ/SystemZInstrInfo.cpp +++ b/lib/Target/SystemZ/SystemZInstrInfo.cpp @@ -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(), -- 2.50.1