This is an archive of the discontinued LLVM Phabricator instance.

[X86]check that Uses, Defs are same for entries in memory folding table
ClosedPublic

Authored by XinWang10 on May 15 2023, 8:37 PM.

Details

Summary

Add expensive check that Uses, Defs are same for entries in memory folding table.
MemFolding could not change the Uses/Defs.

Diff Detail

Event Timeline

XinWang10 created this revision.May 15 2023, 8:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 15 2023, 8:37 PM
XinWang10 requested review of this revision.May 15 2023, 8:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 15 2023, 8:37 PM
craig.topper added inline comments.
llvm/utils/TableGen/X86FoldTablesEmitter.cpp
115

Variable names should not contain underscores.

123

Can we use operator== for the vectors?

XinWang10 updated this revision to Diff 522427.May 15 2023, 9:28 PM
  • resolve comments
XinWang10 marked 2 inline comments as done.May 15 2023, 9:29 PM
XinWang10 added inline comments.
llvm/utils/TableGen/X86FoldTablesEmitter.cpp
123

Sure.

craig.topper added inline comments.May 15 2023, 9:55 PM
llvm/utils/TableGen/X86FoldTablesEmitter.cpp
115

Replace LHS with Reg and RHS with Mem.

XinWang10 marked an inline comment as done.
  • change variable name
XinWang10 marked an inline comment as done.
skan added inline comments.May 15 2023, 10:45 PM
llvm/utils/TableGen/X86FoldTablesEmitter.cpp
111

Function name should not capitalize

  • correct the function name format
XinWang10 marked an inline comment as done.May 15 2023, 10:53 PM
skan added inline comments.May 15 2023, 11:03 PM
llvm/utils/TableGen/X86FoldTablesEmitter.cpp
111

Shouldn't we return void and abort (report_fatal_error) if there is sth wrong?

621

Why there is an indent here?

621

The first char of variable names should be capitalized.

  • adjust format and Use report_fatal_error instead of print msgs
XinWang10 marked 2 inline comments as done.May 15 2023, 11:38 PM
skan added inline comments.May 16 2023, 1:06 AM
llvm/utils/TableGen/X86FoldTablesEmitter.cpp
112

, -> and

This function is about entry only, not about the table. So I suggest
Check that Uses and Defs are same after memory fold

120

Drop llvm::?

619–620

The logic here does not show anything about Uses or Defs. And it's self-explained, we can remove the comments.

XinWang10 updated this revision to Diff 522504.May 16 2023, 2:18 AM
  • update comments
skan accepted this revision.May 16 2023, 2:43 AM

LGTM

This revision is now accepted and ready to land.May 16 2023, 2:43 AM
skan added inline comments.May 16 2023, 6:49 AM
llvm/utils/TableGen/X86FoldTablesEmitter.cpp
120

drop namespace llvm?

pengfei added inline comments.May 16 2023, 7:36 AM
llvm/utils/TableGen/X86FoldTablesEmitter.cpp
120

Given the code for Debug build only, why don't use assert directly?

skan added inline comments.May 16 2023, 7:42 AM
llvm/utils/TableGen/X86FoldTablesEmitter.cpp
120

How to include RegInstRec.getName() and MemInstRec.getName() in assertion message?

pengfei added inline comments.May 16 2023, 8:07 AM
llvm/utils/TableGen/X86FoldTablesEmitter.cpp
120

Right, I missed them :)

XinWang10 updated this revision to Diff 522874.May 16 2023, 6:26 PM
  • remove unneeded namespace

Thanks for your review~