• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -verify-coalescing
2; PR12927
3target triple = "x86_64-apple-macosx10.8.0"
4
5; This is a case where removeCopyByCommutingDef() creates an identity copy that
6; joinCopy must then deal with correctly.
7
8@s = common global i16 0, align 2
9@g1 = common global i32 0, align 4
10@g2 = common global i32 0, align 4
11@g0 = common global i32 0, align 4
12
13define void @func() nounwind uwtable ssp {
14for.body.lr.ph:
15  %0 = load i32, i32* @g2, align 4
16  %tobool6 = icmp eq i32 %0, 0
17  %s.promoted = load i16, i16* @s, align 2
18  %.pre = load i32, i32* @g1, align 4
19  br i1 %tobool6, label %for.body.us, label %for.body
20
21for.body.us:                                      ; preds = %for.body.lr.ph, %for.inc.us
22  %1 = phi i32 [ %3, %for.inc.us ], [ %.pre, %for.body.lr.ph ]
23  %dec13.us = phi i16 [ %dec12.us, %for.inc.us ], [ %s.promoted, %for.body.lr.ph ]
24  %i.011.us = phi i32 [ %inc.us, %for.inc.us ], [ undef, %for.body.lr.ph ]
25  %v.010.us = phi i32 [ %phitmp.us, %for.inc.us ], [ 1, %for.body.lr.ph ]
26  %tobool1.us = icmp ne i32 %v.010.us, 0
27  %2 = zext i1 %tobool1.us to i16
28  %lnot.ext.us = xor i16 %2, 1
29  %add.us = add i16 %dec13.us, %lnot.ext.us
30  %conv3.us = zext i16 %add.us to i32
31  %add4.us = sub i32 0, %1
32  %tobool5.us = icmp eq i32 %conv3.us, %add4.us
33  br i1 %tobool5.us, label %for.inc.us, label %if.then7.us
34
35for.inc.us:                                       ; preds = %cond.end.us, %for.body.us
36  %3 = phi i32 [ %1, %for.body.us ], [ %4, %cond.end.us ]
37  %dec12.us = phi i16 [ %add.us, %for.body.us ], [ %dec.us, %cond.end.us ]
38  %inc.us = add i32 %i.011.us, 1
39  %phitmp.us = udiv i32 %v.010.us, 12
40  %tobool.us = icmp eq i32 %inc.us, 0
41  br i1 %tobool.us, label %for.end, label %for.body.us
42
43cond.end.us:                                      ; preds = %if.then7.us, %cond.false.us
44  %4 = phi i32 [ 0, %cond.false.us ], [ %1, %if.then7.us ]
45  %cond.us = phi i32 [ 0, %cond.false.us ], [ %v.010.us, %if.then7.us ]
46  store i32 %cond.us, i32* @g0, align 4
47  br label %for.inc.us
48
49cond.false.us:                                    ; preds = %if.then7.us
50  store i32 0, i32* @g1, align 4
51  br label %cond.end.us
52
53if.then7.us:                                      ; preds = %for.body.us
54  %dec.us = add i16 %add.us, -1
55  br i1 %tobool1.us, label %cond.end.us, label %cond.false.us
56
57for.body:                                         ; preds = %for.body.lr.ph, %for.body
58  %dec13 = phi i16 [ %dec12, %for.body ], [ %s.promoted, %for.body.lr.ph ]
59  %i.011 = phi i32 [ %inc, %for.body ], [ undef, %for.body.lr.ph ]
60  %v.010 = phi i32 [ %phitmp, %for.body ], [ 1, %for.body.lr.ph ]
61  %tobool1 = icmp eq i32 %v.010, 0
62  %lnot.ext = zext i1 %tobool1 to i16
63  %add = add i16 %dec13, %lnot.ext
64  %conv3 = zext i16 %add to i32
65  %add4 = sub i32 0, %.pre
66  %not.tobool5 = icmp ne i32 %conv3, %add4
67  %dec = sext i1 %not.tobool5 to i16
68  %dec12 = add i16 %add, %dec
69  %inc = add i32 %i.011, 1
70  %phitmp = udiv i32 %v.010, 12
71  %tobool = icmp eq i32 %inc, 0
72  br i1 %tobool, label %for.end, label %for.body
73
74for.end:                                          ; preds = %for.inc.us, %for.body
75  %dec12.lcssa = phi i16 [ %dec12.us, %for.inc.us ], [ %dec12, %for.body ]
76  store i16 %dec12.lcssa, i16* @s, align 2
77  ret void
78}
79