Skip to content

Commit 4cbb8fe

Browse files
committed
Avoid replacing cases that are already set to the constant
1 parent 2e2d9ce commit 4cbb8fe

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,16 @@ void llvm::reduceOperandsZeroDeltaPass(TestRunner &Test) {
134134
if (auto *IntTy = dyn_cast<IntegerType>(Op->getType()))
135135
if (switchCaseExists(Op, ConstantInt::get(IntTy, 0)))
136136
return nullptr;
137-
// Don't replace existing zeroes.
138137

139138
if (auto *TET = dyn_cast<TargetExtType>(Op->getType())) {
139+
if (isa<ConstantTargetNone, PoisonValue>(Op))
140+
return nullptr;
140141
if (TET->hasProperty(TargetExtType::HasZeroInit))
141142
return ConstantTargetNone::get(TET);
142143
return PoisonValue::get(TET);
143144
}
144145

146+
// Don't replace existing zeroes.
145147
return isZero(Op) ? nullptr : Constant::getNullValue(Op->getType());
146148
};
147149
runDeltaPass(

0 commit comments

Comments
 (0)