From 1446d22751cd78af0a93f3872574f968ee936cb0 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 6 Jan 2014 11:40:40 -0800 Subject: [PATCH 1/5] ignore new readonly attribute in llvm 3.4 --- src/parseTools.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parseTools.js b/src/parseTools.js index 1e680fd09be18..655248b339c87 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -462,7 +462,7 @@ function parseParamTokens(params) { // handle 'byval' and 'byval align X'. We store the alignment in 'byVal' byVal = QUANTUM_SIZE; segment.splice(1, 1); - if (segment[1] && segment[1].text === 'nocapture') { + if (segment[1] && (segment[1].text === 'nocapture' || segment[1].text === 'readonly')) { segment.splice(1, 1); } if (segment[1] && segment[1].text === 'align') { @@ -471,7 +471,7 @@ function parseParamTokens(params) { segment.splice(1, 2); } } - if (segment[1] && segment[1].text === 'nocapture') { + if (segment[1] && (segment[1].text === 'nocapture' || segment[1].text === 'readonly')) { segment.splice(1, 1); } if (segment.length == 1) { From 72291a246855c9d3cb3dd8f8ccd0cf513f91442c Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 6 Jan 2014 13:37:34 -0800 Subject: [PATCH 2/5] refactor vector disabling code --- tools/shared.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/shared.py b/tools/shared.py index 90618a97493b8..39488ef27fb23 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -842,6 +842,8 @@ class Building: COMPILER_TEST_OPTS = [] # For use of the test runner JS_ENGINE_OVERRIDE = None # Used to pass the JS engine override from runner.py -> test_benchmark.py + SAFE_OPT_OPTS = ['-disable-loop-vectorization', '-disable-slp-vectorization'] # llvm 3.4 + @staticmethod def get_building_env(native=False): env = os.environ.copy() @@ -1163,7 +1165,7 @@ def llvm_opt(filename, opts, out=None): if type(opts) is int: opts = Building.pick_llvm_opts(opts) #opts += ['-debug-pass=Arguments'] - opts += ['-disable-loop-vectorization', '-disable-slp-vectorization'] + opts += Building.SAFE_OPT_OPTS logging.debug('emcc: LLVM opts: ' + str(opts)) target = out or (filename + '.opt.bc') output = Popen([LLVM_OPT, filename] + opts + ['-o', target], stdout=PIPE).communicate()[0] From c6839090999bf0e70104f35c1b935d5ab3189c50 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 6 Jan 2014 13:38:25 -0800 Subject: [PATCH 3/5] apply EMMAKEN_CFLAGS directly to commandline, not just to clang calls, so that we can parse it in emcc and e.g. disable vectorization as necessary --- emcc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emcc b/emcc index bad118cd0f9a2..45f160396a9f7 100755 --- a/emcc +++ b/emcc @@ -687,7 +687,7 @@ if os.environ.get('EMMAKEN_CXX'): CC_ADDITIONAL_ARGS = shared.COMPILER_OPTS EMMAKEN_CFLAGS = os.environ.get('EMMAKEN_CFLAGS') -if EMMAKEN_CFLAGS: CC_ADDITIONAL_ARGS += shlex.split(EMMAKEN_CFLAGS) +if EMMAKEN_CFLAGS: sys.argv += shlex.split(EMMAKEN_CFLAGS) # ---------------- Utilities --------------- From 77544113ae019c2e797754cabc0b704d4182c90b Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 6 Jan 2014 13:53:58 -0800 Subject: [PATCH 4/5] fix poppler configure for clang 3.4 --- tests/poppler/configure | 4 ++-- tests/poppler/configure.ac | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/poppler/configure b/tests/poppler/configure index 75813bc9b77d1..ab650a3096ced 100755 --- a/tests/poppler/configure +++ b/tests/poppler/configure @@ -23051,12 +23051,12 @@ if test "x$GCC" != xyes; then fi case "$enable_compile_warnings" in no) ;; - yes) CXXFLAGS="-Wall -Wno-write-strings -Woverloaded-virtual -Wnon-virtual-dtor -Wcast-align -fno-exceptions -fno-check-new -fno-common $CXXFLAGS" ;; + yes) CXXFLAGS="-Wall -Wno-write-strings -Woverloaded-virtual -Wnon-virtual-dtor -Wcast-align -fno-exceptions -fno-common $CXXFLAGS" ;; kde) CXXFLAGS="-Wnon-virtual-dtor -Wno-long-long -Wundef \ -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -Wcast-align \ -Wconversion -Wall -W -Wpointer-arith \ -Wwrite-strings -O2 -Wformat-security \ - -Wmissing-format-attribute -fno-exceptions -fno-check-new \ + -Wmissing-format-attribute -fno-exceptions \ -fno-common $CXXFLAGS" ;; esac diff --git a/tests/poppler/configure.ac b/tests/poppler/configure.ac index f1217c8e8321a..e492fe4b45854 100644 --- a/tests/poppler/configure.ac +++ b/tests/poppler/configure.ac @@ -610,12 +610,12 @@ if test "x$GCC" != xyes; then fi case "$enable_compile_warnings" in no) ;; - yes) CXXFLAGS="-Wall -Wno-write-strings -Woverloaded-virtual -Wnon-virtual-dtor -Wcast-align -fno-exceptions -fno-check-new -fno-common $CXXFLAGS" ;; + yes) CXXFLAGS="-Wall -Wno-write-strings -Woverloaded-virtual -Wnon-virtual-dtor -Wcast-align -fno-exceptions -fno-common $CXXFLAGS" ;; kde) CXXFLAGS="-Wnon-virtual-dtor -Wno-long-long -Wundef \ -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -Wcast-align \ -Wconversion -Wall -W -Wpointer-arith \ -Wwrite-strings -O2 -Wformat-security \ - -Wmissing-format-attribute -fno-exceptions -fno-check-new \ + -Wmissing-format-attribute -fno-exceptions \ -fno-common $CXXFLAGS" ;; esac From ce66f8d6b703184353d88f015fddc3a96250bf05 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 6 Jan 2014 14:17:58 -0800 Subject: [PATCH 5/5] check clang version before applying version-specific changes, like disabling vectorization in llvm 3.4 --- tools/shared.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tools/shared.py b/tools/shared.py index 39488ef27fb23..11fc7fb7481c6 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -272,9 +272,17 @@ def new(*args): EXPECTED_LLVM_VERSION = (3,2) +actual_clang_version = None + +def get_clang_version(): + global actual_clang_version + if actual_clang_version is None: + actual_clang_version = Popen([CLANG, '-v'], stderr=PIPE).communicate()[1].split('\n')[0].split(' ')[2] + return actual_clang_version + def check_clang_version(): - expected = 'clang version ' + '.'.join(map(str, EXPECTED_LLVM_VERSION)) - actual = Popen([CLANG, '-v'], stderr=PIPE).communicate()[1].split('\n')[0] + expected = '.'.join(map(str, EXPECTED_LLVM_VERSION)) + actual = get_clang_version() if expected in actual: return True logging.warning('LLVM version appears incorrect (seeing "%s", expected "%s")' % (actual, expected)) @@ -337,10 +345,10 @@ def find_temp_directory(): # we re-check sanity when the settings are changed) # We also re-check sanity and clear the cache when the version changes -EMSCRIPTEN_VERSION = '1.8.4' +EMSCRIPTEN_VERSION = '1.8.5' def generate_sanity(): - return EMSCRIPTEN_VERSION + '|' + get_llvm_target() + '|' + LLVM_ROOT + return EMSCRIPTEN_VERSION + '|' + get_llvm_target() + '|' + LLVM_ROOT + '|' + get_clang_version() def check_sanity(force=False): try: @@ -842,8 +850,6 @@ class Building: COMPILER_TEST_OPTS = [] # For use of the test runner JS_ENGINE_OVERRIDE = None # Used to pass the JS engine override from runner.py -> test_benchmark.py - SAFE_OPT_OPTS = ['-disable-loop-vectorization', '-disable-slp-vectorization'] # llvm 3.4 - @staticmethod def get_building_env(native=False): env = os.environ.copy() @@ -1165,7 +1171,8 @@ def llvm_opt(filename, opts, out=None): if type(opts) is int: opts = Building.pick_llvm_opts(opts) #opts += ['-debug-pass=Arguments'] - opts += Building.SAFE_OPT_OPTS + if get_clang_version() == '3.4': + opts += ['-disable-loop-vectorization', '-disable-slp-vectorization'] # llvm 3.4 has these on by default logging.debug('emcc: LLVM opts: ' + str(opts)) target = out or (filename + '.opt.bc') output = Popen([LLVM_OPT, filename] + opts + ['-o', target], stdout=PIPE).communicate()[0]