do not try to eliminate phi variables, which are unsafe to be removed and the llvm optimizer will remove anyhow if unused

This commit is contained in:
Alon Zakai 2012-12-12 18:55:36 -08:00
Родитель 07ac727a60
Коммит 125256db5c
3 изменённых файлов: 20 добавлений и 2 удалений

Просмотреть файл

@ -6132,4 +6132,12 @@ function _mallocNoU($bytes) {
return $mem_0;
return null;
}
function phi() {
if (wat()) {
var $10 = 1;
} else {
var $10 = (_init_mparams() | 0) != 0;
}
var $10;
}

Просмотреть файл

@ -8828,5 +8828,15 @@ function _mallocNoU($bytes) {
return $mem_0;
return null;
}
// EMSCRIPTEN_GENERATED_FUNCTIONS: ["a", "b", "c", "f", "g", "h", "py", "r", "t", "f2", "f3", "llvm3_1", "_inflate", "_malloc", "_mallocNoU"]
function phi() {
if (wat()) {
var $10 = 1;
} else {
var $7=_init_mparams();
var $8=(($7)|0)!=0;
var $10 = $8;
}
var $10;
}
// EMSCRIPTEN_GENERATED_FUNCTIONS: ["a", "b", "c", "f", "g", "h", "py", "r", "t", "f2", "f3", "llvm3_1", "_inflate", "_malloc", "_mallocNoU", "asm", "phi"]

Просмотреть файл

@ -1464,7 +1464,7 @@ function eliminate(ast, memSafe) {
for (var name in locals) {
if (definitions[name] == 1 && uses[name] == 1) {
potentials[name] = 1;
} else if (uses[name] == 0) {
} else if (uses[name] == 0 && (!definitions[name] || definitions[name] <= 1)) { // no uses, no def or 1 def (cannot operate on phis, and the llvm optimizer will remove unneeded phis anyhow)
var hasSideEffects = false;
if (values[name]) {
traverse(values[name], function(node, type) {