[PATCH] D147396: [WebAssembly] Move call_indirect_alloca to call.ll

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 01:42:16 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG47fc0186e630: [WebAssembly] Move call_indirect_alloca to call.ll (authored by aheejin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147396/new/

https://reviews.llvm.org/D147396

Files:
  llvm/test/CodeGen/WebAssembly/call-indirect.ll
  llvm/test/CodeGen/WebAssembly/call.ll


Index: llvm/test/CodeGen/WebAssembly/call.ll
===================================================================
--- llvm/test/CodeGen/WebAssembly/call.ll
+++ llvm/test/CodeGen/WebAssembly/call.ll
@@ -236,6 +236,21 @@
   ret void
 }
 
+; Allocas should be lowered to call_indirects.
+; CHECK-LABEL: call_indirect_alloca:
+; CHECK:      local.tee  $push{{.*}}=, [[L0:[0-9]+]]
+; CHECK-NEXT: global.set  __stack_pointer
+; CHECK-NEXT: local.get  $push{{.*}}=, [[L0]]
+; CHECK-NEXT: i32.const  $push{{.*}}=, 12
+; CHECK-NEXT: i32.add
+; CHECK-NEXT: call_indirect  $pop{{.*}}
+define void @call_indirect_alloca() {
+entry:
+  %ptr = alloca i32, align 4
+  call void %ptr()
+  ret void
+}
+
 ; TODO: test the following:
 ;  - More argument combinations.
 ;  - Tail call.
Index: llvm/test/CodeGen/WebAssembly/call-indirect.ll
===================================================================
--- llvm/test/CodeGen/WebAssembly/call-indirect.ll
+++ llvm/test/CodeGen/WebAssembly/call-indirect.ll
@@ -18,22 +18,6 @@
   ret void
 }
 
-; CHECK-LABEL: call_indirect_alloca:
-; CHECK-NEXT: .functype call_indirect_alloca () -> ()
-; CHECK:      local.tee  0
-; CHECK-NEXT: global.set  __stack_pointer
-; CHECK-NEXT: local.get  0
-; CHECK-NEXT: i32.const  12
-; CHECK-NEXT: i32.add
-; REF:        call_indirect __indirect_function_table, () -> ()
-; NOREF:      call_indirect () -> ()
-define void @call_indirect_alloca() {
-entry:
-  %ptr = alloca i32, align 4
-  call void %ptr()
-  ret void
-}
-
 ; OBJ:    Imports:
 ; OBJ-NEXT:      - Module:          env
 ; OBJ-NEXT:        Field:           __linear_memory
@@ -41,10 +25,5 @@
 ; OBJ-NEXT:        Memory:
 ; OBJ-NEXT:          Minimum:         0x0
 ; OBJ-NEXT:      - Module:          env
-; OBJ-NEXT:        Field:           __stack_pointer
-; OBJ-NEXT:        Kind:            GLOBAL
-; OBJ-NEXT:        GlobalType:      I32
-; OBJ-NEXT:        GlobalMutable:   true
-; OBJ-NEXT:      - Module:          env
 ; OBJ-NEXT:        Field:           __indirect_function_table
 ; OBJ-NEXT:        Kind:            TABLE


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147396.511014.patch
Type: text/x-patch
Size: 2059 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230405/e297a2a9/attachment.bin>


More information about the llvm-commits mailing list