1c06cb123c1916ce8eaaf46a66d6da86f0cc5166
[oota-llvm.git] / test / Transforms / LoopVectorize / ARM / vector_cast.ll
1 ; RUN: opt -loop-vectorize -tbaa -S < %s | FileCheck %s
2
3 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
4 target triple = "armv7--linux-gnueabi"
5
6 ; This requires the loop vectorizer to create an interleaved access group
7 ; for the stores to the struct. Here we need to perform a bitcast from a vector
8 ; of pointers to a vector i32s.
9
10 %class.C = type { i8 }
11 %class.B = type { %class.A* }
12 %class.A = type { i8*, i32 }
13
14 ; CHECK-LABEL: test0
15 define void @test0(%class.C* nocapture readnone %this, %class.B* dereferenceable(4) %p1) #0 align 2 {
16 entry:
17   %call.i = tail call %class.A* @_ZN1B5m_fn2Ev(%class.B* nonnull %p1)
18   %resize_I.i = getelementptr inbounds %class.B, %class.B* %p1, i32 0, i32 0
19   %0 = load %class.A*, %class.A** %resize_I.i, align 4, !tbaa !3
20   %cmp.6.i = icmp eq %class.A* %0, %call.i
21   br i1 %cmp.6.i, label %_ZN1B5m_fn1Ev.exit, label %for.body.lr.ph.i
22
23 for.body.lr.ph.i:                                 ; preds = %entry
24   %resize_I.promoted8.i = ptrtoint %class.A* %0 to i32
25   %scevgep.i = getelementptr %class.A, %class.A* %call.i, i32 -1, i32 0
26   %1 = ptrtoint i8** %scevgep.i to i32
27   %2 = sub i32 %1, %resize_I.promoted8.i
28   br label %for.body.i
29
30 for.cond.for.cond.cleanup_crit_edge.i:            ; preds = %for.body.i
31   %3 = lshr i32 %2, 3
32   %4 = add nuw nsw i32 %3, 1
33   %scevgep10.i = getelementptr %class.A, %class.A* %0, i32 %4
34   store %class.A* %scevgep10.i, %class.A** %resize_I.i, align 4, !tbaa !3
35   br label %_ZN1B5m_fn1Ev.exit
36
37 for.body.i:                                       ; preds = %for.body.i, %for.body.lr.ph.i
38   %5 = phi %class.A* [ %0, %for.body.lr.ph.i ], [ %incdec.ptr.i, %for.body.i ]
39   %Data.i.i = getelementptr inbounds %class.A, %class.A* %5, i32 0, i32 0
40   store i8* null, i8** %Data.i.i, align 4, !tbaa !8
41   %Length.i.i = getelementptr inbounds %class.A, %class.A* %5, i32 0, i32 1
42   store i32 0, i32* %Length.i.i, align 4, !tbaa !11
43   %incdec.ptr.i = getelementptr inbounds %class.A, %class.A* %5, i32 1
44   %cmp.i = icmp eq %class.A* %incdec.ptr.i, %call.i
45   br i1 %cmp.i, label %for.cond.for.cond.cleanup_crit_edge.i, label %for.body.i
46
47 _ZN1B5m_fn1Ev.exit:                               ; preds = %for.cond.for.cond.cleanup_crit_edge.i, %entry
48   ret void
49 }
50
51 declare %class.A* @_ZN1B5m_fn2Ev(%class.B*) #0
52
53 attributes #0 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="cortex-a8" "target-features"="+neon,+vfp3" "unsafe-fp-math"="false" "use-soft-float"="false" }
54
55 !llvm.module.flags = !{!0, !1}
56 !llvm.ident = !{!2}
57
58 !0 = !{i32 1, !"wchar_size", i32 4}
59 !1 = !{i32 1, !"min_enum_size", i32 4}
60 !2 = !{!"clang version 3.8.0 (trunk 246510) (llvm/trunk 246509)"}
61 !3 = !{!4, !5, i64 0}
62 !4 = !{!"_ZTS1B", !5, i64 0}
63 !5 = !{!"any pointer", !6, i64 0}
64 !6 = !{!"omnipotent char", !7, i64 0}
65 !7 = !{!"Simple C/C++ TBAA"}
66 !8 = !{!9, !5, i64 0}
67 !9 = !{!"_ZTS1A", !5, i64 0, !10, i64 4}
68 !10 = !{!"int", !6, i64 0}
69 !11 = !{!9, !10, i64 4}