[cfe-commits] [PATCH] Invariants (and Assume Aligned) - Clang

Tobias Grosser tobias at grosser.es
Wed Dec 5 14:37:01 PST 2012


On 12/05/2012 11:29 PM, Hal Finkel wrote:
> ----- Original Message -----
>> From: "Tobias Grosser"<tobias at grosser.es>
>> To: reviews+D149+public+707ba5224a940551 at llvm-reviews.chandlerc.com
>> Cc: hfinkel at anl.gov, cfe-commits at cs.uiuc.edu
>> Sent: Wednesday, December 5, 2012 4:04:54 PM
>> Subject: Re: [cfe-commits] [PATCH] Invariants (and Assume Aligned) - Clang
>>
>> On 12/05/2012 09:39 PM, hfinkel at anl.gov wrote:
>>>     Test cases have been enhanced. We now use @llvm.invariant.
>>
>>> Index: test/CodeGen/builtin-assume.c
>>> ===================================================================
>>> --- /dev/null
>>> +++ test/CodeGen/builtin-assume.c
>>> @@ -0,0 +1,9 @@
>>> +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o -
>>> %s | FileCheck %s
>>> +
>>> +// CHECK: @test1
>>> +int test1(int *a) {
>>> +// CHECK: call void @llvm.invariant(i1
>>> +  __builtin_assume(a != 0);
>>> +  return a[0];
>>
>> The second check line looks incomplete? Is this intended?
>
> Yes. I did not want to match the variable name specifying the condition.
>
> [For some reason, I can't see this comment in the web interface].

I have no account for the web interface, but hoped the emails would show 
up there anyway. Is this not the case?

Would you mind adding the entire test case (with some regexp magic) or
in case this is too much work can you add an example to the 
documentation? Does __builtin_assume() basically take an i1 as an 
argument and allows an arbitrary set of instructions that lead to this 
i1. Can I have something, like

__builtin_assume(clamp(0, x, 100) >= 0);
__builtin_assume(clamp(0, x, 100) <= 100);

to pass information about the behavior of the function clamp?

I think this is a very nice feature, which will be very useful to polly.

Cheers
Tobi



More information about the cfe-commits mailing list