[PATCH] D115327: [WebAssembly] Fix reftype load/store match with idx from call
Paulo Matos via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 21 03:29:33 PST 2021
pmatos updated this revision to Diff 395635.
pmatos added a comment.
Remove isUndef check from code. I cannot find a codepath that generates an undef Idx at this point. All undef values end up being propogated down to the respective GEP. So simplifying and removing check.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115327/new/
https://reviews.llvm.org/D115327
Files:
llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
llvm/test/CodeGen/WebAssembly/externref-tableset.ll
Index: llvm/test/CodeGen/WebAssembly/externref-tableset.ll
===================================================================
--- llvm/test/CodeGen/WebAssembly/externref-tableset.ll
+++ llvm/test/CodeGen/WebAssembly/externref-tableset.ll
@@ -79,4 +79,19 @@
ret void
}
+declare i32 @get_table_slot() local_unnamed_addr
+
+define void @set_externref_table_with_id_from_call(%externref %g) {
+; CHECK-LABEL: set_externref_table_with_id_from_call:
+; CHECK-NEXT: .functype set_externref_table_with_id_from_call (externref) -> ()
+; CHECK-NEXT: call get_table_slot
+; CHECK-NEXT: local.get 0
+; CHECK-NEXT: table.set externref_table
+; CHECK-NEXT: end_function
+ %id = call i32 @get_table_slot()
+ %p = getelementptr [0 x %externref], [0 x %externref] addrspace (1)* @externref_table, i32 0, i32 %id
+ store %externref %g, %externref addrspace(1)* %p
+ ret void
+}
+
; CHECK: .tabletype externref_table, externref
Index: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -1491,7 +1491,7 @@
if (GA) {
// We are in Case 2 above.
Idx = Base->getOperand(1);
- if (!Idx || GA->getNumValues() != 1 || Idx->getNumValues() != 1)
+ if (GA->getNumValues() != 1)
return false;
} else {
// This might be Case 1 above (or an error)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115327.395635.patch
Type: text/x-patch
Size: 1499 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211221/e6f9e6b5/attachment.bin>
More information about the llvm-commits
mailing list