[poolalloc] r177097 - When finding the target of a function call, get the called value and strip

John Criswell criswell at illinois.edu
Thu Mar 14 13:12:58 PDT 2013


On 3/14/13 2:00 PM, David Blaikie wrote:
> 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?

The test case from the user contains a simple bitcode file and an LLVM 
pass that *uses* DSA that triggers the bug.  It is not clear to me that 
the existing DSA passes trigger the bug.

I can add the pass to the poolalloc sub-project and create a lit test 
for it, but given the triviality of the fix and my limited bandwidth, 
it's pretty low on my priority list.

If you insist on having a test case, I'll try to devise one, but I 
really don't think it's worth the time.

-- John T.

>
>> 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