2
0

cxx-dtor.ll 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. ; RUN: opt < %s -globalopt -S | FileCheck %s
  2. %0 = type { i32, void ()* }
  3. %struct.A = type { i8 }
  4. %struct.B = type { }
  5. @a = global %struct.A zeroinitializer, align 1
  6. @__dso_handle = external global i8*
  7. @llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @_GLOBAL__I_a }]
  8. ; CHECK-NOT: call i32 @__cxa_atexit
  9. define internal void @__cxx_global_var_init() nounwind section "__TEXT,__StaticInit,regular,pure_instructions" {
  10. %1 = call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.A*)* @_ZN1AD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.A, %struct.A* @a, i32 0, i32 0), i8* bitcast (i8** @__dso_handle to i8*))
  11. ret void
  12. }
  13. define linkonce_odr void @_ZN1AD1Ev(%struct.A* %this) nounwind align 2 {
  14. %t = bitcast %struct.A* %this to %struct.B*
  15. call void @_ZN1BD1Ev(%struct.B* %t)
  16. ret void
  17. }
  18. declare i32 @__cxa_atexit(void (i8*)*, i8*, i8*)
  19. define linkonce_odr void @_ZN1BD1Ev(%struct.B* %this) nounwind align 2 {
  20. ret void
  21. }
  22. define internal void @_GLOBAL__I_a() nounwind section "__TEXT,__StaticInit,regular,pure_instructions" {
  23. call void @__cxx_global_var_init()
  24. ret void
  25. }