From 706b4fc47bbc608932d3b491ae19a3b9cde9497b Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 17 Jan 2020 20:45:01 +0000 Subject: Vendor import of llvm-project master e26a78e70, the last commit before the llvmorg-11-init tag, from which release/10.x was branched. --- llvm/tools/llvm-diff/DifferenceEngine.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/tools/llvm-diff/DifferenceEngine.cpp') diff --git a/llvm/tools/llvm-diff/DifferenceEngine.cpp b/llvm/tools/llvm-diff/DifferenceEngine.cpp index bc93ece864900..564ce78705927 100644 --- a/llvm/tools/llvm-diff/DifferenceEngine.cpp +++ b/llvm/tools/llvm-diff/DifferenceEngine.cpp @@ -732,5 +732,14 @@ void DifferenceEngine::diff(Module *L, Module *R) { bool DifferenceEngine::equivalentAsOperands(GlobalValue *L, GlobalValue *R) { if (globalValueOracle) return (*globalValueOracle)(L, R); + + if (isa(L) && isa(R)) { + GlobalVariable *GVL = cast(L); + GlobalVariable *GVR = cast(R); + if (GVL->hasLocalLinkage() && GVL->hasUniqueInitializer() && + GVR->hasLocalLinkage() && GVR->hasUniqueInitializer()) + return GVL->getInitializer() == GVR->getInitializer(); + } + return L->getName() == R->getName(); } -- cgit v1.2.3