update to llvm 3.4 ; 1.27.1
This commit is contained in:
Родитель
8a70c782a3
Коммит
308d916b9d
3
emcc
3
emcc
|
@ -912,6 +912,9 @@ try:
|
||||||
fastcomp_opts += ['-emscripten-asyncify-functions=' + ','.join(shared.Settings.ASYNCIFY_FUNCTIONS)]
|
fastcomp_opts += ['-emscripten-asyncify-functions=' + ','.join(shared.Settings.ASYNCIFY_FUNCTIONS)]
|
||||||
fastcomp_opts += ['-emscripten-asyncify-whitelist=' + ','.join(shared.Settings.ASYNCIFY_WHITELIST)]
|
fastcomp_opts += ['-emscripten-asyncify-whitelist=' + ','.join(shared.Settings.ASYNCIFY_WHITELIST)]
|
||||||
|
|
||||||
|
else: # non-fastcomp
|
||||||
|
logging.warning('Using old (non-fastcomp) compiler due to EMCC_FAST_COMPILER=0 in the env. This is dangerous, as there are known bugs, and this code path is no longer maintained. Please use emscripten in the default configuration (i.e., do not disable fastcomp)')
|
||||||
|
|
||||||
if shared.Settings.ASM_JS:
|
if shared.Settings.ASM_JS:
|
||||||
assert opt_level >= 1 or fastcomp, 'asm.js requires -O1 or above'
|
assert opt_level >= 1 or fastcomp, 'asm.js requires -O1 or above'
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
1.26.1
|
1.27.1
|
||||||
|
|
||||||
|
|
|
@ -1104,7 +1104,7 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
|
||||||
'splat', 'swizzle', 'shuffle',
|
'splat', 'swizzle', 'shuffle',
|
||||||
'withX', 'withY', 'withZ', 'withW',
|
'withX', 'withY', 'withZ', 'withW',
|
||||||
'load', 'store']
|
'load', 'store']
|
||||||
simdfloatfuncs = simdfuncs + ['mul', 'div', 'min', 'max', 'sqrt',
|
simdfloatfuncs = simdfuncs + ['mul', 'div', 'min', 'max', 'sqrt', 'neg',
|
||||||
'fromInt32x4', 'fromInt32x4Bits',
|
'fromInt32x4', 'fromInt32x4Bits',
|
||||||
'notEqual', 'lessThanOrEqual', 'greaterThanOrEqual'];
|
'notEqual', 'lessThanOrEqual', 'greaterThanOrEqual'];
|
||||||
simdintfuncs = simdfuncs + ['fromFloat32x4', 'fromFloat32x4Bits'];
|
simdintfuncs = simdfuncs + ['fromFloat32x4', 'fromFloat32x4Bits'];
|
||||||
|
|
|
@ -4970,20 +4970,11 @@ int main(void) {
|
||||||
|
|
||||||
def test_fannkuch(self):
|
def test_fannkuch(self):
|
||||||
if Settings.USE_TYPED_ARRAYS != 2: return self.skip('musl libc needs ta2')
|
if Settings.USE_TYPED_ARRAYS != 2: return self.skip('musl libc needs ta2')
|
||||||
try:
|
if os.environ.get('EMCC_FAST_COMPILER') == '0': return self.skip('needs fastcomp')
|
||||||
if self.run_name == 'slow2' or self.run_name == 'slow2asm':
|
results = [ (1,0), (2,1), (3,2), (4,4), (5,7), (6,10), (7, 16), (8,22) ]
|
||||||
old_target = os.environ.get('EMCC_LLVM_TARGET') or ''
|
for i, j in results:
|
||||||
os.environ['EMCC_LLVM_TARGET'] = "asmjs-unknown-emscripten" # testing for asm-emscripten target on non-fastcomp
|
src = open(path_from_root('tests', 'fannkuch.cpp'), 'r').read()
|
||||||
results = [ (1,0), (2,1), (3,2), (4,4), (5,7), (6,10), (7, 16), (8,22) ]
|
self.do_run(src, 'Pfannkuchen(%d) = %d.' % (i,j), [str(i)], no_build=i>1)
|
||||||
for i, j in results:
|
|
||||||
src = open(path_from_root('tests', 'fannkuch.cpp'), 'r').read()
|
|
||||||
self.do_run(src, 'Pfannkuchen(%d) = %d.' % (i,j), [str(i)], no_build=i>1)
|
|
||||||
finally:
|
|
||||||
if self.run_name == 'slow2' or self.run_name == 'slow2asm':
|
|
||||||
if old_target:
|
|
||||||
os.environ['EMCC_LLVM_TARGET'] = old_target
|
|
||||||
else:
|
|
||||||
del os.environ['EMCC_LLVM_TARGET']
|
|
||||||
|
|
||||||
def test_raytrace(self):
|
def test_raytrace(self):
|
||||||
if self.emcc_args is None: return self.skip('requires emcc')
|
if self.emcc_args is None: return self.skip('requires emcc')
|
||||||
|
@ -5359,6 +5350,7 @@ def process(filename):
|
||||||
# gcc -O3 -I/home/alon/Dev/emscripten/tests/sqlite -ldl src.c
|
# gcc -O3 -I/home/alon/Dev/emscripten/tests/sqlite -ldl src.c
|
||||||
if self.emcc_args is None: return self.skip('Very slow without ta2, and we would also need to include dlmalloc manually without emcc')
|
if self.emcc_args is None: return self.skip('Very slow without ta2, and we would also need to include dlmalloc manually without emcc')
|
||||||
if not self.is_emscripten_abi(): return self.skip('fails on x86 due to a legalization issue on llvm 3.3')
|
if not self.is_emscripten_abi(): return self.skip('fails on x86 due to a legalization issue on llvm 3.3')
|
||||||
|
if os.environ.get('EMCC_FAST_COMPILER') == '0': return self.skip('requires fastcomp')
|
||||||
if Settings.QUANTUM_SIZE == 1: return self.skip('TODO FIXME')
|
if Settings.QUANTUM_SIZE == 1: return self.skip('TODO FIXME')
|
||||||
self.banned_js_engines = [NODE_JS] # OOM in older node
|
self.banned_js_engines = [NODE_JS] # OOM in older node
|
||||||
if '-O' not in str(self.emcc_args):
|
if '-O' not in str(self.emcc_args):
|
||||||
|
@ -5746,7 +5738,10 @@ def process(filename):
|
||||||
'18.cpp', '15.c', '21.c'
|
'18.cpp', '15.c', '21.c'
|
||||||
]: continue # works only in fastcomp
|
]: continue # works only in fastcomp
|
||||||
if x == 'lto' and self.run_name == 'default' and os.path.basename(name) in [
|
if x == 'lto' and self.run_name == 'default' and os.path.basename(name) in [
|
||||||
'19.c'
|
'19.c', '18.cpp'
|
||||||
|
]: continue # LLVM LTO bug
|
||||||
|
if x == 'lto' and os.path.basename(name) in [
|
||||||
|
'21.c'
|
||||||
]: continue # LLVM LTO bug
|
]: continue # LLVM LTO bug
|
||||||
|
|
||||||
print name
|
print name
|
||||||
|
@ -6777,6 +6772,7 @@ def process(filename):
|
||||||
if Settings.USE_TYPED_ARRAYS != 2: return self.skip("doesn't pass without typed arrays")
|
if Settings.USE_TYPED_ARRAYS != 2: return self.skip("doesn't pass without typed arrays")
|
||||||
if '-g4' not in Building.COMPILER_TEST_OPTS: Building.COMPILER_TEST_OPTS.append('-g4')
|
if '-g4' not in Building.COMPILER_TEST_OPTS: Building.COMPILER_TEST_OPTS.append('-g4')
|
||||||
if NODE_JS not in JS_ENGINES: return self.skip('sourcemapper requires Node to run')
|
if NODE_JS not in JS_ENGINES: return self.skip('sourcemapper requires Node to run')
|
||||||
|
if os.environ.get('EMCC_FAST_COMPILER') == '0': return self.skip('requires fastcomp')
|
||||||
|
|
||||||
src = '''
|
src = '''
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -2374,19 +2374,8 @@ int main()
|
||||||
self.assertContained('File size: 724', out)
|
self.assertContained('File size: 724', out)
|
||||||
|
|
||||||
def test_simd(self):
|
def test_simd(self):
|
||||||
if get_clang_version() == '3.2':
|
assert get_clang_version() == '3.4'
|
||||||
simd_args = ['-O3', '-vectorize', '-vectorize-loops']
|
Popen([PYTHON, EMCC, path_from_root('tests', 'linpack.c'), '-O2', '-s', 'SIMD=1', '-DSP', '-s', 'PRECISE_F32=1']).communicate()
|
||||||
elif get_clang_version() == '3.3':
|
|
||||||
simd_args = ['-O3', '-vectorize-loops', '-vectorize-slp-aggressive', '-bb-vectorize-aligned-only'] # XXX this generates <2 x float> , '-vectorize-slp']
|
|
||||||
elif get_clang_version() == '3.4':
|
|
||||||
simd_args = ['-O3'] # vectorization on by default, SIMD=1 makes us not disable it
|
|
||||||
else:
|
|
||||||
raise Exception('unknown llvm version')
|
|
||||||
|
|
||||||
simd_args += ['-bb-vectorize-vector-bits=128', '-force-vector-width=4']
|
|
||||||
|
|
||||||
self.clear()
|
|
||||||
Popen([PYTHON, EMCC, path_from_root('tests', 'linpack.c'), '-O2', '-s', 'SIMD=1', '-DSP', '--llvm-opts', str(simd_args), '-s', 'PRECISE_F32=1']).communicate()
|
|
||||||
self.assertContained('Unrolled Single Precision', run_js('a.out.js'))
|
self.assertContained('Unrolled Single Precision', run_js('a.out.js'))
|
||||||
|
|
||||||
def test_dependency_file(self):
|
def test_dependency_file(self):
|
||||||
|
@ -2612,7 +2601,7 @@ int main(int argc, char **argv) {
|
||||||
exit = 1-no_exit
|
exit = 1-no_exit
|
||||||
assert 'coming around' in output
|
assert 'coming around' in output
|
||||||
assert ('going away' in output) == exit, 'destructors should not run if no exit'
|
assert ('going away' in output) == exit, 'destructors should not run if no exit'
|
||||||
assert ('_ZN5WasteILi2EED1Ev' in src) == exit, 'destructors should not appear if no exit'
|
assert ('_ZN5WasteILi2EED' in src) == exit, 'destructors should not appear if no exit'
|
||||||
assert ('atexit(' in src) == exit, 'atexit should not appear or be called'
|
assert ('atexit(' in src) == exit, 'atexit should not appear or be called'
|
||||||
|
|
||||||
def test_os_oz(self):
|
def test_os_oz(self):
|
||||||
|
@ -3529,7 +3518,7 @@ main()
|
||||||
''')
|
''')
|
||||||
Popen([PYTHON, EMCC, 'src.cpp', '-O2', '-s', 'SAFE_HEAP=1']).communicate()
|
Popen([PYTHON, EMCC, 'src.cpp', '-O2', '-s', 'SAFE_HEAP=1']).communicate()
|
||||||
assert os.path.exists('a.out.js') # build should succeed
|
assert os.path.exists('a.out.js') # build should succeed
|
||||||
self.assertContained('segmentation fault loading 4 bytes from address 0', run_js('a.out.js', assert_returncode=None, stderr=PIPE)) # program should segfault
|
self.assertContained(('trap!', 'segmentation fault loading 4 bytes from address 0'), run_js('a.out.js', assert_returncode=None, stderr=PIPE)) # program should segfault
|
||||||
|
|
||||||
def test_only_force_stdlibs(self):
|
def test_only_force_stdlibs(self):
|
||||||
def test(name):
|
def test(name):
|
||||||
|
|
|
@ -450,17 +450,6 @@ fi
|
||||||
assert os.stat(os.path.join(EMCC_CACHE, libname + '.bc')).st_size > 1000000, 'libc++ is big'
|
assert os.stat(os.path.join(EMCC_CACHE, libname + '.bc')).st_size > 1000000, 'libc++ is big'
|
||||||
assert os.stat(basebc_name).st_size > 1000000, 'libc++ is indeed big'
|
assert os.stat(basebc_name).st_size > 1000000, 'libc++ is indeed big'
|
||||||
assert os.stat(dcebc_name).st_size < os.stat(basebc_name).st_size*0.666, 'Dead code elimination must remove most of libc++'
|
assert os.stat(dcebc_name).st_size < os.stat(basebc_name).st_size*0.666, 'Dead code elimination must remove most of libc++'
|
||||||
# should only have metadata in -O0, not 1 and 2
|
|
||||||
if i > 0:
|
|
||||||
ll = None
|
|
||||||
for ll_name in ll_names:
|
|
||||||
if os.path.exists(ll_name):
|
|
||||||
check_call([LLVM_DIS, ll_name, '-o', ll_name + '.ll'])
|
|
||||||
ll = open(ll_name + '.ll').read()
|
|
||||||
break
|
|
||||||
assert ll
|
|
||||||
print 'metas:', ll.count('\n!')
|
|
||||||
assert ll.count('\n!') < 25 # a few lines are left even in -O1 and -O2
|
|
||||||
finally:
|
finally:
|
||||||
del os.environ['EMCC_DEBUG']
|
del os.environ['EMCC_DEBUG']
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ if EM_POPEN_WORKAROUND and os.name == 'nt':
|
||||||
|
|
||||||
# Expectations
|
# Expectations
|
||||||
|
|
||||||
EXPECTED_LLVM_VERSION = (3,3)
|
EXPECTED_LLVM_VERSION = (3,4)
|
||||||
|
|
||||||
actual_clang_version = None
|
actual_clang_version = None
|
||||||
|
|
||||||
|
@ -1385,8 +1385,12 @@ class Building:
|
||||||
if type(opts) is int:
|
if type(opts) is int:
|
||||||
opts = Building.pick_llvm_opts(opts)
|
opts = Building.pick_llvm_opts(opts)
|
||||||
#opts += ['-debug-pass=Arguments']
|
#opts += ['-debug-pass=Arguments']
|
||||||
if get_clang_version() == '3.4' and not Settings.SIMD:
|
if get_clang_version() >= '3.4':
|
||||||
opts += ['-disable-loop-vectorization', '-disable-slp-vectorization'] # llvm 3.4 has these on by default
|
if not Settings.SIMD:
|
||||||
|
opts += ['-disable-vectorize']
|
||||||
|
else:
|
||||||
|
opts += ['-bb-vectorize-vector-bits=128', '-force-vector-width=4']
|
||||||
|
|
||||||
logging.debug('emcc: LLVM opts: ' + ' '.join(opts))
|
logging.debug('emcc: LLVM opts: ' + ' '.join(opts))
|
||||||
target = out or (filename + '.opt.bc')
|
target = out or (filename + '.opt.bc')
|
||||||
output = Popen([LLVM_OPT, filename] + opts + ['-o', target], stdout=PIPE).communicate()[0]
|
output = Popen([LLVM_OPT, filename] + opts + ['-o', target], stdout=PIPE).communicate()[0]
|
||||||
|
|
Загрузка…
Ссылка в новой задаче