Issue |
126409
|
Summary |
[IndVarSimplify] Incorrect samesign handling
|
Labels |
miscompilation,
loopoptim,
llvm:transforms
|
Assignees |
|
Reporter |
dtcxzyw
|
Reproducer: https://alive2.llvm.org/ce/z/jHhApt
```
; bin/opt -passes=indvars test.ll -S
define i16 @src() {
entry:
%xor = xor i32 1, 0
%cmp4 = icmp samesign ult i32 %xor, 155
br i1 %cmp4, label %for.body10, label %if.end
for.body10: ; preds = %for.body10, %entry
%f.addr.0 = phi i8 [ 1, %for.body10 ], [ 0, %entry ]
%cmp8.old = icmp slt i8 %f.addr.0, 1
br i1 %cmp8.old, label %for.body10, label %if.end
if.end: ; preds = %for.body10, %entry
ret i16 0
}
```
```
define i16 @src() {
entry:
%xor = xor i32 1, 0
%cmp4 = icmp samesign ult i32 %xor, 155
br i1 %cmp4, label %for.body10.preheader, label %if.end
for.body10.preheader: ; preds = %entry
br label %for.body10
for.body10: ; preds = %for.body10.preheader, %for.body10
br i1 true, label %for.body10, label %if.end.loopexit
if.end.loopexit: ; preds = %for.body10
br label %if.end
if.end: ; preds = %if.end.loopexit, %entry
ret i16 0
}
```
After indvars, the program runs into an infinite loop (`for.body10 -> for.body10`).
This is a recent bug.
LLVM version: 59cbe2ff591d91e8375cfb4f4ba59dff49a82f4f
cc @artagnon
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs