escape-gep-invoke.ll 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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. %struct.pair = type { i32, i32 }
  4. @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
  5. ; Addr-of a struct element passed into an invoke instruction.
  6. ; (GEP followed by an invoke)
  7. ; safestack attribute
  8. ; Requires protector.
  9. define i32 @foo() uwtable safestack personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
  10. entry:
  11. ; CHECK: __safestack_unsafe_stack_ptr
  12. %c = alloca %struct.pair, align 4
  13. %exn.slot = alloca i8*
  14. %ehselector.slot = alloca i32
  15. %a = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 0
  16. store i32 0, i32* %a, align 4
  17. %a1 = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 0
  18. invoke void @_Z3exceptPi(i32* %a1)
  19. to label %invoke.cont unwind label %lpad
  20. invoke.cont:
  21. ret i32 0
  22. lpad:
  23. %0 = landingpad { i8*, i32 }
  24. catch i8* null
  25. ret i32 0
  26. }
  27. declare void @_Z3exceptPi(i32*)
  28. declare i32 @__gxx_personality_v0(...)