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 1114 - dag combine induces cycle when folding c ? (load p) : (load q)
Summary: dag combine induces cycle when folding c ? (load p) : (load q)
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Common Code Generator Code (show other bugs)
Version: 1.7
Hardware: All All
: P normal
Assignee: Chris Lattner
URL:
Keywords: compile-fail
Depends on:
Blocks:
 
Reported: 2007-01-15 16:43 PST by Anton Korobeynikov
Modified: 2010-02-22 12:53 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments
Failed bytecode (3.46 KB, application/octet-stream)
2007-01-15 16:44 PST, Anton Korobeynikov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Korobeynikov 2007-01-15 16:43:17 PST
./llc bugpoint-reduced-simplified.bc 
llc: /home/asl/proj/llvm/src/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:336: void
<unnamed>::SelectionDAGLegalize::LegalizeDAG(): Assertion `Order.size() ==
Visited.size() && Order.size() == (unsigned)std::distance(DAG.allnodes_begin(),
DAG.allnodes_end()) && "Error: DAG is cyclic!"' failed.

This is reduction from Mozilla.
Comment 1 Anton Korobeynikov 2007-01-15 16:44:09 PST
Created attachment 565 [details]
Failed bytecode
Comment 2 Chris Lattner 2007-01-15 23:32:50 PST
looks like a dag combine issue.
Comment 3 Chris Lattner 2007-01-15 23:42:58 PST
reduced testcase:

declare i1 %foo()

define i32 %test(i32* %A, i32* %B) {
        %a = load i32* %A
        %b = load i32* %B
        %cond = call i1 %foo()
        %c = select i1 %cond, i32 %a, i32 %b
        ret i32 %c
}

Comment 4 Chris Lattner 2007-01-16 00:01:10 PST
Fixed.  Testcase here: CodeGen/Generic/2007-01-15-LoadSelectCycle.ll

Patch here:

-Chris
Comment 5 Chris Lattner 2007-01-16 00:02:20 PST
no really! patch here: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-
Mon-20070115/042758.html