1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2 ; RUN: opt -S -passes=slp-vectorizer < %s | FileCheck %s
4 target triple = "x86_64-redhat-linux-gnu"
6 ; The load+store sequence inside bb10 should not get vectorized. Previously,
7 ; we incorrectly determined that the pointers do not alias, because a cache
8 ; entry based indirectly on a disproven NoAlias assumption was not cleared
9 ; from the BatchAA cache.
10 define void @test(ptr %p1, i64 %arg1, i64 %arg2) {
11 ; CHECK-LABEL: define void @test(
12 ; CHECK-SAME: ptr [[P1:%.*]], i64 [[ARG1:%.*]], i64 [[ARG2:%.*]]) {
13 ; CHECK-NEXT: [[_PREHEADER48_PREHEADER_1:.*]]:
14 ; CHECK-NEXT: br label %[[_LOOPEXIT49_1:.*]]
15 ; CHECK: [[_LOOPEXIT49_1]]:
16 ; CHECK-NEXT: [[I:%.*]] = phi ptr [ [[I21:%.*]], %[[BB20:.*]] ], [ [[P1]], %[[_PREHEADER48_PREHEADER_1]] ]
17 ; CHECK-NEXT: br i1 false, label %[[BB22:.*]], label %[[DOTPREHEADER48_PREHEADER_1:.*]]
19 ; CHECK-NEXT: br label %[[DOTPREHEADER48_PREHEADER_1]]
20 ; CHECK: [[_PREHEADER48_PREHEADER_2:.*:]]
21 ; CHECK-NEXT: [[I5:%.*]] = phi ptr [ [[I]], %[[DEAD]] ], [ [[I]], %[[_LOOPEXIT49_1]] ]
22 ; CHECK-NEXT: br label %[[DOTLOOPEXIT49_1:.*]]
23 ; CHECK: [[DEAD1:.*]]:
24 ; CHECK-NEXT: br i1 false, label %[[DOTLOOPEXIT49_1]], label %[[BB20]]
25 ; CHECK: [[_LOOPEXIT49_2:.*:]]
26 ; CHECK-NEXT: [[I6:%.*]] = phi ptr [ [[I5]], %[[DEAD1]] ], [ [[I5]], %[[DOTPREHEADER48_PREHEADER_1]] ]
27 ; CHECK-NEXT: [[I7:%.*]] = getelementptr i8, ptr [[I6]], i64 [[ARG1]]
28 ; CHECK-NEXT: br label %[[BB10:.*]]
29 ; CHECK: [[DEAD2:.*]]:
30 ; CHECK-NEXT: br label %[[BB10]]
32 ; CHECK-NEXT: [[I11:%.*]] = phi ptr [ [[I7]], %[[DOTLOOPEXIT49_1]] ], [ null, %[[DEAD2]] ]
33 ; CHECK-NEXT: [[I16:%.*]] = getelementptr i8, ptr [[I11]], i64 8
34 ; CHECK-NEXT: [[I17:%.*]] = load i64, ptr [[I16]], align 1
35 ; CHECK-NEXT: store i64 [[I17]], ptr [[I6]], align 1
36 ; CHECK-NEXT: [[I18:%.*]] = getelementptr i8, ptr [[I6]], i64 8
37 ; CHECK-NEXT: [[I19:%.*]] = load i64, ptr [[I11]], align 1
38 ; CHECK-NEXT: store i64 [[I19]], ptr [[I18]], align 1
39 ; CHECK-NEXT: br label %[[BB20]]
41 ; CHECK-NEXT: [[I21]] = phi ptr [ [[I5]], %[[DEAD1]] ], [ [[I6]], %[[BB10]] ]
42 ; CHECK-NEXT: br label %[[_LOOPEXIT49_1]]
44 ; CHECK-NEXT: [[I23:%.*]] = getelementptr i8, ptr [[I]], i64 [[ARG2]]
45 ; CHECK-NEXT: [[I25:%.*]] = getelementptr i8, ptr [[I23]], i64 8
46 ; CHECK-NEXT: br label %[[BB26:.*]]
48 ; CHECK-NEXT: [[I27:%.*]] = phi ptr [ null, %[[BB26]] ], [ [[I25]], %[[BB22]] ]
49 ; CHECK-NEXT: store i64 0, ptr [[I27]], align 1
50 ; CHECK-NEXT: [[I28:%.*]] = getelementptr i8, ptr [[I27]], i64 8
51 ; CHECK-NEXT: [[I29:%.*]] = load i64, ptr [[I23]], align 1
52 ; CHECK-NEXT: store i64 0, ptr [[I28]], align 1
53 ; CHECK-NEXT: br label %[[BB26]]
58 loop1: ; preds = %bb20, %entry
59 %i = phi ptr [ %i21, %bb20 ], [ %p1, %entry ]
60 br i1 false, label %bb22, label %.preheader48.preheader.1
62 dead: ; No predecessors!
63 br label %.preheader48.preheader.1
65 .preheader48.preheader.1: ; preds = %dead, %loop1
66 %i5 = phi ptr [ %i, %dead ], [ %i, %loop1 ]
67 br label %.loopexit49.1
69 dead1: ; No predecessors!
70 br i1 false, label %.loopexit49.1, label %bb20
72 .loopexit49.1: ; preds = %dead1, %.preheader48.preheader.1
73 %i6 = phi ptr [ %i5, %dead1 ], [ %i5, %.preheader48.preheader.1 ]
74 %i7 = getelementptr i8, ptr %i6, i64 %arg1
77 dead2: ; No predecessors!
80 bb10: ; preds = %dead2, %.loopexit49.1
81 %i11 = phi ptr [ %i7, %.loopexit49.1 ], [ null, %dead2 ]
82 %i16 = getelementptr i8, ptr %i11, i64 8
83 %i17 = load i64, ptr %i16, align 1
84 store i64 %i17, ptr %i6, align 1
85 %i18 = getelementptr i8, ptr %i6, i64 8
86 %i19 = load i64, ptr %i11, align 1
87 store i64 %i19, ptr %i18, align 1
90 bb20: ; preds = %bb10, %dead1
91 %i21 = phi ptr [ %i5, %dead1 ], [ %i6, %bb10 ]
94 bb22: ; preds = %loop1
95 %i23 = getelementptr i8, ptr %i, i64 %arg2
96 %i25 = getelementptr i8, ptr %i23, i64 8
99 bb26: ; preds = %bb26, %bb22
100 %i27 = phi ptr [ null, %bb26 ], [ %i25, %bb22 ]
101 store i64 0, ptr %i27, align 1
102 %i28 = getelementptr i8, ptr %i27, i64 8
103 %i29 = load i64, ptr %i23, align 1
104 store i64 0, ptr %i28, align 1