[InstCombine] Shift amount reassociation: fixup constantexpr handling (PR42484)
authorRoman Lebedev <lebedev.ri@gmail.com>
Tue, 2 Jul 2019 12:54:48 +0000 (12:54 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Tue, 2 Jul 2019 12:54:48 +0000 (12:54 +0000)
commit0bde7c65275ef4fcd51bc92e1b6c280f9888b73f
tree21469a76b6790a2005c10cbe63f6036e6ed424e1
parent6c0dcf65e7105611d4fe46e2a10629ce3c9abe5c
[InstCombine] Shift amount reassociation: fixup constantexpr handling (PR42484)

I was actually wondering if there was some nicer way than m_Value()+cast,
but apparently what i was really "subconsciously" thinking about
was correctness issue.

hasNoUnsignedWrap()/hasNoUnsignedWrap() exist for Instruction,
not for BinaryOperator, so let's just use m_Instruction(),
thus both avoiding a cast, and a crash.

Fixes https://bugs.llvm.org/show_bug.cgi?id=42484,
      https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15587

llvm-svn: 364915
llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
llvm/test/Transforms/InstCombine/shift-amount-reassociation.ll