This is an archive of the discontinued LLVM Phabricator instance.

[llvm-tblgen] Support conditional definitions using !casts clauses
ClosedPublic

Authored by reames on Mar 9 2023, 11:04 AM.

Details

Summary

This is a follow on to D145108. This started as simply fixing the crash on an error case reported against that change, but I think this also ends up fixing the original reported issue (https://github.com/llvm/llvm-project/issues/49830) as well. More accurately, D145108 fixed the case where the cast resolves to an existing record, and this change fixes the case where the named record doesn't exist.

Diff Detail

Event Timeline

reames created this revision.Mar 9 2023, 11:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2023, 11:04 AM
reames requested review of this revision.Mar 9 2023, 11:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2023, 11:04 AM
foad added a subscriber: Joe_Nash.Mar 9 2023, 12:54 PM

but I think this also ends up fixing the original reported issue (https://github.com/llvm/llvm-project/issues/49830) as well

That would be awesome! +@Joe_Nash

foad accepted this revision.Mar 10 2023, 4:35 AM

I'm not competent to review the implementation but it seems to work well for me. This will let us replace lots of instances of foreach _ = BoolToList<cond>.ret in ... with if cond then ... in AMDGPU backend tablegen files.

This revision is now accepted and ready to land.Mar 10 2023, 4:35 AM
Joe_Nash accepted this revision.Mar 10 2023, 8:04 AM

This looks like it fixes 49830, and I agree with foad it is useful in the AMDGPU backend. Functionally LGTM! Thanks for working on it.

This revision was landed with ongoing or failed builds.Mar 10 2023, 4:03 PM
This revision was automatically updated to reflect the committed changes.