[llvm-bugs] [Bug 45290] New: Infinite loop in SplitCriticalSideEffectEdges
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Mar 24 06:10:22 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45290
Bug ID: 45290
Summary: Infinite loop in SplitCriticalSideEffectEdges
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: mikael.holmen at ericsson.com
CC: llvm-bugs at lists.llvm.org
Created attachment 23276
--> https://bugs.llvm.org/attachment.cgi?id=23276&action=edit
bbi-40381_x86.ll reproducer
Reproduce with:
llc -O0 -mtriple=x86_64-unknown-linux-gnu -o - bbi-40381_x86.ll
With -debug -debug-Pass=Executions the last thing we see is
[2020-03-24 13:58:41.006703848] 0x60aee00 Executing Pass 'X86 DAG->DAG
Instruction Selection' on Function 'f26'...
=== f26
Running in the debugger we see that we're stuck in the loop in
SplitCriticalSideEffectEdges in SelectionDAGISel.cpp:
static void SplitCriticalSideEffectEdges(Function &Fn, DominatorTree *DT,
LoopInfo *LI) {
// Loop for blocks with phi nodes.
for (BasicBlock &BB : Fn) {
PHINode *PN = dyn_cast<PHINode>(BB.begin());
if (!PN) continue;
ReprocessBlock:
// For each block with a PHI node, check to see if any of the input values
// are potentially trapping constant expressions. Constant expressions are
// the only potentially trapping value that can occur as the argument to a
// PHI.
for (BasicBlock::iterator I = BB.begin(); (PN = dyn_cast<PHINode>(I)); ++I)
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
ConstantExpr *CE = dyn_cast<ConstantExpr>(PN->getIncomingValue(i));
if (!CE || !CE->canTrap()) continue;
// The only case we have to worry about is when the edge is critical.
// Since this block has a PHI Node, we assume it has multiple input
// edges: check to see if the pred has multiple successors.
BasicBlock *Pred = PN->getIncomingBlock(i);
if (Pred->getTerminator()->getNumSuccessors() == 1)
continue;
// Okay, we have to split this edge.
SplitCriticalEdge(
Pred->getTerminator(), GetSuccessorNumber(Pred, &BB),
CriticalEdgeSplittingOptions(DT, LI).setMergeIdenticalEdges());
goto ReprocessBlock;
}
}
}
The problem in this case is because BB has only one predecessor, so
SplitCriticalEdge bails out early and does nothing and we're stuck.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200324/6211ece1/attachment.html>
More information about the llvm-bugs
mailing list