mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-31 07:52:55 +01:00
cf082ae903
This update was done with the following bash script: find test/Transforms -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc" $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 mv $TEMP $NAME fi done llvm-svn: 186268
59 lines
1.4 KiB
LLVM
59 lines
1.4 KiB
LLVM
; RUN: opt -inline < %s -S -o - -inline-threshold=10 | FileCheck %s
|
|
|
|
target datalayout = "p:32:32"
|
|
|
|
define i32 @outer1() {
|
|
; CHECK-LABEL: @outer1(
|
|
; CHECK-NOT: call
|
|
; CHECK: ret i32
|
|
|
|
%ptr = alloca i32
|
|
%ptr1 = getelementptr inbounds i32* %ptr, i32 0
|
|
%ptr2 = getelementptr inbounds i32* %ptr, i32 42
|
|
%result = call i32 @inner1(i32* %ptr1, i32* %ptr2)
|
|
ret i32 %result
|
|
}
|
|
|
|
define i32 @inner1(i32* %begin, i32* %end) {
|
|
%begin.i = ptrtoint i32* %begin to i32
|
|
%end.i = ptrtoint i32* %end to i32
|
|
%distance = sub i32 %end.i, %begin.i
|
|
%icmp = icmp sle i32 %distance, 42
|
|
br i1 %icmp, label %then, label %else
|
|
|
|
then:
|
|
ret i32 3
|
|
|
|
else:
|
|
%t = load i32* %begin
|
|
ret i32 %t
|
|
}
|
|
|
|
define i32 @outer2(i32* %ptr) {
|
|
; Test that an inbounds GEP disables this -- it isn't safe in general as
|
|
; wrapping changes the behavior of lessthan and greaterthan comparisions.
|
|
; CHECK-LABEL: @outer2(
|
|
; CHECK: call i32 @inner2
|
|
; CHECK: ret i32
|
|
|
|
%ptr1 = getelementptr i32* %ptr, i32 0
|
|
%ptr2 = getelementptr i32* %ptr, i32 42
|
|
%result = call i32 @inner2(i32* %ptr1, i32* %ptr2)
|
|
ret i32 %result
|
|
}
|
|
|
|
define i32 @inner2(i32* %begin, i32* %end) {
|
|
%begin.i = ptrtoint i32* %begin to i32
|
|
%end.i = ptrtoint i32* %end to i32
|
|
%distance = sub i32 %end.i, %begin.i
|
|
%icmp = icmp sle i32 %distance, 42
|
|
br i1 %icmp, label %then, label %else
|
|
|
|
then:
|
|
ret i32 3
|
|
|
|
else:
|
|
%t = load i32* %begin
|
|
ret i32 %t
|
|
}
|