[PATCH] D45492: [Verifier] Not really for review: check for TBAA Access Tag presence

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 10 08:36:08 PDT 2018


lebedev.ri created this revision.

I don't really know if this is useful or not, i was just curious to try to make something like this.

There may be several use-cases:

- Verify that front-end indeed did mark every instruction that could have such a TBAA Access Tag (`TBAAVerifier::CouldHaveTBAAAccessTag()`) with the tag.
- Assuming that the input is ok (see previous point), verify that the passes don't loose these tags, don't.

The design is very simplistic right now:

- One option to toggle the check (default to off)
- One option on how to treat the missing access tag:
  - Treat any missing tag as a fatal error
  - Missing tag is never a error
  - If there is at least one instruction that is tagged, then a missing tag is an error.

The last option makes sense to be the default, e.g. because one can globally disable TBAA info
(`-O0`, `-fno-strict-aliasing`?), and then *nothing* is tagged. Since we can't know beforehand
if there is a TBAA metadata, i simply track whether we have seen any tagged instructions,
and decide whether this is a fatal error at the end.

An observation: while trying to test, i have *quickly* found this very simple test, F5955079: input.cpp <https://reviews.llvm.org/F5955079>,
in which the loads/stores aren't being tagged (with roughly `-O1 -fstrict-aliasing` + verifier enabled).
I'm sure there are more.

Now, question[s]:

- If TBAA is enabled, are there valid (i.e. not a bug) cases where these missing tags are genuinely ok/intentional? That would make this way less useful.
- Does this have any actual use cases? (no is an ok answer, too)
- Should i try to look into this further, look into missing tags?


Repository:
  rL LLVM

https://reviews.llvm.org/D45492

Files:
  include/llvm/IR/Verifier.h
  lib/IR/Verifier.cpp
  test/Verifier/tbaa-tag-missing.ll
  test/Verifier/tbaa-tag-partially-missing.ll
  test/Verifier/tbaa-tag-present.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45492.141847.patch
Type: text/x-patch
Size: 10517 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180410/157f8b79/attachment.bin>


More information about the llvm-commits mailing list