54 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=mergeicmps -verify-dom-info -mtriple=x86_64-unknown-unknown -S | FileCheck %s3 4%S = type { i32, i32, i32 }5 6; Last block does not produce the non-constant value into the phi.7; We could handle this case, but an easier way would be to allow other transformations such as8; SimplifyCFG to remove %land.rhs.i.2 and turn the terminator of %land.rhs.i into an unconditional9; branch.10 11define zeroext i1 @opeq1(12; CHECK-LABEL: @opeq1(13; CHECK-NEXT: entry:14; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[A:%.*]], align 415; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[B:%.*]], align 416; CHECK-NEXT: [[CMP_I:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]17; CHECK-NEXT: br i1 [[CMP_I]], label [[LAND_RHS_I:%.*]], label [[OPEQ1_EXIT:%.*]]18; CHECK: land.rhs.i:19; CHECK-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds [[S:%.*]], ptr [[A]], i64 0, i32 120; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[SECOND_I]], align 421; CHECK-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], ptr [[B]], i64 0, i32 122; CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[SECOND2_I]], align 423; CHECK-NEXT: [[CMP3_I:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]]24; CHECK-NEXT: br i1 [[CMP3_I]], label [[LAND_RHS_I_2:%.*]], label [[OPEQ1_EXIT]]25; CHECK: land.rhs.i.2:26; CHECK-NEXT: br label [[OPEQ1_EXIT]]27; CHECK: opeq1.exit:28; CHECK-NEXT: [[TMP4:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ false, [[LAND_RHS_I]] ], [ [[CMP3_I]], [[LAND_RHS_I_2]] ]29; CHECK-NEXT: ret i1 [[TMP4]]30;31 ptr nocapture readonly dereferenceable(12) %a,32 ptr nocapture readonly dereferenceable(12) %b) local_unnamed_addr #0 {33entry:34 %0 = load i32, ptr %a, align 435 %1 = load i32, ptr %b, align 436 %cmp.i = icmp eq i32 %0, %137 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit38 39land.rhs.i:40 %second.i = getelementptr inbounds %S, ptr %a, i64 0, i32 141 %2 = load i32, ptr %second.i, align 442 %second2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 143 %3 = load i32, ptr %second2.i, align 444 %cmp3.i = icmp eq i32 %2, %345 br i1 %cmp3.i, label %land.rhs.i.2, label %opeq1.exit46 47land.rhs.i.2:48 br label %opeq1.exit49 50opeq1.exit:51 %4 = phi i1 [ false, %entry ], [ false, %land.rhs.i], [ %cmp3.i, %land.rhs.i.2 ]52 ret i1 %453}54