[PATCH] D43679: TableGen: Use DefInit::getDef() instead of the type's getRecord()

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 25 07:50:18 PST 2018


nhaehnle added reviewers: MatzeB, petpav01, hfinkel.
nhaehnle added a comment.

Thanks. It's hard to say who really groks utils/TableGen/FixedLenCodeEmitter.cpp, adding some folks (+ @arsenm) who at least wrote the bits near my changes.

I've verified that this change doesn't change the generated code in any of the backends in trunk at all.

The basic pattern is simple: use `cast<DefInit>(TI)->getDef()` instead of `cast<RecordRecTy>(TI->getType())->getRecord()`. If TI is a DefInit, those will yield the same result. If TI is not a DefInit, then the former will crash and the latter will return the record representing some uninstantiated class, which is not meaningful.

So I'd say this is a low-risk change.


Repository:
  rL LLVM

https://reviews.llvm.org/D43679





More information about the llvm-commits mailing list