]> granicus.if.org Git - llvm/commit
[InstCombine] Recommit: Shift amount reassociation: shl-trunc-shl pattern
authorRoman Lebedev <lebedev.ri@gmail.com>
Wed, 7 Aug 2019 09:41:50 +0000 (09:41 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Wed, 7 Aug 2019 09:41:50 +0000 (09:41 +0000)
commit067d81efdb9b2b7d9495f49427419d009ddb0a52
treede985d16036cab4bef6f7a0a06c4820a62d50306
parent330c94129497c5c3d6c1f952beaefed8fac62424
[InstCombine] Recommit: Shift amount reassociation: shl-trunc-shl pattern

This was initially committed in r368059 but got reverted in r368084
because there was a faulty logic in how the shift amounts type mismatch
was being handled (it simply wasn't).

I've added an explicit bailout before we SimplifyAddInst() - i don't think
it's designed in general to handle differently-typed values, even though
the actual problem only comes from ConstantExpr's.

I have also changed the common type deduction, to not just blindly
look past zext, but try to do that so that in the end types match.

Differential Revision: https://reviews.llvm.org/D65380

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368141 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/PatternMatch.h
lib/Transforms/InstCombine/InstCombineShifts.cpp
test/Transforms/InstCombine/shift-amount-reassociation-with-truncation-shl.ll