Skip to content

Commit ab6bcb2

Browse files
committed
Add a comment in the code trying to explain the situation
1 parent 9cccde2 commit ab6bcb2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,11 @@ static bool dominatesMergePoint(
463463
if (!isSafeToSpeculativelyExecute(I, InsertPt, AC))
464464
return false;
465465

466+
// Overflow arithmetic instruction plus extract value are usually generated
467+
// when a division is being replaced. But, in this case, the zero check may
468+
// still be kept in the code. In that case it would be worth to hoist these
469+
// two instruction out of the basic block. Let's treat this pattern as one
470+
// single cheap instruction here!
466471
WithOverflowInst *OverflowInst;
467472
if (match(I, m_ExtractValue<1>(m_OneUse(m_WithOverflowInst(OverflowInst))))) {
468473
ZeroCostInstructions.insert(OverflowInst);

0 commit comments

Comments
 (0)