This is an archive of the discontinued LLVM Phabricator instance.

[MC][AMDGPU] Warn when disassembling a v_cmpx with non-exec destination
Needs ReviewPublic

Authored by gandhi21299 on Apr 2 2023, 10:20 PM.

Details

Reviewers
foad
Joe_Nash
dp
Summary

Emit a warning the destination of a v_cmpx instruction is not
EXEC, except when the source is an immediate zero operand.

Diff Detail

Event Timeline

gandhi21299 created this revision.Apr 2 2023, 10:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 2 2023, 10:20 PM
gandhi21299 requested review of this revision.Apr 2 2023, 10:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 2 2023, 10:20 PM

removed debug prints

foad added a comment.Apr 3 2023, 12:15 AM

This is pretty much the same as D133334 right?

I'm still not too happy about emitting warnings without using proper diagnostics. The reason is that when the disassembler is being used as a library then it's probably not appropriate for it just to write warnings to stderr.

Since printing to errs() seems off the table, some other potential options:

  • Add proper warning infrastructure to the disassembler
  • Wrap the check in DEBUG and print to dbgs() ?
  • Make it a disassembly failure, but only on a new architecture, so we don't break backwards compatibility

This is pretty much the same as D133334 right?

I'm still not too happy about emitting warnings without using proper diagnostics. The reason is that when the disassembler is being used as a library then it's probably not appropriate for it just to write warnings to stderr.

Yes, it's almost the same. I was facing some rebase difficulties so I created a new revision. I am in favor of having a diagnostics infrastructure in disassembler for emitting warnings/errors as well. I will work on it.

Since printing to errs() seems off the table, some other potential options:

  • Add proper warning infrastructure to the disassembler

Done

  • Wrap the check in DEBUG and print to dbgs() ?

I am not sure how that helps. I wrapped the warning-emission in LLVM_DEBUG and added -debug, the warning still does not sync with the instruction it corresponds to. Unless I did not understand this option correctly.

  • Wrap the check in DEBUG and print to dbgs() ?

I am not sure how that helps. I wrapped the warning-emission in LLVM_DEBUG and added -debug, the warning still does not sync with the instruction it corresponds to. Unless I did not understand this option correctly.

This would help with the issue raised by Jay "when the disassembler is being used as a library then it's probably not appropriate for it just to write warnings to stderr." The warning being unsynced seems like a separate issue.