xref: /llvm-project/llvm/test/Transforms/InstCombine/pr71330.ll (revision 9ef829097bbc4cf908698e3891af11a154e1d3e2)
15cc9347aSNoah Goldstein; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
25cc9347aSNoah Goldstein; RUN: opt -passes=instcombine -S < %s | FileCheck %s
35cc9347aSNoah Goldstein
45cc9347aSNoah Goldsteindefine void @pr71330(i32 %conv, i1 %tobool19.not4, i16 %lb) {
55cc9347aSNoah Goldstein; CHECK-LABEL: define void @pr71330(
65cc9347aSNoah Goldstein; CHECK-SAME: i32 [[CONV:%.*]], i1 [[TOBOOL19_NOT4:%.*]], i16 [[LB:%.*]]) {
75cc9347aSNoah Goldstein; CHECK-NEXT:  entry:
85cc9347aSNoah Goldstein; CHECK-NEXT:    br label [[FOR_COND7_PREHEADER:%.*]]
95cc9347aSNoah Goldstein; CHECK:       for.cond7.preheader:
105cc9347aSNoah Goldstein; CHECK-NEXT:    br i1 [[TOBOOL19_NOT4]], label [[FOR_COND7_PREHEADER_SPLIT_US:%.*]], label [[FOR_COND7:%.*]]
115cc9347aSNoah Goldstein; CHECK:       for.cond7.preheader.split.us:
125cc9347aSNoah Goldstein; CHECK-NEXT:    br i1 true, label [[FOR_COND7_PREHEADER_SPLIT_US_SPLIT:%.*]], label [[FOR_COND7_US_US:%.*]]
135cc9347aSNoah Goldstein; CHECK:       for.cond7.us.us:
145cc9347aSNoah Goldstein; CHECK-NEXT:    br i1 poison, label [[FOR_COND7_US_US]], label [[FOR_END25:%.*]]
155cc9347aSNoah Goldstein; CHECK:       for.cond7.preheader.split.us.split:
165cc9347aSNoah Goldstein; CHECK-NEXT:    ret void
175cc9347aSNoah Goldstein; CHECK:       for.cond7:
18*9ef82909SNoah Goldstein; CHECK-NEXT:    [[CMP12:%.*]] = icmp slt i32 [[CONV]], 0
195cc9347aSNoah Goldstein; CHECK-NEXT:    br i1 [[CMP12]], label [[FOR_BODY14:%.*]], label [[FOR_END25]]
205cc9347aSNoah Goldstein; CHECK:       for.body14:
215cc9347aSNoah Goldstein; CHECK-NEXT:    ret void
225cc9347aSNoah Goldstein; CHECK:       for.end25:
235cc9347aSNoah Goldstein; CHECK-NEXT:    br i1 false, label [[FOR_COND7_PREHEADER]], label [[FOR_END36:%.*]]
245cc9347aSNoah Goldstein; CHECK:       for.end36:
255cc9347aSNoah Goldstein; CHECK-NEXT:    ret void
265cc9347aSNoah Goldstein;
275cc9347aSNoah Goldsteinentry:
285cc9347aSNoah Goldstein  br label %for.cond7.preheader
295cc9347aSNoah Goldstein
305cc9347aSNoah Goldsteinfor.cond7.preheader:  ; preds = %for.end25, %entry
315cc9347aSNoah Goldstein  %storemerge33 = phi i32 [ -3, %entry ], [ 0, %for.end25 ]
325cc9347aSNoah Goldstein  %sm8 = and i32 %storemerge33, 1
335cc9347aSNoah Goldstein  %add = add i32 %storemerge33, 8
345cc9347aSNoah Goldstein  %cmp.i.i.not = icmp eq i32 %sm8, 0
355cc9347aSNoah Goldstein  %cmp3.i.i = icmp eq i32 %add, 0
365cc9347aSNoah Goldstein  %and7.i.i = and i32 %storemerge33, 1
375cc9347aSNoah Goldstein  %cmp8.i.i = icmp eq i32 %and7.i.i, 0
385cc9347aSNoah Goldstein  %tobool.not.i.i = icmp eq i32 %add, 0
395cc9347aSNoah Goldstein  %..i.i = select i1 %tobool.not.i.i, i32 1, i32 3
405cc9347aSNoah Goldstein  br i1 %tobool19.not4, label %for.cond7.preheader.split.us, label %for.cond7
415cc9347aSNoah Goldstein
425cc9347aSNoah Goldsteinfor.cond7.preheader.split.us:  ; preds = %for.cond7.preheader
435cc9347aSNoah Goldstein  br i1 %cmp.i.i.not, label %for.cond7.us.us, label %for.cond7.preheader.split.us.split
445cc9347aSNoah Goldstein
455cc9347aSNoah Goldsteinfor.cond7.us.us:  ; preds = %for.cond7.us.us, %for.cond7.preheader.split.us
465cc9347aSNoah Goldstein  %spec.select = select i1 %cmp8.i.i, i32 1, i32 %..i.i
475cc9347aSNoah Goldstein  %retval.0.i.i.us.us = select i1 %cmp3.i.i, i32 0, i32 %spec.select
485cc9347aSNoah Goldstein  %add9.us.us = add i32 %retval.0.i.i.us.us, %conv
495cc9347aSNoah Goldstein  %conv10.us.us = sext i32 %add9.us.us to i64
505cc9347aSNoah Goldstein  %cmp12.us.us = icmp slt i64 %conv10.us.us, 0
515cc9347aSNoah Goldstein  br i1 %cmp12.us.us, label %for.cond7.us.us, label %for.end25
525cc9347aSNoah Goldstein
535cc9347aSNoah Goldsteinfor.cond7.preheader.split.us.split:  ; preds = %for.cond7.preheader.split.us
545cc9347aSNoah Goldstein  ret void
555cc9347aSNoah Goldstein
565cc9347aSNoah Goldsteinfor.cond7:  ; preds = %for.cond7.preheader
575cc9347aSNoah Goldstein  %cmp.i.i.not.not = xor i1 %cmp.i.i.not, true
585cc9347aSNoah Goldstein  %brmerge = select i1 %cmp.i.i.not.not, i1 true, i1 %cmp3.i.i
595cc9347aSNoah Goldstein  %spec.select34 = select i1 %cmp8.i.i, i32 1, i32 %..i.i
605cc9347aSNoah Goldstein  %retval.0.i.i = select i1 %brmerge, i32 0, i32 %spec.select34
615cc9347aSNoah Goldstein  %add9 = add i32 %retval.0.i.i, %conv
625cc9347aSNoah Goldstein  %conv10 = sext i32 %add9 to i64
635cc9347aSNoah Goldstein  %cmp12 = icmp slt i64 %conv10, 0
645cc9347aSNoah Goldstein  br i1 %cmp12, label %for.body14, label %for.end25
655cc9347aSNoah Goldstein
665cc9347aSNoah Goldsteinfor.body14:  ; preds = %for.cond7
675cc9347aSNoah Goldstein  ret void
685cc9347aSNoah Goldstein
695cc9347aSNoah Goldsteinfor.end25:  ; preds = %for.cond7, %for.cond7.us.us
705cc9347aSNoah Goldstein  %conv35 = zext i16 %lb to i32
715cc9347aSNoah Goldstein  %cmp = icmp slt i32 %conv35, 0
725cc9347aSNoah Goldstein  br i1 %cmp, label %for.cond7.preheader, label %for.end36
735cc9347aSNoah Goldstein
745cc9347aSNoah Goldsteinfor.end36:  ; preds = %for.end25
755cc9347aSNoah Goldstein  ret void
765cc9347aSNoah Goldstein}
77