@@ -653,6 +653,35 @@ return:
653653 ret void
654654}
655655
656+ define void @or_tree_second_implies_first_with_unknown_cond (i64 %x , i1 %cond ) {
657+ ; CHECK-LABEL: @or_tree_second_implies_first_with_unknown_cond(
658+ ; CHECK-NEXT: entry:
659+ ; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt i64 [[X:%.*]], 1
660+ ; CHECK-NEXT: [[OR1:%.*]] = select i1 [[CMP1]], i1 [[COND:%.*]], i1 false
661+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i64 [[X]], 2
662+ ; CHECK-NEXT: [[OR2:%.*]] = select i1 [[OR1]], i1 [[CMP2]], i1 false
663+ ; CHECK-NEXT: br i1 [[OR2]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
664+ ; CHECK: if.then:
665+ ; CHECK-NEXT: call void @side_effect()
666+ ; CHECK-NEXT: br label [[IF_END]]
667+ ; CHECK: if.end:
668+ ; CHECK-NEXT: ret void
669+ ;
670+ entry:
671+ %cmp1 = icmp ugt i64 %x , 1
672+ %or1 = select i1 %cmp1 , i1 %cond , i1 false
673+ %cmp2 = icmp ult i64 %x , 2
674+ %or2 = select i1 %or1 , i1 %cmp2 , i1 false
675+ br i1 %or2 , label %if.then , label %if.end
676+
677+ if.then:
678+ call void @side_effect ()
679+ br label %if.end
680+
681+ if.end:
682+ ret void
683+ }
684+
656685define void @negative_and_or_tree_second_implies_first (i32 noundef %v0 , i32 noundef %v1 , i32 noundef %v2 ) {
657686; CHECK-LABEL: @negative_and_or_tree_second_implies_first(
658687; CHECK-NEXT: entry:
0 commit comments