1 ; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
3 target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
4 target triple = "nvptx64-nvidia-cuda"
7 ; ptrtoint/inttoptr combinations can introduce semantically-meaningful address space casts
8 ; which we can't sink into an addrspacecast
11 define void @test(ptr %input_ptr) {
13 ; CHECK-NOT: addrspacecast
14 %intptr = ptrtoint ptr %input_ptr to i64
15 %ptr = inttoptr i64 %intptr to ptr addrspace(3)
20 store atomic i32 1, ptr addrspace(3) %ptr unordered, align 4
25 ; we still should be able to look through multiple sequences of inttoptr/ptrtoint
28 define void @test2(ptr %input_ptr) {
31 %intptr = ptrtoint ptr %input_ptr to i64
32 %ptr = inttoptr i64 %intptr to ptr addrspace(3)
34 %intptr2 = ptrtoint ptr addrspace(3) %ptr to i64
35 %ptr2 = inttoptr i64 %intptr2 to ptr
40 store atomic i32 1, ptr %ptr2 unordered, align 4