[llvm] r316082 - Fixup patch for revision rL316070.
Nikolai Bozhenov via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 18 07:24:50 PDT 2017
Author: n.bozhenov
Date: Wed Oct 18 07:24:50 2017
New Revision: 316082
URL: http://llvm.org/viewvc/llvm-project?rev=316082&view=rev
Log:
Fixup patch for revision rL316070.
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 at intel.com>
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=316082&r1=316081&r2=316082&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Wed Oct 18 07:24:50 2017
@@ -4365,7 +4365,8 @@ static Value *lookThroughCast(CmpInst *C
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
More information about the llvm-commits
mailing list