xref: /llvm-project/llvm/test/Transforms/SafeStack/X86/escape-gep-invoke.ll (revision 3bd517205799a152689434ceddf9493765f1e883)
1; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
2; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
5
6%struct.pair = type { i32, i32 }
7
8@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
9
10; Addr-of a struct element passed into an invoke instruction.
11;   (GEP followed by an invoke)
12;  safestack attribute
13; Requires protector.
14define i32 @foo() uwtable safestack personality ptr @__gxx_personality_v0 {
15entry:
16  ; CHECK: __safestack_unsafe_stack_ptr
17  %c = alloca %struct.pair, align 4
18  %exn.slot = alloca ptr
19  %ehselector.slot = alloca i32
20  store i32 0, ptr %c, align 4
21  invoke void @_Z3exceptPi(ptr %c)
22          to label %invoke.cont unwind label %lpad
23
24invoke.cont:
25  ret i32 0
26
27lpad:
28  %0 = landingpad { ptr, i32 }
29          catch ptr null
30  ret i32 0
31}
32
33declare void @_Z3exceptPi(ptr)
34declare i32 @__gxx_personality_v0(...)
35