[all-commits] [llvm/llvm-project] d125ca: [InstCombine] Support multi-use values in cast eli...

Valeriy Savchenko via All-commits all-commits at lists.llvm.org
Tue Nov 25 09:43:49 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d125cab13f08eee4d02d02e46223d14285bb2353
      https://github.com/llvm/llvm-project/commit/d125cab13f08eee4d02d02e46223d14285bb2353
  Author: Valeriy Savchenko <vsavchenko at apple.com>
  Date:   2025-11-25 (Tue, 25 Nov 2025)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
    M llvm/test/Transforms/InstCombine/cast-mul-select.ll
    M llvm/test/Transforms/InstCombine/cast.ll
    M llvm/test/Transforms/InstCombine/catchswitch-phi.ll
    M llvm/test/Transforms/InstCombine/icmp-mul-zext.ll
    M llvm/test/Transforms/InstCombine/known-bits-lerp-pattern.ll
    M llvm/test/Transforms/InstCombine/logical-select-inseltpoison.ll
    M llvm/test/Transforms/InstCombine/logical-select.ll

  Log Message:
  -----------
  [InstCombine] Support multi-use values in cast elimination transforms (#165877)

`canEvaluateTruncated` and `canEvaluateSExtd` previously rejected
multi-use values to avoid duplication. This was overly conservative, if
all users of a multi-use value are part of the transform, we can
evaluate it in a different type without duplication.

This change tracks visited values and defers decisions on multi-use
values until we verify all their users were visited.
`EvaluateInDifferentType` now memoizes multi-use values to avoid
creating duplicates.

Applied to truncation and sext. Zext unchanged due to its dual-return
nature.



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