Index: tools/llvm-diff/DifferenceEngine.cpp =================================================================== --- tools/llvm-diff/DifferenceEngine.cpp +++ tools/llvm-diff/DifferenceEngine.cpp @@ -303,6 +303,26 @@ if (TryUnify) tryUnify(LI->getSuccessor(0), RI->getSuccessor(0)); return false; + } else if (isa(L)) { + IndirectBrInst *LI = cast(L); + IndirectBrInst *RI = cast(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(L)) { SwitchInst *LI = cast(L); SwitchInst *RI = cast(R); @@ -377,9 +397,9 @@ return equivalentAsOperands(cast(L), cast(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(L)) + if (isa(L) || isa(L) || isa(L)) return true; // Block addresses only match if we've already encountered the @@ -388,6 +408,19 @@ return Blocks[cast(L)->getBasicBlock()] == cast(R)->getBasicBlock(); + // If L and R are ConstantVectors, compare each element + if (isa(L)) { + ConstantVector *CVL = cast(L); + ConstantVector *CVR = cast(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; }