[llvm-commits] [llvm] r146688 - in /llvm/trunk: include/llvm/Transforms/Utils/ModuleUtils.h lib/Transforms/Instrumentation/AddressSanitizer.cpp lib/Transforms/Utils/ModuleUtils.cpp

Kostya Serebryany kcc at google.com
Thu Dec 15 17:32:17 PST 2011


On Thu, Dec 15, 2011 at 5:23 PM, Chandler Carruth <chandlerc at google.com>wrote:

> On Thu, Dec 15, 2011 at 5:14 PM, Kostya Serebryany <kcc at google.com> wrote:
>
>>
>>
>> On Thu, Dec 15, 2011 at 4:45 PM, Chandler Carruth <chandlerc at google.com>wrote:
>>
>>> On Thu, Dec 15, 2011 at 4:25 PM, Kostya Serebryany <kcc at google.com>wrote:
>>>
>>>> yea, agree.
>>>> asan currently (almost) lacks this kind of testing and we will need to
>>>> add more tests (not just this one).
>>>>
>>>
>>> I understand. It's useful for reviewers as well when fixing bugs to
>>> include at least the test for that fix, as it helps document exactly what
>>> the end result should be. Might be a good place to start fleshing out the
>>> test suite.
>>>
>>
>> For this particular case, what would you say about this test?
>>
>
> Generally makes sense, one comment inline...
>
>
>>
>> ; RUN: opt < %s -asan -S | FileCheck %s
>>
>>
>> target datalayout =
>> "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
>>
>> target triple = "x86_64-unknown-linux-gnu"
>>
>>
>> @xxx = global i32 0, align 4
>>
>>
>> ; If a global is present, __asan_[un]register_globals should be called
>> from
>>
>> ; module ctor/dtor
>>
>>
>> ; CHECK: llvm.global_dtors
>>
>>
>> ; CHECK: llvm.global_ctors
>>
>>
>> ; CHECK: asan.module_ctor
>>
>>
>> ; CHECK: call void @__asan_register_globals
>>
>>
>>
>
> It would be good to ensure that nothing untoward ends up between
> asan.module_ctor and the call. I've not looked at the IR generated, but
> something like 'CHECK-NEXT' might work. For cases where that is too
> brittle, a NOT-pinning pattern is very common:
>

yep, done. r146718.


>
> ; CHECK: asan.module_ctor
> ; CHECK-NOT: ret
> ; CHECK: call ...
> ; CHECK: ret
>
>
> Thanks for looking into how to write test cases here!
>

This is in fact quite enjoyable :)

--kcc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111215/a8ecb679/attachment.html>


More information about the llvm-commits mailing list