OSDN Git Service

[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)
commitd04ee38acdc9d1493a7f5ea879c583357a4fe355
tree14dc8c0d98c1e169c580b348752bdd894084ac86
parent7e18e3836ec2ba6bafd982cfed464a04776bcf39
[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354905 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/InstructionSimplify.cpp
test/Transforms/InstSimplify/call.ll