From f65dcba83ce5035ab88a85fe17628b447eb56e1b Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 2 Dec 2021 22:02:54 +0100 Subject: Vendor import of llvm-project main llvmorg-14-init-11187-g222442ec2d71. --- llvm/tools/llvm-diff/lib/DifferenceEngine.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'llvm/tools/llvm-diff/lib/DifferenceEngine.cpp') 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(L)) { return diffCallSites(cast(*L), cast(*R), Complain); } else if (isa(L)) { - // FIXME: implement. + const PHINode &LI = cast(*L); + const PHINode &RI = cast(*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. -- cgit v1.2.3