32 lines · plain
1; RUN: opt < %s -passes=instcombine -S | FileCheck %s2 3%struct.C = type { ptr, i32 }4 5; Check that we instcombine the load across the prefetch.6 7; CHECK-LABEL: define signext i32 @foo8define signext i32 @foo(ptr %c) local_unnamed_addr #0 {9; CHECK: store i32 %dec, ptr %length_10; CHECK-NOT: load11; CHECK: llvm.prefetch12; CHECK-NEXT: ret13entry:14 %0 = load ptr, ptr %c, align 815 %1 = load ptr, ptr %0, align 816 store ptr %1, ptr %c, align 817 %length_ = getelementptr inbounds %struct.C, ptr %c, i32 0, i32 118 %2 = load i32, ptr %length_, align 819 %dec = add nsw i32 %2, -120 store i32 %dec, ptr %length_, align 821 call void @llvm.prefetch(ptr %1, i32 0, i32 0, i32 1)22 %3 = load i32, ptr %length_, align 823 ret i32 %324}25 26; Function Attrs: inaccessiblemem_or_argmemonly nounwind27declare void @llvm.prefetch(ptr nocapture readonly, i32, i32, i32) 28 29attributes #0 = { noinline nounwind }30; We've explicitly removed the function attrs from llvm.prefetch so we get the defaults.31; attributes #1 = { inaccessiblemem_or_argmemonly nounwind }32