[PATCH] D60587: Add options for MaxLoadsPerMemcmp(OptSize).
Hiroshi Yamauchi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 11 14:36:26 PDT 2019
yamauchi created this revision.
yamauchi added a reviewer: davidxl.
Herald added a project: LLVM.
Repository:
rL LLVM
https://reviews.llvm.org/D60587
Files:
lib/CodeGen/ExpandMemCmp.cpp
Index: lib/CodeGen/ExpandMemCmp.cpp
===================================================================
--- lib/CodeGen/ExpandMemCmp.cpp
+++ lib/CodeGen/ExpandMemCmp.cpp
@@ -36,6 +36,14 @@
cl::desc("The number of loads per basic block for inline expansion of "
"memcmp that is only being compared against zero."));
+static cl::opt<unsigned> MaxLoadsPerMemcmp(
+ "max-loads-per-memcmp", cl::Hidden,
+ cl::desc("Set maximum number of loads used in expanded memcmp"));
+
+static cl::opt<unsigned> MaxLoadsPerMemcmpOptSize(
+ "max-loads-per-memcmp-opt-size", cl::Hidden,
+ cl::desc("Set maximum number of loads used in expanded memcmp for -Os/Oz"));
+
namespace {
@@ -741,8 +749,13 @@
const auto *const Options = TTI->enableMemCmpExpansion(IsUsedForZeroCmp);
if (!Options) return false;
- const unsigned MaxNumLoads =
- TLI->getMaxExpandSizeMemcmp(CI->getFunction()->hasOptSize());
+ const unsigned MaxNumLoads = CI->getFunction()->hasOptSize()
+ ? (MaxLoadsPerMemcmpOptSize.getNumOccurrences()
+ ? MaxLoadsPerMemcmpOptSize
+ : TLI->getMaxExpandSizeMemcmp(true))
+ : (MaxLoadsPerMemcmp.getNumOccurrences()
+ ? MaxLoadsPerMemcmp
+ : TLI->getMaxExpandSizeMemcmp(false));
unsigned NumLoadsPerBlock = MemCmpEqZeroNumLoadsPerBlock.getNumOccurrences()
? MemCmpEqZeroNumLoadsPerBlock
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60587.194764.patch
Type: text/x-patch
Size: 1408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190411/9ff8e25c/attachment.bin>
More information about the llvm-commits
mailing list