[llvm] r289402 - [Verifier] Add verification for TBAA metadata

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 08:38:08 PST 2016


Hi Hal,

 > We'll need to fix the bitcode files, or perhaps better yet, add some kind of auto-upgrade support (perhaps just by 
dropping the metadata that does not make sense?).

I would prefer not to drop or heal incorrect TBAA metadata within LLVM.  The main reason to add the verifier was to fail 
noisily with bad TBAA metadata so that the frontends or the passes producing it could be fixed.

On 12/14/16, 7:50 AM, Hal Finkel wrote:
 > Building CXX object Bitcode/Benchmarks/Halide/local_laplacian/CMakeFiles/halide_local_laplacian.dir/local_laplacian.bc.o
 > Access type node must be scalar
 >    %gray.host = load float*, float** %28, !tbaa !28
 > !28 = !{!29, !29, i64 0}
 > !29 = !{!"gray.host"}
 > Access type node must be scalar
 >    %gray.buffer = load %struct.buffer_t*, %struct.buffer_t** %29, !tbaa !30
 > !30 = !{!31, !31, i64 0}
 > !31 = !{!"gray.buffer"}
 > Access type node must be scalar
 >    %input.host = load i16*, i16** %30, !tbaa !32
 > !32 = !{!33, !33, i64 0}
 > !33 = !{!"input.host"}
 > Access type node must be scalar
 >    %input.buffer = load %struct.buffer_t*, %struct.buffer_t** %31, !tbaa !34
 > !34 = !{!35, !35, i64 0}
 > !35 = !{!"input.buffer"}

These look fairly easy to fix though -- the base type and struct type operands directly point to the TBAA root.  I think 
the right representation is:

     %input.buffer = load %struct.buffer_t*, %struct.buffer_t** %31, !tbaa !34
  !34 = !{!35, !35, i64 0}
  !35 = !{!"input.buffer", !36}
  !36 = !{!"halide tbaa root"}

     %input.host = load i16*, i16** %30, !tbaa !32
  !32 = !{!33, !33, i64 0}
  !33 = !{!"input.host", !36}  ;; !36 defined above

Assuming that you want to denote !32 and !34 to be NoAlias.

Note: As far as I can tell, given the IR above, today (without the verifier) they would be seen as MayAlias since they 
have different TBAA roots.

-- Sanjoy


More information about the llvm-commits mailing list