llvm.org GIT mirror llvm / 737ec51
For PR1043: Bye, Bye Booly. Remove the use of the bool type from non-upgraded test cases and from grep expressions. The parser doesn't accept it and the asm writer doesn't produce it any more. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33183 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 12 years ago
18 changed file(s) with 50 addition(s) and 43 deletion(s). Raw diff Collapse all Expand all
None ; RUN: llvm-upgrade < %s | llvm-as | opt -anders-aa -load-vn -gcse -instcombine | llvm-dis | grep 'ret bool true'
0 ; RUN: llvm-upgrade < %s | llvm-as | \
1 ; RUN: opt -anders-aa -load-vn -gcse -instcombine | llvm-dis | \
2 ; RUN: grep 'ret i1 true'
13
24 %G = internal global int* null
35 declare int *%ext()
0 ; RUN: llvm-as < %s | llvm-dis | grep bitcast
1 define bool %main(i32 %X) {
2 %res = bitcast bool true to bool
3 ret bool %res
1 define i1 %main(i32 %X) {
2 %res = bitcast i1 true to i1
3 ret i1 %res
44 }
44
55 implementation ; Functions:
66
7 define bool %someFunc(i32* %tmp.71.reload, %typedef.bc_struct* %n1) {
8 ret bool true
7 define i1 %someFunc(i32* %tmp.71.reload, %typedef.bc_struct* %n1) {
8 ret i1 true
99 }
11
22 define csretcc void %__divsc3({ float, float }* %agg.result, float %a, float %b, float %c, float %d) {
33 entry:
4 br bool false, label %bb, label %cond_next375
4 br i1 false, label %bb, label %cond_next375
55
66 bb: ; preds = %entry
77 %tmp81 = tail call float %copysignf( float 0x7FF0000000000000, float %c ) ; [#uses=1]
1515
1616 declare float %fabsf(float)
1717
18 declare bool %llvm.isunordered.f32(float, float)
18 declare i1 %llvm.isunordered.f32(float, float)
1919
2020 declare float %copysignf(float, float)
44 define i32 %f7(float %a, float %b) {
55 entry:
66 %tmp = fcmp ueq float %a,%b
7 %retval = select bool %tmp, i32 666, i32 42
7 %retval = select i1 %tmp, i32 666, i32 42
88 ret i32 %retval
99 }
1010
1616 define void %test3() {
1717 %tmp.0 = call i16 %foo() sext ;; no extsh!
1818 %tmp.1 = icmp slt i16 %tmp.0, 1234
19 br bool %tmp.1, label %then, label %UnifiedReturnBlock
19 br i1 %tmp.1, label %then, label %UnifiedReturnBlock
2020
2121 then:
2222 call i32 %test1(i16 0 sext)
66 define double %foo(i32 %a.u) {
77 entry:
88 %tmp = icmp eq i32 %a.u,0
9 %retval = select bool %tmp, double 4.561230e+02, double 1.234560e+02
9 %retval = select i1 %tmp, double 4.561230e+02, double 1.234560e+02
1010 ret double %retval
1111 }
1212
None ; An integer truncation to bool should be done with an and instruction to make
0 ; An integer truncation to i1 should be done with an and instruction to make
11 ; sure only the LSBit survives. Test that this is the case both for a returned
22 ; value and as the operand of a branch.
33 ; RUN: llvm-as < %s | llc -march=x86 &&
44 ; RUN: llvm-as < %s | llc -march=x86 | grep '\(and\)\|\(test.*\$1\)' | \
55 ; RUN: wc -l | grep 6
66
7 define bool %test1(i32 %X) zext {
8 %Y = trunc i32 %X to bool
9 ret bool %Y
7 define i1 %test1(i32 %X) zext {
8 %Y = trunc i32 %X to i1
9 ret i1 %Y
1010 }
1111
12 define bool %test2(i32 %val, i32 %mask) {
12 define i1 %test2(i32 %val, i32 %mask) {
1313 entry:
1414 %mask = trunc i32 %mask to i8
1515 %shifted = ashr i32 %val, i8 %mask
1616 %anded = and i32 %shifted, 1
17 %trunced = trunc i32 %anded to bool
18 br bool %trunced, label %ret_true, label %ret_false
17 %trunced = trunc i32 %anded to i1
18 br i1 %trunced, label %ret_true, label %ret_false
1919 ret_true:
20 ret bool true
20 ret i1 true
2121 ret_false:
22 ret bool false
22 ret i1 false
2323 }
2424
2525 define i32 %test3(i8* %ptr) {
2626 %val = load i8* %ptr
27 %tmp = trunc i8 %val to bool
28 br bool %tmp, label %cond_true, label %cond_false
27 %tmp = trunc i8 %val to i1
28 br i1 %tmp, label %cond_true, label %cond_false
2929 cond_true:
3030 ret i32 21
3131 cond_false:
3333 }
3434
3535 define i32 %test4(i8* %ptr) {
36 %tmp = ptrtoint i8* %ptr to bool
37 br bool %tmp, label %cond_true, label %cond_false
36 %tmp = ptrtoint i8* %ptr to i1
37 br i1 %tmp, label %cond_true, label %cond_false
3838 cond_true:
3939 ret i32 21
4040 cond_false:
4242 }
4343
4444 define i32 %test5(float %f) {
45 %tmp = fptoui float %f to bool
46 br bool %tmp, label %cond_true, label %cond_false
45 %tmp = fptoui float %f to i1
46 br i1 %tmp, label %cond_true, label %cond_false
4747 cond_true:
4848 ret i32 21
4949 cond_false:
5151 }
5252
5353 define i32 %test6(double %d) {
54 %tmp = fptosi double %d to bool
55 br bool %tmp, label %cond_true, label %cond_false
54 %tmp = fptosi double %d to i1
55 br i1 %tmp, label %cond_true, label %cond_false
5656 cond_true:
5757 ret i32 21
5858 cond_false:
None ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'ret bool false'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'ret i1 false'
11 bool %test() {
22 %X = trunc uint 320 to bool
33 ret bool %X
None ; RUN: llvm-upgrade < %s | llvm-as | opt -globalopt -instcombine | llvm-dis | grep 'ret bool true'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -globalopt -instcombine | \
1 ; RUN: llvm-dis | grep 'ret i1 true'
12
23 ;; check that global opt turns integers that only hold 0 or 1 into bools.
34
None ; RUN: llvm-upgrade < %s | llvm-as | opt -ipconstprop -instcombine | llvm-dis | grep 'ret bool true'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -ipconstprop -instcombine | \
1 ; RUN: llvm-dis | grep 'ret i1 true'
12 implementation
23
34 internal int %foo(bool %C) {
2020
2121 bb2: ; preds = %bb, %entry
2222 %i.0 = phi i32 [ 0, %entry ], [ %tmp1, %bb ] ; [#uses=4]
23 %tmp = icmp eq i32 %i.0, 0 ; [#uses=1]
24 br bool %tmp, label %cond_true, label %cond_next
23 %tmp = icmp eq i32 %i.0, 0 ; [#uses=1]
24 br i1 %tmp, label %cond_true, label %cond_next
2525
2626 cond_true: ; preds = %bb2
2727 br label %bb
2929 cond_next: ; preds = %bb2
3030 %tmp = getelementptr [5 x i8]* %foo, i32 0, i32 %i.0 ; [#uses=1]
3131 %tmp = load i8* %tmp ; [#uses=1]
32 %tmp5 = icmp eq i8 %tmp, 0 ; [#uses=1]
33 br bool %tmp5, label %bb6, label %bb
32 %tmp5 = icmp eq i8 %tmp, 0 ; [#uses=1]
33 br i1 %tmp5, label %bb6, label %bb
3434
3535 bb6: ; preds = %cond_next
3636 br label %return
1010 store double 0.000000e+00, double* %j
1111 %k = add i64 %i, 1
1212 %n = icmp eq i64 %k, 0
13 br bool %n, label %return, label %bb
13 br i1 %n, label %return, label %bb
1414
1515 return:
1616 ret void
None ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'ret bool false'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'ret i1 false'
11 bool %test(bool %V) {
22 %Y = setlt bool %V, false
33 ret bool %Y
None ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'ret bool true'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
1 ; RUN: grep 'ret i1 true'
12 ; PR586
23
34 %g_07918478 = external global uint ; [#uses=1]
0 ; This file contains various testcases that check to see that instcombine
11 ; is narrowing computations when possible.
22
3 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'ret bool false'
3 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
4 ; RUN: grep 'ret i1 false'
45
56 ; test1 - Eliminating the casts in this testcase (by narrowing the AND
67 ; operation) allows instcombine to realize the function always returns false.
0 ; Make sure that the compare instruction occurs after the increment to avoid
1 ; having overlapping live ranges that result in copies. We want the setcc instruction
2 ; immediately before the conditional branch.
1 ; having overlapping live ranges that result in copies. We want the setcc
2 ; instruction immediately before the conditional branch.
33 ;
4 ; RUN: llvm-upgrade < %s | llvm-as | opt -loop-reduce | llvm-dis | %prcontext 'br bool' 1 | grep icmp
4 ; RUN: llvm-upgrade < %s | llvm-as | opt -loop-reduce | llvm-dis | \
5 ; RUN: %prcontext 'br i1' 1 | grep icmp
56
67 void %foo(float* %D, uint %E) {
78 entry:
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | \
1 ; RUN: grep 'ret bool false'
1 ; RUN: grep 'ret i1 false'
22
33 bool %foo() {
44 %X = and bool false, undef