Open nikic opened 2 weeks ago
I think nocapture
is not sufficient. It doesn't cover pointer comparisons.
Imagine this example:
call @src(@global)
..
define @f(ptr %p) {
%cmp = icmp eq ptr %p, @global
br i1 %cmp, label then, label else
then:
ret 1
else
ret 2
}
So changing from an alloca to a particular global var changes the output of the function.
No you tell me that f
doesn't return or write anything. But it can still exit the program (or not) depending on the address of the input ptr.
We don't have an easy way of expressing that a function is agnostic to concrete pointer addresses.
nocapture in LLVM covers both address capture and provenance escape. Your example is the 3rd point in https://llvm.org/docs/LangRef.html#pointercapture. (Splitting this into two attributes is on my TODO list, but I never get around to it...)
So it sounds like alive2 models nocapture as only forbidding provenance escape, but still allowing address capture?
Ok, then the whole nocapture needs revamping. We don't check for address escaping.
https://alive2.llvm.org/ce/z/9jjAiv
Gives:
I've been staring at this output for a while, but I don't understand what the issue here is supposed to be.