mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-13 14:35:54 +00:00
903dd081e7
SimplifyCFG has two main folds for resumes - one when resume is directly using the landingpad, and the other one where resume is using a PHI node. While for the first case, we were already correctly ignoring all the PHI nodes, and both the debug info intrinsics and lifetime intrinsics, in the PHI-based-one, we weren't ignoring PHI's in the resume block, and weren't ignoring lifetime intrinsics. That is clearly a bug. On RawSpeed library, this results in +9.34% (+81) more invoke->call folds, -0.19% (-39) landing pads, -0.24% (-81) invoke instructions but +51 call instructions and -132 basic blocks. Though, the run-time performance impact appears to be within the noise.
91 lines
2.9 KiB
LLVM
91 lines
2.9 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -simplifycfg -S | FileCheck %s
|
|
|
|
declare void @llvm.lifetime.start.p0i8(i64, i8*)
|
|
declare void @llvm.lifetime.end.p0i8(i64, i8*)
|
|
|
|
declare void @escape(i32*)
|
|
|
|
declare void @throwing_callee_foo()
|
|
declare void @throwing_callee_bar()
|
|
|
|
declare i32 @__gxx_personality_v0(...)
|
|
|
|
define void @caller(i1 %c) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
|
|
; CHECK-LABEL: @caller(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[I0:%.*]] = alloca i32, align 4
|
|
; CHECK-NEXT: [[I1:%.*]] = bitcast i32* [[I0]] to i8*
|
|
; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull [[I1]])
|
|
; CHECK-NEXT: call void @escape(i32* [[I0]])
|
|
; CHECK-NEXT: [[I2:%.*]] = alloca i32, align 4
|
|
; CHECK-NEXT: [[I3:%.*]] = bitcast i32* [[I2]] to i8*
|
|
; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull [[I3]])
|
|
; CHECK-NEXT: call void @escape(i32* [[I2]])
|
|
; CHECK-NEXT: [[I4:%.*]] = alloca i32, align 4
|
|
; CHECK-NEXT: [[I5:%.*]] = bitcast i32* [[I4]] to i8*
|
|
; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull [[I5]])
|
|
; CHECK-NEXT: call void @escape(i32* [[I4]])
|
|
; CHECK-NEXT: [[I6:%.*]] = alloca i32, align 4
|
|
; CHECK-NEXT: [[I7:%.*]] = bitcast i32* [[I6]] to i8*
|
|
; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull [[I7]])
|
|
; CHECK-NEXT: call void @escape(i32* [[I6]])
|
|
; CHECK-NEXT: br i1 [[C:%.*]], label [[V0:%.*]], label [[V1:%.*]]
|
|
; CHECK: v0:
|
|
; CHECK-NEXT: call void @throwing_callee_foo()
|
|
; CHECK-NEXT: unreachable
|
|
; CHECK: v1:
|
|
; CHECK-NEXT: call void @throwing_callee_bar()
|
|
; CHECK-NEXT: unreachable
|
|
;
|
|
entry:
|
|
%i0 = alloca i32
|
|
%i1 = bitcast i32* %i0 to i8*
|
|
call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %i1)
|
|
call void @escape(i32* %i0)
|
|
|
|
%i2 = alloca i32
|
|
%i3 = bitcast i32* %i2 to i8*
|
|
call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %i3)
|
|
call void @escape(i32* %i2)
|
|
|
|
%i4 = alloca i32
|
|
%i5 = bitcast i32* %i4 to i8*
|
|
call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %i5)
|
|
call void @escape(i32* %i4)
|
|
|
|
%i6 = alloca i32
|
|
%i7 = bitcast i32* %i6 to i8*
|
|
call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %i7)
|
|
call void @escape(i32* %i6)
|
|
|
|
br i1 %c, label %v0, label %v1
|
|
|
|
v0:
|
|
invoke void @throwing_callee_foo()
|
|
to label %invoke.cont unwind label %lpad.v0
|
|
|
|
v1:
|
|
invoke void @throwing_callee_bar()
|
|
to label %invoke.cont unwind label %lpad.v1
|
|
|
|
invoke.cont:
|
|
unreachable
|
|
|
|
lpad.v0:
|
|
%i8 = landingpad { i8*, i32 } cleanup
|
|
call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %i1)
|
|
br label %end
|
|
|
|
lpad.v1:
|
|
%i9 = landingpad { i8*, i32 } cleanup
|
|
call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %i3)
|
|
br label %end
|
|
|
|
end:
|
|
%i10 = phi { i8*, i32 } [ %i8, %lpad.v0 ], [ %i9, %lpad.v1 ]
|
|
%i11 = phi i8* [ %i5, %lpad.v0 ], [ %i7, %lpad.v1 ]
|
|
call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %i11)
|
|
resume { i8*, i32 } %i10
|
|
}
|