about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-02-21 04:36:46 +0000
committerbors <bors@rust-lang.org>2017-02-21 04:36:46 +0000
commit3954c70537cc78dc4a8e28c6ffa0a8ae5198387a (patch)
tree4bdbf803a3e02022aa24cef4c873df79a98a51a5
parenta17e5e2949db53c9c1e3a697e41c254e31c0bdf3 (diff)
parent275e9bb51b61c685f39abb107d2eefb8b8e8515d (diff)
downloadrust-3954c70537cc78dc4a8e28c6ffa0a8ae5198387a.tar.gz
rust-3954c70537cc78dc4a8e28c6ffa0a8ae5198387a.zip
Auto merge of #39990 - CryZe:emscripten-no-vectorization, r=alexcrichton
Turn off Vectorization for Emscripten

When targeting Emscripten, rustc emits Vector Instructions by default. However Web Assembly doesn't support Vector Instructions yet, which causes Binaryen to fail converting the intermediate asm.js code to Web Assembly. While asm.js kind of supports Vector Instructions, they aren't supported by any browser other than Firefox, often meaning that they need to be emulated very slowly. So it should just be turned off
for all Emscripten targets.

Fixes #38558
-rw-r--r--src/librustc_trans/back/write.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs
index b717254ef0d..40a69721495 100644
--- a/src/librustc_trans/back/write.rs
+++ b/src/librustc_trans/back/write.rs
@@ -315,11 +315,15 @@ impl ModuleConfig {
         // Copy what clang does by turning on loop vectorization at O2 and
         // slp vectorization at O3. Otherwise configure other optimization aspects
         // of this pass manager builder.
+        // Turn off vectorization for emscripten, as it's not very well supported.
         self.vectorize_loop = !sess.opts.cg.no_vectorize_loops &&
                              (sess.opts.optimize == config::OptLevel::Default ||
-                              sess.opts.optimize == config::OptLevel::Aggressive);
+                              sess.opts.optimize == config::OptLevel::Aggressive) &&
+                             !sess.target.target.options.is_like_emscripten;
+
         self.vectorize_slp = !sess.opts.cg.no_vectorize_slp &&
-                            sess.opts.optimize == config::OptLevel::Aggressive;
+                            sess.opts.optimize == config::OptLevel::Aggressive &&
+                            !sess.target.target.options.is_like_emscripten;
 
         self.merge_functions = sess.opts.optimize == config::OptLevel::Default ||
                                sess.opts.optimize == config::OptLevel::Aggressive;