1 ; Testcase generated from the following code:
2 ; extern __thread int i;
11 ; We want to make sure that TLS variables are not accessed before
12 ; the stack frame is set up.
14 ; RUN: llc < %s -relocation-model=pic | FileCheck %s
16 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
17 target triple = "x86_64-unknown-freebsd11.0"
19 @i = external thread_local global i32, align 4
23 %tmp = load i32, ptr @i, align 4
24 %tobool = icmp eq i32 %tmp, 0
25 br i1 %tobool, label %if.end, label %if.then
27 if.then: ; preds = %entry
28 store i32 0, ptr @i, align 4
29 tail call void (...) @f() #2
30 %.pre = load i32, ptr @i, align 4
33 if.end: ; preds = %if.then, %entry
34 %tmp1 = phi i32 [ 0, %entry ], [ %.pre, %if.then ]
39 ; CHECK-NEXT: .cfi_startproc
40 ; CHECK-NEXT: # %bb.0: # %entry
41 ; CHECK-NEXT: pushq %rbp
42 ; CHECK-NEXT: .cfi_def_cfa_offset 16
43 ; CHECK-NEXT: .cfi_offset %rbp, -16
44 ; CHECK-NEXT: movq %rsp, %rbp
45 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
46 ; CHECK-NEXT: pushq %rbx
47 ; CHECK-NEXT: pushq %rax
48 ; CHECK-NEXT: .cfi_offset %rbx, -24
50 ; CHECK-NEXT: leaq i@TLSGD(%rip), %rdi
52 declare void @f(...) #1
54 attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
55 attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
56 attributes #2 = { nounwind }