mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-30 23:42:52 +01:00
7e501cf4c3
This update was done with the following bash script: find test/CodeGen -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc.*debug" $NAME; then TEMP=`mktemp -t temp` cp $NAME $TEMP sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \ while read FUNC; do sed -i '' "s/;\(.*\)\([A-Za-z0-9_-]*\):\( *\)$FUNC: *\$/;\1\2-LABEL:\3$FUNC:/g" $TEMP done sed -i '' "s/;\(.*\)-LABEL-LABEL:/;\1-LABEL:/" $TEMP sed -i '' "s/;\(.*\)-NEXT-LABEL:/;\1-NEXT:/" $TEMP sed -i '' "s/;\(.*\)-NOT-LABEL:/;\1-NOT:/" $TEMP sed -i '' "s/;\(.*\)-DAG-LABEL:/;\1-DAG:/" $TEMP mv $TEMP $NAME fi done llvm-svn: 186280
60 lines
1.5 KiB
LLVM
60 lines
1.5 KiB
LLVM
; RUN: llc < %s -march=x86-64 -mtriple=x86_64-linux-gnu -relocation-model=pic | FileCheck %s
|
|
|
|
@x = internal thread_local global i32 0, align 4
|
|
@y = internal thread_local global i32 0, align 4
|
|
|
|
; get_x and get_y are here to prevent x and y to be optimized away as 0
|
|
|
|
define i32* @get_x() {
|
|
entry:
|
|
ret i32* @x
|
|
; FIXME: This function uses a single thread-local variable,
|
|
; so we might want to fall back to general-dynamic here.
|
|
; CHECK-LABEL: get_x:
|
|
; CHECK: leaq x@TLSLD(%rip), %rdi
|
|
; CHECK-NEXT: callq __tls_get_addr@PLT
|
|
; CHECK: x@DTPOFF
|
|
}
|
|
|
|
define i32* @get_y() {
|
|
entry:
|
|
ret i32* @y
|
|
}
|
|
|
|
define i32 @f(i32 %i) {
|
|
entry:
|
|
%cmp = icmp eq i32 %i, 1
|
|
br i1 %cmp, label %return, label %if.else
|
|
; This bb does not access TLS, so should not call __tls_get_addr.
|
|
; CHECK-LABEL: f:
|
|
; CHECK-NOT: __tls_get_addr
|
|
; CHECK: je
|
|
|
|
|
|
if.else:
|
|
%0 = load i32* @x, align 4
|
|
%cmp1 = icmp eq i32 %i, 2
|
|
br i1 %cmp1, label %if.then2, label %return
|
|
; Now we call __tls_get_addr.
|
|
; CHECK: # %if.else
|
|
; CHECK: leaq x@TLSLD(%rip), %rdi
|
|
; CHECK-NEXT: callq __tls_get_addr@PLT
|
|
; CHECK: x@DTPOFF
|
|
|
|
|
|
if.then2:
|
|
%1 = load i32* @y, align 4
|
|
%add = add nsw i32 %1, %0
|
|
br label %return
|
|
; This accesses TLS, but is dominated by the previous block,
|
|
; so should not have to call __tls_get_addr again.
|
|
; CHECK: # %if.then2
|
|
; CHECK-NOT: __tls_get_addr
|
|
; CHECK: y@DTPOFF
|
|
|
|
|
|
return:
|
|
%retval.0 = phi i32 [ %add, %if.then2 ], [ 5, %entry ], [ %0, %if.else ]
|
|
ret i32 %retval.0
|
|
}
|