1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt -passes=newgvn -S < %s | FileCheck %s
4 ; Check that an unreachable predecessor to a PHI node doesn't cause a crash.
7 define i32 @f(ptr %f) {
8 ; CHECK-LABEL: define i32 @f(
9 ; CHECK-SAME: ptr [[F:%.*]]) {
11 ; CHECK-NEXT: br label [[BB2:%.*]]
13 ; CHECK-NEXT: store i8 poison, ptr null, align 1
14 ; CHECK-NEXT: br i1 false, label [[BB1:%.*]], label [[BB2]]
16 ; CHECK-NEXT: [[STOREMERGE:%.*]] = load i32, ptr null, align 4
17 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
19 ; Load should be removed, since it's ignored.
21 %bar = load ptr, ptr %f
24 %zed = load ptr, ptr %f
25 br i1 false, label %bb1, label %bb2
27 %foo = phi ptr [ null, %bb0 ], [ %zed, %bb1 ]
28 %storemerge = load i32, ptr %foo