[LLVMdev] How to not zeroinitialize array

Russell Hadley rhadley at microsoft.com
Tue Jul 21 13:31:40 PDT 2015


Hi,

I'm trying to do a proof of concept of compiling some code down to a very simple runtime that doesn't provide support for zeroinitialize.  If I run the below code through llc:

; ModuleID = '.\t.bc'
target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
target triple = "i686-pc-windows-gnu"

@_ZN3Foo11ZeroAndZeroE = global [2 x i32] [i32 0, i32 0], align 4

!llvm.ident = !{!0}

!0 = !{!"clang version 3.6.0 (tags/RELEASE_360/final)"}

It turns into this:

; ModuleID = '.\t.ll'
target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
target triple = "i686-pc-windows-gnu"

@_ZN3Foo11ZeroAndZeroE = global [2 x i32] zeroinitializer, align 4

!llvm.ident = !{!0}

!0 = !{!"clang version 3.6.0 (tags/RELEASE_360/final)"}

My question is where is this transform happening - it looks like it's a byproduct of parsing the ll file which was super surprising to me.  And second is there a know what to circumvent this?  For my app I just want the zero'd space in the section so I can copy it into memory.

Thanks,

-R
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150721/b55d4235/attachment.html>


More information about the llvm-dev mailing list