57 lines · plain
1; Testcase generated from the following code:2; extern __thread int i;3; void f();4; int g(void) {5; if (i) {6; i = 0;7; f();8; }9; return i;10; }11; We want to make sure that TLS variables are not accessed before12; the stack frame is set up.13 14; RUN: llc < %s -relocation-model=pic | FileCheck %s15 16target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"17target triple = "x86_64-unknown-freebsd11.0"18 19@i = external thread_local global i32, align 420 21define i32 @g() #0 {22entry:23 %tmp = load i32, ptr @i, align 424 %tobool = icmp eq i32 %tmp, 025 br i1 %tobool, label %if.end, label %if.then26 27if.then: ; preds = %entry28 store i32 0, ptr @i, align 429 tail call void (...) @f() #230 %.pre = load i32, ptr @i, align 431 br label %if.end32 33if.end: ; preds = %if.then, %entry34 %tmp1 = phi i32 [ 0, %entry ], [ %.pre, %if.then ]35 ret i32 %tmp136}37 38; CHECK: g: # @g39; CHECK-NEXT: .cfi_startproc40; CHECK-NEXT: # %bb.0: # %entry41; CHECK-NEXT: pushq %rbp42; CHECK-NEXT: .cfi_def_cfa_offset 1643; CHECK-NEXT: .cfi_offset %rbp, -1644; CHECK-NEXT: movq %rsp, %rbp45; CHECK-NEXT: .cfi_def_cfa_register %rbp46; CHECK-NEXT: pushq %rbx47; CHECK-NEXT: pushq %rax48; CHECK-NEXT: .cfi_offset %rbx, -2449; CHECK-NEXT: data1650; CHECK-NEXT: leaq i@TLSGD(%rip), %rdi51 52declare void @f(...) #153 54attributes #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" "use-soft-float"="false" }55attributes #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" "use-soft-float"="false" }56attributes #2 = { nounwind }57