[InstCombine] Fix bswap(trunc(bswap(x))) -> trunc(lshr(x, c)) vector support
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 30 Sep 2020 14:51:54 +0000 (15:51 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 30 Sep 2020 15:01:08 +0000 (16:01 +0100)
commit323d08e50a7bb80786dc00a8ade6ae49e1358393
treeebef65b6915dcf18f4feb94b59230b5a87ff6c84
parentb85de2c69cf3d6fbc2ad3439a6224667a58f704c
[InstCombine] Fix bswap(trunc(bswap(x))) -> trunc(lshr(x, c)) vector support

Use getScalarSizeInBits not getPrimitiveSizeInBits to determine the shift value at the element level.
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/bswap-fold.ll