[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
Wed Apr 30 04:54:12 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:

No objections but is it worth waiting to see what everywhere means? because up to press this is the first time I've needed this idiom and the IR side is mostly complete.

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


More information about the llvm-commits mailing list