Skip to content

Commit 0691cc6

Browse files
authored
Deprecate unused --llvm-opts command line argument (#13750)
This option was already essentially ignored is the value of `options.llvm_opts` was written but never read by the compiler driver. The last use of this option was removed back in #11967 but this went unnoticed.
1 parent f5f4ff8 commit 0691cc6

File tree

9 files changed

+9
-59
lines changed

9 files changed

+9
-59
lines changed

ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Current Trunk
2323
- Lists that are passed on the command line can now skip the opening an closing
2424
braces, allowing for simpler, more readable settings. e.g.
2525
`-s EXPORTED_FUNCTIONS=foo,bar`
26+
- Remove/deprecate no longer used `--llvm-opts` command line option. Any
27+
arguments not processed by emcc will be passed through to clang directly
28+
these days.
2629
- Values returned from `sysconf` now more closely match the definitions found in
2730
header files and in upstream musl (#13713).
2831
- `DISABLE_EXCEPTION_CATCHING=2` is now deprecated since it can be inferred from

docs/emcc.txt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -215,26 +215,6 @@ Options that are modified or new in *emcc* are listed below:
215215
happens in "-O2" and above, and when no "-g" option was specified
216216
to prevent minification.
217217

218-
"--llvm-opts <level>"
219-
[compile+link] Enables LLVM optimizations, relevant when we call
220-
the LLVM optimizer (which is done when building source files to
221-
object code). Possible "level" values are:
222-
223-
* "0": No LLVM optimizations (default in -O0).
224-
225-
* "1": LLVM "-O1" optimizations (default in -O1).
226-
227-
* "2": LLVM "-O2" optimizations.
228-
229-
* "3": LLVM "-O3" optimizations (default in -O2+).
230-
231-
You can also specify arbitrary LLVM options, e.g.:
232-
233-
--llvm-opts "['-O3', '-somethingelse']"
234-
235-
You normally don't need to specify this option, as "-O" with an
236-
optimization level will set a good value.
237-
238218
"-flto"
239219
[compile+link] Enables link-time optimizations (LTO).
240220

emcc.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ def __init__(self):
233233
self.profiling_funcs = False
234234
self.tracing = False
235235
self.emit_symbol_map = False
236-
self.llvm_opts = None
237236
self.use_closure_compiler = None
238237
self.closure_args = []
239238
self.js_transform = None
@@ -1010,11 +1009,6 @@ def uniquename(name):
10101009
if options.thread_profiler:
10111010
options.post_js += open(shared.path_from_root('src', 'threadprofiler.js')).read() + '\n'
10121011

1013-
if options.llvm_opts is None:
1014-
options.llvm_opts = LLVM_OPT_LEVEL[shared.Settings.OPT_LEVEL]
1015-
elif type(options.llvm_opts) == int:
1016-
options.llvm_opts = ['-O%d' % options.llvm_opts]
1017-
10181012
if options.memory_init_file is None:
10191013
options.memory_init_file = shared.Settings.OPT_LEVEL >= 2
10201014

@@ -2559,12 +2553,10 @@ def consume_arg_file():
25592553
# Let -O default to -O2, which is what gcc does.
25602554
options.requested_level = arg[2:] or '2'
25612555
if options.requested_level == 's':
2562-
options.llvm_opts = ['-Os']
25632556
options.requested_level = 2
25642557
shared.Settings.SHRINK_LEVEL = 1
25652558
settings_changes.append('INLINING_LIMIT=50')
25662559
elif options.requested_level == 'z':
2567-
options.llvm_opts = ['-Oz']
25682560
options.requested_level = 2
25692561
shared.Settings.SHRINK_LEVEL = 2
25702562
settings_changes.append('INLINING_LIMIT=25')
@@ -2573,7 +2565,7 @@ def consume_arg_file():
25732565
logger.warning('--js-opts ignored when using llvm backend')
25742566
consume_arg()
25752567
elif check_arg('--llvm-opts'):
2576-
options.llvm_opts = parse_value(consume_arg(), expect_list=True)
2568+
diagnostics.warning('deprecated', '--llvm-opts is deprecated. All non-emcc args are passed through to clang.')
25772569
elif arg.startswith('-flto'):
25782570
if '=' in arg:
25792571
shared.Settings.LTO = arg.split('=')[1]

site/source/docs/compiling/Building-Projects.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ However, sometimes you may want slightly different optimizations on certain file
145145
.. note:: Unfortunately each build-system defines its own mechanisms for setting compiler and optimization methods. **You will need to work out the correct approach to set the LLVM optimization flags for your system**.
146146

147147
- Some build systems have a flag like ``./configure --enable-optimize``.
148-
- You can control whether LLVM optimizations are run using ``--llvm-opts N`` where N is an integer in the range 0-3. Sending ``-O2 --llvm-opts 0`` to *emcc* during all compilation stages will disable LLVM optimizations but utilize JavaScript optimizations. This can be useful when debugging a build failure.
149-
150148

151149
JavaScript/WebAssembly optimizations are specified in the final step (sometimes called "link", as that step typically also links together a bunch of files that are all compiled together into one JavaScript/WebAssembly output). For example, to compile with :ref:`-O1 <emcc-O1>`:
152150

site/source/docs/tools_reference/emcc.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -203,23 +203,6 @@ Options that are modified or new in *emcc* are listed below:
203203

204204
.. note:: This is only relevant when :term:`minifying` global names, which happens in ``-O2`` and above, and when no ``-g`` option was specified to prevent minification.
205205

206-
.. _emcc-llvm-opts:
207-
208-
``--llvm-opts <level>``
209-
[compile+link]
210-
Enables LLVM optimizations, relevant when we call the LLVM optimizer (which is done when building source files to object code). Possible ``level`` values are:
211-
212-
- ``0``: No LLVM optimizations (default in -O0).
213-
- ``1``: LLVM ``-O1`` optimizations (default in -O1).
214-
- ``2``: LLVM ``-O2`` optimizations.
215-
- ``3``: LLVM ``-O3`` optimizations (default in -O2+).
216-
217-
You can also specify arbitrary LLVM options, e.g.::
218-
219-
--llvm-opts "['-O3', '-somethingelse']"
220-
221-
You normally don't need to specify this option, as ``-O`` with an optimization level will set a good value.
222-
223206
.. _emcc-lto:
224207

225208
``-flto``

tests/fuzz/23.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,5 +476,5 @@ int main (int argc, char* argv[])
476476
return 0;
477477
}
478478

479-
// /usr/bin/python Dev/emscripten/emcc -O2 --llvm-opts 3 Dev/emscripten/tests/fuzz/temp_fuzzcode29254_.cpp -o Dev/emscripten/tests/fuzz/temp_fuzzcode29254_.js -I Dev/csmith/runtime
479+
// /usr/bin/python Dev/emscripten/emcc -O2 Dev/emscripten/tests/fuzz/temp_fuzzcode29254_.cpp -o Dev/emscripten/tests/fuzz/temp_fuzzcode29254_.js -I Dev/csmith/runtime
480480

tests/fuzz/24.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4808,5 +4808,5 @@ XXX percentage an existing variable is used: 85.1
48084808
********************* end of statistics **********************/
48094809

48104810

4811-
// /usr/bin/python /media/alon/2f9a30d7-6124-42d9-87c5-3c80cb70ec54/home/alon/Dev/emscripten/emcc -O3 --llvm-opts 3 newfail_11275_1.cpp -I /home/alon/Dev/csmith/runtime -s ALLOW_MEMORY_GROWTH=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_WHITELIST='["_main"]'
4811+
// /usr/bin/python /media/alon/2f9a30d7-6124-42d9-87c5-3c80cb70ec54/home/alon/Dev/emscripten/emcc -O3 newfail_11275_1.cpp -I /home/alon/Dev/csmith/runtime -s ALLOW_MEMORY_GROWTH=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_WHITELIST='["_main"]'
48124812

tests/fuzz/csmith_driver.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@
5555
opts = '-Oz'
5656
print('opt level:', opts)
5757

58-
llvm_opts = []
59-
if random.random() < 0.5:
60-
llvm_opts = ['--llvm-opts', str(random.randint(0, 3))]
61-
6258
print('Tried %d, notes: %s' % (tried, notes))
6359
print('1) Generate source')
6460
extra_args = []
@@ -115,7 +111,7 @@
115111

116112
def try_js(args=[]):
117113
shared.try_delete(filename + '.js')
118-
js_args = [shared.EMCC, fullname, '-o', filename + '.js'] + [opts] + llvm_opts + CSMITH_CFLAGS + args + ['-w']
114+
js_args = [shared.EMCC, fullname, '-o', filename + '.js'] + [opts] + CSMITH_CFLAGS + args + ['-w']
119115
if TEST_BINARYEN:
120116
if random.random() < 0.5:
121117
js_args += ['-g']

tests/test_core.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6587,7 +6587,7 @@ def test_demangle_stacks(self, extra_args):
65876587
self.set_setting('DEMANGLE_SUPPORT')
65886588
self.set_setting('ASSERTIONS')
65896589
# ensure function names are preserved
6590-
self.emcc_args += ['--profiling-funcs', '--llvm-opts', '0']
6590+
self.emcc_args += ['--profiling-funcs']
65916591
self.do_core_test('test_demangle_stacks.cpp', assert_returncode=NON_ZERO)
65926592
if not self.has_changed_setting('ASSERTIONS'):
65936593
print('without assertions, the stack is not printed, but a message suggesting assertions is')
@@ -6596,9 +6596,7 @@ def test_demangle_stacks(self, extra_args):
65966596

65976597
def test_demangle_stacks_symbol_map(self):
65986598
self.set_setting('DEMANGLE_SUPPORT')
6599-
if '-O' in str(self.emcc_args) and '-O0' not in self.emcc_args and '-O1' not in self.emcc_args and '-g' not in self.emcc_args:
6600-
self.emcc_args += ['--llvm-opts', '0']
6601-
else:
6599+
if '-O' not in str(self.emcc_args) or '-O0' in self.emcc_args or '-O1' in self.emcc_args or '-g' in self.emcc_args:
66026600
self.skipTest("without opts, we don't emit a symbol map")
66036601
self.emcc_args += ['--emit-symbol-map']
66046602
self.do_runf(test_file('core', 'test_demangle_stacks.cpp'), 'abort', assert_returncode=NON_ZERO)

0 commit comments

Comments
 (0)