r265617 - NFC: use AtomicOrdering isStrongerThan

JF Bastien via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 6 16:37:36 PDT 2016


Author: jfb
Date: Wed Apr  6 18:37:36 2016
New Revision: 265617

URL: http://llvm.org/viewvc/llvm-project?rev=265617&view=rev
Log:
NFC: use AtomicOrdering isStrongerThan

Summary: As discussed in D18775.

Reviewers: jyknight

Differential Revision: http://reviews.llvm.org/D18840

Modified:
    cfe/trunk/lib/CodeGen/CGAtomic.cpp

Modified: cfe/trunk/lib/CodeGen/CGAtomic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGAtomic.cpp?rev=265617&r1=265616&r2=265617&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGAtomic.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGAtomic.cpp Wed Apr  6 18:37:36 2016
@@ -447,8 +447,9 @@ static void emitAtomicCmpXchgFailureSet(
       FailureOrder = llvm::AtomicOrdering::SequentiallyConsistent;
       break;
     }
-    if (FailureOrder >= SuccessOrder) {
-      // Don't assert on undefined behaviour.
+    if (isStrongerThan(FailureOrder, SuccessOrder)) {
+      // Don't assert on undefined behavior "failure argument shall be no
+      // stronger than the success argument".
       FailureOrder =
         llvm::AtomicCmpXchgInst::getStrongestFailureOrdering(SuccessOrder);
     }
@@ -1496,8 +1497,9 @@ AtomicInfo::EmitAtomicCompareExchangeLib
 std::pair<RValue, llvm::Value *> AtomicInfo::EmitAtomicCompareExchange(
     RValue Expected, RValue Desired, llvm::AtomicOrdering Success,
     llvm::AtomicOrdering Failure, bool IsWeak) {
-  if (Failure >= Success)
-    // Don't assert on undefined behavior.
+  if (isStrongerThan(Failure, Success))
+    // Don't assert on undefined behavior "failure argument shall be no stronger
+    // than the success argument".
     Failure = llvm::AtomicCmpXchgInst::getStrongestFailureOrdering(Success);
 
   // Check whether we should use a library call.




More information about the cfe-commits mailing list