<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Instcombine started loosing inbounds sometimes after 12"
href="https://bugs.llvm.org/show_bug.cgi?id=51815">51815</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Instcombine started loosing inbounds sometimes after 12
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>lebedev.ri@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre><a href="https://godbolt.org/z/nP1jTaErz">https://godbolt.org/z/nP1jTaErz</a>
*** IR Dump Before InstCombinePass on _Z15roundToMultipleIPcET_S1_mb ***
; Function Attrs: inlinehint mustprogress nofree nosync nounwind readnone
uwtable willreturn
define linkonce_odr dso_local i8* @_Z15roundToMultipleIPcET_S1_mb(i8* %value,
i64 %multiple, i1 zeroext %roundDown) local_unnamed_addr #1 comdat {
entry:
%cmp = icmp eq i64 %multiple, 0
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%0 = ptrtoint i8* %value to i64
%rem = urem i64 %0, %multiple
%cmp1 = icmp eq i64 %rem, 0
br i1 %cmp1, label %return, label %if.end3
if.end3: ; preds = %if.end
%idx.neg = sub i64 0, %rem
%add.ptr = getelementptr inbounds i8, i8* %value, i64 %idx.neg
%add.ptr6 = getelementptr inbounds i8, i8* %add.ptr, i64 %multiple
%retval.0 = select i1 %roundDown, i8* %add.ptr, i8* %add.ptr6
br label %return
return: ; preds = %if.end3, %if.end,
%entry
%retval.2 = phi i8* [ %value, %entry ], [ %retval.0, %if.end3 ], [ %value,
%if.end ]
ret i8* %retval.2
}
INSTCOMBINE ITERATION #1 on _Z15roundToMultipleIPcET_S1_mb
IC: ADD: ret i8* %retval.2
IC: ADD: %retval.2 = phi i8* [ %value, %entry ], [ %retval.0, %if.end3 ], [
%value, %if.end ]
IC: ADD: br label %return
IC: ADD: %retval.0 = select i1 %roundDown, i8* %add.ptr, i8* %add.ptr6
IC: ADD: %add.ptr6 = getelementptr inbounds i8, i8* %add.ptr, i64 %multiple
IC: ADD: %add.ptr = getelementptr inbounds i8, i8* %value, i64 %idx.neg
IC: ADD: %idx.neg = sub i64 0, %rem
IC: ADD: br i1 %cmp1, label %return, label %if.end3
IC: ADD: %cmp1 = icmp eq i64 %rem, 0
IC: ADD: %rem = urem i64 %0, %multiple
IC: ADD: %0 = ptrtoint i8* %value to i64
IC: ADD: br i1 %cmp, label %return, label %if.end
IC: ADD: %cmp = icmp eq i64 %multiple, 0
IC: Visiting: %cmp = icmp eq i64 %multiple, 0
IC: Visiting: br i1 %cmp, label %return, label %if.end
IC: Visiting: %0 = ptrtoint i8* %value to i64
IC: Visiting: %rem = urem i64 %0, %multiple
IC: Visiting: %cmp1 = icmp eq i64 %rem, 0
IC: Visiting: br i1 %cmp1, label %return, label %if.end3
IC: Visiting: %idx.neg = sub i64 0, %rem
Negator: attempting to sink negation into %rem = urem i64 %0, %multiple
Negator: failed to sink negation into %rem = urem i64 %0, %multiple
IC: Visiting: %add.ptr = getelementptr inbounds i8, i8* %value, i64 %idx.neg
IC: Visiting: %add.ptr6 = getelementptr inbounds i8, i8* %add.ptr, i64
%multiple
IC: Visiting: %retval.0 = select i1 %roundDown, i8* %add.ptr, i8* %add.ptr6
IC: ADD DEFERRED: %retval.0.idx = select i1 %roundDown, i64 0, i64 %multiple
IC: Old = %retval.0 = select i1 %roundDown, i8* %add.ptr, i8* %add.ptr6
New = <badref> = getelementptr i8, i8* %add.ptr, i64 %retval.0.idx
IC: ADD: %retval.0 = getelementptr i8, i8* %add.ptr, i64 %retval.0.idx
IC: ERASE %1 = select i1 %roundDown, i8* %add.ptr, i8* %add.ptr6
IC: ADD DEFERRED: %add.ptr = getelementptr inbounds i8, i8* %value, i64
%idx.neg
IC: ADD DEFERRED: %add.ptr6 = getelementptr inbounds i8, i8* %add.ptr, i64
%multiple
IC: ERASE %add.ptr6 = getelementptr inbounds i8, i8* %add.ptr, i64 %multiple
IC: ADD: %add.ptr = getelementptr inbounds i8, i8* %value, i64 %idx.neg
IC: ADD: %retval.0.idx = select i1 %roundDown, i64 0, i64 %multiple
IC: Visiting: %retval.0.idx = select i1 %roundDown, i64 0, i64 %multiple
IC: Visiting: %add.ptr = getelementptr inbounds i8, i8* %value, i64 %idx.neg
IC: Visiting: %retval.0 = getelementptr i8, i8* %add.ptr, i64 %retval.0.idx
IC: Visiting: br label %return
IC: Visiting: %retval.2 = phi i8* [ %value, %entry ], [ %retval.0, %if.end3
], [ %value, %if.end ]
IC: Visiting: ret i8* %retval.2
INSTCOMBINE ITERATION #2 on _Z15roundToMultipleIPcET_S1_mb
IC: ADD: ret i8* %retval.2
IC: ADD: %retval.2 = phi i8* [ %value, %entry ], [ %retval.0, %if.end3 ], [
%value, %if.end ]
IC: ADD: br label %return
IC: ADD: %retval.0 = getelementptr i8, i8* %add.ptr, i64 %retval.0.idx
IC: ADD: %retval.0.idx = select i1 %roundDown, i64 0, i64 %multiple
IC: ADD: %add.ptr = getelementptr inbounds i8, i8* %value, i64 %idx.neg
IC: ADD: %idx.neg = sub i64 0, %rem
IC: ADD: br i1 %cmp1, label %return, label %if.end3
IC: ADD: %cmp1 = icmp eq i64 %rem, 0
IC: ADD: %rem = urem i64 %0, %multiple
IC: ADD: %0 = ptrtoint i8* %value to i64
IC: ADD: br i1 %cmp, label %return, label %if.end
IC: ADD: %cmp = icmp eq i64 %multiple, 0
IC: Visiting: %cmp = icmp eq i64 %multiple, 0
IC: Visiting: br i1 %cmp, label %return, label %if.end
IC: Visiting: %0 = ptrtoint i8* %value to i64
IC: Visiting: %rem = urem i64 %0, %multiple
IC: Visiting: %cmp1 = icmp eq i64 %rem, 0
IC: Visiting: br i1 %cmp1, label %return, label %if.end3
IC: Visiting: %idx.neg = sub i64 0, %rem
Negator: attempting to sink negation into %rem = urem i64 %0, %multiple
Negator: failed to sink negation into %rem = urem i64 %0, %multiple
IC: Visiting: %add.ptr = getelementptr inbounds i8, i8* %value, i64 %idx.neg
IC: Visiting: %retval.0.idx = select i1 %roundDown, i64 0, i64 %multiple
IC: Visiting: %retval.0 = getelementptr i8, i8* %add.ptr, i64 %retval.0.idx
IC: Visiting: br label %return
IC: Visiting: %retval.2 = phi i8* [ %value, %entry ], [ %retval.0, %if.end3
], [ %value, %if.end ]
IC: Visiting: ret i8* %retval.2
*** IR Dump After InstCombinePass on _Z15roundToMultipleIPcET_S1_mb ***
; Function Attrs: inlinehint mustprogress nofree nosync nounwind readnone
uwtable willreturn
define linkonce_odr dso_local i8* @_Z15roundToMultipleIPcET_S1_mb(i8* %value,
i64 %multiple, i1 zeroext %roundDown) local_unnamed_addr #1 comdat {
entry:
%cmp = icmp eq i64 %multiple, 0
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%0 = ptrtoint i8* %value to i64
%rem = urem i64 %0, %multiple
%cmp1 = icmp eq i64 %rem, 0
br i1 %cmp1, label %return, label %if.end3
if.end3: ; preds = %if.end
%idx.neg = sub i64 0, %rem
%add.ptr = getelementptr inbounds i8, i8* %value, i64 %idx.neg
%retval.0.idx = select i1 %roundDown, i64 0, i64 %multiple
%retval.0 = getelementptr i8, i8* %add.ptr, i64 %retval.0.idx
br label %return
return: ; preds = %if.end3, %if.end,
%entry
%retval.2 = phi i8* [ %value, %entry ], [ %retval.0, %if.end3 ], [ %value,
%if.end ]
ret i8* %retval.2
}</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>