diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-09-11 17:05:29 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-09-11 17:05:29 +0000 |
| commit | 7730dcc858e6d9828f0321168e55177b0db992d1 (patch) | |
| tree | 47d6119013b9e73a000a87e2148b8777e845122a /llvm | |
| parent | e54242dc021f6b17f992320c721e9d9eea3a9099 (diff) | |
| download | bcm5719-llvm-7730dcc858e6d9828f0321168e55177b0db992d1.tar.gz bcm5719-llvm-7730dcc858e6d9828f0321168e55177b0db992d1.zip | |
reject attempts to take the address of an intrinsic, PR4949.
llvm-svn: 81530
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/VMCore/Verifier.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp index 5d9d7ad2bf6..d31e6cb5120 100644 --- a/llvm/lib/VMCore/Verifier.cpp +++ b/llvm/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... |

