; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=mergeicmps -verify-dom-info -mtriple=x86_64-unknown-unknown -S | FileCheck %s --check-prefix=X86
source_filename = "qabstractitemmodeltester.cpp"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64--linux-gnu"
%class.B = type { i32, i32 }
%class.D = type { i32 }
%class.C = type { i8 }
%class.QMessageLogger = type { i8 }
$_ZN1D7compareI1BS1_EEbRKT_RKT0_PKcS9_S9_i = comdat any
@.str = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
; Function Attrs: uwtable
define linkonce_odr dso_local zeroext i1 @_ZN1D7compareI1BS1_EEbRKT_RKT0_PKcS9_S9_i(ptr %this, ptr dereferenceable(8) %p1, ptr dereferenceable(8) %p2, ptr, ptr, ptr, i32) local_unnamed_addr #0 comdat align 2 {
; X86-LABEL: @_ZN1D7compareI1BS1_EEbRKT_RKT0_PKcS9_S9_i(
; X86-NEXT: entry:
; X86-NEXT: [[REF_TMP:%.*]] = alloca [[CLASS_C:%.*]], align 1
; X86-NEXT: [[TMP4:%.*]] = load i32, ptr [[P2:%.*]], align 4
; X86-NEXT: [[TMP5:%.*]] = load i32, ptr [[P1:%.*]], align 4
; X86-NEXT: [[CMP_ENTRY:%.*]] = icmp eq i32 [[TMP4]], [[TMP5]]
; X86-NEXT: br i1 [[CMP_ENTRY]], label [[BB1:%.*]], label [[BB2:%.*]]
; X86: bb1:
; X86-NEXT: [[M_I:%.*]] = getelementptr inbounds [[CLASS_B:%.*]], ptr [[P2]], i64 0, i32 1
; X86-NEXT: [[TMP6:%.*]] = load i32, ptr [[M_I]], align 4
; X86-NEXT: [[M3_I:%.*]] = getelementptr inbounds [[CLASS_B]], ptr [[P1]], i64 0, i32 1
; X86-NEXT: [[TMP7:%.*]] = load i32, ptr [[M3_I]], align 4
; X86-NEXT: [[CMP1:%.*]] = icmp eq i32 [[TMP6]], [[TMP7]]
; X86-NEXT: br label [[BB2]]
; X86: bb2:
; X86-NEXT: [[TMP8:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[CMP1]], [[BB1]] ]
; X86-NEXT: [[TMP9:%.*]] = load i32, ptr [[THIS:%.*]], align 4
; X86-NEXT: [[COND:%.*]] = icmp eq i32 [[TMP9]], 0
; X86-NEXT: br i1 [[COND]], label [[BB3:%.*]], label [[SW_EPILOG:%.*]]
; X86: bb3:
; X86-NEXT: br i1 [[CMP_ENTRY]], label [[BB4:%.*]], label [[BB5:%.*]]
; X86: bb4:
; X86-NEXT: [[M_I_I:%.*]] = getelementptr inbounds [[CLASS_B]], ptr [[P2]], i64 0, i32 1
; X86-NEXT: [[TMP10:%.*]] = load i32, ptr [[M_I_I]], align 4
; X86-NEXT: [[M3_I_I:%.*]] = getelementptr inbounds [[CLASS_B]], ptr [[P1]], i64 0, i32 1
; X86-NEXT: [[TMP11:%.*]] = load i32, ptr [[M3_I_I]], align 4
; X86-NEXT: [[CMP4:%.*]] = icmp eq i32 [[TMP10]], [[TMP11]]
; X86-NEXT: br label [[BB5]]
; X86: bb5:
; X86-NEXT: [[TMP12:%.*]] = phi i1 [ false, [[BB3]] ], [ [[CMP4]], [[BB4]] ]
; X86-NEXT: br label [[SW_EPILOG]]
; X86: sw.epilog:
; X86-NEXT: ret i1 [[TMP8]]
;
entry:
%ref.tmp = alloca %class.C, align 1
%4 = load i32, ptr %p2, align 4
%5 = load i32, ptr %p1, align 4
%cmp_entry = icmp eq i32 %4, %5
br i1 %cmp_entry, label %bb1, label %bb2
bb1: ; preds = %entry
%m.i = getelementptr inbounds %class.B, ptr %p2, i64 0, i32 1
%6 = load i32, ptr %m.i, align 4
%m3.i = getelementptr inbounds %class.B, ptr %p1, i64 0, i32 1
%7 = load i32, ptr %m3.i, align 4
%cmp1 = icmp eq i32 %6, %7
br label %bb2
bb2: ; preds = %entry, %bb1
%8 = phi i1 [ false, %entry ], [ %cmp1, %bb1 ]
%9 = load i32, ptr %this, align 4
%cond = icmp eq i32 %9, 0
br i1 %cond, label %bb3, label %sw.epilog
bb3: ; preds = %bb2
br i1 %cmp_entry, label %bb4, label %bb5
bb4: ; preds = %bb3
%m.i.i = getelementptr inbounds %class.B, ptr %p2, i64 0, i32 1
%10 = load i32, ptr %m.i.i, align 4
%m3.i.i = getelementptr inbounds %class.B, ptr %p1, i64 0, i32 1
%11 = load i32, ptr %m3.i.i, align 4
%cmp4 = icmp eq i32 %10, %11
br label %bb5
bb5: ; preds = %bb3, %bb4
%12 = phi i1 [ false, %bb3 ], [ %cmp4, %bb4 ]
br label %sw.epilog
sw.epilog: ; preds = %bb2
ret i1 %8
}