aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cases/longjmp_tiny_invoke_phi.ll46
-rw-r--r--tests/cases/longjmp_tiny_invoke_phi.txt4
-rw-r--r--tests/test_core.py2
-rw-r--r--tests/test_other.py2
4 files changed, 52 insertions, 2 deletions
diff --git a/tests/cases/longjmp_tiny_invoke_phi.ll b/tests/cases/longjmp_tiny_invoke_phi.ll
new file mode 100644
index 00000000..30c43339
--- /dev/null
+++ b/tests/cases/longjmp_tiny_invoke_phi.ll
@@ -0,0 +1,46 @@
+; ModuleID = '/tmp/emscripten_temp/src.cpp.o'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"
+target triple = "i386-pc-linux-gnu"
+
+@_ZL3buf = internal global [20 x i16] zeroinitializer, align 2
+@.str = private unnamed_addr constant [13 x i8] c"hello world\0A\00", align 1
+@.str1 = private unnamed_addr constant [6 x i8] c"more\0A\00", align 1
+@.str2 = private unnamed_addr constant [6 x i8] c"fair\0A\00", align 1
+
+define i32 @main() {
+entry:
+ %retval = alloca i32, align 4
+ store i32 0, i32* %retval
+ %call = invoke i32 @setjmp(i16* getelementptr inbounds ([20 x i16]* @_ZL3buf, i32 0, i32 0)) returns_twice
+ to label %allgood unwind label %awful
+
+allgood:
+ %p = phi i32 [0, %entry], [1, %if.else]
+ %calll = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str2, i32 0, i32 0))
+ %total = add i32 %p, %call
+ %tobool = icmp ne i32 %total, 10
+ br i1 %tobool, label %if.then, label %if.else
+
+if.then: ; preds = %entry
+ %call1 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([13 x i8]* @.str, i32 0, i32 0))
+ call void @longjmp(i16* getelementptr inbounds ([20 x i16]* @_ZL3buf, i32 0, i32 0), i32 10)
+ br label %if.end
+
+if.else: ; preds = %entry
+ %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str1, i32 0, i32 0))
+ %chak = icmp ne i32 %call2, 1337
+ br i1 %chak, label %if.end, label %allgood
+
+if.end: ; preds = %if.else, %if.then
+ ret i32 0
+
+awful:
+ ret i32 1
+}
+
+declare i32 @setjmp(i16*) returns_twice
+
+declare i32 @printf(i8*, ...)
+
+declare void @longjmp(i16*, i32)
+
diff --git a/tests/cases/longjmp_tiny_invoke_phi.txt b/tests/cases/longjmp_tiny_invoke_phi.txt
new file mode 100644
index 00000000..aaa41d11
--- /dev/null
+++ b/tests/cases/longjmp_tiny_invoke_phi.txt
@@ -0,0 +1,4 @@
+fair
+hello world
+fair
+more
diff --git a/tests/test_core.py b/tests/test_core.py
index e61f5c35..9e52792c 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -5032,7 +5032,7 @@ def process(filename):
'structphiparam', 'callwithstructural_ta2', 'callwithstructural64_ta2', 'structinparam', # pnacl limitations in ExpandStructRegs
'2xi40', # pnacl limitations in ExpandGetElementPtr
'legalizer_ta2', '514_ta2', # pnacl limitation in not legalizing i104, i96, etc.
- 'longjmp_tiny', 'longjmp_tiny_invoke', 'longjmp_tiny_phi', 'longjmp_tiny_phi2', 'indirectbrphi', 'ptrtoint_blockaddr', 'quoted', # current fastcomp limitations FIXME
+ 'longjmp_tiny', 'longjmp_tiny_invoke', 'longjmp_tiny_phi', 'longjmp_tiny_phi2', 'longjmp_tiny_invoke_phi', 'indirectbrphi', 'ptrtoint_blockaddr', 'quoted', # current fastcomp limitations FIXME
'sillyfuncast', 'sillyfuncast2', 'sillybitcast', 'atomicrmw_unaligned' # TODO XXX
]: continue
if '_ta2' in shortname and not Settings.USE_TYPED_ARRAYS == 2:
diff --git a/tests/test_other.py b/tests/test_other.py
index eb9bd23d..43bd3025 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -1165,7 +1165,7 @@ f.close()
''')
Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp'), '--js-library', os.path.join(self.get_dir(), 'mylib1.js'),
- '--js-library', os.path.join(self.get_dir(), 'mylib2.js')]).communicate()
+ '--js-library', os.path.join(self.get_dir(), 'mylib2.js')]).communicate()
self.assertContained('hello from lib!\n*32*\n', run_js(os.path.join(self.get_dir(), 'a.out.js')))
def test_identical_basenames(self):