Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LLVM][IR] Use splat syntax when printing Constant[Data]Vector. #112548

Merged
merged 2 commits into from
Nov 6, 2024

Conversation

paulwalker-arm
Copy link
Collaborator

Whilst this PR is not finished (there are many tests that still need updating) I'm sending for review because there's no value in me continuing if the goal of the PR is not acceptable. Likewise, if there's a better way to navigate the transition then I'm all ears.

I'm thinking that sooner or later the pain of having to update the tests will be required so I figured it was worth getting in early as an NFC patch rather than attempting this when trying to make the vector ConstantInt/ConstantFP support enabled by default. Doing this early will also make it easier to track the cases where code quality diverges so I can circle back to them once the functional issues have been resolved..

@llvmbot
Copy link
Member

llvmbot commented Oct 16, 2024

@llvm/pr-subscribers-mlir-llvm
@llvm/pr-subscribers-clang
@llvm/pr-subscribers-backend-aarch64
@llvm/pr-subscribers-hlsl
@llvm/pr-subscribers-backend-risc-v
@llvm/pr-subscribers-llvm-ir
@llvm/pr-subscribers-backend-hexagon
@llvm/pr-subscribers-backend-amdgpu

@llvm/pr-subscribers-backend-x86

Author: Paul Walker (paulwalker-arm)

Changes

Whilst this PR is not finished (there are many tests that still need updating) I'm sending for review because there's no value in me continuing if the goal of the PR is not acceptable. Likewise, if there's a better way to navigate the transition then I'm all ears.

I'm thinking that sooner or later the pain of having to update the tests will be required so I figured it was worth getting in early as an NFC patch rather than attempting this when trying to make the vector ConstantInt/ConstantFP support enabled by default. Doing this early will also make it easier to track the cases where code quality diverges so I can circle back to them once the functional issues have been resolved..


Patch is 6.56 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/112548.diff

830 Files Affected:

  • (modified) llvm/lib/IR/AsmWriter.cpp (+45)
  • (modified) llvm/lib/IR/Constants.cpp (+4-2)
  • (modified) llvm/test/Analysis/CostModel/AArch64/arith-fp.ll (+7-7)
  • (modified) llvm/test/Analysis/CostModel/AArch64/arith-widening.ll (+3-3)
  • (modified) llvm/test/Analysis/CostModel/AArch64/div.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/AArch64/div_cte.ll (+6-6)
  • (modified) llvm/test/Analysis/CostModel/AArch64/fshl.ll (+4-4)
  • (modified) llvm/test/Analysis/CostModel/AArch64/fshr.ll (+4-4)
  • (modified) llvm/test/Analysis/CostModel/AArch64/rem.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/div.ll (+216-216)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/fdiv.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/fneg.ll (+12-12)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/mul.ll (+96-96)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/rem.ll (+216-216)
  • (modified) llvm/test/Analysis/CostModel/ARM/divrem.ll (+410-410)
  • (modified) llvm/test/Analysis/CostModel/RISCV/arith-int.ll (+6-6)
  • (modified) llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll (+6-6)
  • (modified) llvm/test/Analysis/CostModel/RISCV/rvv-phi-const.ll (+14-14)
  • (modified) llvm/test/Analysis/CostModel/RISCV/rvv-select.ll (+1-1)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp-codesize.ll (+24-24)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp-latency.ll (+48-48)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp-sizelatency.ll (+42-42)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp.ll (+48-48)
  • (modified) llvm/test/Analysis/CostModel/X86/div-codesize.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/div-latency.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/div-sizelatency.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/div.ll (+384-384)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl-codesize.ll (+252-252)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl-latency.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl-sizelatency.ll (+276-276)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr-codesize.ll (+252-252)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr-latency.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr-sizelatency.ll (+276-276)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/mul-codesize.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/mul-latency.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/mul-sizelatency.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/mul.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/rem-codesize.ll (+180-180)
  • (modified) llvm/test/Analysis/CostModel/X86/rem-latency.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/rem-sizelatency.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/rem.ll (+384-384)
  • (modified) llvm/test/Analysis/CostModel/X86/slm-arith-costs.ll (+4-4)
  • (modified) llvm/test/Analysis/CostModel/X86/vdiv-cost.ll (+21-21)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-codesize.ll (+77-77)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-cost-inseltpoison.ll (+80-80)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-cost.ll (+80-80)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-latency.ll (+92-92)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-sizelatency.ll (+79-79)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-codesize.ll (+75-75)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-cost-inseltpoison.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-cost.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-latency.ll (+82-82)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-sizelatency.ll (+75-75)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-codesize.ll (+75-75)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-cost-inseltpoison.ll ()
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-cost.ll ()
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-latency.ll ()
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-sizelatency.ll ()
  • (modified) llvm/test/Analysis/ValueTracking/known-non-zero.ll (+3-3)
  • (modified) llvm/test/Analysis/ValueTracking/knownbits-and-or-xor-lowbit.ll (+7-7)
  • (modified) llvm/test/Analysis/ValueTracking/knownbits-bmi-pattern.ll (+24-24)
  • (modified) llvm/test/Analysis/ValueTracking/knownbits-x86-hadd-hsub.ll (+4-4)
  • (modified) llvm/test/Analysis/ValueTracking/knownzero-shift.ll (+2-2)
  • (modified) llvm/test/Analysis/ValueTracking/numsignbits-shl.ll (+6-6)
  • (modified) llvm/test/Assembler/ConstantExprFold.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-fdiv.ll (+9-9)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-i16-to-i32.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-mul24.ll (+22-22)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-late-codegenprepare.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-pow.ll (+31-31)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-pown.ll (+17-17)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-powr.ll (+17-17)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-rootn.ll (+17-17)
  • (modified) llvm/test/CodeGen/AMDGPU/lower-buffer-fat-pointers-pointer-ops.ll (+6-6)
  • (modified) llvm/test/CodeGen/AMDGPU/promote-alloca-array-aggregate.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/promote-alloca-memset.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/vni8-live-reg-opt.ll (+3-3)
  • (modified) llvm/test/CodeGen/Hexagon/autohvx/vector-align-tbaa.ll (+9-9)
  • (modified) llvm/test/CodeGen/NVPTX/variadics-lowering.ll (+1-1)
  • (modified) llvm/test/CodeGen/RISCV/rvv/fixed-vectors-strided-load-store-negative.ll (+8-8)
  • (modified) llvm/test/CodeGen/RISCV/rvv/fixed-vectors-strided-load-store.ll (+11-11)
  • (modified) llvm/test/CodeGen/Thumb2/LowOverheadLoops/tail-pred-const.ll (+161-25)
  • (modified) llvm/test/CodeGen/Thumb2/mve-gather-optimisation-deep.ll (+16-16)
  • (modified) llvm/test/CodeGen/X86/codegen-prepare-extload.ll (+1-1)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/AArch64/arm64-vshift.ll (+689-689)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/AArch64/neon_vst.ll (+121-121)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/avx-intrinsics-x86.ll (+37-37)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/avx2-intrinsics-x86.ll (+39-39)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/sse2-intrinsics-x86.ll (+51-51)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/sse41-intrinsics-x86.ll (+14-14)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/masked-store-load.ll (+18-18)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/vector-track-origins-neon.ll (-2)
  • (modified) llvm/test/Instrumentation/NumericalStabilitySanitizer/basic.ll (+6-6)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/ARM/fptosisat.ll (+10-10)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/X86/fptosisat.ll (+2-2)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/masked-cmp.ll (+5-5)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/popcount.ll (+15-15)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/trunc_multi_uses.ll (+4-4)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/vector-or-load.ll (+1-1)
  • (modified) llvm/test/Transforms/Attributor/nofpclass-powi.ll (+2-2)
  • (modified) llvm/test/Transforms/Attributor/nofpclass.ll (+4-4)
  • (modified) llvm/test/Transforms/Attributor/value-simplify-pointer-info-vec.ll (+2-2)
  • (modified) llvm/test/Transforms/BDCE/binops-multiuse.ll (+2-2)
  • (modified) llvm/test/Transforms/BDCE/dead-uses.ll (+4-4)
  • (modified) llvm/test/Transforms/BDCE/vectors-inseltpoison.ll (+15-15)
  • (modified) llvm/test/Transforms/BDCE/vectors.ll (+15-15)
  • (modified) llvm/test/Transforms/CodeGenPrepare/X86/fold-loop-of-urem.ll (+7-7)
  • (modified) llvm/test/Transforms/ConstantHoisting/AArch64/large-immediate.ll (+5-11)
  • (modified) llvm/test/Transforms/ConstraintElimination/vector-compares.ll (+1-1)
  • (modified) llvm/test/Transforms/CorrelatedValuePropagation/icmp.ll (+2-2)
  • (modified) llvm/test/Transforms/CorrelatedValuePropagation/overflows.ll (+2-2)
  • (modified) llvm/test/Transforms/CorrelatedValuePropagation/vectors.ll (+11-11)
  • (modified) llvm/test/Transforms/DeadStoreElimination/X86/gather-null-pointer.ll (+3-3)
  • (modified) llvm/test/Transforms/DeadStoreElimination/offsetted-overlapping-stores.ll (+1-1)
  • (modified) llvm/test/Transforms/DivRemPairs/AMDGPU/div-rem-pairs.ll (+2-2)
  • (modified) llvm/test/Transforms/EarlyCSE/commute.ll (+4-4)
  • (modified) llvm/test/Transforms/EarlyCSE/gep.ll (+1-1)
  • (modified) llvm/test/Transforms/GVN/non-integral-pointers-inseltpoison.ll (+2-2)
  • (modified) llvm/test/Transforms/GVN/non-integral-pointers.ll (+1-1)
  • (modified) llvm/test/Transforms/InferAddressSpaces/AMDGPU/infer-getelementptr.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/2008-07-11-RemAnd.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/2008-12-17-SRemNegConstVec.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-masked-memops.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-movmsk.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-muldq-inseltpoison.ll (+16-16)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-muldq.ll (+16-16)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pack-inseltpoison.ll (+24-24)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pack.ll (+24-24)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pmulh.ll (+6-6)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pmulhrs.ll (+6-6)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-ternlog.ll (+15-15)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-vector-shifts-inseltpoison.ll (+79-79)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-vector-shifts.ll (+79-79)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-xop-inseltpoison.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-xop.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/abs-1.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/abs-intrinsic.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/add-mask-neg.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/add-mask.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/add-shl-sdiv-to-srem.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/add-sitofp.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/add.ll (+29-29)
  • (modified) llvm/test/Transforms/InstCombine/add4.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/add_or_sub.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/addsub-constant-folding.ll (+27-27)
  • (modified) llvm/test/Transforms/InstCombine/adjust-for-minmax.ll (+10-10)
  • (modified) llvm/test/Transforms/InstCombine/and-compare.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/and-fcmp.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/and-or-icmp-const-icmp.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/and-or-icmps.ll (+12-12)
  • (modified) llvm/test/Transforms/InstCombine/and-or.ll (+19-19)
  • (modified) llvm/test/Transforms/InstCombine/and-xor-or.ll (+23-23)
  • (modified) llvm/test/Transforms/InstCombine/and.ll (+44-44)
  • (modified) llvm/test/Transforms/InstCombine/and2.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/apint-select.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/ashr-demand.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/ashr-lshr.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/avg-lsb.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/binop-and-shifts.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/binop-cast.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/binop-of-displaced-shifts.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/binop-select-cast-of-select-cond.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/binop-select.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bit-checks.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bit_ceil.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bit_floor.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bitcast-inseltpoison.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bitcast.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/bitreverse.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/bswap-fold.ll (+13-13)
  • (modified) llvm/test/Transforms/InstCombine/bswap.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-ashr-shl-to-masking.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-clamp-like-pattern-between-negative-and-positive-thresholds.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-clamp-like-pattern-between-zero-and-positive-threshold.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-eq-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ne-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sge-to-icmp-sle.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sgt-to-icmp-sgt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sle-to-icmp-sle.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-slt-to-icmp-sgt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-uge-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ugt-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ule-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ult-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-fcmp-inf.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-lack-of-signed-truncation-check.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-and-icmp-eq-to-icmp-ule.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-and-icmp-ne-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v3-and-icmp-eq-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v3-and-icmp-ne-to-icmp-ugt.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v4-and-icmp-eq-to-icmp-ule.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v4-and-icmp-ne-to-icmp-ugt.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-lshr-shl-to-masking.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-shl-lshr-to-masking.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-signed-truncation-check.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/cast-int-fcmp-eq-0.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/cast-int-icmp-eq-0.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/cast.ll (+30-30)
  • (modified) llvm/test/Transforms/InstCombine/clamp-to-minmax.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/cmp-intrinsic.ll (+18-18)
  • (modified) llvm/test/Transforms/InstCombine/combine-is.fpclass-and-fcmp.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/compare-signs.ll (+7-7)
  • (modified) llvm/test/Transforms/InstCombine/compare-udiv.ll (+8-8)
  • (modified) llvm/test/Transforms/InstCombine/consecutive-ptrmask.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/copysign-fneg-fabs.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/ctlz-cttz-shifts.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/ctpop-cttz.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/ctpop-pow2.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/ctpop.ll (+12-12)
  • (modified) llvm/test/Transforms/InstCombine/dependent-ivs.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/div-shift.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/div.ll (+29-29)
  • (modified) llvm/test/Transforms/InstCombine/eq-of-parts.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/exact.ll (+11-11)
  • (modified) llvm/test/Transforms/InstCombine/exp2-1.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/exp2-to-ldexp.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fabs-as-int.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fabs-copysign.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/fabs-fneg-fold.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fadd.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fast-math.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fcmp-range-check-idiom.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fcmp.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/fdiv.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/fma.ll (+17-17)
  • (modified) llvm/test/Transforms/InstCombine/fmul-inseltpoison.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fmul-sqrt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fmul.ll (+6-6)
  • (modified) llvm/test/Transforms/InstCombine/fneg-as-int.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fneg-fabs-as-int.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-bin-operand.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-ctpop-of-not.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/fold-select-fmul-if-zero.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-select-trunc.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-signbit-test-power2.ll (+8-8)
  • (modified) llvm/test/Transforms/InstCombine/fold-sub-of-not-to-inc-of-add.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/fpclass-check-idioms.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/fsh.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/funnel.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/gep-combine-loop-invariant.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/gep-custom-dl.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/gep-vector.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/get-lowbitmask-upto-and-including-bit.ll (+8-8)
  • (modified) llvm/test/Transforms/InstCombine/getelementptr.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/high-bit-signmask-with-trunc.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/high-bit-signmask.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/hoist-negation-out-of-bias-calculation-with-constant.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/hoist-negation-out-of-bias-calculation.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/hoist-not-from-ashr-operand.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/hoist-xor-by-constant-from-xor-by-value.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/icmp-add.ll (+17-17)
  • (modified) llvm/test/Transforms/InstCombine/icmp-and-shift.ll (+13-13)
  • (modified) llvm/test/Transforms/InstCombine/icmp-div-constant.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/icmp-logical.ll (+12-12)
  • (modified) llvm/test/Transforms/InstCombine/icmp-mul-and.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/icmp-mul.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/icmp-of-and-x.ll (+2-2)
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 6adb8d6a742255..93c66ee6d14540 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -89,6 +89,11 @@
 
 using namespace llvm;
 
+namespace llvm {
+extern cl::opt<bool> UseConstantIntForFixedLengthSplat;
+extern cl::opt<bool> UseConstantFPForFixedLengthSplat;
+} // namespace llvm
+
 // Make virtual table appear in this compilation unit.
 AssemblyAnnotationWriter::~AssemblyAnnotationWriter() = default;
 
@@ -1687,6 +1692,46 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
     return;
   }
 
+  // When in the mode where Constant{Int,FP} do not support vector types the
+  // "splat(Ty val)" syntax is interpreted as a ConstantDataVector. Maintaining
+  // this association when outputiing the IR will significantly reduce the
+  // output changes when in the mode where Constant{Int,FP} do support vector
+  // types. In turn this should make it easier to spot difference in output
+  // when switching between the modes. Once the transition is complete this
+  // code will be removed.
+  if (const ConstantDataVector *CDV = dyn_cast<ConstantDataVector>(CV)) {
+    if (auto *SplatVal = CDV->getSplatValue()) {
+      Type* EltTy = SplatVal->getType();
+
+      if (EltTy->isIntegerTy() && !UseConstantIntForFixedLengthSplat) {
+        if (const ConstantInt *CI = dyn_cast<ConstantInt>(SplatVal)) {
+          Out << "splat (";
+          WriterCtx.TypePrinter->print(EltTy, Out);
+          Out << " ";
+
+          if (EltTy->isIntegerTy(1))
+            Out << (CI->getZExtValue() ? "true" : "false");
+          else
+            Out << CI->getValue();
+
+          Out << ")";
+          return;
+        }
+      }
+
+      if (EltTy->isFloatingPointTy() && !UseConstantFPForFixedLengthSplat) {
+        if (const ConstantFP *CFP = dyn_cast<ConstantFP>(SplatVal)) {
+          Out << "splat (";
+          WriterCtx.TypePrinter->print(EltTy, Out);
+          Out << " ";
+          WriteAPFloatInternal(Out, CFP->getValueAPF());
+          Out << ")";
+          return;
+        }
+      }
+    }
+  }
+
   if (isa<ConstantVector>(CV) || isa<ConstantDataVector>(CV)) {
     auto *CVVTy = cast<FixedVectorType>(CV->getType());
     Type *ETy = CVVTy->getElementType();
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index fe3a086c5772de..d716b5c900d8e4 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -36,12 +36,14 @@ using namespace llvm;
 using namespace PatternMatch;
 
 // As set of temporary options to help migrate how splats are represented.
-static cl::opt<bool> UseConstantIntForFixedLengthSplat(
+namespace llvm {
+cl::opt<bool> UseConstantIntForFixedLengthSplat(
     "use-constant-int-for-fixed-length-splat", cl::init(false), cl::Hidden,
     cl::desc("Use ConstantInt's native fixed-length vector splat support."));
-static cl::opt<bool> UseConstantFPForFixedLengthSplat(
+cl::opt<bool> UseConstantFPForFixedLengthSplat(
     "use-constant-fp-for-fixed-length-splat", cl::init(false), cl::Hidden,
     cl::desc("Use ConstantFP's native fixed-length vector splat support."));
+}
 static cl::opt<bool> UseConstantIntForScalableSplat(
     "use-constant-int-for-scalable-splat", cl::init(false), cl::Hidden,
     cl::desc("Use ConstantInt's native scalable vector splat support."));
diff --git a/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll b/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll
index aaffd97b92b2de..b329a5607acb97 100644
--- a/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll
@@ -70,15 +70,15 @@ define i32 @fsub(i32 %arg) {
 define i32 @fneg_idiom(i32 %arg) {
 ; CHECK-LABEL: 'fneg_idiom'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F16 = fsub half 0xH8000, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fsub <4 x half> <half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fsub <8 x half> <half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000>, undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fsub <4 x half> splat (half 0xH8000), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fsub <8 x half> splat (half 0xH8000), undef
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = fsub float -0.000000e+00, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fsub <8 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fsub <2 x float> splat (float -0.000000e+00), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fsub <4 x float> splat (float -0.000000e+00), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fsub <8 x float> splat (float -0.000000e+00), undef
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = fsub double -0.000000e+00, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = fsub <4 x double> <double -0.000000e+00, double -0.000000e+00, double -0.000000e+00, double -0.000000e+00>, undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = fsub <2 x double> splat (double -0.000000e+00), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = fsub <4 x double> splat (double -0.000000e+00), undef
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
 ;
   %F16 = fsub half -0.0, undef
diff --git a/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll b/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll
index 52f6f73525a3b9..303bcfa289577c 100644
--- a/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll
@@ -2091,11 +2091,11 @@ define void @extmulv16(<16 x i8> %i8, <16 x i16> %i16, <16 x i32> %i32, <16 x i6
 define void @extmul_const(<8 x i8> %i8, <8 x i16> %i16, <8 x i32> %i32, <8 x i64> %i64)  {
 ; CHECK-LABEL: 'extmul_const'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sl1_8_16 = sext <8 x i8> %i8 to <8 x i16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %asl_8_16 = mul <8 x i16> %sl1_8_16, <i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %asl_8_16 = mul <8 x i16> %sl1_8_16, splat (i16 10)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %zl1_8_16 = zext <8 x i8> %i8 to <8 x i16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %azl_8_16 = mul <8 x i16> %zl1_8_16, <i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %azl_8_16 = mul <8 x i16> %zl1_8_16, splat (i16 10)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %zl1_8_16b = zext <8 x i8> %i8 to <8 x i16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %and = and <8 x i16> %sl1_8_16, <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %and = and <8 x i16> %sl1_8_16, splat (i16 255)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %aal_8_16 = mul <8 x i16> %zl1_8_16b, %and
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
 ;
diff --git a/llvm/test/Analysis/CostModel/AArch64/div.ll b/llvm/test/Analysis/CostModel/AArch64/div.ll
index 2ceaf0c6f536af..ada0be66c27b5a 100644
--- a/llvm/test/Analysis/CostModel/AArch64/div.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/div.ll
@@ -192,21 +192,21 @@ define i32 @sdiv_uniformconst() {
 ; CHECK-LABEL: 'sdiv_uniformconst'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %I128 = sdiv i128 undef, 7
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %I64 = sdiv i64 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = sdiv <2 x i64> undef, <i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = sdiv <4 x i64> undef, <i64 7, i64 7, i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = sdiv <8 x i64> undef, <i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = sdiv <2 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = sdiv <4 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = sdiv <8 x i64> undef, splat (i64 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = sdiv i32 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = sdiv <4 x i32> undef, <i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = sdiv <8 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = sdiv <16 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = sdiv <4 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = sdiv <8 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = sdiv <16 x i32> undef, splat (i32 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = sdiv i16 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = sdiv <8 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = sdiv <16 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = sdiv <32 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = sdiv <8 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = sdiv <16 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = sdiv <32 x i16> undef, splat (i16 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = sdiv i8 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = sdiv <16 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = sdiv <32 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = sdiv <64 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = sdiv <16 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = sdiv <32 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = sdiv <64 x i8> undef, splat (i8 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
 ;
   %I128 = sdiv i128 undef, 7
@@ -238,21 +238,21 @@ define i32 @udiv_uniformconst() {
 ; CHECK-LABEL: 'udiv_uniformconst'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %I128 = udiv i128 undef, 7
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %I64 = udiv i64 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = udiv <2 x i64> undef, <i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = udiv <4 x i64> undef, <i64 7, i64 7, i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = udiv <8 x i64> undef, <i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = udiv <2 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = udiv <4 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = udiv <8 x i64> undef, splat (i64 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = udiv i32 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = udiv <4 x i32> undef, <i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = udiv <8 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = udiv <16 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = udiv <4 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = udiv <8 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = udiv <16 x i32> undef, splat (i32 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = udiv i16 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = udiv <8 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = udiv <16 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = udiv <32 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = udiv <8 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = udiv <16 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = udiv <32 x i16> undef, splat (i16 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = udiv <16 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = udiv <32 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = udiv <64 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = udiv <16 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = udiv <32 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = udiv <64 x i8> undef, splat (i8 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
 ;
   %I128 = udiv i128 undef, 7
@@ -376,21 +376,21 @@ define i32 @sdiv_uniformconstpow2() {
 ; CHECK-LABEL: 'sdiv_uniformconstpow2'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %I128 = sdiv i128 undef, 16
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %I64 = sdiv i64 undef, 16
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %V2i64 = sdiv <2 x i64> undef, <i64 16, i64 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 30 for instruction: %V4i64 = sdiv <4 x i64> undef, <i64 16, i64 16, i64 16, i64 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 60 for instruction: %V8i64 = sdiv <8 x i64> undef, <i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %V2i64 = sdiv <2 x i64> undef, splat (i64 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 30 for instruction: %V4i64 = sdiv <4 x i64> undef, splat (i64 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 60 for instruction: %V8i64 = sdiv <8 x i64> undef, splat (i64 16)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %I32 = sdiv i32 undef, 16
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 27 for instruction: %V4i32 = sdiv <4 x i32> undef, <i32 16, i32 16, i32 16, i32 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 54 for instruction: %V8i32 = sdiv <8 x i32> undef, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 108 for instruction: %V16i32 = sdiv <16 x i32> undef, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 27 for instruction: %V4i32 = sdiv <4 x i32> undef, splat (i32 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 54 for instruction: %V8i32 = sdiv <8 x i32> undef, splat (i32 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 108 for instruction: %V16i32 = sdiv <16 x i32> undef, splat (i32 16)
 ; CHECK-NEXT:  Cost Model: Found an estimated cos...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented Oct 16, 2024

@llvm/pr-subscribers-llvm-transforms

Author: Paul Walker (paulwalker-arm)

Changes

Whilst this PR is not finished (there are many tests that still need updating) I'm sending for review because there's no value in me continuing if the goal of the PR is not acceptable. Likewise, if there's a better way to navigate the transition then I'm all ears.

I'm thinking that sooner or later the pain of having to update the tests will be required so I figured it was worth getting in early as an NFC patch rather than attempting this when trying to make the vector ConstantInt/ConstantFP support enabled by default. Doing this early will also make it easier to track the cases where code quality diverges so I can circle back to them once the functional issues have been resolved..


Patch is 6.56 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/112548.diff

830 Files Affected:

  • (modified) llvm/lib/IR/AsmWriter.cpp (+45)
  • (modified) llvm/lib/IR/Constants.cpp (+4-2)
  • (modified) llvm/test/Analysis/CostModel/AArch64/arith-fp.ll (+7-7)
  • (modified) llvm/test/Analysis/CostModel/AArch64/arith-widening.ll (+3-3)
  • (modified) llvm/test/Analysis/CostModel/AArch64/div.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/AArch64/div_cte.ll (+6-6)
  • (modified) llvm/test/Analysis/CostModel/AArch64/fshl.ll (+4-4)
  • (modified) llvm/test/Analysis/CostModel/AArch64/fshr.ll (+4-4)
  • (modified) llvm/test/Analysis/CostModel/AArch64/rem.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/div.ll (+216-216)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/fdiv.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/fneg.ll (+12-12)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/mul.ll (+96-96)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/rem.ll (+216-216)
  • (modified) llvm/test/Analysis/CostModel/ARM/divrem.ll (+410-410)
  • (modified) llvm/test/Analysis/CostModel/RISCV/arith-int.ll (+6-6)
  • (modified) llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll (+6-6)
  • (modified) llvm/test/Analysis/CostModel/RISCV/rvv-phi-const.ll (+14-14)
  • (modified) llvm/test/Analysis/CostModel/RISCV/rvv-select.ll (+1-1)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp-codesize.ll (+24-24)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp-latency.ll (+48-48)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp-sizelatency.ll (+42-42)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp.ll (+48-48)
  • (modified) llvm/test/Analysis/CostModel/X86/div-codesize.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/div-latency.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/div-sizelatency.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/div.ll (+384-384)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl-codesize.ll (+252-252)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl-latency.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl-sizelatency.ll (+276-276)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr-codesize.ll (+252-252)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr-latency.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr-sizelatency.ll (+276-276)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/mul-codesize.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/mul-latency.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/mul-sizelatency.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/mul.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/rem-codesize.ll (+180-180)
  • (modified) llvm/test/Analysis/CostModel/X86/rem-latency.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/rem-sizelatency.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/rem.ll (+384-384)
  • (modified) llvm/test/Analysis/CostModel/X86/slm-arith-costs.ll (+4-4)
  • (modified) llvm/test/Analysis/CostModel/X86/vdiv-cost.ll (+21-21)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-codesize.ll (+77-77)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-cost-inseltpoison.ll (+80-80)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-cost.ll (+80-80)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-latency.ll (+92-92)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-sizelatency.ll (+79-79)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-codesize.ll (+75-75)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-cost-inseltpoison.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-cost.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-latency.ll (+82-82)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-sizelatency.ll (+75-75)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-codesize.ll (+75-75)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-cost-inseltpoison.ll ()
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-cost.ll ()
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-latency.ll ()
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-sizelatency.ll ()
  • (modified) llvm/test/Analysis/ValueTracking/known-non-zero.ll (+3-3)
  • (modified) llvm/test/Analysis/ValueTracking/knownbits-and-or-xor-lowbit.ll (+7-7)
  • (modified) llvm/test/Analysis/ValueTracking/knownbits-bmi-pattern.ll (+24-24)
  • (modified) llvm/test/Analysis/ValueTracking/knownbits-x86-hadd-hsub.ll (+4-4)
  • (modified) llvm/test/Analysis/ValueTracking/knownzero-shift.ll (+2-2)
  • (modified) llvm/test/Analysis/ValueTracking/numsignbits-shl.ll (+6-6)
  • (modified) llvm/test/Assembler/ConstantExprFold.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-fdiv.ll (+9-9)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-i16-to-i32.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-mul24.ll (+22-22)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-late-codegenprepare.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-pow.ll (+31-31)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-pown.ll (+17-17)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-powr.ll (+17-17)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-rootn.ll (+17-17)
  • (modified) llvm/test/CodeGen/AMDGPU/lower-buffer-fat-pointers-pointer-ops.ll (+6-6)
  • (modified) llvm/test/CodeGen/AMDGPU/promote-alloca-array-aggregate.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/promote-alloca-memset.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/vni8-live-reg-opt.ll (+3-3)
  • (modified) llvm/test/CodeGen/Hexagon/autohvx/vector-align-tbaa.ll (+9-9)
  • (modified) llvm/test/CodeGen/NVPTX/variadics-lowering.ll (+1-1)
  • (modified) llvm/test/CodeGen/RISCV/rvv/fixed-vectors-strided-load-store-negative.ll (+8-8)
  • (modified) llvm/test/CodeGen/RISCV/rvv/fixed-vectors-strided-load-store.ll (+11-11)
  • (modified) llvm/test/CodeGen/Thumb2/LowOverheadLoops/tail-pred-const.ll (+161-25)
  • (modified) llvm/test/CodeGen/Thumb2/mve-gather-optimisation-deep.ll (+16-16)
  • (modified) llvm/test/CodeGen/X86/codegen-prepare-extload.ll (+1-1)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/AArch64/arm64-vshift.ll (+689-689)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/AArch64/neon_vst.ll (+121-121)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/avx-intrinsics-x86.ll (+37-37)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/avx2-intrinsics-x86.ll (+39-39)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/sse2-intrinsics-x86.ll (+51-51)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/sse41-intrinsics-x86.ll (+14-14)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/masked-store-load.ll (+18-18)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/vector-track-origins-neon.ll (-2)
  • (modified) llvm/test/Instrumentation/NumericalStabilitySanitizer/basic.ll (+6-6)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/ARM/fptosisat.ll (+10-10)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/X86/fptosisat.ll (+2-2)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/masked-cmp.ll (+5-5)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/popcount.ll (+15-15)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/trunc_multi_uses.ll (+4-4)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/vector-or-load.ll (+1-1)
  • (modified) llvm/test/Transforms/Attributor/nofpclass-powi.ll (+2-2)
  • (modified) llvm/test/Transforms/Attributor/nofpclass.ll (+4-4)
  • (modified) llvm/test/Transforms/Attributor/value-simplify-pointer-info-vec.ll (+2-2)
  • (modified) llvm/test/Transforms/BDCE/binops-multiuse.ll (+2-2)
  • (modified) llvm/test/Transforms/BDCE/dead-uses.ll (+4-4)
  • (modified) llvm/test/Transforms/BDCE/vectors-inseltpoison.ll (+15-15)
  • (modified) llvm/test/Transforms/BDCE/vectors.ll (+15-15)
  • (modified) llvm/test/Transforms/CodeGenPrepare/X86/fold-loop-of-urem.ll (+7-7)
  • (modified) llvm/test/Transforms/ConstantHoisting/AArch64/large-immediate.ll (+5-11)
  • (modified) llvm/test/Transforms/ConstraintElimination/vector-compares.ll (+1-1)
  • (modified) llvm/test/Transforms/CorrelatedValuePropagation/icmp.ll (+2-2)
  • (modified) llvm/test/Transforms/CorrelatedValuePropagation/overflows.ll (+2-2)
  • (modified) llvm/test/Transforms/CorrelatedValuePropagation/vectors.ll (+11-11)
  • (modified) llvm/test/Transforms/DeadStoreElimination/X86/gather-null-pointer.ll (+3-3)
  • (modified) llvm/test/Transforms/DeadStoreElimination/offsetted-overlapping-stores.ll (+1-1)
  • (modified) llvm/test/Transforms/DivRemPairs/AMDGPU/div-rem-pairs.ll (+2-2)
  • (modified) llvm/test/Transforms/EarlyCSE/commute.ll (+4-4)
  • (modified) llvm/test/Transforms/EarlyCSE/gep.ll (+1-1)
  • (modified) llvm/test/Transforms/GVN/non-integral-pointers-inseltpoison.ll (+2-2)
  • (modified) llvm/test/Transforms/GVN/non-integral-pointers.ll (+1-1)
  • (modified) llvm/test/Transforms/InferAddressSpaces/AMDGPU/infer-getelementptr.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/2008-07-11-RemAnd.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/2008-12-17-SRemNegConstVec.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-masked-memops.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-movmsk.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-muldq-inseltpoison.ll (+16-16)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-muldq.ll (+16-16)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pack-inseltpoison.ll (+24-24)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pack.ll (+24-24)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pmulh.ll (+6-6)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pmulhrs.ll (+6-6)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-ternlog.ll (+15-15)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-vector-shifts-inseltpoison.ll (+79-79)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-vector-shifts.ll (+79-79)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-xop-inseltpoison.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-xop.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/abs-1.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/abs-intrinsic.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/add-mask-neg.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/add-mask.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/add-shl-sdiv-to-srem.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/add-sitofp.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/add.ll (+29-29)
  • (modified) llvm/test/Transforms/InstCombine/add4.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/add_or_sub.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/addsub-constant-folding.ll (+27-27)
  • (modified) llvm/test/Transforms/InstCombine/adjust-for-minmax.ll (+10-10)
  • (modified) llvm/test/Transforms/InstCombine/and-compare.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/and-fcmp.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/and-or-icmp-const-icmp.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/and-or-icmps.ll (+12-12)
  • (modified) llvm/test/Transforms/InstCombine/and-or.ll (+19-19)
  • (modified) llvm/test/Transforms/InstCombine/and-xor-or.ll (+23-23)
  • (modified) llvm/test/Transforms/InstCombine/and.ll (+44-44)
  • (modified) llvm/test/Transforms/InstCombine/and2.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/apint-select.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/ashr-demand.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/ashr-lshr.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/avg-lsb.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/binop-and-shifts.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/binop-cast.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/binop-of-displaced-shifts.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/binop-select-cast-of-select-cond.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/binop-select.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bit-checks.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bit_ceil.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bit_floor.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bitcast-inseltpoison.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bitcast.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/bitreverse.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/bswap-fold.ll (+13-13)
  • (modified) llvm/test/Transforms/InstCombine/bswap.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-ashr-shl-to-masking.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-clamp-like-pattern-between-negative-and-positive-thresholds.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-clamp-like-pattern-between-zero-and-positive-threshold.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-eq-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ne-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sge-to-icmp-sle.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sgt-to-icmp-sgt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sle-to-icmp-sle.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-slt-to-icmp-sgt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-uge-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ugt-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ule-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ult-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-fcmp-inf.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-lack-of-signed-truncation-check.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-and-icmp-eq-to-icmp-ule.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-and-icmp-ne-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v3-and-icmp-eq-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v3-and-icmp-ne-to-icmp-ugt.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v4-and-icmp-eq-to-icmp-ule.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v4-and-icmp-ne-to-icmp-ugt.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-lshr-shl-to-masking.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-shl-lshr-to-masking.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-signed-truncation-check.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/cast-int-fcmp-eq-0.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/cast-int-icmp-eq-0.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/cast.ll (+30-30)
  • (modified) llvm/test/Transforms/InstCombine/clamp-to-minmax.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/cmp-intrinsic.ll (+18-18)
  • (modified) llvm/test/Transforms/InstCombine/combine-is.fpclass-and-fcmp.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/compare-signs.ll (+7-7)
  • (modified) llvm/test/Transforms/InstCombine/compare-udiv.ll (+8-8)
  • (modified) llvm/test/Transforms/InstCombine/consecutive-ptrmask.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/copysign-fneg-fabs.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/ctlz-cttz-shifts.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/ctpop-cttz.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/ctpop-pow2.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/ctpop.ll (+12-12)
  • (modified) llvm/test/Transforms/InstCombine/dependent-ivs.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/div-shift.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/div.ll (+29-29)
  • (modified) llvm/test/Transforms/InstCombine/eq-of-parts.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/exact.ll (+11-11)
  • (modified) llvm/test/Transforms/InstCombine/exp2-1.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/exp2-to-ldexp.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fabs-as-int.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fabs-copysign.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/fabs-fneg-fold.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fadd.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fast-math.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fcmp-range-check-idiom.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fcmp.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/fdiv.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/fma.ll (+17-17)
  • (modified) llvm/test/Transforms/InstCombine/fmul-inseltpoison.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fmul-sqrt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fmul.ll (+6-6)
  • (modified) llvm/test/Transforms/InstCombine/fneg-as-int.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fneg-fabs-as-int.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-bin-operand.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-ctpop-of-not.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/fold-select-fmul-if-zero.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-select-trunc.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-signbit-test-power2.ll (+8-8)
  • (modified) llvm/test/Transforms/InstCombine/fold-sub-of-not-to-inc-of-add.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/fpclass-check-idioms.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/fsh.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/funnel.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/gep-combine-loop-invariant.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/gep-custom-dl.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/gep-vector.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/get-lowbitmask-upto-and-including-bit.ll (+8-8)
  • (modified) llvm/test/Transforms/InstCombine/getelementptr.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/high-bit-signmask-with-trunc.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/high-bit-signmask.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/hoist-negation-out-of-bias-calculation-with-constant.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/hoist-negation-out-of-bias-calculation.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/hoist-not-from-ashr-operand.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/hoist-xor-by-constant-from-xor-by-value.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/icmp-add.ll (+17-17)
  • (modified) llvm/test/Transforms/InstCombine/icmp-and-shift.ll (+13-13)
  • (modified) llvm/test/Transforms/InstCombine/icmp-div-constant.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/icmp-logical.ll (+12-12)
  • (modified) llvm/test/Transforms/InstCombine/icmp-mul-and.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/icmp-mul.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/icmp-of-and-x.ll (+2-2)
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 6adb8d6a742255..93c66ee6d14540 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -89,6 +89,11 @@
 
 using namespace llvm;
 
+namespace llvm {
+extern cl::opt<bool> UseConstantIntForFixedLengthSplat;
+extern cl::opt<bool> UseConstantFPForFixedLengthSplat;
+} // namespace llvm
+
 // Make virtual table appear in this compilation unit.
 AssemblyAnnotationWriter::~AssemblyAnnotationWriter() = default;
 
@@ -1687,6 +1692,46 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
     return;
   }
 
+  // When in the mode where Constant{Int,FP} do not support vector types the
+  // "splat(Ty val)" syntax is interpreted as a ConstantDataVector. Maintaining
+  // this association when outputiing the IR will significantly reduce the
+  // output changes when in the mode where Constant{Int,FP} do support vector
+  // types. In turn this should make it easier to spot difference in output
+  // when switching between the modes. Once the transition is complete this
+  // code will be removed.
+  if (const ConstantDataVector *CDV = dyn_cast<ConstantDataVector>(CV)) {
+    if (auto *SplatVal = CDV->getSplatValue()) {
+      Type* EltTy = SplatVal->getType();
+
+      if (EltTy->isIntegerTy() && !UseConstantIntForFixedLengthSplat) {
+        if (const ConstantInt *CI = dyn_cast<ConstantInt>(SplatVal)) {
+          Out << "splat (";
+          WriterCtx.TypePrinter->print(EltTy, Out);
+          Out << " ";
+
+          if (EltTy->isIntegerTy(1))
+            Out << (CI->getZExtValue() ? "true" : "false");
+          else
+            Out << CI->getValue();
+
+          Out << ")";
+          return;
+        }
+      }
+
+      if (EltTy->isFloatingPointTy() && !UseConstantFPForFixedLengthSplat) {
+        if (const ConstantFP *CFP = dyn_cast<ConstantFP>(SplatVal)) {
+          Out << "splat (";
+          WriterCtx.TypePrinter->print(EltTy, Out);
+          Out << " ";
+          WriteAPFloatInternal(Out, CFP->getValueAPF());
+          Out << ")";
+          return;
+        }
+      }
+    }
+  }
+
   if (isa<ConstantVector>(CV) || isa<ConstantDataVector>(CV)) {
     auto *CVVTy = cast<FixedVectorType>(CV->getType());
     Type *ETy = CVVTy->getElementType();
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index fe3a086c5772de..d716b5c900d8e4 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -36,12 +36,14 @@ using namespace llvm;
 using namespace PatternMatch;
 
 // As set of temporary options to help migrate how splats are represented.
-static cl::opt<bool> UseConstantIntForFixedLengthSplat(
+namespace llvm {
+cl::opt<bool> UseConstantIntForFixedLengthSplat(
     "use-constant-int-for-fixed-length-splat", cl::init(false), cl::Hidden,
     cl::desc("Use ConstantInt's native fixed-length vector splat support."));
-static cl::opt<bool> UseConstantFPForFixedLengthSplat(
+cl::opt<bool> UseConstantFPForFixedLengthSplat(
     "use-constant-fp-for-fixed-length-splat", cl::init(false), cl::Hidden,
     cl::desc("Use ConstantFP's native fixed-length vector splat support."));
+}
 static cl::opt<bool> UseConstantIntForScalableSplat(
     "use-constant-int-for-scalable-splat", cl::init(false), cl::Hidden,
     cl::desc("Use ConstantInt's native scalable vector splat support."));
diff --git a/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll b/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll
index aaffd97b92b2de..b329a5607acb97 100644
--- a/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll
@@ -70,15 +70,15 @@ define i32 @fsub(i32 %arg) {
 define i32 @fneg_idiom(i32 %arg) {
 ; CHECK-LABEL: 'fneg_idiom'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F16 = fsub half 0xH8000, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fsub <4 x half> <half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fsub <8 x half> <half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000>, undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fsub <4 x half> splat (half 0xH8000), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fsub <8 x half> splat (half 0xH8000), undef
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = fsub float -0.000000e+00, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fsub <8 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fsub <2 x float> splat (float -0.000000e+00), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fsub <4 x float> splat (float -0.000000e+00), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fsub <8 x float> splat (float -0.000000e+00), undef
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = fsub double -0.000000e+00, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = fsub <4 x double> <double -0.000000e+00, double -0.000000e+00, double -0.000000e+00, double -0.000000e+00>, undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = fsub <2 x double> splat (double -0.000000e+00), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = fsub <4 x double> splat (double -0.000000e+00), undef
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
 ;
   %F16 = fsub half -0.0, undef
diff --git a/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll b/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll
index 52f6f73525a3b9..303bcfa289577c 100644
--- a/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll
@@ -2091,11 +2091,11 @@ define void @extmulv16(<16 x i8> %i8, <16 x i16> %i16, <16 x i32> %i32, <16 x i6
 define void @extmul_const(<8 x i8> %i8, <8 x i16> %i16, <8 x i32> %i32, <8 x i64> %i64)  {
 ; CHECK-LABEL: 'extmul_const'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sl1_8_16 = sext <8 x i8> %i8 to <8 x i16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %asl_8_16 = mul <8 x i16> %sl1_8_16, <i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %asl_8_16 = mul <8 x i16> %sl1_8_16, splat (i16 10)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %zl1_8_16 = zext <8 x i8> %i8 to <8 x i16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %azl_8_16 = mul <8 x i16> %zl1_8_16, <i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %azl_8_16 = mul <8 x i16> %zl1_8_16, splat (i16 10)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %zl1_8_16b = zext <8 x i8> %i8 to <8 x i16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %and = and <8 x i16> %sl1_8_16, <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %and = and <8 x i16> %sl1_8_16, splat (i16 255)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %aal_8_16 = mul <8 x i16> %zl1_8_16b, %and
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
 ;
diff --git a/llvm/test/Analysis/CostModel/AArch64/div.ll b/llvm/test/Analysis/CostModel/AArch64/div.ll
index 2ceaf0c6f536af..ada0be66c27b5a 100644
--- a/llvm/test/Analysis/CostModel/AArch64/div.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/div.ll
@@ -192,21 +192,21 @@ define i32 @sdiv_uniformconst() {
 ; CHECK-LABEL: 'sdiv_uniformconst'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %I128 = sdiv i128 undef, 7
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %I64 = sdiv i64 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = sdiv <2 x i64> undef, <i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = sdiv <4 x i64> undef, <i64 7, i64 7, i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = sdiv <8 x i64> undef, <i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = sdiv <2 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = sdiv <4 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = sdiv <8 x i64> undef, splat (i64 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = sdiv i32 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = sdiv <4 x i32> undef, <i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = sdiv <8 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = sdiv <16 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = sdiv <4 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = sdiv <8 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = sdiv <16 x i32> undef, splat (i32 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = sdiv i16 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = sdiv <8 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = sdiv <16 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = sdiv <32 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = sdiv <8 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = sdiv <16 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = sdiv <32 x i16> undef, splat (i16 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = sdiv i8 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = sdiv <16 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = sdiv <32 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = sdiv <64 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = sdiv <16 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = sdiv <32 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = sdiv <64 x i8> undef, splat (i8 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
 ;
   %I128 = sdiv i128 undef, 7
@@ -238,21 +238,21 @@ define i32 @udiv_uniformconst() {
 ; CHECK-LABEL: 'udiv_uniformconst'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %I128 = udiv i128 undef, 7
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %I64 = udiv i64 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = udiv <2 x i64> undef, <i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = udiv <4 x i64> undef, <i64 7, i64 7, i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = udiv <8 x i64> undef, <i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = udiv <2 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = udiv <4 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = udiv <8 x i64> undef, splat (i64 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = udiv i32 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = udiv <4 x i32> undef, <i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = udiv <8 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = udiv <16 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = udiv <4 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = udiv <8 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = udiv <16 x i32> undef, splat (i32 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = udiv i16 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = udiv <8 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = udiv <16 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = udiv <32 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = udiv <8 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = udiv <16 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = udiv <32 x i16> undef, splat (i16 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = udiv <16 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = udiv <32 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = udiv <64 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = udiv <16 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = udiv <32 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = udiv <64 x i8> undef, splat (i8 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
 ;
   %I128 = udiv i128 undef, 7
@@ -376,21 +376,21 @@ define i32 @sdiv_uniformconstpow2() {
 ; CHECK-LABEL: 'sdiv_uniformconstpow2'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %I128 = sdiv i128 undef, 16
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %I64 = sdiv i64 undef, 16
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %V2i64 = sdiv <2 x i64> undef, <i64 16, i64 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 30 for instruction: %V4i64 = sdiv <4 x i64> undef, <i64 16, i64 16, i64 16, i64 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 60 for instruction: %V8i64 = sdiv <8 x i64> undef, <i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %V2i64 = sdiv <2 x i64> undef, splat (i64 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 30 for instruction: %V4i64 = sdiv <4 x i64> undef, splat (i64 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 60 for instruction: %V8i64 = sdiv <8 x i64> undef, splat (i64 16)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %I32 = sdiv i32 undef, 16
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 27 for instruction: %V4i32 = sdiv <4 x i32> undef, <i32 16, i32 16, i32 16, i32 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 54 for instruction: %V8i32 = sdiv <8 x i32> undef, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 108 for instruction: %V16i32 = sdiv <16 x i32> undef, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 27 for instruction: %V4i32 = sdiv <4 x i32> undef, splat (i32 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 54 for instruction: %V8i32 = sdiv <8 x i32> undef, splat (i32 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 108 for instruction: %V16i32 = sdiv <16 x i32> undef, splat (i32 16)
 ; CHECK-NEXT:  Cost Model: Found an estimated cos...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented Oct 16, 2024

@llvm/pr-subscribers-backend-systemz

Author: Paul Walker (paulwalker-arm)

Changes

Whilst this PR is not finished (there are many tests that still need updating) I'm sending for review because there's no value in me continuing if the goal of the PR is not acceptable. Likewise, if there's a better way to navigate the transition then I'm all ears.

I'm thinking that sooner or later the pain of having to update the tests will be required so I figured it was worth getting in early as an NFC patch rather than attempting this when trying to make the vector ConstantInt/ConstantFP support enabled by default. Doing this early will also make it easier to track the cases where code quality diverges so I can circle back to them once the functional issues have been resolved..


Patch is 6.56 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/112548.diff

830 Files Affected:

  • (modified) llvm/lib/IR/AsmWriter.cpp (+45)
  • (modified) llvm/lib/IR/Constants.cpp (+4-2)
  • (modified) llvm/test/Analysis/CostModel/AArch64/arith-fp.ll (+7-7)
  • (modified) llvm/test/Analysis/CostModel/AArch64/arith-widening.ll (+3-3)
  • (modified) llvm/test/Analysis/CostModel/AArch64/div.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/AArch64/div_cte.ll (+6-6)
  • (modified) llvm/test/Analysis/CostModel/AArch64/fshl.ll (+4-4)
  • (modified) llvm/test/Analysis/CostModel/AArch64/fshr.ll (+4-4)
  • (modified) llvm/test/Analysis/CostModel/AArch64/rem.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/div.ll (+216-216)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/fdiv.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/fneg.ll (+12-12)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/mul.ll (+96-96)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/rem.ll (+216-216)
  • (modified) llvm/test/Analysis/CostModel/ARM/divrem.ll (+410-410)
  • (modified) llvm/test/Analysis/CostModel/RISCV/arith-int.ll (+6-6)
  • (modified) llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll (+6-6)
  • (modified) llvm/test/Analysis/CostModel/RISCV/rvv-phi-const.ll (+14-14)
  • (modified) llvm/test/Analysis/CostModel/RISCV/rvv-select.ll (+1-1)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp-codesize.ll (+24-24)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp-latency.ll (+48-48)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp-sizelatency.ll (+42-42)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp.ll (+48-48)
  • (modified) llvm/test/Analysis/CostModel/X86/div-codesize.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/div-latency.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/div-sizelatency.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/div.ll (+384-384)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl-codesize.ll (+252-252)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl-latency.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl-sizelatency.ll (+276-276)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr-codesize.ll (+252-252)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr-latency.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr-sizelatency.ll (+276-276)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/mul-codesize.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/mul-latency.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/mul-sizelatency.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/mul.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/rem-codesize.ll (+180-180)
  • (modified) llvm/test/Analysis/CostModel/X86/rem-latency.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/rem-sizelatency.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/rem.ll (+384-384)
  • (modified) llvm/test/Analysis/CostModel/X86/slm-arith-costs.ll (+4-4)
  • (modified) llvm/test/Analysis/CostModel/X86/vdiv-cost.ll (+21-21)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-codesize.ll (+77-77)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-cost-inseltpoison.ll (+80-80)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-cost.ll (+80-80)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-latency.ll (+92-92)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-sizelatency.ll (+79-79)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-codesize.ll (+75-75)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-cost-inseltpoison.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-cost.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-latency.ll (+82-82)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-sizelatency.ll (+75-75)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-codesize.ll (+75-75)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-cost-inseltpoison.ll ()
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-cost.ll ()
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-latency.ll ()
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-sizelatency.ll ()
  • (modified) llvm/test/Analysis/ValueTracking/known-non-zero.ll (+3-3)
  • (modified) llvm/test/Analysis/ValueTracking/knownbits-and-or-xor-lowbit.ll (+7-7)
  • (modified) llvm/test/Analysis/ValueTracking/knownbits-bmi-pattern.ll (+24-24)
  • (modified) llvm/test/Analysis/ValueTracking/knownbits-x86-hadd-hsub.ll (+4-4)
  • (modified) llvm/test/Analysis/ValueTracking/knownzero-shift.ll (+2-2)
  • (modified) llvm/test/Analysis/ValueTracking/numsignbits-shl.ll (+6-6)
  • (modified) llvm/test/Assembler/ConstantExprFold.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-fdiv.ll (+9-9)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-i16-to-i32.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-mul24.ll (+22-22)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-late-codegenprepare.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-pow.ll (+31-31)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-pown.ll (+17-17)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-powr.ll (+17-17)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-rootn.ll (+17-17)
  • (modified) llvm/test/CodeGen/AMDGPU/lower-buffer-fat-pointers-pointer-ops.ll (+6-6)
  • (modified) llvm/test/CodeGen/AMDGPU/promote-alloca-array-aggregate.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/promote-alloca-memset.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/vni8-live-reg-opt.ll (+3-3)
  • (modified) llvm/test/CodeGen/Hexagon/autohvx/vector-align-tbaa.ll (+9-9)
  • (modified) llvm/test/CodeGen/NVPTX/variadics-lowering.ll (+1-1)
  • (modified) llvm/test/CodeGen/RISCV/rvv/fixed-vectors-strided-load-store-negative.ll (+8-8)
  • (modified) llvm/test/CodeGen/RISCV/rvv/fixed-vectors-strided-load-store.ll (+11-11)
  • (modified) llvm/test/CodeGen/Thumb2/LowOverheadLoops/tail-pred-const.ll (+161-25)
  • (modified) llvm/test/CodeGen/Thumb2/mve-gather-optimisation-deep.ll (+16-16)
  • (modified) llvm/test/CodeGen/X86/codegen-prepare-extload.ll (+1-1)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/AArch64/arm64-vshift.ll (+689-689)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/AArch64/neon_vst.ll (+121-121)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/avx-intrinsics-x86.ll (+37-37)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/avx2-intrinsics-x86.ll (+39-39)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/sse2-intrinsics-x86.ll (+51-51)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/sse41-intrinsics-x86.ll (+14-14)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/masked-store-load.ll (+18-18)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/vector-track-origins-neon.ll (-2)
  • (modified) llvm/test/Instrumentation/NumericalStabilitySanitizer/basic.ll (+6-6)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/ARM/fptosisat.ll (+10-10)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/X86/fptosisat.ll (+2-2)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/masked-cmp.ll (+5-5)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/popcount.ll (+15-15)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/trunc_multi_uses.ll (+4-4)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/vector-or-load.ll (+1-1)
  • (modified) llvm/test/Transforms/Attributor/nofpclass-powi.ll (+2-2)
  • (modified) llvm/test/Transforms/Attributor/nofpclass.ll (+4-4)
  • (modified) llvm/test/Transforms/Attributor/value-simplify-pointer-info-vec.ll (+2-2)
  • (modified) llvm/test/Transforms/BDCE/binops-multiuse.ll (+2-2)
  • (modified) llvm/test/Transforms/BDCE/dead-uses.ll (+4-4)
  • (modified) llvm/test/Transforms/BDCE/vectors-inseltpoison.ll (+15-15)
  • (modified) llvm/test/Transforms/BDCE/vectors.ll (+15-15)
  • (modified) llvm/test/Transforms/CodeGenPrepare/X86/fold-loop-of-urem.ll (+7-7)
  • (modified) llvm/test/Transforms/ConstantHoisting/AArch64/large-immediate.ll (+5-11)
  • (modified) llvm/test/Transforms/ConstraintElimination/vector-compares.ll (+1-1)
  • (modified) llvm/test/Transforms/CorrelatedValuePropagation/icmp.ll (+2-2)
  • (modified) llvm/test/Transforms/CorrelatedValuePropagation/overflows.ll (+2-2)
  • (modified) llvm/test/Transforms/CorrelatedValuePropagation/vectors.ll (+11-11)
  • (modified) llvm/test/Transforms/DeadStoreElimination/X86/gather-null-pointer.ll (+3-3)
  • (modified) llvm/test/Transforms/DeadStoreElimination/offsetted-overlapping-stores.ll (+1-1)
  • (modified) llvm/test/Transforms/DivRemPairs/AMDGPU/div-rem-pairs.ll (+2-2)
  • (modified) llvm/test/Transforms/EarlyCSE/commute.ll (+4-4)
  • (modified) llvm/test/Transforms/EarlyCSE/gep.ll (+1-1)
  • (modified) llvm/test/Transforms/GVN/non-integral-pointers-inseltpoison.ll (+2-2)
  • (modified) llvm/test/Transforms/GVN/non-integral-pointers.ll (+1-1)
  • (modified) llvm/test/Transforms/InferAddressSpaces/AMDGPU/infer-getelementptr.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/2008-07-11-RemAnd.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/2008-12-17-SRemNegConstVec.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-masked-memops.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-movmsk.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-muldq-inseltpoison.ll (+16-16)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-muldq.ll (+16-16)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pack-inseltpoison.ll (+24-24)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pack.ll (+24-24)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pmulh.ll (+6-6)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pmulhrs.ll (+6-6)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-ternlog.ll (+15-15)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-vector-shifts-inseltpoison.ll (+79-79)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-vector-shifts.ll (+79-79)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-xop-inseltpoison.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-xop.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/abs-1.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/abs-intrinsic.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/add-mask-neg.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/add-mask.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/add-shl-sdiv-to-srem.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/add-sitofp.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/add.ll (+29-29)
  • (modified) llvm/test/Transforms/InstCombine/add4.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/add_or_sub.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/addsub-constant-folding.ll (+27-27)
  • (modified) llvm/test/Transforms/InstCombine/adjust-for-minmax.ll (+10-10)
  • (modified) llvm/test/Transforms/InstCombine/and-compare.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/and-fcmp.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/and-or-icmp-const-icmp.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/and-or-icmps.ll (+12-12)
  • (modified) llvm/test/Transforms/InstCombine/and-or.ll (+19-19)
  • (modified) llvm/test/Transforms/InstCombine/and-xor-or.ll (+23-23)
  • (modified) llvm/test/Transforms/InstCombine/and.ll (+44-44)
  • (modified) llvm/test/Transforms/InstCombine/and2.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/apint-select.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/ashr-demand.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/ashr-lshr.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/avg-lsb.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/binop-and-shifts.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/binop-cast.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/binop-of-displaced-shifts.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/binop-select-cast-of-select-cond.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/binop-select.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bit-checks.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bit_ceil.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bit_floor.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bitcast-inseltpoison.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bitcast.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/bitreverse.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/bswap-fold.ll (+13-13)
  • (modified) llvm/test/Transforms/InstCombine/bswap.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-ashr-shl-to-masking.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-clamp-like-pattern-between-negative-and-positive-thresholds.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-clamp-like-pattern-between-zero-and-positive-threshold.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-eq-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ne-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sge-to-icmp-sle.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sgt-to-icmp-sgt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sle-to-icmp-sle.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-slt-to-icmp-sgt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-uge-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ugt-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ule-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ult-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-fcmp-inf.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-lack-of-signed-truncation-check.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-and-icmp-eq-to-icmp-ule.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-and-icmp-ne-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v3-and-icmp-eq-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v3-and-icmp-ne-to-icmp-ugt.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v4-and-icmp-eq-to-icmp-ule.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v4-and-icmp-ne-to-icmp-ugt.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-lshr-shl-to-masking.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-shl-lshr-to-masking.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-signed-truncation-check.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/cast-int-fcmp-eq-0.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/cast-int-icmp-eq-0.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/cast.ll (+30-30)
  • (modified) llvm/test/Transforms/InstCombine/clamp-to-minmax.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/cmp-intrinsic.ll (+18-18)
  • (modified) llvm/test/Transforms/InstCombine/combine-is.fpclass-and-fcmp.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/compare-signs.ll (+7-7)
  • (modified) llvm/test/Transforms/InstCombine/compare-udiv.ll (+8-8)
  • (modified) llvm/test/Transforms/InstCombine/consecutive-ptrmask.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/copysign-fneg-fabs.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/ctlz-cttz-shifts.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/ctpop-cttz.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/ctpop-pow2.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/ctpop.ll (+12-12)
  • (modified) llvm/test/Transforms/InstCombine/dependent-ivs.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/div-shift.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/div.ll (+29-29)
  • (modified) llvm/test/Transforms/InstCombine/eq-of-parts.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/exact.ll (+11-11)
  • (modified) llvm/test/Transforms/InstCombine/exp2-1.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/exp2-to-ldexp.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fabs-as-int.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fabs-copysign.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/fabs-fneg-fold.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fadd.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fast-math.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fcmp-range-check-idiom.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fcmp.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/fdiv.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/fma.ll (+17-17)
  • (modified) llvm/test/Transforms/InstCombine/fmul-inseltpoison.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fmul-sqrt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fmul.ll (+6-6)
  • (modified) llvm/test/Transforms/InstCombine/fneg-as-int.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fneg-fabs-as-int.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-bin-operand.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-ctpop-of-not.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/fold-select-fmul-if-zero.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-select-trunc.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-signbit-test-power2.ll (+8-8)
  • (modified) llvm/test/Transforms/InstCombine/fold-sub-of-not-to-inc-of-add.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/fpclass-check-idioms.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/fsh.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/funnel.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/gep-combine-loop-invariant.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/gep-custom-dl.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/gep-vector.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/get-lowbitmask-upto-and-including-bit.ll (+8-8)
  • (modified) llvm/test/Transforms/InstCombine/getelementptr.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/high-bit-signmask-with-trunc.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/high-bit-signmask.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/hoist-negation-out-of-bias-calculation-with-constant.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/hoist-negation-out-of-bias-calculation.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/hoist-not-from-ashr-operand.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/hoist-xor-by-constant-from-xor-by-value.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/icmp-add.ll (+17-17)
  • (modified) llvm/test/Transforms/InstCombine/icmp-and-shift.ll (+13-13)
  • (modified) llvm/test/Transforms/InstCombine/icmp-div-constant.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/icmp-logical.ll (+12-12)
  • (modified) llvm/test/Transforms/InstCombine/icmp-mul-and.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/icmp-mul.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/icmp-of-and-x.ll (+2-2)
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 6adb8d6a742255..93c66ee6d14540 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -89,6 +89,11 @@
 
 using namespace llvm;
 
+namespace llvm {
+extern cl::opt<bool> UseConstantIntForFixedLengthSplat;
+extern cl::opt<bool> UseConstantFPForFixedLengthSplat;
+} // namespace llvm
+
 // Make virtual table appear in this compilation unit.
 AssemblyAnnotationWriter::~AssemblyAnnotationWriter() = default;
 
@@ -1687,6 +1692,46 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
     return;
   }
 
+  // When in the mode where Constant{Int,FP} do not support vector types the
+  // "splat(Ty val)" syntax is interpreted as a ConstantDataVector. Maintaining
+  // this association when outputiing the IR will significantly reduce the
+  // output changes when in the mode where Constant{Int,FP} do support vector
+  // types. In turn this should make it easier to spot difference in output
+  // when switching between the modes. Once the transition is complete this
+  // code will be removed.
+  if (const ConstantDataVector *CDV = dyn_cast<ConstantDataVector>(CV)) {
+    if (auto *SplatVal = CDV->getSplatValue()) {
+      Type* EltTy = SplatVal->getType();
+
+      if (EltTy->isIntegerTy() && !UseConstantIntForFixedLengthSplat) {
+        if (const ConstantInt *CI = dyn_cast<ConstantInt>(SplatVal)) {
+          Out << "splat (";
+          WriterCtx.TypePrinter->print(EltTy, Out);
+          Out << " ";
+
+          if (EltTy->isIntegerTy(1))
+            Out << (CI->getZExtValue() ? "true" : "false");
+          else
+            Out << CI->getValue();
+
+          Out << ")";
+          return;
+        }
+      }
+
+      if (EltTy->isFloatingPointTy() && !UseConstantFPForFixedLengthSplat) {
+        if (const ConstantFP *CFP = dyn_cast<ConstantFP>(SplatVal)) {
+          Out << "splat (";
+          WriterCtx.TypePrinter->print(EltTy, Out);
+          Out << " ";
+          WriteAPFloatInternal(Out, CFP->getValueAPF());
+          Out << ")";
+          return;
+        }
+      }
+    }
+  }
+
   if (isa<ConstantVector>(CV) || isa<ConstantDataVector>(CV)) {
     auto *CVVTy = cast<FixedVectorType>(CV->getType());
     Type *ETy = CVVTy->getElementType();
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index fe3a086c5772de..d716b5c900d8e4 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -36,12 +36,14 @@ using namespace llvm;
 using namespace PatternMatch;
 
 // As set of temporary options to help migrate how splats are represented.
-static cl::opt<bool> UseConstantIntForFixedLengthSplat(
+namespace llvm {
+cl::opt<bool> UseConstantIntForFixedLengthSplat(
     "use-constant-int-for-fixed-length-splat", cl::init(false), cl::Hidden,
     cl::desc("Use ConstantInt's native fixed-length vector splat support."));
-static cl::opt<bool> UseConstantFPForFixedLengthSplat(
+cl::opt<bool> UseConstantFPForFixedLengthSplat(
     "use-constant-fp-for-fixed-length-splat", cl::init(false), cl::Hidden,
     cl::desc("Use ConstantFP's native fixed-length vector splat support."));
+}
 static cl::opt<bool> UseConstantIntForScalableSplat(
     "use-constant-int-for-scalable-splat", cl::init(false), cl::Hidden,
     cl::desc("Use ConstantInt's native scalable vector splat support."));
diff --git a/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll b/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll
index aaffd97b92b2de..b329a5607acb97 100644
--- a/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll
@@ -70,15 +70,15 @@ define i32 @fsub(i32 %arg) {
 define i32 @fneg_idiom(i32 %arg) {
 ; CHECK-LABEL: 'fneg_idiom'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F16 = fsub half 0xH8000, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fsub <4 x half> <half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fsub <8 x half> <half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000>, undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fsub <4 x half> splat (half 0xH8000), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fsub <8 x half> splat (half 0xH8000), undef
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = fsub float -0.000000e+00, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fsub <8 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fsub <2 x float> splat (float -0.000000e+00), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fsub <4 x float> splat (float -0.000000e+00), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fsub <8 x float> splat (float -0.000000e+00), undef
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = fsub double -0.000000e+00, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = fsub <4 x double> <double -0.000000e+00, double -0.000000e+00, double -0.000000e+00, double -0.000000e+00>, undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = fsub <2 x double> splat (double -0.000000e+00), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = fsub <4 x double> splat (double -0.000000e+00), undef
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
 ;
   %F16 = fsub half -0.0, undef
diff --git a/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll b/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll
index 52f6f73525a3b9..303bcfa289577c 100644
--- a/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll
@@ -2091,11 +2091,11 @@ define void @extmulv16(<16 x i8> %i8, <16 x i16> %i16, <16 x i32> %i32, <16 x i6
 define void @extmul_const(<8 x i8> %i8, <8 x i16> %i16, <8 x i32> %i32, <8 x i64> %i64)  {
 ; CHECK-LABEL: 'extmul_const'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sl1_8_16 = sext <8 x i8> %i8 to <8 x i16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %asl_8_16 = mul <8 x i16> %sl1_8_16, <i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %asl_8_16 = mul <8 x i16> %sl1_8_16, splat (i16 10)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %zl1_8_16 = zext <8 x i8> %i8 to <8 x i16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %azl_8_16 = mul <8 x i16> %zl1_8_16, <i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %azl_8_16 = mul <8 x i16> %zl1_8_16, splat (i16 10)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %zl1_8_16b = zext <8 x i8> %i8 to <8 x i16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %and = and <8 x i16> %sl1_8_16, <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %and = and <8 x i16> %sl1_8_16, splat (i16 255)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %aal_8_16 = mul <8 x i16> %zl1_8_16b, %and
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
 ;
diff --git a/llvm/test/Analysis/CostModel/AArch64/div.ll b/llvm/test/Analysis/CostModel/AArch64/div.ll
index 2ceaf0c6f536af..ada0be66c27b5a 100644
--- a/llvm/test/Analysis/CostModel/AArch64/div.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/div.ll
@@ -192,21 +192,21 @@ define i32 @sdiv_uniformconst() {
 ; CHECK-LABEL: 'sdiv_uniformconst'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %I128 = sdiv i128 undef, 7
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %I64 = sdiv i64 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = sdiv <2 x i64> undef, <i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = sdiv <4 x i64> undef, <i64 7, i64 7, i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = sdiv <8 x i64> undef, <i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = sdiv <2 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = sdiv <4 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = sdiv <8 x i64> undef, splat (i64 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = sdiv i32 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = sdiv <4 x i32> undef, <i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = sdiv <8 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = sdiv <16 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = sdiv <4 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = sdiv <8 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = sdiv <16 x i32> undef, splat (i32 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = sdiv i16 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = sdiv <8 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = sdiv <16 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = sdiv <32 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = sdiv <8 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = sdiv <16 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = sdiv <32 x i16> undef, splat (i16 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = sdiv i8 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = sdiv <16 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = sdiv <32 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = sdiv <64 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = sdiv <16 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = sdiv <32 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = sdiv <64 x i8> undef, splat (i8 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
 ;
   %I128 = sdiv i128 undef, 7
@@ -238,21 +238,21 @@ define i32 @udiv_uniformconst() {
 ; CHECK-LABEL: 'udiv_uniformconst'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %I128 = udiv i128 undef, 7
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %I64 = udiv i64 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = udiv <2 x i64> undef, <i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = udiv <4 x i64> undef, <i64 7, i64 7, i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = udiv <8 x i64> undef, <i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = udiv <2 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = udiv <4 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = udiv <8 x i64> undef, splat (i64 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = udiv i32 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = udiv <4 x i32> undef, <i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = udiv <8 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = udiv <16 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = udiv <4 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = udiv <8 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = udiv <16 x i32> undef, splat (i32 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = udiv i16 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = udiv <8 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = udiv <16 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = udiv <32 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = udiv <8 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = udiv <16 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = udiv <32 x i16> undef, splat (i16 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = udiv <16 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = udiv <32 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = udiv <64 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = udiv <16 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = udiv <32 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = udiv <64 x i8> undef, splat (i8 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
 ;
   %I128 = udiv i128 undef, 7
@@ -376,21 +376,21 @@ define i32 @sdiv_uniformconstpow2() {
 ; CHECK-LABEL: 'sdiv_uniformconstpow2'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %I128 = sdiv i128 undef, 16
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %I64 = sdiv i64 undef, 16
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %V2i64 = sdiv <2 x i64> undef, <i64 16, i64 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 30 for instruction: %V4i64 = sdiv <4 x i64> undef, <i64 16, i64 16, i64 16, i64 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 60 for instruction: %V8i64 = sdiv <8 x i64> undef, <i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %V2i64 = sdiv <2 x i64> undef, splat (i64 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 30 for instruction: %V4i64 = sdiv <4 x i64> undef, splat (i64 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 60 for instruction: %V8i64 = sdiv <8 x i64> undef, splat (i64 16)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %I32 = sdiv i32 undef, 16
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 27 for instruction: %V4i32 = sdiv <4 x i32> undef, <i32 16, i32 16, i32 16, i32 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 54 for instruction: %V8i32 = sdiv <8 x i32> undef, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 108 for instruction: %V16i32 = sdiv <16 x i32> undef, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 27 for instruction: %V4i32 = sdiv <4 x i32> undef, splat (i32 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 54 for instruction: %V8i32 = sdiv <8 x i32> undef, splat (i32 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 108 for instruction: %V16i32 = sdiv <16 x i32> undef, splat (i32 16)
 ; CHECK-NEXT:  Cost Model: Found an estimated cos...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented Oct 16, 2024

@llvm/pr-subscribers-backend-powerpc

Author: Paul Walker (paulwalker-arm)

Changes

Whilst this PR is not finished (there are many tests that still need updating) I'm sending for review because there's no value in me continuing if the goal of the PR is not acceptable. Likewise, if there's a better way to navigate the transition then I'm all ears.

I'm thinking that sooner or later the pain of having to update the tests will be required so I figured it was worth getting in early as an NFC patch rather than attempting this when trying to make the vector ConstantInt/ConstantFP support enabled by default. Doing this early will also make it easier to track the cases where code quality diverges so I can circle back to them once the functional issues have been resolved..


Patch is 6.56 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/112548.diff

830 Files Affected:

  • (modified) llvm/lib/IR/AsmWriter.cpp (+45)
  • (modified) llvm/lib/IR/Constants.cpp (+4-2)
  • (modified) llvm/test/Analysis/CostModel/AArch64/arith-fp.ll (+7-7)
  • (modified) llvm/test/Analysis/CostModel/AArch64/arith-widening.ll (+3-3)
  • (modified) llvm/test/Analysis/CostModel/AArch64/div.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/AArch64/div_cte.ll (+6-6)
  • (modified) llvm/test/Analysis/CostModel/AArch64/fshl.ll (+4-4)
  • (modified) llvm/test/Analysis/CostModel/AArch64/fshr.ll (+4-4)
  • (modified) llvm/test/Analysis/CostModel/AArch64/rem.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/div.ll (+216-216)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/fdiv.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/fneg.ll (+12-12)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/mul.ll (+96-96)
  • (modified) llvm/test/Analysis/CostModel/AMDGPU/rem.ll (+216-216)
  • (modified) llvm/test/Analysis/CostModel/ARM/divrem.ll (+410-410)
  • (modified) llvm/test/Analysis/CostModel/RISCV/arith-int.ll (+6-6)
  • (modified) llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll (+6-6)
  • (modified) llvm/test/Analysis/CostModel/RISCV/rvv-phi-const.ll (+14-14)
  • (modified) llvm/test/Analysis/CostModel/RISCV/rvv-select.ll (+1-1)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp-codesize.ll (+24-24)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp-latency.ll (+48-48)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp-sizelatency.ll (+42-42)
  • (modified) llvm/test/Analysis/CostModel/X86/arith-fp.ll (+48-48)
  • (modified) llvm/test/Analysis/CostModel/X86/div-codesize.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/div-latency.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/div-sizelatency.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/div.ll (+384-384)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl-codesize.ll (+252-252)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl-latency.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl-sizelatency.ll (+276-276)
  • (modified) llvm/test/Analysis/CostModel/X86/fshl.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr-codesize.ll (+252-252)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr-latency.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr-sizelatency.ll (+276-276)
  • (modified) llvm/test/Analysis/CostModel/X86/fshr.ll (+243-243)
  • (modified) llvm/test/Analysis/CostModel/X86/mul-codesize.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/mul-latency.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/mul-sizelatency.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/mul.ll (+192-192)
  • (modified) llvm/test/Analysis/CostModel/X86/rem-codesize.ll (+180-180)
  • (modified) llvm/test/Analysis/CostModel/X86/rem-latency.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/rem-sizelatency.ll (+168-168)
  • (modified) llvm/test/Analysis/CostModel/X86/rem.ll (+384-384)
  • (modified) llvm/test/Analysis/CostModel/X86/slm-arith-costs.ll (+4-4)
  • (modified) llvm/test/Analysis/CostModel/X86/vdiv-cost.ll (+21-21)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-codesize.ll (+77-77)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-cost-inseltpoison.ll (+80-80)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-cost.ll (+80-80)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-latency.ll (+92-92)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-ashr-sizelatency.ll (+79-79)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-codesize.ll (+75-75)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-cost-inseltpoison.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-cost.ll (+72-72)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-latency.ll (+82-82)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-lshr-sizelatency.ll (+75-75)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-codesize.ll (+75-75)
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-cost-inseltpoison.ll ()
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-cost.ll ()
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-latency.ll ()
  • (modified) llvm/test/Analysis/CostModel/X86/vshift-shl-sizelatency.ll ()
  • (modified) llvm/test/Analysis/ValueTracking/known-non-zero.ll (+3-3)
  • (modified) llvm/test/Analysis/ValueTracking/knownbits-and-or-xor-lowbit.ll (+7-7)
  • (modified) llvm/test/Analysis/ValueTracking/knownbits-bmi-pattern.ll (+24-24)
  • (modified) llvm/test/Analysis/ValueTracking/knownbits-x86-hadd-hsub.ll (+4-4)
  • (modified) llvm/test/Analysis/ValueTracking/knownzero-shift.ll (+2-2)
  • (modified) llvm/test/Analysis/ValueTracking/numsignbits-shl.ll (+6-6)
  • (modified) llvm/test/Assembler/ConstantExprFold.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-fdiv.ll (+9-9)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-i16-to-i32.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-mul24.ll (+22-22)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-late-codegenprepare.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-pow.ll (+31-31)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-pown.ll (+17-17)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-powr.ll (+17-17)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-rootn.ll (+17-17)
  • (modified) llvm/test/CodeGen/AMDGPU/lower-buffer-fat-pointers-pointer-ops.ll (+6-6)
  • (modified) llvm/test/CodeGen/AMDGPU/promote-alloca-array-aggregate.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/promote-alloca-memset.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/vni8-live-reg-opt.ll (+3-3)
  • (modified) llvm/test/CodeGen/Hexagon/autohvx/vector-align-tbaa.ll (+9-9)
  • (modified) llvm/test/CodeGen/NVPTX/variadics-lowering.ll (+1-1)
  • (modified) llvm/test/CodeGen/RISCV/rvv/fixed-vectors-strided-load-store-negative.ll (+8-8)
  • (modified) llvm/test/CodeGen/RISCV/rvv/fixed-vectors-strided-load-store.ll (+11-11)
  • (modified) llvm/test/CodeGen/Thumb2/LowOverheadLoops/tail-pred-const.ll (+161-25)
  • (modified) llvm/test/CodeGen/Thumb2/mve-gather-optimisation-deep.ll (+16-16)
  • (modified) llvm/test/CodeGen/X86/codegen-prepare-extload.ll (+1-1)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/AArch64/arm64-vshift.ll (+689-689)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/AArch64/neon_vst.ll (+121-121)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/avx-intrinsics-x86.ll (+37-37)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/avx2-intrinsics-x86.ll (+39-39)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/sse2-intrinsics-x86.ll (+51-51)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/X86/sse41-intrinsics-x86.ll (+14-14)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/masked-store-load.ll (+18-18)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/vector-track-origins-neon.ll (-2)
  • (modified) llvm/test/Instrumentation/NumericalStabilitySanitizer/basic.ll (+6-6)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/ARM/fptosisat.ll (+10-10)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/X86/fptosisat.ll (+2-2)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/masked-cmp.ll (+5-5)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/popcount.ll (+15-15)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/trunc_multi_uses.ll (+4-4)
  • (modified) llvm/test/Transforms/AggressiveInstCombine/vector-or-load.ll (+1-1)
  • (modified) llvm/test/Transforms/Attributor/nofpclass-powi.ll (+2-2)
  • (modified) llvm/test/Transforms/Attributor/nofpclass.ll (+4-4)
  • (modified) llvm/test/Transforms/Attributor/value-simplify-pointer-info-vec.ll (+2-2)
  • (modified) llvm/test/Transforms/BDCE/binops-multiuse.ll (+2-2)
  • (modified) llvm/test/Transforms/BDCE/dead-uses.ll (+4-4)
  • (modified) llvm/test/Transforms/BDCE/vectors-inseltpoison.ll (+15-15)
  • (modified) llvm/test/Transforms/BDCE/vectors.ll (+15-15)
  • (modified) llvm/test/Transforms/CodeGenPrepare/X86/fold-loop-of-urem.ll (+7-7)
  • (modified) llvm/test/Transforms/ConstantHoisting/AArch64/large-immediate.ll (+5-11)
  • (modified) llvm/test/Transforms/ConstraintElimination/vector-compares.ll (+1-1)
  • (modified) llvm/test/Transforms/CorrelatedValuePropagation/icmp.ll (+2-2)
  • (modified) llvm/test/Transforms/CorrelatedValuePropagation/overflows.ll (+2-2)
  • (modified) llvm/test/Transforms/CorrelatedValuePropagation/vectors.ll (+11-11)
  • (modified) llvm/test/Transforms/DeadStoreElimination/X86/gather-null-pointer.ll (+3-3)
  • (modified) llvm/test/Transforms/DeadStoreElimination/offsetted-overlapping-stores.ll (+1-1)
  • (modified) llvm/test/Transforms/DivRemPairs/AMDGPU/div-rem-pairs.ll (+2-2)
  • (modified) llvm/test/Transforms/EarlyCSE/commute.ll (+4-4)
  • (modified) llvm/test/Transforms/EarlyCSE/gep.ll (+1-1)
  • (modified) llvm/test/Transforms/GVN/non-integral-pointers-inseltpoison.ll (+2-2)
  • (modified) llvm/test/Transforms/GVN/non-integral-pointers.ll (+1-1)
  • (modified) llvm/test/Transforms/InferAddressSpaces/AMDGPU/infer-getelementptr.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/2008-07-11-RemAnd.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/2008-12-17-SRemNegConstVec.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-masked-memops.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-movmsk.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-muldq-inseltpoison.ll (+16-16)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-muldq.ll (+16-16)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pack-inseltpoison.ll (+24-24)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pack.ll (+24-24)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pmulh.ll (+6-6)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-pmulhrs.ll (+6-6)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-ternlog.ll (+15-15)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-vector-shifts-inseltpoison.ll (+79-79)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-vector-shifts.ll (+79-79)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-xop-inseltpoison.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/X86/x86-xop.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/abs-1.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/abs-intrinsic.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/add-mask-neg.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/add-mask.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/add-shl-sdiv-to-srem.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/add-sitofp.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/add.ll (+29-29)
  • (modified) llvm/test/Transforms/InstCombine/add4.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/add_or_sub.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/addsub-constant-folding.ll (+27-27)
  • (modified) llvm/test/Transforms/InstCombine/adjust-for-minmax.ll (+10-10)
  • (modified) llvm/test/Transforms/InstCombine/and-compare.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/and-fcmp.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/and-or-icmp-const-icmp.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/and-or-icmps.ll (+12-12)
  • (modified) llvm/test/Transforms/InstCombine/and-or.ll (+19-19)
  • (modified) llvm/test/Transforms/InstCombine/and-xor-or.ll (+23-23)
  • (modified) llvm/test/Transforms/InstCombine/and.ll (+44-44)
  • (modified) llvm/test/Transforms/InstCombine/and2.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/apint-select.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/ashr-demand.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/ashr-lshr.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/avg-lsb.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/binop-and-shifts.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/binop-cast.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/binop-of-displaced-shifts.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/binop-select-cast-of-select-cond.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/binop-select.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bit-checks.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bit_ceil.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bit_floor.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bitcast-inseltpoison.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/bitcast.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/bitreverse.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/bswap-fold.ll (+13-13)
  • (modified) llvm/test/Transforms/InstCombine/bswap.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-ashr-shl-to-masking.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-clamp-like-pattern-between-negative-and-positive-thresholds.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-clamp-like-pattern-between-zero-and-positive-threshold.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-eq-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ne-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sge-to-icmp-sle.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sgt-to-icmp-sgt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sle-to-icmp-sle.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-slt-to-icmp-sgt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-uge-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ugt-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ule-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ult-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-fcmp-inf.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-lack-of-signed-truncation-check.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-and-icmp-eq-to-icmp-ule.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-and-icmp-ne-to-icmp-ugt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v3-and-icmp-eq-to-icmp-ule.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v3-and-icmp-ne-to-icmp-ugt.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v4-and-icmp-eq-to-icmp-ule.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v4-and-icmp-ne-to-icmp-ugt.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-lshr-shl-to-masking.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-shl-lshr-to-masking.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/canonicalize-signed-truncation-check.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/cast-int-fcmp-eq-0.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/cast-int-icmp-eq-0.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/cast.ll (+30-30)
  • (modified) llvm/test/Transforms/InstCombine/clamp-to-minmax.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/cmp-intrinsic.ll (+18-18)
  • (modified) llvm/test/Transforms/InstCombine/combine-is.fpclass-and-fcmp.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/compare-signs.ll (+7-7)
  • (modified) llvm/test/Transforms/InstCombine/compare-udiv.ll (+8-8)
  • (modified) llvm/test/Transforms/InstCombine/consecutive-ptrmask.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/copysign-fneg-fabs.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/ctlz-cttz-shifts.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/ctpop-cttz.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/ctpop-pow2.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/ctpop.ll (+12-12)
  • (modified) llvm/test/Transforms/InstCombine/dependent-ivs.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/div-shift.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/div.ll (+29-29)
  • (modified) llvm/test/Transforms/InstCombine/eq-of-parts.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/exact.ll (+11-11)
  • (modified) llvm/test/Transforms/InstCombine/exp2-1.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/exp2-to-ldexp.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fabs-as-int.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fabs-copysign.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/fabs-fneg-fold.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fadd.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fast-math.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fcmp-range-check-idiom.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fcmp.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/fdiv.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/fma.ll (+17-17)
  • (modified) llvm/test/Transforms/InstCombine/fmul-inseltpoison.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fmul-sqrt.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fmul.ll (+6-6)
  • (modified) llvm/test/Transforms/InstCombine/fneg-as-int.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fneg-fabs-as-int.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-bin-operand.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-ctpop-of-not.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/fold-select-fmul-if-zero.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-select-trunc.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/fold-signbit-test-power2.ll (+8-8)
  • (modified) llvm/test/Transforms/InstCombine/fold-sub-of-not-to-inc-of-add.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/fpclass-check-idioms.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/fsh.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/funnel.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/gep-combine-loop-invariant.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/gep-custom-dl.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/gep-vector.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/get-lowbitmask-upto-and-including-bit.ll (+8-8)
  • (modified) llvm/test/Transforms/InstCombine/getelementptr.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/high-bit-signmask-with-trunc.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/high-bit-signmask.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/hoist-negation-out-of-bias-calculation-with-constant.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/hoist-negation-out-of-bias-calculation.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/hoist-not-from-ashr-operand.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/hoist-xor-by-constant-from-xor-by-value.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/icmp-add.ll (+17-17)
  • (modified) llvm/test/Transforms/InstCombine/icmp-and-shift.ll (+13-13)
  • (modified) llvm/test/Transforms/InstCombine/icmp-div-constant.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/icmp-logical.ll (+12-12)
  • (modified) llvm/test/Transforms/InstCombine/icmp-mul-and.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/icmp-mul.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/icmp-of-and-x.ll (+2-2)
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 6adb8d6a742255..93c66ee6d14540 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -89,6 +89,11 @@
 
 using namespace llvm;
 
+namespace llvm {
+extern cl::opt<bool> UseConstantIntForFixedLengthSplat;
+extern cl::opt<bool> UseConstantFPForFixedLengthSplat;
+} // namespace llvm
+
 // Make virtual table appear in this compilation unit.
 AssemblyAnnotationWriter::~AssemblyAnnotationWriter() = default;
 
@@ -1687,6 +1692,46 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
     return;
   }
 
+  // When in the mode where Constant{Int,FP} do not support vector types the
+  // "splat(Ty val)" syntax is interpreted as a ConstantDataVector. Maintaining
+  // this association when outputiing the IR will significantly reduce the
+  // output changes when in the mode where Constant{Int,FP} do support vector
+  // types. In turn this should make it easier to spot difference in output
+  // when switching between the modes. Once the transition is complete this
+  // code will be removed.
+  if (const ConstantDataVector *CDV = dyn_cast<ConstantDataVector>(CV)) {
+    if (auto *SplatVal = CDV->getSplatValue()) {
+      Type* EltTy = SplatVal->getType();
+
+      if (EltTy->isIntegerTy() && !UseConstantIntForFixedLengthSplat) {
+        if (const ConstantInt *CI = dyn_cast<ConstantInt>(SplatVal)) {
+          Out << "splat (";
+          WriterCtx.TypePrinter->print(EltTy, Out);
+          Out << " ";
+
+          if (EltTy->isIntegerTy(1))
+            Out << (CI->getZExtValue() ? "true" : "false");
+          else
+            Out << CI->getValue();
+
+          Out << ")";
+          return;
+        }
+      }
+
+      if (EltTy->isFloatingPointTy() && !UseConstantFPForFixedLengthSplat) {
+        if (const ConstantFP *CFP = dyn_cast<ConstantFP>(SplatVal)) {
+          Out << "splat (";
+          WriterCtx.TypePrinter->print(EltTy, Out);
+          Out << " ";
+          WriteAPFloatInternal(Out, CFP->getValueAPF());
+          Out << ")";
+          return;
+        }
+      }
+    }
+  }
+
   if (isa<ConstantVector>(CV) || isa<ConstantDataVector>(CV)) {
     auto *CVVTy = cast<FixedVectorType>(CV->getType());
     Type *ETy = CVVTy->getElementType();
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index fe3a086c5772de..d716b5c900d8e4 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -36,12 +36,14 @@ using namespace llvm;
 using namespace PatternMatch;
 
 // As set of temporary options to help migrate how splats are represented.
-static cl::opt<bool> UseConstantIntForFixedLengthSplat(
+namespace llvm {
+cl::opt<bool> UseConstantIntForFixedLengthSplat(
     "use-constant-int-for-fixed-length-splat", cl::init(false), cl::Hidden,
     cl::desc("Use ConstantInt's native fixed-length vector splat support."));
-static cl::opt<bool> UseConstantFPForFixedLengthSplat(
+cl::opt<bool> UseConstantFPForFixedLengthSplat(
     "use-constant-fp-for-fixed-length-splat", cl::init(false), cl::Hidden,
     cl::desc("Use ConstantFP's native fixed-length vector splat support."));
+}
 static cl::opt<bool> UseConstantIntForScalableSplat(
     "use-constant-int-for-scalable-splat", cl::init(false), cl::Hidden,
     cl::desc("Use ConstantInt's native scalable vector splat support."));
diff --git a/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll b/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll
index aaffd97b92b2de..b329a5607acb97 100644
--- a/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll
@@ -70,15 +70,15 @@ define i32 @fsub(i32 %arg) {
 define i32 @fneg_idiom(i32 %arg) {
 ; CHECK-LABEL: 'fneg_idiom'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F16 = fsub half 0xH8000, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fsub <4 x half> <half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fsub <8 x half> <half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000, half 0xH8000>, undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fsub <4 x half> splat (half 0xH8000), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fsub <8 x half> splat (half 0xH8000), undef
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = fsub float -0.000000e+00, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fsub <8 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fsub <2 x float> splat (float -0.000000e+00), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fsub <4 x float> splat (float -0.000000e+00), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fsub <8 x float> splat (float -0.000000e+00), undef
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = fsub double -0.000000e+00, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = fsub <4 x double> <double -0.000000e+00, double -0.000000e+00, double -0.000000e+00, double -0.000000e+00>, undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = fsub <2 x double> splat (double -0.000000e+00), undef
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = fsub <4 x double> splat (double -0.000000e+00), undef
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
 ;
   %F16 = fsub half -0.0, undef
diff --git a/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll b/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll
index 52f6f73525a3b9..303bcfa289577c 100644
--- a/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/arith-widening.ll
@@ -2091,11 +2091,11 @@ define void @extmulv16(<16 x i8> %i8, <16 x i16> %i16, <16 x i32> %i32, <16 x i6
 define void @extmul_const(<8 x i8> %i8, <8 x i16> %i16, <8 x i32> %i32, <8 x i64> %i64)  {
 ; CHECK-LABEL: 'extmul_const'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sl1_8_16 = sext <8 x i8> %i8 to <8 x i16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %asl_8_16 = mul <8 x i16> %sl1_8_16, <i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %asl_8_16 = mul <8 x i16> %sl1_8_16, splat (i16 10)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %zl1_8_16 = zext <8 x i8> %i8 to <8 x i16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %azl_8_16 = mul <8 x i16> %zl1_8_16, <i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %azl_8_16 = mul <8 x i16> %zl1_8_16, splat (i16 10)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %zl1_8_16b = zext <8 x i8> %i8 to <8 x i16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %and = and <8 x i16> %sl1_8_16, <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %and = and <8 x i16> %sl1_8_16, splat (i16 255)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %aal_8_16 = mul <8 x i16> %zl1_8_16b, %and
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
 ;
diff --git a/llvm/test/Analysis/CostModel/AArch64/div.ll b/llvm/test/Analysis/CostModel/AArch64/div.ll
index 2ceaf0c6f536af..ada0be66c27b5a 100644
--- a/llvm/test/Analysis/CostModel/AArch64/div.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/div.ll
@@ -192,21 +192,21 @@ define i32 @sdiv_uniformconst() {
 ; CHECK-LABEL: 'sdiv_uniformconst'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %I128 = sdiv i128 undef, 7
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %I64 = sdiv i64 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = sdiv <2 x i64> undef, <i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = sdiv <4 x i64> undef, <i64 7, i64 7, i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = sdiv <8 x i64> undef, <i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = sdiv <2 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = sdiv <4 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = sdiv <8 x i64> undef, splat (i64 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = sdiv i32 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = sdiv <4 x i32> undef, <i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = sdiv <8 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = sdiv <16 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = sdiv <4 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = sdiv <8 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = sdiv <16 x i32> undef, splat (i32 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = sdiv i16 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = sdiv <8 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = sdiv <16 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = sdiv <32 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = sdiv <8 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = sdiv <16 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = sdiv <32 x i16> undef, splat (i16 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = sdiv i8 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = sdiv <16 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = sdiv <32 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = sdiv <64 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = sdiv <16 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = sdiv <32 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = sdiv <64 x i8> undef, splat (i8 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
 ;
   %I128 = sdiv i128 undef, 7
@@ -238,21 +238,21 @@ define i32 @udiv_uniformconst() {
 ; CHECK-LABEL: 'udiv_uniformconst'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %I128 = udiv i128 undef, 7
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %I64 = udiv i64 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = udiv <2 x i64> undef, <i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = udiv <4 x i64> undef, <i64 7, i64 7, i64 7, i64 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = udiv <8 x i64> undef, <i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %V2i64 = udiv <2 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %V4i64 = udiv <4 x i64> undef, splat (i64 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i64 = udiv <8 x i64> undef, splat (i64 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = udiv i32 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = udiv <4 x i32> undef, <i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = udiv <8 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = udiv <16 x i32> undef, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V4i32 = udiv <4 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %V8i32 = udiv <8 x i32> undef, splat (i32 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i32 = udiv <16 x i32> undef, splat (i32 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = udiv i16 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = udiv <8 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = udiv <16 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = udiv <32 x i16> undef, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V8i16 = udiv <8 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 80 for instruction: %V16i16 = udiv <16 x i16> undef, splat (i16 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i16 = udiv <32 x i16> undef, splat (i16 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 undef, 7
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = udiv <16 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = udiv <32 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = udiv <64 x i8> undef, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %V16i8 = udiv <16 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 160 for instruction: %V32i8 = udiv <32 x i8> undef, splat (i8 7)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 320 for instruction: %V64i8 = udiv <64 x i8> undef, splat (i8 7)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
 ;
   %I128 = udiv i128 undef, 7
@@ -376,21 +376,21 @@ define i32 @sdiv_uniformconstpow2() {
 ; CHECK-LABEL: 'sdiv_uniformconstpow2'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %I128 = sdiv i128 undef, 16
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %I64 = sdiv i64 undef, 16
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %V2i64 = sdiv <2 x i64> undef, <i64 16, i64 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 30 for instruction: %V4i64 = sdiv <4 x i64> undef, <i64 16, i64 16, i64 16, i64 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 60 for instruction: %V8i64 = sdiv <8 x i64> undef, <i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %V2i64 = sdiv <2 x i64> undef, splat (i64 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 30 for instruction: %V4i64 = sdiv <4 x i64> undef, splat (i64 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 60 for instruction: %V8i64 = sdiv <8 x i64> undef, splat (i64 16)
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %I32 = sdiv i32 undef, 16
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 27 for instruction: %V4i32 = sdiv <4 x i32> undef, <i32 16, i32 16, i32 16, i32 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 54 for instruction: %V8i32 = sdiv <8 x i32> undef, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 108 for instruction: %V16i32 = sdiv <16 x i32> undef, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 27 for instruction: %V4i32 = sdiv <4 x i32> undef, splat (i32 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 54 for instruction: %V8i32 = sdiv <8 x i32> undef, splat (i32 16)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 108 for instruction: %V16i32 = sdiv <16 x i32> undef, splat (i32 16)
 ; CHECK-NEXT:  Cost Model: Found an estimated cos...
[truncated]

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good idea.

if (auto *SplatVal = CDV->getSplatValue()) {
Type* EltTy = SplatVal->getType();

if (EltTy->isIntegerTy() && !UseConstantIntForFixedLengthSplat) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the !UseConstantIntForFixedLengthSplat conditions needed? If we use ConstantInt for splat, then we won't reach this case anyway, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. This code only exists so that once I've updated all the tests I can remove the check to doubly verify. I'll do this locally so it shouldn't be part of the final PR unless it turns out we're wrong.

Copy link
Collaborator Author

@paulwalker-arm paulwalker-arm Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As predicted the conditions did not affect the behaviour and have been removed.

The one place where constants are still printed as <Ty V1, Ty V2...> is shufflevector masks, which go down a dedicated path. I've kept this as is for now because I figure non-zero splat masks are rare and ShuffleVectorInst::isValidOperands currently rejects ConstantInt anyway.


if (EltTy->isIntegerTy() && !UseConstantIntForFixedLengthSplat) {
if (const ConstantInt *CI = dyn_cast<ConstantInt>(SplatVal)) {
Out << "splat (";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd extract a common helper for the splat printing between this case and the "ConstantInt for splat" case.

@paulwalker-arm paulwalker-arm changed the title [LLVM][IR] Use splat syntax when printing ConstantDataVector. [LLVM][IR] Use splat syntax when printing Constant[Data]Vector. Oct 22, 2024
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:ARM backend:AArch64 backend:RISC-V mlir:llvm mlir HLSL HLSL Language Support labels Oct 22, 2024
@paulwalker-arm
Copy link
Collaborator Author

FYI: I've separated the code changes into a separate (first) commit to aid review.

Comment on lines 1703 to 1705
Out << " ";
WriteAsOperandInternal(Out, SplatVal, WriterCtx);
Out << ")";
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Out << " ";
WriteAsOperandInternal(Out, SplatVal, WriterCtx);
Out << ")";
return;
Out << ' ';
WriteAsOperandInternal(Out, SplatVal, WriterCtx);
Out << ')';
return;

The character << is cheaper than string

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// options are removed.
if (auto *SplatVal = CV->getSplatValue()) {
if (isa<ConstantInt>(SplatVal) || isa<ConstantFP>(SplatVal)) {
Out << "splat (";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a space between splat and (?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The splat printing follows the same style as used for ConstantExprs.

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@paulwalker-arm paulwalker-arm merged commit 38fffa6 into llvm:main Nov 6, 2024
6 of 7 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 6, 2024

LLVM Buildbot has detected a new failure on builder ppc64le-flang-rhel-clang running on ppc64le-flang-rhel-test while building clang,llvm,mlir at step 6 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/157/builds/12026

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
******************** TEST 'Flang :: Lower/PowerPC/ppc-vec-cmp.f90' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang -fc1 -flang-experimental-hlfir -emit-llvm /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Lower/PowerPC/ppc-vec-cmp.f90 -o - | /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/FileCheck --check-prefixes="LLVMIR" /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Lower/PowerPC/ppc-vec-cmp.f90
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang -fc1 -flang-experimental-hlfir -emit-llvm /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Lower/PowerPC/ppc-vec-cmp.f90 -o -
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/FileCheck --check-prefixes=LLVMIR /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Lower/PowerPC/ppc-vec-cmp.f90
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Lower/PowerPC/ppc-vec-cmp.f90:17:11: error: LLVMIR: expected string not found in input
! LLVMIR: %{{[0-9]+}} = xor <2 x i64> %[[res]], <i64 -1, i64 -1>
          ^
<stdin>:10:76: note: scanning from here
 %6 = call <2 x i64> @llvm.ppc.altivec.vcmpgtsd(<2 x i64> %5, <2 x i64> %4)
                                                                           ^
<stdin>:10:76: note: with "res" equal to "6"
 %6 = call <2 x i64> @llvm.ppc.altivec.vcmpgtsd(<2 x i64> %5, <2 x i64> %4)
                                                                           ^
<stdin>:11:2: note: possible intended match here
 %7 = xor <2 x i64> %6, splat (i64 -1)
 ^

Input file: <stdin>
Check file: /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Lower/PowerPC/ppc-vec-cmp.f90

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
            5:  
            6: define void @vec_cmpge_test_i8_(ptr %0, ptr %1) #0 { 
            7:  %3 = alloca <2 x i64>, i64 1, align 16 
            8:  %4 = load <2 x i64>, ptr %0, align 16 
            9:  %5 = load <2 x i64>, ptr %1, align 16 
           10:  %6 = call <2 x i64> @llvm.ppc.altivec.vcmpgtsd(<2 x i64> %5, <2 x i64> %4) 
check:17'0                                                                                X error: no match found
check:17'1                                                                                  with "res" equal to "6"
           11:  %7 = xor <2 x i64> %6, splat (i64 -1) 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:17'2      ?                                      possible intended match
           12:  store <2 x i64> %7, ptr %3, align 16 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           13:  ret void 
check:17'0     ~~~~~~~~~~
           14: } 
check:17'0     ~~
           15:  
check:17'0     ~
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 6, 2024

LLVM Buildbot has detected a new failure on builder llvm-clang-aarch64-darwin running on doug-worker-5 while building clang,llvm,mlir at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/8943

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'lit :: shtest-external-shell-kill.py' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 23
env -u FILECHECK_OPTS "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9" /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/utils/lit/lit.py -j1 --order=lexical -a Inputs/shtest-external-shell-kill | grep -v 'bash.exe: warning: could not find /tmp, please create!' | FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/build/utils/lit/tests/shtest-external-shell-kill.py
# executed command: env -u FILECHECK_OPTS /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9 /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/utils/lit/lit.py -j1 --order=lexical -a Inputs/shtest-external-shell-kill
# note: command had no output on stdout or stderr
# error: command failed with exit status: 1
# executed command: grep -v 'bash.exe: warning: could not find /tmp, please create!'
# executed command: FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/build/utils/lit/tests/shtest-external-shell-kill.py
# .---command stderr------------
# | �[1m/Users/buildbot/buildbot-root/aarch64-darwin/build/utils/lit/tests/shtest-external-shell-kill.py:29:15: �[0m�[0;1;31merror: �[0m�[1mCHECK-NEXT: is not on the line after the previous match
�[0m# | �[1m�[0m# CHECK-NEXT: end
# | �[0;1;32m              ^
�[0m# | �[0;1;32m�[0m�[1m<stdin>:22:22: �[0m�[0;1;30mnote: �[0m�[1m'next' match was here
�[0m# | �[1m�[0mRUN: at line 5: echo end
# | �[0;1;32m                     ^
�[0m# | �[0;1;32m�[0m�[1m<stdin>:8:6: �[0m�[0;1;30mnote: �[0m�[1mprevious match ended here
�[0m# | �[1m�[0mstart
# | �[0;1;32m     ^
�[0m# | �[0;1;32m�[0m�[1m<stdin>:9:1: �[0m�[0;1;30mnote: �[0m�[1mnon-matching line after previous match is here
�[0m# | �[1m�[0m
# | �[0;1;32m^
�[0m# | �[0;1;32m�[0m
# | Input file: <stdin>
# | Check file: /Users/buildbot/buildbot-root/aarch64-darwin/build/utils/lit/tests/shtest-external-shell-kill.py
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# | �[1m�[0m�[0;1;30m          1: �[0m�[1m�[0;1;46m-- Testing: 1 tests, 1 workers -- �[0m
# | �[0;1;30m          2: �[0m�[1m�[0;1;46mFAIL: shtest-external-shell-kill :: test.txt (1 of 1) �[0m
# | �[0;1;30m          3: �[0m�[1m�[0;1;46m******************** TEST 'shtest-external-shell-kill :: test.txt' FAILED ******************** �[0m
# | �[0;1;30m          4: �[0m�[1m�[0;1;46mExit Code: 1 �[0m
# | �[0;1;30m          5: �[0m�[1m�[0;1;46m �[0m
# | �[0;1;30m          6: �[0m�[1m�[0;1;46m�[0mCommand Output (stdout):�[0;1;46m �[0m
# | �[0;1;32mcheck:26     ^~~~~~~~~~~~~~~~~~~~~~~~
�[0m# | �[0;1;32m�[0m�[0;1;30m          7: �[0m�[1m�[0;1;46m�[0m--�[0;1;46m �[0m
# | �[0;1;32mnext:27      ^~
�[0m# | �[0;1;32m�[0m�[0;1;30m          8: �[0m�[1m�[0;1;46m�[0mstart�[0;1;46m �[0m
# | �[0;1;32mnext:28      ^~~~~
�[0m# | �[0;1;32m�[0m�[0;1;30m          9: �[0m�[1m�[0;1;46m �[0m
# | �[0;1;30m         10: �[0m�[1m�[0;1;46m-- �[0m
# | �[0;1;30m         11: �[0m�[1m�[0;1;46mCommand Output (stderr): �[0m
# | �[0;1;30m         12: �[0m�[1m�[0;1;46m-- �[0m
# | �[0;1;30m         13: �[0m�[1m�[0;1;46mRUN: at line 1: echo start �[0m
# | �[0;1;30m         14: �[0m�[1m�[0;1;46m+ echo start �[0m
...

@paulwalker-arm paulwalker-arm deleted the vector-constant-printing branch November 6, 2024 13:19
@paulwalker-arm
Copy link
Collaborator Author

I've pushed 246b57c to fix the failing PowerPC tests. For what it's worth I think the tests are overly restricted to only run on PowerPC machines, hence the reason they only failed after the PR landed.

I've updated some of the RUN lines so they at least run when the REQUIRES lines is removed, which I did locally to ensure my changes were correct. I don't have enough context so am guessing the intent is for them to use powerpc-registered-target rather than target=powerpc*.

zmodem added a commit to zmodem/rust that referenced this pull request Nov 7, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Nov 7, 2024
Update test for LLVM 20's new vector splat syntax

that was introduced in llvm/llvm-project#112548
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Nov 7, 2024
Update test for LLVM 20's new vector splat syntax

that was introduced in llvm/llvm-project#112548
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Nov 8, 2024
Update test for LLVM 20's new vector splat syntax

that was introduced in llvm/llvm-project#112548
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Nov 8, 2024
Update test for LLVM 20's new vector splat syntax

that was introduced in llvm/llvm-project#112548
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 8, 2024
Rollup merge of rust-lang#132740 - zmodem:simd_syntax_update, r=durin42

Update test for LLVM 20's new vector splat syntax

that was introduced in llvm/llvm-project#112548
mati865 pushed a commit to mati865/rust that referenced this pull request Nov 12, 2024
Update test for LLVM 20's new vector splat syntax

that was introduced in llvm/llvm-project#112548
jakos-sec pushed a commit to jakos-sec/rust that referenced this pull request Nov 13, 2024
@Dinistro
Copy link
Contributor

I stumbled over this change while trying to integrate LLVM head into our downstream project. Is there any way to enforce that this still prints textual IR in the old format, i.e., without "splat"? I found the following flags, but they do not seem to provide the expected behavior.

--use-constant-int-for-fixed-length-splat
--use-constant-fp-for-fixed-length-splat
--use-constant-int-for-scalable-splat
--use-constant-fp-for-scalable-splat

What I would require is some way of forcing opt to roundtrip on the following IR file without transforming this to splat syntax:

define <2 x double> @test(<2 x double> %in) {
  %res = fmul <2 x double> %in, <double 3.000000e+00, double 3.000000e+00>
  ret <2 x double> %res
}

Ofc., we can find other kinds of workarounds, but I wanted to first to confirm that this is indeed expected behavior or not.

@paulwalker-arm
Copy link
Collaborator Author

paulwalker-arm commented Nov 18, 2024

The flags are only intended to control the C++ representation of constant splats and do not affect the parsing[1] or printing.

After this PR the expected behaviour is to unify the textual representation of constant splats. I did not anticipate there being a need to control the behaviour. The parsing code has accepted the newer syntax for a while now and there shouldn't be any change in C++ IR caused by using the newer syntax unless the --use-constant-### flags in use. Are you seeing something different or is your IR going via a route that does not support the new syntax?

[1] Naturally the flags change the IR created but everything sits inside the common ConstantVector::get() interface.

@Dinistro
Copy link
Contributor

We have a, temporary, odd use-case where we need to feed the textual IR back to a tool that is built with LLVM 17. For now, we were able to bypass all incompatibilities by simple workarounds on either the LLVM head, or on the LLVM 17 side. Unfortunately, this change seems the first change that leads to a non-trivial breakage that we cannot temporary circumvent.

I'm aware that our use case is not officially supported, I just wanted to check what is supposed to happen. We will find a way to deal with this.

Either way, thanks for the quick answer and thanks for working on improvements like these 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

6 participants