[all-commits] [llvm/llvm-project] b93173: [InstCombine] Narrow trunc(lshr) in more cases (#1...

Usman Nadeem via All-commits all-commits at lists.llvm.org
Tue May 13 13:43:03 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b93173185d9c93bd6fc94baaa453bd030cd36fea
      https://github.com/llvm/llvm-project/commit/b93173185d9c93bd6fc94baaa453bd030cd36fea
  Author: Usman Nadeem <mnadeem at quicinc.com>
  Date:   2025-05-13 (Tue, 13 May 2025)

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

  Log Message:
  -----------
  [InstCombine] Narrow trunc(lshr) in more cases (#139645)

We can narrow `trunc(lshr(i32)) to i8` to `trunc(lshr(i16)) to i8` even
when the bits that we are shifting in are not zero, in the cases where
the MSBs of the shifted value don't actually matter and actually end up
being truncated away.

This kind of narrowing does not remove the trunc but can help the
vectorizer generate better code in a smaller type.
Motivation: libyuv, functions like ARGBToUV444Row_C().

Proof: https://alive2.llvm.org/ce/z/9Ao2aJ



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