[llvm-commits] Thread Sanitizer seems to have the dual issue

Chandler Carruth chandlerc at google.com
Thu Nov 29 01:22:31 PST 2012


On Thu, Nov 29, 2012 at 1:13 AM, Evgeniy Stepanov <eugenis at google.com> wrote:
> On Thu, Nov 29, 2012 at 10:14 AM, Kostya Serebryany <kcc at google.com> wrote:
>>
>> I see the problem now.
>>
>> With your patch we have:
>>   - asan calls doInitialization and creates Function objects (by calling
>> M.getOrInsertFunction).
>>   - some other pass kicks in and removes those Functions as unused
>>   - asan calls runOnFunction and expects the Function objects to be alive,
>> but they are not.
>>
>> The fix is simple: move the M.getOrInsertFunction calls into
>> runOnFunction.
>
>
> There are plans to run function passes in parallel in the future, right? If
> so, is it possible for a function to disappear while we instrument some
> other function? In general, is FunctionPass allowed to peek at other
> functions while in runOnFunction?

Only other function passes would be running in parallel, and they
can't remove a function from the module. We'd just have to implement
getOrInsertFunction in a threadsafe manner.



More information about the llvm-commits mailing list