Paul C. Anagnostopoulos via llvm-dev
2021-Feb-01 18:15 UTC
[llvm-dev] Problem in AMDGPU TableGen files
I recently discovered that when a defm invokes a multiclass with template
arguments, no type checking is done between the supplied argument values and the
expected types. I am working on a revision that addresses this, along with other
template argument-related issues.
In adding defm template argument checking, I uncovered the following problem in
UOPCInstructions.td, an AMDGPU TableGen file. Here is the multiclass:
multiclass ICMP_Pattern <PatLeaf cond, Instruction inst, ValueType vt> {
let WaveSizePredicate = isWave64 in
...
And here is one of the defm's invoking it:
defm : ICMP_Pattern <COND_EQ, V_CMP_EQ_U32_e64, i32>;
Except that COND_EQ is an instance of the PatFrags class, which is a superclass
of PatLeaf. So the argument value is invalid.
I'd appreciate it someone would check my math here. Then I'll create a
patch to fix the AMDGPU file.