@@ -272,9 +272,17 @@ def new(*args):
272
272
273
273
EXPECTED_LLVM_VERSION = (3 ,2 )
274
274
275
+ actual_clang_version = None
276
+
277
+ def get_clang_version ():
278
+ global actual_clang_version
279
+ if actual_clang_version is None :
280
+ actual_clang_version = Popen ([CLANG , '-v' ], stderr = PIPE ).communicate ()[1 ].split ('\n ' )[0 ].split (' ' )[2 ]
281
+ return actual_clang_version
282
+
275
283
def check_clang_version ():
276
- expected = 'clang version ' + ' .' .join (map (str , EXPECTED_LLVM_VERSION ))
277
- actual = Popen ([ CLANG , '-v' ], stderr = PIPE ). communicate ()[ 1 ]. split ( ' \n ' )[ 0 ]
284
+ expected = '.' .join (map (str , EXPECTED_LLVM_VERSION ))
285
+ actual = get_clang_version ()
278
286
if expected in actual :
279
287
return True
280
288
logging .warning ('LLVM version appears incorrect (seeing "%s", expected "%s")' % (actual , expected ))
@@ -337,10 +345,10 @@ def find_temp_directory():
337
345
# we re-check sanity when the settings are changed)
338
346
# We also re-check sanity and clear the cache when the version changes
339
347
340
- EMSCRIPTEN_VERSION = '1.8.4 '
348
+ EMSCRIPTEN_VERSION = '1.8.5 '
341
349
342
350
def generate_sanity ():
343
- return EMSCRIPTEN_VERSION + '|' + get_llvm_target () + '|' + LLVM_ROOT
351
+ return EMSCRIPTEN_VERSION + '|' + get_llvm_target () + '|' + LLVM_ROOT + '|' + get_clang_version ()
344
352
345
353
def check_sanity (force = False ):
346
354
try :
@@ -842,8 +850,6 @@ class Building:
842
850
COMPILER_TEST_OPTS = [] # For use of the test runner
843
851
JS_ENGINE_OVERRIDE = None # Used to pass the JS engine override from runner.py -> test_benchmark.py
844
852
845
- SAFE_OPT_OPTS = ['-disable-loop-vectorization' , '-disable-slp-vectorization' ] # llvm 3.4
846
-
847
853
@staticmethod
848
854
def get_building_env (native = False ):
849
855
env = os .environ .copy ()
@@ -1165,7 +1171,8 @@ def llvm_opt(filename, opts, out=None):
1165
1171
if type (opts ) is int :
1166
1172
opts = Building .pick_llvm_opts (opts )
1167
1173
#opts += ['-debug-pass=Arguments']
1168
- opts += Building .SAFE_OPT_OPTS
1174
+ if get_clang_version () == '3.4' :
1175
+ opts += ['-disable-loop-vectorization' , '-disable-slp-vectorization' ] # llvm 3.4 has these on by default
1169
1176
logging .debug ('emcc: LLVM opts: ' + str (opts ))
1170
1177
target = out or (filename + '.opt.bc' )
1171
1178
output = Popen ([LLVM_OPT , filename ] + opts + ['-o' , target ], stdout = PIPE ).communicate ()[0 ]
0 commit comments