1 ; RUN: opt -instcombine -S < %s | FileCheck %s
3 ; When a pointer is addrspacecasted to a another addr space, we cannot assume
4 ; anything about the new bits.
6 target datalayout = "p:32:32-p3:32:32-p4:64:64"
8 ; CHECK-LABEL: @test_shift
10 define i64 @test_shift(i8* %p) {
11 %g = addrspacecast i8* %p to i8 addrspace(4)*
12 %i = ptrtoint i8 addrspace(4)* %g to i64
13 %shift = lshr i64 %i, 32
17 ; CHECK-LABEL: @test_null
18 ; A null pointer casted to another addr space may no longer have null value.
19 ; CHECK-NOT: ret i32 0
20 define i32 @test_null() {
21 %g = addrspacecast i8* null to i8 addrspace(3)*
22 %i = ptrtoint i8 addrspace(3)* %g to i32