[InstCombine] add one-use check to opposite shift folds
authorSanjay Patel <spatel@rotateright.com>
Thu, 20 Jan 2022 18:35:58 +0000 (13:35 -0500)
committerSanjay Patel <spatel@rotateright.com>
Thu, 20 Jan 2022 18:49:23 +0000 (13:49 -0500)
commit2d031ec5e53f4e28ea5cc02b4cfdead98a9c0007
tree0c410654a23cad250eafefb69ab2160d6fe390e1
parent587dccfb1238724c3365b12f24f7fc343d60974b
[InstCombine] add one-use check to opposite shift folds

Test comments say this might be intentional, but I don't
see any hard evidence to support it. The extra instruction
shows up as a potential regression in D117680.

One test does show a missed fold that might be recovered
with better demanded bits analysis.
llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
llvm/test/Transforms/InstCombine/canonicalize-shl-lshr-to-masking.ll
llvm/test/Transforms/InstCombine/shift.ll