1; RUN: opt -S -memdep -gvn -basicaa < %s | FileCheck %s
2; RUN: opt -S -memdep -memdep-block-scan-limit=1 -gvn -basicaa < %s | FileCheck %s --check-prefix=WITH-LIMIT
3; CHECK-LABEL: @test(
4; CHECK: load
5; CHECK-NOT: load
6; WITH-LIMIT-LABEL: @test(
7; WITH-LIMIT-CHECK: load
8; WITH-LIMIT-CHECK: load
9define i32 @test(i32* %p) {
10 %1 = load i32, i32* %p
11 %2 = add i32 %1, 3
12 %3 = load i32, i32* %p
13 %4 = add i32 %2, %3
14 ret i32 %4
15}
16