[LLVMdev] pattern matching order
Chris Lattner
clattner at apple.com
Tue Feb 12 15:44:48 PST 2013
On Feb 12, 2013, at 9:35 AM, dag at cray.com wrote:
>> 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.
I'm not defending the name, but here's the reason:
Isel builds a set of candidate patterns that can match, and orders them by priority: it wants to match the largest pattern (most nodes covered by the pattern -> most "complex") at the minimum cost. AddedComplexity is saying that the pattern is higher value because it covers more notes, and is considered to be more complicated (and therefore, valuable) compared to other candidates.
-Chris
More information about the llvm-dev
mailing list