From 70d156991ca425b2c472935e144e98ce205c666c Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Thu, 14 Mar 2019 17:20:59 +0000 Subject: Allow code motion (and thus folding) for atomic (but unordered) memory operands Building on the work done in D57601, now that we can distinguish between atomic and volatile memory accesses, go ahead and allow code motion of unordered atomics. As seen in the diffs, this allows much better folding of memory operations into using instructions. (Mostly done by the PeepholeOpt pass.) Note: I have not reviewed all callers of hasOrderedMemoryRef since one of them - isSafeToMove - is very widely used. I'm relying on the documented semantics of each method to judge correctness. Differential Revision: https://reviews.llvm.org/D59345 llvm-svn: 356170 --- llvm/lib/CodeGen/MachineInstr.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 95f5eb91ee1..17bd0f38964 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -1291,10 +1291,8 @@ bool MachineInstr::hasOrderedMemoryRef() const { return true; // Check if any of our memory operands are ordered. - // TODO: This should probably be be isUnordered (see D57601), but the callers - // need audited and test cases written to be sure. return llvm::any_of(memoperands(), [](const MachineMemOperand *MMO) { - return MMO->isVolatile() || MMO->isAtomic(); + return !MMO->isUnordered(); }); } -- cgit v1.2.3