1 ; RUN: llc -mtriple=s390x-linux-gnu -mcpu=z13 < %s | FileCheck %s
3 ; Check that the second load of @g_2 is not incorrectly eliminated by
4 ; DAGCombiner. It is needed since the preceding store is aliasing.
6 ; %.b1.i = load i1, i1* @g_2, align 4
8 ; %g_717.sink.i = select i1 %cmp.i, i1* @g_717, i1* @g_2
9 ; store i1 true, i1* %g_717.sink.i, align 4
10 ; %.b = load i1, i1* @g_2, align 4
12 ; CHECK: # %bb.6: # %crc32_gentab.exit
13 ; CHECK: larl %r2, g_2
14 ; CHECK-NEXT: llc %r3, 0(%r2)
16 ; CHECK: llc %r1, 0(%r2)
18 @g_2 = external hidden unnamed_addr global i1, align 4
19 @.str.1 = external hidden unnamed_addr constant [4 x i8], align 2
20 @g_717 = external hidden unnamed_addr global i1, align 4
21 @.str.2 = external hidden unnamed_addr constant [6 x i8], align 2
22 @crc32_context = external hidden unnamed_addr global i32, align 4
23 @crc32_tab = external hidden unnamed_addr global [256 x i32], align 4
24 @g_5 = external hidden unnamed_addr global i32, align 4
25 @.str.4 = external hidden unnamed_addr constant [15 x i8], align 2
27 ; Function Attrs: nounwind
28 define signext i32 @main(i32 signext %argc, i8** nocapture readonly %argv) local_unnamed_addr #0 {
30 %cmp = icmp eq i32 %argc, 2
31 br i1 %cmp, label %cond.true, label %vector.ph
33 cond.true: ; preds = %entry
34 %arrayidx = getelementptr inbounds i8*, i8** %argv, i64 1
35 %0 = load i8*, i8** %arrayidx, align 8, !tbaa !2
36 %1 = load i8, i8* %0, align 1, !tbaa !6
37 %conv4 = zext i8 %1 to i32
38 %sub = sub nsw i32 49, %conv4
39 %cmp8 = icmp eq i32 %sub, 0
40 br i1 %cmp8, label %if.then, label %if.end35
42 if.then: ; preds = %cond.true
43 %arrayidx11 = getelementptr inbounds i8, i8* %0, i64 1
44 %2 = load i8, i8* %arrayidx11, align 1, !tbaa !6
45 %conv12 = zext i8 %2 to i32
46 %sub13 = sub nsw i32 0, %conv12
49 if.end35: ; preds = %if.then, %cond.true
50 %__result.0 = phi i32 [ %sub13, %if.then ], [ %sub, %cond.true ]
51 %phitmp = icmp eq i32 %__result.0, 0
52 %spec.select = zext i1 %phitmp to i32
55 vector.ph: ; preds = %if.end35, %entry
56 %print_hash_value.0 = phi i32 [ 0, %entry ], [ %spec.select, %if.end35 ]
59 vector.body: ; preds = %vector.body, %vector.ph
60 %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
61 %vec.ind22 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next23, %vector.body ]
62 %3 = and <4 x i32> %vec.ind22, <i32 1, i32 1, i32 1, i32 1>
63 %4 = icmp eq <4 x i32> %3, zeroinitializer
64 %5 = lshr <4 x i32> %vec.ind22, <i32 1, i32 1, i32 1, i32 1>
65 %6 = xor <4 x i32> %5, <i32 -306674912, i32 -306674912, i32 -306674912, i32 -306674912>
66 %7 = select <4 x i1> %4, <4 x i32> %5, <4 x i32> %6
67 %8 = and <4 x i32> %7, <i32 1, i32 1, i32 1, i32 1>
68 %9 = icmp eq <4 x i32> %8, zeroinitializer
69 %10 = lshr <4 x i32> %7, <i32 1, i32 1, i32 1, i32 1>
70 %11 = xor <4 x i32> %10, <i32 -306674912, i32 -306674912, i32 -306674912, i32 -306674912>
71 %12 = select <4 x i1> %9, <4 x i32> %10, <4 x i32> %11
72 %13 = and <4 x i32> %12, <i32 1, i32 1, i32 1, i32 1>
73 %14 = icmp eq <4 x i32> %13, zeroinitializer
74 %15 = lshr <4 x i32> %12, <i32 1, i32 1, i32 1, i32 1>
75 %16 = xor <4 x i32> %15, <i32 -306674912, i32 -306674912, i32 -306674912, i32 -306674912>
76 %17 = select <4 x i1> %14, <4 x i32> %15, <4 x i32> %16
77 %18 = and <4 x i32> %17, <i32 1, i32 1, i32 1, i32 1>
78 %19 = icmp eq <4 x i32> %18, zeroinitializer
79 %20 = lshr <4 x i32> %17, <i32 1, i32 1, i32 1, i32 1>
80 %21 = xor <4 x i32> %20, <i32 -306674912, i32 -306674912, i32 -306674912, i32 -306674912>
81 %22 = select <4 x i1> %19, <4 x i32> %20, <4 x i32> %21
82 %23 = and <4 x i32> %22, <i32 1, i32 1, i32 1, i32 1>
83 %24 = icmp eq <4 x i32> %23, zeroinitializer
84 %25 = lshr <4 x i32> %22, <i32 1, i32 1, i32 1, i32 1>
85 %26 = xor <4 x i32> %25, <i32 -306674912, i32 -306674912, i32 -306674912, i32 -306674912>
86 %27 = select <4 x i1> %24, <4 x i32> %25, <4 x i32> %26
87 %28 = and <4 x i32> %27, <i32 1, i32 1, i32 1, i32 1>
88 %29 = icmp eq <4 x i32> %28, zeroinitializer
89 %30 = lshr <4 x i32> %27, <i32 1, i32 1, i32 1, i32 1>
90 %31 = xor <4 x i32> %30, <i32 -306674912, i32 -306674912, i32 -306674912, i32 -306674912>
91 %32 = select <4 x i1> %29, <4 x i32> %30, <4 x i32> %31
92 %33 = and <4 x i32> %32, <i32 1, i32 1, i32 1, i32 1>
93 %34 = icmp eq <4 x i32> %33, zeroinitializer
94 %35 = lshr <4 x i32> %32, <i32 1, i32 1, i32 1, i32 1>
95 %36 = xor <4 x i32> %35, <i32 -306674912, i32 -306674912, i32 -306674912, i32 -306674912>
96 %37 = select <4 x i1> %34, <4 x i32> %35, <4 x i32> %36
97 %38 = and <4 x i32> %37, <i32 1, i32 1, i32 1, i32 1>
98 %39 = icmp eq <4 x i32> %38, zeroinitializer
99 %40 = lshr <4 x i32> %37, <i32 1, i32 1, i32 1, i32 1>
100 %41 = xor <4 x i32> %40, <i32 -306674912, i32 -306674912, i32 -306674912, i32 -306674912>
101 %42 = select <4 x i1> %39, <4 x i32> %40, <4 x i32> %41
102 %43 = getelementptr inbounds [256 x i32], [256 x i32]* @crc32_tab, i64 0, i64 %index
103 %44 = bitcast i32* %43 to <4 x i32>*
104 store <4 x i32> %42, <4 x i32>* %44, align 4, !tbaa !7
105 %index.next = add i64 %index, 4
106 %vec.ind.next23 = add <4 x i32> %vec.ind22, <i32 4, i32 4, i32 4, i32 4>
107 %45 = icmp eq i64 %index.next, 256
108 br i1 %45, label %crc32_gentab.exit, label %vector.body
110 crc32_gentab.exit: ; preds = %vector.body
111 %46 = load i32, i32* @g_5, align 4, !tbaa !7
112 %.b1.i = load i1, i1* @g_2, align 4
113 %47 = select i1 %.b1.i, i32 1, i32 2
114 %and.i21 = and i32 %47, %46
115 store i32 %and.i21, i32* @g_5, align 4, !tbaa !7
116 %cmp.i = icmp eq i32 %and.i21, 1
117 %g_717.sink.i = select i1 %cmp.i, i1* @g_717, i1* @g_2
118 store i1 true, i1* %g_717.sink.i, align 4
119 %.b = load i1, i1* @g_2, align 4
120 %conv44 = select i1 %.b, i64 1, i64 2
121 tail call fastcc void @transparent_crc(i64 %conv44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 signext %print_hash_value.0)
122 %.b20 = load i1, i1* @g_717, align 4
123 %conv45 = select i1 %.b20, i64 2, i64 0
124 tail call fastcc void @transparent_crc(i64 %conv45, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 signext %print_hash_value.0)
125 %48 = load i32, i32* @crc32_context, align 4, !tbaa !7
126 %49 = xor i32 %48, -1
127 %call.i = tail call signext i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 zeroext %49) #2
131 ; Function Attrs: nounwind
132 declare hidden fastcc void @transparent_crc(i64, i8*, i32 signext) unnamed_addr #0
134 ; Function Attrs: nounwind
135 declare signext i32 @printf(i8* nocapture readonly, ...) local_unnamed_addr #1
137 !2 = !{!3, !3, i64 0}
138 !3 = !{!"any pointer", !4, i64 0}
139 !4 = !{!"omnipotent char", !5, i64 0}
140 !5 = !{!"Simple C/C++ TBAA"}
141 !6 = !{!4, !4, i64 0}
142 !7 = !{!8, !8, i64 0}
143 !8 = !{!"int", !4, i64 0}