blob: d02dd12239e9bddc5e4562ed8659fb92da3615c1 [file] [edit]
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt -S -mtriple=amdgpu9.00-amd-amdhsa -passes=infer-address-spaces < %s | FileCheck %s
; The loads make the pass rewrite both flat pointers. The call uses both of
; them, so both arguments must fold. The remap for the first flat pointer must
; not stop the remap for the second one.
@lds = addrspace(3) global [4 x i32] poison
declare void @use_local_local(ptr addrspace(3), ptr addrspace(3))
define i32 @two_casts_in_one_call() {
; CHECK-LABEL: define i32 @two_casts_in_one_call() {
; CHECK-NEXT: [[VAL_4:%.*]] = load i32, ptr addrspace(3) getelementptr inbounds (i8, ptr addrspace(3) @lds, i64 4), align 4
; CHECK-NEXT: [[VAL_8:%.*]] = load i32, ptr addrspace(3) getelementptr inbounds (i8, ptr addrspace(3) @lds, i64 8), align 4
; CHECK-NEXT: call void @use_local_local(ptr addrspace(3) getelementptr inbounds (i8, ptr addrspace(3) @lds, i64 4), ptr addrspace(3) getelementptr inbounds (i8, ptr addrspace(3) @lds, i64 8))
; CHECK-NEXT: [[SUM:%.*]] = add i32 [[VAL_4]], [[VAL_8]]
; CHECK-NEXT: ret i32 [[SUM]]
;
%val.4 = load i32, ptr getelementptr inbounds (i8, ptr addrspacecast (ptr addrspace(3) @lds to ptr), i64 4), align 4
%val.8 = load i32, ptr getelementptr inbounds (i8, ptr addrspacecast (ptr addrspace(3) @lds to ptr), i64 8), align 4
call void @use_local_local(ptr addrspace(3) addrspacecast (ptr getelementptr inbounds (i8, ptr addrspacecast (ptr addrspace(3) @lds to ptr), i64 4) to ptr addrspace(3)), ptr addrspace(3) addrspacecast (ptr getelementptr inbounds (i8, ptr addrspacecast (ptr addrspace(3) @lds to ptr), i64 8) to ptr addrspace(3)))
%sum = add i32 %val.4, %val.8
ret i32 %sum
}