1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt -S -passes=argpromotion < %s | FileCheck %s
3 target datalayout = "e-p:64:64-p5:32:32-p6:128:128:128:128"
5 ; Maximum alignment value of the load in a 64-bit address space
6 ; exceeds the bitwidth of the definition address space.
7 define void @entry0() {
8 ; CHECK-LABEL: define void @entry0() {
10 ; CHECK-NEXT: call void @call_load_maxalign_alloca_16()
11 ; CHECK-NEXT: ret void
14 call void @call_load_maxalign_alloca_16()
18 define internal void @call_load_maxalign_alloca_16() {
19 ; CHECK-LABEL: define internal void @call_load_maxalign_alloca_16() {
21 ; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [13 x i16], align 16, addrspace(5)
22 ; CHECK-NEXT: [[ADDRSPACECAST:%.*]] = addrspacecast ptr addrspace(5) [[ALLOCA]] to ptr
23 ; CHECK-NEXT: call void @load_maxalign0(ptr [[ADDRSPACECAST]])
24 ; CHECK-NEXT: ret void
27 %alloca = alloca [13 x i16], align 16, addrspace(5)
28 %addrspacecast = addrspacecast ptr addrspace(5) %alloca to ptr
29 call void @load_maxalign0(ptr %addrspacecast)
33 define internal void @load_maxalign0(ptr %arg) {
34 ; CHECK-LABEL: define internal void @load_maxalign0
35 ; CHECK-SAME: (ptr [[ARG:%.*]]) {
37 ; CHECK-NEXT: br label [[BB1:%.*]]
39 ; CHECK-NEXT: [[LOAD:%.*]] = load i32, ptr [[ARG]], align 4294967296
40 ; CHECK-NEXT: ret void
46 %load = load i32, ptr %arg, align 4294967296
50 ; Make sure the early exit alignment check isn't hiding the offset
52 define void @entry1() {
53 ; CHECK-LABEL: define void @entry1() {
55 ; CHECK-NEXT: call void @call_load_maxalign_alloca_maxalign()
56 ; CHECK-NEXT: ret void
59 call void @call_load_maxalign_alloca_maxalign()
63 define internal void @call_load_maxalign_alloca_maxalign() {
64 ; CHECK-LABEL: define internal void @call_load_maxalign_alloca_maxalign() {
66 ; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [13 x i16], align 4294967296, addrspace(5)
67 ; CHECK-NEXT: [[ADDRSPACECAST:%.*]] = addrspacecast ptr addrspace(5) [[ALLOCA]] to ptr
68 ; CHECK-NEXT: [[ADDRSPACECAST_VAL:%.*]] = load i32, ptr [[ADDRSPACECAST]], align 4294967296
69 ; CHECK-NEXT: call void @load_maxalign1(i32 [[ADDRSPACECAST_VAL]])
70 ; CHECK-NEXT: ret void
73 %alloca = alloca [13 x i16], align 4294967296, addrspace(5)
74 %addrspacecast = addrspacecast ptr addrspace(5) %alloca to ptr
75 call void @load_maxalign1(ptr %addrspacecast)
79 define internal void @load_maxalign1(ptr %arg) {
80 ; CHECK-LABEL: define internal void @load_maxalign1
81 ; CHECK-SAME: (i32 [[ARG_0_VAL:%.*]]) {
83 ; CHECK-NEXT: br label [[BB1:%.*]]
85 ; CHECK-NEXT: ret void
91 %load = load i32, ptr %arg, align 4294967296
95 ; Alignment value exceeds pointer size, more than 1 past the end
96 define void @entry2() {
97 ; CHECK-LABEL: define void @entry2() {
99 ; CHECK-NEXT: call void @call_load_maxalign_alloca_ptr128()
100 ; CHECK-NEXT: ret void
103 call void @call_load_maxalign_alloca_ptr128()
107 define internal void @call_load_maxalign_alloca_ptr128() {
108 ; CHECK-LABEL: define internal void @call_load_maxalign_alloca_ptr128() {
110 ; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [13 x i16], align 4294967296, addrspace(6)
111 ; CHECK-NEXT: [[ADDRSPACECAST:%.*]] = addrspacecast ptr addrspace(6) [[ALLOCA]] to ptr
112 ; CHECK-NEXT: [[ADDRSPACECAST_VAL:%.*]] = load i32, ptr [[ADDRSPACECAST]], align 4294967296
113 ; CHECK-NEXT: call void @load_maxalign2(i32 [[ADDRSPACECAST_VAL]])
114 ; CHECK-NEXT: ret void
117 %alloca = alloca [13 x i16], align 4294967296, addrspace(6)
118 %addrspacecast = addrspacecast ptr addrspace(6) %alloca to ptr
119 call void @load_maxalign2(ptr %addrspacecast)
123 define internal void @load_maxalign2(ptr %arg) {
124 ; CHECK-LABEL: define internal void @load_maxalign2
125 ; CHECK-SAME: (i32 [[ARG_0_VAL:%.*]]) {
127 ; CHECK-NEXT: br label [[BB1:%.*]]
129 ; CHECK-NEXT: ret void
135 %load = load i32, ptr %arg, align 4294967296