aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-09-11 17:05:29 +0000
committerChris Lattner <sabre@nondot.org>2009-09-11 17:05:29 +0000
commit13202deca6e68779a4884174d84a5abc35e8c885 (patch)
treea2b440e9979118b77de114111d82c05a99174b01
parent50b957549b9657d7181bebada1e534e91b38a823 (diff)
reject attempts to take the address of an intrinsic, PR4949.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81530 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/Verifier.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 5d9d7ad2bf..d31e6cb512 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -638,6 +638,18 @@ void Verifier::visitFunction(Function &F) {
Assert1(pred_begin(Entry) == pred_end(Entry),
"Entry block to function must not have predecessors!", Entry);
}
+
+ // If this function is actually an intrinsic, verify that it is only used in
+ // direct call/invokes, never having its "address taken".
+ if (F.getIntrinsicID()) {
+ for (Value::use_iterator UI = F.use_begin(), E = F.use_end(); UI != E;++UI){
+ User *U = cast<User>(UI);
+ if ((isa<CallInst>(U) || isa<InvokeInst>(U)) && UI.getOperandNo() == 0)
+ continue; // Direct calls/invokes are ok.
+
+ Assert1(0, "Invalid user of intrinsic instruction!", U);
+ }
+ }
}
// verifyBasicBlock - Verify that a basic block is well formed...