[cfe-commits] r147655 - in /cfe/trunk: lib/CodeGen/CGBuiltin.cpp test/CodeGen/no-builtin.c

Richard Smith richard at metafoo.co.uk
Fri Jan 6 08:39:42 PST 2012


On Fri, January 6, 2012 16:24, David Chisnall wrote:
> On 6 Jan 2012, at 16:19, Richard Smith wrote:
>> On Fri, January 6, 2012 15:58, David Chisnall wrote:
>>> On 6 Jan 2012, at 15:56, Richard Smith wrote:
>>>> On Fri, January 6, 2012 15:39, David Chisnall wrote:
>>>>> Then I am confused - the test case in the bug report failed for me
>>>>> before making that change and passed after that change...
>>>>
>>>> Were you running it through FileCheck? It's only checking for 'cos' in
>>>> the output, which will naturally exist since you define an extern
>>>> function with that name.
>>>
>>> Ah, that's a bug in the test then.  I was only checking whether the
>>> change fixed the issue in the bug report.
>>
>> Nonetheless, that was not the problem I was originally observing. In my
>> tests, a call to @cos appears in main with -fno-builtin, and does not appear
>> without, for your testcase, with or without your patch. I've tried a freebsd
>> triple, and I see the same behavior. Can you give a command-line using
>> -fno-builtin
>> for which we do not produce a call to @cos, prior to your patch, so I can
>> see if our results match?
>
> I just did:
>
>
> $ clang testcase.c -fno-builtin
> $ ./a.out
> not ok Abort trap: 6 (core dumped)
>
>
> Then I did:
>
>
> $ clang testcase.c -fno-builtin -S -emit-llvm
>
>
> There was no call to cos in the output, the cos(1) was being evaluated at
> compile time.  I made the change, and then the test passed.

Without your change:

$ grep NoBuiltin ~/clang-5/lib/CodeGen/CGBuiltin.cpp
$ ~/clang-5/build/bin/clang test/CodeGen/no-builtin.c -fno-builtin -S
-emit-llvm -o -  | grep cos
[... cut warning output ...]
define double @cos(double %x) nounwind uwtable {
  %call = call double @cos(double 1.000000e+00)
$ ~/clang-5/build/bin/clang test/CodeGen/no-builtin.c -fno-builtin
[...]
$ ./a.out
ok
$ ~/clang-5/build/bin/clang test/CodeGen/no-builtin.c
[...]
$ ./a.out
not ok
zsh: abort

(And I see the exact same behavior with your change.)

- Richard




More information about the cfe-commits mailing list