<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - inline function seems generating wrong code"
href="http://llvm.org/bugs/show_bug.cgi?id=17070">17070</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>inline function seems generating wrong code
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>manjian2006@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=11135" name="attach_11135" title="The preprocessed source & llvm IR source">attachment 11135</a> <a href="attachment.cgi?id=11135&action=edit" title="The preprocessed source & llvm IR source">[details]</a></span>
The preprocessed source & llvm IR source
The generated IR of heapSort is wrong in this line:
the inline function swap
swap(start[endIndex], start[0]);
the llvm code looks like this:
define linkonce_odr hidden void
@_ZN3WTF8heapSortIPNS_6OwnPtrIN7WebCore13MediaQueryExpEEEPFbRKS4_S7_EEEvT_SA_T0_(%"class.WTF::OwnPtr.1"*
%start, %"class.WTF::OwnPtr.1"* %end, i1 (%"class.WTF::OwnPtr.1"*,
%"class.WTF::OwnPtr.1"*)* nocapture %compareLess) #0 {
...
.lr.ph: ; preds =
%_ZN3WTF7heapifyIPNS_6OwnPtrIN7WebCore13MediaQueryExpEEEPFbRKS4_S7_EEEvT_iT0_.exit.preheader
%34 = getelementptr inbounds %"class.WTF::OwnPtr.1"* %start, i32 0, i32 0
br label %35
; <label>:35 ; preds = %.lr.ph,
%_ZN3WTF7heapifyIPNS_6OwnPtrIN7WebCore13MediaQueryExpEEEPFbRKS4_S7_EEEvT_iT0_.exit.backedge
%endIndex.04 = phi i32 [ %endIndex.02.pre-phi, %.lr.ph ], [ %endIndex.0,
%_ZN3WTF7heapifyIPNS_6OwnPtrIN7WebCore13MediaQueryExpEEEPFbRKS4_S7_EEEvT_iT0_.exit.backedge
]
%endIndex.0.in3 = phi i32 [ %4, %.lr.ph ], [ %endIndex.04,
%_ZN3WTF7heapifyIPNS_6OwnPtrIN7WebCore13MediaQueryExpEEEPFbRKS4_S7_EEEvT_iT0_.exit.backedge
]
%36 = getelementptr inbounds %"class.WTF::OwnPtr.1"* %start, i32
%endIndex.04, i32 0
%37 = load %"class.WebCore::MediaQueryExp"** %36, align 4, !tbaa !3
store %"class.WebCore::MediaQueryExp"* %37, %"class.WebCore::MediaQueryExp"**
%34, align 4, !tbaa !3
%38 = add nsw i32 %endIndex.0.in3, -2
%39 = icmp slt i32 %38, 1
br i1 %39, label
%_ZN3WTF7heapifyIPNS_6OwnPtrIN7WebCore13MediaQueryExpEEEPFbRKS4_S7_EEEvT_iT0_.exit.backedge,
label %.lr.ph.i1
As you can see swap function involve two load insts and two store insts,but
just one of them is generated.Please check this bug.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>