[PATCH] D74368: [TBLGEN] Fix subreg value overflow in DAGISelMatcher
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 10 16:22:19 PST 2020
rampitec created this revision.
rampitec added reviewers: arsenm, vpykhtin.
Herald added subscribers: tpr, wdng.
Herald added a project: LLVM.
Tablegen's DAGISelMatcher emits integers in a VBR format,
so if an integer is below 128 it can fit into a single
byte, otherwise high bit is set, next byte is used etc.
MatcherTable is essentially an unsigned char table. When
SelectionDAGISel parses the table it does a reverse translation.
In a situation when numeric value of an integer to emit is
unknown it can be emitted not as OPC_EmitInteger but as
OPC_EmitStringInteger using a symbolic name of the value.
In this situation the value should not exceed 127.
One of the situations when OPC_EmitStringInteger is used is
if we need to emit a subreg into a matcher table. However,
number of subregs can exceed 127. Currently last defined subreg
for AMDGPU is 192. That results in a silent bug in the ISel
with matcher reading from an invalid offset.
Fixed this bug to emit actual VBR encoded value for a subregs
which value exceeds 127.
https://reviews.llvm.org/D74368
Files:
llvm/test/TableGen/dag-isel-subregs.td
llvm/utils/TableGen/DAGISelEmitter.cpp
llvm/utils/TableGen/DAGISelMatcher.h
llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
llvm/utils/TableGen/DAGISelMatcherGen.cpp
llvm/utils/TableGen/RegisterInfoEmitter.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74368.243695.patch
Type: text/x-patch
Size: 13109 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200211/908be5ad/attachment.bin>
More information about the llvm-commits
mailing list