1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt < %s -loop-reduce -S | FileCheck %s
4 ; LSR shouldn't consider %t8 to be an interesting user of %t6, and it
5 ; should be able to form pretty GEPs.
7 target datalayout = "e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
9 ; Copy of uglygep with a different address space
10 ; This tests expandAddToGEP uses the right smaller integer type for
11 ; another address space
12 define void @Z4(ptr addrspace(1) %ptr.i8, ptr addrspace(1) %ptr.float) {
13 ; CHECK-LABEL: define void @Z4
14 ; CHECK-SAME: (ptr addrspace(1) [[PTR_I8:%.*]], ptr addrspace(1) [[PTR_FLOAT:%.*]]) {
16 ; CHECK-NEXT: br label [[BB3:%.*]]
18 ; CHECK-NEXT: br i1 true, label [[BB10:%.*]], label [[BB2:%.*]]
20 ; CHECK-NEXT: [[T:%.*]] = add i16 [[T4:%.*]], 1
21 ; CHECK-NEXT: br label [[BB3]]
23 ; CHECK-NEXT: [[T4]] = phi i16 [ [[T]], [[BB2]] ], [ 0, [[BB:%.*]] ]
24 ; CHECK-NEXT: br label [[BB1:%.*]]
26 ; CHECK-NEXT: [[T7:%.*]] = icmp eq i16 [[T4]], 0
27 ; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PTR_I8]], i16 [[T4]]
28 ; CHECK-NEXT: br label [[BB14:%.*]]
30 ; CHECK-NEXT: store i8 undef, ptr addrspace(1) [[SCEVGEP]], align 1
31 ; CHECK-NEXT: [[T6:%.*]] = load ptr addrspace(1), ptr addrspace(1) [[PTR_FLOAT]], align 2
32 ; CHECK-NEXT: [[SCEVGEP1:%.*]] = getelementptr i8, ptr addrspace(1) [[T6]], i16 16
33 ; CHECK-NEXT: [[SCEVGEP2:%.*]] = getelementptr i8, ptr addrspace(1) [[SCEVGEP1]], i16 [[T4]]
34 ; CHECK-NEXT: store i8 undef, ptr addrspace(1) [[SCEVGEP2]], align 1
35 ; CHECK-NEXT: br label [[BB14]]
41 br i1 true, label %bb10, label %bb2
44 %t = add i16 %t4, 1 ; <i16> [#uses=1]
47 bb3: ; preds = %bb2, %bb
48 %t4 = phi i16 [ %t, %bb2 ], [ 0, %bb ] ; <i16> [#uses=3]
52 %t7 = icmp eq i16 %t4, 0 ; <i1> [#uses=1]
53 %t3 = add i16 %t4, 16 ; <i16> [#uses=1]
56 bb14: ; preds = %bb14, %bb10
57 %t2 = getelementptr inbounds i8, ptr addrspace(1) %ptr.i8, i16 %t4 ; <ptr> [#uses=1]
58 store i8 undef, ptr addrspace(1) %t2
59 %t6 = load ptr addrspace(1), ptr addrspace(1) %ptr.float
60 %t9 = getelementptr inbounds i8, ptr addrspace(1) %t6, i16 %t3 ; <ptr> [#uses=1]
61 store i8 undef, ptr addrspace(1) %t9