Issue 91481
Summary miscompile due to interaction between returned and range attributes
Labels miscompilation
Assignees
Reporter regehr
    this function:
```llvm
define i32 @f(i32 %0) {
  %2 = shl i32 %0, 1
 %3 = sub nuw i32 %2, %0
  ret i32 %3
}
```
is being optimized to:
```lllvm
define range(i32 0, -1) i32 @f(i32 returned %0) local_unnamed_addr #0 {
  ret i32 %0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
```
but when we pass -1 to the optimized code this is out-of-bounds for the range, creating poison, violating the rules for `returned`

cc @nunoplopes 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to