[TableGen][GISel] Incorrect handling of ignored ComplexPattern with GISelPredicateCode
+ PredicateCodeUsesOperands = 1
#68166
Labels
GISelPredicateCode
+ PredicateCodeUsesOperands = 1
#68166
Here is the code that triggers this issue (please paste boilerplate code from
test/TableGen/GlobalISelEmitterCustomPredicate.td
at the beginning of this file). Also, this bug follows up the patch presented in #68125.When running with
-gen-global-isel
, llvm-tblgen cashes with the following message:Here is the root cause:
WaitingForNamedOperands
is a counter that keeps tracks of operand mapping while usingGISelPredicateCode
+PredicateCodeUsesOperands = 1
. It's subtracted by one for each PatFrag operand and it should be zero, namely the assertion message, before we start processing another PatFrag.For instance, when processing
(mul_pat (or_complex_pattern DOP:$src0, DOP:$src1), DOP:$src2)
,WaitingForNamedOperands
is initialized with 2, the number of PatFrag operands. It is subtracted by 1 after(or_complex_pattern DOP:$src0, DOP:$src1)
is handled, but sinceor_complex_pattern
has no GISel counterpart, GlobalISelEmitter bails out (too) early and skipsDOP:$src2
entirely, leavingWaitingForNamedOperands
a non-zero value, hence the assertion failure.The text was updated successfully, but these errors were encountered: