[PATCH] D95308: [TableGen] Fix instantiating multiclass in foreach

Jyun-Yan You via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 25 07:40:10 PST 2021


jyyou.tw marked an inline comment as done.
jyyou.tw added a comment.

In D95308#2518218 <https://reviews.llvm.org/D95308#2518218>, @Paul-C-Anagnostopoulos wrote:

> I presume this change passes all the TableGen, mlir, and clang tests?

Yes, tests are passed.



================
Comment at: llvm/lib/TableGen/TGParser.cpp:3528
+    if (resolve(MC->Entries, Substs, CurMultiClass == nullptr && Loops.empty(),
+                &NewEntries, &SubClassLoc))
       return true;
----------------
Paul-C-Anagnostopoulos wrote:
> Is there a reason why we shouldn't use !CurMultiClass?
If defm is placed in foreach and multiclass has foreach, the parsing flow is

parse foreach -> parse defm -> resolve multiclass entries -> resolve foreach of multiclass

In this case, !CurMultiClass is not enough. When resolving foreach of multiclass, Loop.ListValue is resolved as FieldInit only.
It must be further resolved, so I add Loops.empty() to ensure that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95308/new/

https://reviews.llvm.org/D95308



More information about the llvm-commits mailing list