1f38f99bdSRoman Lebedev; RUN: opt -S -passes=mergefunc < %s | FileCheck %s 2cee313d2SEric Christopher 3cee313d2SEric Christophertarget datalayout = "p:32:32:32-p1:32:32:32-p2:16:16:16" 4cee313d2SEric Christopher 5cee313d2SEric Christopherdeclare void @foo(i32) nounwind 6cee313d2SEric Christopher 7cee313d2SEric Christopher; None of these functions should be merged 8cee313d2SEric Christopher 9*ee278900SNikita Popovdefine i32 @store_as0(ptr %x) { 10cee313d2SEric Christopher; CHECK-LABEL: @store_as0( 11cee313d2SEric Christopher; CHECK: call void @foo( 12*ee278900SNikita Popov %gep = getelementptr i32, ptr %x, i32 4 13*ee278900SNikita Popov %y = load i32, ptr %gep 14cee313d2SEric Christopher call void @foo(i32 %y) nounwind 15cee313d2SEric Christopher ret i32 %y 16cee313d2SEric Christopher} 17cee313d2SEric Christopher 18*ee278900SNikita Popovdefine i32 @store_as1(ptr addrspace(1) %x) { 19cee313d2SEric Christopher; CHECK-LABEL: @store_as1( 20cee313d2SEric Christopher; CHECK: call void @foo( 21*ee278900SNikita Popov %gep = getelementptr i32, ptr addrspace(1) %x, i32 4 22*ee278900SNikita Popov %y = load i32, ptr addrspace(1) %gep 23cee313d2SEric Christopher call void @foo(i32 %y) nounwind 24cee313d2SEric Christopher ret i32 %y 25cee313d2SEric Christopher} 26cee313d2SEric Christopher 27*ee278900SNikita Popovdefine i32 @store_as2(ptr addrspace(2) %x) { 28cee313d2SEric Christopher; CHECK-LABEL: @store_as2( 29cee313d2SEric Christopher; CHECK: call void @foo( 30*ee278900SNikita Popov %gep = getelementptr i32, ptr addrspace(2) %x, i32 4 31*ee278900SNikita Popov %y = load i32, ptr addrspace(2) %gep 32cee313d2SEric Christopher call void @foo(i32 %y) nounwind 33cee313d2SEric Christopher ret i32 %y 34cee313d2SEric Christopher} 35cee313d2SEric Christopher 36