1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -mergeicmps -verify-dom-info -mtriple=x86_64-unknown-unknown -S | FileCheck %s
3
4%S = type { i32, i32 }
5
6define zeroext i1 @opeq(
7; CHECK-LABEL: @opeq(
8; CHECK-NEXT:  entry:
9; CHECK-NEXT:    [[FIRST_I:%.*]] = getelementptr inbounds [[S:%.*]], %S* [[A:%.*]], i64 0, i32 0
10; CHECK-NEXT:    [[TMP0:%.*]] = load i32, i32* [[FIRST_I]], align 4
11; CHECK-NEXT:    [[FIRST1_I:%.*]] = getelementptr inbounds [[S]], %S* [[B:%.*]], i64 0, i32 0
12; CHECK-NEXT:    [[TMP1:%.*]] = load i32, i32* [[FIRST1_I]], align 4
13; CHECK-NEXT:    [[CMP_I:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
14; CHECK-NEXT:    br i1 [[CMP_I]], label [[LAND_RHS_I:%.*]], label [[OPEQ1_EXIT:%.*]]
15; CHECK:       land.rhs.i:
16; CHECK-NEXT:    [[SECOND_I:%.*]] = getelementptr inbounds [[S]], %S* [[A]], i64 0, i32 1
17; CHECK-NEXT:    [[TMP2:%.*]] = load atomic i32, i32* [[SECOND_I]] seq_cst, align 4
18; CHECK-NEXT:    [[SECOND2_I:%.*]] = getelementptr inbounds [[S]], %S* [[B]], i64 0, i32 1
19; CHECK-NEXT:    [[TMP3:%.*]] = load i32, i32* [[SECOND2_I]], align 4
20; CHECK-NEXT:    [[CMP3_I:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]]
21; CHECK-NEXT:    br label [[OPEQ1_EXIT]]
22; CHECK:       opeq1.exit:
23; CHECK-NEXT:    [[TMP4:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[CMP3_I]], [[LAND_RHS_I]] ]
24; CHECK-NEXT:    ret i1 [[TMP4]]
25;
26  %S* nocapture readonly dereferenceable(8) %a,
27  %S* nocapture readonly dereferenceable(8) %b) local_unnamed_addr #0 {
28entry:
29  %first.i = getelementptr inbounds %S, %S* %a, i64 0, i32 0
30  %0 = load i32, i32* %first.i, align 4
31  %first1.i = getelementptr inbounds %S, %S* %b, i64 0, i32 0
32  %1 = load i32, i32* %first1.i, align 4
33  %cmp.i = icmp eq i32 %0, %1
34  br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit
35
36land.rhs.i:
37  %second.i = getelementptr inbounds %S, %S* %a, i64 0, i32 1
38  %2 = load atomic i32, i32* %second.i seq_cst, align 4
39  %second2.i = getelementptr inbounds %S, %S* %b, i64 0, i32 1
40  %3 = load i32, i32* %second2.i, align 4
41  %cmp3.i = icmp eq i32 %2, %3
42  br label %opeq1.exit
43
44opeq1.exit:
45  %4 = phi i1 [ false, %entry ], [ %cmp3.i, %land.rhs.i ]
46  ret i1 %4
47}
48