1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=jump-threading < %s | FileCheck %s
5 ; This is actually a test for value tracking. Jump threading produces
6 ; "%phi = phi i16" when it removes all edges leading to %unreachable.
7 ; The .ll parser won't let us write that directly since it's invalid code.
9 define void @func() nounwind {
12 ; CHECK-NEXT: br label [[BB:%.*]]
14 ; CHECK-NEXT: br label [[BB]]
16 ; CHECK-NEXT: [[PHI:%.*]] = phi i16 [ [[ADD:%.*]], [[UNREACHABLE:%.*]] ], [ 0, [[NEXT:%.*]] ]
17 ; CHECK-NEXT: [[ADD]] = add i16 0, [[PHI]]
18 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[PHI]], 0
19 ; CHECK-NEXT: br i1 [[CMP]], label [[UNREACHABLE]], label [[NEXT]]
21 ; CHECK-NEXT: br label [[UNREACHABLE]]
30 %phi = phi i16 [ %add, %unreachable ], [ 0, %next ]
31 %add = add i16 0, %phi
32 %cmp = icmp slt i16 %phi, 0
33 br i1 %cmp, label %unreachable, label %next