LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 1110 - break-crit-edges incorrectly updates idoms for unreachable code
Summary: break-crit-edges incorrectly updates idoms for unreachable code
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Transformation Utilities (show other bugs)
Version: 1.0
Hardware: All All
: P normal
Assignee: Chris Lattner
URL:
Keywords: compile-fail
Depends on:
Blocks:
 
Reported: 2007-01-14 08:32 PST by Nick Lewycky
Modified: 2018-11-07 00:17 PST (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments
testcase (1.35 KB, application/octet-stream)
2007-01-14 08:33 PST, Nick Lewycky
Details
testcase in asm form (6.17 KB, text/plain)
2007-01-14 10:04 PST, Nick Lewycky
Details
Updated bytecode (1.36 KB, application/octet-stream)
2007-01-14 10:09 PST, Anton Korobeynikov
Details
Updated source (6.09 KB, text/plain)
2007-01-14 10:10 PST, Anton Korobeynikov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Lewycky 2007-01-14 08:32:32 PST
Steps to reproduce:

$ llvm/Debug/bin/opt -etforest -break-crit-edges -domtree x.bc -disable-output
Segmentation fault

The backtrace shows an infinite loop
#123147 0x085b20b7 in llvm::DominatorTree::getNodeForBlock (this=0x87191f8, 
    BB=0x0) at Dominators.cpp:380

but before that, it  seems that llvm::DominatorTree::calculate's "ImmDom", which
is gets from ImmediateDominator is out of date:

#174577 0x085b225f in llvm::DominatorTree::calculate (this=0x87191f8, 
    ID=@0x871a1a8) at Dominators.cpp:399
399             Node *IDomNode = getNodeForBlock(ImmDom);
(gdb) p ImmDom
$2 = (class llvm::BasicBlock *) 0x8719838
(gdb) p ImmDom->getName()
Cannot access memory at address 0xff75effc
(gdb) down
#174576 0x085b20b7 in llvm::DominatorTree::getNodeForBlock (this=0x87191f8, 
    BB=0x8719838) at Dominators.cpp:380
380       Node *IDomNode = getNodeForBlock(IDom);
(gdb) p IDom
$3 = (class llvm::BasicBlock *) 0x0

and that's the start of the infinite loop.
Comment 1 Nick Lewycky 2007-01-14 08:33:01 PST
Created attachment 560 [details]
testcase
Comment 2 Nick Lewycky 2007-01-14 09:47:21 PST
Actually, "-idom -break-crit-edges -domtree" is sufficient.
Comment 3 Nick Lewycky 2007-01-14 10:04:01 PST
Created attachment 561 [details]
testcase in asm form
Comment 4 Anton Korobeynikov 2007-01-14 10:08:48 PST
segfault confirmed with TOT. Upgraded bytecode attached.
Comment 5 Anton Korobeynikov 2007-01-14 10:09:53 PST
Created attachment 562 [details]
Updated bytecode
Comment 6 Anton Korobeynikov 2007-01-14 10:10:27 PST
Created attachment 563 [details]
Updated source
Comment 7 Chris Lattner 2007-01-14 12:08:39 PST
It sounds like b-c-e isn't updating idom correctly.  I'll take a look.
Comment 8 Chris Lattner 2007-01-14 12:35:01 PST
Fixed, testcase here: Analysis/Dominators/2007-01-14-BreakCritEdges.ll

Patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070108/042657.html

-Chris
Comment 9 Nick Lewycky 2007-01-14 14:29:29 PST
Yup, all better. Thanks Chris!