[poolalloc] r177097 - When finding the target of a function call, get the called value and strip
John Criswell
criswell at uiuc.edu
Thu Mar 14 11:49:29 PDT 2013
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.
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,
More information about the llvm-commits
mailing list