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