1; RUN: opt -instcombine %s -S 2>&1 | FileCheck %s 2; RUN: opt -aa-pipeline=basic-aa -passes=instcombine %s -S 2>&1 | FileCheck %s 3 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. 7 8define i32 @test1(i32 %length) { 9; CHECK-LABEL: entry: 10entry: 11 %array = alloca i32, i32 2 12 ; CHECK-NOT: %array 13 14 %length_gep = getelementptr inbounds i32, i32 * %array, i32 0 15 %value_gep = getelementptr inbounds i32, i32 * %array, i32 1 16 store i32 %length, i32 * %length_gep 17 store i32 0, i32 * %value_gep 18 %loaded_length = load i32, i32 * %length_gep 19 ; CHECK-NOT: %loaded_length = load i32 20 21 ret i32 %loaded_length 22 ; CHECK: ret i32 %length 23} 24