Home | History | Annotate | Download | only in X86
      1 ; RUN: llc -relocation-model=pic < %s | FileCheck %s
      2 ; PR5723
      3 target datalayout = "e-p:64:64"
      4 target triple = "x86_64-unknown-linux-gnu"
      5 
      6 %0 = type { [1 x i64] }
      7 %link = type { %0* }
      8 %test = type { i32, %link }
      9 
     10 @data = global [2 x i64] zeroinitializer, align 64 ; <[2 x i64]*> [#uses=1]
     11 @ptr = linkonce thread_local global [1 x i64] [i64 ptrtoint ([2 x i64]* @data to i64)], align 64 ; <[1 x i64]*> [#uses=1]
     12 @link_ptr = linkonce thread_local global [1 x i64] zeroinitializer, align 64 ; <[1 x i64]*> [#uses=1]
     13 @_dm_my_pe = external global [1 x i64], align 64  ; <[1 x i64]*> [#uses=0]
     14 @_dm_pes_in_prog = external global [1 x i64], align 64 ; <[1 x i64]*> [#uses=0]
     15 @_dm_npes_div_mult = external global [1 x i64], align 64 ; <[1 x i64]*> [#uses=0]
     16 @_dm_npes_div_shift = external global [1 x i64], align 64 ; <[1 x i64]*> [#uses=0]
     17 @_dm_pe_addr_loc = external global [1 x i64], align 64 ; <[1 x i64]*> [#uses=0]
     18 @_dm_offset_addr_mask = external global [1 x i64], align 64 ; <[1 x i64]*> [#uses=0]
     19 
     20 define void @leaf() nounwind {
     21 ; CHECK-LABEL: leaf:
     22 ; CHECK-NOT: -8(%rsp)
     23 ; CHECK: leaq link_ptr@TLSGD
     24 ; CHECK: callq __tls_get_addr@PLT
     25 "file foo2.c, line 14, bb1":
     26   %p = alloca %test*, align 8                     ; <%test**> [#uses=4]
     27   br label %"file foo2.c, line 14, bb2"
     28 
     29 "file foo2.c, line 14, bb2":                      ; preds = %"file foo2.c, line 14, bb1"
     30   br label %"@CFE_debug_label_0"
     31 
     32 "@CFE_debug_label_0":                             ; preds = %"file foo2.c, line 14, bb2"
     33   %r = load %test** bitcast ([1 x i64]* @ptr to %test**), align 8 ; <%test*> [#uses=1]
     34   store %test* %r, %test** %p, align 8
     35   br label %"@CFE_debug_label_2"
     36 
     37 "@CFE_debug_label_2":                             ; preds = %"@CFE_debug_label_0"
     38   %r1 = load %link** bitcast ([1 x i64]* @link_ptr to %link**), align 8 ; <%link*> [#uses=1]
     39   %r2 = load %test** %p, align 8                  ; <%test*> [#uses=1]
     40   %r3 = ptrtoint %test* %r2 to i64                ; <i64> [#uses=1]
     41   %r4 = inttoptr i64 %r3 to %link**               ; <%link**> [#uses=1]
     42   %r5 = getelementptr %link** %r4, i64 1          ; <%link**> [#uses=1]
     43   store %link* %r1, %link** %r5, align 8
     44   br label %"@CFE_debug_label_3"
     45 
     46 "@CFE_debug_label_3":                             ; preds = %"@CFE_debug_label_2"
     47   %r6 = load %test** %p, align 8                  ; <%test*> [#uses=1]
     48   %r7 = ptrtoint %test* %r6 to i64                ; <i64> [#uses=1]
     49   %r8 = inttoptr i64 %r7 to %link*                ; <%link*> [#uses=1]
     50   %r9 = getelementptr %link* %r8, i64 1           ; <%link*> [#uses=1]
     51   store %link* %r9, %link** bitcast ([1 x i64]* @link_ptr to %link**), align 8
     52   br label %"@CFE_debug_label_4"
     53 
     54 "@CFE_debug_label_4":                             ; preds = %"@CFE_debug_label_3"
     55   %r10 = load %test** %p, align 8                 ; <%test*> [#uses=1]
     56   %r11 = ptrtoint %test* %r10 to i64              ; <i64> [#uses=1]
     57   %r12 = inttoptr i64 %r11 to i32*                ; <i32*> [#uses=1]
     58   store i32 1, i32* %r12, align 4
     59   br label %"@CFE_debug_label_5"
     60 
     61 "@CFE_debug_label_5":                             ; preds = %"@CFE_debug_label_4"
     62   ret void
     63 }
     64