const-addr.ll 741 B

1234567891011121314151617181920212223
  1. ; RUN: opt -mtriple=arm64-darwin-unknown -S -consthoist < %s | FileCheck %s
  2. %T = type { i32, i32, i32, i32 }
  3. define i32 @test1() nounwind {
  4. ; CHECK-LABEL: test1
  5. ; CHECK: %const = bitcast i64 68141056 to i64
  6. ; CHECK: %1 = inttoptr i64 %const to %T*
  7. ; CHECK: %o1 = getelementptr %T, %T* %1, i32 0, i32 1
  8. ; CHECK: %o2 = getelementptr %T, %T* %1, i32 0, i32 2
  9. ; CHECK: %o3 = getelementptr %T, %T* %1, i32 0, i32 3
  10. %at = inttoptr i64 68141056 to %T*
  11. %o1 = getelementptr %T, %T* %at, i32 0, i32 1
  12. %t1 = load i32, i32* %o1
  13. %o2 = getelementptr %T, %T* %at, i32 0, i32 2
  14. %t2 = load i32, i32* %o2
  15. %a1 = add i32 %t1, %t2
  16. %o3 = getelementptr %T, %T* %at, i32 0, i32 3
  17. %t3 = load i32, i32* %o3
  18. %a2 = add i32 %a1, %t3
  19. ret i32 %a2
  20. }