[PATCH] D22249: Get rid of bool parameters in SelectionDAG::getLoad, getStore, and friends.

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 18:14:28 PDT 2016


chandlerc added a comment.

Looked at all the target-independent stuff so far.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:14129-14131
@@ -14149,2 +14128,5 @@
     unsigned Alignment = std::min(LLD->getAlignment(), RLD->getAlignment());
+    unsigned MMOFlags =
+        (LLD->getMemOperand()->getFlags() & ~MachineMemOperand::MOInvariant) |
+        (isInvariant ? MachineMemOperand::MOInvariant : 0);
     if (LLD->getExtensionType() == ISD::NON_EXTLOAD) {
----------------
I feel like this would be more clear as:

  unsigned MMOFlags = LLD->getMemOperand()->getFlags();
  if (!RLD->isInvariant())
    MMOFlags &= ~MachineMemOperand::MOInvariant;

Or something like that.

================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4381
@@ -4382,2 +4380,3 @@
 
+  const unsigned MMOFlags = isVol ? MachineMemOperand::MOVolatile : 0;
   SmallVector<SDValue, 8> OutChains;
----------------
An enum for zero would be nice here.

================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:3536-3538
@@ -3536,5 +3535,5 @@
                             &Flags);
-    SDValue L = DAG.getLoad(ValueVTs[i], dl, Root,
-                            A, MachinePointerInfo(SV, Offsets[i]), isVolatile,
-                            isNonTemporal, isInvariant, Alignment, AAInfo,
-                            Ranges);
+    unsigned MMOFlags = (isVolatile ? MachineMemOperand::MOVolatile : 0) |
+                        (isNonTemporal ? MachineMemOperand::MONonTemporal : 0) |
+                        (isInvariant ? MachineMemOperand::MOInvariant : 0);
+    SDValue L = DAG.getLoad(ValueVTs[i], dl, Root, A,
----------------
Yuck. Better way to do this maybe?

================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:3658-3662
@@ -3658,2 +3657,7 @@
   unsigned Alignment = I.getAlignment();
+  const unsigned MMOFlags =
+      (I.isVolatile() ? MachineMemOperand::MOVolatile : 0) |
+      (I.getMetadata(LLVMContext::MD_nontemporal) != nullptr
+           ? MachineMemOperand::MONonTemporal
+           : 0);
   SDLoc dl = getCurSDLoc();
----------------
I think separate statements with |= would be easier to read here than the big expression.


http://reviews.llvm.org/D22249





More information about the llvm-commits mailing list