[all-commits] [llvm/llvm-project] 2e3e0a: [InstCombine] fold opposite shifts around an add
RotateRight via All-commits
all-commits at lists.llvm.org
Thu Dec 30 08:54:15 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2e3e0a5c288041745f88a06e66a831c236a3bb1f
https://github.com/llvm/llvm-project/commit/2e3e0a5c288041745f88a06e66a831c236a3bb1f
Author: Sanjay Patel <spatel at rotateright.com>
Date: 2021-12-30 (Thu, 30 Dec 2021)
Changed paths:
M llvm/include/llvm/CodeGen/BasicTTIImpl.h
M llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
M llvm/test/Transforms/InstCombine/lshr.ll
M llvm/test/Transforms/LoopVectorize/X86/gather_scatter.ll
Log Message:
-----------
[InstCombine] fold opposite shifts around an add
((X << C) + Y) >>u C --> (X + (Y >>u C)) & (-1 >>u C)
https://alive2.llvm.org/ce/z/DY9DPg
This replaces a shift with an 'and', and in the case
where the add has a constant operand, it eliminates
both shifts.
As noted in the TODO comment, we already have this fold when
the shifts are in the opposite order (and that code handles
bitwise logic ops too).
Fixes #52851
More information about the All-commits
mailing list