[PATCH] D101273: [JumpThreading] Set KeepOneInputPHIs to be true when DeleteDeadBlocks
guopeilin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 26 01:50:41 PDT 2021
guopeilin added a comment.
https://bugs.llvm.org/show_bug.cgi?id=50119
The bug is that we will be trapped into an infinite loop when we doing jump threading pass, and finally exhaust the stack.
The Jump Threading call function getValueFromCondition() of LazyValueInfo, and this function will recursively call itself in a way shown in the fowllowing:
BinaryOperator *BO = dyn_cast<BinaryOperator>(Cond);
Value *BL = BO->getOperand(0);
Value *BR = BO->getOperand(1);
if (BL == Cond || BR == Cond)
return ValueLatticeElement::getOverdefined();
return intersect(getValueFromCondition(Val, BL, isTrueDest, Visited),
getValueFromCondition(Val, BR, isTrueDest, Visited));
At some time, let's consume that the condition is `%spec.select44.i.us.1 = or i1 undef, %.b31.i.us.1`, its second operand is `%.b31.i.us.1`.
And, `%.b31.i.us.1`'s second is `%spec.select44.i.us.1` again.
So we will be trapped here, with `%.b31.i.us.1` and `%spec.select44.i.us.1` appear alternately.
I guess the root reason is that we generate invalid IRs that use do not dominated by its def.
In D101273#2715865 <https://reviews.llvm.org/D101273#2715865>, @lattner wrote:
> I *think* that the current behavior is ok. Dominance is not defined in unreachable code, so cyclic references etc are allowed (by the verifier etc). What is the problem that this is causing?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101273/new/
https://reviews.llvm.org/D101273
More information about the llvm-commits
mailing list