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

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 07:50:24 PST 2016


Hi Sanjoy,

I'm seeing a failure in the Halide bitcode test-suite compiles now (with an asserts-enabled build):

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"}

Just running opt over the input bitcode file shows the problems as well:

$ opt < projects/test-suite/Bitcode/Benchmarks/Halide/local_laplacian/local_laplacian.bc -S

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?).

Thanks again,
Hal

----- Original Message -----
> From: "Sanjoy Das via llvm-commits" <llvm-commits at lists.llvm.org>
> To: llvm-commits at lists.llvm.org
> Sent: Sunday, December 11, 2016 2:07:16 PM
> Subject: [llvm] r289402 - [Verifier] Add verification for TBAA metadata
> 
> Author: sanjoy
> Date: Sun Dec 11 14:07:15 2016
> New Revision: 289402
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=289402&view=rev
> Log:
> [Verifier] Add verification for TBAA metadata
> 
> Summary:
> This change adds some verification in the IR verifier around struct
> path
> TBAA metadata.
> 
> Other than some basic sanity checks (e.g. we get constant integers
> where
> we expect constant integers), this checks:
> 
>  - That by the time an struct access tuple `(base-type, offset)` is
>    "reduced" to a scalar base type, the offset is `0`.  For instance,
>    in
>    C++ you can't start from, say `("struct-a", 16)`, and end up with
>    `("int", 4)` -- by the time the base type is `"int"`, the offset
>    better be zero.  In particular, a variant of this invariant is
>    needed
>    for `llvm::getMostGenericTBAA` to be correct.
> 
>  - That there are no cycles in a struct path.
> 
>  - That struct type nodes have their offsets listed in an ascending
>    order.
> 
>  - That when generating the struct access path, you eventually reach
>  the
>    access type listed in the tbaa tag node.
> 
> Reviewers: dexonsmith, chandlerc, reames, mehdi_amini, manmanren
> 
> Subscribers: mcrosier, llvm-commits
> 
> Differential Revision: https://reviews.llvm.org/D26438
> 
> Added:
>     llvm/trunk/test/Verifier/tbaa.ll
> Modified:
>     llvm/trunk/lib/IR/Verifier.cpp
>     llvm/trunk/test/Analysis/BasicAA/full-store-partial-alias.ll
>     llvm/trunk/test/Analysis/CFLAliasAnalysis/Steensgaard/full-store-partial-alias.ll
>     llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/aliastest.ll
>     llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/cyclic.ll
>     llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/dse.ll
>     llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/dynamic-indices.ll
>     llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll
>     llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll
>     llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/licm.ll
>     llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll
>     llvm/trunk/test/CodeGen/AMDGPU/llvm.SI.load.dword.ll
>     llvm/trunk/test/CodeGen/AMDGPU/sgpr-copy.ll
>     llvm/trunk/test/CodeGen/AMDGPU/si-lod-bias.ll
>     llvm/trunk/test/CodeGen/AMDGPU/si-scheduler.ll
>     llvm/trunk/test/CodeGen/AMDGPU/si-sgpr-spill.ll
>     llvm/trunk/test/CodeGen/AMDGPU/split-smrd.ll
>     llvm/trunk/test/CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot.ll
>     llvm/trunk/test/CodeGen/AMDGPU/wait.ll
>     llvm/trunk/test/CodeGen/ARM/2011-05-04-MultipleLandingPadSuccs.ll
>     llvm/trunk/test/Instrumentation/AddressSanitizer/X86/bug_11395.ll
>     llvm/trunk/test/Instrumentation/ThreadSanitizer/read_from_global.ll
>     llvm/trunk/test/Instrumentation/ThreadSanitizer/vptr_read.ll
>     llvm/trunk/test/Instrumentation/ThreadSanitizer/vptr_update.ll
>     llvm/trunk/test/Transforms/GVN/PRE/preserve-tbaa.ll
>     llvm/trunk/test/Transforms/GVN/tbaa.ll
>     llvm/trunk/test/Transforms/InstCombine/load-combine-metadata.ll
>     llvm/trunk/test/Transforms/InstCombine/loadstore-metadata.ll
>     llvm/trunk/test/Transforms/InstCombine/tbaa-store-to-load.ll
>     llvm/trunk/test/Transforms/JumpThreading/thread-loads.ll
>     llvm/trunk/test/Transforms/LICM/2011-04-06-PromoteResultOfPromotion.ll
>     llvm/trunk/test/Transforms/LoopVectorize/ARM/vector_cast.ll
>     llvm/trunk/test/Transforms/SLPVectorizer/X86/crash_scheduling.ll
>     llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll
>     llvm/trunk/test/Transforms/Util/store-first-op.ll
> 
> Modified: llvm/trunk/lib/IR/Verifier.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/Verifier.cpp (original)
> +++ llvm/trunk/lib/IR/Verifier.cpp Sun Dec 11 14:07:15 2016
> @@ -187,6 +187,14 @@ private:
>      *OS << *C;
>    }
>  
> +  void Write(const APInt *AI) {
> +    if (!AI)
> +      return;
> +    *OS << *AI << '\n';
> +  }
> +
> +  void Write(const unsigned i) { *OS << i << '\n'; }
> +
>    template <typename T> void Write(ArrayRef<T> Vs) {
>      for (const T &V : Vs)
>        Write(V);
> @@ -285,6 +293,17 @@ class Verifier : public InstVisitor<Veri
>    // constant expressions, we can arrive at a particular user many
>    times.
>    SmallPtrSet<const Value *, 32> GlobalValueVisited;
>  
> +  /// Cache of TBAA base nodes that have already been visited.  This
> cachce maps
> +  /// a node that has been visited to a pair (IsInvalid, BitWidth)
> where
> +  ///
> +  ///  \c IsInvalid is true iff the node is invalid.
> +  ///  \c BitWidth, if non-zero, is the bitwidth of the integer used
> to denoting
> +  ///    the offset of the access.  If zero, only a zero offset is
> allowed.
> +  ///
> +  /// \c BitWidth has no meaning if \c IsInvalid is true.
> +  typedef std::pair<bool, unsigned> TBAABaseNodeSummary;
> +  DenseMap<MDNode *, TBAABaseNodeSummary> TBAABaseNodes;
> +
>    void checkAtomicMemAccessSize(Type *Ty, const Instruction *I);
>  
>  public:
> @@ -393,6 +412,14 @@ private:
>    void visitDereferenceableMetadata(Instruction &I, MDNode *MD);
>    void visitTBAAMetadata(Instruction &I, MDNode *MD);
>  
> +  /// \name Helper functions used by \c visitTBAAMetadata.
> +  /// @{
> +  MDNode *getFieldNodeFromTBAABaseNode(Instruction &I, MDNode
> *BaseNode,
> +                                       APInt &Offset);
> +  TBAABaseNodeSummary verifyTBAABaseNode(Instruction &I, MDNode
> *BaseNode);
> +  TBAABaseNodeSummary verifyTBAABaseNodeImpl(Instruction &I, MDNode
> *BaseNode);
> +  /// @}
> +
>    template <class Ty> bool isValidMetadataArray(const MDTuple &N);
>  #define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS) void
>  visit##CLASS(const CLASS &N);
>  #include "llvm/IR/Metadata.def"
> @@ -3657,6 +3684,174 @@ void Verifier::visitDereferenceableMetad
>           "dereferenceable_or_null metadata value must be an i64!",
>           &I);
>  }
>  
> +/// Verify that \p BaseNode can be used as the "base type" in the
> struct-path
> +/// TBAA scheme.  This means \p BaseNode is either a scalar node, or
> a
> +/// struct-type node describing an aggregate data structure (like a
> struct).
> +Verifier::TBAABaseNodeSummary
> Verifier::verifyTBAABaseNode(Instruction &I,
> +                                                           MDNode
> *BaseNode) {
> +  if (BaseNode->getNumOperands() < 2) {
> +    CheckFailed("Base nodes must have at least two operands", &I,
> BaseNode);
> +    return {true, ~0u};
> +  }
> +
> +  auto Itr = TBAABaseNodes.find(BaseNode);
> +  if (Itr != TBAABaseNodes.end())
> +    return Itr->second;
> +
> +  auto Result = verifyTBAABaseNodeImpl(I, BaseNode);
> +  auto InsertResult = TBAABaseNodes.insert({BaseNode, Result});
> +  (void)InsertResult;
> +  assert(InsertResult.second && "We just checked!");
> +  return Result;
> +}
> +
> +Verifier::TBAABaseNodeSummary
> +Verifier::verifyTBAABaseNodeImpl(Instruction &I, MDNode *BaseNode) {
> +  const Verifier::TBAABaseNodeSummary InvalidNode = {true, ~0u};
> +
> +  if (BaseNode->getNumOperands() == 2) {
> +    // This is a scalar base node.
> +    if (!BaseNode->getOperand(0) || !BaseNode->getOperand(1)) {
> +      CheckFailed("Null operands in scalar type nodes!", &I,
> BaseNode);
> +      return InvalidNode;
> +    }
> +    if (!isa<MDNode>(BaseNode->getOperand(1))) {
> +      CheckFailed("Invalid parent operand in scalar TBAA node", &I,
> BaseNode);
> +      return InvalidNode;
> +    }
> +    if (!isa<MDString>(BaseNode->getOperand(0))) {
> +      CheckFailed("Invalid name operand in scalar TBAA node", &I,
> BaseNode);
> +      return InvalidNode;
> +    }
> +
> +    // Scalar nodes can only be accessed at offset 0.
> +    return {false, 0};
> +  }
> +
> +  if (BaseNode->getNumOperands() % 2 != 1) {
> +    CheckFailed("Struct tag nodes must have an odd number of
> operands!",
> +                BaseNode);
> +    return InvalidNode;
> +  }
> +
> +  bool Failed = false;
> +
> +  Optional<APInt> PrevOffset;
> +  unsigned BitWidth = ~0u;
> +
> +  // We've already checked that BaseNode is not a degenerate root
> node with one
> +  // operand in \c verifyTBAABaseNode, so this loop should run at
> least once.
> +  for (unsigned Idx = 1; Idx < BaseNode->getNumOperands(); Idx += 2)
> {
> +    const MDOperand &FieldTy = BaseNode->getOperand(Idx);
> +    const MDOperand &FieldOffset = BaseNode->getOperand(Idx + 1);
> +    if (!isa<MDNode>(FieldTy)) {
> +      CheckFailed("Incorrect field entry in struct type node!", &I,
> BaseNode);
> +      Failed = true;
> +      continue;
> +    }
> +
> +    auto *OffsetEntryCI =
> +        mdconst::dyn_extract_or_null<ConstantInt>(FieldOffset);
> +    if (!OffsetEntryCI) {
> +      CheckFailed("Offset entries must be constants!", &I,
> BaseNode);
> +      Failed = true;
> +      continue;
> +    }
> +
> +    if (BitWidth == ~0u)
> +      BitWidth = OffsetEntryCI->getBitWidth();
> +
> +    if (OffsetEntryCI->getBitWidth() != BitWidth) {
> +      CheckFailed(
> +          "Bitwidth between the offsets and struct type entries must
> match", &I,
> +          BaseNode);
> +      Failed = true;
> +      continue;
> +    }
> +
> +    // NB! As far as I can tell, we generate a non-strictly
> increasing offset
> +    // sequence only from structs that have zero size bit fields.
>  When
> +    // recursing into a contained struct in \c
> getFieldNodeFromTBAABaseNode we
> +    // pick the field lexically the latest in struct type metadata
> node.  This
> +    // mirrors the actual behavior of the alias analysis
> implementation.
> +    bool IsAscending =
> +        !PrevOffset || PrevOffset->ule(OffsetEntryCI->getValue());
> +
> +    if (!IsAscending) {
> +      CheckFailed("Offsets must be increasing!", &I, BaseNode);
> +      Failed = true;
> +    }
> +
> +    PrevOffset = OffsetEntryCI->getValue();
> +  }
> +
> +  return Failed ? InvalidNode : Verifier::TBAABaseNodeSummary(false,
> BitWidth);
> +}
> +
> +static bool IsRootTBAANode(const MDNode *MD) {
> +  return MD->getNumOperands() < 2;
> +}
> +
> +static bool IsScalarTBAANodeImpl(const MDNode *MD,
> +                                 SmallPtrSetImpl<const MDNode *>
> &Visited) {
> +  if (MD->getNumOperands() == 2)
> +    return true;
> +
> +  if (MD->getNumOperands() != 3)
> +    return false;
> +
> +  auto *Offset =
> mdconst::dyn_extract<ConstantInt>(MD->getOperand(2));
> +  if (!(Offset && Offset->isZero() &&
> isa<MDString>(MD->getOperand(0))))
> +    return false;
> +
> +  auto *Parent = dyn_cast<MDNode>(MD->getOperand(1));
> +  return Visited.insert(Parent).second &&
> +         (IsRootTBAANode(Parent) || IsScalarTBAANodeImpl(Parent,
> Visited));
> +}
> +
> +static bool IsScalarTBAANode(const MDNode *MD) {
> +  SmallPtrSet<const MDNode *, 4> Visited;
> +  return IsScalarTBAANodeImpl(MD, Visited);
> +}
> +
> +/// Returns the field node at the offset \p Offset in \p BaseNode.
>  Update \p
> +/// Offset in place to be the offset within the field node returned.
> +///
> +/// We assume we've okayed \p BaseNode via \c verifyTBAABaseNode.
> +MDNode *Verifier::getFieldNodeFromTBAABaseNode(Instruction &I,
> MDNode *BaseNode,
> +                                               APInt &Offset) {
> +  assert(BaseNode->getNumOperands() >= 2 && "Invalid base node!");
> +
> +  // Scalar nodes have only one possible "field" -- their parent in
> the access
> +  // hierarchy.  Offset must be zero at this point, but our caller
> is supposed
> +  // to Assert that.
> +  if (BaseNode->getNumOperands() == 2)
> +    return cast<MDNode>(BaseNode->getOperand(1));
> +
> +  for (unsigned Idx = 1; Idx < BaseNode->getNumOperands(); Idx += 2)
> {
> +    auto *OffsetEntryCI =
> +        mdconst::extract<ConstantInt>(BaseNode->getOperand(Idx +
> 1));
> +    if (OffsetEntryCI->getValue().ugt(Offset)) {
> +      if (Idx == 1) {
> +        CheckFailed("Could not find TBAA parent in struct type
> node", &I,
> +                    BaseNode, &Offset);
> +        return nullptr;
> +      }
> +
> +      auto *PrevOffsetEntryCI =
> +          mdconst::extract<ConstantInt>(BaseNode->getOperand(Idx -
> 1));
> +      Offset -= PrevOffsetEntryCI->getValue();
> +      return cast<MDNode>(BaseNode->getOperand(Idx - 2));
> +    }
> +  }
> +
> +  auto *LastOffsetEntryCI = mdconst::extract<ConstantInt>(
> +      BaseNode->getOperand(BaseNode->getNumOperands() - 1));
> +
> +  Offset -= LastOffsetEntryCI->getValue();
> +  return
> cast<MDNode>(BaseNode->getOperand(BaseNode->getNumOperands() - 2));
> +}
> +
>  void Verifier::visitTBAAMetadata(Instruction &I, MDNode *MD) {
>    bool IsStructPathTBAA =
>        isa<MDNode>(MD->getOperand(0)) && MD->getNumOperands() >= 3;
> @@ -3664,6 +3859,70 @@ void Verifier::visitTBAAMetadata(Instruc
>    Assert(IsStructPathTBAA,
>           "Old-style TBAA is no longer allowed, use struct-path TBAA
>           instead",
>           &I);
> +
> +  Assert(MD->getNumOperands() < 5,
> +         "Struct tag metadata must have either 3 or 4 operands", &I,
> MD);
> +
> +  MDNode *BaseNode = dyn_cast_or_null<MDNode>(MD->getOperand(0));
> +  MDNode *AccessType = dyn_cast_or_null<MDNode>(MD->getOperand(1));
> +
> +  if (MD->getNumOperands() == 4) {
> +    auto *IsImmutableCI =
> +
>        mdconst::dyn_extract_or_null<ConstantInt>(MD->getOperand(3));
> +    Assert(IsImmutableCI,
> +           "Immutability tag on struct tag metadata must be a
> constant", &I,
> +           MD);
> +    Assert(IsImmutableCI->isZero() || IsImmutableCI->isOne(),
> +           "Immutability part of the struct tag metadata must be
> either 0 or 1",
> +           &I, MD);
> +  }
> +
> +  Assert(BaseNode && AccessType,
> +         "Malformed struct tag metadata:  base and access-type "
> +         "should be non-null and point to Metadata nodes",
> +         &I, MD, BaseNode, AccessType);
> +
> +  Assert(IsScalarTBAANode(AccessType), "Access type node must be
> scalar", &I,
> +         MD, AccessType);
> +
> +  auto *OffsetCI =
> mdconst::dyn_extract_or_null<ConstantInt>(MD->getOperand(2));
> +  Assert(OffsetCI, "Offset must be constant integer", &I, MD);
> +
> +  APInt Offset = OffsetCI->getValue();
> +  bool SeenAccessTypeInPath = false;
> +
> +  SmallPtrSet<MDNode *, 4> StructPath;
> +
> +  for (/* empty */; BaseNode && !IsRootTBAANode(BaseNode);
> +       BaseNode = getFieldNodeFromTBAABaseNode(I, BaseNode, Offset))
> {
> +    if (!StructPath.insert(BaseNode).second) {
> +      CheckFailed("Cycle detected in struct path", &I, MD);
> +      return;
> +    }
> +
> +    bool Invalid;
> +    unsigned BaseNodeBitWidth;
> +    std::tie(Invalid, BaseNodeBitWidth) = verifyTBAABaseNode(I,
> BaseNode);
> +
> +    // If the base node is invalid in itself, then we've already
> printed all the
> +    // errors we wanted to print.
> +    if (Invalid)
> +      return;
> +
> +    SeenAccessTypeInPath |= BaseNode == AccessType;
> +
> +    if (IsScalarTBAANode(BaseNode) || BaseNode == AccessType)
> +      Assert(Offset == 0, "Offset not zero at the point of scalar
> access", &I,
> +             MD, &Offset);
> +
> +    Assert(BaseNodeBitWidth == Offset.getBitWidth() ||
> +               (BaseNodeBitWidth == 0 && Offset == 0),
> +           "Access bit-width not the same as description bit-width",
> &I, MD,
> +           BaseNodeBitWidth, Offset.getBitWidth());
> +  }
> +
> +  Assert(SeenAccessTypeInPath, "Did not see access type in access
> path!", &I,
> +         MD);
>  }
>  
>  /// verifyInstruction - Verify that an instruction is well formed.
> @@ -3801,8 +4060,12 @@ void Verifier::visitInstruction(Instruct
>    if (MDNode *MD =
>    I.getMetadata(LLVMContext::MD_dereferenceable_or_null))
>      visitDereferenceableMetadata(I, MD);
>  
> -  if (MDNode *MD = I.getMetadata(LLVMContext::MD_tbaa))
> -    visitTBAAMetadata(I, MD);
> +  if (MDNode *TBAA = I.getMetadata(LLVMContext::MD_tbaa)) {
> +    Assert(isa<LoadInst>(I) || isa<StoreInst>(I) || isa<CallInst>(I)
> ||
> +               isa<VAArgInst>(I),
> +           "TBAA is only for loads, stores and calls!", &I);
> +    visitTBAAMetadata(I, TBAA);
> +  }
>  
>    if (MDNode *AlignMD = I.getMetadata(LLVMContext::MD_align)) {
>      Assert(I.getType()->isPointerTy(), "align applies only to
>      pointer types",
> 
> Modified:
> llvm/trunk/test/Analysis/BasicAA/full-store-partial-alias.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/full-store-partial-alias.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Analysis/BasicAA/full-store-partial-alias.ll
> (original)
> +++ llvm/trunk/test/Analysis/BasicAA/full-store-partial-alias.ll Sun
> Dec 11 14:07:15 2016
> @@ -31,7 +31,7 @@ entry:
>  
>  !0 = !{!4, !4, i64 0}
>  !1 = !{!"omnipotent char", !2}
> -!2 = !{!"Simple C/C++ TBAA", null}
> +!2 = !{!"Simple C/C++ TBAA"}
>  !3 = !{!5, !5, i64 0}
>  !4 = !{!"double", !1}
>  !5 = !{!"int", !1}
> 
> Modified:
> llvm/trunk/test/Analysis/CFLAliasAnalysis/Steensgaard/full-store-partial-alias.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/CFLAliasAnalysis/Steensgaard/full-store-partial-alias.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> ---
> llvm/trunk/test/Analysis/CFLAliasAnalysis/Steensgaard/full-store-partial-alias.ll
> (original)
> +++
> llvm/trunk/test/Analysis/CFLAliasAnalysis/Steensgaard/full-store-partial-alias.ll
> Sun Dec 11 14:07:15 2016
> @@ -33,7 +33,7 @@ entry:
>  
>  !0 = !{!4, !4, i64 0}
>  !1 = !{!"omnipotent char", !2}
> -!2 = !{!"Simple C/C++ TBAA", null}
> +!2 = !{!"Simple C/C++ TBAA"}
>  !3 = !{!5, !5, i64 0}
>  !4 = !{!"double", !1}
>  !5 = !{!"int", !1}
> 
> Modified:
> llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/aliastest.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/aliastest.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/aliastest.ll
> (original)
> +++ llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/aliastest.ll Sun
> Dec 11 14:07:15 2016
> @@ -63,5 +63,6 @@ define i8 @test1_no(i8* %a, i8* %b) noun
>  !7 = !{ !"foo", !0 }
>  !8 = !{ !"bar", !0 }
>  !9 = !{ !"foo", !0 }
> -!10 = !{ !"bar", !"different" }
> +!10 = !{ !"bar", !12 }
>  !11 = !{ !"qux", !0}
> +!12 = !{!"different"}
> 
> Modified: llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/cyclic.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/cyclic.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/cyclic.ll
> (original)
> +++ llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/cyclic.ll Sun Dec
> 11 14:07:15 2016
> @@ -1,5 +1,5 @@
>  ; RUN: not opt -instcombine < %s 2>&1 | FileCheck %s
> -; CHECK: Cycle found in TBAA metadata.
> +; CHECK: Access type node must be scalar
>  
>  define void @test6(i32* %gi) #0 {
>  entry:
> 
> Modified: llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/dse.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/dse.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/dse.ll (original)
> +++ llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/dse.ll Sun Dec 11
> 14:07:15 2016
> @@ -68,5 +68,6 @@ define i8 @test1_no(i8* %a, i8* %b) noun
>  !7 = !{ !"foo", !0 }
>  !8 = !{ !"bar", !0 }
>  !9 = !{ !"foo", !0 }
> -!10 = !{ !"bar", !"different" }
> +!10 = !{ !"bar", !12}
>  !11 = !{ !"qux", !0}
> +!12 = !{!"different"}
> 
> Modified:
> llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/dynamic-indices.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/dynamic-indices.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> ---
> llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/dynamic-indices.ll
> (original)
> +++
> llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/dynamic-indices.ll
> Sun Dec 11 14:07:15 2016
> @@ -127,7 +127,7 @@ for.end:
>  ; CHECK: [[TYPE_LL]] = !{!"long long", {{!.*}}}
>  !0 = !{!6, !6, i64 0}
>  !1 = !{!"omnipotent char", !2}
> -!2 = !{!"Simple C/C++ TBAA", null}
> +!2 = !{!"Simple C/C++ TBAA"}
>  !3 = !{!7, !7, i64 0}
>  !4 = !{!8, !8, i64 0}
>  !5 = !{!9, !9, i64 0}
> 
> Modified:
> llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> ---
> llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll
> (original)
> +++
> llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll
> Sun Dec 11 14:07:15 2016
> @@ -91,5 +91,6 @@ if.else:
>  !4 = !{!8, !8, i64 0}
>  !5 = !{!"red", !0}
>  !6 = !{!"blu", !0}
> -!7 = !{!"outer space"}
> +!7 = !{!"outer space", !9}
>  !8 = !{!"brick red", !5}
> +!9 = !{!"observable universe"}
> 
> Modified:
> llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll
> (original)
> +++ llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll Sun
> Dec 11 14:07:15 2016
> @@ -26,7 +26,7 @@ declare void @llvm.arm.neon.vst1.p0i8.v8
>  ; CHECK: attributes #1 = { argmemonly nounwind }
>  ; CHECK: attributes [[NUW]] = { nounwind }
>  
> -!0 = !{!"tbaa root", null}
> +!0 = !{!"tbaa root"}
>  !1 = !{!3, !3, i64 0}
>  !2 = !{!4, !4, i64 0}
>  !3 = !{!"A", !0}
> 
> Modified: llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/licm.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/licm.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/licm.ll
> (original)
> +++ llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/licm.ll Sun Dec
> 11 14:07:15 2016
> @@ -29,7 +29,7 @@ for.end:
>    ret void
>  }
>  
> -!0 = !{!"root", null}
> +!0 = !{!"root"}
>  !1 = !{!6, !6, i64 0}
>  !2 = !{!7, !7, i64 0}
>  
> @@ -58,8 +58,9 @@ loop:
>  
>  !3 = !{!"pointer", !8}
>  !4 = !{!8, !8, i64 0}
> -!5 = !{!9, !9, i64 0}
> +!5 = !{!10, !10, i64 0}
>  !6 = !{!"pointer", !0}
>  !7 = !{!"double", !0}
>  !8 = !{!"char", !9}
> -!9 = !{!"root", null}
> +!9 = !{!"root"}
> +!10 = !{!"scalar-type", !9}
> 
> Modified:
> llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll
> (original)
> +++ llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll Sun
> Dec 11 14:07:15 2016
> @@ -20,7 +20,7 @@ declare void @llvm.memcpy.p0i8.p0i8.i64(
>  
>  ; CHECK: [[TAGA]] = !{[[TYPEA:!.*]], [[TYPEA]], i64 0}
>  ; CHECK: [[TYPEA]] = !{!"A", !{{.*}}}
> -!0 = !{!"tbaa root", null}
> +!0 = !{!"tbaa root"}
>  !1 = !{!3, !3, i64 0}
>  !2 = !{!4, !4, i64 0}
>  !3 = !{!"A", !0}
> 
> Modified: llvm/trunk/test/CodeGen/AMDGPU/llvm.SI.load.dword.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/llvm.SI.load.dword.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/AMDGPU/llvm.SI.load.dword.ll (original)
> +++ llvm/trunk/test/CodeGen/AMDGPU/llvm.SI.load.dword.ll Sun Dec 11
> 14:07:15 2016
> @@ -49,4 +49,5 @@ declare void @llvm.SI.export(i32, i32, i
>  
>  attributes #0 = { nounwind readonly }
>  
> -!0 = !{!"const", null, i32 1}
> +!0 = !{!"const", !1, i32 1}
> +!1 = !{!"tbaa root"}
> 
> Modified: llvm/trunk/test/CodeGen/AMDGPU/sgpr-copy.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/sgpr-copy.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/AMDGPU/sgpr-copy.ll (original)
> +++ llvm/trunk/test/CodeGen/AMDGPU/sgpr-copy.ll Sun Dec 11 14:07:15
> 2016
> @@ -412,5 +412,6 @@ attributes #1 = { nounwind readnone }
>  attributes #2 = { nounwind readonly }
>  
>  !0 = !{!1, !1, i64 0, i32 1}
> -!1 = !{!"const", null}
> +!1 = !{!"const", !3}
>  !2 = !{!1, !1, i64 0}
> +!3 = !{!"tbaa root"}
> 
> Modified: llvm/trunk/test/CodeGen/AMDGPU/si-lod-bias.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/si-lod-bias.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/AMDGPU/si-lod-bias.ll (original)
> +++ llvm/trunk/test/CodeGen/AMDGPU/si-lod-bias.ll Sun Dec 11 14:07:15
> 2016
> @@ -49,4 +49,5 @@ declare void @llvm.SI.export(i32, i32, i
>  attributes #1 = { nounwind readnone }
>  
>  !0 = !{!1, !1, i64 0, i32 1}
> -!1 = !{!"const", null}
> +!1 = !{!"const", !2}
> +!2 = !{!"tbaa root"}
> 
> Modified: llvm/trunk/test/CodeGen/AMDGPU/si-scheduler.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/si-scheduler.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/AMDGPU/si-scheduler.ll (original)
> +++ llvm/trunk/test/CodeGen/AMDGPU/si-scheduler.ll Sun Dec 11
> 14:07:15 2016
> @@ -57,4 +57,5 @@ declare void @llvm.SI.export(i32, i32, i
>  attributes #1 = { nounwind readnone }
>  
>  !0 = !{!1, !1, i64 0, i32 1}
> -!1 = !{!"const", null}
> +!1 = !{!"const", !2}
> +!2 = !{!"tbaa root"}
> 
> Modified: llvm/trunk/test/CodeGen/AMDGPU/si-sgpr-spill.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/si-sgpr-spill.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/AMDGPU/si-sgpr-spill.ll (original)
> +++ llvm/trunk/test/CodeGen/AMDGPU/si-sgpr-spill.ll Sun Dec 11
> 14:07:15 2016
> @@ -1619,4 +1619,5 @@ attributes #2 = { nounwind readnone }
>  attributes #3 = { nounwind readonly }
>  
>  !0 = !{!1, !1, i64 0, i32 1}
> -!1 = !{!"const", null}
> +!1 = !{!"const", !2}
> +!2 = !{!"tbaa root"}
> 
> Modified: llvm/trunk/test/CodeGen/AMDGPU/split-smrd.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/split-smrd.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/AMDGPU/split-smrd.ll (original)
> +++ llvm/trunk/test/CodeGen/AMDGPU/split-smrd.ll Sun Dec 11 14:07:15
> 2016
> @@ -42,5 +42,6 @@ attributes #0 = { nounwind }
>  attributes #1 = { nounwind readnone }
>  
>  !0 = !{!1, !1, i64 0, i32 1}
> -!1 = !{!"const", null}
> +!1 = !{!"const", !3}
>  !2 = !{!1, !1, i64 0}
> +!3 = !{!"tbaa root"}
> 
> Modified:
> llvm/trunk/test/CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot.ll
> (original)
> +++ llvm/trunk/test/CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot.ll
> Sun Dec 11 14:07:15 2016
> @@ -497,4 +497,5 @@ attributes #0 = { nounwind }
>  attributes #1 = { nounwind readnone }
>  
>  !0 = !{!1, !1, i64 0, i32 1}
> -!1 = !{!"const", null}
> +!1 = !{!"const", !2}
> +!2 = !{!"tbaa root"}
> 
> Modified: llvm/trunk/test/CodeGen/AMDGPU/wait.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/wait.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/AMDGPU/wait.ll (original)
> +++ llvm/trunk/test/CodeGen/AMDGPU/wait.ll Sun Dec 11 14:07:15 2016
> @@ -82,4 +82,5 @@ attributes #1 = { convergent nounwind }
>  attributes #2 = { nounwind readnone }
>  
>  !0 = !{!1, !1, i64 0, i32 1}
> -!1 = !{!"const", null}
> +!1 = !{!"const", !2}
> +!2 = !{!"tbaa root"}
> 
> Modified:
> llvm/trunk/test/CodeGen/ARM/2011-05-04-MultipleLandingPadSuccs.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2011-05-04-MultipleLandingPadSuccs.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/ARM/2011-05-04-MultipleLandingPadSuccs.ll
> (original)
> +++ llvm/trunk/test/CodeGen/ARM/2011-05-04-MultipleLandingPadSuccs.ll
> Sun Dec 11 14:07:15 2016
> @@ -83,6 +83,6 @@ declare void @_ZSt9terminatev()
>  
>  !0 = !{!"any pointer", !1}
>  !1 = !{!"omnipotent char", !2}
> -!2 = !{!"Simple C/C++ TBAA", null}
> +!2 = !{!"Simple C/C++ TBAA"}
>  !3 = !{!"bool", !1}
>  !4 = !{!"int", !1}
> 
> Modified:
> llvm/trunk/test/Instrumentation/AddressSanitizer/X86/bug_11395.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/X86/bug_11395.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Instrumentation/AddressSanitizer/X86/bug_11395.ll
> (original)
> +++ llvm/trunk/test/Instrumentation/AddressSanitizer/X86/bug_11395.ll
> Sun Dec 11 14:07:15 2016
> @@ -66,7 +66,7 @@ entry:
>  
>  !0 = !{!5, !5, i64 0}
>  !1 = !{!"omnipotent char", !2}
> -!2 = !{!"Simple C/C++ TBAA", null}
> +!2 = !{!"Simple C/C++ TBAA"}
>  !3 = !{!6, !6, i64 0}
>  !4 = !{i32 156132, i32 156164, i32 156205, i32 156238, i32 156282,
>  i32 156332, i32 156370, i32 156408, i32 156447, i32 156486, i32
>  156536, i32 156574, i32 156612, i32 156651, i32 156690, i32 156740,
>  i32 156778, i32 156816, i32 156855, i32 156894, i32 156944, i32
>  156982, i32 157020, i32 157059, i32 157098, i32 157148, i32 157186,
>  i32 157224, i32 157263, i32 157302, i32 157352, i32 157390, i32
>  157428, i32 157467, i32 157506, i32 157556, i32 157594, i32 157632,
>  i32 157671, i32 157710, i32 157760, i32 157798, i32 157836, i32
>  157875, i32 157914, i32 157952, i32 157996, i32 158046, i32 158099,
>  i32 158140, i32 158179, i32 158218, i32 158268, i32 158321, i32
>  158362, i32 158401, i32 158440, i32 158490, i32 158543, i32 158584,
>  i32 158623, i32 158662, i32 158712, i32 158765, i32 158806, i32
>  158845, i32 158884, i32 158922, i32 158963, i32 158996, i32 159029,
>  i32 159062, i32 159109, i32 159154, i32 159199, i32 159243, i32
>  159286, i32 159329, i32 159375, i32 159422, i32 159478, i32 159522,
>  i32 15
>  9566}
>  !5 = !{!"any pointer", !1}
> 
> Modified:
> llvm/trunk/test/Instrumentation/ThreadSanitizer/read_from_global.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/ThreadSanitizer/read_from_global.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> ---
> llvm/trunk/test/Instrumentation/ThreadSanitizer/read_from_global.ll
> (original)
> +++
> llvm/trunk/test/Instrumentation/ThreadSanitizer/read_from_global.ll
> Sun Dec 11 14:07:15 2016
> @@ -54,6 +54,6 @@ entry:
>  ; CHECK: = load
>  ; CHECK: ret void
>  
> -!0 = !{!"Simple C/C++ TBAA", null}
> +!0 = !{!"Simple C/C++ TBAA"}
>  !1 = !{!"vtable pointer", !0}
>  !2 = !{!1, !1, i64 0}
> 
> Modified:
> llvm/trunk/test/Instrumentation/ThreadSanitizer/vptr_read.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/ThreadSanitizer/vptr_read.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Instrumentation/ThreadSanitizer/vptr_read.ll
> (original)
> +++ llvm/trunk/test/Instrumentation/ThreadSanitizer/vptr_read.ll Sun
> Dec 11 14:07:15 2016
> @@ -9,5 +9,5 @@ entry:
>    ret i8 %0
>  }
>  !0 = !{!2, !2, i64 0}
> -!1 = !{!"Simple C/C++ TBAA", null}
> +!1 = !{!"Simple C/C++ TBAA"}
>  !2 = !{!"vtable pointer", !1}
> 
> Modified:
> llvm/trunk/test/Instrumentation/ThreadSanitizer/vptr_update.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/ThreadSanitizer/vptr_update.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Instrumentation/ThreadSanitizer/vptr_update.ll
> (original)
> +++ llvm/trunk/test/Instrumentation/ThreadSanitizer/vptr_update.ll
> Sun Dec 11 14:07:15 2016
> @@ -36,5 +36,5 @@ entry:
>  }
>  
>  !0 = !{!2, !2, i64 0}
> -!1 = !{!"Simple C/C++ TBAA", null}
> +!1 = !{!"Simple C/C++ TBAA"}
>  !2 = !{!"vtable pointer", !1}
> 
> Modified: llvm/trunk/test/Transforms/GVN/PRE/preserve-tbaa.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/PRE/preserve-tbaa.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/GVN/PRE/preserve-tbaa.ll (original)
> +++ llvm/trunk/test/Transforms/GVN/PRE/preserve-tbaa.ll Sun Dec 11
> 14:07:15 2016
> @@ -27,5 +27,5 @@ for.end:
>  
>  !0 = !{!3, !3, i64 0}
>  !1 = !{!"omnipotent char", !2}
> -!2 = !{!"Simple C/C++ TBAA", null}
> +!2 = !{!"Simple C/C++ TBAA"}
>  !3 = !{!"short", !1}
> 
> Modified: llvm/trunk/test/Transforms/GVN/tbaa.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/tbaa.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/GVN/tbaa.ll (original)
> +++ llvm/trunk/test/Transforms/GVN/tbaa.ll Sun Dec 11 14:07:15 2016
> @@ -113,13 +113,14 @@ declare i32 @foo(i8*) readonly
>  ; CHECK: [[TAGA]] = !{[[TYPEA]], [[TYPEA]], i64 0}
>  !0 = !{!5, !5, i64 0}
>  !1 = !{!6, !6, i64 0}
> -!2 = !{!"tbaa root", null}
> +!2 = !{!"tbaa root"}
>  !3 = !{!7, !7, i64 0}
> -!4 = !{!8, !8, i64 0}
> +!4 = !{!11, !11, i64 0}
>  !5 = !{!"C", !6}
>  !6 = !{!"A", !2}
>  !7 = !{!"B", !6}
> -!8 = !{!"another root", null}
> +!8 = !{!"another root"}
> +!11 = !{!"scalar type", !8}
>  
>  
>  ;; A TBAA structure who's only point is to have a constant location
> 
> Modified:
> llvm/trunk/test/Transforms/InstCombine/load-combine-metadata.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/load-combine-metadata.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/InstCombine/load-combine-metadata.ll
> (original)
> +++ llvm/trunk/test/Transforms/InstCombine/load-combine-metadata.ll
> Sun Dec 11 14:07:15 2016
> @@ -26,4 +26,5 @@ define void @test_load_load_combine_meta
>  !5 = !{!3}
>  !6 = !{!4}
>  !7 = !{ !"tbaa root" }
> -!8 = !{ !7, !7, i64 0 }
> +!8 = !{ !9, !9, i64 0 }
> +!9 = !{ !"scalar type", !7}
> 
> Modified:
> llvm/trunk/test/Transforms/InstCombine/loadstore-metadata.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/loadstore-metadata.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/InstCombine/loadstore-metadata.ll
> (original)
> +++ llvm/trunk/test/Transforms/InstCombine/loadstore-metadata.ll Sun
> Dec 11 14:07:15 2016
> @@ -15,9 +15,9 @@ entry:
>  define i32 @test_load_cast_combine_noalias(float* %ptr) {
>  ; Ensure (cast (load (...))) -> (load (cast (...))) preserves
>  no-alias metadata.
>  ; CHECK-LABEL: @test_load_cast_combine_noalias(
> -; CHECK: load i32, i32* %{{.*}}, !alias.scope !2, !noalias !1
> +; CHECK: load i32, i32* %{{.*}}, !alias.scope !3, !noalias !4
>  entry:
> -  %l = load float, float* %ptr, !alias.scope !2, !noalias !1
> +  %l = load float, float* %ptr, !alias.scope !3, !noalias !4
>    %c = bitcast float %l to i32
>    ret i32 %c
>  }
> @@ -31,7 +31,7 @@ define float @test_load_cast_combine_ran
>  ; CHECK-NOT: !range
>  ; CHECK: ret float
>  entry:
> -  %l = load i32, i32* %ptr, !range !6
> +  %l = load i32, i32* %ptr, !range !5
>    %c = bitcast i32 %l to float
>    ret float %c
>  }
> @@ -39,9 +39,9 @@ entry:
>  define i32 @test_load_cast_combine_invariant(float* %ptr) {
>  ; Ensure (cast (load (...))) -> (load (cast (...))) preserves
>  invariant metadata.
>  ; CHECK-LABEL: @test_load_cast_combine_invariant(
> -; CHECK: load i32, i32* %{{.*}}, !invariant.load !3
> +; CHECK: load i32, i32* %{{.*}}, !invariant.load !5
>  entry:
> -  %l = load float, float* %ptr, !invariant.load !3
> +  %l = load float, float* %ptr, !invariant.load !6
>    %c = bitcast float %l to i32
>    ret i32 %c
>  }
> @@ -50,9 +50,9 @@ define i32 @test_load_cast_combine_nonte
>  ; Ensure (cast (load (...))) -> (load (cast (...))) preserves
>  nontemporal
>  ; metadata.
>  ; CHECK-LABEL: @test_load_cast_combine_nontemporal(
> -; CHECK: load i32, i32* %{{.*}}, !nontemporal !4
> +; CHECK: load i32, i32* %{{.*}}, !nontemporal !6
>  entry:
> -  %l = load float, float* %ptr, !nontemporal !4
> +  %l = load float, float* %ptr, !nontemporal !7
>    %c = bitcast float %l to i32
>    ret i32 %c
>  }
> @@ -61,9 +61,9 @@ define i8* @test_load_cast_combine_align
>  ; Ensure (cast (load (...))) -> (load (cast (...))) preserves align
>  ; metadata.
>  ; CHECK-LABEL: @test_load_cast_combine_align(
> -; CHECK: load i8*, i8** %{{.*}}, !align !5
> +; CHECK: load i8*, i8** %{{.*}}, !align !7
>  entry:
> -  %l = load i32*, i32** %ptr, !align !5
> +  %l = load i32*, i32** %ptr, !align !8
>    %c = bitcast i32* %l to i8*
>    ret i8* %c
>  }
> @@ -72,9 +72,9 @@ define i8* @test_load_cast_combine_deref
>  ; Ensure (cast (load (...))) -> (load (cast (...))) preserves
>  dereferenceable
>  ; metadata.
>  ; CHECK-LABEL: @test_load_cast_combine_deref(
> -; CHECK: load i8*, i8** %{{.*}}, !dereferenceable !5
> +; CHECK: load i8*, i8** %{{.*}}, !dereferenceable !7
>  entry:
> -  %l = load i32*, i32** %ptr, !dereferenceable !5
> +  %l = load i32*, i32** %ptr, !dereferenceable !8
>    %c = bitcast i32* %l to i8*
>    ret i8* %c
>  }
> @@ -83,9 +83,9 @@ define i8* @test_load_cast_combine_deref
>  ; Ensure (cast (load (...))) -> (load (cast (...))) preserves
>  ; dereferenceable_or_null metadata.
>  ; CHECK-LABEL: @test_load_cast_combine_deref_or_null(
> -; CHECK: load i8*, i8** %{{.*}}, !dereferenceable_or_null !5
> +; CHECK: load i8*, i8** %{{.*}}, !dereferenceable_or_null !7
>  entry:
> -  %l = load i32*, i32** %ptr, !dereferenceable_or_null !5
> +  %l = load i32*, i32** %ptr, !dereferenceable_or_null !8
>    %c = bitcast i32* %l to i8*
>    ret i8* %c
>  }
> @@ -94,7 +94,7 @@ define void @test_load_cast_combine_loop
>  ; Ensure (cast (load (...))) -> (load (cast (...))) preserves loop
>  access
>  ; metadata.
>  ; CHECK-LABEL: @test_load_cast_combine_loop(
> -; CHECK: load i32, i32* %{{.*}}, !llvm.mem.parallel_loop_access !1
> +; CHECK: load i32, i32* %{{.*}}, !llvm.mem.parallel_loop_access !4
>  entry:
>    br label %loop
>  
> @@ -102,7 +102,7 @@ loop:
>    %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
>    %src.gep = getelementptr inbounds float, float* %src, i32 %i
>    %dst.gep = getelementptr inbounds i32, i32* %dst, i32 %i
> -  %l = load float, float* %src.gep, !llvm.mem.parallel_loop_access
> !1
> +  %l = load float, float* %src.gep, !llvm.mem.parallel_loop_access
> !4
>    %c = bitcast float %l to i32
>    store i32 %c, i32* %dst.gep
>    %i.next = add i32 %i, 1
> @@ -130,7 +130,7 @@ define void @test_load_cast_combine_nonn
>  ; CHECK-NOT: !nonnull
>  ; CHECK: store i64 %[[V]], i64*
>  entry:
> -  %p = load float*, float** %ptr, !nonnull !3
> +  %p = load float*, float** %ptr, !nonnull !6
>    %gep = getelementptr float*, float** %ptr, i32 42
>    store float* %p, float** %gep
>    ret void
> @@ -138,10 +138,12 @@ entry:
>  
>  ; This is the metadata tuple that we reference above:
>  ; CHECK: ![[MD]] = !{i64 1, i64 0}
> -!0 = !{ !1, !1, i64 0 }
> -!1 = !{ !1 }
> -!2 = !{ !2, !1 }
> -!3 = !{ }
> -!4 = !{ i32 1 }
> -!5 = !{ i64 8 }
> -!6 = !{ i32 0, i32 42 }
> +!0 = !{!1, !1, i64 0}
> +!1 = !{!"scalar type", !2}
> +!2 = !{!"root"}
> +!3 = distinct !{!3, !4}
> +!4 = distinct !{!4}
> +!5 = !{i32 0, i32 42}
> +!6 = !{}
> +!7 = !{i32 1}
> +!8 = !{i64 8}
> 
> Modified:
> llvm/trunk/test/Transforms/InstCombine/tbaa-store-to-load.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/tbaa-store-to-load.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/InstCombine/tbaa-store-to-load.ll
> (original)
> +++ llvm/trunk/test/Transforms/InstCombine/tbaa-store-to-load.ll Sun
> Dec 11 14:07:15 2016
> @@ -14,4 +14,5 @@ top:
>  }
>  
>  !0 = !{!1, !1, i64 0}
> -!1 = !{!"load_tbaa"}
> +!1 = !{!"scalar type", !2}
> +!2 = !{!"load_tbaa"}
> 
> Modified: llvm/trunk/test/Transforms/JumpThreading/thread-loads.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/JumpThreading/thread-loads.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/JumpThreading/thread-loads.ll
> (original)
> +++ llvm/trunk/test/Transforms/JumpThreading/thread-loads.ll Sun Dec
> 11 14:07:15 2016
> @@ -304,7 +304,7 @@ ret2:
>  
>  !0 = !{!3, !3, i64 0}
>  !1 = !{!"omnipotent char", !2}
> -!2 = !{!"Simple C/C++ TBAA", null}
> +!2 = !{!"Simple C/C++ TBAA"}
>  !3 = !{!"int", !1}
>  !4 = !{ i32 0, i32 1 }
>  !5 = !{ i32 8, i32 10 }
> 
> Modified:
> llvm/trunk/test/Transforms/LICM/2011-04-06-PromoteResultOfPromotion.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/2011-04-06-PromoteResultOfPromotion.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> ---
> llvm/trunk/test/Transforms/LICM/2011-04-06-PromoteResultOfPromotion.ll
> (original)
> +++
> llvm/trunk/test/Transforms/LICM/2011-04-06-PromoteResultOfPromotion.ll
> Sun Dec 11 14:07:15 2016
> @@ -32,7 +32,7 @@ for.end:
>  
>  !0 = !{!5, !5, i64 0}
>  !1 = !{!"omnipotent char", !2}
> -!2 = !{!"Simple C/C++ TBAA", null}
> +!2 = !{!"Simple C/C++ TBAA"}
>  !3 = !{!"short", !1}
>  !4 = !{!6, !6, i64 0}
>  !5 = !{!"any pointer", !1}
> 
> Modified: llvm/trunk/test/Transforms/LoopVectorize/ARM/vector_cast.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopVectorize/ARM/vector_cast.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/LoopVectorize/ARM/vector_cast.ll
> (original)
> +++ llvm/trunk/test/Transforms/LoopVectorize/ARM/vector_cast.ll Sun
> Dec 11 14:07:15 2016
> @@ -32,6 +32,6 @@ exit:
>  !6 = !{!"omnipotent char", !7, i64 0}
>  !7 = !{!"Simple C/C++ TBAA"}
>  !8 = !{!9, !5, i64 0}
> -!9 = !{!5, i64 0, !10, i64 4}
> +!9 = !{!"some struct", !5, i64 0, !10, i64 4}
>  !10 = !{!"int", !6, i64 0}
>  !11 = !{!9, !10, i64 4}
> 
> Modified:
> llvm/trunk/test/Transforms/SLPVectorizer/X86/crash_scheduling.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SLPVectorizer/X86/crash_scheduling.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/SLPVectorizer/X86/crash_scheduling.ll
> (original)
> +++ llvm/trunk/test/Transforms/SLPVectorizer/X86/crash_scheduling.ll
> Sun Dec 11 14:07:15 2016
> @@ -1,4 +1,4 @@
> -; RUN: opt < %s -basicaa -slp-vectorizer -S
> -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
> +; RUN: opt < %s -basicaa -disable-verify -slp-vectorizer -S
> -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
>  
>  target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
>  target triple = "x86_64-apple-darwin13.3.0"
> 
> Modified: llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll (original)
> +++ llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll Sun Dec 11
> 14:07:15 2016
> @@ -106,7 +106,7 @@ bb0:
>    %tmp1 = icmp eq i8 %tmp, 0
>    br i1 %tmp1, label %bb2, label %bb1
>  bb1:
> -  %tmp3 = load i8, i8* %r, align 1, !range !2, !tbaa !1, !dbg !5
> +  %tmp3 = load i8, i8* %r, align 1, !range !2, !tbaa !10, !dbg !5
>    %tmp4 = icmp eq i8 %tmp3, 1
>    br i1 %tmp4, label %bb2, label %bb3
>  bb2:
> @@ -120,7 +120,7 @@ declare i8 @test6g(i8*)
>  !llvm.dbg.cu = !{!3}
>  !llvm.module.flags = !{!8, !9}
>  
> -!0 = !{!1, !1, i64 0}
> +!0 = !{!10, !10, i64 0}
>  !1 = !{!"foo"}
>  !2 = !{i8 0, i8 2}
>  !3 = distinct !DICompileUnit(language: DW_LANG_C99, file: !7,
>  producer: "clang", isOptimized: false, runtimeVersion: 0,
>  emissionKind: FullDebug, enums: !4, globals: !4)
> @@ -130,3 +130,4 @@ declare i8 @test6g(i8*)
>  !7 = !DIFile(filename: "foo.c", directory: "/")
>  !8 = !{i32 2, !"Dwarf Version", i32 2}
>  !9 = !{i32 2, !"Debug Info Version", i32 3}
> +!10 = !{!"scalar type", !1}
> 
> Modified: llvm/trunk/test/Transforms/Util/store-first-op.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Util/store-first-op.ll?rev=289402&r1=289401&r2=289402&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/Util/store-first-op.ll (original)
> +++ llvm/trunk/test/Transforms/Util/store-first-op.ll Sun Dec 11
> 14:07:15 2016
> @@ -32,5 +32,6 @@ attributes #1 = { nounwind readnone }
>  !5 = !DICompositeType(tag: DW_TAG_class_type, scope: !4, file: !1,
>  line: 25, size: 8, align: 8)
>  !6 = !DIExpression()
>  !7 = !DILocation(line: 25, column: 8, scope: !4)
> -!8 = !{!9, !9, i64 0}
> +!8 = !{!10, !10, i64 0}
>  !9 = !{i64 0}
> +!10 = !{!"scalar type", !9}
> 
> Added: llvm/trunk/test/Verifier/tbaa.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/tbaa.ll?rev=289402&view=auto
> ==============================================================================
> --- llvm/trunk/test/Verifier/tbaa.ll (added)
> +++ llvm/trunk/test/Verifier/tbaa.ll Sun Dec 11 14:07:15 2016
> @@ -0,0 +1,109 @@
> +; RUN: not llvm-as < %s 2>&1 | FileCheck %s
> +
> +define void @f_0(i32* %ptr) {
> +; This part checks for the easy syntactic verifier rules.
> +
> +; CHECK: Struct tag metadata must have either 3 or 4 operands
> +; CHECK-NEXT:  store i32 0, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Immutability tag on struct tag metadata must be a constant
> +; CHECK-NEXT:  store i32 1, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Immutability part of the struct tag metadata must be either
> 0 or 1
> +; CHECK-NEXT:  store i32 2, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Offset must be constant integer
> +; CHECK-NEXT:  store i32 3, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Malformed struct tag metadata:  base and access-type should
> be non-null and point to Metadata nodes
> +; CHECK-NEXT:  store i32 4, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Access type node must be scalar
> +; CHECK-NEXT:  store i32 5, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Access bit-width not the same as description bit-width
> +; CHECK-NEXT:  store i32 6, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Access type node must be scalar
> +; CHECK-NEXT:  store i32 7, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +  store i32 0, i32* %ptr, !tbaa !{!3, !2, i64 40, i64 0, i64 1, i64
> 2}
> +  store i32 1, i32* %ptr, !tbaa !{!3, !2, i64 40, !"immutable"}
> +  store i32 2, i32* %ptr, !tbaa !{!3, !2, i64 40, i64 4}
> +  store i32 3, i32* %ptr, !tbaa !{!3, !2, !"40", i64 0}
> +  store i32 4, i32* %ptr, !tbaa !{!3, null, !"40", i64 0}
> +  store i32 5, i32* %ptr, !tbaa !{!3, !3, !"40", i64 0}
> +  store i32 6, i32* %ptr, !tbaa !{!3, !2, i32 40, i64 0}
> +  store i32 7, i32* %ptr, !tbaa !{!3, !12, i32 40, i64 0}
> +  ret void
> +}
> +
> +
> +define void @f_1(i32* %ptr) {
> +; This part checks for more semantic verifier rules.
> +
> +; CHECK: Cycle detected in struct path
> +; CHECK-NEXT:  store i32 0, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Offset not zero at the point of scalar access
> +; CHECK-NEXT:  store i32 1, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Offset not zero at the point of scalar access
> +; CHECK-NEXT:  store i32 2, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Could not find TBAA parent in struct type node
> +; CHECK-NEXT:  store i32 3, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Did not see access type in access path!
> +; CHECK-NEXT:  store i32 3, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Invalid parent operand in scalar TBAA node
> +; CHECK-NEXT:  store i32 4, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Invalid name operand in scalar TBAA node
> +; CHECK-NEXT:  store i32 5, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Null operands in scalar type nodes!
> +; CHECK-NEXT:  store i32 6, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Struct tag nodes must have an odd number of operands!
> +; CHECK-NEXT:!{{[0-9]+}} = !{!"bad-struct-type-0", !{{[0-9]+}}, i64
> 40, !{{[0-9]+}}}
> +
> +; CHECK: Incorrect field entry in struct type node!
> +; CHECK-NEXT:  store i32 8, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Bitwidth between the offsets and struct type entries must
> match
> +; CHECK-NEXT:  store i32 9, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +; CHECK: Offsets must be increasing!
> +; CHECK-NEXT:  store i32 10, i32* %ptr, !tbaa !{{[0-9]+}}
> +
> +  store i32 0, i32* %ptr, !tbaa !{!4, !2, i64 40}
> +  store i32 1, i32* %ptr, !tbaa !{!3, !2, i64 45}
> +  store i32 2, i32* %ptr, !tbaa !{!3, !2, i64 45}
> +  store i32 3, i32* %ptr, !tbaa !{!3, !2, i64 10}
> +  store i32 4, i32* %ptr, !tbaa !{!5, !5, i64 0}
> +  store i32 5, i32* %ptr, !tbaa !{!6, !6, i64 0}
> +  store i32 6, i32* %ptr, !tbaa !{!7, !7, i64 0}
> +  store i32 7, i32* %ptr, !tbaa !{!8, !1, i64 40}
> +  store i32 8, i32* %ptr, !tbaa !{!9, !1, i64 40}
> +  store i32 9, i32* %ptr, !tbaa !{!10, !1, i64 40}
> +  store i32 10, i32* %ptr, !tbaa !{!11, !1, i64 40}
> +  ret void
> +}
> +
> +
> +
> +!0 = !{!"root"}
> +!1 = !{!"scalar-a", !0}
> +!2 = !{!"scalar-b", !0}
> +!3 = !{!"struct-a", !2, i64 20, !1, i64 40}
> +!4 = distinct !{!"self-recursive-struct", !2, i64 20, !4, i64 40}
> +!5 = !{!"bad-scalar-0", i64 40}
> +!6 = !{i64 42, !0}
> +!7 = !{!"bad-scalar-1", null}
> +!8 = !{!"bad-struct-type-0", !1, i64 40, !1}
> +!9 = !{!"bad-struct-type-1", !1, i64 40, i64 56, !1}
> +!10 = !{!"bad-struct-type-2", !1, i64 40, !1, i32 56}
> +!11 = !{!"bad-struct-type-2", !1, i64 80, !1, i64 56}
> +!12 = !{!"bad-scalar-2", !3, i64 0}
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> 

-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory


More information about the llvm-commits mailing list