From 41af71952606b5d916719365d586b5d544830793 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 13 Dec 2006 04:30:37 +0000 Subject: [PATCH] Reject attempts to define intrinsics. This fixes PR1047 and Regression/Verifier/2006-12-12-IntrinsicDefine.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32529 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Verifier.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 2b9bb6b18b5..38ce2525be7 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -112,6 +112,7 @@ namespace { // Anonymous namespace for class bool runOnFunction(Function &F) { // Get dominator information if we are being run by PassManager if (RealPass) EF = &getAnalysis(); + visit(F); InstsInThisBlock.clear(); @@ -333,6 +334,12 @@ void Verifier::visitFunction(Function &F) { F.getReturnType() == Type::VoidTy, "Functions cannot return aggregate values!", &F); + // Verify that this function (which has a body) is not named "llvm.*". It + // is not legal to define intrinsics. + if (F.getName().size() >= 5) + Assert1(F.getName().substr(0, 5) != "llvm.", + "llvm intrinsics cannot be defined!", &F); + // Check that this function meets the restrictions on this calling convention. switch (F.getCallingConv()) { default: