[all-commits] [llvm/llvm-project] 038606: [InstCombine] do not assume the operand position o...

Hongyu Chen via All-commits all-commits at lists.llvm.org
Thu Jun 25 03:10:34 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 038606bcc37039cd0dbaede7be18a0b353ffcabf
      https://github.com/llvm/llvm-project/commit/038606bcc37039cd0dbaede7be18a0b353ffcabf
  Author: Hongyu Chen <xxs_chy at outlook.com>
  Date:   2026-06-25 (Thu, 25 Jun 2026)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
    M llvm/test/Transforms/InstCombine/bswap.ll

  Log Message:
  -----------
  [InstCombine] do not assume the operand position of reverse shuffle (#205747)

Fixes https://github.com/llvm/llvm-project/issues/204522
`Shuf->isReverse` only guarantees that the shuffle mask is reverse for
one of the operands, instead of the first one, and we cannot assume that
the second shuffle operand is undef. Otherwise, the assertion can be
triggered by the bitcasts on non-canonical shuffles, e.g., bitcast on
`%shuffle` generated by `InstCombinerImpl::mergeStoreIntoSuccessor` in
the testcase.

In this patch, we remove the assertion and do the fold only if the
second shuffle operand is undef. In this case, for whichever shuffle
operand the mask is reverse for, we are performing the correct
refinement.



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