I was wondering how easy would it be to add an All/Any in Lit, maybe
together with a multi-scan option.
As far as I know, you have things like "CHECK", "CHECK-NOT" and
"CHECK-NEXT", but sometimes the order of the output is less relevant
(especially for debug information, on both IR and Dwarf outputs).
So, my idea are:
CHECK-ANY: %symbol1 = op %s2, %s3
CHECK-OR: %symbol = other-op %s2, other option, %s4
In that case, either one of the three option (limited by ANY/OR
sequence) could match. If there is a match on any of them, all others
CHECK-ALL: %symbol1 = op %s2, %s3
CHECK-AND: %symbol = other-op %s2, other option, %s4
In that case, all three options (limited by ALL/AND sequence) must
match, in any order.
If it doesn't match the first time, store that in a list to try again.
Stop when the number of items in the list doesn't reduce in size after
This should only walk over the output multiple times, not re-execute
the command multiple times.
I'm unsure if MULTI should be a global option (as in, all CHECKs
should be checked multiple times within the same output) or not. So,
if you have two runs:
%run foo | lit CHECK
%run bar | lit CHECK2
and you say:
That'll mean that all "CHECK" checks will be done multiple times, but no CHECK2.
If MULTI is not a global option, than just the "CHECK-MULTI" line will
be recorded for future attempts in case of failure.