[LLVMdev] teaching FileCheck to handle variations in order

Krzysztof Parzyszek kparzysz at codeaurora.org
Fri Sep 7 10:12:23 PDT 2012


On 9/7/2012 7:20 AM, Matthew Curtis wrote:
>
> The attached patch implements one possible solution. It introduces a
> position stack and a couple of directives:
>
>   * 'CHECK-PUSH:' pushes the current match position onto the stack.
>   * 'CHECK-POP:' pops the top value off of the stack and uses it to set
>     the current match position.
>
> The above test can now be re-written as:
>
>     ; CHECK-PUSH:
>     ; CHECK: memw(##a)
>     ; CHECK-POP:
>     ; CHECK: memw(##b)
>
>     %0 = load i32* @a, align 4
>     %1 = load i32* @b, align 4
>
> which handles either ordering of memory reads for 'a' and 'b'.
>
> Thoughts?

I'm not sure if I got the details of how the tests work, but wouldn't 
this allow false positives?

Take this, for example:

; CHECK-PUSH:
; CHECK: memw(##a)
; CHECK-POP:
; CHECK: memw(##b)

%0 = load i32* @a, align 4
%1 = load i32* @b, align 4

; CHECK: memw(##a)

%2 = load i32* @a, align 4


My understanding is that this is supposed to detect:
- 2 loads in any order, one from @a, the other from @b, followed by
- 1 load from @a,
that is, a total of 3 loads.

At the same time I believe that it would positively match this code:
   ... = memw(##b)
   ... = memw(##a)
i.e. only two loads.  The second load would match two different CHECKs.

-K

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the llvm-dev mailing list