1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
4 ; Gracefully handle the alloca that is not in the alloca AS (=5)
6 target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9"
7 target triple = "amdgcn-amd-amdhsa"
10 declare void @use2(ptr, ptr)
12 define weak amdgpu_kernel void @__omp_offloading_802_ea0109_main_l8(ptr %a) {
13 ; CHECK-LABEL: @__omp_offloading_802_ea0109_main_l8(
14 ; CHECK-NEXT: .master:
15 ; CHECK-NEXT: [[TMP0:%.*]] = alloca [8 x i8], align 1
16 ; CHECK-NEXT: call void @use2(ptr nonnull [[TMP0]], ptr nonnull [[TMP0]])
17 ; CHECK-NEXT: ret void
20 %0 = alloca i8, i64 8, align 1
21 store ptr undef, ptr %0, align 8
22 call void @use2(ptr %0, ptr %0)
26 %struct.widget = type { [8 x i8] }
28 define void @spam(ptr %arg1) {
31 ; CHECK-NEXT: [[ALLOCA1:%.*]] = alloca [0 x [30 x %struct.widget]], align 16
32 ; CHECK-NEXT: call void @zot(ptr nonnull [[ALLOCA1]])
33 ; CHECK-NEXT: ret void
36 %alloca = alloca [30 x %struct.widget], i32 0, align 16
37 call void @zot(ptr %alloca)
41 define i1 @alloca_addrspace_0_nonnull() {
42 ; CHECK-LABEL: @alloca_addrspace_0_nonnull(
43 ; CHECK-NEXT: [[ALLOCA:%.*]] = alloca i8, align 1
44 ; CHECK-NEXT: call void @use(ptr nonnull [[ALLOCA]])
45 ; CHECK-NEXT: ret i1 true
48 call void @use(ptr %alloca)
49 %cmp = icmp ne ptr %alloca, null
53 define i1 @alloca_addrspace_5_nonnull() {
54 ; CHECK-LABEL: @alloca_addrspace_5_nonnull(
55 ; CHECK-NEXT: [[ALLOCA:%.*]] = alloca i8, align 1, addrspace(5)
56 ; CHECK-NEXT: call void @use(ptr addrspace(5) [[ALLOCA]])
57 ; CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr addrspace(5) [[ALLOCA]], null
58 ; CHECK-NEXT: ret i1 [[CMP]]
60 %alloca = alloca i8, addrspace(5)
61 call void @use(ptr addrspace(5) %alloca)
62 %cmp = icmp ne ptr addrspace(5) %alloca, null
66 declare hidden void @zot(ptr)