65 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -S -passes=mergeicmps < %s | FileCheck %s3 4target triple = "x86_64-unknown-linux-gnu"5 6%"struct.a::c" = type { i32, ptr, ptr }7 8; The entry block cannot be merged as the comparison is not continuous.9; While it compares the highest address, it should not be moved after the10; other comparisons, as that would make the allocas non-dominating.11 12define i1 @test() {13; CHECK-LABEL: @test(14; CHECK-NEXT: "land.lhs.true+entry":15; CHECK-NEXT: [[H:%.*]] = alloca %"struct.a::c", align 816; CHECK-NEXT: [[I:%.*]] = alloca %"struct.a::c", align 817; CHECK-NEXT: call void @init(ptr [[H]])18; CHECK-NEXT: call void @init(ptr [[I]])19; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds %"struct.a::c", ptr [[H]], i64 0, i32 120; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds %"struct.a::c", ptr [[I]], i64 0, i32 121; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[TMP0]], ptr [[TMP1]], i64 16)22; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 023; CHECK-NEXT: br i1 [[TMP2]], label [[LAND_RHS1:%.*]], label [[LAND_END:%.*]]24; CHECK: land.rhs1:25; CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[H]], align 826; CHECK-NEXT: [[TMP4:%.*]] = load i32, ptr [[I]], align 827; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i32 [[TMP3]], [[TMP4]]28; CHECK-NEXT: br label [[LAND_END]]29; CHECK: land.end:30; CHECK-NEXT: [[V9:%.*]] = phi i1 [ [[TMP5]], [[LAND_RHS1]] ], [ false, %"land.lhs.true+entry" ]31; CHECK-NEXT: ret i1 [[V9]]32;33entry:34 %h = alloca %"struct.a::c", align 835 %i = alloca %"struct.a::c", align 836 call void @init(ptr %h)37 call void @init(ptr %i)38 %e = getelementptr inbounds %"struct.a::c", ptr %h, i64 0, i32 239 %v3 = load ptr, ptr %e, align 840 %e2 = getelementptr inbounds %"struct.a::c", ptr %i, i64 0, i32 241 %v4 = load ptr, ptr %e2, align 842 %cmp = icmp eq ptr %v3, %v443 br i1 %cmp, label %land.lhs.true, label %land.end44 45land.lhs.true: ; preds = %entry46 %d = getelementptr inbounds %"struct.a::c", ptr %h, i64 0, i32 147 %v5 = load ptr, ptr %d, align 848 %d3 = getelementptr inbounds %"struct.a::c", ptr %i, i64 0, i32 149 %v6 = load ptr, ptr %d3, align 850 %cmp4 = icmp eq ptr %v5, %v651 br i1 %cmp4, label %land.rhs, label %land.end52 53land.rhs: ; preds = %land.lhs.true54 %v7 = load i32, ptr %h, align 855 %v8 = load i32, ptr %i, align 856 %cmp6 = icmp eq i32 %v7, %v857 br label %land.end58 59land.end: ; preds = %land.rhs, %land.lhs.true, %entry60 %v9 = phi i1 [ false, %land.lhs.true ], [ false, %entry ], [ %cmp6, %land.rhs ]61 ret i1 %v962}63 64declare void @init(ptr)65