[PATCH] D58738: [SelectionDAG] Strengthen assertions about usage of AtomicSDNodes

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 27 20:07:35 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL355069: [SelectionDAG] Strengthen assertions about usage of AtomicSDNodes (authored by reames, committed by ).
Herald added a project: LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D58738?vs=188620&id=188665#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58738/new/

https://reviews.llvm.org/D58738

Files:
  llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h


Index: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
===================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -1385,7 +1385,10 @@
 public:
   AtomicSDNode(unsigned Opc, unsigned Order, const DebugLoc &dl, SDVTList VTL,
                EVT MemVT, MachineMemOperand *MMO)
-      : MemSDNode(Opc, Order, dl, VTL, MemVT, MMO) {}
+    : MemSDNode(Opc, Order, dl, VTL, MemVT, MMO) {
+    assert(((Opc != ISD::ATOMIC_LOAD && Opc != ISD::ATOMIC_STORE) ||
+            MMO->isAtomic()) && "then why are we using an AtomicSDNode?");
+  }
 
   const SDValue &getBasePtr() const { return getOperand(1); }
   const SDValue &getVal() const { return getOperand(2); }
@@ -2138,6 +2141,8 @@
       : MemSDNode(NodeTy, Order, dl, VTs, MemVT, MMO) {
     LSBaseSDNodeBits.AddressingMode = AM;
     assert(getAddressingMode() == AM && "Value truncated");
+    assert((!MMO->isAtomic() || MMO->isVolatile()) &&
+           "use an AtomicSDNode instead for non-volatile atomics");
   }
 
   const SDValue &getOffset() const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58738.188665.patch
Type: text/x-patch
Size: 1136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190228/ab1e976d/attachment.bin>


More information about the llvm-commits mailing list