Skip to content

Commit c33e176

Browse files
committed
Simplify more
1 parent 601c7ad commit c33e176

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13550,8 +13550,8 @@ SDValue DAGCombiner::visitSETCC(SDNode *N) {
1355013550
KnownVal = false;
1355113551
}
1355213552

13553-
// If not handled by special cases, use ICmpInst::compare
1355413553
if (!KnownVal) {
13554+
bool SupportedPredicate = true;
1355513555
KnownBits KnownLHS = DAG.computeKnownBits(N0);
1355613556

1355713557
// Convert ISD::CondCode to CmpInst::Predicate
@@ -13588,17 +13588,17 @@ SDValue DAGCombiner::visitSETCC(SDNode *N) {
1358813588
Pred = CmpInst::ICMP_SGE;
1358913589
break;
1359013590
default:
13591-
return SDValue(); // Unsupported predicate
13591+
SupportedPredicate = false;
13592+
break;
1359213593
}
1359313594

13594-
// Use the same logic as GlobalISel: ICmpInst::compare
13595-
KnownVal = ICmpInst::compare(KnownLHS, KnownRHS, Pred);
13595+
if (SupportedPredicate)
13596+
KnownVal = ICmpInst::compare(KnownLHS, KnownRHS, Pred);
1359613597
}
1359713598

1359813599
// If the comparison result is known, replace with constant
13599-
if (KnownVal) {
13600+
if (KnownVal)
1360013601
return DAG.getBoolConstant(*KnownVal, DL, VT, N1.getValueType());
13601-
}
1360213602
}
1360313603

1360413604
if (SDValue Combined = SimplifySetCC(VT, N0, N1, Cond, DL, !PreferSetCC)) {

0 commit comments

Comments
 (0)