diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2021-12-02 21:02:54 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2021-12-02 21:02:54 +0000 |
commit | f65dcba83ce5035ab88a85fe17628b447eb56e1b (patch) | |
tree | 35f37bb72b3cfc6060193e66c76ee7c9478969b0 /llvm/tools/llvm-diff/lib/DifferenceEngine.cpp | |
parent | 846a2208a8ab099f595fe7e8b2e6d54a7b5e67fb (diff) |
Diffstat (limited to 'llvm/tools/llvm-diff/lib/DifferenceEngine.cpp')
-rw-r--r-- | llvm/tools/llvm-diff/lib/DifferenceEngine.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/llvm/tools/llvm-diff/lib/DifferenceEngine.cpp b/llvm/tools/llvm-diff/lib/DifferenceEngine.cpp index eb746cd2a865..4bdefcdc1758 100644 --- a/llvm/tools/llvm-diff/lib/DifferenceEngine.cpp +++ b/llvm/tools/llvm-diff/lib/DifferenceEngine.cpp @@ -269,15 +269,35 @@ class FunctionDifferenceEngine { } else if (isa<CallInst>(L)) { return diffCallSites(cast<CallInst>(*L), cast<CallInst>(*R), Complain); } else if (isa<PHINode>(L)) { - // FIXME: implement. + const PHINode &LI = cast<PHINode>(*L); + const PHINode &RI = cast<PHINode>(*R); // This is really weird; type uniquing is broken? - if (L->getType() != R->getType()) { - if (!L->getType()->isPointerTy() || !R->getType()->isPointerTy()) { + if (LI.getType() != RI.getType()) { + if (!LI.getType()->isPointerTy() || !RI.getType()->isPointerTy()) { if (Complain) Engine.log("different phi types"); return true; } } + + if (LI.getNumIncomingValues() != RI.getNumIncomingValues()) { + if (Complain) + Engine.log("PHI node # of incoming values differ"); + return true; + } + + for (unsigned I = 0; I < LI.getNumIncomingValues(); ++I) { + if (TryUnify) + tryUnify(LI.getIncomingBlock(I), RI.getIncomingBlock(I)); + + if (!equivalentAsOperands(LI.getIncomingValue(I), + RI.getIncomingValue(I))) { + if (Complain) + Engine.log("PHI node incoming values differ"); + return true; + } + } + return false; // Terminators. |