llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

LoopDistribute domtree handling gives eternal loop

Open uabjean opened this issue 10 years ago • 2 comments

Bugzilla Link 30958
Resolution FIXED
Resolved on Dec 19, 2016 11:21
Version trunk
OS Windows NT
Attachments Small program provoking the bug
CC @fhahn,@mikaelholmen

Extended Description

Opt gets stuck in an eternal loop with the attached small program, using these flags:

opt -simplifycfg -loop-distribute -instcombine loopdist_simplified.ll

The reason is that the LoopDistribute pass mess up the dominator tree and introduce a cycle, so when the instcombiner needs to walk the dominator tree it gets stuck in a tight eternal loop:

Program received signal SIGINT, Interrupt. llvm::DominatorTreeBasellvm::BasicBlock::dominatedBySlowTreeWalk (this=0x343d570, A=0x345e5e0, B=0x3455b70) at ../include/llvm/Support/GenericDomTree.h:220 220 B = IDom; // Walk up the tree

If we use this command line: opt -loop-distribute -verify-dom-info loopdist_simplified.ll

... the verifier complains:

DominatorTree for function: f is not up to date! Computed: =============================-------------------------------- Inorder Dominator Tree: DFSNumbers invalid: 0 slow queries. [1] %0 {0,5}

Actual: =============================-------------------------------- Inorder Dominator Tree: [1] %0 {0,17} [2] %bb1 {1,16} [3] %bb2.lver.check {2,15} [4] %bb2.ph.lver.orig {3,6} [5] %bb2.lver.orig {4,5} [4] %bb2.ph.ldist1 {7,14} [5] %bb2.ldist1 {8,13} [6] %bb2.ph {9,12} [7] %bb2 {10,11}

uabjean avatar Nov 09 '16 11:11 uabjean

Should be fixed by https://reviews.llvm.org/rL290116

fhahn avatar Dec 19 '16 19:12 fhahn

I've a patch for that issue in review: https://reviews.llvm.org/D27469

fhahn avatar Dec 18 '16 23:12 fhahn