The loop which emits AssemblerPredicate conditions also links them together by emitting a '&&'.
If the 1st predicate is not an AssemblerPredicate, while the 2nd one is, nothing gets emitted for the 1st one, but we still emit the '&&' because of the 2nd predicate.
This generated code looks like "( && Cond2)" and is invalid.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
I don't think the commit message explains this change very well. If we hadn't already discussed the problem off-list I'm not sure I would have understood what you meant. I'd have started with a subject like:
[tablegen] Fix invalid code generation when the first predicate is not an AssemblerMatcherPredicate.
and then talked about the way it currently produces 'if ( && B)' in the body of the message.
test/TableGen/PredicateOrderDisasm.td | ||
---|---|---|
3–5 ↗ | (On Diff #21839) | |
3–11 ↗ | (On Diff #21839) | This is a bit strange to read. Maybe simply: Check that we don't accidentally generate code of the form 'if ( && B)'. is enough. |
37 ↗ | (On Diff #21839) | It's better to check that the correct thing happens rather than check that the wrong thing doesn't happen. |
Comment Actions
Rewrote comments.
Switched to CHECK-ing for correct behavior.
Renamed test file to a more appropriate name.