[PATCH] D107353: [LoopIdiom] let the pass deal with runtime memset size

Yueh-Ting Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 7 09:18:26 PDT 2021


eopXD added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:949
+    LLVM_DEBUG(dbgs() << "  memset size is non-constant\n");
+    if (Pointer->getType()->getPointerAddressSpace() != 0) {
+      LLVM_DEBUG(dbgs() << "  pointer is not in address space zero\n");
----------------
eopXD wrote:
> lebedev.ri wrote:
> > Negative test missing
> `isLegalStore` already blocks non-zero address spaces. So this guard will never trigger and should be deleted.
Added `memset-runtime-debug.ll` - `@NonZeroAddressSpace`.


================
Comment at: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:954
+    if (!SE->isLoopInvariant(MemsetSizeSCEV, CurLoop) ||
+        !SE->isLoopInvariant(StrideSCEV, CurLoop)) {
+      LLVM_DEBUG(dbgs() << "  memset size or stride is not a loop-invariant, "
----------------
eopXD wrote:
> lebedev.ri wrote:
> > Negative test missing
> `isLegalStore` already blocks non-affine SCEV for the pointer in the memset instruction. So this guard will never trigger and should be deleted.
Added `memset-runtime-debug.ll` - `@NonAffinePointer`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107353



More information about the llvm-commits mailing list