[InstSimplify] remove zero-shift-guard fold for general funnel shift
authorSanjay Patel <spatel@rotateright.com>
Tue, 26 Feb 2019 18:26:56 +0000 (18:26 +0000)
committerSanjay Patel <spatel@rotateright.com>
Tue, 26 Feb 2019 18:26:56 +0000 (18:26 +0000)
commit9dada83d6c533376b919eaf93cea99772f180814
treecb64eca057b5f6963635544d08533c1383fd5036
parentc0170de2222ea3e06265b6e262ced5c56784f06f
[InstSimplify] remove zero-shift-guard fold for general funnel shift

As discussed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2019-February/130491.html

We can't remove the compare+select in the general case because
we are treating funnel shift like a standard instruction (as
opposed to a special instruction like select/phi).

That means that if one of the operands of the funnel shift is
poison, the result is poison regardless of whether we know that
the operand is actually unused based on the instruction's
particular semantics.

The motivating case for this transform is the more specific
rotate op (rather than funnel shift), and we are preserving the
fold for that case because there is no chance of introducing
extra poison when there is no anonymous extra operand to the
funnel shift.

llvm-svn: 354905
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstSimplify/call.ll