diff options
98 files changed, 292 insertions, 146 deletions
@@ -129,4 +129,5 @@ a license to everyone to use it as detailed in LICENSE.) * Haneef Mubarak <haneef503@gmail.com> * Nicolas Peri <nicox@shivaengine.com> (copyright owned by ShiVa Technologies, SAS) * Bernhard Fey <e-male@web.de> +* Dave Nicponski <dave.nicponski@gmail.com> diff --git a/CONTRIBUTING.markdown b/CONTRIBUTING.md index ceea8735..c068eb7f 100644 --- a/CONTRIBUTING.markdown +++ b/CONTRIBUTING.md @@ -1,5 +1,6 @@ +Contributing +============ See our wiki for information about contributing to Emscripten: [Contribution section on wiki](https://github.com/kripken/emscripten/wiki#contributing) - diff --git a/README.markdown b/README.markdown deleted file mode 100644 index 81a95141..00000000 --- a/README.markdown +++ /dev/null @@ -1,14 +0,0 @@ - - - -Emscripten -========== - -Emscripten is an LLVM-to-JavaScript compiler. It takes LLVM bitcode - which can be generated from C/C++, using llvm-gcc or clang, or any other language that can be converted into LLVM - and compiles that into JavaScript, which can be run on the web (or anywhere else JavaScript can run). - -Links to **demos**, **tutorial**, **FAQ**, etc: <https://github.com/kripken/emscripten/wiki> - -Main project page: <http://emscripten.org> - -Emscripten is MIT licensed, see LICENSE.txt. - diff --git a/README.md b/README.md new file mode 100644 index 00000000..6b4778bf --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ + + +Emscripten is an LLVM-to-JavaScript compiler. It takes LLVM bitcode - which can be generated +from C/C++, using `llvm-gcc` (DragonEgg) or `clang`, or any other language that can be +converted into LLVM - and compiles that into JavaScript, which can be run on the web (or +anywhere else JavaScript can run). + +Links to **demos**, **tutorial**, **FAQ**, etc: <https://github.com/kripken/emscripten/wiki> + +Main project page: <http://emscripten.org> + +License +------- + +Emscripten is available under 2 licenses, the MIT license and the +University of Illinois/NCSA Open Source License. + +Both are permissive open source licenses, with little if any +practical difference between them. + +The reason for offering both is that (1) the MIT license is +well-known, while (2) the University of Illinois/NCSA Open Source +License allows Emscripten's code to be integrated upstream into +LLVM, which uses that license, should the opportunity arise. + +See `LICENSE` for the full content of the licenses. diff --git a/emscripten-version.txt b/emscripten-version.txt new file mode 100644 index 00000000..bf2b5ccf --- /dev/null +++ b/emscripten-version.txt @@ -0,0 +1,2 @@ +1.13.0 + diff --git a/emscripten.py b/emscripten.py index 37e1c83f..5c9275c2 100755 --- a/emscripten.py +++ b/emscripten.py @@ -746,6 +746,9 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None, backend_args += ['-emscripten-warn-unaligned'] if settings['RESERVED_FUNCTION_POINTERS'] > 0: backend_args += ['-emscripten-reserved-function-pointers=%d' % settings['RESERVED_FUNCTION_POINTERS']] + if settings['ASSERTIONS'] > 0: + backend_args += ['-emscripten-assertions=%d' % settings['ASSERTIONS']] + backend_args += ['-O' + str(settings['OPT_LEVEL'])] if DEBUG: logging.debug('emscript: llvm backend: ' + ' '.join(backend_args)) t = time.time() diff --git a/docs/emscripten_switch_logo.eps b/media/switch_logo.eps Binary files differindex 741970c1..741970c1 100644 --- a/docs/emscripten_switch_logo.eps +++ b/media/switch_logo.eps diff --git a/docs/emscripten_switch_logo.jpg b/media/switch_logo.jpeg Binary files differindex 7c05cd94..7c05cd94 100644 --- a/docs/emscripten_switch_logo.jpg +++ b/media/switch_logo.jpeg diff --git a/docs/emscripten_switch_logo.svg b/media/switch_logo.svg index 58277388..58277388 100644 --- a/docs/emscripten_switch_logo.svg +++ b/media/switch_logo.svg diff --git a/package.json b/package.json index a1447c9f..4fbba2fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "emscripten", - "version": "1.0.0", + "version": "1.13.0", "dependencies": { "ws": "~0.4.28" } diff --git a/patches/README b/patches/README deleted file mode 100644 index f6817fed..00000000 --- a/patches/README +++ /dev/null @@ -1,4 +0,0 @@ -This directory contains a useful mercurial patch queue. - -Note to patch queue maintainer: You need to manually copy from .hg/patches into this directory, after |qrefresh|ing the patch. - diff --git a/patches/series b/patches/series deleted file mode 100644 index 04f16d03..00000000 --- a/patches/series +++ /dev/null @@ -1,2 +0,0 @@ -sauer - diff --git a/src/headlessCanvas.js b/src/headlessCanvas.js index 4bd17a7b..1eefe48e 100644 --- a/src/headlessCanvas.js +++ b/src/headlessCanvas.js @@ -598,7 +598,9 @@ function headlessCanvas() { }); }, exitPointerLock: function(){}, - style: {}, + style: { + setProperty: function(){} + }, eventListeners: {}, addEventListener: function(){}, removeEventListener: function(){}, diff --git a/src/library_browser.js b/src/library_browser.js index 47b3b2f9..03da394e 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -1,7 +1,6 @@ //"use strict"; // Utilities for browser environments - mergeInto(LibraryManager.library, { $Browser__deps: ['$PATH'], $Browser__postset: 'Module["requestFullScreen"] = function Module_requestFullScreen(lockPointer, resizeCanvas) { Browser.requestFullScreen(lockPointer, resizeCanvas) };\n' + // exports @@ -1011,8 +1010,11 @@ mergeInto(LibraryManager.library, { var callbackId = msg.data['callbackId']; var callbackInfo = info.callbacks[callbackId]; if (!callbackInfo) return; // no callback or callback removed meanwhile - info.awaited--; - info.callbacks[callbackId] = null; // TODO: reuse callbackIds, compress this + // Don't trash our callback state if we expect additional calls. + if (msg.data['finalResponse']) { + info.awaited--; + info.callbacks[callbackId] = null; // TODO: reuse callbackIds, compress this + } var data = msg.data['data']; if (data) { if (!data.byteLength) data = new Uint8Array(data); @@ -1059,12 +1061,23 @@ mergeInto(LibraryManager.library, { }); }, + emscripten_worker_respond_provisionally: function(data, size) { + if (!inWorkerCall) throw 'not in worker call!'; + if (workerResponded) throw 'already responded with final response!'; + postMessage({ + 'callbackId': workerCallbackId, + 'finalResponse': false, + 'data': data ? new Uint8Array({{{ makeHEAPView('U8', 'data', 'data + size') }}}) : 0 // XXX copy to a new typed array as a workaround for chrome bug 169705 + }); + }, + emscripten_worker_respond: function(data, size) { if (!inWorkerCall) throw 'not in worker call!'; - if (workerResponded) throw 'already responded!'; + if (workerResponded) throw 'already responded with final response!'; workerResponded = true; postMessage({ 'callbackId': workerCallbackId, + 'finalResponse': true, 'data': data ? new Uint8Array({{{ makeHEAPView('U8', 'data', 'data + size') }}}) : 0 // XXX copy to a new typed array as a workaround for chrome bug 169705 }); }, diff --git a/src/relooper/README.markdown b/src/relooper/README.markdown deleted file mode 100644 index 9b0187b3..00000000 --- a/src/relooper/README.markdown +++ /dev/null @@ -1,14 +0,0 @@ - -Relooper -======== - -This is an optimized C++ implemention of the Relooper algorithm originally -developed as part of Emscripten. This implementation includes optimizations -added since the original academic paper [1] - see paper.pdf - was published -about it, and is written in an LLVM-friendly way with the goal of inclusion -in upstream LLVM. - -License: MIT&LLVM - -[1] Alon Zakai. 2011. Emscripten: an LLVM-to-JavaScript compiler. In Proceedings of the ACM international conference companion on Object oriented programming systems languages and applications companion (SPLASH '11). ACM, New York, NY, USA, 301-312. DOI=10.1145/2048147.2048224 http://doi.acm.org/10.1145/2048147.2048224 - diff --git a/src/relooper/README.md b/src/relooper/README.md new file mode 100644 index 00000000..a4073a77 --- /dev/null +++ b/src/relooper/README.md @@ -0,0 +1,12 @@ +Relooper +======== + +This is an optimized C++ implemention of the Relooper algorithm originally developed as part +of Emscripten. This implementation includes optimizations added since the original academic +paper [1] - see paper.pdf - was published about it, and is written in an LLVM-friendly way +with the goal of inclusion in upstream LLVM. + +[1] Alon Zakai. 2011. Emscripten: an LLVM-to-JavaScript compiler. In Proceedings of the ACM +international conference companion on Object oriented programming systems languages and +applications companion (SPLASH '11). ACM, New York, NY, USA, 301-312. +DOI=10.1145/2048147.2048224 http://doi.acm.org/10.1145/2048147.2048224 diff --git a/src/settings.js b/src/settings.js index 7f9fbabf..02f6c8b5 100644 --- a/src/settings.js +++ b/src/settings.js @@ -311,6 +311,10 @@ var EXPORTED_FUNCTIONS = ['_main', '_malloc']; // through LLVM dead code elimination, and also made accessible outside of // the generated code even after running closure compiler (on "Module"). // Note the necessary prefix of "_". + // Note also that this is the full list of exported functions - if you + // have a main() function and want it to run, you must include it in this + // list (as _main is by default in this value, and if you override it + // without keeping it there, you are in effect removing it). var EXPORT_ALL = 0; // If true, we export all the symbols. Note that this does *not* affect LLVM, so it can // still eliminate functions as dead. This just exports them on the Module object. var EXPORT_BINDINGS = 0; // Export all bindings generator functions (prefixed with emscripten_bind_). This diff --git a/system/include/emscripten/emscripten.h b/system/include/emscripten/emscripten.h index 26ecdf0e..a3009936 100644 --- a/system/include/emscripten/emscripten.h +++ b/system/include/emscripten/emscripten.h @@ -400,10 +400,17 @@ void emscripten_destroy_worker(worker_handle worker); void emscripten_call_worker(worker_handle worker, const char *funcname, char *data, int size, void (*callback)(char *, int, void*), void *arg); /* - * Sends a response when in a worker call. Should only be - * called once in each call. + * Sends a response when in a worker call. Both functions post a message + * back to the thread which called the worker. The _respond_provisionally + * variant can be invoked multiple times, which will queue up messages to + * be posted to the worker's creator. Eventually, the _respond variant must + * be invoked, which will disallow further messages and free framework + * resources previously allocated for this worker call. (Calling the + * provisional version is optional, but you must call the non-provisional + * one to avoid leaks.) */ void emscripten_worker_respond(char *data, int size); +void emscripten_worker_respond_provisionally(char *data, int size); /* * Checks how many responses are being waited for from a worker. This diff --git a/tests/cases/2xi40.ll b/tests/cases/2xi40.ll index 03c918c8..fe249528 100644 --- a/tests/cases/2xi40.ll +++ b/tests/cases/2xi40.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpe4Pk1F/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.pair = type { [5 x i8], [5 x i8] } diff --git a/tests/cases/514_ta2.ll b/tests/cases/514_ta2.ll index d435cac1..caf69fb5 100644 --- a/tests/cases/514_ta2.ll +++ b/tests/cases/514_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpxFUbAg/test_emcc1.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.c_s = type { i8, float, i32 } diff --git a/tests/cases/aliasbitcast.ll b/tests/cases/aliasbitcast.ll index de46cdd4..926b386d 100644 --- a/tests/cases/aliasbitcast.ll +++ b/tests/cases/aliasbitcast.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/emscripten/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1] diff --git a/tests/cases/aliasbitcast2_noasm.ll b/tests/cases/aliasbitcast2_noasm.ll index 8537e272..5387f2c0 100644 --- a/tests/cases/aliasbitcast2_noasm.ll +++ b/tests/cases/aliasbitcast2_noasm.ll @@ -9,7 +9,7 @@ target triple = "i386-pc-linux-gnu" ; [#uses=2] define void @original() { entry: - %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] + %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i32* bitcast (i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0) to i32*)) ; [#uses=0] br label %return return: ; preds = %entry diff --git a/tests/cases/aliasbitcast3_noasm.ll b/tests/cases/aliasbitcast3_noasm.ll index 4ff969e3..19d3ff14 100644 --- a/tests/cases/aliasbitcast3_noasm.ll +++ b/tests/cases/aliasbitcast3_noasm.ll @@ -11,7 +11,7 @@ target triple = "i386-pc-linux-gnu" ; [#uses=2] define void @original() { entry: - %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] + %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i32* bitcast (i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0) to i32*)) ; [#uses=0] br label %return return: ; preds = %entry @@ -24,6 +24,6 @@ declare i32 @puts(i8*) ; [#uses=0] define i32 @main() { entry: - call void @thriceremoved() + call void @thriceremoved(i32 0) ret i32 0 } diff --git a/tests/cases/aliasbitcastdollar_noasm.ll b/tests/cases/aliasbitcastdollar_noasm.ll index 1ecf6047..558289b7 100644 --- a/tests/cases/aliasbitcastdollar_noasm.ll +++ b/tests/cases/aliasbitcastdollar_noasm.ll @@ -9,7 +9,7 @@ target triple = "i386-pc-linux-gnu" ; [#uses=2] define void @original() { entry: - %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] + %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i32* bitcast (i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0) to i32*)) ; [#uses=0] br label %return return: ; preds = %entry diff --git a/tests/cases/atomicrmw.ll b/tests/cases/atomicrmw.ll index abbcc7a6..20a68baa 100644 --- a/tests/cases/atomicrmw.ll +++ b/tests/cases/atomicrmw.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, %d,%d!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/atomicrmw_dec.ll b/tests/cases/atomicrmw_dec.ll index edb5bd8f..819c3a2a 100644 --- a/tests/cases/atomicrmw_dec.ll +++ b/tests/cases/atomicrmw_dec.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, %d,%d!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/atomicrmw_unaligned.ll b/tests/cases/atomicrmw_unaligned.ll index abbcc7a6..20a68baa 100644 --- a/tests/cases/atomicrmw_unaligned.ll +++ b/tests/cases/atomicrmw_unaligned.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, %d,%d!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/bigdouble.ll b/tests/cases/bigdouble.ll index e96b10af..472adadd 100644 --- a/tests/cases/bigdouble.ll +++ b/tests/cases/bigdouble.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpijH2sB/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1 diff --git a/tests/cases/boolret_fastcomp.ll b/tests/cases/boolret_fastcomp.ll index 1b968778..e6320bab 100644 --- a/tests/cases/boolret_fastcomp.ll +++ b/tests/cases/boolret_fastcomp.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"helloworld%d.\0A\00", align 1 diff --git a/tests/cases/breakinthemiddle.ll b/tests/cases/breakinthemiddle.ll index 4c43bbd0..39aaa922 100644 --- a/tests/cases/breakinthemiddle.ll +++ b/tests/cases/breakinthemiddle.ll @@ -1,4 +1,4 @@ -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1] diff --git a/tests/cases/breakinthemiddle2.ll b/tests/cases/breakinthemiddle2.ll index 301b62c3..db1cb7b6 100644 --- a/tests/cases/breakinthemiddle2.ll +++ b/tests/cases/breakinthemiddle2.ll @@ -1,4 +1,4 @@ -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1] diff --git a/tests/cases/caall.ll b/tests/cases/caall.ll index ffbf29d8..0d92a498 100644 --- a/tests/cases/caall.ll +++ b/tests/cases/caall.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/callwithstructural64_ta2.ll b/tests/cases/callwithstructural64_ta2.ll index 56b0442c..103adcd0 100644 --- a/tests/cases/callwithstructural64_ta2.ll +++ b/tests/cases/callwithstructural64_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'foo.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %ac = type { i8*, i64 } diff --git a/tests/cases/callwithstructural_ta2.ll b/tests/cases/callwithstructural_ta2.ll index 88a3d755..00cde791 100644 --- a/tests/cases/callwithstructural_ta2.ll +++ b/tests/cases/callwithstructural_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'foo.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %ac = type { i8*, i32 } diff --git a/tests/cases/complexphi.ll b/tests/cases/complexphi.ll index 0d1677f3..871cbe27 100644 --- a/tests/cases/complexphi.ll +++ b/tests/cases/complexphi.ll @@ -1,5 +1,5 @@ ; ModuleID = '/dev/shm/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/ctors_cast.ll b/tests/cases/ctors_cast.ll index 707b5528..69baa17d 100644 --- a/tests/cases/ctors_cast.ll +++ b/tests/cases/ctors_cast.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpHcVUBJ/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.Other = type { i8 } diff --git a/tests/cases/dash.ll b/tests/cases/dash.ll index 6f727820..0104cf7c 100644 --- a/tests/cases/dash.ll +++ b/tests/cases/dash.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpqfApGD/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @other-name = alias i32 ()* @main diff --git a/tests/cases/dollar.ll b/tests/cases/dollar.ll index 8f0c1dd7..3bd203cf 100644 --- a/tests/cases/dollar.ll +++ b/tests/cases/dollar.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/emptyalloca.ll b/tests/cases/emptyalloca.ll index 0c03c645..59ff2955 100644 --- a/tests/cases/emptyalloca.ll +++ b/tests/cases/emptyalloca.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpjSNiky/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [30 x i8] c"Module.print('hello, world!')\00", align 1 diff --git a/tests/cases/emptyasm_aue.ll b/tests/cases/emptyasm_aue.ll index 65d9e213..24805591 100644 --- a/tests/cases/emptyasm_aue.ll +++ b/tests/cases/emptyasm_aue.ll @@ -1,4 +1,4 @@ -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" ; ModuleID = 'tests/hello_world.bc' diff --git a/tests/cases/emptystruct.ll b/tests/cases/emptystruct.ll index ecf0e295..b32ac803 100644 --- a/tests/cases/emptystruct.ll +++ b/tests/cases/emptystruct.ll @@ -13,7 +13,7 @@ entry: %z = alloca %struct.s, align 4 %0 = bitcast %struct.s* %z to i8* call void @llvm.memset.p0i8.i32(i8* %0, i8 0, i32 4, i32 4, i1 false) - %1 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] + %1 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i32* bitcast (i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0) to i32*)) ; [#uses=0] ret i32 0 } diff --git a/tests/cases/entry3.ll b/tests/cases/entry3.ll index 7e154e2c..822e6b7f 100644 --- a/tests/cases/entry3.ll +++ b/tests/cases/entry3.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpKnA2D3/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [11 x i8] c"getgid=%d\0A\00", align 1 diff --git a/tests/cases/fptosi.ll b/tests/cases/fptosi.ll index caf9b754..5c6477bf 100644 --- a/tests/cases/fptosi.ll +++ b/tests/cases/fptosi.ll @@ -1,5 +1,5 @@ ; ModuleID = '/dev/shm/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [8 x i8] c"*%.3f*\0A\00", align 1 ; [#uses=1 type=[8 x i8]*] diff --git a/tests/cases/funcptr.ll b/tests/cases/funcptr.ll index ffc1ad1d..4c1c9990 100644 --- a/tests/cases/funcptr.ll +++ b/tests/cases/funcptr.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [17 x i8] c"hello %d world!\0A\00", align 1 ; [#uses=1 type=[17 x i8]*] diff --git a/tests/cases/fuzz6_ta2.ll b/tests/cases/fuzz6_ta2.ll index 225493f9..a30bf61f 100644 --- a/tests/cases/fuzz6_ta2.ll +++ b/tests/cases/fuzz6_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'emcc-0-basebc.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.S3 = type { i32, i32 } diff --git a/tests/cases/gepaddoverflow.ll b/tests/cases/gepaddoverflow.ll index 258e2cc5..4346ce20 100644 --- a/tests/cases/gepaddoverflow.ll +++ b/tests/cases/gepaddoverflow.ll @@ -1,5 +1,5 @@ ; ModuleID = 'new.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" declare i32 @printf(i8* noalias, ...) nounwind diff --git a/tests/cases/i24_mem_ta2.ll b/tests/cases/i24_mem_ta2.ll index 995c9f8b..296c8c0b 100644 --- a/tests/cases/i24_mem_ta2.ll +++ b/tests/cases/i24_mem_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [6 x i8] c".%x.\0A\00", align 1 ; [#uses=1 type=[5 x i8]*] diff --git a/tests/cases/i96_ashr_ta2.ll b/tests/cases/i96_ashr_ta2.ll index da6410f9..2800ad0d 100644 --- a/tests/cases/i96_ashr_ta2.ll +++ b/tests/cases/i96_ashr_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [23 x i8] c"hello..world!%x,%x,%x\0A\00", align 1 diff --git a/tests/cases/i96shiftnon32_ta2.ll b/tests/cases/i96shiftnon32_ta2.ll index 815d71ea..3a3ba5fd 100644 --- a/tests/cases/i96shiftnon32_ta2.ll +++ b/tests/cases/i96shiftnon32_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpxFUbAg/test_emcc1.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.c_s = type { i8, float, i32 } diff --git a/tests/cases/inttoptr.ll b/tests/cases/inttoptr.ll index e225336c..7682bed1 100644 --- a/tests/cases/inttoptr.ll +++ b/tests/cases/inttoptr.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/emscripten/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1] diff --git a/tests/cases/invokebitcast.ll b/tests/cases/invokebitcast.ll index 63239a7b..ecbce6dd 100644 --- a/tests/cases/invokebitcast.ll +++ b/tests/cases/invokebitcast.ll @@ -1,6 +1,6 @@ ; ModuleID = '/dev/shm/tmp/src.cpp.o' ; Just test for compilation here -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.CPU_Regs = type { [8 x %union.GenReg32] } @@ -10,7 +10,7 @@ target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1] ; [#uses=0] -define i32 @main() { +define i32 @main(i32 %p) { entry: %retval = alloca i32 ; [#uses=2] %0 = alloca i32 ; [#uses=2] @@ -24,13 +24,15 @@ entry: store i32 %3, i32* %retval, align 4 br label %return - invoke void bitcast (void (i32*, i32)* @_Z8toStringj to void (i64*, i32)*)(%struct.CPU_Regs* noalias @cpu_regs, i32 %99) + invoke void bitcast (void (i32*, i32)* @_Z8toStringj to void (i64*, i32)*)(i64* bitcast (%struct.CPU_Regs* @cpu_regs to i64*), i32 %p) to label %invcont33 unwind label %lpad106 invcont33: ret i32 %retval1 lpad106: + %Z = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + cleanup ret i32 %retval1 return: ; preds = %entry @@ -40,3 +42,6 @@ return: ; preds = %entry ; [#uses=1] declare i32 @puts(i8*) + +declare void @_Z8toStringj(i32*, i32) +declare i32 @__gxx_personality_v0(...) diff --git a/tests/cases/invokeundef.ll b/tests/cases/invokeundef.ll index 17b14a3f..e24763d9 100644 --- a/tests/cases/invokeundef.ll +++ b/tests/cases/invokeundef.ll @@ -1,6 +1,6 @@ ; ModuleID = '/dev/shm/tmp/src.cpp.o' ; Just test for compilation here -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.CPU_Regs = type { [8 x %union.GenReg32] } diff --git a/tests/cases/legalizer_b_ta2.ll b/tests/cases/legalizer_b_ta2.ll index ec5e7506..78b5dc04 100644 --- a/tests/cases/legalizer_b_ta2.ll +++ b/tests/cases/legalizer_b_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @globaliz = global [300 x i8] zeroinitializer diff --git a/tests/cases/legalizer_ta2.ll b/tests/cases/legalizer_ta2.ll index e7f71f15..1cd89220 100644 --- a/tests/cases/legalizer_ta2.ll +++ b/tests/cases/legalizer_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @globaliz = global [300 x i8] zeroinitializer diff --git a/tests/cases/loadbitcastgep.ll b/tests/cases/loadbitcastgep.ll index daba67c4..311329f3 100644 --- a/tests/cases/loadbitcastgep.ll +++ b/tests/cases/loadbitcastgep.ll @@ -1,5 +1,5 @@ ; ModuleID = '/dev/shm/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.CPU_Regs = type { [8 x %union.GenReg32] } diff --git a/tests/cases/muli33_ta2.ll b/tests/cases/muli33_ta2.ll index 7a427731..e6f092cd 100644 --- a/tests/cases/muli33_ta2.ll +++ b/tests/cases/muli33_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpt0JpDh/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [7 x i8] c"20\0A91\0A\00", align 1 diff --git a/tests/cases/oob_ta2.ll b/tests/cases/oob_ta2.ll index 51b622b5..3c06573e 100644 --- a/tests/cases/oob_ta2.ll +++ b/tests/cases/oob_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %structy = type { [2 x [10 x i8]] } diff --git a/tests/cases/phi24_ta2.ll b/tests/cases/phi24_ta2.ll index 17edb228..0edb36be 100644 --- a/tests/cases/phi24_ta2.ll +++ b/tests/cases/phi24_ta2.ll @@ -1,5 +1,5 @@ -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %union.U4 = type { i32 } diff --git a/tests/cases/phicubed.ll b/tests/cases/phicubed.ll index 7079dc63..90f91e9c 100644 --- a/tests/cases/phicubed.ll +++ b/tests/cases/phicubed.ll @@ -1,5 +1,5 @@ ; ModuleID = '/dev/shm/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.worker_args = type { i32, %struct.worker_args* } diff --git a/tests/cases/phientryimplicit.ll b/tests/cases/phientryimplicit.ll index 3249bb8d..1dc5f2c7 100644 --- a/tests/cases/phientryimplicit.ll +++ b/tests/cases/phientryimplicit.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" ; Phi nodes can refer to the entry. And the entry might be unnamed, and doesn't even have a consistent implicit name! @@ -10,14 +10,14 @@ target triple = "asmjs-unknown-emscripten" define i32 @main() { %retval = alloca i32, align 4 ; [#uses=1 type=i32*] %a16 = trunc i32 1 to i1 - br i1 %a16, label %L17, label %L26, !dbg !1269853 ; [debug line = 3920:5] + br i1 %a16, label %L17, label %L26 L17: %a25 = trunc i32 1 to i1 br label %L26 L26: - %a27 = phi i1 [ false, %1 ], [ %a25, %L17 ] ; [#uses=1 type=i1] + %a27 = phi i1 [ false, %0 ], [ %a25, %L17 ] ; [#uses=1 type=i1] store i32 0, i32* %retval %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0 type=i32] %cal2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i1 %a27) ; make sure %27 is used @@ -27,7 +27,7 @@ L26: define i32 @main0() { %retval = alloca i32, align 4 ; [#uses=1 type=i32*] %a16 = trunc i32 1 to i1 - br i1 %a16, label %L17, label %L26, !dbg !1269853 ; [debug line = 3920:5] + br i1 %a16, label %L17, label %L26 L17: %a25 = trunc i32 1 to i1 diff --git a/tests/cases/phientryimplicitmix.ll b/tests/cases/phientryimplicitmix.ll index 7696f5a9..8903e783 100644 --- a/tests/cases/phientryimplicitmix.ll +++ b/tests/cases/phientryimplicitmix.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" ; Phi nodes can refer to the entry. And the entry might be unnamed, and doesn't even have a consistent implicit name! diff --git a/tests/cases/phientryimplicitmoar.ll b/tests/cases/phientryimplicitmoar.ll index eca7276e..ad1e701c 100644 --- a/tests/cases/phientryimplicitmoar.ll +++ b/tests/cases/phientryimplicitmoar.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/philoop_ta2.ll b/tests/cases/philoop_ta2.ll index 1afec610..b73aefc3 100644 --- a/tests/cases/philoop_ta2.ll +++ b/tests/cases/philoop_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpVIBz29/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [13 x i8] c"99\0A70\0A26\0A97\0A\00", align 1 diff --git a/tests/cases/phinonexist.ll b/tests/cases/phinonexist.ll index 145d2221..75c1cef6 100644 --- a/tests/cases/phinonexist.ll +++ b/tests/cases/phinonexist.ll @@ -5,18 +5,19 @@ target triple = "i386-pc-linux-gnu" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] define i32 @main() { +entry: %retval = alloca i32, align 4 %a12 = zext i1 1 to i32 - br label %13 + br label %label13 -; <label>:13 ; preds = %13, %1 - %a14 = phi i32 [ %a12, %1 ], [ %a15, %135 ] +label13: ; preds = %13, %1 + %a14 = phi i32 [ %a12, %entry ], [ %a15, %135 ] %call0 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) %a15 = add nsw i32 %a14, 2 %a16 = icmp eq i32 %a15, 9 - br label %17 + br label %label17 -; <label>:17 ; preds = %1 +label17: ; preds = %1 ret i32 1 } diff --git a/tests/cases/phinonreachable64.ll b/tests/cases/phinonreachable64.ll index 41aac5f0..fe56fc09 100644 --- a/tests/cases/phinonreachable64.ll +++ b/tests/cases/phinonreachable64.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/phiptrtoint.ll b/tests/cases/phiptrtoint.ll index 617ada49..2028f494 100644 --- a/tests/cases/phiptrtoint.ll +++ b/tests/cases/phiptrtoint.ll @@ -1,6 +1,6 @@ ; ModuleID = '/tmp/tmpJctwj0/bug.bc' ; just an asm validation check, no output -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %"class.test::Processor" = type { i32, %"class.test::StateMachine" } diff --git a/tests/cases/phiself.ll b/tests/cases/phiself.ll index b61b970f..72572859 100644 --- a/tests/cases/phiself.ll +++ b/tests/cases/phiself.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/emscripten_temp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [7 x i8] c"cheez\0A\00", align 1 diff --git a/tests/cases/ptrtoi64.ll b/tests/cases/ptrtoi64.ll index 09929742..e22b60dc 100644 --- a/tests/cases/ptrtoi64.ll +++ b/tests/cases/ptrtoi64.ll @@ -1,7 +1,7 @@ ; pointer to i64, then to i32 ; ModuleID = '/tmp/emscripten/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str2 = private constant [9 x i8] c"*%d,%d*\0A\00", align 1 ; [#uses=1] diff --git a/tests/cases/ptrtoint_blockaddr.ll b/tests/cases/ptrtoint_blockaddr.ll index 08370650..f9f72449 100644 --- a/tests/cases/ptrtoint_blockaddr.ll +++ b/tests/cases/ptrtoint_blockaddr.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1] diff --git a/tests/cases/quotedlabel.ll b/tests/cases/quotedlabel.ll index d32e380a..d4b8639c 100644 --- a/tests/cases/quotedlabel.ll +++ b/tests/cases/quotedlabel.ll @@ -13,7 +13,7 @@ entry: br label %"finish$$$" "finish$$$": ; preds = %entry - %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] + %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i32* bitcast (i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0) to i32*)) ; [#uses=0] ret i32 0 } diff --git a/tests/cases/sillybitcast.ll b/tests/cases/sillybitcast.ll index 020a6e84..e9baf74d 100644 --- a/tests/cases/sillybitcast.ll +++ b/tests/cases/sillybitcast.ll @@ -1,13 +1,13 @@ ; ModuleID = '/tmp/emscripten/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1] ; [#uses=2] -define void @"\01_Z5hellov"() { +define void @"_Z5hellov"() { entry: - %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] + %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i32* bitcast (i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0) to i32*)) ; [#uses=0] br label %return return: ; preds = %entry @@ -23,7 +23,7 @@ entry: %retval = alloca i32 ; [#uses=2] %0 = alloca i32 ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @"\01_Z5hellov"() + call void @"_Z5hellov"() store i32 0, i32* %0, align 4 %1 = load i32* %0, align 4 ; [#uses=1] store i32 %1, i32* %retval, align 4 diff --git a/tests/cases/sillybitcast2.ll b/tests/cases/sillybitcast2.ll index 275760c5..6ef0f32d 100644 --- a/tests/cases/sillybitcast2.ll +++ b/tests/cases/sillybitcast2.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/emscripten/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1] diff --git a/tests/cases/sillyfuncast.ll b/tests/cases/sillyfuncast.ll index 2f2f7fe6..af03e975 100644 --- a/tests/cases/sillyfuncast.ll +++ b/tests/cases/sillyfuncast.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/sillyfuncast2.ll b/tests/cases/sillyfuncast2_noasm.ll index f72ebe28..6c55b990 100644 --- a/tests/cases/sillyfuncast2.ll +++ b/tests/cases/sillyfuncast2_noasm.ll @@ -14,6 +14,7 @@ entry: %retval = alloca i32, align 4 ; [#uses=1 type=i32*] store i32 0, i32* %retval call i32 bitcast (void (i32, i32)* @doit to i32 (i32, i64)*)(i32 0, i64 0) nounwind + call void bitcast (void (i32, i32)* @doit to void (i32, float)*)(i32 0, float 0.0) nounwind ret i32 1 } diff --git a/tests/cases/storebigfloat.ll b/tests/cases/storebigfloat.ll index a7c6c2da..6348fd5f 100644 --- a/tests/cases/storebigfloat.ll +++ b/tests/cases/storebigfloat.ll @@ -1,4 +1,4 @@ -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/storestruct.ll b/tests/cases/storestruct.ll index 1bc0bffb..272b8d5a 100644 --- a/tests/cases/storestruct.ll +++ b/tests/cases/storestruct.ll @@ -1,5 +1,5 @@ ; ModuleID = '/dev/shm/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" ; Load and store an entire structure as a whole (and also load as a whole, extract values and save separately, etc.) diff --git a/tests/cases/structinparam.ll b/tests/cases/structinparam.ll index 93f486a0..a85a50ae 100644 --- a/tests/cases/structinparam.ll +++ b/tests/cases/structinparam.ll @@ -1,5 +1,5 @@ ; ModuleID = 'min.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %ac = type { i8*, i32 } diff --git a/tests/cases/structparam.ll b/tests/cases/structparam.ll index c59ad600..53ee5a93 100644 --- a/tests/cases/structparam.ll +++ b/tests/cases/structparam.ll @@ -27,7 +27,7 @@ cond.end: ; preds = %cond.false, %cond.t %cond = phi { i32, i32 } [ { i32 5, i32 6 }, %entry ], [ zeroinitializer, %cond.null ] ; [#uses=1] store { i32, i32 } %cond, { i32, i32 }* %comp %call = call i32 (i32, { i32, i32 })* @doit(i32 1, { i32, i32 } %cond) ; - store { i32, i32 } { i32 ptrtoint (i64* @_dispatchTable to i32), i32 0 }, { i32, i32 }* getelementptr inbounds ([1 x i64]* @_dispatchTable, i32 0, i32 0, i32 1), align 4 + store { i32, i32 } { i32 ptrtoint (i64* @_dispatchTable to i32), i32 0 }, { i32, i32 }* bitcast (i64* getelementptr inbounds ([1 x i64]* bitcast (i64* @_dispatchTable to [1 x i64]*), i32 0, i32 0) to { i32, i32 }*), align 4 ret i32 0 ; [debug line = 6:13] } diff --git a/tests/cases/structphiparam.ll b/tests/cases/structphiparam.ll index b5d05c17..8ce7b9ae 100644 --- a/tests/cases/structphiparam.ll +++ b/tests/cases/structphiparam.ll @@ -1,5 +1,5 @@ ; ModuleID = '/dev/shm/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, %d %d!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/sub_11_0.ll b/tests/cases/sub_11_0.ll index 59f70c7f..aab61866 100644 --- a/tests/cases/sub_11_0.ll +++ b/tests/cases/sub_11_0.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/switch64_ta2.ll b/tests/cases/switch64_ta2.ll index f30c078f..23413847 100644 --- a/tests/cases/switch64_ta2.ll +++ b/tests/cases/switch64_ta2.ll @@ -1,4 +1,4 @@ -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private constant [18 x i8] c"hello, world: %d\0A\00", align 1 diff --git a/tests/cases/switch64b_ta2.ll b/tests/cases/switch64b_ta2.ll index beb644e0..60aca441 100644 --- a/tests/cases/switch64b_ta2.ll +++ b/tests/cases/switch64b_ta2.ll @@ -1,4 +1,4 @@ -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private constant [18 x i8] c"hello, world: %d\0A\00", align 1 diff --git a/tests/cases/uadd_overflow_ta2.ll b/tests/cases/uadd_overflow_ta2.ll index 19c2908b..1268f78a 100644 --- a/tests/cases/uadd_overflow_ta2.ll +++ b/tests/cases/uadd_overflow_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str2 = private constant [9 x i8] c"*%d,%d*\0A\00", align 1 ; [#uses=1] diff --git a/tests/cases/zeroembedded.ll b/tests/cases/zeroembedded.ll index b1394893..7acbc017 100644 --- a/tests/cases/zeroembedded.ll +++ b/tests/cases/zeroembedded.ll @@ -1,4 +1,4 @@ -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.pypy_str = type { i32, [0 x i8] } diff --git a/tests/cases/zeroextarg.ll b/tests/cases/zeroextarg.ll index ff42741b..d02b671b 100644 --- a/tests/cases/zeroextarg.ll +++ b/tests/cases/zeroextarg.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/core/test_sscanf_other_whitespace.in b/tests/core/test_sscanf_other_whitespace.in index 467fa4f0..3ae23d92 100644 --- a/tests/core/test_sscanf_other_whitespace.in +++ b/tests/core/test_sscanf_other_whitespace.in @@ -1,8 +1,8 @@ #include <stdio.h> int main() { - short int x; - short int y; + int x; + int y; const char* buffer[] = { "\t2\t3\t", /* TAB - horizontal tab */ diff --git a/tests/cubegeom_color.c b/tests/cubegeom_color.c index 0d2b6ecb..7a41c64d 100644 --- a/tests/cubegeom_color.c +++ b/tests/cubegeom_color.c @@ -38,10 +38,6 @@ void verify() { for (int x = 0; x < width*height*4; x++) { if (x % 4 != 3) sum += x * data[x]; } -#ifdef __EMSCRIPTEN__ - int result = sum; - REPORT_RESULT(); -#endif } int main(int argc, char *argv[]) diff --git a/tests/full_es2_sdlproc.c b/tests/full_es2_sdlproc.c index d9ac072b..3f72f2bf 100644 --- a/tests/full_es2_sdlproc.c +++ b/tests/full_es2_sdlproc.c @@ -704,6 +704,8 @@ gears_init(void) gear3 = create_gear(1.3, 2.0, 0.5, 10, 0.7); } +#include "SDL/SDL.h" + int main(int argc, char *argv[]) { diff --git a/tests/hello_world.ll b/tests/hello_world.ll index 343805a0..ab4b199f 100644 --- a/tests/hello_world.ll +++ b/tests/hello_world.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/python/python.asmjs-unknown-emscripten.bc b/tests/python/python.asmjs-unknown-emscripten.bc Binary files differindex 6c25401e..fe848c20 100644 --- a/tests/python/python.asmjs-unknown-emscripten.bc +++ b/tests/python/python.asmjs-unknown-emscripten.bc diff --git a/tests/sdl_headless.c b/tests/sdl_headless.c index 6157a46d..e1836777 100644 --- a/tests/sdl_headless.c +++ b/tests/sdl_headless.c @@ -57,9 +57,6 @@ int main(int argc, char **argv) { printf("done.\n"); - int result = sum > 3000 && sum < 5000; // varies a little on different browsers, font differences? - REPORT_RESULT(); - return 0; } diff --git a/tests/sqlite/benchmark.c b/tests/sqlite/benchmark.c index de800742..04dc150a 100644 --- a/tests/sqlite/benchmark.c +++ b/tests/sqlite/benchmark.c @@ -1,5 +1,6 @@ #include <time.h> #include <stdio.h> +#include <stdlib.h> #include <sqlite3.h> #include <emscripten.h> diff --git a/tests/test_browser.py b/tests/test_browser.py index 62d3f257..f34a2d98 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -732,9 +732,9 @@ If manually bisecting: self.btest('sdl_canvas.c', expected='1', args=['-s', 'LEGACY_GL_EMULATION=1']) # some extra coverage self.clear() - self.btest('sdl_canvas.c', expected='1', args=['-s', 'LEGACY_GL_EMULATION=1', '-s', '-O0', '-s', 'SAFE_HEAP=1']) + self.btest('sdl_canvas.c', expected='1', args=['-s', 'LEGACY_GL_EMULATION=1', '-O0', '-s', 'SAFE_HEAP=1']) self.clear() - self.btest('sdl_canvas.c', expected='1', args=['-s', 'LEGACY_GL_EMULATION=1', '-s', '-O2', '-s', 'SAFE_HEAP=1']) + self.btest('sdl_canvas.c', expected='1', args=['-s', 'LEGACY_GL_EMULATION=1', '-O2', '-s', 'SAFE_HEAP=1']) def test_sdl_canvas_proxy(self): def post(): @@ -1757,6 +1757,10 @@ void *getBindBuffer() { Popen([PYTHON, EMCC, path_from_root('tests', 'worker_api_2_worker.cpp'), '-o', 'worker.js', '-s', 'BUILD_AS_WORKER=1', '-O2', '--minify', '0', '-s', 'EXPORTED_FUNCTIONS=["_one", "_two", "_three", "_four"]']).communicate() self.btest('worker_api_2_main.cpp', args=['-O2', '--minify', '0'], expected='11') + def test_worker_api_3(self): + Popen([PYTHON, EMCC, path_from_root('tests', 'worker_api_3_worker.cpp'), '-o', 'worker.js', '-s', 'BUILD_AS_WORKER=1', '-s', 'EXPORTED_FUNCTIONS=["_one"]']).communicate() + self.btest('worker_api_3_main.cpp', expected='5') + def test_emscripten_async_wget2(self): self.btest('http.cpp', expected='0', args=['-I' + path_from_root('tests')]) diff --git a/tests/test_core.py b/tests/test_core.py index ddb61b2b..6ea0614a 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -5199,11 +5199,11 @@ def process(filename): shortname = name.replace('.ll', '') if '' not in shortname: continue if os.environ.get('EMCC_FAST_COMPILER') != '0' and os.path.basename(shortname) in [ - 'structparam', 'extendedprecision', 'issue_39', 'emptystruct', 'phinonexist', 'quotedlabel', 'oob_ta2', 'phientryimplicit', 'phiself', 'invokebitcast', 'funcptr', # invalid ir + 'structparam', 'extendedprecision', 'issue_39', 'phinonexist', 'oob_ta2', 'phiself', 'invokebitcast', # invalid ir 'structphiparam', 'callwithstructural_ta2', 'callwithstructural64_ta2', 'structinparam', # pnacl limitations in ExpandStructRegs '2xi40', # pnacl limitations in ExpandGetElementPtr 'quoted', # current fastcomp limitations FIXME - 'sillyfuncast2', 'sillybitcast', 'atomicrmw_unaligned' # TODO XXX + 'atomicrmw_unaligned' # TODO XXX ]: continue if '_ta2' in shortname and not Settings.USE_TYPED_ARRAYS == 2: print self.skip('case "%s" only relevant for ta2' % shortname) diff --git a/tests/test_other.py b/tests/test_other.py index 9f7d2eeb..0ef9ebb5 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -195,7 +195,6 @@ Options that are modified or new in %s include: (['-O2', '-g3'], lambda generated: 'var b=0' not in generated and 'var b = 0' not in generated and 'function _main' in generated, 'registerize is cancelled by -g3'), #(['-O2', '-g4'], lambda generated: 'var b=0' not in generated and 'var b = 0' not in generated and 'function _main' in generated, 'same as -g3 for now'), (['-s', 'INLINING_LIMIT=0'], lambda generated: 'function _dump' in generated, 'no inlining without opts'), - (['-Os', '--llvm-lto', '1', '-s', 'ASM_JS=0', '-g2'], lambda generated: 'function _dump' in generated, '-Os disables inlining'), (['-s', 'USE_TYPED_ARRAYS=0'], lambda generated: 'new Int32Array' not in generated, 'disable typed arrays'), (['-s', 'USE_TYPED_ARRAYS=1'], lambda generated: 'IHEAPU = ' in generated, 'typed arrays 1 selected'), ([], lambda generated: 'Module["_dump"]' not in generated, 'dump is not exported by default'), @@ -2522,16 +2521,36 @@ int main() } ''') + IMPLICIT_WARNING = '''warning: implicit declaration of function 'strnlen' is invalid in C99''' + IMPLICIT_ERROR = '''error: implicit declaration of function 'strnlen' is invalid in C99''' + for opts, expected, compile_expected in [ - ([], ['abort()', 'it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this'], []), - (['-s', 'ASSERTIONS=2'], ['abort()', 'This pointer might make sense in another type signature'], []), - (['-O1'], ['hello 2\nhello 5\n'], []), # invalid output - second arg is sent as varargs, but needs to be int. llvm optimizer avoided the crash silently, caused undefined behavior... at least people can debug this by running an -O0 build. + ([], None, [IMPLICIT_ERROR]), + (['-Wno-error=implicit-function-declaration'], ['abort()', 'it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this'], [IMPLICIT_WARNING]), # turn error into warning + (['-Wno-implicit-function-declaration'], ['abort()', 'it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this'], []), # turn error into nothing at all + (['-Wno-error=implicit-function-declaration', '-s', 'ASSERTIONS=2'], ['abort()', 'This pointer might make sense in another type signature'], []), + (['-Wno-error=implicit-function-declaration', '-O1'], ['hello 2\nhello 5\n'], []), # invalid output - second arg is sent as varargs, but needs to be int. llvm optimizer avoided the crash silently, caused undefined behavior... at least people can debug this by running an -O0 build. ]: print opts, expected stdout, stderr = Popen([PYTHON, EMCC, 'src.c'] + opts, stderr=PIPE).communicate() - output = run_js(os.path.join(self.get_dir(), 'a.out.js'), stderr=PIPE, full_output=True) - for e in expected: - self.assertContained(e, output) - for ce in compile_expected + ['''warning: implicit declaration of function 'strnlen' is invalid in C99''', '''warning: incompatible pointer types''']: + for ce in compile_expected + ['''warning: incompatible pointer types''']: self.assertContained(ce, stderr) + if expected is None: + assert not os.path.exists('a.out.js') + else: + output = run_js(os.path.join(self.get_dir(), 'a.out.js'), stderr=PIPE, full_output=True) + for e in expected: + self.assertContained(e, output) + + def test_incorrect_static_call(self): + for opts in [0, 1]: + for asserts in [0, 1]: + extra = [] + if opts != 1-asserts: extra = ['-s', 'ASSERTIONS=' + str(asserts)] + cmd = [PYTHON, EMCC, path_from_root('tests', 'cases', 'sillyfuncast2_noasm.ll'), '-O' + str(opts)] + extra + print cmd + stdout, stderr = Popen(cmd, stderr=PIPE).communicate() + assert ('''unexpected number of arguments 3 in call to 'doit', should be 2''' in stderr) == asserts, stderr + assert ('''unexpected return type i32 in call to 'doit', should be void''' in stderr) == asserts, stderr + assert ('''unexpected argument type float at index 1 in call to 'doit', should be i32''' in stderr) == asserts, stderr diff --git a/tests/worker_api_3_main.cpp b/tests/worker_api_3_main.cpp new file mode 100644 index 00000000..595f99b9 --- /dev/null +++ b/tests/worker_api_3_main.cpp @@ -0,0 +1,44 @@ +#include <stdio.h> +#include <assert.h> +#include <emscripten.h> + +int w1; + +bool sawCalls[] = { false, false, false, false }; + +void c1(char *data, int size, void *arg) { + assert((int)arg == 97); + assert(size >= sizeof(int)); + + int *x = (int*)data; + printf("c1: %d\n", x[0]); + + if (*x >= 0 && *x < 4) { + // Calls should have happened in order. + sawCalls[*x] = true; // Note the call with current param was made + for (int i = 0; i < *x - 1; ++i) { + if (!sawCalls[i]) { + // If we were called out of order, fail this and all following calls. + sawCalls[*x] = false; + break; + } + } + } else { + assert(*x == 4); + // This is the last call. All prior calls should have occurred. + int result = 1; // Final call occurred. + for (int i = 0; i < 4; ++i) + if (sawCalls[i]) result++; + REPORT_RESULT(); + } +} + +int main() { + w1 = emscripten_create_worker("worker.js"); + + int x[1] = { 0 }; + emscripten_call_worker(w1, "one", (char*)x, sizeof(x), c1, (void*)97); + + return 0; +} + diff --git a/tests/worker_api_3_worker.cpp b/tests/worker_api_3_worker.cpp new file mode 100644 index 00000000..db14377a --- /dev/null +++ b/tests/worker_api_3_worker.cpp @@ -0,0 +1,25 @@ +#include <assert.h> +#include <emscripten.h> + +extern "C" { + +// Respond with 0, 1, 2, 3 each with finalResponse=false, and 4 with +// finalResponse=true. +void one(char *data, int size) { + int *x = (int*)data; + + if (*x == 0) { + // Respond 0, 1, 2, 3 + for (int i = 0; i < 4; ++i) { + *x = i; + emscripten_worker_respond_provisionally(data, size); + } + } + + // Respond 4 + *x = 4; + emscripten_worker_respond(data, size); +} + +} + diff --git a/tools/shared.py b/tools/shared.py index ac6319bf..533906c9 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -310,7 +310,8 @@ def check_fastcomp(): seen = False d = os.path.dirname(LLVM_COMPILER) while d != os.path.dirname(d): - if os.path.exists(os.path.join(d, 'emscripten-version.txt')): + # look for version file in llvm repo, making sure not to mistake the emscripten repo for it + if os.path.exists(os.path.join(d, 'emscripten-version.txt')) and not os.path.abspath(d) == os.path.abspath(path_from_root()): seen = True llvm_version = open(os.path.join(d, 'emscripten-version.txt')).read().strip() if os.path.exists(os.path.join(d, 'tools', 'clang', 'emscripten-version.txt')): @@ -365,7 +366,11 @@ 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.12.3' +try: + EMSCRIPTEN_VERSION = open(path_from_root('emscripten-version.txt')).read().strip() +except Exception, e: + logging.error('cannot find emscripten version ' + str(e)) + EMSCRIPTEN_VERSION = 'unknown' def generate_sanity(): return EMSCRIPTEN_VERSION + '|' + get_llvm_target() + '|' + LLVM_ROOT + '|' + get_clang_version() @@ -657,6 +662,15 @@ if LLVM_TARGET != 'asmjs-unknown-emscripten': COMPILER_OPTS += ['-DEMSCRIPTEN', '-D__EMSCRIPTEN__', '-fno-math-errno', '-U__native_client__', '-U__pnacl__', '-U__ELF__'] +# Changes to default clang behavior +if LLVM_TARGET == 'asmjs-unknown-emscripten' or LLVM_TARGET == 'le32-unknown-nacl': + # Implicit functions can cause horribly confusing asm.js function pointer type errors, see #2175 + # If your codebase really needs them - very unrecommended! - you can disable the error with + # -Wno-error=implicit-function-declaration + # or disable even a warning about it with + # -Wno-implicit-function-declaration + COMPILER_OPTS += ['-Werror=implicit-function-declaration'] + USE_EMSDK = not os.environ.get('EMMAKEN_NO_SDK') if USE_EMSDK: |