1 ; RUN: opt -passes=instcombine %s -S 2>&1 | FileCheck %s
2 ; RUN: opt -aa-pipeline=basic-aa -passes=instcombine %s -S 2>&1 | FileCheck %s
4 ; Checking successful store-load optimization of array length.
5 ; Function below should deduce just to "return length".
6 ; Doable only if instcombine has access to alias-analysis.
8 define i32 @test1(i32 %length) {
11 %array = alloca i32, i32 2
14 %value_gep = getelementptr inbounds i32, ptr %array, i32 1
15 store i32 %length, ptr %array
16 store i32 0, ptr %value_gep
17 %loaded_length = load i32, ptr %array
18 ; CHECK-NOT: %loaded_length = load i32
20 ret i32 %loaded_length
21 ; CHECK: ret i32 %length