[NFC] Use new canCreatePoison to make code intent more clear in PoisonChecking

This commit is contained in:
Philip Reames 2020-04-15 12:34:48 -07:00
parent 18ee0fca8c
commit 75ca7127bc
1 changed files with 5 additions and 2 deletions

View File

@ -192,6 +192,8 @@ static Value* generatePoisonChecks(Instruction &I) {
// Handle non-binops seperately // Handle non-binops seperately
switch (I.getOpcode()) { switch (I.getOpcode()) {
default: default:
// Note there are a couple of missing cases here, once implemented, this
// should become an llvm_unreachable.
break; break;
case Instruction::ExtractElement: { case Instruction::ExtractElement: {
Value *Vec = I.getOperand(0); Value *Vec = I.getOperand(0);
@ -296,8 +298,9 @@ static bool rewrite(Function &F) {
for (Value *V : I.operands()) for (Value *V : I.operands())
Checks.push_back(getPoisonFor(ValToPoison, V)); Checks.push_back(getPoisonFor(ValToPoison, V));
if (auto *Check = generatePoisonChecks(I)) if (canCreatePoison(&I))
Checks.push_back(Check); if (auto *Check = generatePoisonChecks(I))
Checks.push_back(Check);
ValToPoison[&I] = buildOrChain(B, Checks); ValToPoison[&I] = buildOrChain(B, Checks);
} }