[Hexagon] Do not insert non-phis before phis in bit simplification
[oota-llvm.git] / test / CodeGen / Hexagon / bit-phi.ll
1 ; RUN: llc -march=hexagon < %s
2 ; REQUIRES: asserts
3
4 target datalayout = "e-m:e-p:32:32-i1:32-i64:64-a:0-v32:32-n16:32"
5 target triple = "hexagon-unknown--elf"
6
7 %struct.item = type { i32, i8*, i8*, i32, i8, i8, i16, i32, i8, i16, i32 }
8
9 declare %struct.item* @foo(%struct.item*, i8*, i32) #1
10
11 ; Function Attrs: nounwind
12 define i32 @bar(%struct.item** %ptr, i8* %buf, i32 %c, i8* %d, i32 %e) #1 {
13 entry:
14   br i1 undef, label %return, label %if.end
15
16 if.end:                                           ; preds = %entry
17   br i1 undef, label %while.cond13.preheader, label %if.end3
18
19 if.end3:                                          ; preds = %if.end
20   br label %while.cond13.preheader
21
22 while.cond13.preheader:                           ; preds = %if.end3, %if.end
23   br i1 undef, label %while.body20, label %return
24
25 while.body20:                                     ; preds = %if.end38, %while.cond13.preheader
26   %addr.0100 = phi i32 [ undef, %if.end38 ], [ %c, %while.cond13.preheader ]
27   %cond = select i1 undef, i32 %addr.0100, i32 undef
28   br i1 undef, label %while.body20.if.end38_crit_edge, label %if.then32
29
30 while.body20.if.end38_crit_edge:                  ; preds = %while.body20
31   %conv39.pre = and i32 %cond, 65535
32   br label %if.end38
33
34 if.then32:                                        ; preds = %while.body20
35   %conv33 = and i32 %cond, 65535
36   %.pre = load %struct.item*, %struct.item** %ptr, align 4, !tbaa !1
37   br label %if.end38
38
39 if.end38:                                         ; preds = %if.then32, %while.body20.if.end38_crit_edge
40   %conv39.pre-phi = phi i32 [ %conv39.pre, %while.body20.if.end38_crit_edge ], [ %conv33, %if.then32 ]
41   %0 = phi %struct.item* [ undef, %while.body20.if.end38_crit_edge ], [ %.pre, %if.then32 ]
42   %add = add i32 %conv39.pre-phi, 0
43   %call52 = tail call %struct.item* @foo(%struct.item* %0, i8* %d, i32 %e) #1
44   br i1 undef, label %while.body20, label %return
45
46 return:                                           ; preds = %if.end38, %while.cond13.preheader, %entry
47   %retval.0 = phi i32 [ 0, %entry ], [ 0, %while.cond13.preheader ], [ %add, %if.end38 ]
48   ret i32 %retval.0
49 }
50
51
52 attributes #0 = { nounwind readonly }
53 attributes #1 = { nounwind }
54
55 !1 = !{!2, !2, i64 0}
56 !2 = !{!"any pointer", !3, i64 0}
57 !3 = !{!"omnipotent char", !4, i64 0}
58 !4 = !{!"Simple C/C++ TBAA"}