[llvm] [LLVM][CodeGen][X86] Add ConstantInt/FP based vector support to MachineInstr fixup and printing code. (PR #137331)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 25 08:47:43 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());
----------------
arsenm wrote:

I'm not sure I understand what this is doing. How is this different than the direct getValue? How is this a splat if APInt doesn't have vectors? 

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


More information about the llvm-commits mailing list