address-spaces.ll 874 B

1234567891011121314151617181920212223242526272829303132333435
  1. ; RUN: opt -S -mergefunc < %s | FileCheck %s
  2. target datalayout = "p:32:32:32-p1:32:32:32-p2:16:16:16"
  3. declare void @foo(i32) nounwind
  4. ; None of these functions should be merged
  5. define i32 @store_as0(i32* %x) {
  6. ; CHECK-LABEL: @store_as0(
  7. ; CHECK: call void @foo(
  8. %gep = getelementptr i32, i32* %x, i32 4
  9. %y = load i32, i32* %gep
  10. call void @foo(i32 %y) nounwind
  11. ret i32 %y
  12. }
  13. define i32 @store_as1(i32 addrspace(1)* %x) {
  14. ; CHECK-LABEL: @store_as1(
  15. ; CHECK: call void @foo(
  16. %gep = getelementptr i32, i32 addrspace(1)* %x, i32 4
  17. %y = load i32, i32 addrspace(1)* %gep
  18. call void @foo(i32 %y) nounwind
  19. ret i32 %y
  20. }
  21. define i32 @store_as2(i32 addrspace(2)* %x) {
  22. ; CHECK-LABEL: @store_as2(
  23. ; CHECK: call void @foo(
  24. %gep = getelementptr i32, i32 addrspace(2)* %x, i32 4
  25. %y = load i32, i32 addrspace(2)* %gep
  26. call void @foo(i32 %y) nounwind
  27. ret i32 %y
  28. }