[llvm-dev] Problem in AMDGPU TableGen files

Paul C. Anagnostopoulos via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 1 10:15:10 PST 2021


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.



More information about the llvm-dev mailing list