[llvm] [HLSL] Adding DXIL Target type into `TypedInfo` (PR #164887)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 23 14:06:07 PDT 2025


================
@@ -206,6 +206,14 @@ static dxil::ElementType toDXILElementType(Type *Ty, bool IsSigned) {
   return ElementType::Invalid;
 }
 
+static dxil::ElementType toDXILTargetType(Type *Ty, bool IsSigned) {
+  // TODO: Handle unorm, snorm, and packed.
+  Type *ScalarTy = Ty->getScalarType();
+  if (ScalarTy->isIntegerTy(64) || ScalarTy->isDoubleTy())
+    return ElementType::U32;
+  return toDXILElementType(Ty, IsSigned);
+}
----------------
bogner wrote:

Would it be better to operate on a `dxil::ElementType` here rather than redo the `toDXILElementType` work? The only user of this has already called `toDXILElementType()`.

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


More information about the llvm-commits mailing list