[PATCH] D29711: [globalisel] Sort RuleMatchers by priority.

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 08:41:35 PST 2017


dsanders added inline comments.


================
Comment at: utils/TableGen/GlobalISelEmitter.cpp:724
+            [](const RuleMatcher &A, const RuleMatcher &B) {
+              return A.isHigherPriorityThan(B);
+            });
----------------
rovka wrote:
> dsanders wrote:
> > rovka wrote:
> > > I'd add an assert here on the asymmetry of isHigherPriorityThan.
> > I'm not sure what you mean here.
> Sorry, I wasn't being very specific :)
> 
> I meant assert that if A.isHigherPriorityThan(B) then !B.isHigherPriorityThan(A). I think this is important because we're using a pretty complex function for sorting and it's a good idea to check that it's a strict weak ordering, so we don't have trouble with the sort. I don't know if it's worth worrying about transitivity, but asymmetry (which implies irreflexivity) is easy enough to verify.
That makes sense to me. Thanks


https://reviews.llvm.org/D29711





More information about the llvm-commits mailing list