23 lines · plain
1; RUN: opt -passes=instcombine %s -S 2>&1 | FileCheck %s2; RUN: opt -aa-pipeline=basic-aa -passes=instcombine %s -S 2>&1 | FileCheck %s3 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 212 ; CHECK-NOT: %array13 14 %value_gep = getelementptr inbounds i32, ptr %array, i32 115 store i32 %length, ptr %array16 store i32 0, ptr %value_gep17 %loaded_length = load i32, ptr %array18 ; CHECK-NOT: %loaded_length = load i3219 20 ret i32 %loaded_length21 ; CHECK: ret i32 %length22}23