aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-05-16 11:00:50 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-05-16 11:00:50 -0700
commitce33f9c21230d619b2b5d42358592f204410eab4 (patch)
treedb3833edea5f4ad5599da9a6060b81946c9d7f20
parentcf2846e05a399598f128db8106a87bc30a8f0c2c (diff)
enable aliasing function pointers by default in -O2
-rwxr-xr-xemcc8
-rwxr-xr-xtests/runner.py2
-rw-r--r--tools/shared.py1
3 files changed, 9 insertions, 2 deletions
diff --git a/emcc b/emcc
index 4315219a..d368a4e5 100755
--- a/emcc
+++ b/emcc
@@ -163,7 +163,10 @@ Options that are modified or new in %s include:
EMCC_OPTIMIZE_NORMALLY=1 (not recommended
unless you know what you are doing!)
-O2 As -O1, plus the relooper (loop recreation),
- plus LLVM -O2 optimizations
+ LLVM -O2 optimizations, and
+
+ -s ALIASING_FUNCTION_POINTERS=1
+
-O3 As -O2, plus dangerous optimizations that may
break the generated code! This adds
@@ -1032,6 +1035,9 @@ try:
shared.Settings.CORRECT_OVERFLOWS = 1
assert not shared.Settings.PGO, 'cannot run PGO in ASM_JS mode'
+ if shared.Settings.ASSERTIONS and shared.Settings.ALIASING_FUNCTION_POINTERS:
+ logging.warning('ALIASING_FUNCTION_POINTERS is on, function pointer comparisons may be invalid across types')
+
if shared.Settings.CORRECT_SIGNS >= 2 or shared.Settings.CORRECT_OVERFLOWS >= 2 or shared.Settings.CORRECT_ROUNDINGS >= 2:
keep_llvm_debug = True # must keep debug info to do line-by-line operations
diff --git a/tests/runner.py b/tests/runner.py
index 65aea50d..b802a68f 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -9415,7 +9415,7 @@ TT = %s
# asm.js
exec('asm1 = make_run("asm1", compiler=CLANG, emcc_args=["-O1", "-s", "CHECK_HEAP_ALIGN=1"])')
- exec('asm2 = make_run("asm2", compiler=CLANG, emcc_args=["-O2", "-s", "ALIASING_FUNCTION_POINTERS=1"])')
+ exec('asm2 = make_run("asm2", compiler=CLANG, emcc_args=["-O2"])')
exec('asm2g = make_run("asm2g", compiler=CLANG, emcc_args=["-O2", "-g", "-s", "ASSERTIONS=1", "--memory-init-file", "1"])')
exec('''asm2x86 = make_run("asm2x86", compiler=CLANG, emcc_args=["-O2", "-g", "-s", "CHECK_HEAP_ALIGN=1"], env='{"EMCC_LLVM_TARGET": "i386-pc-linux-gnu"}')''')
diff --git a/tools/shared.py b/tools/shared.py
index cc056074..228f1253 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -676,6 +676,7 @@ class Settings:
Settings.EMIT_GENERATED_FUNCTIONS = 1
if opt_level >= 2:
Settings.RELOOP = 1
+ Settings.ALIASING_FUNCTION_POINTERS = 1
if opt_level >= 3:
# Aside from these, -O3 also runs closure compiler and llvm lto
Settings.FORCE_ALIGNED_MEMORY = 1