[llvm] ca2e7e5 - [IRGen] Add !annotation metadata for auto-init stores.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 16 02:42:36 PST 2020


Author: Florian Hahn
Date: 2020-11-16T10:37:02Z
New Revision: ca2e7e59994d167c74f4ecfdda682d2a826124e3

URL: https://github.com/llvm/llvm-project/commit/ca2e7e59994d167c74f4ecfdda682d2a826124e3
DIFF: https://github.com/llvm/llvm-project/commit/ca2e7e59994d167c74f4ecfdda682d2a826124e3.diff

LOG: [IRGen] Add !annotation metadata for auto-init stores.

This patch updates Clang's IRGen to add !annotation nodes with an
"auto-init" annotation to all stores for auto-initialization.

As discussed in 'RFC: Combining Annotation Metadata and Remarks'
(http://lists.llvm.org/pipermail/llvm-dev/2020-November/146393.html)
this allows using optimization remarks to track down where auto-init
code was inserted (and not removed by optimizations).

There are a few cases in the tests where !annotation gets dropped by
optimizations. Those optimizations will be updated in subsequent
patches.

This patch is based on a patch by Francis Visoiu Mistrih.

Reviewed By: thegameg, paquette

Differential Revision: https://reviews.llvm.org/D91417

Added: 
    

Modified: 
    clang/lib/CodeGen/CGBuiltin.cpp
    clang/lib/CodeGen/CGDecl.cpp
    clang/test/CodeGenCXX/auto-var-init.cpp
    clang/test/CodeGenCXX/trivial-auto-var-init-attribute.cpp
    clang/test/CodeGenCXX/trivial-auto-var-init.cpp
    llvm/include/llvm/IR/Instruction.h
    llvm/lib/IR/Metadata.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 9cc58cf9a736..e98ec3e35e37 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -78,7 +78,8 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size,
   }
   if (CGF.CGM.stopAutoInit())
     return;
-  CGF.Builder.CreateMemSet(AI, Byte, Size, AlignmentInBytes);
+  auto *I = CGF.Builder.CreateMemSet(AI, Byte, Size, AlignmentInBytes);
+  I->addAnnotationMetadata("auto-init");
 }
 
 /// getBuiltinLibFunction - Given a builtin id for a function like

diff  --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 96922e415423..478821665e45 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -911,14 +911,17 @@ static bool canEmitInitWithFewStoresAfterBZero(llvm::Constant *Init,
 /// the scalar stores that would be required.
 static void emitStoresForInitAfterBZero(CodeGenModule &CGM,
                                         llvm::Constant *Init, Address Loc,
-                                        bool isVolatile, CGBuilderTy &Builder) {
+                                        bool isVolatile, CGBuilderTy &Builder,
+                                        bool IsAutoInit) {
   assert(!Init->isNullValue() && !isa<llvm::UndefValue>(Init) &&
          "called emitStoresForInitAfterBZero for zero or undef value.");
 
   if (isa<llvm::ConstantInt>(Init) || isa<llvm::ConstantFP>(Init) ||
       isa<llvm::ConstantVector>(Init) || isa<llvm::BlockAddress>(Init) ||
       isa<llvm::ConstantExpr>(Init)) {
-    Builder.CreateStore(Init, Loc, isVolatile);
+    auto *I = Builder.CreateStore(Init, Loc, isVolatile);
+    if (IsAutoInit)
+      I->addAnnotationMetadata("auto-init");
     return;
   }
 
@@ -931,7 +934,7 @@ static void emitStoresForInitAfterBZero(CodeGenModule &CGM,
       if (!Elt->isNullValue() && !isa<llvm::UndefValue>(Elt))
         emitStoresForInitAfterBZero(
             CGM, Elt, Builder.CreateConstInBoundsGEP2_32(Loc, 0, i), isVolatile,
-            Builder);
+            Builder, IsAutoInit);
     }
     return;
   }
@@ -946,7 +949,7 @@ static void emitStoresForInitAfterBZero(CodeGenModule &CGM,
     if (!Elt->isNullValue() && !isa<llvm::UndefValue>(Elt))
       emitStoresForInitAfterBZero(CGM, Elt,
                                   Builder.CreateConstInBoundsGEP2_32(Loc, 0, i),
-                                  isVolatile, Builder);
+                                  isVolatile, Builder, IsAutoInit);
   }
 }
 
@@ -1154,7 +1157,7 @@ static Address createUnnamedGlobalForMemcpyFrom(CodeGenModule &CGM,
 static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
                                   Address Loc, bool isVolatile,
                                   CGBuilderTy &Builder,
-                                  llvm::Constant *constant) {
+                                  llvm::Constant *constant, bool IsAutoInit) {
   auto *Ty = constant->getType();
   uint64_t ConstantSize = CGM.getDataLayout().getTypeAllocSize(Ty);
   if (!ConstantSize)
@@ -1163,7 +1166,9 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
   bool canDoSingleStore = Ty->isIntOrIntVectorTy() ||
                           Ty->isPtrOrPtrVectorTy() || Ty->isFPOrFPVectorTy();
   if (canDoSingleStore) {
-    Builder.CreateStore(constant, Loc, isVolatile);
+    auto *I = Builder.CreateStore(constant, Loc, isVolatile);
+    if (IsAutoInit)
+      I->addAnnotationMetadata("auto-init");
     return;
   }
 
@@ -1172,14 +1177,17 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
   // If the initializer is all or mostly the same, codegen with bzero / memset
   // then do a few stores afterward.
   if (shouldUseBZeroPlusStoresToInitialize(constant, ConstantSize)) {
-    Builder.CreateMemSet(Loc, llvm::ConstantInt::get(CGM.Int8Ty, 0), SizeVal,
-                         isVolatile);
+    auto *I = Builder.CreateMemSet(Loc, llvm::ConstantInt::get(CGM.Int8Ty, 0),
+                                   SizeVal, isVolatile);
+    if (IsAutoInit)
+      I->addAnnotationMetadata("auto-init");
 
     bool valueAlreadyCorrect =
         constant->isNullValue() || isa<llvm::UndefValue>(constant);
     if (!valueAlreadyCorrect) {
       Loc = Builder.CreateBitCast(Loc, Ty->getPointerTo(Loc.getAddressSpace()));
-      emitStoresForInitAfterBZero(CGM, constant, Loc, isVolatile, Builder);
+      emitStoresForInitAfterBZero(CGM, constant, Loc, isVolatile, Builder,
+                                  IsAutoInit);
     }
     return;
   }
@@ -1194,8 +1202,10 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
       assert(AP.getBitWidth() <= 8);
       Value = AP.getLimitedValue();
     }
-    Builder.CreateMemSet(Loc, llvm::ConstantInt::get(CGM.Int8Ty, Value), SizeVal,
-                         isVolatile);
+    auto *I = Builder.CreateMemSet(
+        Loc, llvm::ConstantInt::get(CGM.Int8Ty, Value), SizeVal, isVolatile);
+    if (IsAutoInit)
+      I->addAnnotationMetadata("auto-init");
     return;
   }
 
@@ -1208,7 +1218,8 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
           Address EltPtr = Builder.CreateStructGEP(Loc, i);
           emitStoresForConstant(
               CGM, D, EltPtr, isVolatile, Builder,
-              cast<llvm::Constant>(Builder.CreateExtractValue(constant, i)));
+              cast<llvm::Constant>(Builder.CreateExtractValue(constant, i)),
+              IsAutoInit);
         }
         return;
       }
@@ -1219,7 +1230,8 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
           Address EltPtr = Builder.CreateConstArrayGEP(Loc, i);
           emitStoresForConstant(
               CGM, D, EltPtr, isVolatile, Builder,
-              cast<llvm::Constant>(Builder.CreateExtractValue(constant, i)));
+              cast<llvm::Constant>(Builder.CreateExtractValue(constant, i)),
+              IsAutoInit);
         }
         return;
       }
@@ -1227,10 +1239,13 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
   }
 
   // Copy from a global.
-  Builder.CreateMemCpy(Loc,
-                       createUnnamedGlobalForMemcpyFrom(
-                           CGM, D, Builder, constant, Loc.getAlignment()),
-                       SizeVal, isVolatile);
+  auto *I =
+      Builder.CreateMemCpy(Loc,
+                           createUnnamedGlobalForMemcpyFrom(
+                               CGM, D, Builder, constant, Loc.getAlignment()),
+                           SizeVal, isVolatile);
+  if (IsAutoInit)
+    I->addAnnotationMetadata("auto-init");
 }
 
 static void emitStoresForZeroInit(CodeGenModule &CGM, const VarDecl &D,
@@ -1239,7 +1254,8 @@ static void emitStoresForZeroInit(CodeGenModule &CGM, const VarDecl &D,
   llvm::Type *ElTy = Loc.getElementType();
   llvm::Constant *constant =
       constWithPadding(CGM, IsPattern::No, llvm::Constant::getNullValue(ElTy));
-  emitStoresForConstant(CGM, D, Loc, isVolatile, Builder, constant);
+  emitStoresForConstant(CGM, D, Loc, isVolatile, Builder, constant,
+                        /*IsAutoInit=*/true);
 }
 
 static void emitStoresForPatternInit(CodeGenModule &CGM, const VarDecl &D,
@@ -1249,7 +1265,8 @@ static void emitStoresForPatternInit(CodeGenModule &CGM, const VarDecl &D,
   llvm::Constant *constant = constWithPadding(
       CGM, IsPattern::Yes, initializationPatternFor(CGM, ElTy));
   assert(!isa<llvm::UndefValue>(constant));
-  emitStoresForConstant(CGM, D, Loc, isVolatile, Builder, constant);
+  emitStoresForConstant(CGM, D, Loc, isVolatile, Builder, constant,
+                        /*IsAutoInit=*/true);
 }
 
 static bool containsUndef(llvm::Constant *constant) {
@@ -1718,14 +1735,16 @@ void CodeGenFunction::emitZeroOrPatternForAutoVarInit(QualType type,
   case LangOptions::TrivialAutoVarInitKind::Uninitialized:
     llvm_unreachable("Uninitialized handled by caller");
 
-  case LangOptions::TrivialAutoVarInitKind::Zero:
+  case LangOptions::TrivialAutoVarInitKind::Zero: {
     if (CGM.stopAutoInit())
       return;
     if (!EltSize.isOne())
       SizeVal = Builder.CreateNUWMul(SizeVal, CGM.getSize(EltSize));
-    Builder.CreateMemSet(Loc, llvm::ConstantInt::get(Int8Ty, 0), SizeVal,
-                         isVolatile);
+    auto *I = Builder.CreateMemSet(Loc, llvm::ConstantInt::get(Int8Ty, 0),
+                                   SizeVal, isVolatile);
+    I->addAnnotationMetadata("auto-init");
     break;
+  }
 
   case LangOptions::TrivialAutoVarInitKind::Pattern: {
     if (CGM.stopAutoInit())
@@ -1754,10 +1773,12 @@ void CodeGenFunction::emitZeroOrPatternForAutoVarInit(QualType type,
     llvm::PHINode *Cur = Builder.CreatePHI(Begin.getType(), 2, "vla.cur");
     Cur->addIncoming(Begin.getPointer(), OriginBB);
     CharUnits CurAlign = Loc.getAlignment().alignmentOfArrayElement(EltSize);
-    Builder.CreateMemCpy(Address(Cur, CurAlign),
-                         createUnnamedGlobalForMemcpyFrom(
-                             CGM, D, Builder, Constant, ConstantAlign),
-                         BaseSizeInChars, isVolatile);
+    auto *I =
+        Builder.CreateMemCpy(Address(Cur, CurAlign),
+                             createUnnamedGlobalForMemcpyFrom(
+                                 CGM, D, Builder, Constant, ConstantAlign),
+                             BaseSizeInChars, isVolatile);
+    I->addAnnotationMetadata("auto-init");
     llvm::Value *Next =
         Builder.CreateInBoundsGEP(Int8Ty, Cur, BaseSizeInChars, "vla.next");
     llvm::Value *Done = Builder.CreateICmpEQ(Next, End, "vla-init.isdone");
@@ -1878,7 +1899,7 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) {
   llvm::Type *BP = CGM.Int8Ty->getPointerTo(Loc.getAddressSpace());
   emitStoresForConstant(
       CGM, D, (Loc.getType() == BP) ? Loc : Builder.CreateBitCast(Loc, BP),
-      type.isVolatileQualified(), Builder, constant);
+      type.isVolatileQualified(), Builder, constant, /*IsAutoInit=*/false);
 }
 
 /// Emit an expression as an initializer for an object (variable, field, etc.)

diff  --git a/clang/test/CodeGenCXX/auto-var-init.cpp b/clang/test/CodeGenCXX/auto-var-init.cpp
index 773d70a0f456..d50967c40216 100644
--- a/clang/test/CodeGenCXX/auto-var-init.cpp
+++ b/clang/test/CodeGenCXX/auto-var-init.cpp
@@ -243,9 +243,9 @@ TEST_UNINIT(char, char);
 // CHECK:       %uninit = alloca i8, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_char_uninit()
-// PATTERN: store i8 [[I8]], i8* %uninit, align 1
+// PATTERN: store i8 [[I8]], i8* %uninit, align 1, !annotation [[AUTO_INIT:!.+]]
 // ZERO-LABEL: @test_char_uninit()
-// ZERO: store i8 0, i8* %uninit, align 1
+// ZERO: store i8 0, i8* %uninit, align 1, !annotation [[AUTO_INIT:!.+]]
 
 TEST_BRACES(char, char);
 // CHECK-LABEL: @test_char_braces()
@@ -258,9 +258,9 @@ TEST_UNINIT(uchar, unsigned char);
 // CHECK:       %uninit = alloca i8, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_uchar_uninit()
-// PATTERN: store i8 [[I8]], i8* %uninit, align 1
+// PATTERN: store i8 [[I8]], i8* %uninit, align 1, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_uchar_uninit()
-// ZERO: store i8 0, i8* %uninit, align 1
+// ZERO: store i8 0, i8* %uninit, align 1, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(uchar, unsigned char);
 // CHECK-LABEL: @test_uchar_braces()
@@ -273,14 +273,15 @@ TEST_UNINIT(schar, signed char);
 // CHECK:       %uninit = alloca i8, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_schar_uninit()
-// PATTERN: store i8 [[I8]], i8* %uninit, align 1
+// PATTERN: store i8 [[I8]], i8* %uninit, align 1, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_schar_uninit()
-// ZERO: store i8 0, i8* %uninit, align 1
+// ZERO: store i8 0, i8* %uninit, align 1, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(schar, signed char);
 // CHECK-LABEL: @test_schar_braces()
 // CHECK:       %braces = alloca i8, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i8 0, i8* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(wchar_t, wchar_t);
@@ -288,14 +289,15 @@ TEST_UNINIT(wchar_t, wchar_t);
 // CHECK:       %uninit = alloca i32, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_wchar_t_uninit()
-// PATTERN: store i32 [[I32]], i32* %uninit, align
+// PATTERN: store i32 [[I32]], i32* %uninit, align 4, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_wchar_t_uninit()
-// ZERO: store i32 0, i32* %uninit, align
+// ZERO: store i32 0, i32* %uninit, align 4, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(wchar_t, wchar_t);
 // CHECK-LABEL: @test_wchar_t_braces()
 // CHECK:       %braces = alloca i32, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i32 0, i32* %braces, align [[ALIGN]]
+//  CHECK-NOT:  !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(short, short);
@@ -303,14 +305,15 @@ TEST_UNINIT(short, short);
 // CHECK:       %uninit = alloca i16, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_short_uninit()
-// PATTERN: store i16 [[I16]], i16* %uninit, align
+// PATTERN: store i16 [[I16]], i16* %uninit, align 2, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_short_uninit()
-// ZERO: store i16 0, i16* %uninit, align
+// ZERO: store i16 0, i16* %uninit, align 2, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(short, short);
 // CHECK-LABEL: @test_short_braces()
 // CHECK:       %braces = alloca i16, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i16 0, i16* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(ushort, unsigned short);
@@ -318,14 +321,15 @@ TEST_UNINIT(ushort, unsigned short);
 // CHECK:       %uninit = alloca i16, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_ushort_uninit()
-// PATTERN: store i16 [[I16]], i16* %uninit, align
+// PATTERN: store i16 [[I16]], i16* %uninit, align 2, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_ushort_uninit()
-// ZERO: store i16 0, i16* %uninit, align
+// ZERO: store i16 0, i16* %uninit, align 2, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(ushort, unsigned short);
 // CHECK-LABEL: @test_ushort_braces()
 // CHECK:       %braces = alloca i16, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i16 0, i16* %braces, align [[ALIGN]]
+//CHECK-NOT:    !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(int, int);
@@ -333,14 +337,15 @@ TEST_UNINIT(int, int);
 // CHECK:       %uninit = alloca i32, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_int_uninit()
-// PATTERN: store i32 [[I32]], i32* %uninit, align
+// PATTERN: store i32 [[I32]], i32* %uninit, align 4, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_int_uninit()
-// ZERO: store i32 0, i32* %uninit, align
+// ZERO: store i32 0, i32* %uninit, align 4, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(int, int);
 // CHECK-LABEL: @test_int_braces()
 // CHECK:       %braces = alloca i32, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i32 0, i32* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(unsigned, unsigned);
@@ -348,14 +353,15 @@ TEST_UNINIT(unsigned, unsigned);
 // CHECK:       %uninit = alloca i32, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_unsigned_uninit()
-// PATTERN: store i32 [[I32]], i32* %uninit, align
+// PATTERN: store i32 [[I32]], i32* %uninit, align 4, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_unsigned_uninit()
-// ZERO: store i32 0, i32* %uninit, align
+// ZERO: store i32 0, i32* %uninit, align 4, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(unsigned, unsigned);
 // CHECK-LABEL: @test_unsigned_braces()
 // CHECK:       %braces = alloca i32, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i32 0, i32* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(long, long);
@@ -363,14 +369,15 @@ TEST_UNINIT(long, long);
 // CHECK:       %uninit = alloca i64, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_long_uninit()
-// PATTERN: store [[ILONGT]] [[ILONG]], [[ILONGT]]* %uninit, align
+// PATTERN: store [[ILONGT]] [[ILONG]], [[ILONGT]]* %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_long_uninit()
-// ZERO: store i64 0, i64* %uninit, align
+// ZERO: store i64 0, i64* %uninit, align 8, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(long, long);
 // CHECK-LABEL: @test_long_braces()
 // CHECK:       %braces = alloca i64, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i64 0, i64* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(ulong, unsigned long);
@@ -378,14 +385,15 @@ TEST_UNINIT(ulong, unsigned long);
 // CHECK:       %uninit = alloca i64, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_ulong_uninit()
-// PATTERN: store [[ILONGT]] [[ILONG]], [[ILONGT]]* %uninit, align
+// PATTERN: store [[ILONGT]] [[ILONG]], [[ILONGT]]* %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_ulong_uninit()
-// ZERO: store i64 0, i64* %uninit, align
+// ZERO: store i64 0, i64* %uninit, align 8, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(ulong, unsigned long);
 // CHECK-LABEL: @test_ulong_braces()
 // CHECK:       %braces = alloca i64, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i64 0, i64* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(longlong, long long);
@@ -393,14 +401,15 @@ TEST_UNINIT(longlong, long long);
 // CHECK:       %uninit = alloca i64, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_longlong_uninit()
-// PATTERN: store i64 [[I64]], i64* %uninit, align
+// PATTERN: store i64 [[I64]], i64* %uninit, align 8, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_longlong_uninit()
-// ZERO: store i64 0, i64* %uninit, align
+// ZERO: store i64 0, i64* %uninit, align 8, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(longlong, long long);
 // CHECK-LABEL: @test_longlong_braces()
 // CHECK:       %braces = alloca i64, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i64 0, i64* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(ulonglong, unsigned long long);
@@ -408,14 +417,15 @@ TEST_UNINIT(ulonglong, unsigned long long);
 // CHECK:       %uninit = alloca i64, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_ulonglong_uninit()
-// PATTERN: store i64 [[I64]], i64* %uninit, align
+// PATTERN: store i64 [[I64]], i64* %uninit, align 8, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_ulonglong_uninit()
-// ZERO: store i64 0, i64* %uninit, align
+// ZERO: store i64 0, i64* %uninit, align 8, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(ulonglong, unsigned long long);
 // CHECK-LABEL: @test_ulonglong_braces()
 // CHECK:       %braces = alloca i64, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i64 0, i64* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(int128, __int128);
@@ -423,14 +433,15 @@ TEST_UNINIT(int128, __int128);
 // CHECK:       %uninit = alloca i128, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_int128_uninit()
-// PATTERN: store [[I128T]] [[I128]], [[I128T]]* %uninit, align
+// PATTERN: store [[I128T]] [[I128]], [[I128T]]* %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_int128_uninit()
-// ZERO: store i128 0, i128* %uninit, align
+// ZERO: store i128 0, i128* %uninit, align 16, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(int128, __int128);
 // CHECK-LABEL: @test_int128_braces()
 // CHECK:       %braces = alloca i128, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i128 0, i128* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(uint128, unsigned __int128);
@@ -438,14 +449,15 @@ TEST_UNINIT(uint128, unsigned __int128);
 // CHECK:       %uninit = alloca i128, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_uint128_uninit()
-// PATTERN: store [[I128T]] [[I128]], [[I128T]]* %uninit, align
+// PATTERN: store [[I128T]] [[I128]], [[I128T]]* %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_uint128_uninit()
-// ZERO: store i128 0, i128* %uninit, align
+// ZERO: store i128 0, i128* %uninit, align 16, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(uint128, unsigned __int128);
 // CHECK-LABEL: @test_uint128_braces()
 // CHECK:       %braces = alloca i128, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i128 0, i128* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(fp16, __fp16);
@@ -453,14 +465,15 @@ TEST_UNINIT(fp16, __fp16);
 // CHECK:       %uninit = alloca half, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_fp16_uninit()
-// PATTERN: store half 0xHFFFF, half* %uninit, align
+// PATTERN: store half 0xHFFFF, half* %uninit, align 2, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_fp16_uninit()
-// ZERO: store half 0xH0000, half* %uninit, align
+// ZERO: store half 0xH0000, half* %uninit, align 2, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(fp16, __fp16);
 // CHECK-LABEL: @test_fp16_braces()
 // CHECK:       %braces = alloca half, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store half 0xH0000, half* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(float, float);
@@ -468,14 +481,15 @@ TEST_UNINIT(float, float);
 // CHECK:       %uninit = alloca float, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_float_uninit()
-// PATTERN: store float 0xFFFFFFFFE0000000, float* %uninit, align
+// PATTERN: store float 0xFFFFFFFFE0000000, float* %uninit, align 4, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_float_uninit()
-// ZERO: store float 0.000000e+00, float* %uninit, align
+// ZERO: store float 0.000000e+00, float* %uninit, align 4, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(float, float);
 // CHECK-LABEL: @test_float_braces()
 // CHECK:       %braces = alloca float, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store float 0.000000e+00, float* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(double, double);
@@ -483,14 +497,15 @@ TEST_UNINIT(double, double);
 // CHECK:       %uninit = alloca double, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_double_uninit()
-// PATTERN: store double 0xFFFFFFFFFFFFFFFF, double* %uninit, align
+// PATTERN: store double 0xFFFFFFFFFFFFFFFF, double* %uninit, align 8, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_double_uninit()
-// ZERO: store double 0.000000e+00, double* %uninit, align
+// ZERO: store double 0.000000e+00, double* %uninit, align 8, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(double, double);
 // CHECK-LABEL: @test_double_braces()
 // CHECK:       %braces = alloca double, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store double 0.000000e+00, double* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(longdouble, long double);
@@ -498,30 +513,31 @@ TEST_UNINIT(longdouble, long double);
 // CHECK:       %uninit = alloca x86_fp80, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_longdouble_uninit()
-// PATTERN: store x86_fp80 0xKFFFFFFFFFFFFFFFFFFFF, x86_fp80* %uninit, align
+// PATTERN: store x86_fp80 0xKFFFFFFFFFFFFFFFFFFFF, x86_fp80* %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_longdouble_uninit()
-// ZERO: store x86_fp80 0xK00000000000000000000, x86_fp80* %uninit, align
+// ZERO: store x86_fp80 0xK00000000000000000000, x86_fp80* %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(longdouble, long double);
 // CHECK-LABEL: @test_longdouble_braces()
 // CHECK:       %braces = alloca x86_fp80, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store x86_fp80 0xK00000000000000000000, x86_fp80* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
-
 TEST_UNINIT(intptr, int*);
 // CHECK-LABEL: @test_intptr_uninit()
 // CHECK:       %uninit = alloca i32*, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_intptr_uninit()
-// PATTERN: store i32* inttoptr ([[IPTRT]] [[IPTR]] to i32*), i32** %uninit, align
+// PATTERN: store i32* inttoptr ([[IPTRT]] [[IPTR]] to i32*), i32** %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_intptr_uninit()
-// ZERO: store i32* null, i32** %uninit, align
+// ZERO: store i32* null, i32** %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(intptr, int*);
 // CHECK-LABEL: @test_intptr_braces()
 // CHECK:       %braces = alloca i32*, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i32* null, i32** %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(intptrptr, int**);
@@ -529,14 +545,15 @@ TEST_UNINIT(intptrptr, int**);
 // CHECK:       %uninit = alloca i32**, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_intptrptr_uninit()
-// PATTERN: store i32** inttoptr ([[IPTRT]] [[IPTR]] to i32**), i32*** %uninit, align
+// PATTERN: store i32** inttoptr ([[IPTRT]] [[IPTR]] to i32**), i32*** %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_intptrptr_uninit()
-// ZERO: store i32** null, i32*** %uninit, align
+// ZERO: store i32** null, i32*** %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(intptrptr, int**);
 // CHECK-LABEL: @test_intptrptr_braces()
 // CHECK:       %braces = alloca i32**, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i32** null, i32*** %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(function, void(*)());
@@ -544,14 +561,15 @@ TEST_UNINIT(function, void(*)());
 // CHECK:       %uninit = alloca void ()*, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_function_uninit()
-// PATTERN: store void ()* inttoptr ([[IPTRT]] [[IPTR]] to void ()*), void ()** %uninit, align
+// PATTERN: store void ()* inttoptr ([[IPTRT]] [[IPTR]] to void ()*), void ()** %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_function_uninit()
-// ZERO: store void ()* null, void ()** %uninit, align
+// ZERO: store void ()* null, void ()** %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(function, void(*)());
 // CHECK-LABEL: @test_function_braces()
 // CHECK:       %braces = alloca void ()*, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store void ()* null, void ()** %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(bool, bool);
@@ -559,33 +577,36 @@ TEST_UNINIT(bool, bool);
 // CHECK:       %uninit = alloca i8, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_bool_uninit()
-// PATTERN: store i8 [[I8]], i8* %uninit, align 1
+// PATTERN: store i8 [[I8]], i8* %uninit, align 1, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_bool_uninit()
-// ZERO: store i8 0, i8* %uninit, align 1
+// ZERO: store i8 0, i8* %uninit, align 1, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(bool, bool);
 // CHECK-LABEL: @test_bool_braces()
 // CHECK:       %braces = alloca i8, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i8 0, i8* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
-
 TEST_UNINIT(empty, empty);
 // CHECK-LABEL: @test_empty_uninit()
 // CHECK:       %uninit = alloca %struct.empty, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_empty_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_empty_uninit.uninit
-// PATTERN-O1: store i8 [[I8]], {{.*}} align 1
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_empty_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
+// PATTERN-O1: store i8 [[I8]], {{.*}} align 1, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_empty_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1: store i8 0, {{.*}} align 1
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(empty, empty);
 // CHECK-LABEL: @test_empty_braces()
 // CHECK:       %braces = alloca %struct.empty, align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(small, small);
@@ -593,17 +614,20 @@ TEST_UNINIT(small, small);
 // CHECK:       %uninit = alloca %struct.small, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_small_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_small_uninit.uninit
-// PATTERN-O1: store i8 [[I8]], {{.*}} align 1
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_small_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
+// PATTERN-O1: store i8 [[I8]], {{.*}} align 1, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_small_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1: store i8 0, {{.*}} align 1
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(small, small);
 // CHECK-LABEL: @test_small_braces()
 // CHECK:       %braces = alloca %struct.small, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 1, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(small, small, { 42 });
@@ -611,6 +635,7 @@ TEST_CUSTOM(small, small, { 42 });
 // CHECK:       %custom = alloca %struct.small, align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(smallinit, smallinit);
@@ -624,6 +649,7 @@ TEST_BRACES(smallinit, smallinit);
 // CHECK:       %braces = alloca %struct.smallinit, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  %[[C:[^ ]*]] = getelementptr inbounds %struct.smallinit, %struct.smallinit* %braces, i32 0, i32 0
 // CHECK-NEXT:  store i8 42, i8* %[[C]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(smallinit, smallinit, { 100 });
@@ -631,6 +657,7 @@ TEST_CUSTOM(smallinit, smallinit, { 100 });
 // CHECK:       %custom = alloca %struct.smallinit, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  %[[C:[^ ]*]] = getelementptr inbounds %struct.smallinit, %struct.smallinit* %custom, i32 0, i32 0
 // CHECK-NEXT:  store i8 100, i8* %[[C]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(smallpartinit, smallpartinit);
@@ -639,21 +666,25 @@ TEST_UNINIT(smallpartinit, smallpartinit);
 // CHECK-NEXT:  call void @{{.*}}smallpartinit{{.*}}%uninit)
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_smallpartinit_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_smallpartinit_uninit.uninit
-// PATTERN-O1: store i8 [[I8]], {{.*}} align 1
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_smallpartinit_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
+// PATTERN-O1: store i8 [[I8]], {{.*}} align 1, !annotation [[AUTO_INIT]]
 // PATTERN-O1: store i8 42, {{.*}} align 1
 // ZERO-LABEL: @test_smallpartinit_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1-LEGACY: store i16 0, i16* %uninit, align 2
 // ZERO-O1-NEWPM: store i16 0, i16* %uninit, align 2
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(smallpartinit, smallpartinit);
 // CHECK-LABEL: @test_smallpartinit_braces()
 // CHECK:       %braces = alloca %struct.smallpartinit, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  %[[C:[^ ]*]] = getelementptr inbounds %struct.smallpartinit, %struct.smallpartinit* %braces, i32 0, i32 0
 // CHECK-NEXT:  store i8 42, i8* %[[C]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  %[[D:[^ ]*]] = getelementptr inbounds %struct.smallpartinit, %struct.smallpartinit* %braces, i32 0, i32 1
 // CHECK-NEXT:  store i8 0, i8* %[[D]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(smallpartinit, smallpartinit, { 100, 42 });
@@ -661,8 +692,10 @@ TEST_CUSTOM(smallpartinit, smallpartinit, { 100, 42 });
 // CHECK:       %custom = alloca %struct.smallpartinit, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  %[[C:[^ ]*]] = getelementptr inbounds %struct.smallpartinit, %struct.smallpartinit* %custom, i32 0, i32 0
 // CHECK-NEXT:  store i8 100, i8* %[[C]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  %[[D:[^ ]*]] = getelementptr inbounds %struct.smallpartinit, %struct.smallpartinit* %custom, i32 0, i32 1
 // CHECK-NEXT:  store i8 42, i8* %[[D]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(nullinit, nullinit);
@@ -676,6 +709,7 @@ TEST_BRACES(nullinit, nullinit);
 // CHECK:       %braces = alloca %struct.nullinit, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  %[[N:[^ ]*]] = getelementptr inbounds %struct.nullinit, %struct.nullinit* %braces, i32 0, i32 0
 // CHECK-NEXT:  store i8* null, i8** %[[N]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(nullinit, nullinit, { (char*)"derp" });
@@ -683,6 +717,7 @@ TEST_CUSTOM(nullinit, nullinit, { (char*)"derp" });
 // CHECK:       %custom = alloca %struct.nullinit, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  %[[N:[^ ]*]] = getelementptr inbounds %struct.nullinit, %struct.nullinit* %custom, i32 0, i32 0
 // CHECK-NEXT:  store i8* getelementptr inbounds {{.*}}, i8** %[[N]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(padded, padded);
@@ -690,17 +725,22 @@ TEST_UNINIT(padded, padded);
 // CHECK:       %uninit = alloca %struct.padded, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_padded_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_padded_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_padded_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // PATTERN-O1: store i64 [[I64]], i64* %uninit, align 8
+// FIXME: !annotation dropped by optimizations
+// PATTERN-O1-NOT: !annotation
 // ZERO-LABEL: @test_padded_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}})
 // ZERO-O1: store i64 0, i64* %uninit, align 8
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(padded, padded);
 // CHECK-LABEL: @test_padded_braces()
 // CHECK:       %braces = alloca %struct.padded, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(padded, padded, { 42, 13371337 });
@@ -708,6 +748,7 @@ TEST_CUSTOM(padded, padded, { 42, 13371337 });
 // CHECK:       %custom = alloca %struct.padded, align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(paddednullinit, paddednullinit);
@@ -716,20 +757,26 @@ TEST_UNINIT(paddednullinit, paddednullinit);
 // CHECK-NEXT:  call void @{{.*}}paddednullinit{{.*}}%uninit)
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_paddednullinit_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddednullinit_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddednullinit_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // PATTERN-O1-LEGACY: store i64 [[I64]], i64* %uninit, align 8
 // PATTERN-O1-NEWPM: store i64 [[I64]], i64* %uninit, align 8
+// FIXME: !annotation dropped by optimizations
+// PATTERN-O1-NOT: !annotation
 // ZERO-LABEL: @test_paddednullinit_uninit()
 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
 // ZERO-O1: store i64 0, i64* %uninit, align 8
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(paddednullinit, paddednullinit);
 // CHECK-LABEL: @test_paddednullinit_braces()
 // CHECK:       %braces = alloca %struct.paddednullinit, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  %[[C:[^ ]*]] = getelementptr inbounds %struct.paddednullinit, %struct.paddednullinit* %braces, i32 0, i32 0
 // CHECK-NEXT:  store i8 0, i8* %[[C]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  %[[I:[^ ]*]] = getelementptr inbounds %struct.paddednullinit, %struct.paddednullinit* %braces, i32 0, i32 1
 // CHECK-NEXT:  store i32 0, i32* %[[I]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(paddednullinit, paddednullinit, { 42, 13371337 });
@@ -737,8 +784,10 @@ TEST_CUSTOM(paddednullinit, paddednullinit, { 42, 13371337 });
 // CHECK:       %custom = alloca %struct.paddednullinit, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  %[[C:[^ ]*]] = getelementptr inbounds %struct.paddednullinit, %struct.paddednullinit* %custom, i32 0, i32 0
 // CHECK-NEXT:  store i8 42, i8* %[[C]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  %[[I:[^ ]*]] = getelementptr inbounds %struct.paddednullinit, %struct.paddednullinit* %custom, i32 0, i32 1
 // CHECK-NEXT:  store i32 13371337, i32* %[[I]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(paddedpacked, paddedpacked);
@@ -746,20 +795,21 @@ TEST_UNINIT(paddedpacked, paddedpacked);
 // CHECK:       %uninit = alloca %struct.paddedpacked, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_paddedpacked_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddedpacked_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddedpacked_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // PATTERN-O1:  %[[C:[^ ]*]] = getelementptr inbounds {{.*}}%uninit, i64 0, i32 0
-// PATTERN-O1:  store i8 [[I8]], i8* %[[C]], align
+// PATTERN-O1:  store i8 [[I8]], i8* %[[C]], align {{.+}}, !annotation [[AUTO_INIT]]
 // PATTERN-O1:  %[[I:[^ ]*]] = getelementptr inbounds {{.*}}%uninit, i64 0, i32 1
-// PATTERN-O1: store i32 [[I32]], i32* %[[I]], align
+// PATTERN-O1: store i32 [[I32]], i32* %[[I]], align {{.+}}, !annotation [[AUTO_INIT]]
 
 // ZERO-LABEL: @test_paddedpacked_uninit()
-// ZERO: call void @llvm.memset{{.*}}, i8 0,
+// ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 
 TEST_BRACES(paddedpacked, paddedpacked);
 // CHECK-LABEL: @test_paddedpacked_braces()
 // CHECK:       %braces = alloca %struct.paddedpacked, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 5, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(paddedpacked, paddedpacked, { 42, 13371337 });
@@ -767,6 +817,7 @@ TEST_CUSTOM(paddedpacked, paddedpacked, { 42, 13371337 });
 // CHECK:       %custom = alloca %struct.paddedpacked, align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy{{.*}}({{.*}}@__const.test_paddedpacked_custom.custom
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(paddedpackedarray, paddedpackedarray);
@@ -774,17 +825,20 @@ TEST_UNINIT(paddedpackedarray, paddedpackedarray);
 // CHECK:       %uninit = alloca %struct.paddedpackedarray, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_paddedpackedarray_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddedpackedarray_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddedpackedarray_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // PATTERN-O1: getelementptr
 // PATTERN-O1: call void @llvm.memset{{.*}}({{.*}}i8 [[I8]], i64 10
+// FIXME: !annotation dropped by optimizations
+// PATTERN-O1-NOT: !annotation
 // ZERO-LABEL: @test_paddedpackedarray_uninit()
-// ZERO: call void @llvm.memset{{.*}}, i8 0,
+// ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 
 TEST_BRACES(paddedpackedarray, paddedpackedarray);
 // CHECK-LABEL: @test_paddedpackedarray_braces()
 // CHECK:       %braces = alloca %struct.paddedpackedarray, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 10, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(paddedpackedarray, paddedpackedarray, { {{ 42, 13371337 }, { 43, 13371338 }} });
@@ -792,28 +846,32 @@ TEST_CUSTOM(paddedpackedarray, paddedpackedarray, { {{ 42, 13371337 }, { 43, 133
 // CHECK:       %custom = alloca %struct.paddedpackedarray, align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy{{.*}}({{.*}}@__const.test_paddedpackedarray_custom.custom
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(unpackedinpacked, unpackedinpacked);
 // PATTERN-LABEL: @test_unpackedinpacked_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} 9, i1 false)
+// PATTERN-O0: call void @llvm.memcpy{{.*}} 9, i1 false), !annotation [[AUTO_INIT]]
 
 TEST_UNINIT(paddednested, paddednested);
 // CHECK-LABEL: @test_paddednested_uninit()
 // CHECK:       %uninit = alloca %struct.paddednested, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_paddednested_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddednested_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddednested_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // PATTERN-O1: getelementptr
-// PATTERN-O1: call void @llvm.memset{{.*}}({{.*}}, i8 [[I8]], i64 16
+// PATTERN-O1: call void @llvm.memset{{.*}}({{.*}}, i8 [[I8]], i64 16{{.+}})
+// FIXME: !annotation dropped by optimizations
+// PATTERN-O1-NOT: !annotation
 // ZERO-LABEL: @test_paddednested_uninit()
-// ZERO: call void @llvm.memset{{.*}}, i8 0,
+// ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 
 TEST_BRACES(paddednested, paddednested);
 // CHECK-LABEL: @test_paddednested_braces()
 // CHECK:       %braces = alloca %struct.paddednested, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 16, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(paddednested, paddednested, { { 42, 13371337 }, { 43, 13371338 } });
@@ -821,6 +879,7 @@ TEST_CUSTOM(paddednested, paddednested, { { 42, 13371337 }, { 43, 13371338 } });
 // CHECK:       %custom = alloca %struct.paddednested, align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy{{.*}}({{.*}}@__const.test_paddednested_custom.custom
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(paddedpackednested, paddedpackednested);
@@ -828,17 +887,20 @@ TEST_UNINIT(paddedpackednested, paddedpackednested);
 // CHECK:       %uninit = alloca %struct.paddedpackednested, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_paddedpackednested_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddedpackednested_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddedpackednested_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // PATTERN-O1: getelementptr
-// PATTERN-O1: call void @llvm.memset.p0i8.i64(i8* nonnull align 1 dereferenceable(10) %0, i8 [[I8]], i64 10, i1 false
+// PATTERN-O1: call void @llvm.memset.p0i8.i64(i8* nonnull align 1 dereferenceable(10) %0, i8 [[I8]], i64 10, i1 false)
+// FIXME: !annotation dropped by optimizations
+// PATTERN-O1-NOT: !annotation
 // ZERO-LABEL: @test_paddedpackednested_uninit()
-// ZERO: call void @llvm.memset{{.*}}, i8 0,
+// ZERO: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
 
 TEST_BRACES(paddedpackednested, paddedpackednested);
 // CHECK-LABEL: @test_paddedpackednested_braces()
 // CHECK:       %braces = alloca %struct.paddedpackednested, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 10, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(paddedpackednested, paddedpackednested, { { 42, 13371337 }, { 43, 13371338 } });
@@ -846,6 +908,7 @@ TEST_CUSTOM(paddedpackednested, paddedpackednested, { { 42, 13371337 }, { 43, 13
 // CHECK:       %custom = alloca %struct.paddedpackednested, align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy{{.*}}({{.*}}@__const.test_paddedpackednested_custom.custom
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(bitfield, bitfield);
@@ -853,17 +916,22 @@ TEST_UNINIT(bitfield, bitfield);
 // CHECK:       %uninit = alloca %struct.bitfield, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_bitfield_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_bitfield_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_bitfield_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // PATTERN-O1: store i32 [[I32]], i32* %uninit, align 4
+// FIXME: !annotation dropped by optimizations
+// PATTERN-O1-NOT: !annotation
 // ZERO-LABEL: @test_bitfield_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1: store i32 0, i32* %uninit, align 4
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(bitfield, bitfield);
 // CHECK-LABEL: @test_bitfield_braces()
 // CHECK:       %braces = alloca %struct.bitfield, align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(bitfield, bitfield, { 4, 1 });
@@ -871,6 +939,7 @@ TEST_CUSTOM(bitfield, bitfield, { 4, 1 });
 // CHECK:       %custom = alloca %struct.bitfield, align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(bitfieldaligned, bitfieldaligned);
@@ -878,17 +947,22 @@ TEST_UNINIT(bitfieldaligned, bitfieldaligned);
 // CHECK:       %uninit = alloca %struct.bitfieldaligned, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_bitfieldaligned_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_bitfieldaligned_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_bitfieldaligned_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // PATTERN-O1: store i64 [[IPTR]], i64* %uninit, align 8
+// FIXME: !annotation dropped by optimizations
+// PATTERN-O1-NOT: !annotation
 // ZERO-LABEL: @test_bitfieldaligned_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1: store i64 0, i64* %uninit, align 8
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(bitfieldaligned, bitfieldaligned);
 // CHECK-LABEL: @test_bitfieldaligned_braces()
 // CHECK:       %braces = alloca %struct.bitfieldaligned, align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(bitfieldaligned, bitfieldaligned, { 4, 1  });
@@ -896,6 +970,7 @@ TEST_CUSTOM(bitfieldaligned, bitfieldaligned, { 4, 1  });
 // CHECK:       %custom = alloca %struct.bitfieldaligned, align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(big, big);
@@ -903,15 +978,16 @@ TEST_UNINIT(big, big);
 // CHECK:       %uninit = alloca %struct.big, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_big_uninit()
-// PATTERN: call void @llvm.memset{{.*}}, i8 [[I8]],
+// PATTERN: call void @llvm.memset{{.*}}, i8 [[I8]],{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_big_uninit()
-// ZERO: call void @llvm.memset{{.*}}, i8 0,
+// ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 
 TEST_BRACES(big, big);
 // CHECK-LABEL: @test_big_braces()
 // CHECK:       %braces = alloca %struct.big, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 104, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(big, big, { 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA });
@@ -919,6 +995,7 @@ TEST_CUSTOM(big, big, { 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAA
 // CHECK:       %custom = alloca %struct.big, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 -86, i64 104, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(arraytail, arraytail);
@@ -926,17 +1003,20 @@ TEST_UNINIT(arraytail, arraytail);
 // CHECK:       %uninit = alloca %struct.arraytail, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_arraytail_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_arraytail_uninit.uninit
-// PATTERN-O1: store i32 [[I32]], {{.*}} align 4
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_arraytail_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
+// PATTERN-O1: store i32 [[I32]], {{.*}} align 4, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_arraytail_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1: store i32 0, {{.*}} align 4
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(arraytail, arraytail);
 // CHECK-LABEL: @test_arraytail_braces()
 // CHECK:       %braces = alloca %struct.arraytail, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(arraytail, arraytail, { 0xdead });
@@ -944,9 +1024,9 @@ TEST_CUSTOM(arraytail, arraytail, { 0xdead });
 // CHECK:       %custom = alloca %struct.arraytail, align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
-
 TEST_UNINIT(int0, int[0]);
 // CHECK-LABEL: @test_int0_uninit()
 // CHECK:       %uninit = alloca [0 x i32], align
@@ -969,17 +1049,20 @@ TEST_UNINIT(int1, int[1]);
 // CHECK:       %uninit = alloca [1 x i32], align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_int1_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_int1_uninit.uninit
-// PATTERN-O1: store i32 [[I32]], {{.*}} align 4
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_int1_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
+// PATTERN-O1: store i32 [[I32]], {{.*}} align 4, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_int1_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1: store i32 0, {{.*}} align 4
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(int1, int[1]);
 // CHECK-LABEL: @test_int1_braces()
 // CHECK:       %braces = alloca [1 x i32], align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(int1, int[1], { 0x33333333 });
@@ -987,6 +1070,7 @@ TEST_CUSTOM(int1, int[1], { 0x33333333 });
 // CHECK:       %custom = alloca [1 x i32], align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(int64, int[64]);
@@ -994,15 +1078,16 @@ TEST_UNINIT(int64, int[64]);
 // CHECK:       %uninit = alloca [64 x i32], align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_int64_uninit()
-// PATTERN: call void @llvm.memset{{.*}}, i8 [[I8]],
+// PATTERN: call void @llvm.memset{{.*}}, i8 [[I8]],{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_int64_uninit()
-// ZERO: call void @llvm.memset{{.*}}, i8 0,
+// ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 
 TEST_BRACES(int64, int[64]);
 // CHECK-LABEL: @test_int64_braces()
 // CHECK:       %braces = alloca [64 x i32], align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 256, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(int64, int[64], = { 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111 });
@@ -1010,6 +1095,7 @@ TEST_CUSTOM(int64, int[64], = { 0x11111111, 0x11111111, 0x11111111, 0x11111111,
 // CHECK:       %custom = alloca [64 x i32], align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 17, i64 256, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(bool4, bool[4]);
@@ -1017,17 +1103,22 @@ TEST_UNINIT(bool4, bool[4]);
 // CHECK:       %uninit = alloca [4 x i8], align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_bool4_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_bool4_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_bool4_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // PATTERN-O1: store i32 [[I32]], i32* %uninit, align 4
+// FIXME: !annotation dropped by optimizations
+// PATTERN-O1-NOT: !annotation
 // ZERO-LABEL: @test_bool4_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1: store i32 0, i32* %uninit, align 4
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(bool4, bool[4]);
 // CHECK-LABEL: @test_bool4_braces()
 // CHECK:       %braces = alloca [4 x i8], align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(bool4, bool[4], { true, true, true, true });
@@ -1035,6 +1126,7 @@ TEST_CUSTOM(bool4, bool[4], { true, true, true, true });
 // CHECK:       %custom = alloca [4 x i8], align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(intptr4, int*[4]);
@@ -1043,21 +1135,25 @@ TEST_UNINIT(intptr4, int*[4]);
 // CHECK-NEXT:       call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-O1-LABEL: @test_intptr4_uninit()
 // PATTERN-O1:  call void @llvm.memset.p0i8.i64(i8* nonnull align 16  dereferenceable(32) %{{[0-9*]}}, i8 -86, i64 32, i1 false)
+// FIXME: !annotation dropped by optimizations
+// PATTERN-O1-NOT: !annotation
 // ZERO-LABEL:       @test_intptr4_uninit()
-// ZERO:             call void @llvm.memset{{.*}}, i8 0,
+// ZERO:             call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 
 TEST_BRACES(intptr4, int*[4]);
 // CHECK-LABEL: @test_intptr4_braces()
 // CHECK:       %braces = alloca [4 x i32*], align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 32, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
-  TEST_CUSTOM(intptr4, int*[4], = { (int*)0x22222222, (int*)0x22222222, (int*)0x22222222, (int*)0x22222222 });
+TEST_CUSTOM(intptr4, int *[4], = {(int *)0x22222222, (int *)0x22222222, (int *)0x22222222, (int *)0x22222222});
 // CHECK-LABEL: @test_intptr4_custom()
 // CHECK:       %custom = alloca [4 x i32*], align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(tailpad4, tailpad[4]);
@@ -1065,17 +1161,20 @@ TEST_UNINIT(tailpad4, tailpad[4]);
 // CHECK:       %uninit = alloca [4 x %struct.tailpad], align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_tailpad4_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_tailpad4_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_tailpad4_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // PATTERN-O1: bitcast
-// PATTERN-O1: call void @llvm.memset{{.*}}({{.*}}0, i8 [[I8]], i64 16
+// PATTERN-O1: call void @llvm.memset{{.*}}({{.*}}0, i8 [[I8]], i64 16{{.+}})
+// FIXME: !annotation dropped by optimizations
+// PATTERN-O1-NOT: !annotation
 // ZERO-LABEL: @test_tailpad4_uninit()
-// ZERO: call void @llvm.memset{{.*}}, i8 0,
+// ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 
 TEST_BRACES(tailpad4, tailpad[4]);
 // CHECK-LABEL: @test_tailpad4_braces()
 // CHECK:       %braces = alloca [4 x %struct.tailpad], align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 16, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(tailpad4, tailpad[4], { {257, 1}, {257, 1}, {257, 1}, {257, 1} });
@@ -1083,6 +1182,7 @@ TEST_CUSTOM(tailpad4, tailpad[4], { {257, 1}, {257, 1}, {257, 1}, {257, 1} });
 // CHECK:       %custom = alloca [4 x %struct.tailpad], align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(tailpad9, tailpad[9]);
@@ -1090,15 +1190,16 @@ TEST_UNINIT(tailpad9, tailpad[9]);
 // CHECK:       %uninit = alloca [9 x %struct.tailpad], align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_tailpad9_uninit()
-// PATTERN-O0: call void @llvm.memset{{.*}}, i8 [[I8]],
+// PATTERN-O0: call void @llvm.memset{{.*}}, i8 [[I8]],{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_tailpad9_uninit()
-// ZERO: call void @llvm.memset{{.*}}, i8 0,
+// ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 
 TEST_BRACES(tailpad9, tailpad[9]);
 // CHECK-LABEL: @test_tailpad9_braces()
 // CHECK:       %braces = alloca [9 x %struct.tailpad], align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 36, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(tailpad9, tailpad[9], { {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1} });
@@ -1106,82 +1207,93 @@ TEST_CUSTOM(tailpad9, tailpad[9], { {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257
 // CHECK:       %custom = alloca [9 x %struct.tailpad], align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 1, i64 36, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
-
 TEST_UNINIT(atomicbool, _Atomic(bool));
 // CHECK-LABEL: @test_atomicbool_uninit()
 // CHECK:       %uninit = alloca i8, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_atomicbool_uninit()
-// PATTERN: store i8 [[I8]], i8* %uninit, align 1
+// PATTERN: store i8 [[I8]], i8* %uninit, align 1, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_atomicbool_uninit()
-// ZERO: store i8 0, i8* %uninit, align 1
+// ZERO: store i8 0, i8* %uninit, align 1, !annotation [[AUTO_INIT]]
 
 TEST_UNINIT(atomicint, _Atomic(int));
 // CHECK-LABEL: @test_atomicint_uninit()
 // CHECK:       %uninit = alloca i32, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_atomicint_uninit()
-// PATTERN: store i32 [[I32]], i32* %uninit, align 4
+// PATTERN: store i32 [[I32]], i32* %uninit, align 4, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_atomicint_uninit()
-// ZERO: store i32 0, i32* %uninit, align 4
+// ZERO: store i32 0, i32* %uninit, align 4, !annotation [[AUTO_INIT]]
 
 TEST_UNINIT(atomicdouble, _Atomic(double));
 // CHECK-LABEL: @test_atomicdouble_uninit()
 // CHECK:       %uninit = alloca double, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_atomicdouble_uninit()
-// PATTERN: store double 0xFFFFFFFFFFFFFFFF, double* %uninit, align 8
+// PATTERN: store double 0xFFFFFFFFFFFFFFFF, double* %uninit, align 8, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_atomicdouble_uninit()
-// ZERO: store double 0.000000e+00, double* %uninit, align 8
+// ZERO: store double 0.000000e+00, double* %uninit, align 8, !annotation [[AUTO_INIT]]
 
 TEST_UNINIT(atomicnotlockfree, _Atomic(notlockfree));
 // CHECK-LABEL: @test_atomicnotlockfree_uninit()
 // CHECK:       %uninit = alloca %struct.notlockfree, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_atomicnotlockfree_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_atomicnotlockfree_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_atomicnotlockfree_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // PATTERN-O1: bitcast
 // PATTERN-O1: call void @llvm.memset{{.*}}({{.*}}, i8 [[I8]], i64 32
+// FIXME: !annotation dropped by optimizations
+// PATTERN-O1-NOT: !annotation
 // ZERO-LABEL: @test_atomicnotlockfree_uninit()
-// ZERO: call void @llvm.memset{{.*}}, i8 0,
+// ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 
 TEST_UNINIT(atomicpadded, _Atomic(padded));
 // CHECK-LABEL: @test_atomicpadded_uninit()
 // CHECK:       %uninit = alloca %struct.padded, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_atomicpadded_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_atomicpadded_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_atomicpadded_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // PATTERN-O1: store i64 [[IPTR]], i64* %uninit, align 8
+// FIXME: !annotation dropped by optimizations
+// PATTERN-O1-NOT: !annotation
 // ZERO-LABEL: @test_atomicpadded_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1: store i64 0, i64* %uninit, align 8
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_UNINIT(atomictailpad, _Atomic(tailpad));
 // CHECK-LABEL: @test_atomictailpad_uninit()
 // CHECK:       %uninit = alloca %struct.tailpad, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_atomictailpad_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_atomictailpad_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_atomictailpad_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_atomictailpad_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1: store i32 0, i32* %uninit, align 4
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_UNINIT(complexfloat, _Complex float);
 // CHECK-LABEL: @test_complexfloat_uninit()
 // CHECK:       %uninit = alloca { float, float }, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_complexfloat_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_complexfloat_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_complexfloat_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // PATTERN-O1:  %[[F1:[^ ]*]] = getelementptr inbounds {{.*}}%uninit, i64 0, i32 0
-// PATTERN-O1: store float 0xFFFFFFFFE0000000, float* %[[F1]], align
+// PATTERN-O1: store float 0xFFFFFFFFE0000000, float* %[[F1]], align {{.+}}, !annotation [[AUTO_INIT]]
+
 // PATTERN-O1:  %[[F2:[^ ]*]] = getelementptr inbounds {{.*}}%uninit, i64 0, i32 1
-// PATTERN-O1: store float 0xFFFFFFFFE0000000, float* %[[F2]], align
+// PATTERN-O1: store float 0xFFFFFFFFE0000000, float* %[[F2]], align {{.+}}, !annotation [[AUTO_INIT]]
 
 // ZERO-LABEL: @test_complexfloat_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1: store i64 0, i64* %uninit, align 8
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(complexfloat, _Complex float);
 // CHECK-LABEL: @test_complexfloat_braces()
@@ -1189,7 +1301,9 @@ TEST_BRACES(complexfloat, _Complex float);
 // CHECK-NEXT:  %[[R:[^ ]*]] = getelementptr inbounds { float, float }, { float, float }* %braces, i32 0, i32 0
 // CHECK-NEXT:  %[[I:[^ ]*]] = getelementptr inbounds { float, float }, { float, float }* %braces, i32 0, i32 1
 // CHECK-NEXT:  store float 0.000000e+00, float* %[[R]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  store float 0.000000e+00, float* %[[I]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(complexfloat, _Complex float, { 3.1415926535897932384626433, 3.1415926535897932384626433 });
@@ -1198,7 +1312,9 @@ TEST_CUSTOM(complexfloat, _Complex float, { 3.1415926535897932384626433, 3.14159
 // CHECK-NEXT:  %[[R:[^ ]*]] = getelementptr inbounds { float, float }, { float, float }* %custom, i32 0, i32 0
 // CHECK-NEXT:  %[[I:[^ ]*]] = getelementptr inbounds { float, float }, { float, float }* %custom, i32 0, i32 1
 // CHECK-NEXT:  store float 0x400921FB60000000, float* %[[R]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  store float 0x400921FB60000000, float* %[[I]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(complexdouble, _Complex double);
@@ -1206,9 +1322,9 @@ TEST_UNINIT(complexdouble, _Complex double);
 // CHECK:       %uninit = alloca { double, double }, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_complexdouble_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_complexdouble_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_complexdouble_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_complexdouble_uninit()
-// ZERO: call void @llvm.memset{{.*}}, i8 0,
+// ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 
 TEST_BRACES(complexdouble, _Complex double);
 // CHECK-LABEL: @test_complexdouble_braces()
@@ -1216,7 +1332,9 @@ TEST_BRACES(complexdouble, _Complex double);
 // CHECK-NEXT:  %[[R:[^ ]*]] = getelementptr inbounds { double, double }, { double, double }* %braces, i32 0, i32 0
 // CHECK-NEXT:  %[[I:[^ ]*]] = getelementptr inbounds { double, double }, { double, double }* %braces, i32 0, i32 1
 // CHECK-NEXT:  store double 0.000000e+00, double* %[[R]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  store double 0.000000e+00, double* %[[I]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(complexdouble, _Complex double, { 3.1415926535897932384626433, 3.1415926535897932384626433 });
@@ -1225,23 +1343,25 @@ TEST_CUSTOM(complexdouble, _Complex double, { 3.1415926535897932384626433, 3.141
 // CHECK-NEXT:  %[[R:[^ ]*]] = getelementptr inbounds { double, double }, { double, double }* %custom, i32 0, i32 0
 // CHECK-NEXT:  %[[I:[^ ]*]] = getelementptr inbounds { double, double }, { double, double }* %custom, i32 0, i32 1
 // CHECK-NEXT:  store double 0x400921FB54442D18, double* %[[R]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  store double 0x400921FB54442D18, double* %[[I]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
-
 TEST_UNINIT(volatileint, volatile int);
 // CHECK-LABEL: @test_volatileint_uninit()
 // CHECK:       %uninit = alloca i32, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_volatileint_uninit()
-// PATTERN: store volatile i32 [[I32]], i32* %uninit, align 4
+// PATTERN: store volatile i32 [[I32]], i32* %uninit, align 4, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_volatileint_uninit()
-// ZERO: store volatile i32 0, i32* %uninit, align 4
+// ZERO: store volatile i32 0, i32* %uninit, align 4, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(volatileint, volatile int);
 // CHECK-LABEL: @test_volatileint_braces()
 // CHECK:       %braces = alloca i32, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store volatile i32 0, i32* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_UNINIT(semivolatile, semivolatile);
@@ -1249,16 +1369,19 @@ TEST_UNINIT(semivolatile, semivolatile);
 // CHECK:       %uninit = alloca %struct.semivolatile, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_semivolatile_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_semivolatile_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_semivolatile_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_semivolatile_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1: store i64 0, i64* %uninit, align 8
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(semivolatile, semivolatile);
 // CHECK-LABEL: @test_semivolatile_braces()
 // CHECK:       %braces = alloca %struct.semivolatile, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(semivolatile, semivolatile, { 0x44444444, 0x44444444 });
@@ -1266,8 +1389,10 @@ TEST_CUSTOM(semivolatile, semivolatile, { 0x44444444, 0x44444444 });
 // CHECK:       %custom = alloca %struct.semivolatile, align
 // CHECK-O0:  bitcast
 // CHECK-O0:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-O0:  call void @{{.*}}used{{.*}}%custom)
 // CHECK-O1:  store i64 4919131752989213764, i64* %custom, align 8
+// CHECK-NOT:   !annotation
 
 TEST_UNINIT(semivolatileinit, semivolatileinit);
 // CHECK-LABEL: @test_semivolatileinit_uninit()
@@ -1280,8 +1405,10 @@ TEST_BRACES(semivolatileinit, semivolatileinit);
 // CHECK:       %braces = alloca %struct.semivolatileinit, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  %[[I:[^ ]*]] = getelementptr inbounds %struct.semivolatileinit, %struct.semivolatileinit* %braces, i32 0, i32 0
 // CHECK-NEXT:  store i32 286331153, i32* %[[I]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  %[[VI:[^ ]*]] = getelementptr inbounds %struct.semivolatileinit, %struct.semivolatileinit* %braces, i32 0, i32 1
 // CHECK-NEXT:  store volatile i32 286331153, i32* %[[VI]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(semivolatileinit, semivolatileinit, { 0x44444444, 0x44444444 });
@@ -1289,28 +1416,32 @@ TEST_CUSTOM(semivolatileinit, semivolatileinit, { 0x44444444, 0x44444444 });
 // CHECK:       %custom = alloca %struct.semivolatileinit, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  %[[I:[^ ]*]] = getelementptr inbounds %struct.semivolatileinit, %struct.semivolatileinit* %custom, i32 0, i32 0
 // CHECK-NEXT:  store i32 1145324612, i32* %[[I]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  %[[VI:[^ ]*]] = getelementptr inbounds %struct.semivolatileinit, %struct.semivolatileinit* %custom, i32 0, i32 1
 // CHECK-NEXT:  store volatile i32 1145324612, i32* %[[VI]], align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
-
 TEST_UNINIT(base, base);
 // CHECK-LABEL: @test_base_uninit()
 // CHECK:       %uninit = alloca %struct.base, align
 // CHECK-NEXT:  call void @{{.*}}base{{.*}}%uninit)
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_base_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_base_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_base_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_base_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1-LEGACY: store i64 0, {{.*}} align 8
 // ZERO-O1-NEWPM: store i32 (...)** bitcast (i8** getelementptr inbounds ({ [4 x i8*] }, { [4 x i8*] }* @_ZTV4base, i64 0, inrange i32 0, i64 2) to i32 (...)**), {{.*}}, align 8
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(base, base);
 // CHECK-LABEL: @test_base_braces()
 // CHECK:       %braces = alloca %struct.base, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}base{{.*}}%braces)
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
@@ -1320,17 +1451,20 @@ TEST_UNINIT(derived, derived);
 // CHECK-NEXT:  call void @{{.*}}derived{{.*}}%uninit)
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_derived_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_derived_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_derived_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_derived_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1-LEGACY: store i64 0, {{.*}} align 8
 // ZERO-O1-NEWPM: store i32 (...)** bitcast (i8** getelementptr inbounds ({ [4 x i8*] }, { [4 x i8*] }* @_ZTV7derived, i64 0, inrange i32 0, i64 2) to i32 (...)**), {{.*}} align 8
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(derived, derived);
 // CHECK-LABEL: @test_derived_braces()
 // CHECK:       %braces = alloca %struct.derived, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}derived{{.*}}%braces)
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
@@ -1340,36 +1474,39 @@ TEST_UNINIT(virtualderived, virtualderived);
 // CHECK-NEXT:  call void @{{.*}}virtualderived{{.*}}%uninit)
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_virtualderived_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_virtualderived_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_virtualderived_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_virtualderived_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
-// ZERO-O1-LEGACY: call void @llvm.memset{{.*}}, i8 0,
-// ZERO-O1-NEWPM: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
+// ZERO-O1-LEGACY: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
+// ZERO-O1-NEWPM: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
 
 TEST_BRACES(virtualderived, virtualderived);
 // CHECK-LABEL: @test_virtualderived_braces()
 // CHECK:       %braces = alloca %struct.virtualderived, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 16, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}virtualderived{{.*}}%braces)
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
-
 TEST_UNINIT(matching, matching);
 // CHECK-LABEL: @test_matching_uninit()
 // CHECK:       %uninit = alloca %union.matching, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_matching_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_matching_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_matching_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_matching_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1: store i32 0, {{.*}} align 4
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(matching, matching);
 // CHECK-LABEL: @test_matching_braces()
 // CHECK:       %braces = alloca %union.matching, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(matching, matching, { .f = 0xf00f });
@@ -1377,26 +1514,31 @@ TEST_CUSTOM(matching, matching, { .f = 0xf00f });
 // CHECK:       %custom = alloca %union.matching, align
 // CHECK-O0:  bitcast
 // CHECK-O0:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-O0:  call void @{{.*}}used{{.*}}%custom)
 // CHECK-O1:  getelementptr
 // CHECK-O1:  store i32 1198526208, i32* {{.*}}, align 4
+// CHECK-NOT:   !annotation
 
 TEST_UNINIT(matchingreverse, matchingreverse);
 // CHECK-LABEL: @test_matchingreverse_uninit()
 // CHECK:       %uninit = alloca %union.matchingreverse, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_matchingreverse_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_matchingreverse_uninit.uninit
-// PATTERN-O1: store float 0xFFFFFFFFE0000000
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_matchingreverse_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
+// PATTERN-O1: store float 0xFFFFFFFFE0000000, {{.+}}, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_matchingreverse_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1: store i32 0, {{.*}} align 4
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(matchingreverse, matchingreverse);
 // CHECK-LABEL: @test_matchingreverse_braces()
 // CHECK:       %braces = alloca %union.matchingreverse, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(matchingreverse, matchingreverse, { .i = 0xf00f });
@@ -1404,24 +1546,29 @@ TEST_CUSTOM(matchingreverse, matchingreverse, { .i = 0xf00f });
 // CHECK:       %custom = alloca %union.matchingreverse, align
 // CHECK-O0:    bitcast
 // CHECK-O0:    call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-O0:    call void @{{.*}}used{{.*}}%custom)
 // CHECK-O1:    store i32 61455, i32* %1, align 4
+// CHECK-NOT:   !annotation
 
 TEST_UNINIT(unmatched, unmatched);
 // CHECK-LABEL: @test_unmatched_uninit()
 // CHECK:       %uninit = alloca %union.unmatched, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_unmatched_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_unmatched_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_unmatched_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_unmatched_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1: store i32 0, {{.*}} align 4
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(unmatched, unmatched);
 // CHECK-LABEL: @test_unmatched_braces()
 // CHECK:       %braces = alloca %union.unmatched, align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(unmatched, unmatched, { .i = 0x3badbeef });
@@ -1429,24 +1576,29 @@ TEST_CUSTOM(unmatched, unmatched, { .i = 0x3badbeef });
 // CHECK:       %custom = alloca %union.unmatched, align
 // CHECK-O0:    bitcast
 // CHECK-O0:    call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-O0:    call void @{{.*}}used{{.*}}%custom)
 // CHECK-O1:    store i32 1001242351, i32* {{.*}}, align 4
+// CHECK-NOT:   !annotation
 
 TEST_UNINIT(unmatchedreverse, unmatchedreverse);
 // CHECK-LABEL: @test_unmatchedreverse_uninit()
 // CHECK:       %uninit = alloca %union.unmatchedreverse, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_unmatchedreverse_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_unmatchedreverse_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_unmatchedreverse_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_unmatchedreverse_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1:  store i32 0, {{.*}} align 4
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(unmatchedreverse, unmatchedreverse);
 // CHECK-LABEL: @test_unmatchedreverse_braces()
 // CHECK:       %braces = alloca %union.unmatchedreverse, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(unmatchedreverse, unmatchedreverse, { .c = 42  });
@@ -1454,6 +1606,7 @@ TEST_CUSTOM(unmatchedreverse, unmatchedreverse, { .c = 42  });
 // CHECK:       %custom = alloca %union.unmatchedreverse, align
 // CHECK-O0:    bitcast
 // CHECK-O0:    call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-O0:    call void @{{.*}}used{{.*}}%custom)
 // PATTERN-O1:  store i32 -1431655894, i32* {{.*}}, align 4
 // ZERO-O1:     store i32 42, i32* {{.*}}, align 4
@@ -1463,16 +1616,19 @@ TEST_UNINIT(unmatchedfp, unmatchedfp);
 // CHECK:       %uninit = alloca %union.unmatchedfp, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_unmatchedfp_uninit()
-// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_unmatchedfp_uninit.uninit
+// PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_unmatchedfp_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_unmatchedfp_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
 // ZERO-O1: store i64 0, {{.*}} align 8
+// FIXME: !annotation dropped by optimizations
+// ZERO-O1-NOT: !annotation
 
 TEST_BRACES(unmatchedfp, unmatchedfp);
 // CHECK-LABEL: @test_unmatchedfp_braces()
 // CHECK:       %braces = alloca %union.unmatchedfp, align
 // CHECK-NEXT:  bitcast
 // CHECK-NEXT:  call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(unmatchedfp, unmatchedfp, { .d = 3.1415926535897932384626433 });
@@ -1480,28 +1636,33 @@ TEST_CUSTOM(unmatchedfp, unmatchedfp, { .d = 3.1415926535897932384626433 });
 // CHECK:       %custom = alloca %union.unmatchedfp, align
 // CHECK-O0:    bitcast
 // CHECK-O0:    call void @llvm.memcpy
+// CHECK-NOT:   !annotation
 // CHECK-O0:    call void @{{.*}}used{{.*}}%custom)
 // CHECK-O1:    store i64 4614256656552045848, i64* %1, align 8
+// CHECK-NOT:   !annotation
 
 TEST_UNINIT(emptyenum, emptyenum);
 // CHECK-LABEL: @test_emptyenum_uninit()
 // CHECK:       %uninit = alloca i32, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_emptyenum_uninit()
-// PATTERN: store i32 [[I32]], i32* %uninit, align 4
+// PATTERN: store i32 [[I32]], i32* %uninit, align 4, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_emptyenum_uninit()
-// ZERO: store i32 0, i32* %uninit, align 4
+// ZERO: store i32 0, i32* %uninit, align 4, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(emptyenum, emptyenum);
 // CHECK-LABEL: @test_emptyenum_braces()
 // CHECK:       %braces = alloca i32, align [[ALIGN:[0-9]*]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  store i32 0, i32* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(emptyenum, emptyenum, { (emptyenum)42 });
 // CHECK-LABEL: @test_emptyenum_custom()
 // CHECK:       %custom = alloca i32, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i32 42, i32* %custom, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(smallenum, smallenum);
@@ -1509,42 +1670,45 @@ TEST_UNINIT(smallenum, smallenum);
 // CHECK:       %uninit = alloca i32, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_smallenum_uninit()
-// PATTERN: store i32 [[I32]], i32* %uninit, align 4
+// PATTERN: store i32 [[I32]], i32* %uninit, align 4, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_smallenum_uninit()
-// ZERO: store i32 0, i32* %uninit, align 4
+// ZERO: store i32 0, i32* %uninit, align 4, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(smallenum, smallenum);
 // CHECK-LABEL: @test_smallenum_braces()
 // CHECK:       %braces = alloca i32, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i32 0, i32* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(smallenum, smallenum, { (smallenum)42 });
 // CHECK-LABEL: @test_smallenum_custom()
 // CHECK:       %custom = alloca i32, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store i32 42, i32* %custom, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
-
 TEST_UNINIT(intvec16, int  __attribute__((vector_size(16))));
 // CHECK-LABEL: @test_intvec16_uninit()
 // CHECK:       %uninit = alloca <4 x i32>, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_intvec16_uninit()
-// PATTERN: store <4 x i32> <i32 [[I32]], i32 [[I32]], i32 [[I32]], i32 [[I32]]>, <4 x i32>* %uninit, align 16
+// PATTERN: store <4 x i32> <i32 [[I32]], i32 [[I32]], i32 [[I32]], i32 [[I32]]>, <4 x i32>* %uninit, align 16, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_intvec16_uninit()
-// ZERO: store <4 x i32> zeroinitializer, <4 x i32>* %uninit, align 16
+// ZERO: store <4 x i32> zeroinitializer, <4 x i32>* %uninit, align 16, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(intvec16, int  __attribute__((vector_size(16))));
 // CHECK-LABEL: @test_intvec16_braces()
 // CHECK:       %braces = alloca <4 x i32>, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store <4 x i32> zeroinitializer, <4 x i32>* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(intvec16, int  __attribute__((vector_size(16))), { 0x44444444, 0x44444444, 0x44444444, 0x44444444 });
 // CHECK-LABEL: @test_intvec16_custom()
 // CHECK:       %custom = alloca <4 x i32>, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store <4 x i32> <i32 1145324612, i32 1145324612, i32 1145324612, i32 1145324612>, <4 x i32>* %custom, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(longlongvec32, long long  __attribute__((vector_size(32))));
@@ -1552,14 +1716,15 @@ TEST_UNINIT(longlongvec32, long long  __attribute__((vector_size(32))));
 // CHECK:       %uninit = alloca <4 x i64>, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_longlongvec32_uninit()
-// PATTERN: store <4 x i64> <i64 [[I64]], i64 [[I64]], i64 [[I64]], i64 [[I64]]>, <4 x i64>* %uninit, align 32
+// PATTERN: store <4 x i64> <i64 [[I64]], i64 [[I64]], i64 [[I64]], i64 [[I64]]>, <4 x i64>* %uninit, align 32, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_longlongvec32_uninit()
-// ZERO: store <4 x i64> zeroinitializer, <4 x i64>* %uninit, align 32
+// ZERO: store <4 x i64> zeroinitializer, <4 x i64>* %uninit, align 32, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(longlongvec32, long long  __attribute__((vector_size(32))));
 // CHECK-LABEL: @test_longlongvec32_braces()
 // CHECK:       %braces = alloca <4 x i64>, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store <4 x i64> zeroinitializer, <4 x i64>* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(longlongvec32, long long  __attribute__((vector_size(32))), { 0x3333333333333333, 0x3333333333333333, 0x3333333333333333, 0x3333333333333333 });
@@ -1573,20 +1738,22 @@ TEST_UNINIT(floatvec16, float  __attribute__((vector_size(16))));
 // CHECK:       %uninit = alloca <4 x float>, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_floatvec16_uninit()
-// PATTERN: store <4 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000>, <4 x float>* %uninit, align 16
+// PATTERN: store <4 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000>, <4 x float>* %uninit, align 16, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_floatvec16_uninit()
-// ZERO: store <4 x float> zeroinitializer, <4 x float>* %uninit, align 16
+// ZERO: store <4 x float> zeroinitializer, <4 x float>* %uninit, align 16, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(floatvec16, float  __attribute__((vector_size(16))));
 // CHECK-LABEL: @test_floatvec16_braces()
 // CHECK:       %braces = alloca <4 x float>, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store <4 x float> zeroinitializer, <4 x float>* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(floatvec16, float  __attribute__((vector_size(16))), { 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433 });
 // CHECK-LABEL: @test_floatvec16_custom()
 // CHECK:       %custom = alloca <4 x float>, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store <4 x float> <float 0x400921FB60000000, float 0x400921FB60000000, float 0x400921FB60000000, float 0x400921FB60000000>, <4 x float>* %custom, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 TEST_UNINIT(doublevec32, double  __attribute__((vector_size(32))));
@@ -1594,20 +1761,22 @@ TEST_UNINIT(doublevec32, double  __attribute__((vector_size(32))));
 // CHECK:       %uninit = alloca <4 x double>, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_doublevec32_uninit()
-// PATTERN: store <4 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF>, <4 x double>* %uninit, align 32
+// PATTERN: store <4 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF>, <4 x double>* %uninit, align 32, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_doublevec32_uninit()
-// ZERO: store <4 x double> zeroinitializer, <4 x double>* %uninit, align 32
+// ZERO: store <4 x double> zeroinitializer, <4 x double>* %uninit, align 32, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(doublevec32, double  __attribute__((vector_size(32))));
 // CHECK-LABEL: @test_doublevec32_braces()
 // CHECK:       %braces = alloca <4 x double>, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store <4 x double> zeroinitializer, <4 x double>* %braces, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%braces)
 
 TEST_CUSTOM(doublevec32, double  __attribute__((vector_size(32))), { 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433 });
 // CHECK-LABEL: @test_doublevec32_custom()
 // CHECK:       %custom = alloca <4 x double>, align [[ALIGN:[0-9]*]]
 // CHECK-NEXT:  store <4 x double> <double 0x400921FB54442D18, double 0x400921FB54442D18, double 0x400921FB54442D18, double 0x400921FB54442D18>, <4 x double>* %custom, align [[ALIGN]]
+// CHECK-NOT:   !annotation
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%custom)
 
 // TODO: This vector has tail padding
@@ -1616,9 +1785,9 @@ TEST_UNINIT(doublevec24, double  __attribute__((vector_size(24))));
 // CHECK:       %uninit = alloca <3 x double>, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_doublevec24_uninit()
-// PATTERN: store <3 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF>, <3 x double>* %uninit, align 32
+// PATTERN: store <3 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF>, <3 x double>* %uninit, align 32, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_doublevec24_uninit()
-// ZERO: store <3 x double> zeroinitializer, <3 x double>* %uninit, align 32
+// ZERO: store <3 x double> zeroinitializer, <3 x double>* %uninit, align 32, !annotation [[AUTO_INIT]]
 
 // TODO: This vector has tail padding
 TEST_UNINIT(longdoublevec32, long double  __attribute__((vector_size(sizeof(long double)*2))));
@@ -1626,8 +1795,11 @@ TEST_UNINIT(longdoublevec32, long double  __attribute__((vector_size(sizeof(long
 // CHECK:       %uninit = alloca <2 x x86_fp80>, align
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_longdoublevec32_uninit()
-// PATTERN: store <2 x x86_fp80> <x86_fp80 0xKFFFFFFFFFFFFFFFFFFFF, x86_fp80 0xKFFFFFFFFFFFFFFFFFFFF>, <2 x x86_fp80>* %uninit, align 32
+// PATTERN: store <2 x x86_fp80> <x86_fp80 0xKFFFFFFFFFFFFFFFFFFFF, x86_fp80 0xKFFFFFFFFFFFFFFFFFFFF>, <2 x x86_fp80>* %uninit, align 32, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_longdoublevec32_uninit()
-// ZERO: store <2 x x86_fp80> zeroinitializer, <2 x x86_fp80>* %uninit, align 32
+// ZERO: store <2 x x86_fp80> zeroinitializer, <2 x x86_fp80>* %uninit, align 32, !annotation [[AUTO_INIT]]
 
 } // extern "C"
+
+// PATTERN: [[AUTO_INIT]] = !{!"auto-init"}
+// ZERO: [[AUTO_INIT]] = !{!"auto-init"}

diff  --git a/clang/test/CodeGenCXX/trivial-auto-var-init-attribute.cpp b/clang/test/CodeGenCXX/trivial-auto-var-init-attribute.cpp
index 8b1bf2e57b21..4b9b1c6bb526 100644
--- a/clang/test/CodeGenCXX/trivial-auto-var-init-attribute.cpp
+++ b/clang/test/CodeGenCXX/trivial-auto-var-init-attribute.cpp
@@ -11,9 +11,11 @@ extern "C" {
 // UNINIT-NEXT: call void
 // ZERO-LABEL:    test_attribute_uninitialized(
 // ZERO:      alloca
+// ZERO-NOT:  !annotation
 // ZERO-NEXT: call void
 // PATTERN-LABEL: test_attribute_uninitialized(
 // PATTERN:      alloca
+// PATTERN-NOT:  !annotation
 // PATTERN-NEXT: call void
 void test_attribute_uninitialized() {
   [[clang::uninitialized]] int i;

diff  --git a/clang/test/CodeGenCXX/trivial-auto-var-init.cpp b/clang/test/CodeGenCXX/trivial-auto-var-init.cpp
index 2cc63a47dd19..513222cb3f1d 100644
--- a/clang/test/CodeGenCXX/trivial-auto-var-init.cpp
+++ b/clang/test/CodeGenCXX/trivial-auto-var-init.cpp
@@ -12,9 +12,9 @@ extern "C" {
 
 // UNINIT-LABEL:  test_selfinit(
 // ZERO-LABEL:    test_selfinit(
-// ZERO: store i32 0, i32* %self, align 4
+// ZERO: store i32 0, i32* %self, align 4, !annotation [[AUTO_INIT:!.+]]
 // PATTERN-LABEL: test_selfinit(
-// PATTERN: store i32 -1431655766, i32* %self, align 4
+// PATTERN: store i32 -1431655766, i32* %self, align 4, !annotation [[AUTO_INIT:!.+]]
 void test_selfinit() {
   int self = self + 1;
   used(self);
@@ -22,9 +22,9 @@ void test_selfinit() {
 
 // UNINIT-LABEL:  test_block(
 // ZERO-LABEL:    test_block(
-// ZERO: store i32 0, i32* %block
+// ZERO: store i32 0, i32* %block, align 4, !annotation [[AUTO_INIT:!.+]]
 // PATTERN-LABEL: test_block(
-// PATTERN: store i32 -1431655766, i32* %block
+// PATTERN: store i32 -1431655766, i32* %block, align 4, !annotation [[AUTO_INIT:!.+]]
 void test_block() {
   __block int block;
   used(block);
@@ -38,12 +38,12 @@ void test_block() {
 // ZERO-LABEL:    test_block_self_init(
 // ZERO:          %block = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>, align 8
 // ZERO:          %captured1 = getelementptr inbounds %struct.__block_byref_captured, %struct.__block_byref_captured* %captured, i32 0, i32 4
-// ZERO-NEXT:     store %struct.XYZ* null, %struct.XYZ** %captured1, align 8
+// ZERO-NEXT:     store %struct.XYZ* null, %struct.XYZ** %captured1, align 8, !annotation [[AUTO_INIT:!.+]]
 // ZERO:          %call = call %struct.XYZ* @create(
 // PATTERN-LABEL: test_block_self_init(
 // PATTERN:       %block = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>, align 8
 // PATTERN:       %captured1 = getelementptr inbounds %struct.__block_byref_captured, %struct.__block_byref_captured* %captured, i32 0, i32 4
-// PATTERN-NEXT:  store %struct.XYZ* inttoptr (i64 -6148914691236517206 to %struct.XYZ*), %struct.XYZ** %captured1, align 8
+// PATTERN-NEXT:  store %struct.XYZ* inttoptr (i64 -6148914691236517206 to %struct.XYZ*), %struct.XYZ** %captured1, align 8, !annotation [[AUTO_INIT:!.+]]
 // PATTERN:       %call = call %struct.XYZ* @create(
 using Block = void (^)();
 typedef struct XYZ {
@@ -62,12 +62,12 @@ void test_block_self_init() {
 // ZERO-LABEL:    test_block_captures_self_after_init(
 // ZERO:          %block = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>, align 8
 // ZERO:          %captured1 = getelementptr inbounds %struct.__block_byref_captured.1, %struct.__block_byref_captured.1* %captured, i32 0, i32 4
-// ZERO-NEXT:     store %struct.XYZ* null, %struct.XYZ** %captured1, align 8
+// ZERO-NEXT:     store %struct.XYZ* null, %struct.XYZ** %captured1, align 8, !annotation [[AUTO_INIT:!.+]]
 // ZERO:          %call = call %struct.XYZ* @create(
 // PATTERN-LABEL: test_block_captures_self_after_init(
 // PATTERN:       %block = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>, align 8
 // PATTERN:       %captured1 = getelementptr inbounds %struct.__block_byref_captured.1, %struct.__block_byref_captured.1* %captured, i32 0, i32 4
-// PATTERN-NEXT:  store %struct.XYZ* inttoptr (i64 -6148914691236517206 to %struct.XYZ*), %struct.XYZ** %captured1, align 8
+// PATTERN-NEXT:  store %struct.XYZ* inttoptr (i64 -6148914691236517206 to %struct.XYZ*), %struct.XYZ** %captured1, align 8, !annotation [[AUTO_INIT:!.+]]
 // PATTERN:       %call = call %struct.XYZ* @create(
 void test_block_captures_self_after_init() {
   extern xyz_t create(Block block);
@@ -97,13 +97,13 @@ void test_goto_unreachable_value() {
 // ZERO-LABEL:    test_goto(
 // ZERO: if.then:
 // ZERO: br label %jump
-// ZERO: store i32 0, i32* %oops, align 4
+// ZERO: store i32 0, i32* %oops, align 4, !annotation [[AUTO_INIT:!.+]]
 // ZERO: br label %jump
 // ZERO: jump:
 // PATTERN-LABEL: test_goto(
 // PATTERN: if.then:
 // PATTERN: br label %jump
-// PATTERN: store i32 -1431655766, i32* %oops, align 4
+// PATTERN: store i32 -1431655766, i32* %oops, align 4, !annotation [[AUTO_INIT:!.+]]
 // PATTERN: br label %jump
 // PATTERN: jump:
 void test_goto(int i) {
@@ -119,12 +119,12 @@ void test_goto(int i) {
 // UNINIT-LABEL:  test_switch(
 // ZERO-LABEL:    test_switch(
 // ZERO:      sw.bb:
-// ZERO-NEXT: store i32 0, i32* %oops, align 4
+// ZERO-NEXT: store i32 0, i32* %oops, align 4, !annotation [[AUTO_INIT:!.+]]
 // ZERO:      sw.bb1:
 // ZERO-NEXT: call void @{{.*}}used
 // PATTERN-LABEL: test_switch(
 // PATTERN:      sw.bb:
-// PATTERN-NEXT: store i32 -1431655766, i32* %oops, align 4
+// PATTERN-NEXT: store i32 -1431655766, i32* %oops, align 4, !annotation [[AUTO_INIT:!.+]]
 // PATTERN:      sw.bb1:
 // PATTERN-NEXT: call void @{{.*}}used
 void test_switch(int i) {
@@ -140,7 +140,7 @@ void test_switch(int i) {
 // UNINIT-LABEL:  test_vla(
 // ZERO-LABEL:    test_vla(
 // ZERO:  %[[SIZE:[0-9]+]] = mul nuw i64 %{{.*}}, 4
-// ZERO:  call void @llvm.memset{{.*}}(i8* align 16 %{{.*}}, i8 0, i64 %[[SIZE]], i1 false)
+// ZERO:  call void @llvm.memset{{.*}}(i8* align 16 %{{.*}}, i8 0, i64 %[[SIZE]], i1 false), !annotation [[AUTO_INIT:!.+]]
 // PATTERN-LABEL: test_vla(
 // PATTERN:  %vla.iszerosized = icmp eq i64 %{{.*}}, 0
 // PATTERN:  br i1 %vla.iszerosized, label %vla-init.cont, label %vla-setup.loop
@@ -151,7 +151,7 @@ void test_switch(int i) {
 // PATTERN:  br label %vla-init.loop
 // PATTERN: vla-init.loop:
 // PATTERN:  %vla.cur = phi i8* [ %vla.begin, %vla-setup.loop ], [ %vla.next, %vla-init.loop ]
-// PATTERN:  call void @llvm.memcpy{{.*}} %vla.cur, {{.*}}@__const.test_vla.vla
+// PATTERN:  call void @llvm.memcpy{{.*}} %vla.cur, {{.*}}@__const.test_vla.vla {{.*}}), !annotation [[AUTO_INIT:!.+]]
 // PATTERN:  %vla.next = getelementptr inbounds i8, i8* %vla.cur, i64 4
 // PATTERN:  %vla-init.isdone = icmp eq i8* %vla.next, %vla.end
 // PATTERN:  br i1 %vla-init.isdone, label %vla-init.cont, label %vla-init.loop
@@ -177,11 +177,11 @@ void test_vla(int size) {
 // ZERO-LABEL:    test_alloca(
 // ZERO:          %[[SIZE:[a-z0-9]+]] = sext i32 %{{.*}} to i64
 // ZERO-NEXT:     %[[ALLOCA:[a-z0-9]+]] = alloca i8, i64 %[[SIZE]], align [[ALIGN:[0-9]+]]
-// ZERO-NEXT:     call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %[[ALLOCA]], i8 0, i64 %[[SIZE]], i1 false)
+// ZERO-NEXT:     call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %[[ALLOCA]], i8 0, i64 %[[SIZE]], i1 false), !annotation [[AUTO_INIT:!.+]]
 // PATTERN-LABEL: test_alloca(
 // PATTERN:       %[[SIZE:[a-z0-9]+]] = sext i32 %{{.*}} to i64
 // PATTERN-NEXT:  %[[ALLOCA:[a-z0-9]+]] = alloca i8, i64 %[[SIZE]], align [[ALIGN:[0-9]+]]
-// PATTERN-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %[[ALLOCA]], i8 -86, i64 %[[SIZE]], i1 false)
+// PATTERN-NEXT:  call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %[[ALLOCA]], i8 -86, i64 %[[SIZE]], i1 false), !annotation [[AUTO_INIT:!.+]]
 void test_alloca(int size) {
   void *ptr = __builtin_alloca(size);
   used(ptr);
@@ -191,11 +191,11 @@ void test_alloca(int size) {
 // ZERO-LABEL:    test_alloca_with_align(
 // ZERO:          %[[SIZE:[a-z0-9]+]] = sext i32 %{{.*}} to i64
 // ZERO-NEXT:     %[[ALLOCA:[a-z0-9]+]] = alloca i8, i64 %[[SIZE]], align 128
-// ZERO-NEXT:     call void @llvm.memset{{.*}}(i8* align 128 %[[ALLOCA]], i8 0, i64 %[[SIZE]], i1 false)
+// ZERO-NEXT:     call void @llvm.memset{{.*}}(i8* align 128 %[[ALLOCA]], i8 0, i64 %[[SIZE]], i1 false), !annotation [[AUTO_INIT:!.+]]
 // PATTERN-LABEL: test_alloca_with_align(
 // PATTERN:       %[[SIZE:[a-z0-9]+]] = sext i32 %{{.*}} to i64
 // PATTERN-NEXT:  %[[ALLOCA:[a-z0-9]+]] = alloca i8, i64 %[[SIZE]], align 128
-// PATTERN-NEXT:  call void @llvm.memset{{.*}}(i8* align 128 %[[ALLOCA]], i8 -86, i64 %[[SIZE]], i1 false)
+// PATTERN-NEXT:  call void @llvm.memset{{.*}}(i8* align 128 %[[ALLOCA]], i8 -86, i64 %[[SIZE]], i1 false), !annotation [[AUTO_INIT:!.+]]
 void test_alloca_with_align(int size) {
   void *ptr = __builtin_alloca_with_align(size, 1024);
   used(ptr);
@@ -204,7 +204,7 @@ void test_alloca_with_align(int size) {
 // UNINIT-LABEL:  test_struct_vla(
 // ZERO-LABEL:    test_struct_vla(
 // ZERO:  %[[SIZE:[0-9]+]] = mul nuw i64 %{{.*}}, 16
-// ZERO:  call void @llvm.memset{{.*}}(i8* align 16 %{{.*}}, i8 0, i64 %[[SIZE]], i1 false)
+// ZERO:  call void @llvm.memset{{.*}}(i8* align 16 %{{.*}}, i8 0, i64 %[[SIZE]], i1 false), !annotation [[AUTO_INIT:!.+]]
 // PATTERN-LABEL: test_struct_vla(
 // PATTERN:  %vla.iszerosized = icmp eq i64 %{{.*}}, 0
 // PATTERN:  br i1 %vla.iszerosized, label %vla-init.cont, label %vla-setup.loop
@@ -215,7 +215,7 @@ void test_alloca_with_align(int size) {
 // PATTERN:  br label %vla-init.loop
 // PATTERN: vla-init.loop:
 // PATTERN:  %vla.cur = phi i8* [ %vla.begin, %vla-setup.loop ], [ %vla.next, %vla-init.loop ]
-// PATTERN:  call void @llvm.memcpy{{.*}} %vla.cur, {{.*}}@__const.test_struct_vla.vla
+// PATTERN:  call void @llvm.memcpy{{.*}} %vla.cur, {{.*}}@__const.test_struct_vla.vla {{.*}}), !annotation [[AUTO_INIT:!.+]]
 // PATTERN:  %vla.next = getelementptr inbounds i8, i8* %vla.cur, i64 16
 // PATTERN:  %vla-init.isdone = icmp eq i8* %vla.next, %vla.end
 // PATTERN:  br i1 %vla-init.isdone, label %vla-init.cont, label %vla-init.loop
@@ -247,12 +247,12 @@ void test_zsa(int size) {
   int zsa[0];
   used(zsa);
 }
-  
+
 // UNINIT-LABEL:  test_huge_uninit(
 // ZERO-LABEL:    test_huge_uninit(
-// ZERO: call void @llvm.memset{{.*}}, i8 0, i64 65536,
+// ZERO: call void @llvm.memset{{.*}}, i8 0, i64 65536, {{.*}}), !annotation [[AUTO_INIT:!.+]]
 // PATTERN-LABEL: test_huge_uninit(
-// PATTERN: call void @llvm.memset{{.*}}, i8 -86, i64 65536,
+// PATTERN: call void @llvm.memset{{.*}}, i8 -86, i64 65536, {{.*}}), !annotation [[AUTO_INIT:!.+]]
 void test_huge_uninit() {
   // We can't emit this as an inline constant to a store instruction because
   // SDNode hits an internal size limit.
@@ -263,12 +263,14 @@ void test_huge_uninit() {
 // UNINIT-LABEL:  test_huge_small_init(
 // ZERO-LABEL:    test_huge_small_init(
 // ZERO: call void @llvm.memset{{.*}}, i8 0, i64 65536,
+// ZERO-NOT: !annotation
 // ZERO: store i8 97,
 // ZERO: store i8 98,
 // ZERO: store i8 99,
 // ZERO: store i8 100,
 // PATTERN-LABEL: test_huge_small_init(
 // PATTERN: call void @llvm.memset{{.*}}, i8 0, i64 65536,
+// PATTERN-NOT: !annotation
 // PATTERN: store i8 97,
 // PATTERN: store i8 98,
 // PATTERN: store i8 99,
@@ -281,11 +283,15 @@ void test_huge_small_init() {
 // UNINIT-LABEL:  test_huge_larger_init(
 // ZERO-LABEL:    test_huge_larger_init(
 // ZERO:  call void @llvm.memcpy{{.*}} @__const.test_huge_larger_init.big, {{.*}}, i64 65536,
+// ZERO-NOT: !annotation
 // PATTERN-LABEL: test_huge_larger_init(
 // PATTERN:  call void @llvm.memcpy{{.*}} @__const.test_huge_larger_init.big, {{.*}}, i64 65536,
+// PATTERN-NOT: !annotation
 void test_huge_larger_init() {
   char big[65536] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
   used(big);
 }
 
 } // extern "C"
+
+// CHECK: [[AUTO_INIT]] = !{ !"auto-init" }

diff  --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h
index 3ebe15c75b8d..ef83a250a580 100644
--- a/llvm/include/llvm/IR/Instruction.h
+++ b/llvm/include/llvm/IR/Instruction.h
@@ -340,6 +340,11 @@ class Instruction : public User,
   }
   /// @}
 
+  /// Adds an !annotation metadata node with \p Annotation to this instruction.
+  /// If this instruction already has !annotation metadata, append \p Annotation
+  /// to the existing node.
+  void addAnnotationMetadata(StringRef Annotation);
+
   /// Sets the metadata on this instruction from the AAMDNodes structure.
   void setAAMetadata(const AAMDNodes &N);
 

diff  --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index d21095844337..a32d8f420eae 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -10,6 +10,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/IR/Metadata.h"
 #include "LLVMContextImpl.h"
 #include "MetadataImpl.h"
 #include "SymbolTableListTraitsImpl.h"
@@ -38,7 +39,7 @@
 #include "llvm/IR/GlobalVariable.h"
 #include "llvm/IR/Instruction.h"
 #include "llvm/IR/LLVMContext.h"
-#include "llvm/IR/Metadata.h"
+#include "llvm/IR/MDBuilder.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/TrackingMDRef.h"
 #include "llvm/IR/Type.h"
@@ -1305,6 +1306,27 @@ void Instruction::setMetadata(unsigned KindID, MDNode *Node) {
   Value::setMetadata(KindID, Node);
 }
 
+void Instruction::addAnnotationMetadata(StringRef Name) {
+  MDBuilder MDB(getContext());
+
+  auto *Existing = getMetadata(LLVMContext::MD_annotation);
+  SmallVector<Metadata *, 4> Names;
+  bool AppendName = true;
+  if (Existing) {
+    auto *Tuple = cast<MDTuple>(Existing);
+    for (auto &N : Tuple->operands()) {
+      if (cast<MDString>(N.get())->getString() == Name)
+        AppendName = false;
+      Names.push_back(N.get());
+    }
+  }
+  if (AppendName)
+    Names.push_back(MDB.createString(Name));
+
+  MDNode *MD = MDTuple::get(getContext(), Names);
+  setMetadata(LLVMContext::MD_annotation, MD);
+}
+
 void Instruction::setAAMetadata(const AAMDNodes &N) {
   setMetadata(LLVMContext::MD_tbaa, N.TBAA);
   setMetadata(LLVMContext::MD_tbaa_struct, N.TBAAStruct);


        


More information about the llvm-commits mailing list