[llvm] [NFC][LLVM][CodeGen][X86] Add ConstantInt/FP based vector support to MachineInstr fixup and printing code. (PR #137331)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Tue May 6 05:49:16 PDT 2025
================
@@ -88,11 +88,19 @@ static std::optional<APInt> extractConstantBits(const Constant *C) {
if (isa<UndefValue>(C))
return APInt::getZero(NumBits);
- if (auto *CInt = dyn_cast<ConstantInt>(C))
+ if (auto *CInt = dyn_cast<ConstantInt>(C)) {
+ if (isa<VectorType>(CInt->getType()))
+ return APInt::getSplat(NumBits, CInt->getValue());
----------------
paulwalker-arm wrote:
After investigation I see such a function is not implementable for scalable vectors. Given a goal of using ConstantInt/FP for constant vector splats is to unify code paths, I'd rather not diverge from this by adding fixed-length vector only functions to these classes.
https://github.com/llvm/llvm-project/pull/137331
More information about the llvm-commits
mailing list