Skip to content

invalid TLS with -relocation-model=pic -regalloc=local #4376

@llvmbot

Description

@llvmbot
Bugzilla Link 4004
Resolution FIXED
Resolved on Apr 24, 2009 08:02
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @asl,@lattner,@sunfishcode

Extended Description

Compiling

@​a = thread_local global i32 0 ; <i32*> [#uses=2]

define void @​f(i32* nocapture %c, i32* nocapture %d) nounwind optsize {
entry:
%0 = load i32* @​a, align 4 ; [#uses=1]
store i32 %0, i32* %c, align 4
%1 = load i32* @​a, align 4 ; [#uses=1]
store i32 %1, i32* %d, align 4
ret void
}

with llc -relocation-model=pic -regalloc=local produces

    .byte   0x66; leaq      a@TLSGD(%rip), %rdi; .word      0x6666; rex64
    movq    %rax, -8(%rsp)
    movq    %rcx, -16(%rsp)
    call    __tls_get_addr@PLT

This is invalid. The call must be just after the rex64.

I think this is a more general problem with the local register allocator. It is inserting spills between two instructions linked by a flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions