[clang] eaac0e8 - [NFC][clang] Autogenerate checklines in CodeGenCXX/nrvo.cpp
Roman Lebedev via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 8 07:28:02 PST 2022
Author: Roman Lebedev
Date: 2022-02-08T18:27:54+03:00
New Revision: eaac0e87fb0249f9b87b9929b1afa24504db9792
URL: https://github.com/llvm/llvm-project/commit/eaac0e87fb0249f9b87b9929b1afa24504db9792
DIFF: https://github.com/llvm/llvm-project/commit/eaac0e87fb0249f9b87b9929b1afa24504db9792.diff
LOG: [NFC][clang] Autogenerate checklines in CodeGenCXX/nrvo.cpp
It checks IR after optimizations, which is inherently fragile,
and the results are now different after the recent patch.
Added:
Modified:
clang/test/CodeGenCXX/nrvo.cpp
Removed:
################################################################################
diff --git a/clang/test/CodeGenCXX/nrvo.cpp b/clang/test/CodeGenCXX/nrvo.cpp
index 11b1d5e13572a..c9428fd8887db 100644
--- a/clang/test/CodeGenCXX/nrvo.cpp
+++ b/clang/test/CodeGenCXX/nrvo.cpp
@@ -1,3 +1,4 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -O1 -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -O1 -fcxx-exceptions -fexceptions -std=c++03 -o - %s | FileCheck --check-prefixes=CHECK-EH,CHECK-EH-03 %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -O1 -fcxx-exceptions -fexceptions -std=c++11 -o - %s | FileCheck --check-prefixes=CHECK-EH,CHECK-EH-11 %s
@@ -18,34 +19,141 @@ template<typename T> struct Y {
}
};
-// CHECK-LABEL: define{{.*}} void @_Z5test0v
-// CHECK-EH-LABEL: define{{.*}} void @_Z5test0v
+// CHECK-LABEL: @_Z5test0v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]]) #[[ATTR5:[0-9]+]]
+// CHECK-NEXT: ret void
+//
+// CHECK-EH-LABEL: @_Z5test0v(
+// CHECK-EH-NEXT: entry:
+// CHECK-EH-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]])
+// CHECK-EH-NEXT: ret void
+//
X test0() {
X x;
- // CHECK: call {{.*}} @_ZN1XC1Ev
- // CHECK-NEXT: ret void
- // CHECK-EH: call {{.*}} @_ZN1XC1Ev
- // CHECK-EH-NEXT: ret void
return x;
}
-// CHECK-LABEL: define{{.*}} void @_Z5test1b(
-// CHECK-EH-LABEL: define{{.*}} void @_Z5test1b(
+// CHECK-LABEL: @_Z5test1b(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]]) #[[ATTR5]]
+// CHECK-NEXT: ret void
+//
+// CHECK-EH-LABEL: @_Z5test1b(
+// CHECK-EH-NEXT: entry:
+// CHECK-EH-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]])
+// CHECK-EH-NEXT: ret void
+//
X test1(bool B) {
- // CHECK: call {{.*}} @_ZN1XC1Ev
- // CHECK-NEXT: ret void
X x;
if (B)
return (x);
return x;
- // CHECK-EH: call {{.*}} @_ZN1XC1Ev
- // CHECK-EH-NEXT: ret void
}
-// CHECK-LABEL: define{{.*}} void @_Z5test2b
-// CHECK-EH-LABEL: define{{.*}} void @_Z5test2b
-// CHECK-EH-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+// CHECK-LABEL: @_Z5test2b(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: [[X:%.*]] = alloca [[CLASS_X:%.*]], align 1
+// CHECK-NEXT: [[Y:%.*]] = alloca [[CLASS_X]], align 1
+// CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[CLASS_X]], %class.X* [[X]], i32 0, i32 0
+// CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR5]]
+// CHECK-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]]) #[[ATTR5]]
+// CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[CLASS_X]], %class.X* [[Y]], i32 0, i32 0
+// CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP1]]) #[[ATTR5]]
+// CHECK-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[Y]]) #[[ATTR5]]
+// CHECK-NEXT: [[Y_X:%.*]] = select i1 [[B:%.*]], %class.X* [[Y]], %class.X* [[X]]
+// CHECK-NEXT: call void @_ZN1XC1ERKS_(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]], %class.X* noundef nonnull align 1 dereferenceable(1) [[Y_X]]) #[[ATTR5]]
+// CHECK-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[Y]]) #[[ATTR5]]
+// CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP1]]) #[[ATTR5]]
+// CHECK-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]]) #[[ATTR5]]
+// CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR5]]
+// CHECK-NEXT: ret void
+//
+// CHECK-EH-03-LABEL: @_Z5test2b(
+// CHECK-EH-03-NEXT: entry:
+// CHECK-EH-03-NEXT: [[X:%.*]] = alloca [[CLASS_X:%.*]], align 1
+// CHECK-EH-03-NEXT: [[Y:%.*]] = alloca [[CLASS_X]], align 1
+// CHECK-EH-03-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[CLASS_X]], %class.X* [[X]], i32 0, i32 0
+// CHECK-EH-03-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7:[0-9]+]]
+// CHECK-EH-03-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]])
+// CHECK-EH-03-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[CLASS_X]], %class.X* [[Y]], i32 0, i32 0
+// CHECK-EH-03-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP1]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: invoke void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[Y]])
+// CHECK-EH-03-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[LPAD:%.*]]
+// CHECK-EH-03: invoke.cont:
+// CHECK-EH-03-NEXT: [[TMP2:%.*]] = select i1 [[B:%.*]], %class.X* [[Y]], %class.X* [[X]]
+// CHECK-EH-03-NEXT: invoke void @_ZN1XC1ERKS_(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]], %class.X* noundef nonnull align 1 dereferenceable(1) [[TMP2]])
+// CHECK-EH-03-NEXT: to label [[CLEANUP:%.*]] unwind label [[LPAD1:%.*]]
+// CHECK-EH-03: lpad:
+// CHECK-EH-03-NEXT: [[TMP3:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-03-NEXT: cleanup
+// CHECK-EH-03-NEXT: br label [[EHCLEANUP:%.*]]
+// CHECK-EH-03: lpad1:
+// CHECK-EH-03-NEXT: [[TMP4:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-03-NEXT: cleanup
+// CHECK-EH-03-NEXT: invoke void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[Y]])
+// CHECK-EH-03-NEXT: to label [[EHCLEANUP]] unwind label [[TERMINATE_LPAD:%.*]]
+// CHECK-EH-03: cleanup:
+// CHECK-EH-03-NEXT: invoke void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[Y]])
+// CHECK-EH-03-NEXT: to label [[INVOKE_CONT4:%.*]] unwind label [[LPAD]]
+// CHECK-EH-03: invoke.cont4:
+// CHECK-EH-03-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP1]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]])
+// CHECK-EH-03-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: ret void
+// CHECK-EH-03: ehcleanup:
+// CHECK-EH-03-NEXT: [[DOTPN:%.*]] = phi { i8*, i32 } [ [[TMP3]], [[LPAD]] ], [ [[TMP4]], [[LPAD1]] ]
+// CHECK-EH-03-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP1]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: invoke void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]])
+// CHECK-EH-03-NEXT: to label [[INVOKE_CONT9:%.*]] unwind label [[TERMINATE_LPAD]]
+// CHECK-EH-03: invoke.cont9:
+// CHECK-EH-03-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: resume { i8*, i32 } [[DOTPN]]
+// CHECK-EH-03: terminate.lpad:
+// CHECK-EH-03-NEXT: [[TMP5:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-03-NEXT: catch i8* null
+// CHECK-EH-03-NEXT: [[TMP6:%.*]] = extractvalue { i8*, i32 } [[TMP5]], 0
+// CHECK-EH-03-NEXT: call void @__clang_call_terminate(i8* [[TMP6]]) #[[ATTR8:[0-9]+]]
+// CHECK-EH-03-NEXT: unreachable
+//
+// CHECK-EH-11-LABEL: @_Z5test2b(
+// CHECK-EH-11-NEXT: entry:
+// CHECK-EH-11-NEXT: [[X:%.*]] = alloca [[CLASS_X:%.*]], align 1
+// CHECK-EH-11-NEXT: [[Y:%.*]] = alloca [[CLASS_X]], align 1
+// CHECK-EH-11-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[CLASS_X]], %class.X* [[X]], i32 0, i32 0
+// CHECK-EH-11-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7:[0-9]+]]
+// CHECK-EH-11-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]])
+// CHECK-EH-11-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[CLASS_X]], %class.X* [[Y]], i32 0, i32 0
+// CHECK-EH-11-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP1]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: invoke void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[Y]])
+// CHECK-EH-11-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[LPAD:%.*]]
+// CHECK-EH-11: invoke.cont:
+// CHECK-EH-11-NEXT: [[TMP2:%.*]] = select i1 [[B:%.*]], %class.X* [[Y]], %class.X* [[X]]
+// CHECK-EH-11-NEXT: invoke void @_ZN1XC1ERKS_(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]], %class.X* noundef nonnull align 1 dereferenceable(1) [[TMP2]])
+// CHECK-EH-11-NEXT: to label [[CLEANUP:%.*]] unwind label [[LPAD1:%.*]]
+// CHECK-EH-11: lpad:
+// CHECK-EH-11-NEXT: [[TMP3:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-11-NEXT: cleanup
+// CHECK-EH-11-NEXT: br label [[EHCLEANUP:%.*]]
+// CHECK-EH-11: lpad1:
+// CHECK-EH-11-NEXT: [[TMP4:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-11-NEXT: cleanup
+// CHECK-EH-11-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[Y]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: br label [[EHCLEANUP]]
+// CHECK-EH-11: cleanup:
+// CHECK-EH-11-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[Y]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP1]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: ret void
+// CHECK-EH-11: ehcleanup:
+// CHECK-EH-11-NEXT: [[DOTPN:%.*]] = phi { i8*, i32 } [ [[TMP4]], [[LPAD1]] ], [ [[TMP3]], [[LPAD]] ]
+// CHECK-EH-11-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP1]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: resume { i8*, i32 } [[DOTPN]]
+//
X test2(bool B) {
// No NRVO.
@@ -54,84 +162,87 @@ X test2(bool B) {
if (B)
return y;
return x;
-
- // 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 {{.*}} @_ZN1XC1Ev
- // CHECK: call {{.*}} @_ZN1XC1ERKS_
- // CHECK: call {{.*}} @_ZN1XD1Ev
- // CHECK-NEXT: call void @llvm.lifetime.end
- // CHECK: call {{.*}} @_ZN1XD1Ev
- // CHECK-NEXT: call void @llvm.lifetime.end
- // CHECK: ret void
-
- // The block ordering in the -fexceptions IR is unfortunate.
-
- // CHECK-EH: call void @llvm.lifetime.start
- // CHECK-EH-NEXT: call {{.*}} @_ZN1XC1Ev
- // CHECK-EH: call void @llvm.lifetime.start
- // CHECK-EH-NEXT: invoke {{.*}} @_ZN1XC1Ev
- // -> %invoke.cont, %lpad
-
- // %invoke.cont:
- // CHECK-EH: br i1
- // -> %if.then, %if.end
-
- // %if.then: returning 'x'
- // CHECK-EH: invoke {{.*}} @_ZN1XC1ERKS_
- // -> %cleanup, %lpad1
-
- // %lpad: landing pad for ctor of 'y', dtor of 'y'
- // CHECK-EH: [[CAUGHTVAL:%.*]] = landingpad { i8*, i32 }
- // CHECK-EH-NEXT: cleanup
- // CHECK-EH-NEXT: br label
- // -> %eh.cleanup
-
- // %lpad1: landing pad for return copy ctors, EH cleanup for 'y'
- // CHECK-EH-03: invoke {{.*}} @_ZN1XD1Ev
- // -> %eh.cleanup, %terminate.lpad
- // CHECK-EH-11: call {{.*}} @_ZN1XD1Ev
-
- // %if.end: returning 'y'
- // CHECK-EH: invoke {{.*}} @_ZN1XC1ERKS_
- // -> %cleanup, %lpad1
-
- // %cleanup: normal cleanup for 'y'
- // CHECK-EH-03: invoke {{.*}} @_ZN1XD1Ev
- // -> %invoke.cont11, %lpad
- // CHECK-EH-11: call {{.*}} @_ZN1XD1Ev
-
- // %invoke.cont11: normal cleanup for 'x'
- // CHECK-EH: call void @llvm.lifetime.end
- // CHECK-EH-NEXT: call {{.*}} @_ZN1XD1Ev
- // CHECK-EH-NEXT: call void @llvm.lifetime.end
- // CHECK-EH-NEXT: ret void
-
- // %eh.cleanup: EH cleanup for 'x'
- // CHECK-EH-03: invoke {{.*}} @_ZN1XD1Ev
- // -> %invoke.cont17, %terminate.lpad
- // CHECK-EH-11: call {{.*}} @_ZN1XD1Ev
-
- // %invoke.cont17: rethrow block for %eh.cleanup.
- // This really should be elsewhere in the function.
- // CHECK-EH: resume { i8*, i32 }
-
- // %terminate.lpad: terminate landing pad.
- // CHECK-EH-03: [[T0:%.*]] = landingpad { i8*, i32 }
- // CHECK-EH-03-NEXT: catch i8* null
- // CHECK-EH-03-NEXT: [[T1:%.*]] = extractvalue { i8*, i32 } [[T0]], 0
- // CHECK-EH-03-NEXT: call void @__clang_call_terminate(i8* [[T1]]) [[NR_NUW:#[0-9]+]]
- // CHECK-EH-03-NEXT: unreachable
-
}
-// CHECK-LABEL: define{{.*}} void @_Z5test3b
+// CHECK-LABEL: @_Z5test3b(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: [[X:%.*]] = alloca [[CLASS_X:%.*]], align 1
+// CHECK-NEXT: br i1 [[B:%.*]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
+// CHECK: if.then:
+// CHECK-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]]) #[[ATTR5]]
+// CHECK-NEXT: br label [[RETURN:%.*]]
+// CHECK: if.end:
+// CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[CLASS_X]], %class.X* [[X]], i32 0, i32 0
+// CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR5]]
+// CHECK-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]]) #[[ATTR5]]
+// CHECK-NEXT: call void @_ZN1XC1ERKS_(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT]], %class.X* noundef nonnull align 1 dereferenceable(1) [[X]]) #[[ATTR5]]
+// CHECK-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]]) #[[ATTR5]]
+// CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR5]]
+// CHECK-NEXT: br label [[RETURN]]
+// CHECK: return:
+// CHECK-NEXT: ret void
+//
+// CHECK-EH-03-LABEL: @_Z5test3b(
+// CHECK-EH-03-NEXT: entry:
+// CHECK-EH-03-NEXT: [[X:%.*]] = alloca [[CLASS_X:%.*]], align 1
+// CHECK-EH-03-NEXT: br i1 [[B:%.*]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
+// CHECK-EH-03: if.then:
+// CHECK-EH-03-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]])
+// CHECK-EH-03-NEXT: br label [[RETURN:%.*]]
+// CHECK-EH-03: if.end:
+// CHECK-EH-03-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[CLASS_X]], %class.X* [[X]], i32 0, i32 0
+// CHECK-EH-03-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]])
+// CHECK-EH-03-NEXT: invoke void @_ZN1XC1ERKS_(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT]], %class.X* noundef nonnull align 1 dereferenceable(1) [[X]])
+// CHECK-EH-03-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[LPAD:%.*]]
+// CHECK-EH-03: invoke.cont:
+// CHECK-EH-03-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]])
+// CHECK-EH-03-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: br label [[RETURN]]
+// CHECK-EH-03: lpad:
+// CHECK-EH-03-NEXT: [[TMP1:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-03-NEXT: cleanup
+// CHECK-EH-03-NEXT: invoke void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]])
+// CHECK-EH-03-NEXT: to label [[INVOKE_CONT1:%.*]] unwind label [[TERMINATE_LPAD:%.*]]
+// CHECK-EH-03: invoke.cont1:
+// CHECK-EH-03-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: resume { i8*, i32 } [[TMP1]]
+// CHECK-EH-03: return:
+// CHECK-EH-03-NEXT: ret void
+// CHECK-EH-03: terminate.lpad:
+// CHECK-EH-03-NEXT: [[TMP2:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-03-NEXT: catch i8* null
+// CHECK-EH-03-NEXT: [[TMP3:%.*]] = extractvalue { i8*, i32 } [[TMP2]], 0
+// CHECK-EH-03-NEXT: call void @__clang_call_terminate(i8* [[TMP3]]) #[[ATTR8]]
+// CHECK-EH-03-NEXT: unreachable
+//
+// CHECK-EH-11-LABEL: @_Z5test3b(
+// CHECK-EH-11-NEXT: entry:
+// CHECK-EH-11-NEXT: [[X:%.*]] = alloca [[CLASS_X:%.*]], align 1
+// CHECK-EH-11-NEXT: br i1 [[B:%.*]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
+// CHECK-EH-11: if.then:
+// CHECK-EH-11-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]])
+// CHECK-EH-11-NEXT: br label [[RETURN:%.*]]
+// CHECK-EH-11: if.end:
+// CHECK-EH-11-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[CLASS_X]], %class.X* [[X]], i32 0, i32 0
+// CHECK-EH-11-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]])
+// CHECK-EH-11-NEXT: invoke void @_ZN1XC1ERKS_(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT]], %class.X* noundef nonnull align 1 dereferenceable(1) [[X]])
+// CHECK-EH-11-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[LPAD:%.*]]
+// CHECK-EH-11: invoke.cont:
+// CHECK-EH-11-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: br label [[RETURN]]
+// CHECK-EH-11: lpad:
+// CHECK-EH-11-NEXT: [[TMP1:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-11-NEXT: cleanup
+// CHECK-EH-11-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: resume { i8*, i32 } [[TMP1]]
+// CHECK-EH-11: return:
+// CHECK-EH-11-NEXT: ret void
+//
X test3(bool B) {
- // CHECK: call {{.*}} @_ZN1XC1Ev
- // CHECK-NOT: call {{.*}} @_ZN1XC1ERKS_
- // CHECK: call {{.*}} @_ZN1XC1Ev
- // CHECK: call {{.*}} @_ZN1XC1ERKS_
if (B) {
X y;
return y;
@@ -143,54 +254,242 @@ X test3(bool B) {
extern "C" void exit(int) throw();
-// CHECK-LABEL: define{{.*}} void @_Z5test4b
+// CHECK-LABEL: @_Z5test4b(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]]) #[[ATTR5]]
+// CHECK-NEXT: br i1 [[B:%.*]], label [[RETURN:%.*]], label [[NRVO_UNUSED:%.*]]
+// CHECK: nrvo.unused:
+// CHECK-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT]]) #[[ATTR5]]
+// CHECK-NEXT: call void @exit(i32 noundef 1) #[[ATTR5]]
+// CHECK-NEXT: unreachable
+// CHECK: return:
+// CHECK-NEXT: ret void
+//
+// CHECK-EH-03-LABEL: @_Z5test4b(
+// CHECK-EH-03-NEXT: entry:
+// CHECK-EH-03-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]])
+// CHECK-EH-03-NEXT: br i1 [[B:%.*]], label [[RETURN:%.*]], label [[NRVO_UNUSED:%.*]]
+// CHECK-EH-03: nrvo.unused:
+// CHECK-EH-03-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT]])
+// CHECK-EH-03-NEXT: call void @exit(i32 noundef 1) #[[ATTR7]]
+// CHECK-EH-03-NEXT: unreachable
+// CHECK-EH-03: return:
+// CHECK-EH-03-NEXT: ret void
+//
+// CHECK-EH-11-LABEL: @_Z5test4b(
+// CHECK-EH-11-NEXT: entry:
+// CHECK-EH-11-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]])
+// CHECK-EH-11-NEXT: br i1 [[B:%.*]], label [[RETURN:%.*]], label [[NRVO_UNUSED:%.*]]
+// CHECK-EH-11: nrvo.unused:
+// CHECK-EH-11-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: call void @exit(i32 noundef 1) #[[ATTR7]]
+// CHECK-EH-11-NEXT: unreachable
+// CHECK-EH-11: return:
+// CHECK-EH-11-NEXT: ret void
+//
X test4(bool B) {
{
- // CHECK: call {{.*}} @_ZN1XC1Ev
X x;
- // CHECK: br i1
if (B)
return x;
}
- // CHECK: call {{.*}} @_ZN1XD1Ev
- // CHECK: call void @exit(i32 noundef 1)
exit(1);
}
#ifdef __EXCEPTIONS
-// CHECK-EH-LABEL: define{{.*}} void @_Z5test5
void may_throw();
+// CHECK-EH-03-LABEL: @_Z5test5v(
+// CHECK-EH-03-NEXT: entry:
+// CHECK-EH-03-NEXT: [[X:%.*]] = alloca [[CLASS_X:%.*]], align 1
+// CHECK-EH-03-NEXT: invoke void @_Z9may_throwv()
+// CHECK-EH-03-NEXT: to label [[TRY_CONT:%.*]] unwind label [[LPAD:%.*]]
+// CHECK-EH-03: lpad:
+// CHECK-EH-03-NEXT: [[TMP0:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-03-NEXT: catch i8* bitcast ({ i8*, i8* }* @_ZTI1X to i8*)
+// CHECK-EH-03-NEXT: [[TMP1:%.*]] = extractvalue { i8*, i32 } [[TMP0]], 0
+// CHECK-EH-03-NEXT: [[TMP2:%.*]] = extractvalue { i8*, i32 } [[TMP0]], 1
+// CHECK-EH-03-NEXT: [[TMP3:%.*]] = call i32 @llvm.eh.typeid.for(i8* bitcast ({ i8*, i8* }* @_ZTI1X to i8*)) #[[ATTR7]]
+// CHECK-EH-03-NEXT: [[MATCHES:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]]
+// CHECK-EH-03-NEXT: br i1 [[MATCHES]], label [[CATCH:%.*]], label [[EH_RESUME:%.*]]
+// CHECK-EH-03: catch:
+// CHECK-EH-03-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[CLASS_X]], %class.X* [[X]], i32 0, i32 0
+// CHECK-EH-03-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP4]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: [[TMP5:%.*]] = call i8* @__cxa_get_exception_ptr(i8* [[TMP1]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: [[TMP6:%.*]] = bitcast i8* [[TMP5]] to %class.X*
+// CHECK-EH-03-NEXT: invoke void @_ZN1XC1ERKS_(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]], %class.X* noundef nonnull align 1 dereferenceable(1) [[TMP6]])
+// CHECK-EH-03-NEXT: to label [[INVOKE_CONT1:%.*]] unwind label [[TERMINATE_LPAD:%.*]]
+// CHECK-EH-03: invoke.cont1:
+// CHECK-EH-03-NEXT: [[TMP7:%.*]] = call i8* @__cxa_begin_catch(i8* [[TMP1]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: invoke void @_ZN1XC1ERKS_(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]], %class.X* noundef nonnull align 1 dereferenceable(1) [[X]])
+// CHECK-EH-03-NEXT: to label [[INVOKE_CONT3:%.*]] unwind label [[LPAD2:%.*]]
+// CHECK-EH-03: invoke.cont3:
+// CHECK-EH-03-NEXT: invoke void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]])
+// CHECK-EH-03-NEXT: to label [[INVOKE_CONT5:%.*]] unwind label [[LPAD4:%.*]]
+// CHECK-EH-03: lpad2:
+// CHECK-EH-03-NEXT: [[TMP8:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-03-NEXT: cleanup
+// CHECK-EH-03-NEXT: invoke void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]])
+// CHECK-EH-03-NEXT: to label [[EHCLEANUP:%.*]] unwind label [[TERMINATE_LPAD]]
+// CHECK-EH-03: invoke.cont5:
+// CHECK-EH-03-NEXT: call void @__cxa_end_catch()
+// CHECK-EH-03-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP4]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: ret void
+// CHECK-EH-03: lpad4:
+// CHECK-EH-03-NEXT: [[TMP9:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-03-NEXT: cleanup
+// CHECK-EH-03-NEXT: br label [[EHCLEANUP]]
+// CHECK-EH-03: ehcleanup:
+// CHECK-EH-03-NEXT: [[DOTPN:%.*]] = phi { i8*, i32 } [ [[TMP9]], [[LPAD4]] ], [ [[TMP8]], [[LPAD2]] ]
+// CHECK-EH-03-NEXT: invoke void @__cxa_end_catch()
+// CHECK-EH-03-NEXT: to label [[INVOKE_CONT7:%.*]] unwind label [[TERMINATE_LPAD]]
+// CHECK-EH-03: invoke.cont7:
+// CHECK-EH-03-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP4]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: br label [[EH_RESUME]]
+// CHECK-EH-03: try.cont:
+// CHECK-EH-03-NEXT: unreachable
+// CHECK-EH-03: eh.resume:
+// CHECK-EH-03-NEXT: [[LPAD_VAL11_MERGED:%.*]] = phi { i8*, i32 } [ [[DOTPN]], [[INVOKE_CONT7]] ], [ [[TMP0]], [[LPAD]] ]
+// CHECK-EH-03-NEXT: resume { i8*, i32 } [[LPAD_VAL11_MERGED]]
+// CHECK-EH-03: terminate.lpad:
+// CHECK-EH-03-NEXT: [[TMP10:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-03-NEXT: catch i8* null
+// CHECK-EH-03-NEXT: [[TMP11:%.*]] = extractvalue { i8*, i32 } [[TMP10]], 0
+// CHECK-EH-03-NEXT: call void @__clang_call_terminate(i8* [[TMP11]]) #[[ATTR8]]
+// CHECK-EH-03-NEXT: unreachable
+//
+// CHECK-EH-11-LABEL: @_Z5test5v(
+// CHECK-EH-11-NEXT: entry:
+// CHECK-EH-11-NEXT: [[X:%.*]] = alloca [[CLASS_X:%.*]], align 1
+// CHECK-EH-11-NEXT: invoke void @_Z9may_throwv()
+// CHECK-EH-11-NEXT: to label [[TRY_CONT:%.*]] unwind label [[LPAD:%.*]]
+// CHECK-EH-11: lpad:
+// CHECK-EH-11-NEXT: [[TMP0:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-11-NEXT: catch i8* bitcast ({ i8*, i8* }* @_ZTI1X to i8*)
+// CHECK-EH-11-NEXT: [[TMP1:%.*]] = extractvalue { i8*, i32 } [[TMP0]], 0
+// CHECK-EH-11-NEXT: [[TMP2:%.*]] = extractvalue { i8*, i32 } [[TMP0]], 1
+// CHECK-EH-11-NEXT: [[TMP3:%.*]] = call i32 @llvm.eh.typeid.for(i8* bitcast ({ i8*, i8* }* @_ZTI1X to i8*)) #[[ATTR7]]
+// CHECK-EH-11-NEXT: [[MATCHES:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]]
+// CHECK-EH-11-NEXT: br i1 [[MATCHES]], label [[CATCH:%.*]], label [[EH_RESUME:%.*]]
+// CHECK-EH-11: catch:
+// CHECK-EH-11-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[CLASS_X]], %class.X* [[X]], i32 0, i32 0
+// CHECK-EH-11-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP4]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: [[TMP5:%.*]] = call i8* @__cxa_get_exception_ptr(i8* [[TMP1]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: [[TMP6:%.*]] = bitcast i8* [[TMP5]] to %class.X*
+// CHECK-EH-11-NEXT: invoke void @_ZN1XC1ERKS_(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]], %class.X* noundef nonnull align 1 dereferenceable(1) [[TMP6]])
+// CHECK-EH-11-NEXT: to label [[INVOKE_CONT1:%.*]] unwind label [[TERMINATE_LPAD:%.*]]
+// CHECK-EH-11: invoke.cont1:
+// CHECK-EH-11-NEXT: [[TMP7:%.*]] = call i8* @__cxa_begin_catch(i8* [[TMP1]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: invoke void @_ZN1XC1ERKS_(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]], %class.X* noundef nonnull align 1 dereferenceable(1) [[X]])
+// CHECK-EH-11-NEXT: to label [[INVOKE_CONT3:%.*]] unwind label [[LPAD2:%.*]]
+// CHECK-EH-11: invoke.cont3:
+// CHECK-EH-11-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: call void @__cxa_end_catch()
+// CHECK-EH-11-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP4]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: ret void
+// CHECK-EH-11: lpad2:
+// CHECK-EH-11-NEXT: [[TMP8:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-11-NEXT: cleanup
+// CHECK-EH-11-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[X]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: invoke void @__cxa_end_catch()
+// CHECK-EH-11-NEXT: to label [[INVOKE_CONT4:%.*]] unwind label [[TERMINATE_LPAD]]
+// CHECK-EH-11: invoke.cont4:
+// CHECK-EH-11-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP4]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: br label [[EH_RESUME]]
+// CHECK-EH-11: try.cont:
+// CHECK-EH-11-NEXT: unreachable
+// CHECK-EH-11: eh.resume:
+// CHECK-EH-11-NEXT: [[LPAD_VAL7_MERGED:%.*]] = phi { i8*, i32 } [ [[TMP8]], [[INVOKE_CONT4]] ], [ [[TMP0]], [[LPAD]] ]
+// CHECK-EH-11-NEXT: resume { i8*, i32 } [[LPAD_VAL7_MERGED]]
+// CHECK-EH-11: terminate.lpad:
+// CHECK-EH-11-NEXT: [[TMP9:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-11-NEXT: catch i8* null
+// CHECK-EH-11-NEXT: [[TMP10:%.*]] = extractvalue { i8*, i32 } [[TMP9]], 0
+// CHECK-EH-11-NEXT: call void @__clang_call_terminate(i8* [[TMP10]]) #[[ATTR8:[0-9]+]]
+// CHECK-EH-11-NEXT: unreachable
+//
X test5() {
try {
may_throw();
} catch (X x) {
- // CHECK-EH: invoke {{.*}} @_ZN1XC1ERKS_
- // CHECK-EH: call void @__cxa_end_catch()
- // CHECK-EH: ret void
return x;
}
}
#endif
// rdar://problem/10430868
-// CHECK-LABEL: define{{.*}} void @_Z5test6v
+// CHECK-LABEL: @_Z5test6v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: [[A:%.*]] = alloca [[CLASS_X:%.*]], align 8
+// CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[CLASS_X]], %class.X* [[A]], i32 0, i32 0
+// CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR5]]
+// CHECK-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[A]]) #[[ATTR5]]
+// CHECK-NEXT: call void @_ZN1XC1ERKS_(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]], %class.X* noundef nonnull align 1 dereferenceable(1) [[A]]) #[[ATTR5]]
+// CHECK-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[A]]) #[[ATTR5]]
+// CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR5]]
+// CHECK-NEXT: ret void
+//
+// CHECK-EH-03-LABEL: @_Z5test6v(
+// CHECK-EH-03-NEXT: entry:
+// CHECK-EH-03-NEXT: [[A:%.*]] = alloca [[CLASS_X:%.*]], align 8
+// CHECK-EH-03-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[CLASS_X]], %class.X* [[A]], i32 0, i32 0
+// CHECK-EH-03-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[A]])
+// CHECK-EH-03-NEXT: invoke void @_ZN1XC1ERKS_(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]], %class.X* noundef nonnull align 1 dereferenceable(1) [[A]])
+// CHECK-EH-03-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[LPAD:%.*]]
+// CHECK-EH-03: invoke.cont:
+// CHECK-EH-03-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[A]])
+// CHECK-EH-03-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: ret void
+// CHECK-EH-03: lpad:
+// CHECK-EH-03-NEXT: [[TMP1:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-03-NEXT: cleanup
+// CHECK-EH-03-NEXT: invoke void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[A]])
+// CHECK-EH-03-NEXT: to label [[INVOKE_CONT1:%.*]] unwind label [[TERMINATE_LPAD:%.*]]
+// CHECK-EH-03: invoke.cont1:
+// CHECK-EH-03-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-03-NEXT: resume { i8*, i32 } [[TMP1]]
+// CHECK-EH-03: terminate.lpad:
+// CHECK-EH-03-NEXT: [[TMP2:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-03-NEXT: catch i8* null
+// CHECK-EH-03-NEXT: [[TMP3:%.*]] = extractvalue { i8*, i32 } [[TMP2]], 0
+// CHECK-EH-03-NEXT: call void @__clang_call_terminate(i8* [[TMP3]]) #[[ATTR8]]
+// CHECK-EH-03-NEXT: unreachable
+//
+// CHECK-EH-11-LABEL: @_Z5test6v(
+// CHECK-EH-11-NEXT: entry:
+// CHECK-EH-11-NEXT: [[A:%.*]] = alloca [[CLASS_X:%.*]], align 8
+// CHECK-EH-11-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[CLASS_X]], %class.X* [[A]], i32 0, i32 0
+// CHECK-EH-11-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[A]])
+// CHECK-EH-11-NEXT: invoke void @_ZN1XC1ERKS_(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]], %class.X* noundef nonnull align 1 dereferenceable(1) [[A]])
+// CHECK-EH-11-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[LPAD:%.*]]
+// CHECK-EH-11: invoke.cont:
+// CHECK-EH-11-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[A]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: ret void
+// CHECK-EH-11: lpad:
+// CHECK-EH-11-NEXT: [[TMP1:%.*]] = landingpad { i8*, i32 }
+// CHECK-EH-11-NEXT: cleanup
+// CHECK-EH-11-NEXT: call void @_ZN1XD1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[A]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7]]
+// CHECK-EH-11-NEXT: resume { i8*, i32 } [[TMP1]]
+//
X test6() {
X a __attribute__((aligned(8)));
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.p0i8(i64 1, i8* nonnull [[PTR]])
- // CHECK-NEXT: call {{.*}} @_ZN1XC1Ev([[X]]* {{[^,]*}} [[A]])
- // CHECK-NEXT: call {{.*}} @_ZN1XC1ERKS_([[X]]* {{[^,]*}} {{%.*}}, [[X]]* noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[A]])
- // CHECK-NEXT: call {{.*}} @_ZN1XD1Ev([[X]]* {{[^,]*}} [[A]])
- // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull [[PTR]])
- // CHECK-NEXT: ret void
}
-// CHECK-LABEL: define{{.*}} void @_Z5test7b
+// CHECK-LABEL: @_Z5test7b(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]]) #[[ATTR5]]
+// CHECK-NEXT: ret void
+//
+// CHECK-EH-LABEL: @_Z5test7b(
+// CHECK-EH-NEXT: entry:
+// CHECK-EH-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]])
+// CHECK-EH-NEXT: ret void
+//
X test7(bool b) {
- // CHECK: call {{.*}} @_ZN1XC1Ev
- // CHECK-NEXT: ret
if (b) {
X x;
return x;
@@ -198,10 +497,17 @@ X test7(bool b) {
return X();
}
-// CHECK-LABEL: define{{.*}} void @_Z5test8b
+// CHECK-LABEL: @_Z5test8b(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]]) #[[ATTR5]]
+// CHECK-NEXT: ret void
+//
+// CHECK-EH-LABEL: @_Z5test8b(
+// CHECK-EH-NEXT: entry:
+// CHECK-EH-NEXT: call void @_ZN1XC1Ev(%class.X* noundef nonnull align 1 dereferenceable(1) [[AGG_RESULT:%.*]])
+// CHECK-EH-NEXT: ret void
+//
X test8(bool b) {
- // CHECK: call {{.*}} @_ZN1XC1Ev
- // CHECK-NEXT: ret
if (b) {
X x;
return x;
@@ -211,11 +517,22 @@ X test8(bool b) {
}
}
+// CHECK-LABEL: @_Z5test9v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: [[TMP:%.*]] = alloca [[STRUCT_Y:%.*]], align 1
+// CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[STRUCT_Y]], %struct.Y* [[TMP]], i32 0, i32 0
+// CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR5]]
+// CHECK-NEXT: call void @_ZN1YIiE1fEv(%struct.Y* nonnull sret([[STRUCT_Y]]) align 1 [[TMP]])
+// CHECK-NEXT: unreachable
+//
+// CHECK-EH-LABEL: @_Z5test9v(
+// CHECK-EH-NEXT: entry:
+// CHECK-EH-NEXT: [[TMP:%.*]] = alloca [[STRUCT_Y:%.*]], align 1
+// CHECK-EH-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[STRUCT_Y]], %struct.Y* [[TMP]], i32 0, i32 0
+// CHECK-EH-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull [[TMP0]]) #[[ATTR7:[0-9]+]]
+// CHECK-EH-NEXT: call void @_ZN1YIiE1fEv(%struct.Y* nonnull sret([[STRUCT_Y]]) align 1 [[TMP]])
+// CHECK-EH-NEXT: unreachable
+//
Y<int> test9() {
Y<int>::f();
}
-
-// CHECK-LABEL: define linkonce_odr void @_ZN1YIiE1fEv
-// CHECK: call {{.*}} @_ZN1YIiEC1Ev
-
-// CHECK-EH-03: attributes [[NR_NUW]] = { noreturn nounwind }
More information about the cfe-commits
mailing list