[PATCH] D35998: [TableGen] AsmMatcher: fix OpIdx computation when HasOptionalOperands is true

Nirav Dave via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 4 19:56:43 PDT 2017


niravd requested changes to this revision.
niravd added a comment.
This revision now requires changes to proceed.

Based on the UB Error, it seems like the CVT_tied check should be removed and the values of DefaultOffsets shifted over one.

  CvtOS << "  for (unsigned i = 0, NumDefaults = 0; i < " << (MaxNumOperands-1) << "; ++i) {\n";
  CvtOS << "    DefaultsOffset[i] = NumDefaults;\n";
  CvtOS << "    NumDefaults += (OptionalOperandsMask[i+1] ? 1 : 0);\n";
  CvtOS << "  }\n";

and

  CvtOS << "    OpIdx = *(p + 1) - DefaultsOffset[*(p + 1) ];\n" ;


Repository:
  rL LLVM

https://reviews.llvm.org/D35998





More information about the llvm-commits mailing list