[InstCombine] Prune fshl/fshr with masked operands
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 16 Apr 2019 19:05:49 +0000 (19:05 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 16 Apr 2019 19:05:49 +0000 (19:05 +0000)
commit5ecd6a48b938b37822cbfd9f309bb14e56043d38
treeb69d13f4edbbbf65c2c1ed00f8794cd89c8e986b
parentf700081a7d977fd132b2fdaf8609627ca12e92b9
[InstCombine] Prune fshl/fshr with masked operands

If a constant shift amount is used, then only some of the LHS/RHS
operand bits are demanded and we may be able to simplify based on
that. InstCombineSimplifyDemanded already had the necessary support
for that, we just weren't calling it with fshl/fshr as root.

In particular, this allows us to relax some masked funnel shifts
into simple shifts, as shown in the tests.

Patch by Shawn Landden.

Differential Revision: https://reviews.llvm.org/D60660

llvm-svn: 358515
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/fsh.ll