diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-02-27 10:47:14 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-02-27 10:47:14 -0800 |
commit | ad068bc5fd5d19f5f48d69d3a39d8aacbbd26e85 (patch) | |
tree | 3d7e8421a17338909875151b28511c3f45cb0c96 /lib | |
parent | 065e2bbb1254768cba1a9f39f5ce847c198cf058 (diff) |
emit assigns only for variables actually used
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/JSBackend/JSBackend.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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<Instruction>(V)) - return getAssign(I); + if (const Instruction *I = dyn_cast<Instruction>(V)) { + if (I->getNumUses() > 0) return getAssign(I); + } return std::string(); } |