Make the JIT zero out globals with memset instead of an element at a time. This
authorChris Lattner <sabre@nondot.org>
Sun, 15 Feb 2004 05:54:06 +0000 (05:54 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 15 Feb 2004 05:54:06 +0000 (05:54 +0000)
should speed it up a bit on a lot of programs

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11472 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/ExecutionEngine.cpp

index 665b5c6273766271d570cb5fe1e03fd1ed7d6cf6..4e45bfa24ec5d876fd7fe0f0a122b3293223a80c 100644 (file)
@@ -406,6 +406,10 @@ void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) {
     GenericValue Val = getConstantValue(Init);
     StoreValueToMemory(Val, (GenericValue*)Addr, Init->getType());
     return;
+  } else if (isa<ConstantAggregateZero>(Init)) {
+    unsigned Size = getTargetData().getTypeSize(Init->getType());
+    memset(Addr, 0, Size);
+    return;
   }
 
   switch (Init->getType()->getPrimitiveID()) {