1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
4 ; We used to hit an assertion in getFlippedStrictnessPredicateAndConstant due
5 ; to assuming that edge cases such as %cmp (ult x, 0) already has been
6 ; simplified. But that depends on the worklist order, so that is not always
9 define i16 @d(i16* %d.a, i16* %d.b) {
12 ; CHECK-NEXT: [[T0:%.*]] = load i16, i16* [[D_A:%.*]], align 1
13 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i16 [[T0]], 0
14 ; CHECK-NEXT: br i1 [[TOBOOL]], label [[LAND_END:%.*]], label [[LAND_RHS:%.*]]
16 ; CHECK-NEXT: br label [[LAND_END]]
18 ; CHECK-NEXT: ret i16 -1
21 %t0 = load i16, i16* %d.a, align 1
22 %tobool = icmp ne i16 %t0, 0
23 br i1 %tobool, label %land.rhs, label %land.end
26 %t1 = load i16, i16* %d.b, align 1
27 %cmp = icmp ult i16 %t1, 0
31 %t2 = phi i1 [ false, %entry ], [ %cmp, %land.rhs ]
32 %land.ext = zext i1 %t2 to i16
33 %mul = mul nsw i16 %land.ext, 3
34 %neg = xor i16 %mul, -1