[InstCombine] visitCallInst - retain undefs in vector funnel shift amounts
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 14 Oct 2020 13:38:08 +0000 (14:38 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 14 Oct 2020 13:38:21 +0000 (14:38 +0100)
commit25a97c3a43d7bc469ec67dd4e901a507b9b11116
treef4b0d0090d6c8368b6716805808764c5078dee49
parent6756d43af97ea39722af14504b286e302955c6b5
[InstCombine] visitCallInst - retain undefs in vector funnel shift amounts

By always performing a modulo on the shift amount constants this was causing undef amounts being replaced with zero, meaning we were losing funnel shift by splat (with undef) patterns.

Tweaked the shift amount bounds check to support (passthrough) undefs, and use Constant::mergeUndefsWith to preserve the undefs after folding.
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/funnel.ll
llvm/test/Transforms/InstCombine/rotate.ll