ctor-list-opt-inbounds.ll 912 B

1234567891011121314151617181920212223
  1. ; RUN: opt < %s -globalopt -S | FileCheck %s
  2. ; Don't get fooled by the inbounds keyword; it doesn't change
  3. ; the computed address.
  4. ; CHECK: @H = global i32 2
  5. ; CHECK: @I = global i32 2
  6. @llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @CTOR } ]
  7. @addr = external global i32
  8. @G = internal global [6 x [5 x i32]] zeroinitializer
  9. @H = global i32 80
  10. @I = global i32 90
  11. define internal void @CTOR() {
  12. store i32 1, i32* getelementptr ([6 x [5 x i32]], [6 x [5 x i32]]* @G, i64 0, i64 0, i64 0)
  13. store i32 2, i32* getelementptr inbounds ([6 x [5 x i32]], [6 x [5 x i32]]* @G, i64 0, i64 0, i64 0)
  14. %t = load i32, i32* getelementptr ([6 x [5 x i32]], [6 x [5 x i32]]* @G, i64 0, i64 0, i64 0)
  15. store i32 %t, i32* @H
  16. %s = load i32, i32* getelementptr inbounds ([6 x [5 x i32]], [6 x [5 x i32]]* @G, i64 0, i64 0, i64 0)
  17. store i32 %s, i32* @I
  18. ret void
  19. }