[llvm] a9ea11b - [aarch64][NFC] Remove unneeded work from machine memset (#65672)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 14:12:09 PDT 2023


Author: Nathan Sidwell
Date: 2023-09-25T17:12:05-04:00
New Revision: a9ea11b694c17a5f94077036f8bb5d21ea922863

URL: https://github.com/llvm/llvm-project/commit/a9ea11b694c17a5f94077036f8bb5d21ea922863
DIFF: https://github.com/llvm/llvm-project/commit/a9ea11b694c17a5f94077036f8bb5d21ea922863.diff

LOG: [aarch64][NFC] Remove unneeded work from machine memset (#65672)

The memset intrinsics have no source pointer, so don't construct that
operand.

Added: 
    

Modified: 
    llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.cpp b/llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.cpp
index 677797a6797bb69..10d2e768cb29abe 100644
--- a/llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.cpp
@@ -46,21 +46,16 @@ SDValue AArch64SelectionDAGInfo::EmitMOPS(AArch64ISD::NodeType SDOpcode,
     }
   }();
 
-  MachineMemOperand::Flags Flags = MachineMemOperand::MOStore;
-  if (isVolatile)
-    Flags |= MachineMemOperand::MOVolatile;
-  if (!IsSet)
-    Flags |= MachineMemOperand::MOLoad;
-
   MachineFunction &MF = DAG.getMachineFunction();
 
+  auto Vol =
+      isVolatile ? MachineMemOperand::MOVolatile : MachineMemOperand::MONone;
+  auto DstFlags = MachineMemOperand::MOStore | Vol;
   auto *DstOp =
-      MF.getMachineMemOperand(DstPtrInfo, Flags, ConstSize, Alignment);
-  auto *SrcOp =
-      MF.getMachineMemOperand(SrcPtrInfo, Flags, ConstSize, Alignment);
+      MF.getMachineMemOperand(DstPtrInfo, DstFlags, ConstSize, Alignment);
 
   if (IsSet) {
-    // Extend value to i64 if required
+    // Extend value to i64, if required.
     if (SrcOrValue.getValueType() != MVT::i64)
       SrcOrValue = DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, SrcOrValue);
     SDValue Ops[] = {Dst, Size, SrcOrValue, Chain};
@@ -72,6 +67,10 @@ SDValue AArch64SelectionDAGInfo::EmitMOPS(AArch64ISD::NodeType SDOpcode,
     SDValue Ops[] = {Dst, SrcOrValue, Size, Chain};
     const EVT ResultTys[] = {MVT::i64, MVT::i64, MVT::i64, MVT::Other};
     MachineSDNode *Node = DAG.getMachineNode(MachineOpcode, DL, ResultTys, Ops);
+
+    auto SrcFlags = MachineMemOperand::MOLoad | Vol;
+    auto *SrcOp =
+        MF.getMachineMemOperand(SrcPtrInfo, SrcFlags, ConstSize, Alignment);
     DAG.setNodeMemRefs(Node, {DstOp, SrcOp});
     return SDValue(Node, 3);
   }


        


More information about the llvm-commits mailing list