]> granicus.if.org Git - llvm/commit
[InstCombine] conditional sign-extend of high-bit-extract: 'or' pattern.
authorRoman Lebedev <lebedev.ri@gmail.com>
Sun, 20 Oct 2019 20:52:06 +0000 (20:52 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sun, 20 Oct 2019 20:52:06 +0000 (20:52 +0000)
commitb93a52f5fec53c51628fa923f8a573f9f6ce2c98
treeabb104ee4e7b8fd3f25181f164f62caf76912223
parent150b0bedb7f0aa3af89dbd75a3f046b76260c191
[InstCombine] conditional sign-extend of high-bit-extract: 'or' pattern.

In this pattern, all the "magic" bits that we'd `add` are all
high sign bits, and in the value we'd be adding to they are all unset,
not unexpectedly, so we can have an `or` there:
https://rise4fun.com/Alive/ups

It is possible that `haveNoCommonBitsSet()` should be taught about this
pattern so that we never have an `add` variant, but the reasoning would
need to be recursive (because of that `select`), so i'm not really sure
that would be worth it just yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375378 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineAddSub.cpp
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
lib/Transforms/InstCombine/InstCombineInternal.h
test/Transforms/InstCombine/conditional-variable-length-signext-after-high-bit-extract.ll