From ad068bc5fd5d19f5f48d69d3a39d8aacbbd26e85 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 27 Feb 2014 10:47:14 -0800 Subject: emit assigns only for variables actually used --- lib/Target/JSBackend/JSBackend.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp index 5074378efb..da28c26e4b 100644 --- a/lib/Target/JSBackend/JSBackend.cpp +++ b/lib/Target/JSBackend/JSBackend.cpp @@ -581,8 +581,9 @@ std::string JSWriter::getAssign(const Instruction *I) { } std::string JSWriter::getAssignIfNeeded(const Value *V) { - if (const Instruction *I = dyn_cast(V)) - return getAssign(I); + if (const Instruction *I = dyn_cast(V)) { + if (I->getNumUses() > 0) return getAssign(I); + } return std::string(); } -- cgit v1.2.3-18-g5258