diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 10:51:19 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 10:51:19 +0000 |
commit | eb11fae6d08f479c0799db45860a98af528fa6e7 (patch) | |
tree | 44d492a50c8c1a7eb8e2d17ea3360ec4d066f042 /tools/llvm-diff | |
parent | b8a2042aa938069e862750553db0e4d82d25822c (diff) | |
download | src-test2-eb11fae6d08f479c0799db45860a98af528fa6e7.tar.gz src-test2-eb11fae6d08f479c0799db45860a98af528fa6e7.zip |
Notes
Diffstat (limited to 'tools/llvm-diff')
-rw-r--r-- | tools/llvm-diff/DifferenceEngine.cpp | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/tools/llvm-diff/DifferenceEngine.cpp b/tools/llvm-diff/DifferenceEngine.cpp index 95a63d7f9c83..af0a055ea21f 100644 --- a/tools/llvm-diff/DifferenceEngine.cpp +++ b/tools/llvm-diff/DifferenceEngine.cpp @@ -303,6 +303,26 @@ class FunctionDifferenceEngine { if (TryUnify) tryUnify(LI->getSuccessor(0), RI->getSuccessor(0)); return false; + } else if (isa<IndirectBrInst>(L)) { + IndirectBrInst *LI = cast<IndirectBrInst>(L); + IndirectBrInst *RI = cast<IndirectBrInst>(R); + if (LI->getNumDestinations() != RI->getNumDestinations()) { + if (Complain) Engine.log("indirectbr # of destinations differ"); + return true; + } + + if (!equivalentAsOperands(LI->getAddress(), RI->getAddress())) { + if (Complain) Engine.log("indirectbr addresses differ"); + return true; + } + + if (TryUnify) { + for (unsigned i = 0; i < LI->getNumDestinations(); i++) { + tryUnify(LI->getDestination(i), RI->getDestination(i)); + } + } + return false; + } else if (isa<SwitchInst>(L)) { SwitchInst *LI = cast<SwitchInst>(L); SwitchInst *RI = cast<SwitchInst>(R); @@ -377,9 +397,9 @@ class FunctionDifferenceEngine { return equivalentAsOperands(cast<ConstantExpr>(L), cast<ConstantExpr>(R)); - // Nulls of the "same type" don't always actually have the same + // Constants of the "same type" don't always actually have the same // type; I don't know why. Just white-list them. - if (isa<ConstantPointerNull>(L)) + if (isa<ConstantPointerNull>(L) || isa<UndefValue>(L) || isa<ConstantAggregateZero>(L)) return true; // Block addresses only match if we've already encountered the @@ -388,6 +408,19 @@ class FunctionDifferenceEngine { return Blocks[cast<BlockAddress>(L)->getBasicBlock()] == cast<BlockAddress>(R)->getBasicBlock(); + // If L and R are ConstantVectors, compare each element + if (isa<ConstantVector>(L)) { + ConstantVector *CVL = cast<ConstantVector>(L); + ConstantVector *CVR = cast<ConstantVector>(R); + if (CVL->getType()->getNumElements() != CVR->getType()->getNumElements()) + return false; + for (unsigned i = 0; i < CVL->getType()->getNumElements(); i++) { + if (!equivalentAsOperands(CVL->getOperand(i), CVR->getOperand(i))) + return false; + } + return true; + } + return false; } |