]> granicus.if.org Git - llvm/commit
[InstCombine] canonicalize funnel shift constant shift amount to be modulo bitwidth
authorSanjay Patel <spatel@rotateright.com>
Thu, 14 Mar 2019 19:22:08 +0000 (19:22 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 14 Mar 2019 19:22:08 +0000 (19:22 +0000)
commit82311c6556ecbe61cc471d366c23f4ae8eb49504
treedff6eba2e682cd8ce258430d4a6bbfb93a218ee2
parent74800bb68bc95e37b39d685f147e004976381764
[InstCombine] canonicalize funnel shift constant shift amount to be modulo bitwidth

The shift argument is defined to be modulo the bitwidth, so if that argument
is a constant, we can always reduce the constant to its minimal form to allow
better CSE and other follow-on transforms.

We need to be careful to ignore constant expressions here, or we will likely
infinite loop. I'm adding a general vector constant query for that case.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356192 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Constant.h
lib/Analysis/InstructionSimplify.cpp
lib/IR/Constants.cpp
lib/Transforms/InstCombine/InstCombineCalls.cpp
test/Transforms/InstCombine/fsh.ll