25 lines · plain
1; RUN: opt -passes=instcombine -S < %s | FileCheck %s2 3; When a pointer is addrspacecasted to a another addr space, we cannot assume4; anything about the new bits.5 6target datalayout = "p:32:32-p3:32:32-p4:64:64"7 8; CHECK-LABEL: @test_shift9; CHECK-NOT: ret i64 010define i64 @test_shift(ptr %p) {11 %g = addrspacecast ptr %p to ptr addrspace(4)12 %i = ptrtoint ptr addrspace(4) %g to i6413 %shift = lshr i64 %i, 3214 ret i64 %shift15}16 17; CHECK-LABEL: @test_null18; A null pointer casted to another addr space may no longer have null value.19; CHECK-NOT: ret i32 020define i32 @test_null() {21 %g = addrspacecast ptr null to ptr addrspace(3)22 %i = ptrtoint ptr addrspace(3) %g to i3223 ret i32 %i24}25