[llvm-commits] [llvm] r64352 - /llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp

Duncan Sands baldrick at free.fr
Thu Feb 12 01:08:11 PST 2009

Hi Nick,

> I'm going to guess that you misunderstood the problem.

correct :)

> Taking strtod as an example, it has:
> double strtod(const char *nptr, char **endptr) {
>    /* In a certain case, if (*nptr == 0) ... */
>    *endptr = nptr;
> }

You could still mark endptr nocapure (maybe not worth it).

> and that's an escape. We can't mark nptr as "nocapture" since it can 
> certainly be captured by being written through endptr.
> printf and sprintf don't have that problem. If you write a pointer to a 
> file, you're passing that pointer in an argument that isn't marked 
> nocapture. We only mark the format string (and for sprintf, the output 
> 'str') as nocapture.

If we decided that nocapture means: "(really not captured) or (captured,
but did something which results in undefined alias analysis results)",
and say that pointer swizzling results in undefined alias analysis behavior,
then all arguments to printf could be marked nocapture I guess.



More information about the llvm-commits mailing list