llvm.org GIT mirror llvm / d6e617b
Merging r340641: ------------------------------------------------------------------------ r340641 | stefanp | 2018-08-24 21:38:29 +0200 (Fri, 24 Aug 2018) | 9 lines [Exception Handling] Unwind tables are required for all functions that have an EH personality. This patch is for defect: https://bugs.llvm.org/show_bug.cgi?id=32611 Functions may require unwind tables even if they are marked with the attribute nounwind. Any function with an EH personality may require an unwind table. Differential Revision: https://reviews.llvm.org/D50987 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_70@340731 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 2 years ago
4 changed file(s) with 96 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
556556
557557 /// True if this function needs an unwind table.
558558 bool needsUnwindTableEntry() const {
559 return hasUWTable() || !doesNotThrow();
559 return hasUWTable() || !doesNotThrow() || hasPersonalityFn();
560560 }
561561
562562 /// Determine if the function returns a structure through first
0 ; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-unknown \
1 ; RUN: -verify-machineinstrs -ppc-asm-full-reg-names \
2 ; RUN: -ppc-vsr-nums-as-vr < %s | FileCheck %s
3 ; RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-unknown \
4 ; RUN: -verify-machineinstrs -ppc-asm-full-reg-names \
5 ; RUN: -ppc-vsr-nums-as-vr < %s | FileCheck %s
6 ; RUN: llc -mtriple=powerpc64-unknown-unknown \
7 ; RUN: -verify-machineinstrs -ppc-asm-full-reg-names \
8 ; RUN: -ppc-vsr-nums-as-vr < %s | FileCheck %s
9
10
11 @_ZTIi = external constant i8*
12
13 ; Function is marked as nounwind but it still throws with __cxa_throw and
14 ; calls __cxa_call_unexpected.
15 ; Need to make sure that we do not only have a debug frame.
16 ; Function Attrs: noreturn nounwind
17 define void @_Z4funcv() local_unnamed_addr #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
18 entry:
19 %exception = tail call i8* @__cxa_allocate_exception(i64 4)
20 %0 = bitcast i8* %exception to i32*
21 store i32 100, i32* %0, align 16
22 invoke void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null)
23 to label %unreachable unwind label %lpad
24
25 lpad: ; preds = %entry
26 %1 = landingpad { i8*, i32 }
27 filter [0 x i8*] zeroinitializer
28 %2 = extractvalue { i8*, i32 } %1, 0
29 tail call void @__cxa_call_unexpected(i8* %2)
30 unreachable
31
32 unreachable: ; preds = %entry
33 unreachable
34 ; CHECK-LABEL: _Z4funcv
35 ; CHECK-NOT: .debug_frame
36 ; CHECK: .cfi_personality
37 ; CHECK: .cfi_endproc
38 }
39
40 declare i8* @__cxa_allocate_exception(i64) local_unnamed_addr
41
42 declare void @__cxa_throw(i8*, i8*, i8*) local_unnamed_addr
43
44 declare i32 @__gxx_personality_v0(...)
45
46 declare void @__cxa_call_unexpected(i8*) local_unnamed_addr
47
48
49 attributes #0 = { noreturn nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="ppc64le" "target-features"="+altivec,+bpermd,+crypto,+direct-move,+extdiv,+htm,+power8-vector,+vsx,-power9-vector,-qpx" "unsafe-fp-math"="false" "use-soft-float"="false" }
50
0 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
1
2
3 @_ZTIi = external constant i8*
4
5 ; Function is marked as nounwind but it still throws with __cxa_throw and
6 ; calls __cxa_call_unexpected.
7 ; Need to make sure that we do not only have a debug frame.
8 ; Function Attrs: noreturn nounwind
9 define void @_Z4funcv() local_unnamed_addr #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
10 entry:
11 %exception = tail call i8* @__cxa_allocate_exception(i64 4)
12 %0 = bitcast i8* %exception to i32*
13 store i32 100, i32* %0, align 16
14 invoke void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null)
15 to label %unreachable unwind label %lpad
16
17 lpad: ; preds = %entry
18 %1 = landingpad { i8*, i32 }
19 filter [0 x i8*] zeroinitializer
20 %2 = extractvalue { i8*, i32 } %1, 0
21 tail call void @__cxa_call_unexpected(i8* %2)
22 unreachable
23
24 unreachable: ; preds = %entry
25 unreachable
26 ; CHECK-LABEL: _Z4funcv
27 ; CHECK-NOT: .debug_frame
28 ; CHECK: .cfi_personality
29 ; CHECK: .cfi_endproc
30 }
31
32 declare i8* @__cxa_allocate_exception(i64) local_unnamed_addr
33
34 declare void @__cxa_throw(i8*, i8*, i8*) local_unnamed_addr
35
36 declare i32 @__gxx_personality_v0(...)
37
38 declare void @__cxa_call_unexpected(i8*) local_unnamed_addr
39
40
41 attributes #0 = { noreturn nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="ppc64le" "target-features"="+altivec,+bpermd,+crypto,+direct-move,+extdiv,+htm,+power8-vector,+vsx,-power9-vector,-qpx" "unsafe-fp-math"="false" "use-soft-float"="false" }
42
236236 ; CHECK: push
237237 ;
238238 ; Jump to throw_exception:
239 ; CHECK-NEXT: .cfi_def_cfa_offset
239240 ; CHECK-NEXT: testb $1, %dil
240241 ; CHECK-NEXT: jne [[THROW_LABEL:LBB[0-9_]+]]
241242 ; Else return exit