[InstCombine] fix one-use condition for shift transform
authorSanjay Patel <spatel@rotateright.com>
Mon, 6 Sep 2021 14:22:24 +0000 (10:22 -0400)
committerSanjay Patel <spatel@rotateright.com>
Mon, 6 Sep 2021 15:13:39 +0000 (11:13 -0400)
commitfbb78668f2ee4a7ce390d9a5749168c5be26874e
tree09479c744f0eba11e7a2bb2bb310e8a601fd5e95
parent982a15cb3fa0ea06fc7d24ebf56249cff06e268b
[InstCombine] fix one-use condition for shift transform

This transform is written in a confusing style,
and I suspect it is at fault for a more serious
bug noted in PR51567.

But it's been around forever, so I'm making the
minimal change to fix another bug - it could
increase instructions because it was not checking
uses.
llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
llvm/test/Transforms/InstCombine/shift-amount-reassociation-with-truncation-shl.ll