1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00
llvm-mirror/test/Assembler/opaque-ptr.ll
Arthur Eubanks c9fe8a87e5 [OpaquePtr] Make loads and stores work with opaque pointers
Don't check that types match when the pointer operand is an opaque
pointer.

I would separate the Assembler and Verifier changes, but
verify-uselistorder in the Assembler test ends up running the verifier.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D102450
2021-05-18 13:43:50 -07:00

43 lines
1.1 KiB
LLVM

; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
; RUN: verify-uselistorder %s
; CHECK: define ptr @f(ptr %a) {
; CHECK: %b = bitcast ptr %a to ptr
; CHECK: ret ptr %b
define ptr @f(ptr %a) {
%b = bitcast ptr %a to ptr
ret ptr %b
}
; CHECK: define ptr @g(ptr addrspace(2) %a) {
; CHECK: %b = addrspacecast ptr addrspace(2) %a to ptr
; CHECK: ret ptr %b
define ptr @g(ptr addrspace(2) %a) {
%b = addrspacecast ptr addrspace(2) %a to ptr addrspace(0)
ret ptr addrspace(0) %b
}
; CHECK: define ptr addrspace(2) @g2(ptr %a) {
; CHECK: %b = addrspacecast ptr %a to ptr addrspace(2)
; CHECK: ret ptr addrspace(2) %b
define ptr addrspace(2) @g2(ptr addrspace(0) %a) {
%b = addrspacecast ptr addrspace(0) %a to ptr addrspace(2)
ret ptr addrspace(2) %b
}
; CHECK: define i32 @load(ptr %a)
; CHECK: %i = load i32, ptr %a
; CHECK: ret i32 %i
define i32 @load(ptr %a) {
%i = load i32, ptr %a
ret i32 %i
}
; CHECK: define void @store(ptr %a, i32 %i)
; CHECK: store i32 %i, ptr %a
; CHECK: ret void
define void @store(ptr %a, i32 %i) {
store i32 %i, ptr %a
ret void
}