Issue |
129090
|
Summary |
Incorrectly inferred captures(none) when a pointer is captured by a call to readonly nonunwind function without return value
|
Labels |
new issue
|
Assignees |
|
Reporter |
tmiasko
|
FunctionAttrs assumes that readonly (or readnone) and nounwind function that
don't return a value can't capture arguments. That is incorrect, since such a
function can vary its behavior by terminating or not terminating.
An example demonstrating the issue:
```console
$ cat a.ll
define void @f(ptr %a, ptr %b) {
start:
call void @g(ptr %a, ptr %b)
ret void
}
define void @g(ptr %a, ptr %b) {
start:
%0 = icmp eq ptr %a, %b
br i1 %0, label %bb2, label %bb1
bb1:
br label %bb1
bb2:
ret void
}
$ opt-21 -S --passes=function-attrs a.ll
; ModuleID = 'a.ll'
source_filename = "a.ll"
; Function Attrs: nofree norecurse nosync nounwind memory(none)
define void @f(ptr readnone captures(none) %a, ptr readnone captures(none) %b) #0 {
start:
call void @g(ptr %a, ptr %b)
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(none)
define void @g(ptr readnone %a, ptr readnone %b) #0 {
start:
%0 = icmp eq ptr %a, %b
br i1 %0, label %bb2, label %bb1
bb1: ; preds = %bb1, %start
br label %bb1
bb2: ; preds = %start
ret void
}
attributes #0 = { nofree norecurse nosync nounwind memory(none) }
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs