[poolalloc] r177097 - When finding the target of a function call, get the called value and strip
David Blaikie
dblaikie at gmail.com
Thu Mar 14 12:00:52 PDT 2013
On Thu, Mar 14, 2013 at 11:49 AM, John Criswell <criswell at uiuc.edu> wrote:
> Author: criswell
> Date: Thu Mar 14 13:49:29 2013
> New Revision: 177097
>
> URL: http://llvm.org/viewvc/llvm-project?rev=177097&view=rev
> Log:
> When finding the target of a function call, get the called value and strip
> pointer casts instead of asking the CallSite class to do that. This fixes a
> bug in which DSA crashes on calls to functions when the function is subjected
> to a ConstantExpr bitcast first.
Test case?
>
> Patch contributed by Fan Long.
>
> Modified:
> poolalloc/branches/release_32/lib/DSA/DSGraph.cpp
>
> Modified: poolalloc/branches/release_32/lib/DSA/DSGraph.cpp
> URL: http://llvm.org/viewvc/llvm-project/poolalloc/branches/release_32/lib/DSA/DSGraph.cpp?rev=177097&r1=177096&r2=177097&view=diff
> ==============================================================================
> --- poolalloc/branches/release_32/lib/DSA/DSGraph.cpp (original)
> +++ poolalloc/branches/release_32/lib/DSA/DSGraph.cpp Thu Mar 14 13:49:29 2013
> @@ -569,8 +569,13 @@ DSCallSite DSGraph::getDSCallSiteForCall
> }
> }
>
> - // Add a new function call entry...
> - if (Function *F = CS.getCalledFunction())
> + //
> + // Add a new function call entry. We get the called value from the call site
> + // and strip pointer casts instead of asking the CallSite class to do that
> + // since CallSite::getCalledFunction() returns 0 if the called value is
> + // a bit-casted function constant.
> + //
> + if (Function *F=dyn_cast<Function>(CS.getCalledValue()->stripPointerCasts()))
> return DSCallSite(CS, RetVal, VarArg, F, Args);
> else
> return DSCallSite(CS, RetVal, VarArg,
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list