aboutsummaryrefslogtreecommitdiff
path: root/tools/eliminator
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-05-07 18:54:03 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-05-07 18:54:03 -0700
commit4ead9dad30c559f0d342c592633d3ad73d8b1bd3 (patch)
treea765cc1304aa930dbef8ac6734ca243bb831ec41 /tools/eliminator
parent536ab4dd3bb1f889cc434f730dd500321d9313fb (diff)
recognize the double-to-i64 bitcast pattern as having no side effects in eliminator
Diffstat (limited to 'tools/eliminator')
-rw-r--r--tools/eliminator/asm-eliminator-test-output.js4
-rw-r--r--tools/eliminator/asm-eliminator-test.js10
2 files changed, 13 insertions, 1 deletions
diff --git a/tools/eliminator/asm-eliminator-test-output.js b/tools/eliminator/asm-eliminator-test-output.js
index 4cd9cbaa..b519cdf9 100644
--- a/tools/eliminator/asm-eliminator-test-output.js
+++ b/tools/eliminator/asm-eliminator-test-output.js
@@ -129,4 +129,8 @@ function confuusion() {
j = i;
func2(+j);
}
+function tempDouble(a) {
+ a = +a;
+ f(a * a);
+}
diff --git a/tools/eliminator/asm-eliminator-test.js b/tools/eliminator/asm-eliminator-test.js
index 9dc71835..ff67af47 100644
--- a/tools/eliminator/asm-eliminator-test.js
+++ b/tools/eliminator/asm-eliminator-test.js
@@ -162,5 +162,13 @@ function confuusion() {
var j = i; // add this var in the middle. should show up with right type later, auto-inferred from i's type
func2(+j);
}
-// EMSCRIPTEN_GENERATED_FUNCTIONS: ["asm", "__Z11printResultPiS_j", "_segment_holding", "__ZN5identC2EiPKcPci", "_vec2Length", "exc", "label", "confuusion"]
+function tempDouble(a) {
+ a = +a;
+ var x = +0, y = +0;
+ // CastAway can leave things like this as variables no longer needed. We need to identify that x's value has no side effects so it can be completely cleaned up
+ x = (HEAP32[((tempDoublePtr)>>2)]=((HEAP32[(($_sroa_0_0__idx1)>>2)])|0),HEAP32[(((tempDoublePtr)+(4))>>2)]=((HEAP32[((($_sroa_0_0__idx1)+(4))>>2)])|0),(+(HEAPF64[(tempDoublePtr)>>3])));
+ y = a*a;
+ f(y);
+}
+// EMSCRIPTEN_GENERATED_FUNCTIONS: ["asm", "__Z11printResultPiS_j", "_segment_holding", "__ZN5identC2EiPKcPci", "_vec2Length", "exc", "label", "confuusion", "tempDouble"]