diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-24 15:03:48 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-24 15:03:48 -0800 |
commit | 3750b7d55dc655b4be9b34e210e76a5ac38d6686 (patch) | |
tree | 90ebe1f671f51437059aeeb9d96c7e76f1c3eb49 | |
parent | 32f7fbfce3948e52246489458fc184183b1d2753 (diff) |
fix phi cycle detection getting confused by non-relevant values
-rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 4244c2689e..35f679185d 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -330,9 +330,11 @@ std::string JSWriter::getPhiCode(const BasicBlock *From, const BasicBlock *To) { Value *V = P->getIncomingValue(index); values[name] = V; std::string vname = getValueAsStr(V); - if (!dyn_cast<Constant>(V)) { - deps[name] = vname; - undeps[vname] = name; + if (const Instruction *VI = dyn_cast<const Instruction>(V)) { + if (VI->getParent() == To) { + deps[name] = vname; + undeps[vname] = name; + } } } // Emit assignments+values, taking into account dependencies, and breaking cycles |