[InstCombine] foldShiftIntoShiftInAnotherHandOfAndInICmp(): avoid constantexpr pitfai...
authorRoman Lebedev <lebedev.ri@gmail.com>
Mon, 12 Aug 2019 11:28:02 +0000 (11:28 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Mon, 12 Aug 2019 11:28:02 +0000 (11:28 +0000)
commitccdad6ef486a00ed815ead642d2f62d87d86ee90
treeaa68a38cfef0a52681ff57dbbd40a8d1b48622e0
parent05e8209e3347f636e93af9182c913259ec2bbffa
[InstCombine] foldShiftIntoShiftInAnotherHandOfAndInICmp(): avoid constantexpr pitfail (PR42962)

Instead of matching value and then blindly casting to BinaryOperator
just to get the opcode, just match instruction and do no cast.

Fixes https://bugs.llvm.org/show_bug.cgi?id=42962

llvm-svn: 368554
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll