Index: llvm/trunk/test/Transforms/MergeICmps/X86/pr36557.ll =================================================================== --- llvm/trunk/test/Transforms/MergeICmps/X86/pr36557.ll +++ llvm/trunk/test/Transforms/MergeICmps/X86/pr36557.ll @@ -0,0 +1,160 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -mergeicmps -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 dso_local void @_Z8qCompareRK1BS1_(%class.B* nocapture readonly dereferenceable(8) %p1, %class.B* nocapture readonly dereferenceable(8) %p2) local_unnamed_addr #0 { +entry: + %c.i = getelementptr inbounds %class.B, %class.B* %p2, i64 0, i32 0 + %0 = load i32, i32* %c.i, align 4, !tbaa !2 + %c2.i = getelementptr inbounds %class.B, %class.B* %p1, i64 0, i32 0 + %1 = load i32, i32* %c2.i, align 4, !tbaa !2 + %cmp.i = icmp eq i32 %0, %1 + br i1 %cmp.i, label %land.rhs.i, label %_ZNK1BeqERKS_.exit + +land.rhs.i: ; preds = %entry + %m.i = getelementptr inbounds %class.B, %class.B* %p2, i64 0, i32 1 + %2 = load i32, i32* %m.i, align 4, !tbaa !7 + %m3.i = getelementptr inbounds %class.B, %class.B* %p1, i64 0, i32 1 + %3 = load i32, i32* %m3.i, align 4, !tbaa !7 + %cmp4.i = icmp eq i32 %2, %3 + br label %_ZNK1BeqERKS_.exit + +_ZNK1BeqERKS_.exit: ; preds = %entry, %land.rhs.i + %4 = phi i1 [ false, %entry ], [ %cmp4.i, %land.rhs.i ] + tail call void @_Z14compare_helperb(i1 zeroext %4) + ret void +} + +declare dso_local void @_Z14compare_helperb(i1 zeroext) local_unnamed_addr #1 + +; Function Attrs: uwtable +define dso_local void @_ZN1D13layoutChangedEv(%class.D* %this) local_unnamed_addr #0 align 2 { +entry: + %a = alloca %class.B, align 4 + %ref.tmp = alloca i64, align 8 + %tmpcast = bitcast i64* %ref.tmp to %class.B* + %0 = bitcast %class.B* %a to i8* + call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %0) #3 + %1 = bitcast i64* %ref.tmp to i8* + call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %1) #3 + store i64 0, i64* %ref.tmp, align 8 + %call = call zeroext i1 @_ZN1D7compareI1BS1_EEbRKT_RKT0_PKcS9_S9_i(%class.D* %this, %class.B* nonnull dereferenceable(8) %a, %class.B* nonnull dereferenceable(8) %tmpcast, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 3) + call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %1) #3 + call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %0) #3 + ret void +} + +; Function Attrs: argmemonly nounwind +declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #2 + +; Function Attrs: uwtable +define linkonce_odr dso_local zeroext i1 @_ZN1D7compareI1BS1_EEbRKT_RKT0_PKcS9_S9_i(%class.D* %this, %class.B* dereferenceable(8) %p1, %class.B* dereferenceable(8) %p2, i8*, i8*, i8*, i32) local_unnamed_addr #0 comdat align 2 { +entry: + %ref.tmp = alloca %class.C, align 1 + %ref.tmp5 = alloca %class.QMessageLogger, align 1 + %ref.tmp6 = alloca %class.C, align 1 + %c.i = getelementptr inbounds %class.B, %class.B* %p2, i64 0, i32 0 + %4 = load i32, i32* %c.i, align 4, !tbaa !2 + %c2.i = getelementptr inbounds %class.B, %class.B* %p1, i64 0, i32 0 + %5 = load i32, i32* %c2.i, align 4, !tbaa !2 + %cmp.i = icmp eq i32 %4, %5 + br i1 %cmp.i, label %land.rhs.i, label %_ZNK1BeqERKS_.exit + +land.rhs.i: ; preds = %entry + %m.i = getelementptr inbounds %class.B, %class.B* %p2, i64 0, i32 1 + %6 = load i32, i32* %m.i, align 4, !tbaa !7 + %m3.i = getelementptr inbounds %class.B, %class.B* %p1, i64 0, i32 1 + %7 = load i32, i32* %m3.i, align 4, !tbaa !7 + %cmp4.i = icmp eq i32 %6, %7 + br label %_ZNK1BeqERKS_.exit + +_ZNK1BeqERKS_.exit: ; preds = %entry, %land.rhs.i + %8 = phi i1 [ false, %entry ], [ %cmp4.i, %land.rhs.i ] + %failureReportingMode = getelementptr inbounds %class.D, %class.D* %this, i64 0, i32 0 + %9 = load i32, i32* %failureReportingMode, align 4, !tbaa !8 + %cond = icmp eq i32 %9, 0 + br i1 %cond, label %sw.bb, label %sw.epilog + +sw.bb: ; preds = %_ZNK1BeqERKS_.exit + br i1 %cmp.i, label %land.rhs.i.i, label %_Z8qCompareRK1BS1_.exit + +land.rhs.i.i: ; preds = %sw.bb + %m.i.i = getelementptr inbounds %class.B, %class.B* %p2, i64 0, i32 1 + %10 = load i32, i32* %m.i.i, align 4, !tbaa !7 + %m3.i.i = getelementptr inbounds %class.B, %class.B* %p1, i64 0, i32 1 + %11 = load i32, i32* %m3.i.i, align 4, !tbaa !7 + %cmp4.i.i = icmp eq i32 %10, %11 + br label %_Z8qCompareRK1BS1_.exit + +_Z8qCompareRK1BS1_.exit: ; preds = %sw.bb, %land.rhs.i.i + %12 = phi i1 [ false, %sw.bb ], [ %cmp4.i.i, %land.rhs.i.i ] + tail call void @_Z14compare_helperb(i1 zeroext %12) + %13 = getelementptr inbounds %class.C, %class.C* %ref.tmp, i64 0, i32 0 + call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %13) #3 + tail call void @_Z11lcModelTestv() + call void @_ZN1C16isWarningEnabledEv(%class.C* nonnull %ref.tmp) + call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %13) #3 + %14 = getelementptr inbounds %class.QMessageLogger, %class.QMessageLogger* %ref.tmp5, i64 0, i32 0 + %15 = getelementptr inbounds %class.C, %class.C* %ref.tmp6, i64 0, i32 0 + br label %for.cond + +for.cond: ; preds = %for.cond, %_Z8qCompareRK1BS1_.exit + call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %14) #3 + call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %15) #3 + call void @_Z11lcModelTestv() + %call8 = call i8* @_ZN1C12categoryNameEv(%class.C* nonnull %ref.tmp6) + call void @_ZN14QMessageLoggerC1EPciS0_S0_(%class.QMessageLogger* nonnull %ref.tmp5, i8* null, i32 0, i8* null, i8* %call8) + call void @_ZN14QMessageLogger7warningEv(%class.QMessageLogger* nonnull %ref.tmp5) + call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %15) #3 + call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %14) #3 + br label %for.cond + +sw.epilog: ; preds = %_ZNK1BeqERKS_.exit + ret i1 %8 +} + +; Function Attrs: argmemonly nounwind +declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #2 + +declare dso_local void @_Z11lcModelTestv() local_unnamed_addr #1 + +declare dso_local void @_ZN1C16isWarningEnabledEv(%class.C*) local_unnamed_addr #1 + +declare dso_local i8* @_ZN1C12categoryNameEv(%class.C*) local_unnamed_addr #1 + +declare dso_local void @_ZN14QMessageLoggerC1EPciS0_S0_(%class.QMessageLogger*, i8*, i32, i8*, i8*) unnamed_addr #1 + +declare dso_local void @_ZN14QMessageLogger7warningEv(%class.QMessageLogger*) local_unnamed_addr #1 + +attributes #0 = { uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #2 = { argmemonly nounwind } +attributes #3 = { nounwind } + +!llvm.module.flags = !{!0} +!llvm.ident = !{!1} + +!0 = !{i32 1, !"wchar_size", i32 4} +!1 = !{!"clang version 7.0.0 (trunk 326236) (llvm/trunk 326244)"} +!2 = !{!3, !4, i64 0} +!3 = !{!"_ZTS1B", !4, i64 0, !4, i64 4} +!4 = !{!"int", !5, i64 0} +!5 = !{!"omnipotent char", !6, i64 0} +!6 = !{!"Simple C++ TBAA"} +!7 = !{!3, !4, i64 4} +!8 = !{!9, !10, i64 0} +!9 = !{!"_ZTS1D", !10, i64 0} +!10 = !{!"_ZTSN1A20FailureReportingModeE", !5, i64 0}