[llvm-bugs] [Bug 51815] New: Instcombine started loosing inbounds sometimes after 12
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Sep 10 04:08:55 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51815
Bug ID: 51815
Summary: Instcombine started loosing inbounds sometimes after
12
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: lebedev.ri at gmail.com
CC: llvm-bugs at lists.llvm.org
https://godbolt.org/z/nP1jTaErz
*** 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
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210910/0553ac14/attachment.html>
More information about the llvm-bugs
mailing list