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

Chris Lattner sabre at nondot.org
Tue Dec 12 20:30:52 PST 2006



Changes in directory llvm/lib/VMCore:

Verifier.cpp updated: 1.171 -> 1.172
---
Log message:

Reject attempts to define intrinsics.  This fixes PR1047: http://llvm.org/PR1047  and
Regression/Verifier/2006-12-12-IntrinsicDefine.ll


---
Diffs of the changes:  (+7 -0)

 Verifier.cpp |    7 +++++++
 1 files changed, 7 insertions(+)


Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.171 llvm/lib/VMCore/Verifier.cpp:1.172
--- llvm/lib/VMCore/Verifier.cpp:1.171	Thu Dec  7 17:41:45 2006
+++ llvm/lib/VMCore/Verifier.cpp	Tue Dec 12 22:30:37 2006
@@ -112,6 +112,7 @@
     bool runOnFunction(Function &F) {
       // Get dominator information if we are being run by PassManager
       if (RealPass) EF = &getAnalysis<ETForest>();
+      
       visit(F);
       InstsInThisBlock.clear();
 
@@ -333,6 +334,12 @@
           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:






More information about the llvm-commits mailing list