1 ; RUN: opt < %s -passes=sink -S | FileCheck %s
3 declare ptr @llvm.load.relative.i32(ptr %ptr, i32 %offset) argmemonly nounwind readonly
4 define i64 @sinkload(i1 %cmp, ptr %ptr, i32 %off) {
5 ; CHECK-LABEL: @sinkload
8 ; CHECK: call void @foo(ptr %a)
9 ; CHECK-NEXT: %x = load i64, ptr %a
10 ; CHECK-NEXT: %y = call ptr @llvm.load.relative.i32(ptr %ptr, i32 %off)
11 call void @foo(ptr %a)
13 %y = call ptr @llvm.load.relative.i32(ptr %ptr, i32 %off)
14 br i1 %cmp, label %A, label %B
20 ; CHECK-NOT: load i64, ptr %a
21 ; CHECK-NOT: call ptr @llvm.load.relative(ptr %ptr, i32 off)
22 %y2 = ptrtoint ptr %y to i64
23 %retval = add i64 %y2, %x