diff options
author | Sanjay Patel <spatel@rotateright.com> | 2019-01-08 22:39:55 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2019-01-08 22:39:55 +0000 |
commit | d023dd60e944886a9d5a0b1dbf46f67d43293af8 (patch) | |
tree | 0bd98a23cbc0515a99f4b9598c849b83fca7b902 /llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | |
parent | 016220549dd7b1e402f9738e43a2b698e9c35c88 (diff) | |
download | bcm5719-llvm-d023dd60e944886a9d5a0b1dbf46f67d43293af8.tar.gz bcm5719-llvm-d023dd60e944886a9d5a0b1dbf46f67d43293af8.zip |
[InstCombine] canonicalize another raw IR rotate pattern to funnel shift
This is matching the equivalent of the DAG expansion,
so it should never end up with worse perf than the
original code even if the target doesn't have a rotate
instruction.
llvm-svn: 350672
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index ebbe2afe3ec..faf58a08976 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -1557,8 +1557,7 @@ static Instruction *factorizeMinMaxTree(SelectPatternFlavor SPF, Value *LHS, /// funnel shift intrinsic. Example: /// rotl32(a, b) --> (b == 0 ? a : ((a >> (32 - b)) | (a << b))) /// --> call llvm.fshl.i32(a, a, b) -static Instruction *foldSelectRotate(SelectInst &Sel, - InstCombiner::BuilderTy &Builder) { +static Instruction *foldSelectRotate(SelectInst &Sel) { // The false value of the select must be a rotate of the true value. Value *Or0, *Or1; if (!match(Sel.getFalseValue(), m_OneUse(m_Or(m_Value(Or0), m_Value(Or1))))) @@ -2047,7 +2046,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { if (Instruction *Select = foldSelectBinOpIdentity(SI, TLI)) return Select; - if (Instruction *Rot = foldSelectRotate(SI, Builder)) + if (Instruction *Rot = foldSelectRotate(SI)) return Rot; return nullptr; |