[LLVMdev] pattern matching order

dag at cray.com dag at cray.com
Tue Feb 12 09:35:17 PST 2013


Jakob Stoklund Olesen <stoklund at 2pi.dk> writes:

> On Feb 8, 2013, at 9:38 AM, Reed Kotler <rkotler at mips.com> wrote:
>
>> It seems that patterns are matched in the order that they appear in the td file.
>> Is this something we can rely on?
>
> It is by design but it is the last resort for ordering, and it is very fragile to depend on that.
>
> It is better to use AddedComplexity to control pattern ordering when required.

This matches my experience.

BTW, why is it called "AddedComplexity?"  That's a quite misleading
name.  Should we rename it to something else, maybe, "SelectionWeight?"
"SelectionPriority" would be better still but that's also misleading
since larger numbers => higher priority.

                            -David



More information about the llvm-dev mailing list