[LLVMdev] thread_local

Bram Adams bram.adams at ugent.be
Wed Jul 11 02:34:15 PDT 2007


Hi,

This weekend, I've noticed that GlobalVariable's could be declared as  
thread-local in LLVM 2.0. However, when using it on a small example  
(OSX), I got the following error:

=========

Cannot yet select: 0x56059f0: i32 = GlobalTLSAddress <i32* @a> 0
Abort trap

=========

This is the example code:

=========

; ModuleID = 'test.o'
target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32- 
i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0
:64"
target triple = "powerpc-apple-darwin8.9.0"
@a = thread_local global i32 666                ; <i32*> [#uses=2]

define i32 @main() {
entry:
         %retval = alloca i32, align 4           ; <i32*> [#uses=1]
         "alloca point" = bitcast i32 0 to i32           ; <i32>  
[#uses=0]
         %tmp = load i32* @a             ; <i32> [#uses=1]
         %tmp1 = add i32 %tmp, 1         ; <i32> [#uses=1]
         store i32 %tmp1, i32* @a
         br label %return

return:         ; preds = %entry
         %retval2 = load i32* %retval            ; <i32> [#uses=1]
         ret i32 %retval2
}

=========

Is this a bug or an as yet unimplemented feature (on OSX)?

Kind regards,

Bram Adams
GH-SEL, INTEC, Ghent University (Belgium)



More information about the llvm-dev mailing list