[llvm-bugs] [Bug 30629] New: Indvars not respecting "nuw" property on add, leading to infinite loop
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Oct 7 01:20:22 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=30629
Bug ID: 30629
Summary: Indvars not respecting "nuw" property on add, leading
to infinite loop
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: mikael.holmen at ericsson.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Created attachment 17414
--> https://llvm.org/bugs/attachment.cgi?id=17414&action=edit
Reproducer
It seems like indvars can produce wrong output.
In the input we have the following loop counter update and test
%_tmp4 = icmp ult i16 %uc.1.0, 65535
%_tmp2 = add nuw i16 %uc.1.0, 1
indvars rewrites this to
%_tmp2 = add nuw i16 %uc.1.0, 1
%exitcond = icmp ne i16 %_tmp2, 0
Note that the input add instruction was "nuw", and the "nuw" property is still
left on the add after the transformation, but now the add will indeed
overflow!
If running e.g. instcombine afterwards the icmp is simply replaced with i1 true
and we get an infinite loop.
Reproduce with:
opt -S ./indvar-bug.ll -indvars
--
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/20161007/024e6106/attachment.html>
More information about the llvm-bugs
mailing list