<div dir="ltr"><div>I don't understand why, but there is quite some difference. I have attached what objdump shows me. I am not even sure if it is speaking the truth.</div><div><br></div><div>Without asan:</div><div><br></div><div>00000000004d2ab0 <_ZN11__llvm_libc7testing4mpfr14getMPFRMatcherIfEENS1_8internal11MPFRMatcherIT_EENS1_9OperationES5_NS1_9ToleranceE>:<br> 4d2ab0: 55 push %rbp<br> 4d2ab1: 48 89 e5 mov %rsp,%rbp<br> 4d2ab4: 53 push %rbx<br> 4d2ab5: 48 83 ec 18 sub $0x18,%rsp<br> 4d2ab9: 48 89 fb mov %rdi,%rbx<br> 4d2abc: 48 89 55 e8 mov %rdx,-0x18(%rbp)<br> 4d2ac0: 89 4d f0 mov %ecx,-0x10(%rbp)<br> 4d2ac3: 48 8d 55 e8 lea -0x18(%rbp),%rdx<br> 4d2ac7: e8 d4 02 00 00 callq 4d2da0 <_ZN11__llvm_libc7testing4mpfr8internal11MPFRMatcherIfEC2ENS1_9OperationEfRNS1_9ToleranceE><br> 4d2acc: 48 89 d8 mov %rbx,%rax<br> 4d2acf: 48 83 c4 18 add $0x18,%rsp<br> 4d2ad3: 5b pop %rbx<br> 4d2ad4: 5d pop %rbp<br> 4d2ad5: c3 retq <br> 4d2ad6: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)<br> 4d2add: 00 00 00 <br></div><div><br></div><div>With asan:</div> 4d2ab0: 55 push %rbp<br> 4d2ab1: 48 89 e5 mov %rsp,%rbp<br> 4d2ab4: 41 57 push %r15<br> 4d2ab6: 41 56 push %r14<br> 4d2ab8: 41 55 push %r13<br> 4d2aba: 41 54 push %r12<br> 4d2abc: 53 push %rbx<br> 4d2abd: 48 83 e4 e0 and $0xffffffffffffffe0,%rsp<br> 4d2ac1: 48 83 ec 40 sub $0x40,%rsp<br> 4d2ac5: 48 89 e3 mov %rsp,%rbx<br> 4d2ac8: f3 0f 11 43 0c movss %xmm0,0xc(%rbx)<br> 4d2acd: 48 89 7b 10 mov %rdi,0x10(%rbx)<br> 4d2ad1: 48 8d 05 68 96 2e 00 lea 0x2e9668(%rip),%rax # 7bc140 <__asan_option_detect_stack_use_after_return><br> 4d2ad8: 83 38 00 cmpl $0x0,(%rax)<br> 4d2adb: 89 73 08 mov %esi,0x8(%rbx)<br> 4d2ade: 89 4b 04 mov %ecx,0x4(%rbx)<br> 4d2ae1: 49 89 d6 mov %rdx,%r14<br> 4d2ae4: 74 0f je 4d2af5 <_ZN11__llvm_libc7testing4mpfr14getMPFRMatcherIfEENS1_8internal11MPFRMatcherIT_EENS1_9OperationES5_NS1_9ToleranceE+0x45><br> 4d2ae6: bf 40 00 00 00 mov $0x40,%edi<br> 4d2aeb: e8 50 22 f6 ff callq 434d40 <__asan_stack_malloc_0><br> 4d2af0: 49 89 c4 mov %rax,%r12<br> 4d2af3: eb 03 jmp 4d2af8 <_ZN11__llvm_libc7testing4mpfr14getMPFRMatcherIfEENS1_8internal11MPFRMatcherIT_EENS1_9OperationES5_NS1_9ToleranceE+0x48><br> 4d2af5: 45 31 e4 xor %r12d,%r12d<br> 4d2af8: 4d 89 e5 mov %r12,%r13<br> 4d2afb: 4d 85 e4 test %r12,%r12<br> 4d2afe: 75 0e jne 4d2b0e <_ZN11__llvm_libc7testing4mpfr14getMPFRMatcherIfEENS1_8internal11MPFRMatcherIT_EENS1_9OperationES5_NS1_9ToleranceE+0x5e><br> 4d2b00: 49 89 e5 mov %rsp,%r13<br> 4d2b03: 49 83 c5 c0 add $0xffffffffffffffc0,%r13<br> 4d2b07: 49 83 e5 e0 and $0xffffffffffffffe0,%r13<br> 4d2b0b: 4c 89 ec mov %r13,%rsp<br> 4d2b0e: 4c 89 6b 18 mov %r13,0x18(%rbx)<br> 4d2b12: 49 8d 55 20 lea 0x20(%r13),%rdx<br> 4d2b16: 49 c7 45 00 b3 8a b5 movq $0x41b58ab3,0x0(%r13)<br> 4d2b1d: 41 <br> 4d2b1e: 48 8d 05 21 6a 1a 00 lea 0x1a6a21(%rip),%rax # 679546 <_ZTSN11__llvm_libc7testing11MatcherBaseE+0x3f><br> 4d2b25: 49 89 45 08 mov %rax,0x8(%r13)<br> 4d2b29: 48 8d 05 80 ff ff ff lea -0x80(%rip),%rax # 4d2ab0 <_ZN11__llvm_libc7testing4mpfr14getMPFRMatcherIfEENS1_8internal11MPFRMatcherIT_EENS1_9OperationES5_NS1_9ToleranceE><br> 4d2b30: 49 89 45 10 mov %rax,0x10(%r13)<br> 4d2b34: 4d 89 ef mov %r13,%r15<br> 4d2b37: 49 c1 ef 03 shr $0x3,%r15<br> 4d2b3b: 48 b8 f1 f1 f1 f1 00 movabs $0xf3f30400f1f1f1f1,%rax<br> 4d2b42: 04 f3 f3 <br> 4d2b45: 49 89 87 00 80 ff 7f mov %rax,0x7fff8000(%r15)<br> 4d2b4c: 48 89 d0 mov %rdx,%rax<br> 4d2b4f: 48 c1 e8 03 shr $0x3,%rax<br> 4d2b53: 80 b8 00 80 ff 7f 00 cmpb $0x0,0x7fff8000(%rax)<br> 4d2b5a: 0f 85 89 00 00 00 jne 4d2be9 <_ZN11__llvm_libc7testing4mpfr14getMPFRMatcherIfEENS1_8internal11MPFRMatcherIT_EENS1_9OperationES5_NS1_9ToleranceE+0x139><br> 4d2b60: 4c 89 32 mov %r14,(%rdx)<br> 4d2b63: 48 8d 7a 08 lea 0x8(%rdx),%rdi<br> 4d2b67: 48 89 f8 mov %rdi,%rax<br> 4d2b6a: 48 c1 e8 03 shr $0x3,%rax<br> 4d2b6e: 8a 80 00 80 ff 7f mov 0x7fff8000(%rax),%al<br> 4d2b74: 84 c0 test %al,%al<br> 4d2b76: 75 60 jne 4d2bd8 <_ZN11__llvm_libc7testing4mpfr14getMPFRMatcherIfEENS1_8internal11MPFRMatcherIT_EENS1_9OperationES5_NS1_9ToleranceE+0x128><br> 4d2b78: 8b 43 04 mov 0x4(%rbx),%eax<br> 4d2b7b: 41 89 45 28 mov %eax,0x28(%r13)<br> 4d2b7f: 4c 8b 73 10 mov 0x10(%rbx),%r14<br> 4d2b83: 4c 89 f7 mov %r14,%rdi<br> 4d2b86: 8b 73 08 mov 0x8(%rbx),%esi<br> 4d2b89: f3 0f 10 43 0c movss 0xc(%rbx),%xmm0<br> 4d2b8e: e8 2d 03 00 00 callq 4d2ec0 <_ZN11__llvm_libc7testing4mpfr8internal11MPFRMatcherIfEC2ENS1_9OperationEfRNS1_9ToleranceE><br> 4d2b93: 49 c7 45 00 0e 36 e0 movq $0x45e0360e,0x0(%r13)<br> 4d2b9a: 45 <br> 4d2b9b: 4d 85 e4 test %r12,%r12<br> 4d2b9e: 74 1b je 4d2bbb <_ZN11__llvm_libc7testing4mpfr14getMPFRMatcherIfEENS1_8internal11MPFRMatcherIT_EENS1_9OperationES5_NS1_9ToleranceE+0x10b><br> 4d2ba0: 48 b8 f5 f5 f5 f5 f5 movabs $0xf5f5f5f5f5f5f5f5,%rax<br> 4d2ba7: f5 f5 f5 <br> 4d2baa: 49 89 87 00 80 ff 7f mov %rax,0x7fff8000(%r15)<br> 4d2bb1: 49 8b 44 24 38 mov 0x38(%r12),%rax<br> 4d2bb6: c6 00 00 movb $0x0,(%rax)<div> 4d2bb9: eb 0b jmp 4d2bc6 <_ZN11__llvm_libc7testing4mpfr14getMPFRMatcherIfEENS1_8internal11MPFRMatcherIT_EENS1_9OperationES5_NS1_9ToleranceE+0x116><br> 4d2bbb: 49 c7 87 00 80 ff 7f movq $0x0,0x7fff8000(%r15)<br> 4d2bc2: 00 00 00 00 <br> 4d2bc6: 4c 89 f0 mov %r14,%rax<br> 4d2bc9: 48 8d 65 d8 lea -0x28(%rbp),%rsp<br> 4d2bcd: 5b pop %rbx<br> 4d2bce: 41 5c pop %r12<br> 4d2bd0: 41 5d pop %r13<br> 4d2bd2: 41 5e pop %r14<br> 4d2bd4: 41 5f pop %r15<br> 4d2bd6: 5d pop %rbp<br> 4d2bd7: c3 retq <br> 4d2bd8: 89 f9 mov %edi,%ecx<br> 4d2bda: 80 e1 07 and $0x7,%cl<br> 4d2bdd: 80 c1 03 add $0x3,%cl<br> 4d2be0: 38 c1 cmp %al,%cl<br> 4d2be2: 7c 94 jl 4d2b78 <_ZN11__llvm_libc7testing4mpfr14getMPFRMatcherIfEENS1_8internal11MPFRMatcherIT_EENS1_9OperationES5_NS1_9ToleranceE+0xc8><br> 4d2be4: e8 17 32 fd ff callq 4a5e00 <__asan_report_store4><br> 4d2be9: 48 89 d7 mov %rdx,%rdi<br> 4d2bec: e8 cf 32 fd ff callq 4a5ec0 <__asan_report_store8><br> 4d2bf1: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)<br> 4d2bf8: 00 00 00 <br> 4d2bfb: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)<br><div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 5, 2020 at 2:07 PM Alex Brachet-Mialot <<a href="mailto:alexbrachetmialot@gmail.com">alexbrachetmialot@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I'm also curious. Especially given the function which this attribute<br>
was added is only returning the matcher, and not doing any real work.<br>
<br>
On Tue, May 5, 2020 at 4:45 PM Eric Christopher via libc-commits<br>
<<a href="mailto:libc-commits@lists.llvm.org" target="_blank">libc-commits@lists.llvm.org</a>> wrote:<br>
><br>
> I'm curious what's taking so long. What's the change in code generation in the functions with and without the asan instrumentation?<br>
><br>
> -eric<br>
><br>
> On Tue, May 5, 2020 at 1:37 PM Siva Chandra via libc-commits <<a href="mailto:libc-commits@lists.llvm.org" target="_blank">libc-commits@lists.llvm.org</a>> wrote:<br>
>><br>
>> I submitted this without review to unblock the asan bot. Feel free to suggest other ways to improve the run time.<br>
>><br>
>><br>
>> On Tue, May 5, 2020 at 1:31 PM Siva Chandra Reddy via libc-commits <<a href="mailto:libc-commits@lists.llvm.org" target="_blank">libc-commits@lists.llvm.org</a>> wrote:<br>
>>><br>
>>><br>
>>> Author: Siva Chandra Reddy<br>
>>> Date: 2020-05-05T13:30:30-07:00<br>
>>> New Revision: fbaaa16802d7b2fc096c8ed5fa23e0cad56807a2<br>
>>><br>
>>> URL: <a href="https://github.com/llvm/llvm-project/commit/fbaaa16802d7b2fc096c8ed5fa23e0cad56807a2" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/fbaaa16802d7b2fc096c8ed5fa23e0cad56807a2</a><br>
>>> DIFF: <a href="https://github.com/llvm/llvm-project/commit/fbaaa16802d7b2fc096c8ed5fa23e0cad56807a2.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/fbaaa16802d7b2fc096c8ed5fa23e0cad56807a2.diff</a><br>
>>><br>
>>> LOG: [libc] Add no_sanitize("address") attribute to the getMPFRMatcher function.<br>
>>><br>
>>> This dramtically reduces the run time of tests. For example,<br>
>>> sincosf_test takes over 25 minutes without this attribute but only 8<br>
>>> seconds with this attribute.<br>
>>><br>
>>> Added:<br>
>>><br>
>>><br>
>>> Modified:<br>
>>> libc/utils/MPFRWrapper/MPFRUtils.h<br>
>>><br>
>>> Removed:<br>
>>><br>
>>><br>
>>><br>
>>> ################################################################################<br>
>>> diff --git a/libc/utils/MPFRWrapper/MPFRUtils.h b/libc/utils/MPFRWrapper/MPFRUtils.h<br>
>>> index 31afd39b2895..6cdba34882d5 100644<br>
>>> --- a/libc/utils/MPFRWrapper/MPFRUtils.h<br>
>>> +++ b/libc/utils/MPFRWrapper/MPFRUtils.h<br>
>>> @@ -73,6 +73,7 @@ template <typename T> class MPFRMatcher : public testing::Matcher<T> {<br>
>>> } // namespace internal<br>
>>><br>
>>> template <typename T><br>
>>> +__attribute__((no_sanitize("address")))<br>
>>> internal::MPFRMatcher<T> getMPFRMatcher(Operation op, T input, Tolerance t) {<br>
>>> static_assert(<br>
>>> __llvm_libc::cpp::IsFloatingPointType<T>::Value,<br>
>>><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> libc-commits mailing list<br>
>>> <a href="mailto:libc-commits@lists.llvm.org" target="_blank">libc-commits@lists.llvm.org</a><br>
>>> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/libc-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/libc-commits</a><br>
>><br>
>> _______________________________________________<br>
>> libc-commits mailing list<br>
>> <a href="mailto:libc-commits@lists.llvm.org" target="_blank">libc-commits@lists.llvm.org</a><br>
>> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/libc-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/libc-commits</a><br>
><br>
> _______________________________________________<br>
> libc-commits mailing list<br>
> <a href="mailto:libc-commits@lists.llvm.org" target="_blank">libc-commits@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/libc-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/libc-commits</a><br>
</blockquote></div></div></div></div>