Added check that type of CmpConst and source type of trunc are equal
for correct matching of the case when we can set widened C constant
equal to CmpConstant.
%cond = cmp iN %x, CmpConst
%tr = trunc iN %x to iK
%narrowsel = select i1 %cond, iK %t, iK C
Patch by: Gainullin, Artur <artur.gainullin@intel.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316082
91177308-0d34-0410-b5e6-
96231b3b80d8
break;
case Instruction::Trunc:
Constant *CmpConst;
- if (match(CmpI->getOperand(1), m_Constant(CmpConst))) {
+ if (match(CmpI->getOperand(1), m_Constant(CmpConst)) &&
+ CmpConst->getType() == SrcTy) {
// Here we have the following case:
//
// %cond = cmp iN %x, CmpConst