Test simplification that Ana Pazos noticed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141644 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2011-10-11 04:43:15 +00:00
parent 29480fd798
commit 3606f75f35

View File

@ -1,49 +1,20 @@
; RUN: llc < %s -mtriple thumbv7-apple-ios5.0.0 | FileCheck %s
; RUN: llc < %s -march=thumb -mattr=+thumb2 | FileCheck %s
; PR11107
%struct.huffcodetab = type { i32, i32, i32*, i8* }
@ht = external global [34 x %struct.huffcodetab]
define i32 @func(i32 %table_select, i32 %x, i32 %y, i32* %code) nounwind {
define i32 @test(i32 %a, i32 %b) {
entry:
; CHECK: BB#0:
; CHECK: movs.w
; CHECK-NEXT: it mi
; CHECK-NEXT: rsbmi
; CHECK-NEXT: movs.w
; CHECK-NEXT: it mi
; CHECK-NEXT: rsbmi
%cmp.i = icmp sgt i32 %x, 0
%mul.i = sub i32 0, %x
%mul.i6 = select i1 %cmp.i, i32 %x, i32 %mul.i
%tmp = select i1 %cmp.i, i32 0, i32 1
%cmp.i1 = icmp sgt i32 %y, 0
%mul.i3 = sub i32 0, %y
%mul.i38 = select i1 %cmp.i1, i32 %y, i32 %mul.i3
br label %if.then3
if.then3: ; preds = %if.end
%xlen = getelementptr inbounds [34 x %struct.huffcodetab]* @ht, i32 0, i32 %table_select, i32 0
%tmp2 = load i32* %xlen, align 4, !tbaa !0
%sub = add nsw i32 %mul.i6, -15
%cmp4 = icmp sgt i32 %mul.i6, 14
%mul.i7 = select i1 %cmp4, i32 15, i32 %mul.i6
%sub9 = add nsw i32 %mul.i38, -15
%cmp7 = icmp sgt i32 %mul.i38, 14
%mul.i39 = select i1 %cmp7, i32 15, i32 %mul.i38
%mul = shl nsw i32 %mul.i7, 4
%add = add nsw i32 %mul, %mul.i39
%table = getelementptr inbounds [34 x %struct.huffcodetab]* @ht, i32 0, i32 %table_select, i32 2
%tmp3 = load i32** %table, align 4, !tbaa !3
%arrayidx11 = getelementptr inbounds i32* %tmp3, i32 %add
%tmp4 = load i32* %arrayidx11, align 4, !tbaa !4
store i32 %tmp4, i32* %code, align 4, !tbaa !0
ret i32 42
%cmp1 = icmp slt i32 %a, 0
%sub1 = sub nsw i32 0, %a
%abs1 = select i1 %cmp1, i32 %sub1, i32 %a
%cmp2 = icmp slt i32 %b, 0
%sub2 = sub nsw i32 0, %b
%abs2 = select i1 %cmp2, i32 %sub2, i32 %b
%add = add nsw i32 %abs1, %abs2
ret i32 %add
}
!0 = metadata !{metadata !"int", metadata !1}
!1 = metadata !{metadata !"omnipotent char", metadata !2}
!2 = metadata !{metadata !"Simple C/C++ TBAA", null}
!3 = metadata !{metadata !"any pointer", metadata !1}
!4 = metadata !{metadata !"long", metadata !1}