; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 ; RUN: opt < %s -data-layout="e-p:32:32:32-p1:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-n8:16:32" -passes=gvn,dce -S | FileCheck %s --check-prefixes=CHECK,MDEP ; RUN: opt < %s -data-layout="e-p:32:32:32-p1:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-n8:16:32" -passes='gvn',dce -S | FileCheck %s --check-prefixes=CHECK,MSSA define i8 @coerce_offset0_addrspacecast(i32 %V, ptr %P) { ; MDEP-LABEL: define i8 @coerce_offset0_addrspacecast( ; MDEP-SAME: i32 [[V:%.*]], ptr [[P:%.*]]) { ; MDEP-NEXT: store i32 [[V]], ptr [[P]], align 4 ; MDEP-NEXT: [[TMP1:%.*]] = lshr i32 [[V]], 16 ; MDEP-NEXT: [[TMP2:%.*]] = trunc i32 [[TMP1]] to i8 ; MDEP-NEXT: ret i8 [[TMP2]] ; ; MSSA-LABEL: define i8 @coerce_offset0_addrspacecast( ; MSSA-SAME: i32 [[V:%.*]], ptr [[P:%.*]]) { ; MSSA-NEXT: store i32 [[V]], ptr [[P]], align 4 ; MSSA-NEXT: [[P2:%.*]] = addrspacecast ptr [[P]] to ptr addrspace(1) ; MSSA-NEXT: [[P3:%.*]] = getelementptr i8, ptr addrspace(1) [[P2]], i32 2 ; MSSA-NEXT: [[A:%.*]] = load i8, ptr addrspace(1) [[P3]], align 1 ; MSSA-NEXT: ret i8 [[A]] ; store i32 %V, ptr %P %P2 = addrspacecast ptr %P to ptr addrspace(1) %P3 = getelementptr i8, ptr addrspace(1) %P2, i32 2 %A = load i8, ptr addrspace(1) %P3 ret i8 %A } ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: ; CHECK: {{.*}}