diff options
author | Alan Baker <alanbaker@google.com> | 2018-01-16 11:15:06 -0500 |
---|---|---|
committer | Alan Baker <alanbaker@google.com> | 2018-01-25 09:42:00 -0800 |
commit | 2e93e806e454e2cfefabf217320038188c6c1fb6 (patch) | |
tree | 056b1c576238a0854942cc734619af5c42c1eebe /tools | |
parent | b2eb8404689a38dfeeb3aad51715bec4b9faf6f2 (diff) |
Initial implementation of if conversion
* Handles simple cases only
* Identifies phis in blocks with two predecessors and attempts to
convert the phi to an select
* does not perform code motion currently so the converted values must
dominate the join point (e.g. can't be defined in the branches)
* limited for now to two predecessors, but can be extended to handle
more cases
* Adding if conversion to -O and -Os
Diffstat (limited to 'tools')
-rw-r--r-- | tools/opt/opt.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index dd5fea63..c007b0ae 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -148,6 +148,8 @@ Options (in lexicographical order): --freeze-spec-const Freeze the values of specialization constants to their default values. + --if-conversion + Convert if-then-else like assignments into OpSelect. --inline-entry-points-exhaustive Exhaustively inline all function calls in entry point call tree functions. Currently does not inline calls to functions with @@ -391,6 +393,8 @@ OptStatus ParseFlags(int argc, const char** argv, Optimizer* optimizer, "error: Expected a string of <spec id>:<default value> pairs."); return {OPT_STOP, 1}; } + } else if (0 == strcmp(cur_arg, "--if-conversion")) { + optimizer->RegisterPass(CreateIfConversionPass()); } else if (0 == strcmp(cur_arg, "--freeze-spec-const")) { optimizer->RegisterPass(CreateFreezeSpecConstantValuePass()); } else if (0 == strcmp(cur_arg, "--inline-entry-points-exhaustive")) { |