HomePhabricator

[InstCombine] factorize left shifts of add/sub

Authored by spatel on Sep 20 2020, 9:55 AM.

Description

[InstCombine] factorize left shifts of add/sub

We do similar factorization folds in SimplifyUsingDistributiveLaws,
but that drops no-wrap properties. Propagating those optimally may
help solve:
https://llvm.org/PR47430

The propagation is all-or-nothing for these patterns: when all
3 incoming ops have nsw or nuw, the 2 new ops should have the
same no-wrap property:
https://alive2.llvm.org/ce/z/Dv8wsU

This also solves:
https://llvm.org/PR47584

Details

Committed
spatelSep 20 2020, 9:55 AM
Parents
rGcf75e83275d1: [InstCombine] replace zombie unreachable values with 'undef' before erasing
Branches
Unknown
Tags
Unknown