[PATCH] D5226: [Polly] Support memory intrinsics

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 12:21:22 PST 2016


Meinersbur added a subscriber: Meinersbur.
Meinersbur added a comment.

I don't see that the copied' size gets evaluated apart from checking that it's affine.

Does the following work as expected?

  float A[128][128], B[128];
  for (int i = 0; i < 128; i+=1)
    memcpy(A[i], B, 128*sizeof(float));


================
Comment at: include/polly/Support/ScopHelper.h:224
@@ -198,1 +223,3 @@
+    if (isMemIntrinsic())
+      return !asMemIntrinsic()->isVolatile();
     llvm_unreachable("Operation not supported on nullptr");
----------------
Maybe add a comment explaining this?

I guess this is taken from LoadInst/StoreInst implementation of isUnordered() with getOrdering() returning NotAtomic.

================
Comment at: lib/Analysis/ScopDetection.cpp:38
@@ -39,1 +37,3 @@
+// Function calls and intrinsics that do not have side effects (readnone)
+// or of which the memory effects are known and representable are allowed.
 //
----------------
Can you be more specific: memset, memcpy, memmove are allowed?

================
Comment at: lib/Analysis/ScopInfo.cpp:306
@@ -305,1 +305,3 @@
 
+  auto *BB = getStatement()->getParent()->getRegion().getEntry();
+  auto &DL = BB->getModule()->getDataLayout();
----------------
LLVM coding style suggests to use auto only in specific cases. Eg. where the type already appears on the right side or the type is already abstracted away.

If you keep auto, the asterisk is superfluous.

================
Comment at: test/ScopInfo/memcpy.ll:16
@@ +15,3 @@
+; CHECK-NEXT:                { Stmt_for_body3[i0, i1] -> MemRef_A[o0] : -16 <= o0 <= 20 };
+; CHECK-NEXT:            MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
+; CHECK-NEXT:                { Stmt_for_body3[i0, i1] -> MemRef_B[o0] : 64 <= o0 <= 100 };
----------------
Shouldn't this be a ReadAccess? This look like memcpy write two locations instead of reading one, writing the other.

================
Comment at: test/ScopInfo/memmove.ll:16
@@ +15,3 @@
+; CHECK-NEXT:                { Stmt_for_body3[i0, i1] -> MemRef_A[o0] : -16 <= o0 <= 15 };
+; CHECK-NEXT:            MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
+; CHECK-NEXT:                { Stmt_for_body3[i0, i1] -> MemRef_B[o0] : 64 <= o0 <= 95 };
----------------
dito


http://reviews.llvm.org/D5226





More information about the llvm-commits mailing list