[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 14:12:08 PST 2019


reames updated this revision to Diff 188620.
reames added a comment.

I somehow uploaded entirely the wrong patch... oops.


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

https://reviews.llvm.org/D58738

Files:
  include/llvm/CodeGen/SelectionDAGNodes.h


Index: include/llvm/CodeGen/SelectionDAGNodes.h
===================================================================
--- include/llvm/CodeGen/SelectionDAGNodes.h
+++ 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.188620.patch
Type: text/x-patch
Size: 1103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190227/6669b6a5/attachment.bin>


More information about the llvm-commits mailing list