From 2894327d8f947cc9a266946abf18e19abe2c072e Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 25 Jul 2014 14:17:30 -0700 Subject: [PATCH 1/3] Ignore llvm.global.annotations attributes. --- lib/Target/JSBackend/JSBackend.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp index 0048795d9b5..432cc07473c 100644 --- a/lib/Target/JSBackend/JSBackend.cpp +++ b/lib/Target/JSBackend/JSBackend.cpp @@ -2187,7 +2187,10 @@ void JSWriter::parseConstant(const std::string& name, const Constant* CV, bool c } else if (const ConstantArray *CA = dyn_cast(CV)) { if (calculate) { for (Constant::const_use_iterator UI = CV->use_begin(), UE = CV->use_end(); UI != UE; ++UI) { - assert((*UI)->getName() == "llvm.used"); // llvm.used is acceptable (and can be ignored) + // llvm.used and llvm.global.annotations are acceptable (and can be + // ignored). + assert((*UI)->getName() == "llvm.used" || + (*UI)->getName() == "llvm.global.annotations"); } // export the kept-alives for (unsigned i = 0; i < CA->getNumOperands(); i++) { From f805b9ab25b587c87b5417181a4ab7a146a43277 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 26 Jul 2014 11:43:11 -0700 Subject: [PATCH 2/3] fix ignoring of llvm.annotations --- lib/Target/JSBackend/JSBackend.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp index 432cc07473c..1537cdae5a8 100644 --- a/lib/Target/JSBackend/JSBackend.cpp +++ b/lib/Target/JSBackend/JSBackend.cpp @@ -2187,18 +2187,21 @@ void JSWriter::parseConstant(const std::string& name, const Constant* CV, bool c } else if (const ConstantArray *CA = dyn_cast(CV)) { if (calculate) { for (Constant::const_use_iterator UI = CV->use_begin(), UE = CV->use_end(); UI != UE; ++UI) { - // llvm.used and llvm.global.annotations are acceptable (and can be - // ignored). - assert((*UI)->getName() == "llvm.used" || - (*UI)->getName() == "llvm.global.annotations"); - } - // export the kept-alives - for (unsigned i = 0; i < CA->getNumOperands(); i++) { - const Constant *C = CA->getOperand(i); - if (const ConstantExpr *CE = dyn_cast(C)) { - C = CE->getOperand(0); // ignore bitcasts + if ((*UI)->getName() == "llvm.used") { + // export the kept-alives + for (unsigned i = 0; i < CA->getNumOperands(); i++) { + const Constant *C = CA->getOperand(i); + if (const ConstantExpr *CE = dyn_cast(C)) { + C = CE->getOperand(0); // ignore bitcasts + } + Exports.push_back(getJSName(C)); + } + } else if ((*UI)->getName() == "llvm.global.annotations") { + // llvm.global.annotations can be ignored. + } else { + llvm_unreachable("Unexpected constant array"); } - Exports.push_back(getJSName(C)); + break; // we assume one use here } } } else if (const ConstantStruct *CS = dyn_cast(CV)) { From 579ef8169cd273080902faf4f2c11dfa78ebc3d1 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 28 Jul 2014 13:26:48 -0700 Subject: [PATCH 3/3] remove type_info hacks; 1.21.8 --- emscripten-version.txt | 2 +- lib/Target/JSBackend/JSBackend.cpp | 19 ------------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/emscripten-version.txt b/emscripten-version.txt index 8b65a411073..db98d22c01c 100644 --- a/emscripten-version.txt +++ b/emscripten-version.txt @@ -1,2 +1,2 @@ -1.21.7 +1.21.8 diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp index 1537cdae5a8..162e0653139 100644 --- a/lib/Target/JSBackend/JSBackend.cpp +++ b/lib/Target/JSBackend/JSBackend.cpp @@ -241,25 +241,6 @@ namespace { "count=" + Twine(a.first) + " " "elementsize=" + Twine(a.second)); } - if (s == "_ZTVN10__cxxabiv119__pointer_type_infoE" || - s == "_ZTVN10__cxxabiv117__class_type_infoE" || - s == "_ZTVN10__cxxabiv120__si_class_type_infoE" || - s == "_ZTIi" || - s == "_ZTIj" || - s == "_ZTIl" || - s == "_ZTIm" || - s == "_ZTIx" || - s == "_ZTIy" || - s == "_ZTIf" || - s == "_ZTId" || - s == "_ZTIe" || - s == "_ZTIc" || - s == "_ZTIa" || - s == "_ZTIh" || - s == "_ZTIs" || - s == "_ZTIt") { - NamedGlobals[s] = Ret; - } return Ret; } // returns the internal offset inside the proper block: GlobalData8, 32, 64