This is an archive of the discontinued LLVM Phabricator instance.

[X86] Simplify function isDataInvariant by using X86MnemonicTables
ClosedPublic

Authored by skan on Mar 19 2022, 12:24 AM.

Details

Summary

This is not a NFC change b/c we add more instructions like
IMUL16/32/64r, MOV16ao16 and MOV16rr_REV etc to the list.
But I think it's reasonable.

Diff Detail

Event Timeline

skan created this revision.Mar 19 2022, 12:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 19 2022, 12:24 AM
skan requested review of this revision.Mar 19 2022, 12:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 19 2022, 12:24 AM

I'm slightly worried about IMUL16/32/64r because it writes EAX/EDX. No other instruction in the list has a physical register output.

llvm/lib/Target/X86/X86InstrInfo.cpp
402

Some of these are in isMOVSXD not isMOVSX

llvm/test/CodeGen/X86/speculative-load-hardening.ll
82

What instruction addition caused this change?

skan updated this revision to Diff 416673.Mar 19 2022, 1:10 AM
skan marked an inline comment as done.

Add missing isMOVSXD

skan added a comment.Mar 19 2022, 1:25 AM

I'm slightly worried about IMUL16/32/64r because it writes EAX/EDX. No other instruction in the list has a physical register output.

This function is added by @chandlerc in D44824. According the description of the function

Returns true if the instruction has no behavior (specified or otherwise)
that is based on the value of any of its register operands

I believe it doesn't matter the instruction has a physical register output.

llvm/test/CodeGen/X86/speculative-load-hardening.ll
82

It was casued by the missing isMOVSXD.

Amir accepted this revision.Mar 19 2022, 2:25 AM

LGTM, exactly the intended usage of mnemonic tables.

This revision is now accepted and ready to land.Mar 19 2022, 2:25 AM
This revision was landed with ongoing or failed builds.Mar 20 2022, 3:39 AM
This revision was automatically updated to reflect the committed changes.