aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-01-14 04:25:59 +0000
committerChris Lattner <sabre@nondot.org>2004-01-14 04:25:59 +0000
commit30768ac3c2395d5b2047ec84e1b8f4330ba2658f (patch)
tree1928726bbf2ba3360e711a50f7616128adf105c6 /lib/VMCore
parent0cccb18c98ac83e0166eebf9c4192c6998aabf39 (diff)
downloadexternal_llvm-30768ac3c2395d5b2047ec84e1b8f4330ba2658f.zip
external_llvm-30768ac3c2395d5b2047ec84e1b8f4330ba2658f.tar.gz
external_llvm-30768ac3c2395d5b2047ec84e1b8f4330ba2658f.tar.bz2
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) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10841 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Verifier.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index c2e3d9a..a9bcbd5 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -506,18 +506,24 @@ void Verifier::visitInstruction(Instruction &I) {
"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);
}