[llvm-commits] [llvm] r57342 - in /llvm/trunk: include/llvm/Analysis/EscapeAnalysis.h lib/Analysis/EscapeAnalysis.cpp
Duncan Sands
baldrick at free.fr
Sat Oct 11 13:17:28 PDT 2008
Hi Owen,
> + // FIXME: Are there any other possible escape points?
if M is a malloced pointer, this would cause M to escape:
if (M & 1)
bits[0]=1;
if (M & 2)
bits[1]=1;
if (M & 4)
bits[2]=1;
...
Export the "bits" array somehow (eg: write to a global,
a parameter, return it). Then other parts of the program
can reconstruct M from bits, so it would be wrong to
convert it to an alloca.
> +/// escapes - Determines whether the passed allocation can escape from the
> +/// current function. It does this by using a simple worklist algorithm to
> +/// search for a path in the def-use graph from the allocation to an
> +/// escape point.
As the above example shows, you also have to watch out for control flow.
This may not involve phi nodes.
Ciao,
Duncan.
More information about the llvm-commits
mailing list