Skip to content

Commit ca733bd

Browse files
committed
Supposing V1 and V2 are the same type, replace the checking to assertion.
1 parent d81963f commit ca733bd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8897,8 +8897,7 @@ static Value *lookThroughCast(CmpInst *CmpI, Value *V1, Value *V2,
88978897

88988898
Value *CastedTo = nullptr;
88998899
if (*CastOp == Instruction::Trunc) {
8900-
if (match(CmpI->getOperand(1), m_ZExtOrSExt(m_Specific(V2))) &&
8901-
V2->getType() == Cast1->getType()) {
8900+
if (match(CmpI->getOperand(1), m_ZExtOrSExt(m_Specific(V2)))) {
89028901
// Here we have the following case:
89038902
// %y_ext = sext iK %y to iN
89048903
// %cond = cmp iN %x, %y_ext
@@ -8910,6 +8909,8 @@ static Value *lookThroughCast(CmpInst *CmpI, Value *V1, Value *V2,
89108909
// %cond = cmp iN %x, %y_ext
89118910
// %widesel = select i1 %cond, iN %x, iN%y_ext
89128911
// %tr = trunc iN %widesel to iK
8912+
assert(V2->getType() == Cast1->getType() &&
8913+
"V2 and Cast1 should be the same type.");
89138914
CastedTo = CmpI->getOperand(1);
89148915
}
89158916
}

0 commit comments

Comments
 (0)