This is an archive of the discontinued LLVM Phabricator instance.

Fix for bug PR35549 - [X86] Repeated schedule comments
ClosedPublic

Authored by avt77 on Dec 7 2017, 8:33 AM.

Diff Detail

Event Timeline

avt77 created this revision.Dec 7 2017, 8:33 AM
RKSimon added inline comments.Dec 9 2017, 9:37 AM
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
725–727

update the comment to explain what the return value means

771

just return true here? Then you can remove Result entirely and return false at the end of the function.

1026
if (isVerbose() && emitComments(MI, OutStreamer->GetCommentOS(), this)) {

It'd be much safer to add a MachineInstr::setSchedInfoFlags(bool) style helper and avoid the hard coded constant here.

The whole block needs to be passed through clang-format as well.

lib/Target/X86/MCTargetDesc/X86BaseInfo.h
63

Add a comment describing the flag as its different from the other flags which are about prefixes.

lib/Target/X86/X86MCInstLower.cpp
104

Again, get rid of this hard coded constant

2005

Won't this copy other flags as well? Is that safe?

avt77 added inline comments.Dec 11 2017, 1:45 AM
lib/Target/X86/X86MCInstLower.cpp
2005

Yes, that's exactly what we need here.

RKSimon added inline comments.Dec 11 2017, 9:34 AM
lib/Target/X86/X86MCInstLower.cpp
2005

So is this a separate issue that needs tests and possibly a separate preliminary patch? Are you missing prefix flags data because of this?

avt77 added inline comments.Dec 12 2017, 12:58 AM
lib/Target/X86/X86MCInstLower.cpp
2005

I was completely wrong here: I mixed Flags from MCInst and MachineInstr. It's redone now.

avt77 updated this revision to Diff 126532.Dec 12 2017, 4:38 AM

All comments from Simon were resolved. There was a real bug and it's fixed in this new patch - tnx, Simon.

RKSimon added inline comments.Dec 13 2017, 6:38 AM
include/llvm/CodeGen/MachineInstr.h
73 ↗(On Diff #126532)

The TAsmComments/AC_EVEX_2_VEX hard-coded enum fix should be done as a separate pre-commit.

lib/CodeGen/AsmPrinter/AsmPrinter.cpp
772

You can probably either replace this with:

if (Commented)
  CommentOS << "\n";

or pull it into the previous if:

if (Commented) {
  if (AP->EnablePrintSchedInfo) {
    // If any comment was added above and we need sched info comment then
    // add this new comment just after the above comment w/o "\n" between them.
    CommentOS << " " << MF->getSubtarget().getSchedInfoStr(MI) << "\n";
    return true;
  }
  CommentOS << "\n";
}
avt77 updated this revision to Diff 126981.Dec 14 2017, 9:10 AM

The latest Simon's comments were implemented.

RKSimon accepted this revision.Dec 15 2017, 8:06 AM

LGTM with one minor

lib/Target/X86/X86MCInstLower.cpp
104

EnablePrintSchedInfo &&

This revision is now accepted and ready to land.Dec 15 2017, 8:06 AM
This revision was automatically updated to reflect the committed changes.