[PATCH] D24833: [LoopDataPrefetch/AArch64] Allow selective prefetching of symbolic strided accesses
Balaram Makam via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 23 11:18:30 PDT 2016
bmakam added inline comments.
================
Comment at: lib/Transforms/Scalar/LoopDataPrefetch.cpp:178-201
@@ -163,1 +177,26 @@
+bool LoopDataPrefetch::isSymbolicStride(const SCEV *V, Loop *L) {
+ const auto *M = dyn_cast<SCEVMulExpr>(V);
+ if (!M)
+ return false;
+ // Check if the step value is a non-unit constant.
+ V = M->getOperand(0);
+ if (V->getSCEVType() != scConstant)
+ return false;
+
+ if (V->isOne() || V->isAllOnesValue())
+ return false;
+
+ V = M->getOperand(1);
+
+ // Strip off casts.
+ while (const auto *C = dyn_cast<SCEVCastExpr>(V))
+ V = C->getOperand();
+
+ const auto *U = dyn_cast<SCEVUnknown>(V);
+ if (!U)
+ return false;
+
+ return (L->isLoopInvariant(U->getValue()));
+}
+
----------------
mssimpso wrote:
> Would it be possible to reuse llvm::getStrideFromPointer instead of re-implementing some of the logic here?
It seems like llvm::getStrideFromPointer is not suitable for reuse here, especially it somehow assumes that the PtrAccessSize is always 1 and returns null when PtrAccessSize != StepVal. For all the interesting cases this scheme targets the stepval is a non-unit constant.
https://reviews.llvm.org/D24833
More information about the llvm-commits
mailing list