]> granicus.if.org Git - llvm/commit
[NFC][InstCombine] Shift amount reassociation: add flag preservation test
authorRoman Lebedev <lebedev.ri@gmail.com>
Fri, 28 Jun 2019 15:32:52 +0000 (15:32 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Fri, 28 Jun 2019 15:32:52 +0000 (15:32 +0000)
commit4f9b5abd8a0a1d8ca6b936430f7afc99dc7423ef
tree1fe97211d7e0d09170e709a1962a754e23ff4ab5
parentc8753f157b307ed204ac0dacec323824521c56a2
[NFC][InstCombine] Shift amount reassociation: add flag preservation test

As discussed in https://reviews.llvm.org/D63812#inline-569870
* exact on both lshr => exact https://rise4fun.com/Alive/plHk
* exact on both ashr => exact https://rise4fun.com/Alive/QDAA
* nuw on both shl => nuw https://rise4fun.com/Alive/5Uk
* nsw on both shl => nsw https://rise4fun.com/Alive/0plg

So basically if the same flag is set on both original shifts -> set it on new shift.
Don't think we can do anything with non-matching flags on shl.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364652 91177308-0d34-0410-b5e6-96231b3b80d8
test/Transforms/InstCombine/shift-amount-reassociation.ll