[all-commits] [llvm/llvm-project] 9b2411: [InstCombine] Require one-use intermediate binop i...
Andrey Grabezhnoy via All-commits
all-commits at lists.llvm.org
Mon Apr 27 06:22:41 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 9b2411da20d78653fdc93972e26700aef2f7dfe9
https://github.com/llvm/llvm-project/commit/9b2411da20d78653fdc93972e26700aef2f7dfe9
Author: Andrey Grabezhnoy <andrey.grabezhnoy at intel.com>
Date: 2026-04-27 (Mon, 27 Apr 2026)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
M llvm/test/Transforms/InstCombine/and-xor-or.ll
M llvm/test/Transforms/InstCombine/binop-and-shifts.ll
Log Message:
-----------
[InstCombine] Require one-use intermediate binop in foldBinOpShiftWithShift (#194341)
foldBinOpShiftWithShift rewrites
binop(shift(X,C) op Mask, shift(Y,C))
to
binop(shift(X+Y,C), Mask).
Both shifts are matched with m_OneUse, but the enclosing binop that
wraps (shift(X,C), Mask) is not. When that binop has additional users
the rewrite cannot eliminate the originals and only adds new
instructions. The reproducer in the issue shows this: a shared base
with several downstream consumers gets duplicated on each one, so the
fold grows the IR instead of shrinking it.
Wrap the outer m_c_BinOp in m_OneUse so the fold only fires when the
binop can actually be replaced. Mirrors the one-use discipline already
applied to both shifts in the same matcher.
Fixes #194007.
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