[llvm] 3a80dc2 - [WebAssembly][test][NFC] Add coverage of non-void funcref calls

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 07:58:44 PST 2023


Author: Alex Bradbury
Date: 2023-02-07T15:56:10Z
New Revision: 3a80dc27ed45a43be7f18eecb7059d424b7c08d5

URL: https://github.com/llvm/llvm-project/commit/3a80dc27ed45a43be7f18eecb7059d424b7c08d5
DIFF: https://github.com/llvm/llvm-project/commit/3a80dc27ed45a43be7f18eecb7059d424b7c08d5.diff

LOG: [WebAssembly][test][NFC] Add coverage of non-void funcref calls

This is trickier to handle in some other representations of funcrefs
that are being explored, so it makes sense to ensure we have some
coverage of this requirement.

Added: 
    

Modified: 
    llvm/test/CodeGen/WebAssembly/funcref-call.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/WebAssembly/funcref-call.ll b/llvm/test/CodeGen/WebAssembly/funcref-call.ll
index 17e5f3bb5cac..c4eb42524445 100644
--- a/llvm/test/CodeGen/WebAssembly/funcref-call.ll
+++ b/llvm/test/CodeGen/WebAssembly/funcref-call.ll
@@ -21,3 +21,25 @@ define void @call_funcref(%funcref %ref) {
   call addrspace(20) void %ref()
   ret void
 }
+
+define float @call_funcref_with_args(%funcref %ref) {
+; CHECK-LABEL: call_funcref_with_args:
+; CHECK:         .functype call_funcref_with_args (funcref) -> (f32)
+; CHECK-NEXT:    .local f32
+; CHECK-NEXT:  # %bb.0:
+; CHECK-NEXT:    i32.const 0
+; CHECK-NEXT:    local.get 0
+; CHECK-NEXT:    table.set __funcref_call_table
+; CHECK-NEXT:    f64.const 0x1p0
+; CHECK-NEXT:    i32.const 2
+; CHECK-NEXT:    i32.const 0
+; CHECK-NEXT:    call_indirect __funcref_call_table, (f64, i32) -> (f32)
+; CHECK-NEXT:    local.set 1
+; CHECK-NEXT:    i32.const 0
+; CHECK-NEXT:    ref.null_func
+; CHECK-NEXT:    table.set __funcref_call_table
+; CHECK-NEXT:    local.get 1
+; CHECK-NEXT:    # fallthrough-return
+  %ret = call addrspace(20) float %ref(double 1.0, i32 2)
+  ret float %ret
+}


        


More information about the llvm-commits mailing list