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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 13 10:17:22 PDT 2021


lebedev.ri added a comment.

Thank you, i think this is about right for this chunk.



================
Comment at: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:930-934
+    // Reject memsets that are so large that they overflow an unsigned.
+    LLVM_DEBUG(dbgs() << "  memset size is constant\n");
+    uint64_t SizeInBytes = cast<ConstantInt>(MSI->getLength())->getZExtValue();
+    if ((SizeInBytes >> 32) != 0)
+      return false;
----------------
Since non-constant case has to deal with this problem also, i suspect this should go away


================
Comment at: llvm/test/Transforms/LoopIdiom/memset-runtime-debug.ll:3
+; REQUIRES: asserts
+; RUN: opt < %s -S -debug -passes=loop-idiom -debug-only=loop-idiom -disable-output 2>&1 | FileCheck %s
+; The C code to generate this testcase:
----------------
It's not great that we don't check what the IR is.
At the very least i think you want `FileCheck --implicit-check-not=memset %s`


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