[llvm] [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
Fri Apr 25 08:55:40 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:

My guess is that vector constants are represented as vector-size-integers. I just copied the handling done for ConstantVector based splats from below.

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


More information about the llvm-commits mailing list