[PATCH] D64064: [InstCombine] Dropping redundant masking before right-shift (PR42456)
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 2 03:33:17 PDT 2019
lebedev.ri created this revision.
lebedev.ri added reviewers: spatel, nikic, RKSimon.
lebedev.ri added a project: LLVM.
If we have:
`(X & (-1 << Y)) outer>> Y`
Or non-canonical
`((X inner>> Y) << Y) outer>> Y`
The mask is redundant, and can be dropped:
`X outer>> Y`
This is valid for both `lshr and `ashr` in both positions and any combination.
https://rise4fun.com/Alive/Vf1p
We must not preserve `exact`:
https://rise4fun.com/Alive/DYq
https://rise4fun.com/Alive/JXjy
Should fix PR42456 <https://bugs.llvm.org/show_bug.cgi?id=42456>
Repository:
rL LLVM
https://reviews.llvm.org/D64064
Files:
lib/Transforms/InstCombine/InstCombineShifts.cpp
test/Transforms/InstCombine/redundant-shift-input-masking.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64064.207502.patch
Type: text/x-patch
Size: 6727 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190702/04d2da3e/attachment.bin>
More information about the llvm-commits
mailing list