This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Add bank conflict hazarding
ClosedPublic

Authored by dpenry on Dec 10 2020, 11:19 AM.

Details

Summary

Adds ARMBankConflictHazardRecognizer. This hazard recognizer
looks for a few situations where the same base pointer is used and
then checks whether the offsets lead to a bank conflict. Two
parameters are also added to permit overriding of the target
assumptions:

arm-data-bank-mask=<int> - Mask of bits which are to be checked for

conflicts.  If all these bits are equal in
the offsets, there is a conflict.

arm-assume-itcm-bankconflict=<bool> - Assume that there will be bank

conflicts on any loads to a constant
pool.

This hazard recognizer is enabled for Cortex-M7, where the Technical Reference
Manual states that there are two DTCM banks banked using bit 2 and one ITCM
bank.

Diff Detail

Event Timeline

dpenry created this revision.Dec 10 2020, 11:19 AM
dpenry requested review of this revision.Dec 10 2020, 11:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 10 2020, 11:19 AM
dmgreen accepted this revision.Dec 14 2020, 3:10 AM

LGTM. Thanks for the patch.

There are some clang-format related suggestions above that are worth making before pushing.

This revision is now accepted and ready to land.Dec 14 2020, 3:10 AM

Perhaps some tests are missing: one inlined suggestion is related to AssumeITCMBankConflict, and I was wondering about other cases like Size > 4 and SP relative access?

llvm/lib/Target/ARM/ARMHazardRecognizer.cpp
164

Nit: I would prefer a different name than ABC, probably same for DDN.

184

nit: we can just do:

if (MO0->getSize() > 4)
  return NoHazard;

to exit early/earlier, also because we don't seem to use Size0.

225

Option AssumeITCMBankConflict defaults to false. Do have/need a test with this enabled?

dpenry marked 2 inline comments as done.Dec 18 2020, 3:42 PM
dpenry added inline comments.
llvm/lib/Target/ARM/ARMHazardRecognizer.cpp
225

For Cortex-M7, this flag is enabled. There isn't a test written to distinguish between enabled/disabled at present.

dpenry updated this revision to Diff 312895.Dec 18 2020, 3:50 PM

Formatting and variable name changes

dpenry updated this revision to Diff 313120.Dec 21 2020, 9:01 AM

More formatting changes

This revision was landed with ongoing or failed builds.Dec 23 2020, 6:01 AM
Closed by commit rGa9f14cdc6203: [ARM] Add bank conflict hazarding (authored by dpenry, committed by dmgreen). · Explain Why
This revision was automatically updated to reflect the committed changes.