LLVMBuild: Add description files for the LLVM tools.
[oota-llvm.git] / tools / llvm-diff / DifferenceEngine.cpp
index 2344e398b08ecafdd9e0bcf5e7d2ab35d17a608e..435cd87fa7614bd90ac1ddec80ca8c0542a4fd30 100644 (file)
@@ -195,12 +195,12 @@ class FunctionDifferenceEngine {
     DifferenceEngine::Context C(Engine, L, R);
 
     BasicBlock::iterator LI = L->begin(), LE = L->end();
-    BasicBlock::iterator RI = R->begin(), RE = R->end();
+    BasicBlock::iterator RI = R->begin();
 
     llvm::SmallVector<std::pair<Instruction*,Instruction*>, 20> TentativePairs;
 
     do {
-      assert(LI != LE && RI != RE);
+      assert(LI != LE && RI != R->end());
       Instruction *LeftI = &*LI, *RightI = &*RI;
 
       // If the instructions differ, start the more sophisticated diff
@@ -267,7 +267,7 @@ class FunctionDifferenceEngine {
     } else if (isa<PHINode>(L)) {
       // FIXME: implement.
 
-      // This is really wierd;  type uniquing is broken?
+      // This is really weird;  type uniquing is broken?
       if (L->getType() != R->getType()) {
         if (!L->getType()->isPointerTy() || !R->getType()->isPointerTy()) {
           if (Complain) Engine.log("different phi types");
@@ -327,7 +327,7 @@ class FunctionDifferenceEngine {
         if (LCase) {
           if (TryUnify) tryUnify(LCase, RI->getSuccessor(I));
           LCases.erase(CaseValue);
-        } else if (!Difference) {
+        } else if (Complain || !Difference) {
           if (Complain)
             Engine.logf("right switch has extra case %r") << CaseValue;
           Difference = true;