blob: 17d6a4c0915fd12a9e8c4aceeadd93824b3e98e5 [file] [log] [blame]
Dan Gohmanfafb8902010-04-23 01:55:05 +00001; RUN: llc -march=x86-64 < %s > /dev/null
Dan Gohmanfafb8902010-04-23 01:55:05 +00002
3; ScalarEvolution misses an opportunity to fold ((trunc x) + (trunc -x) + y),
4; but LSR should tolerate this.
Dan Gohman948c8a32010-04-26 21:46:36 +00005; rdar://7886751
Dan Gohmanfafb8902010-04-23 01:55:05 +00006
7target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
8target triple = "x86_64-apple-darwin11.0"
9
10define fastcc void @formatValue(i64 %arg5) nounwind {
11bb12: ; preds = %bb11
12 %t = trunc i64 %arg5 to i32 ; <i32> [#uses=1]
13 %t13 = sub i64 0, %arg5 ; <i64> [#uses=1]
14 %t14 = and i64 %t13, 4294967295 ; <i64> [#uses=1]
15 br label %bb15
16
17bb15: ; preds = %bb21, %bb12
18 %t16 = phi i64 [ 0, %bb12 ], [ %t23, %bb15 ] ; <i64> [#uses=2]
19 %t17 = mul i64 %t14, %t16 ; <i64> [#uses=1]
20 %t18 = add i64 undef, %t17 ; <i64> [#uses=1]
21 %t19 = trunc i64 %t18 to i32 ; <i32> [#uses=1]
22 %t22 = icmp eq i32 %t19, %t ; <i1> [#uses=1]
23 %t23 = add i64 %t16, 1 ; <i64> [#uses=1]
24 br i1 %t22, label %bb24, label %bb15
25
26bb24: ; preds = %bb21, %bb11
27 unreachable
28}
Dan Gohman948c8a32010-04-26 21:46:36 +000029
30; ScalarEvolution should be able to correctly expand the crazy addrec here.
31; PR6914
32
33define void @int323() nounwind {
34entry:
35 br label %for.cond
36
37for.cond: ; preds = %lbl_264, %for.inc, %entry
38 %g_263.tmp.1 = phi i8 [ undef, %entry ], [ %g_263.tmp.1, %for.cond ]
39 %p_95.addr.0 = phi i8 [ 0, %entry ], [ %add, %for.cond ]
40 %add = add i8 %p_95.addr.0, 1 ; <i8> [#uses=1]
41 br i1 undef, label %for.cond, label %lbl_264
42
43lbl_264: ; preds = %if.end, %lbl_264.preheader
44 %g_263.tmp.0 = phi i8 [ %g_263.tmp.1, %for.cond ] ; <i8> [#uses=1]
45 %tmp7 = load i16* undef ; <i16> [#uses=1]
46 %conv8 = trunc i16 %tmp7 to i8 ; <i8> [#uses=1]
47 %mul.i = mul i8 %p_95.addr.0, %p_95.addr.0 ; <i8> [#uses=1]
48 %mul.i18 = mul i8 %mul.i, %conv8 ; <i8> [#uses=1]
49 %tobool12 = icmp eq i8 %mul.i18, 0 ; <i1> [#uses=1]
50 unreachable
51}