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 1219 - dag combine miscompilation of setlt
Summary: dag combine miscompilation of setlt
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Common Code Generator Code (show other bugs)
Version: trunk
Hardware: All All
: P normal
Assignee: Chris Lattner
URL:
Keywords: miscompilation
Depends on:
Blocks:
 
Reported: 2007-02-23 19:28 PST by Chris Lattner
Modified: 2010-02-22 12:45 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Lattner 2007-02-23 19:28:50 PST
From Anton: switch lowering is still broken somehow.

Consider the folowing code:

define i32 @main(i32 %argc, i8** %argv) {
old_entry1:
        br label %cond_next
cond_next:
        %not.tmp14 = icmp slt i32 %argc, 11
        %hvar2 = zext i1 %not.tmp14 to i32
        switch i32 %hvar2, label %old_entry [
                 i32 -2, label %cond_true
                 i32 -1, label %cond_next
                 i32 0, label %cond_true15
                 i32 1, label %cond_next22
        ]
cond_true15:
        ret i32 1
cond_true:
        ret i32 2
cond_next22:
        ret i32 3
old_entry:
        ret i32 4
}

(Yes, I know, that cases -1 and -2 are really dead).

Resulting binary will always produce result code 4. Commenting out "-1" and "-2"
cases will fix the problem.
Comment 1 Chris Lattner 2007-02-23 20:10:13 PST
Testcase here:
CodeGen/Generic/2007-02-23-DAGCombine-Miscompile.ll

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

Thanks for tracking this down Anton!

-Chris