yaxunl created this revision.
Herald added a subscriber: wdng.

There is incoming LLVM changes for letting alloca return pointers to alloca 
address space specified by data layout and correspondingly letting lifetime 
intrinsics to accept pointer arguments in alloca address space.

https://reviews.llvm.org/D31041

https://reviews.llvm.org/D31042

This patch makes Clang to emit correct lifetime intrinsics following the above 
two changes in LLVM.

Basically lifetime intrinsics will be declared with pointer argument in alloca 
address space.


https://reviews.llvm.org/D31717

Files:
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenTypeCache.h
  test/CodeGen/cleanup-destslot-simple.c
  test/CodeGen/lifetime-asan.c
  test/CodeGen/lifetime.c
  test/CodeGen/lifetime2.c
  test/CodeGen/temporary-lifetime-exceptions.cpp
  test/CodeGen/temporary-lifetime.cpp
  test/CodeGenCXX/destructors.cpp
  test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp
  test/CodeGenCXX/nrvo.cpp
  test/CodeGenCXX/stack-reuse-miscompile.cpp
  test/CodeGenCXX/stack-reuse.cpp
  test/CodeGenObjC/arc-blocks.m
  test/CodeGenObjC/arc-bridged-cast.m
  test/CodeGenObjC/arc-literals.m
  test/CodeGenObjC/arc-precise-lifetime.m
  test/CodeGenObjC/arc-ternary-op.m
  test/CodeGenObjC/arc.m
  test/CodeGenObjC/exceptions.m
  test/CodeGenObjCXX/arc-move.mm
  test/CodeGenObjCXX/arc-references.mm
  test/CodeGenObjCXX/arc.mm
  test/CodeGenObjCXX/literals.mm

Index: test/CodeGenObjCXX/literals.mm
===================================================================
--- test/CodeGenObjCXX/literals.mm
+++ test/CodeGenObjCXX/literals.mm
@@ -21,7 +21,7 @@
 
   // Initializing first element
   // CHECK: [[PTR1:%.*]] = bitcast i8** [[ARR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[PTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PTR1]])
   // CHECK: [[ELEMENT0:%[a-zA-Z0-9.]+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[OBJECTS]], i64 0, i64 0
   // CHECK-NEXT: call void @_ZN1XC1Ev
   // CHECK-NEXT: [[OBJECT0:%[a-zA-Z0-9.]+]] = invoke i8* @_ZNK1XcvP11objc_objectEv
@@ -51,7 +51,7 @@
   // CHECK-NOT: ret void
   // CHECK: call void @objc_release
   // CHECK-NEXT: [[PTR2:%.*]] = bitcast i8** [[ARR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTR2]])
   // CHECK-NEXT: ret void
 
   // Check cleanups
@@ -73,7 +73,7 @@
 
   // Initializing first element
   // CHECK:      [[PTR1:%.*]] = bitcast i8** [[ARR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[PTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PTR1]])
   // CHECK: [[ELEMENT0:%[a-zA-Z0-9.]+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[OBJECTS]], i64 0, i64 0
   // CHECK-NEXT: call void @_ZN1XC1Ev
   // CHECK-NEXT: [[OBJECT0:%[a-zA-Z0-9.]+]] = invoke i8* @_ZNK1XcvP11objc_objectEv
@@ -103,7 +103,7 @@
   // CHECK-NOT: ret void
   // CHECK: call void @objc_release
   // CHECK-NEXT: [[PTR2]] = bitcast i8** [[ARR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTR2]])
   // CHECK-NEXT: ret void
 
   // Check cleanups
Index: test/CodeGenObjCXX/arc.mm
===================================================================
--- test/CodeGenObjCXX/arc.mm
+++ test/CodeGenObjCXX/arc.mm
@@ -65,10 +65,10 @@
   // CHECK-NEXT: [[CONDCLEANUP:%.*]] = alloca i1
   // CHECK-NEXT: store i32
   // CHECK-NEXT: [[STRONGP:%.*]] = bitcast i8** [[STRONG]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[STRONGP]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[STRONGP]])
   // CHECK-NEXT: store i8* null, i8** [[STRONG]]
   // CHECK-NEXT: [[WEAKP:%.*]] = bitcast i8** [[WEAK]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[WEAKP]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[WEAKP]])
   // CHECK-NEXT: call i8* @objc_initWeak(i8** [[WEAK]], i8* null)
 
   // CHECK-NEXT: [[T0:%.*]] = load i32, i32* [[COND]]
@@ -124,77 +124,77 @@
 
 // CHECK-LABEL: define void @_Z6test3513Test35_HelperPS_
 void test35(Test35_Helper x0, Test35_Helper *x0p) {
-  // CHECK: call void @llvm.lifetime.start
+  // CHECK: call void @llvm.lifetime.start.p0i8
   // CHECK: call i8* @_ZN13Test35_Helper11makeObject1Ev
   // CHECK-NOT: call i8* @objc_retain
   id obj1 = Test35_Helper::makeObject1();
-  // CHECK: call void @llvm.lifetime.start
+  // CHECK: call void @llvm.lifetime.start.p0i8
   // CHECK: call i8* @_ZN13Test35_Helper11makeObject2Ev
   // CHECK-NOT: call i8* @objc_retain
   id obj2 = x0.makeObject2();
-  // CHECK: call void @llvm.lifetime.start
+  // CHECK: call void @llvm.lifetime.start.p0i8
   // CHECK: call i8* @_ZN13Test35_Helper11makeObject2Ev
   // CHECK-NOT: call i8* @objc_retain
   id obj3 = x0p->makeObject2();
   id (Test35_Helper::*pmf)() __attribute__((ns_returns_retained))
     = &Test35_Helper::makeObject2;
-  // CHECK: call void @llvm.lifetime.start
+  // CHECK: call void @llvm.lifetime.start.p0i8
   // CHECK: call i8* %
   // CHECK-NOT: call i8* @objc_retain
   id obj4 = (x0.*pmf)();
-  // CHECK: call void @llvm.lifetime.start
+  // CHECK: call void @llvm.lifetime.start.p0i8
   // CHECK: call i8* %
   // CHECK-NOT: call i8* @objc_retain
   id obj5 = (x0p->*pmf)();
 
   // CHECK: call void @objc_release
-  // CHECK: call void @llvm.lifetime.end
+  // CHECK: call void @llvm.lifetime.end.p0i8
   // CHECK: call void @objc_release
-  // CHECK: call void @llvm.lifetime.end
+  // CHECK: call void @llvm.lifetime.end.p0i8
   // CHECK: call void @objc_release
-  // CHECK: call void @llvm.lifetime.end
+  // CHECK: call void @llvm.lifetime.end.p0i8
   // CHECK: call void @objc_release
-  // CHECK: call void @llvm.lifetime.end
+  // CHECK: call void @llvm.lifetime.end.p0i8
   // CHECK: call void @objc_release
-  // CHECK: call void @llvm.lifetime.end
+  // CHECK: call void @llvm.lifetime.end.p0i8
   // CHECK-NEXT: ret void
 }
 
 // CHECK-LABEL: define void @_Z7test35b13Test35_HelperPS_
 void test35b(Test35_Helper x0, Test35_Helper *x0p) {
-  // CHECK: call void @llvm.lifetime.start
+  // CHECK: call void @llvm.lifetime.start.p0i8
   // CHECK: call i8* @_ZN13Test35_Helper11makeObject3Ev
   // CHECK: call i8* @objc_retain
   id obj1 = Test35_Helper::makeObject3();
-  // CHECK: call void @llvm.lifetime.start
+  // CHECK: call void @llvm.lifetime.start.p0i8
   // CHECK: call i8* @_ZN13Test35_Helper11makeObject4Ev
   // CHECK: call i8* @objc_retain
   id obj2 = x0.makeObject4();
-  // CHECK: call void @llvm.lifetime.start
+  // CHECK: call void @llvm.lifetime.start.p0i8
   // CHECK: call i8* @_ZN13Test35_Helper11makeObject4Ev
   // CHECK: call i8* @objc_retain
   id obj3 = x0p->makeObject4();
   id (Test35_Helper::*pmf)() = &Test35_Helper::makeObject4;
-  // CHECK: call void @llvm.lifetime.start
+  // CHECK: call void @llvm.lifetime.start.p0i8
   // CHECK: call i8* %
   // CHECK: call i8* @objc_retain
   id obj4 = (x0.*pmf)();
-  // CHECK: call void @llvm.lifetime.start
+  // CHECK: call void @llvm.lifetime.start.p0i8
   // CHECK: call i8* %
   // CHECK: call i8* @objc_retain
   id obj5 = (x0p->*pmf)();
 
   // CHECK: call void @objc_release
-  // CHECK: call void @llvm.lifetime.end
+  // CHECK: call void @llvm.lifetime.end.p0i8
   // CHECK: call void @objc_release
-  // CHECK: call void @llvm.lifetime.end
-  // CHECK: call void @llvm.lifetime.end
+  // CHECK: call void @llvm.lifetime.end.p0i8
+  // CHECK: call void @llvm.lifetime.end.p0i8
   // CHECK: call void @objc_release
-  // CHECK: call void @llvm.lifetime.end
+  // CHECK: call void @llvm.lifetime.end.p0i8
   // CHECK: call void @objc_release
-  // CHECK: call void @llvm.lifetime.end
+  // CHECK: call void @llvm.lifetime.end.p0i8
   // CHECK: call void @objc_release
-  // CHECK: call void @llvm.lifetime.end
+  // CHECK: call void @llvm.lifetime.end.p0i8
   // CHECK-NEXT: ret void
 }
 
@@ -316,7 +316,7 @@
 // CHECK:      [[X:%.*]] = alloca i8*
 // CHECK-NEXT: [[TEMP:%.*]] = alloca i8*
 // CHECK-NEXT: [[XP:%.*]] = bitcast i8** [[X]] to i8*
-// CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XP]])
+// CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XP]])
 // CHECK-NEXT: store i8* null, i8** [[X]]
 // CHECK:      [[T0:%.*]] = load i8*, i8** [[X]]
 // CHECK-NEXT: store i8* [[T0]], i8** [[TEMP]]
Index: test/CodeGenObjCXX/arc-references.mm
===================================================================
--- test/CodeGenObjCXX/arc-references.mm
+++ test/CodeGenObjCXX/arc-references.mm
@@ -45,7 +45,7 @@
   // CHECK-NEXT: call void @_Z6calleev()
   callee();
   // CHECK-NEXT: [[PTR:%.*]] = bitcast i8*** [[REF]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTR]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTR]])
   // CHECK-NEXT: call void @objc_destroyWeak
   // CHECK-NEXT: ret void
 }
@@ -75,11 +75,11 @@
   // CHECK-NEXT: [[OBJ_ID:%[a-zA-Z0-9]+]] = bitcast [[A]]* [[OBJ_A]] to i8*
   // CHECK-NEXT: call void @objc_release
   // CHECK-NEXT: [[IPTR1:%.*]] = bitcast i32* [[I]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 4, i8* [[IPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* [[IPTR1]])
   // CHECK-NEXT: store i32 17, i32
   int i = 17;
   // CHECK-NEXT: [[IPTR2:%.*]] = bitcast i32* [[I]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 4, i8* [[IPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 4, i8* [[IPTR2]])
   // CHECK-NEXT: ret void
 }
 
Index: test/CodeGenObjCXX/arc-move.mm
===================================================================
--- test/CodeGenObjCXX/arc-move.mm
+++ test/CodeGenObjCXX/arc-move.mm
@@ -49,7 +49,7 @@
   // CHECK: [[X:%.*]] = alloca i8*, align 8
   // CHECK: [[I:%.*]] = alloca i32, align 4
   // CHECK:      [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
   // CHECK: [[Y:%[a-zA-Z0-9]+]] = call dereferenceable({{[0-9]+}}) i8** @_Z4moveIRU8__strongP11objc_objectEON16remove_referenceIT_E4typeEOS5_
   // Load the object
   // CHECK-NEXT: [[OBJ:%[a-zA-Z0-9]+]] = load i8*, i8** [[Y]]
@@ -60,15 +60,15 @@
   id x = move(y);
 
   // CHECK-NEXT: [[IPTR1:%.*]] = bitcast i32* [[I]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 4, i8* [[IPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* [[IPTR1]])
   // CHECK-NEXT: store i32 17
   int i = 17;
   // CHECK-NEXT: [[IPTR2:%.*]] = bitcast i32* [[I]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 4, i8* [[IPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 4, i8* [[IPTR2]])
   // CHECK-NEXT: [[OBJ:%[a-zA-Z0-9]+]] = load i8*, i8** [[X]]
   // CHECK-NEXT: call void @objc_release(i8* [[OBJ]])
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK-NEXT: ret void
 }
 
Index: test/CodeGenObjC/exceptions.m
===================================================================
--- test/CodeGenObjC/exceptions.m
+++ test/CodeGenObjC/exceptions.m
@@ -83,7 +83,7 @@
 
   // CHECK:      [[X:%.*]] = alloca i32
   // CHECK:      [[XPTR:%.*]] = bitcast i32* [[X]] to i8*
-  // CHECK:      call void @llvm.lifetime.start(i64 4, i8* nonnull [[XPTR]])
+  // CHECK:      call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull [[XPTR]])
   // CHECK:      store i32 0, i32* [[X]]
   int x = 0;
 
@@ -124,7 +124,7 @@
   }
 
   // CHECK:      call void @f3_helper(i32 4, i32* nonnull [[X]])
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 4, i8* nonnull [[XPTR]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull [[XPTR]])
   // CHECK-NEXT: ret void
   f3_helper(4, &x);
 }
Index: test/CodeGenObjC/arc.m
===================================================================
--- test/CodeGenObjC/arc.m
+++ test/CodeGenObjC/arc.m
@@ -49,14 +49,14 @@
   // CHECK-NEXT: [[PARM:%.*]] = call i8* @objc_retain(i8* {{%.*}})
   // CHECK-NEXT: store i8* [[PARM]], i8** [[X]]
   // CHECK-NEXT: [[YPTR1:%.*]] = bitcast i8** [[Y]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[YPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[YPTR1]])
   // CHECK-NEXT: store i8* null, i8** [[Y]]
   // CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[Y]]
   // CHECK-NEXT: [[RET:%.*]] = call i8* @objc_retain(i8* [[T0]])
   // CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[Y]]
   // CHECK-NEXT: call void @objc_release(i8* [[T0]])
   // CHECK-NEXT: [[YPTR2:%.*]] = bitcast i8** [[Y]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[YPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[YPTR2]])
   // CHECK-NEXT: [[T1:%.*]] = load i8*, i8** [[X]]
   // CHECK-NEXT: call void @objc_release(i8* [[T1]])
   // CHECK-NEXT: [[T1:%.*]] = tail call i8* @objc_autoreleaseReturnValue(i8* [[RET]])
@@ -102,7 +102,7 @@
 
   // CHECK:      [[X:%.*]] = alloca [[TEST3:%.*]]*
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast [[TEST3]]** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
   // CHECK-NEXT: store [[TEST3]]* null, [[TEST3]]** [[X]], align
   Test3 *x;
 
@@ -127,15 +127,15 @@
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST3]]* [[T0]] to i8*
   // CHECK-NEXT: call void @objc_release(i8* [[T1]]) [[NUW]]
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast [[TEST3]]** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK-NEXT: ret void
 }
 
 // CHECK-LABEL: define void @test3()
 void test3() {
   // CHECK:      [[X:%.*]] = alloca i8*
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
 
   id x = [[Test3 alloc] initWith: 5];
 
@@ -171,7 +171,7 @@
   // CHECK-NEXT: [[TMP:%.*]] = load i8*, i8** [[X]]
   // CHECK-NEXT: call void @objc_release(i8* [[TMP]]) [[NUW]]
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK-NEXT: ret void
 }
 
@@ -254,13 +254,13 @@
 void test6() {
   // CHECK:      [[X:%.*]] = alloca i8*
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
   // CHECK-NEXT: [[CALL:%.*]] = call i8* @test6_helper()
   // CHECK-NEXT: store i8* [[CALL]], i8** [[X]]
   // CHECK-NEXT: [[T1:%.*]] = load i8*, i8** [[X]]
   // CHECK-NEXT: call void @objc_release(i8* [[T1]]) [[NUW]], !clang.imprecise_release
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK-NEXT: ret void
   id x = test6_helper();
 }
@@ -270,15 +270,15 @@
 void test7() {
   // CHECK:      [[X:%.*]] = alloca i8*
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
   // CHECK-NEXT: store i8* null, i8** [[X]]
   // CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[X]]
   // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retain(i8* [[T0]]) [[NUW]]
   // CHECK-NEXT: call void @test7_helper(i8* [[T1]])
   // CHECK-NEXT: [[T1:%.*]] = load i8*, i8** [[X]]
   // CHECK-NEXT: call void @objc_release(i8* [[T1]]) [[NUW]], !clang.imprecise_release
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK-NEXT: ret void
   id x;
   test7_helper(x);
@@ -289,12 +289,12 @@
   __unsafe_unretained id x = test8_helper();
   // CHECK:      [[X:%.*]] = alloca i8*
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
   // CHECK-NEXT: [[T0:%.*]] = call i8* @test8_helper()
   // CHECK-NEXT: store i8* [[T0]], i8** [[X]]
   // CHECK-NEXT: call void @objc_release(i8* [[T0]]) [[NUW]], !clang.imprecise_release
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK-NEXT: ret void
 }
 
@@ -309,10 +309,10 @@
   // CHECK:      [[X:%.*]] = alloca [[TEST10:%.*]]*, align
   // CHECK-NEXT: [[Y:%.*]] = alloca i8*, align
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast [[TEST10]]** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
   // CHECK-NEXT: store [[TEST10]]* null, [[TEST10]]** [[X]]
   // CHECK-NEXT: [[YPTR1:%.*]] = bitcast i8** [[Y]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[YPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[YPTR1]])
   // CHECK-NEXT: load [[TEST10]]*, [[TEST10]]** [[X]], align
   // CHECK-NEXT: load i8*, i8** @OBJC_SELECTOR_REFERENCES_{{[0-9]*}}
   // CHECK-NEXT: bitcast
@@ -333,12 +333,12 @@
   // CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[Y]]
   // CHECK-NEXT: call void @objc_release(i8* [[T0]])
   // CHECK-NEXT: [[YPTR2:%.*]] = bitcast i8** [[Y]] to i8*
-  // CHECK-NEXT: void @llvm.lifetime.end(i64 8, i8* [[YPTR2]])
+  // CHECK-NEXT: void @llvm.lifetime.end.p0i8(i64 8, i8* [[YPTR2]])
   // CHECK-NEXT: [[T0:%.*]] = load [[TEST10]]*, [[TEST10]]** [[X]]
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST10]]* [[T0]] to i8*
   // CHECK-NEXT: call void @objc_release(i8* [[T1]])
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast [[TEST10]]** [[X]] to i8*
-  // CHECK-NEXT: void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK-NEXT: ret void
 }
 
@@ -348,14 +348,14 @@
   // CHECK-NEXT: [[X:%.*]] = alloca i8*, align
   // CHECK-NEXT: store i8* ()* {{%.*}}, i8* ()** [[F]], align
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
   // CHECK-NEXT: [[T0:%.*]] = load i8* ()*, i8* ()** [[F]], align
   // CHECK-NEXT: [[T1:%.*]] = call i8* [[T0]]()
   // CHECK-NEXT: store i8* [[T1]], i8** [[X]], align
   // CHECK-NEXT: [[T3:%.*]] = load i8*, i8** [[X]]
   // CHECK-NEXT: call void @objc_release(i8* [[T3]]) [[NUW]], !clang.imprecise_release
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK-NEXT: ret void
   id x = f();
 }
@@ -369,7 +369,7 @@
 
   __weak id x = test12_helper();
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
   // CHECK-NEXT: [[T0:%.*]] = call i8* @test12_helper()
   // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]])
   // CHECK-NEXT: call i8* @objc_initWeak(i8** [[X]], i8* [[T1]])
@@ -383,26 +383,26 @@
 
   id y = x;
   // CHECK-NEXT: [[YPTR1:%.*]] = bitcast i8** [[Y]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[YPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[YPTR1]])
   // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_loadWeakRetained(i8** [[X]])
   // CHECK-NEXT: store i8* [[T2]], i8** [[Y]], align
 
   // CHECK-NEXT: [[T4:%.*]] = load i8*, i8** [[Y]]
   // CHECK-NEXT: call void @objc_release(i8* [[T4]]) [[NUW]], !clang.imprecise_release
   // CHECK-NEXT: [[YPTR2:%.*]] = bitcast i8** [[Y]] to i8*
-  // CHECK-NEXT: void @llvm.lifetime.end(i64 8, i8* [[YPTR2]])
+  // CHECK-NEXT: void @llvm.lifetime.end.p0i8(i64 8, i8* [[YPTR2]])
   // CHECK-NEXT: call void @objc_destroyWeak(i8** [[X]])
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK: ret void
 }
 
 // Indirect consuming calls.
 void test13(void) {
   // CHECK-LABEL:      define void @test13()
   // CHECK:      [[X:%.*]] = alloca i8*, align
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
   // CHECK-NEXT: store i8* null, i8** [[X]], align
   id x;
 
@@ -429,7 +429,7 @@
   // CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[X]]
   // CHECK-NEXT: call void @objc_release(i8* [[T0]]) [[NUW]]
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK-NEXT: ret void
 }
 
@@ -505,7 +505,7 @@
 void test19() {
   // CHECK-LABEL: define void @test19()
   // CHECK:      [[X:%.*]] = alloca [5 x i8*], align 16
-  // CHECK: call void @llvm.lifetime.start
+  // CHECK: call void @llvm.lifetime.start.p0i8
   // CHECK-NEXT: [[T0:%.*]] = bitcast [5 x i8*]* [[X]] to i8*
   // CHECK: call void @llvm.memset.p0i8.i64(i8* [[T0]], i8 0, i64 40, i32 16, i1 false)
   id x[5];
@@ -901,7 +901,7 @@
   // CHECK-NEXT: bitcast
   // CHECK-NEXT: store
   // CHECK-NEXT: bitcast
-  // CHECK-NEXT: call void @llvm.lifetime.start
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8
   // CHECK-NEXT: store [[A_T]]* null, [[A_T]]** [[A]]
 
   // CHECK-NEXT: load [[TEST33]]*, [[TEST33]]** [[PTR]]
@@ -965,7 +965,7 @@
   // CHECK-NEXT: bitcast
   // CHECK-NEXT: objc_release
   // CHECK-NEXT: bitcast
-  // CHECK-NEXT: call void @llvm.lifetime.end
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8
   // CHECK-NEXT: load
   // CHECK-NEXT: bitcast
   // CHECK-NEXT: objc_release
@@ -1005,7 +1005,7 @@
   // CHECK:      [[VAR:%.*]] = alloca [[TEST37:%.*]]*,
   // CHECK-NEXT: [[TEMP:%.*]] = alloca i8*
   // CHECK-NEXT: [[VARPTR1:%.*]] = bitcast [[TEST37]]** [[VAR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[VARPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[VARPTR1]])
   // CHECK-NEXT: store [[TEST37]]* null, [[TEST37]]** [[VAR]]
 
   // CHECK-NEXT: [[W0:%.*]] = load [[TEST37]]*, [[TEST37]]** [[VAR]]
@@ -1027,7 +1027,7 @@
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST37]]* [[T0]] to i8*
   // CHECK-NEXT: call void @objc_release(i8* [[T1]])
   // CHECK-NEXT: [[VARPTR2:%.*]] = bitcast [[TEST37]]** [[VAR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[VARPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[VARPTR2]])
   // CHECK-NEXT: ret void
 }
 
@@ -1085,7 +1085,7 @@
   // CHECK-LABEL:    define void @test47()
   // CHECK:      [[X:%.*]] = alloca i8*
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
   // CHECK-NEXT: store i8* null, i8** [[X]]
   // CHECK-NEXT: [[CALL:%.*]] = call i8* @test47_helper()
   // CHECK-NEXT: [[T0:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[CALL]])
@@ -1099,7 +1099,7 @@
   // CHECK-NEXT: [[T4:%.*]] = load i8*, i8** [[X]]
   // CHECK-NEXT: call void @objc_release(i8* [[T4]])
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK-NEXT: ret void
 }
 
@@ -1109,16 +1109,16 @@
   // CHECK-LABEL:    define void @test48()
   // CHECK:      [[X:%.*]] = alloca i8*
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
   // CHECK-NEXT: [[T0:%.*]] = call i8* @objc_initWeak(i8** [[X]], i8* null)
   // CHECK-NEXT: [[T1:%.*]] = call i8* @test48_helper()
   // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]])
   // CHECK-NEXT: [[T3:%.*]] = call i8* @objc_storeWeak(i8** [[X]], i8* [[T2]])
   // CHECK-NEXT: [[T4:%.*]] = call i8* @objc_storeWeak(i8** [[X]], i8* [[T3]])
   // CHECK-NEXT: call void @objc_release(i8* [[T2]])
   // CHECK-NEXT: call void @objc_destroyWeak(i8** [[X]])
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK-NEXT: ret void
 }
 
@@ -1128,16 +1128,16 @@
   // CHECK-LABEL:    define void @test49()
   // CHECK:      [[X:%.*]] = alloca i8*
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
   // CHECK-NEXT: store i8* null, i8** [[X]]
   // CHECK-NEXT: [[CALL:%.*]] = call i8* @test49_helper()
   // CHECK-NEXT: [[T0:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[CALL]])
   // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_autorelease(i8* [[T0]])
   // CHECK-NEXT: store i8* [[T2]], i8** [[X]]
   // CHECK-NEXT: [[T3:%.*]] = call i8* @objc_retainAutorelease(i8* [[T1]])
   // CHECK-NEXT: store i8* [[T3]], i8** [[X]]
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK-NEXT: ret void
 }
 
@@ -1174,13 +1174,13 @@
 // CHECK:      [[X:%.*]] = alloca i32
 // CHECK-NEXT: [[TMPALLOCA:%.*]] = alloca i8*
 // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i32* [[X]] to i8*
-// CHECK-NEXT: call void @llvm.lifetime.start(i64 4, i8* [[XPTR1]])
+// CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* [[XPTR1]])
 // CHECK-NEXT: store i32 5, i32* [[X]],
 // CHECK-NEXT: [[T0:%.*]] = load i32, i32* [[X]],
 // CHECK-NEXT: [[T1:%.*]] = call i8* @test52_helper(i32 [[T0]])
 // CHECK-NEXT: store i8* [[T1]], i8** [[TMPALLOCA]]
 // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i32* [[X]] to i8*
-// CHECK-NEXT: call void @llvm.lifetime.end(i64 4, i8* [[XPTR2]])
+// CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 4, i8* [[XPTR2]])
 // CHECK-NEXT: [[T2:%.*]] = load i8*, i8** [[TMPALLOCA]]
 // CHECK-NEXT: [[T3:%.*]] = tail call i8* @objc_autoreleaseReturnValue(i8* [[T2]])
 // CHECK-NEXT: ret i8* [[T3]]
@@ -1196,9 +1196,9 @@
 // CHECK-NEXT: [[Y:%.*]] = alloca i8*,
 // CHECK-NEXT: [[TMPALLOCA:%.*]] = alloca i8*,
 // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
-// CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+// CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
 // CHECK-NEXT: [[YPTR1:%.*]] = bitcast i8** [[Y]] to i8*
-// CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[YPTR1]])
+// CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[YPTR1]])
 // CHECK-NEXT: [[T0:%.*]] = call i8* @test53_helper()
 // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]])
 // CHECK-NEXT: store i8* [[T1]], i8** [[Y]],
@@ -1208,14 +1208,14 @@
 // CHECK-NEXT: [[T2:%.*]] = load i8*, i8** [[Y]]
 // CHECK-NEXT: call void @objc_release(i8* [[T2]])
 // CHECK-NEXT: [[YPTR2:%.*]] = bitcast i8** [[Y]] to i8*
-// CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[YPTR2]])
+// CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[YPTR2]])
 // CHECK-NEXT: [[T3:%.*]] = load i8*, i8** [[TMPALLOCA]]
 // CHECK-NEXT: store i8* [[T3]], i8** [[X]],
 // CHECK-NEXT: load i8*, i8** [[X]],
 // CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[X]]
 // CHECK-NEXT: call void @objc_release(i8* [[T0]])
 // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
-// CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+// CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
 // CHECK-NEXT: ret void
 }
 
@@ -1263,13 +1263,13 @@
   // CHECK-LABEL: define void @test56_test()
   // CHECK:      [[X:%.*]] = alloca i8*, align 8
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
   // CHECK:      [[T0:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(
   // CHECK-NEXT: store i8* [[T0]], i8** [[X]]
   // CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[X]]
   // CHECK-NEXT: call void @objc_release(i8* [[T0]])
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK-NEXT: ret void
 }
 
@@ -1350,7 +1350,7 @@
   [test61_make() performSelector: @selector(test61_void)];
 
   // CHECK-NEXT: [[YPTR1:%.*]] = bitcast i8** [[Y]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[YPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[YPTR1]])
   // CHECK-NEXT: [[T0:%.*]] = call i8* @test61_make()
   // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]])
   // CHECK-NEXT: [[T2:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_
@@ -1364,7 +1364,7 @@
   // CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[Y]]
   // CHECK-NEXT: call void @objc_release(i8* [[T0]])
   // CHECK-NEXT: [[YPTR2:%.*]] = bitcast i8** [[Y]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[YPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[YPTR2]])
   // CHECK-NEXT: ret void
 }
 
@@ -1378,7 +1378,7 @@
   extern void test62_body(void);
 
   // CHECK-NEXT: [[IPTR:%.*]] = bitcast i32* [[I]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 4, i8* [[IPTR]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* [[IPTR]])
   // CHECK-NEXT: store i32 0, i32* [[I]], align 4
   // CHECK-NEXT: br label
 
@@ -1471,11 +1471,11 @@
 // CHECK-LABEL:    define void @test67()
 // CHECK:      [[CL:%.*]] = alloca i8*, align 8
 // CHECK-NEXT: [[CLPTR1:%.*]] = bitcast i8** [[CL]] to i8*
-// CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[CLPTR1]])
+// CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[CLPTR1]])
 // CHECK-NEXT: [[T0:%.*]] = call i8* @test67_helper()
 // CHECK-NEXT: store i8* [[T0]], i8** [[CL]], align 8
 // CHECK-NEXT: [[CLPTR2:%.*]] = bitcast i8** [[CL]] to i8*
-// CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[CLPTR2]])
+// CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[CLPTR2]])
 // CHECK-NEXT: ret void
 
 Class test68_helper(void);
@@ -1485,14 +1485,14 @@
 // CHECK-LABEL:    define void @test68()
 // CHECK:      [[CL:%.*]] = alloca i8*, align 8
 // CHECK-NEXT: [[CLPTR1:%.*]] = bitcast i8** [[CL]] to i8*
-// CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[CLPTR1]])
+// CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[CLPTR1]])
 // CHECK-NEXT: [[T0:%.*]] = call i8* @test67_helper()
 // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]])
 // CHECK-NEXT: store i8* [[T1]], i8** [[CL]], align 8
 // CHECK-NEXT: [[T2:%.*]] = load i8*, i8** [[CL]]
 // CHECK-NEXT: call void @objc_release(i8* [[T2]])
 // CHECK-NEXT: [[CLPTR2:%.*]] = bitcast i8** [[CL]] to i8*
-// CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[CLPTR2]])
+// CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[CLPTR2]])
 // CHECK-NEXT: ret void
 
 // rdar://problem/10564852
Index: test/CodeGenObjC/arc-ternary-op.m
===================================================================
--- test/CodeGenObjC/arc-ternary-op.m
+++ test/CodeGenObjC/arc-ternary-op.m
@@ -11,7 +11,7 @@
   // CHECK-NEXT: zext
   // CHECK-NEXT: store
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
   // CHECK-NEXT: [[T0:%.*]] = load i8, i8* [[COND]]
   // CHECK-NEXT: [[T1:%.*]] = trunc i8 [[T0]] to i1
   // CHECK-NEXT: store i1 false, i1* [[RELCOND]]
@@ -32,7 +32,7 @@
   // CHECK:      [[T0:%.*]] = load i8*, i8** [[X]]
   // CHECK-NEXT: call void @objc_release(i8* [[T0]]) [[NUW]]
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK-NEXT: ret void
   id x = (cond ? 0 : test0_helper());
 }
@@ -54,10 +54,10 @@
   // CHECK-NEXT: [[CONDCLEANUP:%.*]] = alloca i1
   // CHECK-NEXT: store i32
   // CHECK-NEXT: [[STRONGPTR1:%.*]] = bitcast i8** [[STRONG]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[STRONGPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[STRONGPTR1]])
   // CHECK-NEXT: store i8* null, i8** [[STRONG]]
   // CHECK-NEXT: [[WEAKPTR1:%.*]] = bitcast i8** [[WEAK]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[WEAKPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[WEAKPTR1]])
   // CHECK-NEXT: call i8* @objc_initWeak(i8** [[WEAK]], i8* null)
 
   // CHECK-NEXT: [[T0:%.*]] = load i32, i32* [[COND]]
@@ -102,9 +102,9 @@
 
   // CHECK:      call void @objc_destroyWeak(i8** [[WEAK]])
   // CHECK:      [[WEAKPTR2:%.*]] = bitcast i8** [[WEAK]] to i8*
-  // CHECK:      call void @llvm.lifetime.end(i64 8, i8* [[WEAKPTR2]])
+  // CHECK:      call void @llvm.lifetime.end.p0i8(i64 8, i8* [[WEAKPTR2]])
   // CHECK:      [[STRONGPTR2:%.*]] = bitcast i8** [[STRONG]] to i8*
-  // CHECK:      call void @llvm.lifetime.end(i64 8, i8* [[STRONGPTR2]])
+  // CHECK:      call void @llvm.lifetime.end.p0i8(i64 8, i8* [[STRONGPTR2]])
   // CHECK:      ret void
 }
 
Index: test/CodeGenObjC/arc-precise-lifetime.m
===================================================================
--- test/CodeGenObjC/arc-precise-lifetime.m
+++ test/CodeGenObjC/arc-precise-lifetime.m
@@ -8,7 +8,7 @@
   x = 0;
   // CHECK:      [[X:%.*]] = alloca i8*
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XPTR1]])
   // CHECK-NEXT: [[CALL:%.*]] = call i8* @test0_helper()
   // CHECK-NEXT: store i8* [[CALL]], i8** [[X]]
 
@@ -22,7 +22,7 @@
   // CHECK-NOT:  clang.imprecise_release
 
   // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[XPTR2]])
   // CHECK-NEXT: ret void
 }
 
@@ -40,14 +40,14 @@
   // CHECK:      [[PTR:%.*]] = alloca [[PTR_T:%.*]]*, align 8
   // CHECK:      [[C:%.*]] = alloca i8*, align 8
   // CHECK:      [[PTRPTR1:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK:      call void @llvm.lifetime.start(i64 8, i8* [[PTRPTR1]])
+  // CHECK:      call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PTRPTR1]])
   // CHECK:      [[T0:%.*]] = call [[TEST1:%.*]]* @test1_helper()
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]])
   // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST1]]*
   // CHECK-NEXT: store [[TEST1]]* [[T3]]
   // CHECK-NEXT: [[CPTR1:%.*]] = bitcast i8** [[C]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[CPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[CPTR1]])
   // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutorelease(i8* [[T1]])
@@ -57,12 +57,12 @@
   // CHECK-NEXT: [[T6:%.*]] = call i8* bitcast
   // CHECK-NEXT: store i8* [[T6]], i8**
   // CHECK-NEXT: [[CPTR2:%.*]] = bitcast i8** [[C]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[CPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[CPTR2]])
   // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: call void @objc_release(i8* [[T1]]) [[NUW]], !clang.imprecise_release
   // CHECK-NEXT: [[PTRPTR2:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTRPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTRPTR2]])
   // CHECK-NEXT: ret void
   Test1 *ptr = test1_helper();
   char *c = [(ptr) interior];
@@ -74,14 +74,14 @@
   // CHECK:      [[PTR:%.*]] = alloca [[PTR_T:%.*]]*, align 8
   // CHECK:      [[C:%.*]] = alloca i8*, align 8
   // CHECK:      [[PTRPTR1:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK:      call void @llvm.lifetime.start(i64 8, i8* [[PTRPTR1]])
+  // CHECK:      call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PTRPTR1]])
   // CHECK:      [[T0:%.*]] = call [[TEST1:%.*]]* @test1_helper()
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]])
   // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST1]]*
   // CHECK-NEXT: store [[TEST1]]* [[T3]]
   // CHECK-NEXT: [[CPTR1:%.*]] = bitcast i8** [[C]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[CPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[CPTR1]])
   // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutorelease(i8* [[T1]])
@@ -91,12 +91,12 @@
   // CHECK-NEXT: [[T6:%.*]] = call i8* bitcast
   // CHECK-NEXT: store i8* [[T6]], i8**
   // CHECK-NEXT: [[CPTR2:%.*]] = bitcast i8** [[C]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[CPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[CPTR2]])
   // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: call void @objc_release(i8* [[T1]]) [[NUW]], !clang.imprecise_release
   // CHECK-NEXT: [[PTRPTR2:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTRPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTRPTR2]])
   // CHECK-NEXT: ret void
   Test1 *ptr = test1_helper();
   char *c = ptr.interior;
@@ -108,27 +108,27 @@
   // CHECK:      [[PTR:%.*]] = alloca [[PTR_T:%.*]]*, align 8
   // CHECK:      [[C:%.*]] = alloca i8*, align 8
   // CHECK:      [[PTRPTR1:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK:      call void @llvm.lifetime.start(i64 8, i8* [[PTRPTR1]])
+  // CHECK:      call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PTRPTR1]])
   // CHECK:      [[T0:%.*]] = call [[TEST1:%.*]]* @test1_helper()
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]])
   // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST1]]*
   // CHECK-NEXT: store [[TEST1]]* [[T3]]
   // CHECK-NEXT: [[CPTR1:%.*]] = bitcast i8** [[C]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[CPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[CPTR1]])
   // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[T1:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_
   // CHECK-NEXT: [[T2:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[T3:%.*]] = call i8* bitcast
   // CHECK-NEXT: store i8* [[T3]], i8**
   // CHECK-NEXT: [[CPTR2:%.*]] = bitcast i8** [[C]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[CPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[CPTR2]])
   // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: call void @objc_release(i8* [[T1]]) [[NUW]]
   // CHECK-NOT:  clang.imprecise_release
   // CHECK-NEXT: [[PTRPTR2:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTRPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTRPTR2]])
   // CHECK-NEXT: ret void
   PRECISE_LIFETIME Test1 *ptr = test1_helper();
   char *c = [ptr interior];
@@ -139,27 +139,27 @@
   // CHECK:      [[PTR:%.*]] = alloca [[PTR_T:%.*]]*, align 8
   // CHECK:      [[C:%.*]] = alloca i8*, align 8
   // CHECK:      [[PTRPTR1:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK:      call void @llvm.lifetime.start(i64 8, i8* [[PTRPTR1]])
+  // CHECK:      call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PTRPTR1]])
   // CHECK:      [[T0:%.*]] = call [[TEST1:%.*]]* @test1_helper()
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]])
   // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST1]]*
   // CHECK-NEXT: store [[TEST1]]* [[T3]]
   // CHECK-NEXT: [[CPTR1:%.*]] = bitcast i8** [[C]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[CPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[CPTR1]])
   // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[T1:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_
   // CHECK-NEXT: [[T2:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[T3:%.*]] = call i8* bitcast
   // CHECK-NEXT: store i8* [[T3]], i8**
   // CHECK-NEXT: [[CPTR2:%.*]] = bitcast i8** [[C]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[CPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[CPTR2]])
   // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: call void @objc_release(i8* [[T1]]) [[NUW]]
   // CHECK-NOT:  clang.imprecise_release
   // CHECK-NEXT: [[PTRPTR2:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTRPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTRPTR2]])
   // CHECK-NEXT: ret void
   PRECISE_LIFETIME Test1 *ptr = test1_helper();
   char *c = ptr.interior;
@@ -170,14 +170,14 @@
   // CHECK:      [[PTR:%.*]] = alloca [[PTR_T:%.*]]*, align 8
   // CHECK:      [[PC:%.*]] = alloca i8*, align 8
   // CHECK:      [[PTRPTR1:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK:      call void @llvm.lifetime.start(i64 8, i8* [[PTRPTR1]])
+  // CHECK:      call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PTRPTR1]])
   // CHECK:      [[T0:%.*]] = call [[TEST1:%.*]]* @test1_helper()
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]])
   // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST1]]*
   // CHECK-NEXT: store [[TEST1]]* [[T3]]
   // CHECK-NEXT: [[PCPTR1:%.*]] = bitcast i8** [[PC]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[PCPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PCPTR1]])
   // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutorelease(i8* [[T1]])
@@ -187,12 +187,12 @@
   // CHECK-NEXT: [[T6:%.*]] = call i8* bitcast
   // CHECK-NEXT: store i8* [[T6]], i8**
   // CHECK-NEXT: [[PCPTR2:%.*]] = bitcast i8** [[PC]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PCPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PCPTR2]])
   // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: call void @objc_release(i8* [[T1]]) [[NUW]], !clang.imprecise_release
   // CHECK-NEXT: [[PTRPTR2:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTRPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTRPTR2]])
   // CHECK-NEXT: ret void
   Test1 *ptr = test1_helper();
   char *pc = [ptr PropertyReturnsInnerPointer];
@@ -203,14 +203,14 @@
   // CHECK:      [[PTR:%.*]] = alloca [[PTR_T:%.*]]*, align 8
   // CHECK:      [[PC:%.*]] = alloca i8*, align 8
   // CHECK:      [[PTRPTR1:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK:      call void @llvm.lifetime.start(i64 8, i8* [[PTRPTR1]])
+  // CHECK:      call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PTRPTR1]])
   // CHECK:      [[T0:%.*]] = call [[TEST1:%.*]]* @test1_helper()
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]])
   // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST1]]*
   // CHECK-NEXT: store [[TEST1]]* [[T3]]
   // CHECK-NEXT: [[PCPTR1:%.*]] = bitcast i8** [[PC]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[PCPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PCPTR1]])
   // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutorelease(i8* [[T1]])
@@ -220,12 +220,12 @@
   // CHECK-NEXT: [[T6:%.*]] = call i8* bitcast
   // CHECK-NEXT: store i8* [[T6]], i8**
   // CHECK-NEXT: [[PCPTR2:%.*]] = bitcast i8** [[PC]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PCPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PCPTR2]])
   // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: call void @objc_release(i8* [[T1]]) [[NUW]], !clang.imprecise_release
   // CHECK-NEXT: [[PTRPTR2:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTRPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTRPTR2]])
   // CHECK-NEXT: ret void
   Test1 *ptr = test1_helper();
   char *pc = ptr.PropertyReturnsInnerPointer;
@@ -236,26 +236,26 @@
   // CHECK:      [[PTR:%.*]] = alloca [[PTR_T:%.*]]*, align 8
   // CHECK:      [[PC:%.*]] = alloca i8*, align 8
   // CHECK:      [[PTRPTR1:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK:      call void @llvm.lifetime.start(i64 8, i8* [[PTRPTR1]])
+  // CHECK:      call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PTRPTR1]])
   // CHECK:      [[T0:%.*]] = call [[TEST1:%.*]]* @test1_helper()
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]])
   // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST1]]*
   // CHECK-NEXT: store [[TEST1]]* [[T3]]
   // CHECK-NEXT: [[PCPTR1:%.*]] = bitcast i8** [[PC]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[PCPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PCPTR1]])
   // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[SEVEN:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_
   // CHECK-NEXT: [[EIGHT:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[CALL1:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* [[EIGHT]], i8* [[SEVEN]])
   // CHECK-NEXT: store i8* [[CALL1]], i8**
   // CHECK-NEXT: [[PCPTR2:%.*]] = bitcast i8** [[PC]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PCPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PCPTR2]])
   // CHECK-NEXT: [[NINE:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[TEN:%.*]] = bitcast [[TEST1]]* [[NINE]] to i8*
   // CHECK-NEXT: call void @objc_release(i8* [[TEN]])
   // CHECK-NEXT: [[PTRPTR2:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTRPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTRPTR2]])
   // CHECK-NEXT: ret void
   PRECISE_LIFETIME Test1 *ptr = test1_helper();
   char *pc = [ptr PropertyReturnsInnerPointer];
@@ -266,26 +266,26 @@
   // CHECK:      [[PTR:%.*]] = alloca [[PTR_T:%.*]]*, align 8
   // CHECK:      [[PC:%.*]] = alloca i8*, align 8
   // CHECK:      [[PTRPTR1:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK:      call void @llvm.lifetime.start(i64 8, i8* [[PTRPTR1]])
+  // CHECK:      call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PTRPTR1]])
   // CHECK:      [[T0:%.*]] = call [[TEST1:%.*]]* @test1_helper()
   // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]])
   // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST1]]*
   // CHECK-NEXT: store [[TEST1]]* [[T3]]
   // CHECK-NEXT: [[PCPTR1:%.*]] = bitcast i8** [[PC]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[PCPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PCPTR1]])
   // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[SEVEN:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_
   // CHECK-NEXT: [[EIGHT:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
   // CHECK-NEXT: [[CALL1:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* [[EIGHT]], i8* [[SEVEN]])
   // CHECK-NEXT: store i8* [[CALL1]], i8**
   // CHECK-NEXT: [[PCPTR2:%.*]] = bitcast i8** [[PC]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PCPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PCPTR2]])
   // CHECK-NEXT: [[NINE:%.*]] = load [[TEST1]]*, [[TEST1]]**
   // CHECK-NEXT: [[TEN:%.*]] = bitcast [[TEST1]]* [[NINE]] to i8*
   // CHECK-NEXT: call void @objc_release(i8* [[TEN]])
   // CHECK-NEXT: [[PTRPTR2:%.*]] = bitcast [[PTR_T]]** [[PTR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTRPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTRPTR2]])
   // CHECK-NEXT: ret void
   PRECISE_LIFETIME Test1 *ptr = test1_helper();
   char *pc = ptr.PropertyReturnsInnerPointer;
Index: test/CodeGenObjC/arc-literals.m
===================================================================
--- test/CodeGenObjC/arc-literals.m
+++ test/CodeGenObjC/arc-literals.m
@@ -27,13 +27,13 @@
   // CHECK: call i8* @objc_retainAutoreleasedReturnValue
   id charlit = @'a';
   // CHECK: call void @objc_release
-  // CHECK: call void @llvm.lifetime.end
+  // CHECK: call void @llvm.lifetime.end.p0i8
   // CHECK: call void @objc_release
-  // CHECK: call void @llvm.lifetime.end
+  // CHECK: call void @llvm.lifetime.end.p0i8
   // CHECK: call void @objc_release
-  // CHECK: call void @llvm.lifetime.end
+  // CHECK: call void @llvm.lifetime.end.p0i8
   // CHECK: call void @objc_release
-  // CHECK: call void @llvm.lifetime.end
+  // CHECK: call void @llvm.lifetime.end.p0i8
   // CHECK-NEXT: ret void
 }
 
Index: test/CodeGenObjC/arc-bridged-cast.m
===================================================================
--- test/CodeGenObjC/arc-bridged-cast.m
+++ test/CodeGenObjC/arc-bridged-cast.m
@@ -32,7 +32,7 @@
   *i = 17;
   // CHECK: call void @objc_release
   // CHECK-NEXT: bitcast
-  // CHECK-NEXT: call void @llvm.lifetime.end
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8
   // CHECK-NEXT: ret void
 }
 
@@ -53,7 +53,7 @@
   *i = 17;
   // CHECK: call void @objc_release
   // CHECK-NEXT: bitcast
-  // CHECK-NEXT: call void @llvm.lifetime.end
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8
   // CHECK-NEXT: ret void
 }
 
@@ -72,15 +72,15 @@
   // CHECK: store i32 17
   *i = 17;
   // CHECK-NEXT: bitcast
-  // CHECK-NEXT: call void @llvm.lifetime.end
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8
   // CHECK-NEXT: ret void
 }
 
 // CHECK-LABEL: define void @bridge_of_cf
 void bridge_of_cf(int *i) {
   // CHECK: store i32 7
   *i = 7;
-  // CHECK: call void @llvm.lifetime.start
+  // CHECK: call void @llvm.lifetime.start.p0i8
   // CHECK-NEXT: call i8* @CreateSomething()
   CFTypeRef cf1 = (__bridge CFTypeRef)CreateSomething();
   // CHECK-NOT: retain
@@ -93,7 +93,7 @@
   // CHECK: store i32 17
   *i = 17;
   // CHECK-NEXT: bitcast
-  // CHECK-NEXT: call void @llvm.lifetime.end
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8
   // CHECK-NEXT: ret void
 }
 
Index: test/CodeGenObjC/arc-blocks.m
===================================================================
--- test/CodeGenObjC/arc-blocks.m
+++ test/CodeGenObjC/arc-blocks.m
@@ -75,7 +75,7 @@
   // CHECK-NEXT: bitcast i8*
   // CHECK-NEXT: store void (i8**)* {{%.*}}, void (i8**)** [[SINK]]
   // CHECK-NEXT: [[STRONGPTR1:%.*]] = bitcast i8** [[STRONG]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[STRONGPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[STRONGPTR1]])
   // CHECK-NEXT: store i8* null, i8** [[STRONG]]
 
   // CHECK-NEXT: load void (i8**)*, void (i8**)** [[SINK]]
@@ -97,7 +97,7 @@
   // CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[STRONG]]
   // CHECK-NEXT: call void @objc_release(i8* [[T0]])
   // CHECK-NEXT: [[STRONGPTR2:%.*]] = bitcast i8** [[STRONG]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[STRONGPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[STRONGPTR2]])
 
   // CHECK-NEXT: load void (i8**)*, void (i8**)** [[SINK]]
   // CHECK-NEXT: bitcast
@@ -172,7 +172,7 @@
   // CHECK:      [[VAR:%.*]] = alloca i8*
   // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]],
   // CHECK-NEXT: [[VARPTR1:%.*]] = bitcast i8** [[VAR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[VARPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[VARPTR1]])
   // CHECK: [[T0:%.*]] = call i8* @test5_source()
   // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]])
   // CHECK-NEXT: store i8* [[T1]], i8** [[VAR]],
@@ -185,7 +185,7 @@
   // CHECK-NEXT: [[T0:%.*]] = bitcast [[BLOCK_T]]* [[BLOCK]] to
   // CHECK: call void @test5_helper
   // CHECK-NEXT: [[VARPTR2:%.*]] = bitcast i8** [[VAR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[VARPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[VARPTR2]])
   // CHECK-NEXT: ret void
 }
 
@@ -199,7 +199,7 @@
   // CHECK:      [[VAR:%.*]] = alloca [[BYREF_T:%.*]],
   // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]],
   // CHECK-NEXT: [[VARPTR1:%.*]] = bitcast [[BYREF_T]]* [[VAR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 48, i8* [[VARPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 48, i8* [[VARPTR1]])
   // CHECK:      [[T0:%.*]] = getelementptr inbounds [[BYREF_T]], [[BYREF_T]]* [[VAR]], i32 0, i32 2
   // 0x02000000 - has copy/dispose helpers weak
   // CHECK-NEXT: store i32 1107296256, i32* [[T0]]
@@ -218,7 +218,7 @@
   // CHECK-NEXT: call void @_Block_object_dispose(i8* [[T0]], i32 8)
   // CHECK-NEXT: call void @objc_destroyWeak(i8** [[SLOT]])
   // CHECK-NEXT: [[VARPTR2:%.*]] = bitcast [[BYREF_T]]* [[VAR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 48, i8* [[VARPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 48, i8* [[VARPTR2]])
   // CHECK-NEXT: ret void
 
   // CHECK-LABEL:    define internal void @__Block_byref_object_copy_.{{[0-9]+}}(i8*, i8*) #{{[0-9]+}} {
@@ -506,7 +506,7 @@
   // CHECK-NEXT: [[T0:%.*]] = call i8* @objc_retain(i8* {{%.*}})
   // CHECK-NEXT: store i8* [[T0]], i8** [[X]], align 8
   // CHECK-NEXT: [[BPTR1:%.*]] = bitcast void ()** [[B]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[BPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[BPTR1]])
   // CHECK-NEXT: [[CLEANUP_ADDR:%.*]] = getelementptr inbounds [[BLOCK_T]], [[BLOCK_T]]* [[BLOCK]], i32 0, i32 5
   // CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[X]], align 8
   // CHECK-NEXT: [[T1:%.*]] = icmp ne i8* [[T0]], null
@@ -533,7 +533,7 @@
   // CHECK-NEXT: [[T1:%.*]] = bitcast void ()* [[T0]] to i8*
   // CHECK-NEXT: call void @objc_release(i8* [[T1]])
   // CHECK-NEXT: [[BPTR2:%.*]] = bitcast void ()** [[B]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[BPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[BPTR2]])
 
   // CHECK-NEXT: [[T0:%.*]] = load i1, i1* [[CLEANUP_ACTIVE]]
   // CHECK-NEXT: br i1 [[T0]]
@@ -566,7 +566,7 @@
   // CHECK: [[BLKVAR:%.*]]  = alloca void ()*, align 8
   // CHECK-NEXT:  [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]],
   // CHECK-NEXT:  [[BLKVARPTR1:%.*]] = bitcast void ()** [[BLKVAR]] to i8*
-  // CHECK-NEXT:  call void @llvm.lifetime.start(i64 8, i8* [[BLKVARPTR1]])
+  // CHECK-NEXT:  call void @llvm.lifetime.start.p0i8(i64 8, i8* [[BLKVARPTR1]])
   // CHECK-NEXT:  [[SLOTREL:%.*]] = getelementptr inbounds [[BLOCK_T]], [[BLOCK_T]]* [[BLOCK]], i32 0, i32 5
   // CHECK-NEXT:  store void ()* null, void ()** [[BLKVAR]], align 8
 }
Index: test/CodeGenCXX/stack-reuse.cpp
===================================================================
--- test/CodeGenCXX/stack-reuse.cpp
+++ test/CodeGenCXX/stack-reuse.cpp
@@ -34,38 +34,38 @@
 
 void small_rvoed_unnamed_temporary_object() {
 // CHECK-LABEL: define void @small_rvoed_unnamed_temporary_object
-// CHECK: call void @llvm.lifetime.start
+// CHECK: call void @llvm.lifetime.start.p0i8
 // CHECK: call void @_Z9foo_smallv
-// CHECK: call void @llvm.lifetime.end
-// CHECK: call void @llvm.lifetime.start
+// CHECK: call void @llvm.lifetime.end.p0i8
+// CHECK: call void @llvm.lifetime.start.p0i8
 // CHECK: call void @_Z9foo_smallv
-// CHECK: call void @llvm.lifetime.end
+// CHECK: call void @llvm.lifetime.end.p0i8
 
   foo_small();
   foo_small();
 }
 
 void large_rvoed_unnamed_temporary_object() {
 // CHECK-LABEL: define void @large_rvoed_unnamed_temporary_object
-// CHECK: call void @llvm.lifetime.start
+// CHECK: call void @llvm.lifetime.start.p0i8
 // CHECK: call void @_Z9foo_largev
-// CHECK: call void @llvm.lifetime.end
-// CHECK: call void @llvm.lifetime.start
+// CHECK: call void @llvm.lifetime.end.p0i8
+// CHECK: call void @llvm.lifetime.start.p0i8
 // CHECK: call void @_Z9foo_largev
-// CHECK: call void @llvm.lifetime.end
+// CHECK: call void @llvm.lifetime.end.p0i8
 
   foo_large();
   foo_large();
 }
 
 void small_rvoed_named_temporary_object() {
 // CHECK-LABEL: define void @small_rvoed_named_temporary_object
-// CHECK: call void @llvm.lifetime.start
+// CHECK: call void @llvm.lifetime.start.p0i8
 // CHECK: call void @_Z9foo_smallv
-// CHECK: call void @llvm.lifetime.end
-// CHECK: call void @llvm.lifetime.start
+// CHECK: call void @llvm.lifetime.end.p0i8
+// CHECK: call void @llvm.lifetime.start.p0i8
 // CHECK: call void @_Z9foo_smallv
-// CHECK: call void @llvm.lifetime.end
+// CHECK: call void @llvm.lifetime.end.p0i8
 
   {
     S_small s = foo_small();
@@ -77,12 +77,12 @@
 
 void large_rvoed_named_temporary_object() {
 // CHECK-LABEL: define void @large_rvoed_named_temporary_object
-// CHECK: call void @llvm.lifetime.start
+// CHECK: call void @llvm.lifetime.start.p0i8
 // CHECK: call void @_Z9foo_largev
-// CHECK: call void @llvm.lifetime.end
-// CHECK: call void @llvm.lifetime.start
+// CHECK: call void @llvm.lifetime.end.p0i8
+// CHECK: call void @llvm.lifetime.start.p0i8
 // CHECK: call void @_Z9foo_largev
-// CHECK: call void @llvm.lifetime.end
+// CHECK: call void @llvm.lifetime.end.p0i8
 
   {
     S_large s = foo_large();
@@ -94,12 +94,12 @@
 
 void small_auto_object() {
 // CHECK-LABEL: define void @small_auto_object
-// CHECK: call void @llvm.lifetime.start
+// CHECK: call void @llvm.lifetime.start.p0i8
 // CHECK: call void @_Z9bar_smallP7S_small
-// CHECK: call void @llvm.lifetime.end
-// CHECK: call void @llvm.lifetime.start
+// CHECK: call void @llvm.lifetime.end.p0i8
+// CHECK: call void @llvm.lifetime.start.p0i8
 // CHECK: call void @_Z9bar_smallP7S_small
-// CHECK: call void @llvm.lifetime.end
+// CHECK: call void @llvm.lifetime.end.p0i8
 
   {
     S_small s;
@@ -113,12 +113,12 @@
 
 void large_auto_object() {
 // CHECK-LABEL: define void @large_auto_object
-// CHECK: call void @llvm.lifetime.start
+// CHECK: call void @llvm.lifetime.start.p0i8
 // CHECK: call void @_Z9bar_largeP7S_large
-// CHECK: call void @llvm.lifetime.end
-// CHECK: call void @llvm.lifetime.start
+// CHECK: call void @llvm.lifetime.end.p0i8
+// CHECK: call void @llvm.lifetime.start.p0i8
 // CHECK: call void @_Z9bar_largeP7S_large
-// CHECK: call void @llvm.lifetime.end
+// CHECK: call void @llvm.lifetime.end.p0i8
 
   {
     S_large s;
Index: test/CodeGenCXX/stack-reuse-miscompile.cpp
===================================================================
--- test/CodeGenCXX/stack-reuse-miscompile.cpp
+++ test/CodeGenCXX/stack-reuse-miscompile.cpp
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -triple armv7l-unknown-linux-gnueabihf -emit-llvm -O1 -disable-llvm-passes -std=c++03 %s -o - | FileCheck %s
 
-// This test should not to generate llvm.lifetime.start/llvm.lifetime.end for
+// This test should not to generate llvm.lifetime.start.p0i8/llvm.lifetime.end.p0i8 for
 // f function because all temporary objects in this function are used for the
 // final result
 
Index: test/CodeGenCXX/nrvo.cpp
===================================================================
--- test/CodeGenCXX/nrvo.cpp
+++ test/CodeGenCXX/nrvo.cpp
@@ -57,21 +57,21 @@
 
   // CHECK: call {{.*}} @_ZN1XC1Ev
   // CHECK-NEXT: {{.*}} getelementptr inbounds %class.X, %class.X* %y, i32 0, i32 0
-  // CHECK-NEXT: call void @llvm.lifetime.start
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8
   // CHECK-NEXT: call {{.*}} @_ZN1XC1Ev
   // CHECK: call {{.*}} @_ZN1XC1ERKS_
   // CHECK: call {{.*}} @_ZN1XC1ERKS_
   // CHECK: call {{.*}} @_ZN1XD1Ev
-  // CHECK-NEXT: call void @llvm.lifetime.end
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8
   // CHECK: call {{.*}} @_ZN1XD1Ev
-  // CHECK-NEXT: call void @llvm.lifetime.end
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8
   // CHECK: ret void
 
   // The block ordering in the -fexceptions IR is unfortunate.
 
-  // CHECK-EH:      call void @llvm.lifetime.start
+  // CHECK-EH:      call void @llvm.lifetime.start.p0i8
   // CHECK-EH-NEXT: call {{.*}} @_ZN1XC1Ev
-  // CHECK-EH:      call void @llvm.lifetime.start
+  // CHECK-EH:      call void @llvm.lifetime.start.p0i8
   // CHECK-EH-NEXT: invoke {{.*}} @_ZN1XC1Ev
   // -> %invoke.cont, %lpad
 
@@ -106,9 +106,9 @@
   // CHECK-EH-11: call   {{.*}} @_ZN1XD1Ev
 
   // %invoke.cont11: normal cleanup for 'x'
-  // CHECK-EH:      call void @llvm.lifetime.end
+  // CHECK-EH:      call void @llvm.lifetime.end.p0i8
   // CHECK-EH-NEXT: call {{.*}} @_ZN1XD1Ev
-  // CHECK-EH-NEXT: call void @llvm.lifetime.end
+  // CHECK-EH-NEXT: call void @llvm.lifetime.end.p0i8
   // CHECK-EH-NEXT: ret void
 
   // %eh.cleanup:  EH cleanup for 'x'
@@ -182,11 +182,11 @@
   return a;
   // CHECK:      [[A:%.*]] = alloca [[X:%.*]], align 8
   // CHECK-NEXT: [[PTR:%.*]] = getelementptr inbounds %class.X, %class.X* [[A]], i32 0, i32 0
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 1, i8* nonnull [[PTR]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[PTR]])
   // CHECK-NEXT: call {{.*}} @_ZN1XC1Ev([[X]]* nonnull [[A]])
   // CHECK-NEXT: call {{.*}} @_ZN1XC1ERKS_([[X]]* {{%.*}}, [[X]]* nonnull dereferenceable({{[0-9]+}}) [[A]])
   // CHECK-NEXT: call {{.*}} @_ZN1XD1Ev([[X]]* nonnull [[A]])
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 1, i8* nonnull [[PTR]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[PTR]])
   // CHECK-NEXT: ret void
 }
 
Index: test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp
===================================================================
--- test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp
+++ test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp
@@ -259,14 +259,14 @@
 // WIN32-LIFETIME-LABEL: define void @"\01?f@lifetime_marker@@YAXXZ"()
 // WIN32-LIFETIME: %[[c:.*]] = alloca %"struct.lifetime_marker::C"
 // WIN32-LIFETIME: %[[bc0:.*]] = bitcast %"struct.lifetime_marker::C"* %c to i8*
-// WIN32-LIFETIME: call void @llvm.lifetime.start(i64 1, i8* %[[bc0]])
+// WIN32-LIFETIME: call void @llvm.lifetime.start.p0i8(i64 1, i8* %[[bc0]])
 // WIN32-LIFETIME: invoke void @"\01?g@lifetime_marker@@YAXXZ"()
 // WIN32-LIFETIME-NEXT: to label %[[cont:[^ ]*]] unwind label %[[lpad0:[^ ]*]]
 //
 // WIN32-LIFETIME: [[cont]]
 // WIN32-LIFETIME: call x86_thiscallcc void @"\01??1C@lifetime_marker@@QAE@XZ"({{.*}})
 // WIN32-LIFETIME: %[[bc1:.*]] = bitcast %"struct.lifetime_marker::C"* %[[c]] to i8*
-// WIN32-LIFETIME: call void @llvm.lifetime.end(i64 1, i8* %[[bc1]])
+// WIN32-LIFETIME: call void @llvm.lifetime.end.p0i8(i64 1, i8* %[[bc1]])
 //
 // WIN32-LIFETIME: [[lpad0]]
 // WIN32-LIFETIME-NEXT: cleanuppad
@@ -276,7 +276,7 @@
 // WIN32-LIFETIME: [[lpad1]]
 // WIN32-LIFETIME-NEXT: cleanuppad
 // WIN32-LIFETIME: %[[bc2:.*]] = bitcast %"struct.lifetime_marker::C"* %[[c]] to i8*
-// WIN32-LIFETIME: call void @llvm.lifetime.end(i64 1, i8* %[[bc2]])
+// WIN32-LIFETIME: call void @llvm.lifetime.end.p0i8(i64 1, i8* %[[bc2]])
 }
 
 struct class_2 {
Index: test/CodeGenCXX/destructors.cpp
===================================================================
--- test/CodeGenCXX/destructors.cpp
+++ test/CodeGenCXX/destructors.cpp
@@ -309,7 +309,7 @@
   // CHECK5v03-NEXT: [[EXN:%.*]] = alloca i8*
   // CHECK5v03-NEXT: [[SEL:%.*]] = alloca i32
   // CHECK5-NEXT: [[PELEMS:%.*]] = bitcast [5 x [[A]]]* [[ELEMS]] to i8*
-  // CHECK5-NEXT: call void @llvm.lifetime.start(i64 5, i8* [[PELEMS]])
+  // CHECK5-NEXT: call void @llvm.lifetime.start.p0i8(i64 5, i8* [[PELEMS]])
   // CHECK5-NEXT: [[BEGIN:%.*]] = getelementptr inbounds [5 x [[A]]], [5 x [[A]]]* [[ELEMS]], i32 0, i32 0
   // CHECK5-NEXT: [[END:%.*]] = getelementptr inbounds [[A]], [[A]]* [[BEGIN]], i64 5
   // CHECK5-NEXT: br label
@@ -319,7 +319,7 @@
   // CHECK5v11-NEXT: call   void @_ZN5test51AD1Ev([[A]]* [[ELT]])
   // CHECK5:      [[T0:%.*]] = icmp eq [[A]]* [[ELT]], [[BEGIN]]
   // CHECK5-NEXT: br i1 [[T0]],
-  // CHECK5:      call void @llvm.lifetime.end
+  // CHECK5:      call void @llvm.lifetime.end.p0i8
   // CHECK5-NEXT: ret void
   // lpad
   // CHECK5v03:      [[EMPTY:%.*]] = icmp eq [[A]]* [[BEGIN]], [[ELT]]
@@ -484,29 +484,29 @@
 // CHECK6: {{^}}invoke.cont
 // CHECK6: call void @_ZN6test112S1D1Ev(%"struct.test11::S1"* [[T1]])
 // CHECK6: [[BC1:%[a-z0-9]+]] = bitcast %"struct.test11::S1"* [[T1]] to i8*
-// CHECK6: call void @llvm.lifetime.end(i64 32, i8* [[BC1]])
+// CHECK6: call void @llvm.lifetime.end.p0i8(i64 32, i8* [[BC1]])
 // CHECK6: {{^}}lpad
 // CHECK6: call void @_ZN6test112S1D1Ev(%"struct.test11::S1"* [[T1]])
 // CHECK6: [[BC2:%[a-z0-9]+]] = bitcast %"struct.test11::S1"* [[T1]] to i8*
-// CHECK6: call void @llvm.lifetime.end(i64 32, i8* [[BC2]])
+// CHECK6: call void @llvm.lifetime.end.p0i8(i64 32, i8* [[BC2]])
 
 // CHECK6: {{^}}invoke.cont
 // CHECK6: call void @_ZN6test112S1D1Ev(%"struct.test11::S1"* [[T2]])
 // CHECK6: [[BC3:%[a-z0-9]+]] = bitcast %"struct.test11::S1"* [[T2]] to i8*
-// CHECK6: call void @llvm.lifetime.end(i64 32, i8* [[BC3]])
+// CHECK6: call void @llvm.lifetime.end.p0i8(i64 32, i8* [[BC3]])
 // CHECK6: {{^}}lpad
 // CHECK6: call void @_ZN6test112S1D1Ev(%"struct.test11::S1"* [[T2]])
 // CHECK6: [[BC4:%[a-z0-9]+]] = bitcast %"struct.test11::S1"* [[T2]] to i8*
-// CHECK6: call void @llvm.lifetime.end(i64 32, i8* [[BC4]])
+// CHECK6: call void @llvm.lifetime.end.p0i8(i64 32, i8* [[BC4]])
 
 // CHECK6: {{^}}invoke.cont
 // CHECK6: call void @_ZN6test112S1D1Ev(%"struct.test11::S1"* [[T3]])
 // CHECK6: [[BC5:%[a-z0-9]+]] = bitcast %"struct.test11::S1"* [[T3]] to i8*
-// CHECK6: call void @llvm.lifetime.end(i64 32, i8* [[BC5]])
+// CHECK6: call void @llvm.lifetime.end.p0i8(i64 32, i8* [[BC5]])
 // CHECK6: {{^}}lpad
 // CHECK6: call void @_ZN6test112S1D1Ev(%"struct.test11::S1"* [[T3]])
 // CHECK6: [[BC6:%[a-z0-9]+]] = bitcast %"struct.test11::S1"* [[T3]] to i8*
-// CHECK6: call void @llvm.lifetime.end(i64 32, i8* [[BC6]])
+// CHECK6: call void @llvm.lifetime.end.p0i8(i64 32, i8* [[BC6]])
 
   struct S1 {
     ~S1();
Index: test/CodeGen/temporary-lifetime.cpp
===================================================================
--- test/CodeGen/temporary-lifetime.cpp
+++ test/CodeGen/temporary-lifetime.cpp
@@ -21,27 +21,27 @@
 
 void Test1() {
   // CHECK-DTOR-LABEL: Test1
-  // CHECK-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
+  // CHECK-DTOR: call void @llvm.lifetime.start.p0i8(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
   // CHECK-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR:[^ ]+]])
   // CHECK-DTOR: call void @_Z3FooIRK1AEvOT_
   // CHECK-DTOR: call void @_ZN1AD1Ev(%struct.A* nonnull %[[VAR]])
-  // CHECK-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR]])
-  // CHECK-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
+  // CHECK-DTOR: call void @llvm.lifetime.end.p0i8(i64 1024, i8* nonnull %[[ADDR]])
+  // CHECK-DTOR: call void @llvm.lifetime.start.p0i8(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
   // CHECK-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR:[^ ]+]])
   // CHECK-DTOR: call void @_Z3FooIRK1AEvOT_
   // CHECK-DTOR: call void @_ZN1AD1Ev(%struct.A* nonnull %[[VAR]])
-  // CHECK-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR]])
+  // CHECK-DTOR: call void @llvm.lifetime.end.p0i8(i64 1024, i8* nonnull %[[ADDR]])
   // CHECK-DTOR: }
 
   // CHECK-NO-DTOR-LABEL: Test1
-  // CHECK-NO-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
+  // CHECK-NO-DTOR: call void @llvm.lifetime.start.p0i8(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
   // CHECK-NO-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR:[^ ]+]])
   // CHECK-NO-DTOR: call void @_Z3FooIRK1AEvOT_
-  // CHECK-NO-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR]])
-  // CHECK-NO-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
+  // CHECK-NO-DTOR: call void @llvm.lifetime.end.p0i8(i64 1024, i8* nonnull %[[ADDR]])
+  // CHECK-NO-DTOR: call void @llvm.lifetime.start.p0i8(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
   // CHECK-NO-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR:[^ ]+]])
   // CHECK-NO-DTOR: call void @_Z3FooIRK1AEvOT_
-  // CHECK-NO-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR]])
+  // CHECK-NO-DTOR: call void @llvm.lifetime.end.p0i8(i64 1024, i8* nonnull %[[ADDR]])
   // CHECK-NO-DTOR: }
   {
     const A &a = A{};
@@ -55,27 +55,27 @@
 
 void Test2() {
   // CHECK-DTOR-LABEL: Test2
-  // CHECK-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR1:[0-9]+]])
+  // CHECK-DTOR: call void @llvm.lifetime.start.p0i8(i64 1024, i8* nonnull %[[ADDR1:[0-9]+]])
   // CHECK-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR1:[^ ]+]])
   // CHECK-DTOR: call void @_Z3FooIRK1AEvOT_
-  // CHECK-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR2:[0-9]+]])
+  // CHECK-DTOR: call void @llvm.lifetime.start.p0i8(i64 1024, i8* nonnull %[[ADDR2:[0-9]+]])
   // CHECK-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR2:[^ ]+]])
   // CHECK-DTOR: call void @_Z3FooIRK1AEvOT_
   // CHECK-DTOR: call void @_ZN1AD1Ev(%struct.A* nonnull %[[VAR2]])
-  // CHECK-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR2]])
+  // CHECK-DTOR: call void @llvm.lifetime.end.p0i8(i64 1024, i8* nonnull %[[ADDR2]])
   // CHECK-DTOR: call void @_ZN1AD1Ev(%struct.A* nonnull %[[VAR1]])
-  // CHECK-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR1]])
+  // CHECK-DTOR: call void @llvm.lifetime.end.p0i8(i64 1024, i8* nonnull %[[ADDR1]])
   // CHECK-DTOR: }
 
   // CHECK-NO-DTOR-LABEL: Test2
-  // CHECK-NO-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR1:[0-9]+]])
+  // CHECK-NO-DTOR: call void @llvm.lifetime.start.p0i8(i64 1024, i8* nonnull %[[ADDR1:[0-9]+]])
   // CHECK-NO-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR1:[^ ]+]])
   // CHECK-NO-DTOR: call void @_Z3FooIRK1AEvOT_
-  // CHECK-NO-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR2:[0-9]+]])
+  // CHECK-NO-DTOR: call void @llvm.lifetime.start.p0i8(i64 1024, i8* nonnull %[[ADDR2:[0-9]+]])
   // CHECK-NO-DTOR: call void @_ZN1AC1Ev(%struct.A* nonnull %[[VAR2:[^ ]+]])
   // CHECK-NO-DTOR: call void @_Z3FooIRK1AEvOT_
-  // CHECK-NO-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR2]])
-  // CHECK-NO-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR1]])
+  // CHECK-NO-DTOR: call void @llvm.lifetime.end.p0i8(i64 1024, i8* nonnull %[[ADDR2]])
+  // CHECK-NO-DTOR: call void @llvm.lifetime.end.p0i8(i64 1024, i8* nonnull %[[ADDR1]])
   // CHECK-NO-DTOR: }
   const A &a = A{};
   Foo(a);
@@ -85,17 +85,17 @@
 
 void Test3() {
   // CHECK-DTOR-LABEL: Test3
-  // CHECK-DTOR: call void @llvm.lifetime.start
-  // CHECK-DTOR: call void @llvm.lifetime.start
+  // CHECK-DTOR: call void @llvm.lifetime.start.p0i8
+  // CHECK-DTOR: call void @llvm.lifetime.start.p0i8
 
   // if.then:
-  // CHECK-DTOR: call void @llvm.lifetime.end
+  // CHECK-DTOR: call void @llvm.lifetime.end.p0i8
 
   // cleanup:
-  // CHECK-DTOR: call void @llvm.lifetime.end
+  // CHECK-DTOR: call void @llvm.lifetime.end.p0i8
 
   // cleanup:
-  // CHECK-DTOR: call void @llvm.lifetime.end
+  // CHECK-DTOR: call void @llvm.lifetime.end.p0i8
   // CHECK-DTOR: }
   const A &a = A{};
   if (const A &b = A(a)) {
@@ -107,10 +107,10 @@
 
 void Test4() {
   // CHECK-DTOR-LABEL: Test4
-  // CHECK-DTOR: call void @llvm.lifetime.start
+  // CHECK-DTOR: call void @llvm.lifetime.start.p0i8
 
   // for.cond.cleanup:
-  // CHECK-DTOR: call void @llvm.lifetime.end
+  // CHECK-DTOR: call void @llvm.lifetime.end.p0i8
 
   // for.body:
   // CHECK-DTOR: }
@@ -121,47 +121,47 @@
 
 int Test5() {
   // CHECK-DTOR-LABEL: Test5
-  // CHECK-DTOR: call void @llvm.lifetime.start
+  // CHECK-DTOR: call void @llvm.lifetime.start.p0i8
   // CHECK-DTOR: call i32 @_Z3BazIiET_v()
   // CHECK-DTOR: store
   // CHECK-DTOR: call void @_Z3FooIRKiEvOT_
   // CHECK-DTOR: load
-  // CHECK-DTOR: call void @llvm.lifetime.end
+  // CHECK-DTOR: call void @llvm.lifetime.end.p0i8
   // CHECK-DTOR: }
   const int &a = Baz<int>();
   Foo(a);
   return a;
 }
 
 void Test6() {
   // CHECK-DTOR-LABEL: Test6
-  // CHECK-DTOR: call void @llvm.lifetime.start(i64 {{[0-9]+}}, i8* nonnull %[[ADDR:[0-9]+]])
+  // CHECK-DTOR: call void @llvm.lifetime.start.p0i8(i64 {{[0-9]+}}, i8* nonnull %[[ADDR:[0-9]+]])
   // CHECK-DTOR: call i32 @_Z3BazIiET_v()
   // CHECK-DTOR: store
   // CHECK-DTOR: call void @_Z3FooIiEvOT_
-  // CHECK-DTOR: call void @llvm.lifetime.end(i64 {{[0-9]+}}, i8* nonnull %[[ADDR]])
-  // CHECK-DTOR: call void @llvm.lifetime.start(i64 {{[0-9]+}}, i8* nonnull %[[ADDR:[0-9]+]])
+  // CHECK-DTOR: call void @llvm.lifetime.end.p0i8(i64 {{[0-9]+}}, i8* nonnull %[[ADDR]])
+  // CHECK-DTOR: call void @llvm.lifetime.start.p0i8(i64 {{[0-9]+}}, i8* nonnull %[[ADDR:[0-9]+]])
   // CHECK-DTOR: call i32 @_Z3BazIiET_v()
   // CHECK-DTOR: store
   // CHECK-DTOR: call void @_Z3FooIiEvOT_
-  // CHECK-DTOR: call void @llvm.lifetime.end(i64 {{[0-9]+}}, i8* nonnull %[[ADDR]])
+  // CHECK-DTOR: call void @llvm.lifetime.end.p0i8(i64 {{[0-9]+}}, i8* nonnull %[[ADDR]])
   // CHECK-DTOR: }
   Foo(Baz<int>());
   Foo(Baz<int>());
 }
 
 void Test7() {
   // CHECK-DTOR-LABEL: Test7
-  // CHECK-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
+  // CHECK-DTOR: call void @llvm.lifetime.start.p0i8(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
   // CHECK-DTOR: call void @_Z3BazI1AET_v({{.*}} %[[SLOT:[^ ]+]])
   // CHECK-DTOR: call void @_Z3FooI1AEvOT_({{.*}} %[[SLOT]])
   // CHECK-DTOR: call void @_ZN1AD1Ev(%struct.A* nonnull %[[SLOT]])
-  // CHECK-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR]])
-  // CHECK-DTOR: call void @llvm.lifetime.start(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
+  // CHECK-DTOR: call void @llvm.lifetime.end.p0i8(i64 1024, i8* nonnull %[[ADDR]])
+  // CHECK-DTOR: call void @llvm.lifetime.start.p0i8(i64 1024, i8* nonnull %[[ADDR:[0-9]+]])
   // CHECK-DTOR: call void @_Z3BazI1AET_v({{.*}} %[[SLOT:[^ ]+]])
   // CHECK-DTOR: call void @_Z3FooI1AEvOT_({{.*}} %[[SLOT]])
   // CHECK-DTOR: call void @_ZN1AD1Ev(%struct.A* nonnull %[[SLOT]])
-  // CHECK-DTOR: call void @llvm.lifetime.end(i64 1024, i8* nonnull %[[ADDR]])
+  // CHECK-DTOR: call void @llvm.lifetime.end.p0i8(i64 1024, i8* nonnull %[[ADDR]])
   // CHECK-DTOR: }
   Foo(Baz<A>());
   Foo(Baz<A>());
Index: test/CodeGen/temporary-lifetime-exceptions.cpp
===================================================================
--- test/CodeGen/temporary-lifetime-exceptions.cpp
+++ test/CodeGen/temporary-lifetime-exceptions.cpp
@@ -9,16 +9,16 @@
 void Test1() {
   // CHECK-LABEL: @_Z5Test1v(
   // CHECK: getelementptr
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 1, i8* nonnull [[TMP:[^ ]+]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP:[^ ]+]])
   // CHECK-NEXT: getelementptr
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 1, i8* nonnull [[TMP1:[^ ]+]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP1:[^ ]+]])
 
   // Normal exit
-  // CHECK: call void @llvm.lifetime.end(i64 1, i8* nonnull [[TMP1]])
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 1, i8* nonnull [[TMP]])
+  // CHECK: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP1]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP]])
 
   // Exception exit
-  // CHECK: call void @llvm.lifetime.end(i64 1, i8* nonnull [[TMP1]])
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 1, i8* nonnull [[TMP]])
+  // CHECK: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP1]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP]])
   Baz(Baz(A()));
 }
Index: test/CodeGen/lifetime2.c
===================================================================
--- test/CodeGen/lifetime2.c
+++ test/CodeGen/lifetime2.c
@@ -6,37 +6,37 @@
 extern int bar(char *A, int n);
 
 // CHECK-LABEL: @foo
-// O0-NOT: @llvm.lifetime.start
+// O0-NOT: @llvm.lifetime.start.p0i8
 int foo (int n) {
   if (n) {
-// O2: @llvm.lifetime.start
+// O2: @llvm.lifetime.start.p0i8
     char A[100];
     return bar(A, 1);
   } else {
-// O2: @llvm.lifetime.start
+// O2: @llvm.lifetime.start.p0i8
     char A[100];
     return bar(A, 2);
   }
 }
 
 // CHECK-LABEL: @no_goto_bypass
 void no_goto_bypass() {
-  // O2: @llvm.lifetime.start(i64 1
+  // O2: @llvm.lifetime.start.p0i8(i64 1
   char x;
 l1:
   bar(&x, 1);
   char y[5];
   bar(y, 5);
   goto l1;
   // Infinite loop
-  // O2-NOT: @llvm.lifetime.end(
+  // O2-NOT: @llvm.lifetime.end.p0i8(
 }
 
 // CHECK-LABEL: @goto_bypass
 void goto_bypass() {
   {
-    // O2-NOT: @llvm.lifetime.start(i64 1
-    // O2-NOT: @llvm.lifetime.end(i64 1
+    // O2-NOT: @llvm.lifetime.start.p0i8(i64 1
+    // O2-NOT: @llvm.lifetime.end.p0i8(i64 1
     char x;
   l1:
     bar(&x, 1);
@@ -48,16 +48,16 @@
 void no_switch_bypass(int n) {
   switch (n) {
   case 1: {
-    // O2: @llvm.lifetime.start(i64 1
-    // O2: @llvm.lifetime.end(i64 1
+    // O2: @llvm.lifetime.start.p0i8(i64 1
+    // O2: @llvm.lifetime.end.p0i8(i64 1
     char x;
     bar(&x, 1);
     break;
   }
   case 2:
     n = n;
-    // O2: @llvm.lifetime.start(i64 5
-    // O2: @llvm.lifetime.end(i64 5
+    // O2: @llvm.lifetime.start.p0i8(i64 5
+    // O2: @llvm.lifetime.end.p0i8(i64 5
     char y[5];
     bar(y, 5);
     break;
@@ -69,8 +69,8 @@
   switch (n) {
   case 1:
     n = n;
-    // O2-NOT: @llvm.lifetime.start(i64 1
-    // O2-NOT: @llvm.lifetime.end(i64 1
+    // O2-NOT: @llvm.lifetime.start.p0i8(i64 1
+    // O2-NOT: @llvm.lifetime.end.p0i8(i64 1
     char x;
     bar(&x, 1);
     break;
@@ -93,8 +93,8 @@
 // O2-LABEL: @jump_backward_over_declaration(
 // O2: %[[p:.*]] = alloca i32*
 // O2: %[[v0:.*]] = bitcast i32** %[[p]] to i8*
-// O2: call void @llvm.lifetime.start(i64 {{.*}}, i8* %[[v0]])
-// O2-NOT: call void @llvm.lifetime.start(
+// O2: call void @llvm.lifetime.start.p0i8(i64 {{.*}}, i8* %[[v0]])
+// O2-NOT: call void @llvm.lifetime.start.p0i8(
 
 extern void foo2(int p);
 
Index: test/CodeGen/lifetime.c
===================================================================
--- test/CodeGen/lifetime.c
+++ test/CodeGen/lifetime.c
@@ -15,9 +15,9 @@
 // O1: lifetime_test
 // O2: lifetime_test
 // O3: lifetime_test
-// O0-NOT: @llvm.lifetime.start
-// O1: @llvm.lifetime.start
-// O2: @llvm.lifetime.start
-// O3: @llvm.lifetime.start
+// O0-NOT: @llvm.lifetime.start.p0i8
+// O1: @llvm.lifetime.start.p0i8
+// O2: @llvm.lifetime.start.p0i8
+// O3: @llvm.lifetime.start.p0i8
   helper_no_markers();
 }
Index: test/CodeGen/lifetime-asan.c
===================================================================
--- test/CodeGen/lifetime-asan.c
+++ test/CodeGen/lifetime-asan.c
@@ -5,17 +5,17 @@
 
 extern int bar(char *A, int n);
 
-// CHECK-O0-NOT: @llvm.lifetime.start
+// CHECK-O0-NOT: @llvm.lifetime.start.p0i8
 int foo(int n) {
   if (n) {
-    // CHECK-ASAN-USE-AFTER-SCOPE: @llvm.lifetime.start(i64 10, i8* {{.*}})
+    // CHECK-ASAN-USE-AFTER-SCOPE: @llvm.lifetime.start.p0i8(i64 10, i8* {{.*}})
     char A[10];
     return bar(A, 1);
-    // CHECK-ASAN-USE-AFTER-SCOPE: @llvm.lifetime.end(i64 10, i8* {{.*}})
+    // CHECK-ASAN-USE-AFTER-SCOPE: @llvm.lifetime.end.p0i8(i64 10, i8* {{.*}})
   } else {
-    // CHECK-ASAN-USE-AFTER-SCOPE: @llvm.lifetime.start(i64 20, i8* {{.*}})
+    // CHECK-ASAN-USE-AFTER-SCOPE: @llvm.lifetime.start.p0i8(i64 20, i8* {{.*}})
     char A[20];
     return bar(A, 2);
-    // CHECK-ASAN-USE-AFTER-SCOPE: @llvm.lifetime.end(i64 20, i8* {{.*}})
+    // CHECK-ASAN-USE-AFTER-SCOPE: @llvm.lifetime.end.p0i8(i64 20, i8* {{.*}})
   }
 }
Index: test/CodeGen/cleanup-destslot-simple.c
===================================================================
--- test/CodeGen/cleanup-destslot-simple.c
+++ test/CodeGen/cleanup-destslot-simple.c
@@ -13,9 +13,9 @@
   return *p;
 // CHECK: [[X:%.*]] = alloca i32
 // CHECK: [[P:%.*]] = alloca i32*
-// LIFETIME: call void @llvm.lifetime.start(i64 4, i8* nonnull %{{.*}}){{( #[0-9]+)?}}, !dbg
-// LIFETIME: call void @llvm.lifetime.start(i64 8, i8* nonnull %{{.*}}){{( #[0-9]+)?}}, !dbg
+// LIFETIME: call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %{{.*}}){{( #[0-9]+)?}}, !dbg
+// LIFETIME: call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %{{.*}}){{( #[0-9]+)?}}, !dbg
 // CHECK-NOT: store i32 %{{.*}}, i32* %cleanup.dest.slot
-// LIFETIME: call void @llvm.lifetime.end(i64 8, {{.*}}){{( #[0-9]+)?}}, !dbg
-// LIFETIME: call void @llvm.lifetime.end(i64 4, {{.*}}){{( #[0-9]+)?}}, !dbg
+// LIFETIME: call void @llvm.lifetime.end.p0i8(i64 8, {{.*}}){{( #[0-9]+)?}}, !dbg
+// LIFETIME: call void @llvm.lifetime.end.p0i8(i64 4, {{.*}}){{( #[0-9]+)?}}, !dbg
 }
Index: lib/CodeGen/CodeGenTypeCache.h
===================================================================
--- lib/CodeGen/CodeGenTypeCache.h
+++ lib/CodeGen/CodeGenTypeCache.h
@@ -60,6 +60,12 @@
     llvm::PointerType *Int8PtrPtrTy;
   };
 
+  /// void* in alloca address space
+  union {
+    llvm::PointerType *AllocaVoidPtrTy;
+    llvm::PointerType *AllocaInt8PtrTy;
+  };
+
   /// The size and alignment of the builtin C type 'int'.  This comes
   /// up enough in various ABI lowering tasks to be worth pre-computing.
   union {
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -111,6 +111,8 @@
     C.getTargetInfo().getMaxPointerWidth());
   Int8PtrTy = Int8Ty->getPointerTo(0);
   Int8PtrPtrTy = Int8PtrTy->getPointerTo(0);
+  AllocaInt8PtrTy = Int8Ty->getPointerTo(
+      M.getDataLayout().getAllocaAddrSpace());
 
   RuntimeCC = getTargetCodeGenInfo().getABIInfo().getRuntimeCC();
   BuiltinCC = getTargetCodeGenInfo().getABIInfo().getBuiltinCC();
Index: lib/CodeGen/CGDecl.cpp
===================================================================
--- lib/CodeGen/CGDecl.cpp
+++ lib/CodeGen/CGDecl.cpp
@@ -924,15 +924,15 @@
     return nullptr;
 
   llvm::Value *SizeV = llvm::ConstantInt::get(Int64Ty, Size);
-  Addr = Builder.CreateBitCast(Addr, Int8PtrTy);
+  Addr = Builder.CreateBitCast(Addr, AllocaInt8PtrTy);
   llvm::CallInst *C =
       Builder.CreateCall(CGM.getLLVMLifetimeStartFn(), {SizeV, Addr});
   C->setDoesNotThrow();
   return SizeV;
 }
 
 void CodeGenFunction::EmitLifetimeEnd(llvm::Value *Size, llvm::Value *Addr) {
-  Addr = Builder.CreateBitCast(Addr, Int8PtrTy);
+  Addr = Builder.CreateBitCast(Addr, AllocaInt8PtrTy);
   llvm::CallInst *C =
       Builder.CreateCall(CGM.getLLVMLifetimeEndFn(), {Size, Addr});
   C->setDoesNotThrow();
@@ -1727,16 +1727,22 @@
 /// Lazily declare the @llvm.lifetime.start intrinsic.
 llvm::Constant *CodeGenModule::getLLVMLifetimeStartFn() {
   if (LifetimeStartFn) return LifetimeStartFn;
+  llvm::Type *Tys[] = {llvm::Type::getInt8PtrTy(getLLVMContext(),
+          getModule().getDataLayout().getAllocaAddrSpace()) };
   LifetimeStartFn = llvm::Intrinsic::getDeclaration(&getModule(),
-                                            llvm::Intrinsic::lifetime_start);
+                                            llvm::Intrinsic::lifetime_start,
+                                            Tys);
   return LifetimeStartFn;
 }
 
 /// Lazily declare the @llvm.lifetime.end intrinsic.
 llvm::Constant *CodeGenModule::getLLVMLifetimeEndFn() {
   if (LifetimeEndFn) return LifetimeEndFn;
+  llvm::Type *Tys[] = {llvm::Type::getInt8PtrTy(getLLVMContext(),
+          getModule().getDataLayout().getAllocaAddrSpace()) };
   LifetimeEndFn = llvm::Intrinsic::getDeclaration(&getModule(),
-                                              llvm::Intrinsic::lifetime_end);
+                                              llvm::Intrinsic::lifetime_end,
+                                              Tys);
   return LifetimeEndFn;
 }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to