[llvm] [SDAG] Teach FoldConstantArithmetic to match splats inserted into vectors (PR #163984)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 20 03:08:49 PDT 2025
================
@@ -8,7 +8,7 @@
define void @pr35443() {
; CHECK-LABEL: pr35443:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: vpbroadcastb ac+4(%rip), %xmm0
+; CHECK-NEXT: vpbroadcastb ac+4(%rip), %ymm0
----------------
MacDue wrote:
I've come up with an alternate approach that updates `FoldConstantArithmetic` to handle this case (does not appear to cause any regressions).
I looked into the various IsSplat/GetSplat functions, but I didn't see any uses that looked like they would result in these cases being constant-folded. Waiting till ISEL also looked like it may be too late, as some nodes, like UDIV, may expand to a more complex sequence by that point.
https://github.com/llvm/llvm-project/pull/163984
More information about the llvm-commits
mailing list