[PATCH] D46338: [GlobalISel][Legalizer] LegalizerInfo verifier: checking that legalization rules cover all type indices
Roman Tereshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 1 16:11:31 PDT 2018
rtereshin created this revision.
rtereshin added reviewers: dsanders, aditya_nandakumar, aemerson.
Herald added subscribers: llvm-commits, kristof.beyls, rovka.
Herald added a reviewer: javed.absar.
This patch adds a simple verifier that tracks type indices being touched by legalization rules' builders.
Every target will now have an opportunity to call `LegalizerInfo::verify(...)` at the end of its derived LegalizerInfo's constructor and check there are no obvious mistakes like checking only first type for an opcode that has more than one type index and therefore implicitly declaring any type for the second (and higher) type index legal.
The check is only ran in assert builds and should have very minor performance impact in assert builds and none in release builds.
This patch also doesn't make the verification errors fatal, only produces an error message, there is a follow up patch that does.
This is inspired by the discussion at https://reviews.llvm.org/D44704, please take a look there for more info on motivation.
This patch includes 2 commits:
the first is described above, it does not add `LegalizerInfo::verify(...)` calls to target-specific legalizers;
the second one has the following message:
[GlobalISel][AArch64] LegalizerInfo verifier: Adding LegalizerInfo::verify(...) call w/o fixing bugs
This is to make it clear what kind of bugs the LegalizerInfo::verifier
is able to catch and test its output
I also have an NFC commit planned to get in before this patch with the following commit message:
[GlobalISel][Legalizer] LegalizerInfo NFC, mostly reducing LegalizeRuleSet's methods' inter-dependecies
Making LegalizeRuleSet's implementation a little more dumb and
straightforward to make it easier to read and change, in particular in
order to add the initial version of LegalizerInfo verifier
Repository:
rL LLVM
https://reviews.llvm.org/D46338
Files:
include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
lib/CodeGen/GlobalISel/LegalizerInfo.cpp
lib/Target/AArch64/AArch64LegalizerInfo.cpp
test/CodeGen/AArch64/GlobalISel/legalize-inttoptr-xfail-1.mir
test/CodeGen/AArch64/GlobalISel/legalize-inttoptr-xfail-2.mir
test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46338.144809.patch
Type: text/x-patch
Size: 33221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180501/8aa95b93/attachment.bin>
More information about the llvm-commits
mailing list