[all-commits] [llvm/llvm-project] 349372: [InstCombine] Add fold combining adjacent extracte...

Ryunosuke (Rick) Yanashita via All-commits all-commits at lists.llvm.org
Mon Sep 14 20:26:43 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3493720eca95cf844a8d7e58fdd12e0e5644e7d0
      https://github.com/llvm/llvm-project/commit/3493720eca95cf844a8d7e58fdd12e0e5644e7d0
  Author: Ryunosuke (Rick) Yanashita <ryunosukeyanashita at gmail.com>
  Date:   2026-09-15 (Tue, 15 Sep 2026)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    M llvm/test/Transforms/InstCombine/trunc.ll

  Log Message:
  -----------
  [InstCombine] Add fold combining adjacent extracted bit fields to restore optimization for separate truncations (#219598)

This restores the InstCombine optimization that was lost (regression)
starting from Clang 14, when assembling adjacent bit fields extracted
from a wider integer.

The fold combines:
```
(trunc (lshr X, S) & M0) | (lshr (trunc X), S & M1) --> (trunc (lshr X, S) & (C0 | C1))
```
The fold handles both orderings. I implemented tests for this fold in
trunc.ll

alive2 proof: https://alive2.llvm.org/ce/z/rPQN4D 

Fixes #215254



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