[PATCH] D60587: Add options for MaxLoadsPerMemcmp(OptSize).
Hiroshi Yamauchi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 12 08:04:37 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL358287: Add options for MaxLoadsPerMemcmp(OptSize). (authored by yamauchi, committed by ).
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60587/new/
https://reviews.llvm.org/D60587
Files:
llvm/trunk/lib/CodeGen/ExpandMemCmp.cpp
Index: llvm/trunk/lib/CodeGen/ExpandMemCmp.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/ExpandMemCmp.cpp
+++ llvm/trunk/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.194890.patch
Type: text/x-patch
Size: 1441 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190412/e1be460b/attachment.bin>
More information about the llvm-commits
mailing list