[all-commits] [llvm/llvm-project] d591a4: InstCombine: Fold bitcast of vector with constant ...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Mon Feb 2 03:33:43 PST 2026


  Branch: refs/heads/users/arsenm/instcombine/fold-bitcast-through-select-const-vector
  Home:   https://github.com/llvm/llvm-project
  Commit: d591a4cb737437afc09d20b7f091b1a712bf0c40
      https://github.com/llvm/llvm-project/commit/d591a4cb737437afc09d20b7f091b1a712bf0c40
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2026-02-02 (Mon, 02 Feb 2026)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
    A llvm/test/Transforms/InstCombine/bitcast-select-const-vector.ll
    M llvm/test/Transforms/InstCombine/copysign.ll
    M llvm/test/Transforms/InstCombine/fold-bin-operand.ll

  Log Message:
  -----------
  InstCombine: Fold bitcast of vector with constant to scalar

Fold bitcast (select cond, val, const) ->
  select cond, (bitcast val), (bitcast const)

Rocm device libs has an unfortunate amount of code that does bithacking
on the sign bit of double values by casting to <2 x i32> and operation
on the high element. This breaks value tracking optimizations on the
fp value.

The existing transform would only do this if the input to the select was
also a bitcast with a single use, and if it didn't convert between vector
and scalar.


  Commit: fd146bef1b1a32e55edff127f828d5c9045b237f
      https://github.com/llvm/llvm-project/commit/fd146bef1b1a32e55edff127f828d5c9045b237f
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2026-02-02 (Mon, 02 Feb 2026)

  Changed paths:
    M llvm/test/Transforms/InstCombine/bitcast-select-const-vector.ll

  Log Message:
  -----------
  Add negative vselect test


Compare: https://github.com/llvm/llvm-project/compare/f162306b8b80...fd146bef1b1a

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