From d9003e75353416cfcdb9f03d5fba7e1060a35196 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 5 Mar 2014 17:27:17 -0800 Subject: Teach phi translation to also look through bitcasts. This fixes a regression introduced in d95cd364f0c049d6c1b8d78746d44c00ed2f69f2; when regular expression translation looks through bitcasts but phi translation doesn't, phi translation may fail to properly detect dependencies. --- lib/Target/JSBackend/JSBackend.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/Target') diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp index a08e61fbff..5efd4c5684 100644 --- a/lib/Target/JSBackend/JSBackend.cpp +++ b/lib/Target/JSBackend/JSBackend.cpp @@ -521,7 +521,10 @@ std::string JSWriter::getPhiCode(const BasicBlock *From, const BasicBlock *To) { // we found it const std::string &name = getJSName(P); assigns[name] = getAssign(P); - const Value *V = P->getIncomingValue(index); + // Get the operand, and strip pointer casts, since normal expression + // translation also strips pointer casts, and we want to see the same + // thing so that we can detect any resulting dependencies. + const Value *V = P->getIncomingValue(index)->stripPointerCasts(); values[name] = V; std::string vname = getValueAsStr(V); if (const Instruction *VI = dyn_cast(V)) { -- cgit v1.2.3-18-g5258