diff options
author | Nikolai Bozhenov <nikolai.bozhenov@intel.com> | 2017-10-18 14:24:50 +0000 |
---|---|---|
committer | Nikolai Bozhenov <nikolai.bozhenov@intel.com> | 2017-10-18 14:24:50 +0000 |
commit | 9723f12491da5a1879d73213254ccc00ed825aaa (patch) | |
tree | 96a2da7b6ad477e8ea87912f9d4e5cd2327541e7 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 77bf0fd59c058a8920fd2ed71e27a8203bba62de (diff) | |
download | llvm-9723f12491da5a1879d73213254ccc00ed825aaa.zip llvm-9723f12491da5a1879d73213254ccc00ed825aaa.tar.gz llvm-9723f12491da5a1879d73213254ccc00ed825aaa.tar.bz2 |
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@intel.com>
llvm-svn: 316082
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 55a7a35..4f5d69d 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -4365,7 +4365,8 @@ static Value *lookThroughCast(CmpInst *CmpI, Value *V1, Value *V2, 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 |