blob: 302b3912c4d609c0a3726433af7e734850cdf678 [file] [log] [blame]
Xin Tong8ba674e2018-02-28 12:08:00 +00001; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -mergeicmps -mtriple=x86_64-unknown-unknown -S | FileCheck %s
3
4%"struct.std::pair" = 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 as
8; SimplifyCFG to remove %land.rhs.i.2 and turn the terminator of %land.rhs.i into an unconditional
9; branch.
10
11define zeroext i1 @opeq1(
12; CHECK-LABEL: @opeq1(
13; CHECK-NEXT: entry:
14; CHECK-NEXT: [[FIRST_I:%.*]] = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* [[A:%.*]], i64 0, i32 0
15; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[FIRST_I]], align 4
16; CHECK-NEXT: [[FIRST1_I:%.*]] = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* [[B:%.*]], i64 0, i32 0
17; CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* [[FIRST1_I]], align 4
18; CHECK-NEXT: [[CMP_I:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
19; CHECK-NEXT: br i1 [[CMP_I]], label [[LAND_RHS_I:%.*]], label [[OPEQ1_EXIT:%.*]]
20; CHECK: land.rhs.i:
21; CHECK-NEXT: [[SECOND_I:%.*]] = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* [[A]], i64 0, i32 1
22; CHECK-NEXT: [[TMP2:%.*]] = load i32, i32* [[SECOND_I]], align 4
23; CHECK-NEXT: [[SECOND2_I:%.*]] = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* [[B]], i64 0, i32 1
24; CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* [[SECOND2_I]], align 4
25; CHECK-NEXT: [[CMP3_I:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]]
26; CHECK-NEXT: br i1 [[CMP3_I]], label [[LAND_RHS_I:%.*]], label [[OPEQ1_EXIT:%.*]]
27; CHECK: land.rhs.i.2:
28; CHECK-NEXT: br label [[OPEQ1_EXIT]]
29; CHECK: opeq1.exit:
30; CHECK-NEXT: [[TMP4:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[CMP3_I]], [[LAND_RHS_I]] ]
31; CHECK-NEXT: ret i1 [[TMP4]]
32;
33 %"struct.std::pair"* nocapture readonly dereferenceable(12) %a,
34 %"struct.std::pair"* nocapture readonly dereferenceable(12) %b) local_unnamed_addr #0 {
35entry:
36 %first.i = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* %a, i64 0, i32 0
37 %0 = load i32, i32* %first.i, align 4
38 %first1.i = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* %b, i64 0, i32 0
39 %1 = load i32, i32* %first1.i, align 4
40 %cmp.i = icmp eq i32 %0, %1
41 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit
42
43land.rhs.i:
44 %second.i = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* %a, i64 0, i32 1
45 %2 = load i32, i32* %second.i, align 4
46 %second2.i = getelementptr inbounds %"struct.std::pair", %"struct.std::pair"* %b, i64 0, i32 1
47 %3 = load i32, i32* %second2.i, align 4
48 %cmp3.i = icmp eq i32 %2, %3
49 br i1 %cmp3.i, label %land.rhs.i.2, label %opeq1.exit
50
51land.rhs.i.2:
52 br label %opeq1.exit
53
54opeq1.exit:
55 %4 = phi i1 [ false, %entry ], [ false, %land.rhs.i], [ %cmp3.i, %land.rhs.i.2 ]
56 ret i1 %4
57}