LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 36667 - [llvm-mca] Teach the tool how to identify memory fence instructions.
Summary: [llvm-mca] Teach the tool how to identify memory fence instructions.
Status: NEW
Alias: None
Product: tools
Classification: Unclassified
Component: llvm-mca (show other bugs)
Version: trunk
Hardware: PC All
: P enhancement
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-09 07:18 PST by Andrea Di Biagio
Modified: 2018-10-18 06:18 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrea Di Biagio 2018-03-09 07:18:59 PST
This could be fixed by using an extra flag in MCInstrDesc.

Currently, the LSUnit in llvm-mca (LSUnit.h) doesn't know about memory-barriers. It conservatively assumes that an instruction with both 'mayLoad' and 'unmodeledSideEffects' behaves like a "soft" load barrier. Similarly, an instruction with flag 'mayStore' and 'unmodeledSideEffects' is treated like a "soft" store barrier. That means, memory operations are serialized without forcing a flush (of the load/store queue).
This is inaccurate, and currently it leads to potentially incorrect analysis.

If we teach llvm-mca how to correctly identify fence instructions, then the analysis becomes more accurate (and we don't need to guess anymore).