34 lines · plain
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 %s3 4; CHECK: define void @crash(ptr %s, i32 %n) {5; CHECK-NEXT: entry:6; CHECK-NEXT: %struct = load ptr, ptr %s7; CHECK-NEXT: %gep0 = getelementptr [65536 x i32], ptr %struct, i64 0, i32 200008; CHECK-NEXT: store i32 %n, ptr %gep09; CHECK-NEXT: ret void10; CHECK-NEXT: }11 12define void @crash(ptr %s, i32 %n) {13entry:14 %struct = load ptr, ptr %s15 %cmp = icmp slt i32 0, %n16 br i1 %cmp, label %baz, label %bar17baz:18 br label %bar19 20foo:21 %gep0 = getelementptr [65536 x i32], ptr %phi2, i64 0, i32 2000022 br label %st23 24st:25 store i32 %n, ptr %gep026 br label %out27 28bar:29 %phi2 = phi ptr [ %struct, %baz ], [ %struct, %entry ]30 br label %foo31out:32 ret void33}34