mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
83caad013a
Summary: Previously, CGP would unconditionally sink addrspacecast instructions, even going so far as to sink them into a loop. Now we check that the cast is "cheap", as defined by TLI. We introduce a new "is-cheap" function to TLI rather than using isNopAddrSpaceCast because some GPU platforms want the ability to ask for non-nop casts to be sunk. Reviewers: arsenm, tra Subscribers: jholewinski, wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D26923 llvm-svn: 287591
22 lines
530 B
LLVM
22 lines
530 B
LLVM
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
|
|
|
target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
|
|
target triple = "nvptx64-nvidia-cuda"
|
|
|
|
; CHECK-LABEL: @test
|
|
define i64 @test(i1 %pred, i64* %ptr) {
|
|
; CHECK: addrspacecast
|
|
%ptr_as1 = addrspacecast i64* %ptr to i64 addrspace(1)*
|
|
br i1 %pred, label %l1, label %l2
|
|
l1:
|
|
; CHECK-LABEL: l1:
|
|
; CHECK-NOT: addrspacecast
|
|
%v1 = load i64, i64* %ptr
|
|
ret i64 %v1
|
|
l2:
|
|
; CHECK-LABEL: l2:
|
|
; CHECK-NOT: addrspacecast
|
|
%v2 = load i64, i64 addrspace(1)* %ptr_as1
|
|
ret i64 %v2
|
|
}
|