[PATCH] D119720: [ARM] Pass for Cortex-A57 and Cortex-A72 Fused AES Erratum

Sam Elliott via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 14 07:30:28 PST 2022


lenary created this revision.
lenary added reviewers: tmatheson, stuij, chill, dmgreen, kparzysz.
Herald added subscribers: dang, hiraditya, kristof.beyls, mgorny.
lenary requested review of this revision.
Herald added projects: clang, LLVM.
Herald added a subscriber: cfe-commits.

This adds a late Machine Pass to work around a Cortex CPU Erratum
affecting Cortex-A57 and Cortex-A72:

- Cortex-A57 Erratum 1742098
- Cortex-A72 Erratum 1655431

The pass inserts instructions to make the inputs to the fused AES
instruction pairs no longer trigger the erratum. Here the pass errs on
the side of caution, inserting the instructions wherever we cannot prove
that the inputs came from a safe instruction.

As the pass is executed very late in the ARM backend pipeline, it has to
reconstruct the Register Dataflow Graph, for which it uses the RDFGraph
utilities used by other backends.

This initial version will stop at the start of basic block containing
the first AES instruction, but having the full RDF Graph available means
we should be able to be more efficient with AES encryption and
decryption loops in future, if we wish.

The pass is used:

- for Cortex-A57 and Cortex-A72,
- for "generic" cores (which are used when using `-march=`),
- when the user specifies `-mfix-cortex-a57-aes-1742098` or `mfix-cortex-a72-aes-1655431` in the command-line arguments to clang.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119720

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  clang/test/Driver/arm-fix-cortex-a57-aes-1742098.c
  llvm/lib/CodeGen/RDFGraph.cpp
  llvm/lib/Target/ARM/ARM.h
  llvm/lib/Target/ARM/ARM.td
  llvm/lib/Target/ARM/ARMFixCortexA57AES1742098Pass.cpp
  llvm/lib/Target/ARM/ARMSubtarget.h
  llvm/lib/Target/ARM/ARMTargetMachine.cpp
  llvm/lib/Target/ARM/CMakeLists.txt
  llvm/test/CodeGen/ARM/O3-pipeline.ll
  llvm/test/CodeGen/ARM/aes-erratum-fix.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119720.408413.patch
Type: text/x-patch
Size: 159727 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220214/592fa04e/attachment-0001.bin>


More information about the cfe-commits mailing list