[PATCH] D118443: Add support for atomic memory copy lowering

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 30 06:32:07 PDT 2022


arsenm added inline comments.


================
Comment at: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h:716
+    Type *OpType = Type::getIntNTy(Context, OpSizeInBytes * 8);
+    for (unsigned i = 0; i != RemainingBytes; i+= OpSizeInBytes)
+      OpsOut.push_back(OpType);
----------------
Bot is right, missing space before +=


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h:138
                                   unsigned SrcAddrSpace, unsigned DestAddrSpace,
-                                  unsigned SrcAlign, unsigned DestAlign) const;
-
-  void getMemcpyLoopResidualLoweringType(SmallVectorImpl<Type *> &OpsOut,
-                                         LLVMContext &Context,
-                                         unsigned RemainingBytes,
-                                         unsigned SrcAddrSpace,
-                                         unsigned DestAddrSpace,
-                                         unsigned SrcAlign,
-                                         unsigned DestAlign) const;
+                                  unsigned SrcAlign, unsigned DestAlign,
+                                  Optional<uint32_t> AtomicElementSize) const;
----------------
We should probably move these to use Align (separate patch)


================
Comment at: llvm/lib/Transforms/Utils/LowerMemIntrinsics.cpp:260
 
-  if (!LoopOpIsInt8) {
-   // Add in the
-   Value *RuntimeResidual = PLBuilder.CreateURem(CopyLen, CILoopOpSize);
-   Value *RuntimeBytesCopied = PLBuilder.CreateSub(CopyLen, RuntimeResidual);
+  bool requiresResidal =
+      !LoopOpIsInt8 && !(AtomicElementSize && LoopOpSize == AtomicElementSize);
----------------
Typo s/Residal/Residual


================
Comment at: llvm/lib/Transforms/Utils/LowerMemIntrinsics.cpp:307
+    Value *SrcAsResLoopOpType = ResBuilder.CreateBitCast(
+        SrcAddr, PointerType::get(ResLoopOpType, SrcAS));
+    Value *DstAsResLoopOpType = ResBuilder.CreateBitCast(
----------------
Might as well make this opaque pointer friendly with getWithSamePointeeType


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118443



More information about the llvm-commits mailing list