Files
clang-p2996/llvm/test/CodeGen/WebAssembly/externref-undef.ll
Paulo Matos 46667a1003 [WebAssembly] Implementation of global.get/set for reftypes in LLVM IR
Reland of 31859f896.

This change implements new DAG notes GLOBAL_GET/GLOBAL_SET, and
lowering methods for load and stores of reference types from IR
globals. Once the lowering creates the new nodes, tablegen pattern
matches those and converts them to Wasm global.get/set.

Reviewed By: tlively

Differential Revision: https://reviews.llvm.org/D104797
2021-07-22 22:07:24 +02:00

22 lines
739 B
LLVM

; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types | FileCheck %s
%extern = type opaque
%externref = type %extern addrspace(10)* ;; addrspace 10 is nonintegral
@externref_global = local_unnamed_addr addrspace(1) global %externref undef
define %extern @return_extern_undef() {
; Returning a ref.null or an uninitialized externref would make
; more sense if the return type would be %externref. However, in
; this case this is an %extern value, which really is an opaque
; type and should never really happen.
ret %extern undef
}
; CHECK-LABEL: return_extern_undef:
; CHECK-NEXT: functype return_extern_undef () -> ()
; CHECK-NEXT: end_function
; CHECK: .globl externref_global