[llvm-bugs] [Bug 51866] New: Miscompile by -loop-bound-split (load from wrong address after split)
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Sep 15 01:28:01 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51866
Bug ID: 51866
Summary: Miscompile by -loop-bound-split (load from wrong
address after split)
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Loop Optimizer
Assignee: unassignedbugs at nondot.org
Reporter: mikael.holmen at ericsson.com
CC: llvm-bugs at lists.llvm.org
Created attachment 25259
--> https://bugs.llvm.org/attachment.cgi?id=25259&action=edit
bbi-60288.ll reproducer
llvm commit: 0dc461441eed
Reproduce with:
opt -passes='module(loop-bound-split)' -S -o - bbi-60288.ll
In the input the loop executes 10 rounds, and for each round we read in B with
the induction variable "i" as offset.
After loop-bound-split, the loop is split in two, one for i < 5 and one for
larger i. However, in the second loop we starts over reading at offset 0 in B
instead of offset 5.
I.e. in the second loop we do
for.cond.split: ; preds =
%for.cond.split.preheader, %for.inc.split
%i.0.split = phi i16 [ %inc.split, %for.inc.split ], [ 0,
%for.cond.split.preheader ]
%exitcond.not.split = icmp eq i16 %i.0.split, 10
br i1 %exitcond.not.split, label %for.end.loopexit, label %for.body.split
for.body.split: ; preds = %for.cond.split
%cmp1.split = icmp ult i16 %i.0.split, 5
%arrayidx.split = getelementptr inbounds [10 x i16], [10 x i16]* @B, i16 0,
i16 %i.0.split
%2 = load i16, i16* %arrayidx.split, align 1
br i1 false, label %if.then.split, label %if.else.split
where %i.0.split "starts over" from 0 in the PHI and %i.0.split is used in the
gep determining where to read.
I think the PHI should be
%i.0.split = phi i16 [ %inc.split, %for.inc.split ], [ 5,
%for.cond.split.preheader ]
instead.
--
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/20210915/3e74fee8/attachment-0001.html>
More information about the llvm-bugs
mailing list