1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2 ; RUN: opt < %s -S -passes=early-cse -earlycse-debug-hash | FileCheck %s
3 ; RUN: opt < %s -S -passes='early-cse<memssa>' | FileCheck %s
5 %T1 = type { i64, i64, i64 }
7 declare void @use_vec(<4 x ptr>);
9 define void @foo(ptr %a, <4 x i64> %b, i64 %i) {
10 ; CHECK-LABEL: define void @foo(
11 ; CHECK-SAME: ptr [[A:%.*]], <4 x i64> [[B:%.*]], i64 [[I:%.*]]) {
12 ; CHECK-NEXT: [[S1A:%.*]] = getelementptr i8, ptr [[A]], i64 8
13 ; CHECK-NEXT: [[N1D:%.*]] = getelementptr i8, ptr [[A]], i64 7
14 ; CHECK-NEXT: [[N1G:%.*]] = getelementptr i32, ptr [[A]], i64 1
15 ; CHECK-NEXT: [[N1H:%.*]] = getelementptr i8, ptr [[A]], i64 [[I]]
16 ; CHECK-NEXT: [[V:%.*]] = getelementptr i64, ptr [[A]], <4 x i64> splat (i64 1)
17 ; CHECK-NEXT: call void @use_vec(<4 x ptr> [[V]])
18 ; CHECK-NEXT: [[V2:%.*]] = getelementptr i64, ptr [[A]], <4 x i64> <i64 0, i64 2, i64 1, i64 1>
19 ; CHECK-NEXT: call void @use_vec(<4 x ptr> [[V2]])
20 ; CHECK-NEXT: ret void
22 %s1a = getelementptr i8, ptr %a, i64 8
23 %s1av = load i64, ptr %s1a
24 %s1b = getelementptr inbounds i8, ptr %a, i64 8
25 %s1bv = load i64, ptr %s1b
26 %s1c = getelementptr %T1, ptr %a, i64 0, i32 1
27 %s1cv = load i64, ptr %s1c
28 %n1d = getelementptr i8, ptr %a, i64 7
29 %n1dv = load i64, ptr %n1d
30 %s1e = getelementptr i64, ptr %a, i64 1
31 %s1ev = load i64, ptr %s1e
32 %s1f = getelementptr i32, ptr %a, i64 2
33 %s1fv = load i64, ptr %s1f
34 %n1g = getelementptr i32, ptr %a, i64 1
35 %n1gv = load i64, ptr %n1g
36 %n1h = getelementptr i8, ptr %a, i64 %i
37 %n1hv = load i64, ptr %n1h
39 %v = getelementptr i64, ptr %a, <4 x i64> <i64 1, i64 1, i64 1, i64 1>
40 call void @use_vec(<4 x ptr> %v)
41 %v2 = getelementptr i64, ptr %a, <4 x i64> <i64 0, i64 2, i64 1, i64 1>
42 call void @use_vec(<4 x ptr> %v2)