[llvm-bugs] [Bug 50486] New: Deficiency in 'if' compared to 'foreach' with cast in TableGen

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 26 09:39:31 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50486

            Bug ID: 50486
           Summary: Deficiency in 'if' compared to 'foreach' with cast in
                    TableGen
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: TableGen
          Assignee: unassignedbugs at nondot.org
          Reporter: joseph.nash at amd.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24894
  --> https://bugs.llvm.org/attachment.cgi?id=24894&action=edit
reproducer and counterexamples

The Tablegen if statement introduced in https://reviews.llvm.org/D71474 seems
to have a deficiency compared to foreach, when using casts. The attached case
shows an example where this happens, and it is a reduced version of what
happens in the AMDGPU backend. 

The error message is "attempting to loop over
'!if(!cast<with_field>("instance").val, [1], [])', expected a list" which is
the code the 'if ... then' is expanded to in llvm/lib/TableGen/TGParser.cpp.
However,I could not figure out a fix while looking at this file.

The equivalent formation the statement using foreach works.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210526/212a2b2c/attachment.html>


More information about the llvm-bugs mailing list