Skip to content

Commit 23fe66e

Browse files
committed
early exit if both const
1 parent 3adf819 commit 23fe66e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -4043,7 +4043,8 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
40434043
if (CondVal->getType() == SI.getType() && isKnownInversion(FalseVal, TrueVal))
40444044
return BinaryOperator::CreateXor(CondVal, FalseVal);
40454045

4046-
if (SelType->isIntOrIntVectorTy()) {
4046+
if (SelType->isIntOrIntVectorTy() &&
4047+
(!isa<Constant>(TrueVal) || !isa<Constant>(FalseVal))) {
40474048
// Try to simplify select arms based on KnownBits implied by the condition.
40484049
CondContext CC(CondVal);
40494050
findValuesAffectedByCondition(CondVal, /*IsAssume=*/false, [&](Value *V) {

0 commit comments

Comments
 (0)