[clang] [HLSL] Vector standard conversions (PR #71098)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 12 18:15:00 PST 2023


================
@@ -1422,6 +1424,9 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType,
     return Builder.CreateVectorSplat(NumElements, Src, "splat");
   }
 
+  if (SrcType->isExtVectorType() && DstType->isExtVectorType())
+    return EmitVectorElementConversion(SrcType, DstType, Src);
----------------
efriedma-quic wrote:

EmitScalarConversion is a mess; we have cast kinds, but we never taught this part of CodeGen to use them, so it just guesses the cast kind based on the source and destination types.  This is particularly bad for vectors, since it's often possible to cast them in multiple different ways; I'm not confident this change won't have unintended side-effects.  Please fix the code for the relevant cast kinds to avoid going through EmitScalarConversion.

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


More information about the cfe-commits mailing list