[llvm] [WebAssembly] Use 'any' type in more cases in AsmTypeCheck (PR #110403)

Heejin Ahn via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 28 19:40:16 PDT 2024


================
@@ -364,16 +371,21 @@ bool WebAssemblyAsmTypeCheck::typeCheck(SMLoc ErrorLoc, const MCInst &Inst,
       pushType(Type);
       return Error;
     }
+    pushType(Any{});
     return true;
   }
 
   if (Name == "table.set") {
     bool Error = false;
-    if (!getTable(Operands[1]->getStartLoc(), Inst.getOperand(0), Type))
-      Error |= popType(ErrorLoc, Type);
-    else
+    SmallVector<StackType, 2> PopTypes;
+    PopTypes.push_back(wasm::ValType::I32);
+    if (!getTable(Operands[1]->getStartLoc(), Inst.getOperand(0), Type)) {
+      PopTypes.push_back(Type);
+    } else {
       Error = true;
-    Error |= popType(ErrorLoc, wasm::ValType::I32);
+      PopTypes.push_back(Any{});
+    }
----------------
aheejin wrote:

Note that given that we are now passing a vector of types, the order of types should be in reverse, because the types in the vector will be popped from the end.

https://github.com/llvm/llvm-project/pull/110403


More information about the llvm-commits mailing list