
When printing a memory operand in MIR, this lined37bc32a65/llvm/lib/CodeGen/MachineOperand.cpp (L1247)
calls thisd37bc32a65/llvm/include/llvm/Support/Alignment.h (L238)
which assumes `Rhs` (the size in this case) is positive. But Wasm reference types' size is set to 0:d37bc32a65/llvm/include/llvm/CodeGen/ValueTypes.td (L326-L328)
`getSize() > 0` condition was added with the Wasm reference types support in46667a1003
, and it looks it was removed in #84751. This revives the condition so that Wasm reference types will not crash the MIR printer.
22 lines
885 B
LLVM
22 lines
885 B
LLVM
; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types | FileCheck %s
|
|
; Test for MIR printing of reference types in other address spaces. This should
|
|
; not error out.
|
|
; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types -print-after=finalize-isel | FileCheck %s
|
|
|
|
%externref = type ptr addrspace(10) ;; addrspace 10 is nonintegral
|
|
|
|
@externref_global = local_unnamed_addr addrspace(1) global %externref undef
|
|
|
|
define %externref @return_externref_global() {
|
|
;; this generates a global.get of @externref_global
|
|
%ref = load %externref, ptr addrspace(1) @externref_global
|
|
ret %externref %ref
|
|
}
|
|
|
|
; CHECK-LABEL: return_externref_global:
|
|
; CHECK-NEXT: functype return_externref_global () -> (externref)
|
|
; CHECK-NEXT: global.get externref_global
|
|
; CHECK-NEXT: end_function
|
|
|
|
; CHECK: .globl externref_global
|