summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSteven Perron <stevenperron@google.com>2018-04-16 09:58:00 -0400
committerSteven Perron <stevenperron@google.com>2018-05-18 10:03:46 -0400
commita579e720a8d7805ec9ebf657a4c6fa67ec268f7e (patch)
tree704a59d3c2f2cc71b7dba20073ef2a86528e000a /tools
parentf1f7cc870e13e1ad1eb2f2e757c21aec4276c707 (diff)
Remove the limit on struct size in SROA.
Removes the limit on scalar replacement for the lagalization passes. This is done by adding an option to the pass (and command line option) to set the limit on maximum size of the composite that scalar replacement is willing to divide. Fixes #1494.
Diffstat (limited to 'tools')
-rw-r--r--tools/opt/opt.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 0d965666..38aa36e5 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -292,10 +292,12 @@ Options (in lexicographical order):
--ssa-rewrite
Replace loads and stores to function local variables with
operations on SSA IDs.
- --scalar-replacement
+ --scalar-replacement[=<n>]
Replace aggregate function scope variables that are only accessed
via their elements with new function variables representing each
- element.
+ element. <n> is a limit on the size of the aggragates that will
+ be replaced. 0 means there is no limit. The default value is
+ 100.
--set-spec-const-default-value "<spec id>:<default value> ..."
Set the default values of the specialization constants with
<spec id>:<default value> pairs specified in a double-quoted
@@ -569,6 +571,9 @@ OptStatus ParseFlags(int argc, const char** argv, Optimizer* optimizer,
optimizer->RegisterPass(CreateLoopUnswitchPass());
} else if (0 == strcmp(cur_arg, "--scalar-replacement")) {
optimizer->RegisterPass(CreateScalarReplacementPass());
+ } else if (0 == strncmp(cur_arg, "--scalar-replacement=", 21)) {
+ uint32_t limit = atoi(cur_arg + 21);
+ optimizer->RegisterPass(CreateScalarReplacementPass(limit));
} else if (0 == strcmp(cur_arg, "--strength-reduction")) {
optimizer->RegisterPass(CreateStrengthReductionPass());
} else if (0 == strcmp(cur_arg, "--unify-const")) {