[all-commits] [llvm/llvm-project] df9e5a: [InstCombine] Match scalable splats in m_ImmConsta...

Luke Lau via All-commits all-commits at lists.llvm.org
Wed Apr 2 13:22:13 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: df9e5ae5b40c4d245d904a2565e46f5b7ab9c7c8
      https://github.com/llvm/llvm-project/commit/df9e5ae5b40c4d245d904a2565e46f5b7ab9c7c8
  Author: Luke Lau <luke at igalia.com>
  Date:   2025-04-02 (Wed, 02 Apr 2025)

  Changed paths:
    M llvm/include/llvm/IR/PatternMatch.h
    M llvm/test/Transforms/InstCombine/select.ll
    M llvm/test/Transforms/InstCombine/shl-bo.ll
    M llvm/test/Transforms/InstCombine/shl-twice-constant.ll
    M llvm/test/Transforms/InstCombine/sub.ll

  Log Message:
  -----------
  [InstCombine] Match scalable splats in m_ImmConstant (#132522)

#118806 fixed an infinite loop in FoldShiftByConstant that could occur
when the shift amount was a ConstantExpr.

However this meant that FoldShiftByConstant no longer kicked in for
scalable vectors because scalable splats are represented by
ConstantExprs.

This fixes it by allowing scalable splats of non-ConstantExprs in
m_ImmConstant, which also fixes a few other test cases where scalable
splats were being missed.

But I'm also hoping that UseConstantIntForScalableSplat will eventually
remove the need for this.

I noticed this when trying to reverse a combine on RISC-V in #132245,
and saw that the resulting vector and scalar forms were different.

---------

Co-authored-by: Yingwei Zheng <dtcxzyw at qq.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list