From 02bf06e293b1f6eebc23c3b8fcb75ebd85c92e11 Mon Sep 17 00:00:00 2001 From: Peizhao Ou Date: Tue, 17 Jul 2018 12:07:00 -0700 Subject: [PATCH] Ensures non-acquire RMWs are transformed to acquire RMWs --- lib/CodeGen/AtomicExpandPass.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/CodeGen/AtomicExpandPass.cpp b/lib/CodeGen/AtomicExpandPass.cpp index 6152055a5bc..8665551bb75 100644 --- a/lib/CodeGen/AtomicExpandPass.cpp +++ b/lib/CodeGen/AtomicExpandPass.cpp @@ -131,6 +131,15 @@ bool AtomicExpand::runOnFunction(Function &F) { } break; } + case Instruction::AtomicRMW: { + auto* RMW = dyn_cast(&*I); + if (RMW->getOrdering() == Monotonic) { + RMW->setOrdering(Acquire); + } else if (RMW->getOrdering() == Release) { + RMW->setOrdering(AcquireRelease); + } + break; + } default: { break; } -- 2.34.1