[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Jan 13 22:27:01 PST 2004


Changes in directory llvm/lib/VMCore:

Verifier.cpp updated: 1.76 -> 1.77

---
Log message:

Tighten up verifier checks.  The result of an invoke instruction only
dominates the normal destination, not the exceptional dest (ie, the result
of a call is undefined on an exception)



---
Diffs of the changes:  (+8 -2)

Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.76 llvm/lib/VMCore/Verifier.cpp:1.77
--- llvm/lib/VMCore/Verifier.cpp:1.76	Mon Jan  5 23:33:02 2004
+++ llvm/lib/VMCore/Verifier.cpp	Tue Jan 13 22:25:59 2004
@@ -506,18 +506,24 @@
               "Cannot take the address of an intrinsic!", &I);
 
     else if (Instruction *Op = dyn_cast<Instruction>(I.getOperand(i))) {
+      BasicBlock *OpBlock = Op->getParent();
+      // Invoke results are only usable in the normal destination, not in the
+      // exceptional destination.
+      if (InvokeInst *II = dyn_cast<InvokeInst>(Op))
+        OpBlock = II->getNormalDest();
+
       // Check that a definition dominates all of its uses.
       //
       if (!isa<PHINode>(I)) {
         // Definition must dominate use unless use is unreachable!
-        Assert2(DS->dominates(Op->getParent(), BB) ||
+        Assert2(DS->dominates(OpBlock, BB) ||
                 !DS->dominates(&BB->getParent()->getEntryBlock(), BB),
                 "Instruction does not dominate all uses!", Op, &I);
       } else {
         // PHI nodes are more difficult than other nodes because they actually
         // "use" the value in the predecessor basic blocks they correspond to.
         BasicBlock *PredBB = cast<BasicBlock>(I.getOperand(i+1));
-        Assert2(DS->dominates(Op->getParent(), PredBB) ||
+        Assert2(DS->dominates(OpBlock, PredBB) ||
                 !DS->dominates(&BB->getParent()->getEntryBlock(), PredBB),
                 "Instruction does not dominate all uses!", Op, &I);
       }





More information about the llvm-commits mailing list