[PATCH] D82615: [HWASan] [GlobalISel] Add +tagged-globals backend feature for GlobalISel

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 17:29:42 PDT 2020


hctim created this revision.
hctim added reviewers: eugenis, pcc, ostannard.
Herald added subscribers: llvm-commits, hiraditya, kristof.beyls, rovka.
Herald added a project: LLVM.
hctim updated this revision to Diff 273564.
hctim added a comment.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.

First patchset was the wrong diff. Should be the right one now.


GlobalISel is the default ISel for aarch64 at -O0. Prior to D78465 <https://reviews.llvm.org/D78465>, GlobalISel
didn't have support for dealing with address-of-global lowerings, so it fell
back to SelectionDAGISel.

HWASan Globals require special handling, as they contain the pointer tag in the
top 16-bits, and are thus outside the code model. We need to generate a `movk`
in the instruction sequence with a G3 relocation to ensure the bits are
relocated properly. This is implemented in SelectionDAGISel, this patch does
the same for GlobalISel.

GlobalISel and SelectionDAGISel differ in their lowering sequence, so there are
differences in the final instruction sequence, explained in
`tagged-globals.ll`. Both of these implementations are correct, but GlobalISel
is slightly larger code size / slightly slower (by a couple of arithmetic
instructions). I don't see this as a problem for now as GlobalISel is only on
by default at `-O0`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82615

Files:
  compiler-rt/test/hwasan/TestCases/exported-tagged-global.c
  llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
  llvm/test/CodeGen/AArch64/tagged-globals.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82615.273564.patch
Type: text/x-patch
Size: 7571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200626/54c6a2a4/attachment-0001.bin>


More information about the llvm-commits mailing list