[clang] [llvm] [WebAssembly] Represent reference types as TargetExtType (PR #203165)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 10 21:07:02 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,c,h -- clang/test/CodeGen/WebAssembly/wasm-funcref-to-ptr-error.c clang/lib/CodeGen/CGCall.cpp clang/lib/CodeGen/CGExprScalar.cpp clang/lib/CodeGen/CodeGenTypes.cpp clang/test/CodeGen/WebAssembly/builtins-table-externref.c clang/test/CodeGen/WebAssembly/builtins-table-funcref.c clang/test/CodeGen/WebAssembly/builtins-test-fp-sig.c clang/test/CodeGen/WebAssembly/wasm-externref.c clang/test/CodeGen/WebAssembly/wasm-funcref.c clang/test/CodeGen/builtins-wasm.c llvm/include/llvm/IR/Intrinsics.h llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/lib/CodeGen/ValueTypes.cpp llvm/lib/IR/Intrinsics.cpp llvm/lib/IR/Type.cpp llvm/lib/Target/WebAssembly/GISel/WebAssemblyCallLowering.cpp llvm/lib/Target/WebAssembly/Utils/WasmAddressSpaces.h llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.h llvm/lib/Target/WebAssembly/WebAssembly.h llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h llvm/lib/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/CodeGen/ValueTypes.cpp b/llvm/lib/CodeGen/ValueTypes.cpp
index 3cd34ea62..a8eb5f801 100644
--- a/llvm/lib/CodeGen/ValueTypes.cpp
+++ b/llvm/lib/CodeGen/ValueTypes.cpp
@@ -268,9 +268,9 @@ MVT MVT::getVT(Type *Ty, bool HandleUnknown){
TargetExtType *TargetExtTy = cast<TargetExtType>(Ty);
if (TargetExtTy->getName() == "aarch64.svcount")
return MVT(MVT::aarch64svcount);
- else if(TargetExtTy->getName() == "wasm.externref")
+ else if (TargetExtTy->getName() == "wasm.externref")
return MVT(MVT::externref);
- else if(TargetExtTy->getName() == "wasm.funcref")
+ else if (TargetExtTy->getName() == "wasm.funcref")
return MVT(MVT::funcref);
else if (TargetExtTy->getName().starts_with("spirv."))
return MVT(MVT::spirvbuiltin);
diff --git a/llvm/lib/Target/WebAssembly/GISel/WebAssemblyCallLowering.cpp b/llvm/lib/Target/WebAssembly/GISel/WebAssemblyCallLowering.cpp
index 7ba7eac2c..3241e3078 100644
--- a/llvm/lib/Target/WebAssembly/GISel/WebAssemblyCallLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/GISel/WebAssemblyCallLowering.cpp
@@ -58,8 +58,8 @@ static unsigned extendOpFromFlags(ISD::ArgFlagsTy Flags) {
return TargetOpcode::G_ANYEXT;
}
-// GlobalISel doesn't handle reference types. We bail out of GlobalISel for functions
-// passing/returning references and fall back to SDAG.
+// GlobalISel doesn't handle reference types. We bail out of GlobalISel for
+// functions passing/returning references and fall back to SDAG.
static bool typeContainsReference(const Type *Ty) {
if (WebAssembly::isWebAssemblyReferenceType(Ty))
return true;
``````````
</details>
https://github.com/llvm/llvm-project/pull/203165
More information about the cfe-commits
mailing list