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