[all-commits] [llvm/llvm-project] 8a69fb: [InstCombine] Fold (X + C) + (Y & ~C) to X + (Y | ...

hanbeom via All-commits all-commits at lists.llvm.org
Tue Apr 14 09:34:38 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a69fb096cb3f3f99ee9bf25247f4b0bc442ca84
      https://github.com/llvm/llvm-project/commit/8a69fb096cb3f3f99ee9bf25247f4b0bc442ca84
  Author: hanbeom <kese111 at gmail.com>
  Date:   2026-04-15 (Wed, 15 Apr 2026)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/test/Transforms/InstCombine/add.ll

  Log Message:
  -----------
  [InstCombine] Fold (X + C) + (Y & ~C) to X + (Y | C) (#191334)

Add an InstCombine fold for masked overwrite patterns where the add
constant matches the cleared bits in the mask:

  (X + C) + (Y & ~C) -> X + (Y | C)

Since `Y & ~C` clears all bits set in C, adding C cannot generate carry
through those bits and is equivalent to setting them with `or`.

Proof: https://alive2.llvm.org/ce/z/277UFK
Fixed: https://github.com/llvm/llvm-project/issues/191171



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