[llvm] [LLVM][CodeGen][DirectX] Fix scalarisation when vector ConstantFP is used. (PR #172684)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 4 09:04:31 PST 2026


================
@@ -2016,7 +2016,7 @@ void DXILBitcodeWriter::writeConstants(unsigned FirstVal, unsigned LastVal,
       }
     } else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(C)) {
       Code = bitc::CST_CODE_FLOAT;
-      Type *Ty = CFP->getType();
+      Type *Ty = CFP->getType()->getScalarType();
----------------
paulwalker-arm wrote:

In truth I don't know. I found this when auditing the final unhandled instances of `dyn_cast<ConstantFP>`. The code looks obviously broken (when using `-use-constant-fp-for-fixed-length-splat`) but I could not find any test coverage so did not know how to prove it.

Given I hit the same issue with BitcodeWriter.cpp and the same fix has no effect for existing usage, I thought it might be ok to just pull in?

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


More information about the llvm-commits mailing list