1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -mtriple=x86_64-unknown-unknown -passes=mergeicmps -verify-dom-info -S | FileCheck %s --check-prefix=X86
4 %S = type { i32, i32, i32, i32, i32}
6 define zeroext i1 @opeq1(
8 ; X86-NEXT: "entry+land.rhs.i+land.rhs.i.2+land.rhs.i.3":
9 ; X86-NEXT: [[PTR:%.*]] = alloca i32, align 4
10 ; X86-NEXT: store i32 42, ptr [[PTR]], align 4
11 ; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[A:%.*]], ptr [[B:%.*]], i64 16)
12 ; X86-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0
13 ; X86-NEXT: br label [[OPEQ1_EXIT:%.*]]
15 ; X86-NEXT: ret i1 [[TMP2]]
17 ptr nocapture readonly dereferenceable(16) %a,
18 ptr nocapture readonly dereferenceable(16) %b) local_unnamed_addr nofree nosync {
22 %0 = load i32, ptr %a, align 4
23 %1 = load i32, ptr %b, align 4
24 ; Does other work, has no interference, merge block
25 store i32 42, ptr %ptr
26 %cmp.i = icmp eq i32 %0, %1
27 br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit
30 %second.i = getelementptr inbounds %S, ptr %a, i64 0, i32 1
31 %2 = load i32, ptr %second.i, align 4
32 %second2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 1
33 %3 = load i32, ptr %second2.i, align 4
34 %cmp2.i = icmp eq i32 %2, %3
35 br i1 %cmp2.i, label %land.rhs.i.2, label %opeq1.exit
38 %third.i = getelementptr inbounds %S, ptr %a, i64 0, i32 2
39 %4 = load i32, ptr %third.i, align 4
40 %third2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 2
41 %5 = load i32, ptr %third2.i, align 4
42 %cmp3.i = icmp eq i32 %4, %5
43 br i1 %cmp3.i, label %land.rhs.i.3, label %opeq1.exit
46 %fourth.i = getelementptr inbounds %S, ptr %a, i64 0, i32 3
47 %6 = load i32, ptr %fourth.i, align 4
48 %fourth2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 3
49 %7 = load i32, ptr %fourth2.i, align 4
50 %cmp4.i = icmp eq i32 %6, %7
54 %8 = phi i1 [ false, %entry ], [ false, %land.rhs.i] , [ false, %land.rhs.i.2 ], [ %cmp4.i, %land.rhs.i.3 ]
58 define zeroext i1 @part_sequent_eq_with_metadata() {
59 ; X86-LABEL: @part_sequent_eq_with_metadata(
61 ; X86-NEXT: [[A:%.*]] = alloca [[S:%.*]], align 8
62 ; X86-NEXT: [[B:%.*]] = alloca [[S]], align 8
63 ; X86-NEXT: [[TMP0:%.*]] = load i32, ptr [[A]], align 4, !range [[RNG0:![0-9]+]], !noundef !1
64 ; X86-NEXT: [[TMP1:%.*]] = load i32, ptr [[B]], align 4, !range [[RNG0]], !noundef !1
65 ; X86-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
66 ; X86-NEXT: br i1 [[TMP2]], label %"bb1+bb2+bb3", label [[EXIT:%.*]]
68 ; X86-NEXT: [[TMP3:%.*]] = getelementptr inbounds [[S]], ptr [[A]], i64 0, i32 2
69 ; X86-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[S]], ptr [[B]], i64 0, i32 2
70 ; X86-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[TMP3]], ptr [[TMP4]], i64 12)
71 ; X86-NEXT: [[TMP5:%.*]] = icmp eq i32 [[MEMCMP]], 0
72 ; X86-NEXT: br label [[EXIT]]
74 ; X86-NEXT: [[RET:%.*]] = phi i1 [ [[TMP5]], %"bb1+bb2+bb3" ], [ false, [[BB01:%.*]] ]
75 ; X86-NEXT: ret i1 [[RET]]
78 %a = alloca %S, align 8
79 %b = alloca %S, align 8
80 %value0 = load i32, ptr %a, align 4, !range !0, !noundef !1
81 %value1 = load i32, ptr %b, align 4, !range !0, !noundef !1
82 %cmp.i = icmp eq i32 %value0, %value1
83 br i1 %cmp.i, label %bb1, label %exit
86 %second.i = getelementptr inbounds %S, ptr %a, i64 0, i32 2
87 %value2 = load i32, ptr %second.i, align 4
88 %second2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 2
89 %value3 = load i32, ptr %second2.i, align 4
90 %cmp2.i = icmp eq i32 %value2, %value3
91 br i1 %cmp2.i, label %bb2, label %exit
94 %third.i = getelementptr inbounds %S, ptr %a, i64 0, i32 3
95 %value4 = load i32, ptr %third.i, align 4
96 %third2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 3
97 %value5 = load i32, ptr %third2.i, align 4
98 %cmp3.i = icmp eq i32 %value4, %value5
99 br i1 %cmp3.i, label %bb3, label %exit
102 %fourth.i = getelementptr inbounds %S, ptr %a, i64 0, i32 4
103 %value6 = load i32, ptr %fourth.i, align 4
104 %fourth2.i = getelementptr inbounds %S, ptr %b, i64 0, i32 4
105 %value7 = load i32, ptr %fourth2.i, align 4
106 %cmp4.i = icmp eq i32 %value6, %value7
110 %ret = phi i1 [ false, %bb0 ], [ false, %bb1] , [ false, %bb2] ,[ %cmp4.i, %bb3 ]