diff --git a/test/Transforms/CorrelatedValuePropagation/icmp.ll b/test/Transforms/CorrelatedValuePropagation/icmp.ll index fa2e6ff9af6..e576f13fde0 100644 --- a/test/Transforms/CorrelatedValuePropagation/icmp.ll +++ b/test/Transforms/CorrelatedValuePropagation/icmp.ll @@ -396,7 +396,7 @@ define i1 @test13(i8 %x, i64* %p) { ; CHECK-NEXT: [[ZEXT:%.*]] = zext i8 [[X:%.*]] to i64 ; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw i64 [[ZEXT]], 128 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i64 [[ADD]], 384 -; CHECK-NEXT: store i64 [[ADD]], i64* [[P:%.*]] +; CHECK-NEXT: store i64 [[ADD]], i64* [[P:%.*]], align 8 ; CHECK-NEXT: ret i1 [[CMP]] ; %zext = zext i8 %x to i64 @@ -652,4 +652,355 @@ exit: declare i1 @get_bool() +define void @test_icmp_or_ult(i32 %a, i32 %b) { +; CHECK-LABEL: @test_icmp_or_ult( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[OR:%.*]] = or i32 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[OR]], 7 +; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] +; CHECK: if.true: +; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP2]]) +; CHECK-NEXT: [[CMP3:%.*]] = icmp ult i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP3]]) +; CHECK-NEXT: ret void +; CHECK: if.false: +; CHECK-NEXT: [[CMP4:%.*]] = icmp uge i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP4]]) +; CHECK-NEXT: [[CMP5:%.*]] = icmp uge i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP5]]) +; CHECK-NEXT: ret void +; +entry: + %or = or i32 %a, %b + %cmp = icmp ult i32 %or, 7 + br i1 %cmp, label %if.true, label %if.false + +if.true: + %cmp2 = icmp ult i32 %a, 7 + call void @check1(i1 %cmp2) + %cmp3 = icmp ult i32 %b, 7 + call void @check1(i1 %cmp3) + ret void + +if.false: + %cmp4 = icmp uge i32 %a, 7 + call void @check1(i1 %cmp4) + %cmp5 = icmp uge i32 %b, 7 + call void @check1(i1 %cmp5) + ret void +} + +define void @test_icmp_or_ule(i32 %a, i32 %b) { +; CHECK-LABEL: @test_icmp_or_ule( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[OR:%.*]] = or i32 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp ule i32 [[OR]], 7 +; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] +; CHECK: if.true: +; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP2]]) +; CHECK-NEXT: [[CMP3:%.*]] = icmp ule i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP3]]) +; CHECK-NEXT: ret void +; CHECK: if.false: +; CHECK-NEXT: [[CMP4:%.*]] = icmp ugt i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP4]]) +; CHECK-NEXT: [[CMP5:%.*]] = icmp ugt i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP5]]) +; CHECK-NEXT: ret void +; +entry: + %or = or i32 %a, %b + %cmp = icmp ule i32 %or, 7 + br i1 %cmp, label %if.true, label %if.false + +if.true: + %cmp2 = icmp ule i32 %a, 7 + call void @check1(i1 %cmp2) + %cmp3 = icmp ule i32 %b, 7 + call void @check1(i1 %cmp3) + ret void + +if.false: + %cmp4 = icmp ugt i32 %a, 7 + call void @check1(i1 %cmp4) + %cmp5 = icmp ugt i32 %b, 7 + call void @check1(i1 %cmp5) + ret void +} + +define void @test_icmp_or_ugt(i32 %a, i32 %b) { +; CHECK-LABEL: @test_icmp_or_ugt( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[OR:%.*]] = or i32 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i32 [[OR]], 7 +; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] +; CHECK: if.true: +; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP2]]) +; CHECK-NEXT: [[CMP3:%.*]] = icmp ugt i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP3]]) +; CHECK-NEXT: ret void +; CHECK: if.false: +; CHECK-NEXT: [[CMP4:%.*]] = icmp ule i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP4]]) +; CHECK-NEXT: [[CMP5:%.*]] = icmp ule i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP5]]) +; CHECK-NEXT: ret void +; +entry: + %or = or i32 %a, %b + %cmp = icmp ugt i32 %or, 7 + br i1 %cmp, label %if.true, label %if.false + +if.true: + %cmp2 = icmp ugt i32 %a, 7 + call void @check1(i1 %cmp2) + %cmp3 = icmp ugt i32 %b, 7 + call void @check1(i1 %cmp3) + ret void + +if.false: + %cmp4 = icmp ule i32 %a, 7 + call void @check1(i1 %cmp4) + %cmp5 = icmp ule i32 %b, 7 + call void @check1(i1 %cmp5) + ret void +} + +define void @test_icmp_or_uge(i32 %a, i32 %b) { +; CHECK-LABEL: @test_icmp_or_uge( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[OR:%.*]] = or i32 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp uge i32 [[OR]], 7 +; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] +; CHECK: if.true: +; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP2]]) +; CHECK-NEXT: [[CMP3:%.*]] = icmp uge i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP3]]) +; CHECK-NEXT: ret void +; CHECK: if.false: +; CHECK-NEXT: [[CMP4:%.*]] = icmp ult i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP4]]) +; CHECK-NEXT: [[CMP5:%.*]] = icmp ult i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP5]]) +; CHECK-NEXT: ret void +; +entry: + %or = or i32 %a, %b + %cmp = icmp uge i32 %or, 7 + br i1 %cmp, label %if.true, label %if.false + +if.true: + %cmp2 = icmp uge i32 %a, 7 + call void @check1(i1 %cmp2) + %cmp3 = icmp uge i32 %b, 7 + call void @check1(i1 %cmp3) + ret void + +if.false: + %cmp4 = icmp ult i32 %a, 7 + call void @check1(i1 %cmp4) + %cmp5 = icmp ult i32 %b, 7 + call void @check1(i1 %cmp5) + ret void +} + +define void @test_icmp_or_slt(i32 %a, i32 %b) { +; CHECK-LABEL: @test_icmp_or_slt( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[OR:%.*]] = or i32 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[OR]], 7 +; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] +; CHECK: if.true: +; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP2]]) +; CHECK-NEXT: [[CMP3:%.*]] = icmp slt i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP3]]) +; CHECK-NEXT: ret void +; CHECK: if.false: +; CHECK-NEXT: [[CMP4:%.*]] = icmp sge i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP4]]) +; CHECK-NEXT: [[CMP5:%.*]] = icmp sge i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP5]]) +; CHECK-NEXT: ret void +; +entry: + %or = or i32 %a, %b + %cmp = icmp slt i32 %or, 7 + br i1 %cmp, label %if.true, label %if.false + +if.true: + %cmp2 = icmp slt i32 %a, 7 + call void @check1(i1 %cmp2) + %cmp3 = icmp slt i32 %b, 7 + call void @check1(i1 %cmp3) + ret void + +if.false: + %cmp4 = icmp sge i32 %a, 7 + call void @check1(i1 %cmp4) + %cmp5 = icmp sge i32 %b, 7 + call void @check1(i1 %cmp5) + ret void +} + +define void @test_icmp_and_ugt(i32 %a, i32 %b) { +; CHECK-LABEL: @test_icmp_and_ugt( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i32 [[AND]], 7 +; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] +; CHECK: if.true: +; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP2]]) +; CHECK-NEXT: [[CMP3:%.*]] = icmp ugt i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP3]]) +; CHECK-NEXT: ret void +; CHECK: if.false: +; CHECK-NEXT: [[CMP4:%.*]] = icmp ule i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP4]]) +; CHECK-NEXT: [[CMP5:%.*]] = icmp ule i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP5]]) +; CHECK-NEXT: ret void +; +entry: + %and = and i32 %a, %b + %cmp = icmp ugt i32 %and, 7 + br i1 %cmp, label %if.true, label %if.false + +if.true: + %cmp2 = icmp ugt i32 %a, 7 + call void @check1(i1 %cmp2) + %cmp3 = icmp ugt i32 %b, 7 + call void @check1(i1 %cmp3) + ret void + +if.false: + %cmp4 = icmp ule i32 %a, 7 + call void @check1(i1 %cmp4) + %cmp5 = icmp ule i32 %b, 7 + call void @check1(i1 %cmp5) + ret void +} + +define void @test_icmp_and_uge(i32 %a, i32 %b) { +; CHECK-LABEL: @test_icmp_and_uge( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp uge i32 [[AND]], 7 +; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] +; CHECK: if.true: +; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP2]]) +; CHECK-NEXT: [[CMP3:%.*]] = icmp uge i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP3]]) +; CHECK-NEXT: ret void +; CHECK: if.false: +; CHECK-NEXT: [[CMP4:%.*]] = icmp ult i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP4]]) +; CHECK-NEXT: [[CMP5:%.*]] = icmp ult i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP5]]) +; CHECK-NEXT: ret void +; +entry: + %and = and i32 %a, %b + %cmp = icmp uge i32 %and, 7 + br i1 %cmp, label %if.true, label %if.false + +if.true: + %cmp2 = icmp uge i32 %a, 7 + call void @check1(i1 %cmp2) + %cmp3 = icmp uge i32 %b, 7 + call void @check1(i1 %cmp3) + ret void + +if.false: + %cmp4 = icmp ult i32 %a, 7 + call void @check1(i1 %cmp4) + %cmp5 = icmp ult i32 %b, 7 + call void @check1(i1 %cmp5) + ret void +} + +define void @test_icmp_and_ult(i32 %a, i32 %b) { +; CHECK-LABEL: @test_icmp_and_ult( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[AND]], 7 +; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] +; CHECK: if.true: +; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP2]]) +; CHECK-NEXT: [[CMP3:%.*]] = icmp ult i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP3]]) +; CHECK-NEXT: ret void +; CHECK: if.false: +; CHECK-NEXT: [[CMP4:%.*]] = icmp uge i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP4]]) +; CHECK-NEXT: [[CMP5:%.*]] = icmp uge i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP5]]) +; CHECK-NEXT: ret void +; +entry: + %and = and i32 %a, %b + %cmp = icmp ult i32 %and, 7 + br i1 %cmp, label %if.true, label %if.false + +if.true: + %cmp2 = icmp ult i32 %a, 7 + call void @check1(i1 %cmp2) + %cmp3 = icmp ult i32 %b, 7 + call void @check1(i1 %cmp3) + ret void + +if.false: + %cmp4 = icmp uge i32 %a, 7 + call void @check1(i1 %cmp4) + %cmp5 = icmp uge i32 %b, 7 + call void @check1(i1 %cmp5) + ret void +} + +define void @test_icmp_and_sgt(i32 %a, i32 %b) { +; CHECK-LABEL: @test_icmp_and_sgt( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[AND]], 7 +; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] +; CHECK: if.true: +; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP2]]) +; CHECK-NEXT: [[CMP3:%.*]] = icmp sgt i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP3]]) +; CHECK-NEXT: ret void +; CHECK: if.false: +; CHECK-NEXT: [[CMP4:%.*]] = icmp sle i32 [[A]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP4]]) +; CHECK-NEXT: [[CMP5:%.*]] = icmp sle i32 [[B]], 7 +; CHECK-NEXT: call void @check1(i1 [[CMP5]]) +; CHECK-NEXT: ret void +; +entry: + %and = and i32 %a, %b + %cmp = icmp sgt i32 %and, 7 + br i1 %cmp, label %if.true, label %if.false + +if.true: + %cmp2 = icmp sgt i32 %a, 7 + call void @check1(i1 %cmp2) + %cmp3 = icmp sgt i32 %b, 7 + call void @check1(i1 %cmp3) + ret void + +if.false: + %cmp4 = icmp sle i32 %a, 7 + call void @check1(i1 %cmp4) + %cmp5 = icmp sle i32 %b, 7 + call void @check1(i1 %cmp5) + ret void +} + attributes #4 = { noreturn }