1 ; Checks that case when GEP is bound to trivial PHI node is correctly handled.
2 ; RUN: opt %s -mtriple=aarch64-linux-gnu -codegenprepare -S -o - | FileCheck %s
4 ; CHECK: define void @crash([65536 x i32]** %s, i32 %n) {
6 ; CHECK-NEXT: %struct = load [65536 x i32]*, [65536 x i32]** %s
7 ; CHECK-NEXT: %gep0 = getelementptr [65536 x i32], [65536 x i32]* %struct, i64 0, i32 20000
8 ; CHECK-NEXT: store i32 %n, i32* %gep0
12 define void @crash([65536 x i32]** %s, i32 %n) {
14 %struct = load [65536 x i32]*, [65536 x i32]** %s
15 %cmp = icmp slt i32 0, %n
16 br i1 %cmp, label %baz, label %bar
21 %gep0 = getelementptr [65536 x i32], [65536 x i32]* %phi2, i64 0, i32 20000
25 store i32 %n, i32* %gep0
29 %phi2 = phi [65536 x i32]* [ %struct, %baz ], [ %struct, %entry ]