[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp InstLoops.cpp ProfilePaths.cpp

Jeff Cohen jeffc at jolt-lang.org
Sat Oct 22 21:37:39 PDT 2005



Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths:

EdgeCode.cpp updated: 1.30 -> 1.31
InstLoops.cpp updated: 1.21 -> 1.22
ProfilePaths.cpp updated: 1.43 -> 1.44
---
Log message:

When a function takes a variable number of pointer arguments, with a zero
pointer marking the end of the list, the zero *must* be cast to the pointer
type.  An un-cast zero is a 32-bit int, and at least on x86_64, gcc will
not extend the zero to 64 bits, thus allowing the upper 32 bits to be
random junk.

The new END_WITH_NULL macro may be used to annotate a such a function
so that GCC (version 4 or newer) will detect the use of un-casted zero
at compile time.


---
Diffs of the changes:  (+5 -3)

 EdgeCode.cpp     |    2 +-
 InstLoops.cpp    |    3 ++-
 ProfilePaths.cpp |    3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.30 llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.31
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.30	Sat Apr 23 16:38:35 2005
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp	Sat Oct 22 23:37:20 2005
@@ -40,7 +40,7 @@
   const Type *PIntTy = PointerType::get(Type::IntTy);
   Function *trigMeth = M->getOrInsertFunction("trigger", Type::VoidTy,
                                               Type::IntTy, Type::IntTy,
-                                              PIntTy, PIntTy, 0);
+                                              PIntTy, PIntTy, (Type *)0);
   assert(trigMeth && "trigger method could not be inserted!");
 
   vector<Value *> trargs;


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.21 llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.22
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.21	Sat Apr 23 16:38:35 2005
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp	Sat Oct 22 23:37:20 2005
@@ -156,7 +156,8 @@
 }
 
 bool InstLoops::doInitialization (Module &M) {
-  inCountMth = M.getOrInsertFunction("llvm_first_trigger", Type::VoidTy, 0);
+  inCountMth = M.getOrInsertFunction("llvm_first_trigger", Type::VoidTy,
+                                     (Type *)0);
   return true;  // Module was modified.
 }
 


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.43 llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.44
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.43	Thu Apr 21 18:40:47 2005
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp	Sat Oct 22 23:37:20 2005
@@ -189,7 +189,8 @@
     // IN THEIR INITIALIZE METHOD!!
     Function *initialize =
       F.getParent()->getOrInsertFunction("reoptimizerInitialize", Type::VoidTy,
-                                         PointerType::get(Type::IntTy), 0);
+                                         PointerType::get(Type::IntTy),
+                                         (Type *)0);
 
     std::vector<Value *> trargs;
     trargs.push_back(threshold);






More information about the llvm-commits mailing list