Skip to content

Commit

Permalink
Add a clarifying comment about branching on poison
Browse files Browse the repository at this point in the history
I recently got this wrong (again), and I'm sure I'm not the only one.  Put a comment in the logical place someone would look to "fix" the obvious "missed optimization" which arrises based on the common misunderstanding.  Hopefully, this will save others time.  :)

llvm-svn: 363318
  • Loading branch information
preames committed Jun 13, 2019
1 parent 79ec1a2 commit 038e01d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions llvm/lib/Analysis/ValueTracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4388,6 +4388,10 @@ const Value *llvm::getGuaranteedNonFullPoisonOp(const Instruction *I) {
return I->getOperand(1);

default:
// Note: It's really tempting to think that a conditional branch or
// switch should be listed here, but that's incorrect. It's not
// branching off of poison which is UB, it is executing a side effecting
// instruction which follows the branch.
return nullptr;
}
}
Expand Down

0 comments on commit 038e01d

Please sign in to comment.