brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · af9b5cc Raw
43 lines · plain
1; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s2 3target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"4target triple = "nvptx64-nvidia-cuda"5 6 7; ptrtoint/inttoptr combinations can introduce semantically-meaningful address space casts8; which we can't sink into an addrspacecast9 10; CHECK-LABEL: @test11define void @test(ptr %input_ptr) {12  ; CHECK-LABEL: l1:13  ; CHECK-NOT: addrspacecast14  %intptr = ptrtoint ptr %input_ptr to i6415  %ptr = inttoptr i64 %intptr to ptr addrspace(3)16 17  br label %l118l1:19 20  store atomic i32 1, ptr addrspace(3) %ptr unordered, align 421  ret void22}23 24 25; we still should be able to look through multiple sequences of inttoptr/ptrtoint26 27; CHECK-LABEL: @test228define void @test2(ptr %input_ptr) {29  ; CHECK-LABEL: l2:30  ; CHECK-NEXT: store31  %intptr = ptrtoint ptr %input_ptr to i6432  %ptr = inttoptr i64 %intptr to ptr addrspace(3)33 34  %intptr2 = ptrtoint ptr addrspace(3) %ptr to i6435  %ptr2 = inttoptr i64 %intptr2 to ptr36 37  br label %l238l2:39 40  store atomic i32 1, ptr %ptr2 unordered, align 441  ret void42}43