64 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s3; The instructions addis,addi, bl are used to calculate the address of TLS4; thread local variables. These TLS access code sequences are generated5; repeatedly every time the thread local variable is accessed. By communicating6; to Machine CSE that X2 is guaranteed to have the same value within the same7; function call (so called Caller Preserved Physical Register), the redundant8; TLS access code sequences are cleaned up.9 10%"struct.CC::TT" = type { i64, i32 }11%class.CC = type { %struct.SS }12%struct.SS = type { ptr }13 14@_ZN2CC2ccE = external thread_local global %"struct.CC::TT", align 815 16define noalias ptr @_ZN2CC3funEv(ptr %this) nounwind {17; CHECK-LABEL: _ZN2CC3funEv:18; CHECK: # %bb.0: # %entry19; CHECK-NEXT: mflr 020; CHECK-NEXT: std 30, -16(1) # 8-byte Folded Spill21; CHECK-NEXT: stdu 1, -48(1)22; CHECK-NEXT: std 2, 24(1)23; CHECK-NEXT: std 0, 64(1)24; CHECK-NEXT: mr 30, 325; CHECK-NEXT: ld 12, 0(3)26; CHECK-NEXT: mtctr 1227; CHECK-NEXT: bctrl28; CHECK-NEXT: ld 2, 24(1)29; CHECK-NEXT: addis 3, 2, _ZN2CC2ccE@got@tlsgd@ha30; CHECK-NEXT: addi 3, 3, _ZN2CC2ccE@got@tlsgd@l31; CHECK-NEXT: bl __tls_get_addr(_ZN2CC2ccE@tlsgd)32; CHECK-NEXT: nop33; CHECK-NEXT: ld 4, 0(3)34; CHECK-NEXT: cmpldi 4, 035; CHECK-NEXT: beq 0, .LBB0_236; CHECK-NEXT: # %bb.1: # %if.then37; CHECK-NEXT: addi 4, 3, 838; CHECK-NEXT: mr 3, 3039; CHECK-NEXT: bl _ZN2CC3barEPi40; CHECK-NEXT: nop41; CHECK-NEXT: .LBB0_2: # %if.end42; CHECK-NEXT: li 3, 043; CHECK-NEXT: addi 1, 1, 4844; CHECK-NEXT: ld 0, 16(1)45; CHECK-NEXT: ld 30, -16(1) # 8-byte Folded Reload46; CHECK-NEXT: mtlr 047; CHECK-NEXT: blr48entry:49 %0 = load ptr, ptr %this, align 850 tail call void %0()51 %1 = load i64, ptr @_ZN2CC2ccE52 %tobool = icmp eq i64 %1, 053 br i1 %tobool, label %if.end, label %if.then54 55if.then:56 tail call void @_ZN2CC3barEPi(ptr nonnull %this, ptr getelementptr inbounds (%"struct.CC::TT", ptr @_ZN2CC2ccE, i64 0, i32 1))57 br label %if.end58 59if.end:60 ret ptr null61}62 63declare void @_ZN2CC3barEPi(ptr, ptr)64