[all-commits] [llvm/llvm-project] 549215: [ConstantFold] Support byte values in `bitcast` co...

Pedro Lobo via All-commits all-commits at lists.llvm.org
Sun Apr 19 11:58:40 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5492150b2078f03c9c1942c13f6d0428a530e165
      https://github.com/llvm/llvm-project/commit/5492150b2078f03c9c1942c13f6d0428a530e165
  Author: Pedro Lobo <pedro.lobo at tecnico.ulisboa.pt>
  Date:   2026-04-19 (Sun, 19 Apr 2026)

  Changed paths:
    M llvm/lib/Analysis/ConstantFolding.cpp
    M llvm/lib/IR/ConstantFold.cpp
    M llvm/test/Transforms/InstSimplify/bitcast-vector-fold.ll

  Log Message:
  -----------
  [ConstantFold] Support byte values in `bitcast` constant folding (#188030)

Add support for constant folding `bitcast` instructions including
`ConstantByte` values. This patch handles bitcasts between byte types
and integer, FP, and other byte types in both directions.

`poison` source bytes are preserved, rather than letting the generic
integer fold refine them to `undef` or zero. This is because some
threading optimizations just compare the result of constant folding
(e.g., https://github.com/llvm/llvm-project/pull/114280).

Folds are skipped for byte `bitcast`s where element counts don't divide
evenly and the source contains `poison` values. Some of these casts can
be folded. However, this is left for a future PR.



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