xref: /llvm-project/llvm/test/Transforms/MergeICmps/X86/pr41917.ll (revision 9a3e39996320793ec5fe5c6bb4873f82cbc1bbf3)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -passes=mergeicmps -verify-dom-info -S | FileCheck %s
3
4target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
5target triple = "i386-pc-windows-msvc19.11.0"
6
7%class.a = type { i32, i32, i32, i32, i32 }
8
9; Function Attrs: nounwind optsize
10define dso_local zeroext i1 @pr41917(ptr byval(%class.a) nocapture readonly align 4 %g, ptr byval(%class.a) nocapture readonly align 4 %p2) local_unnamed_addr #0 {
11; CHECK-LABEL: @pr41917(
12; CHECK-NEXT:  entry:
13; CHECK-NEXT:    [[CALL:%.*]] = tail call zeroext i1 @f2() #[[ATTR3:[0-9]+]]
14; CHECK-NEXT:    br i1 [[CALL]], label [[LAND_RHS:%.*]], label %"land.end+land.rhs3"
15; CHECK:       land.rhs:
16; CHECK-NEXT:    [[CALL1:%.*]] = tail call zeroext i1 @f2() #[[ATTR3]]
17; CHECK-NEXT:    br label %"land.end+land.rhs3"
18; CHECK:       "land.end+land.rhs3":
19; CHECK-NEXT:    [[TMP0:%.*]] = getelementptr inbounds [[CLASS_A:%.*]], ptr [[G:%.*]], i32 0, i32 1
20; CHECK-NEXT:    [[TMP1:%.*]] = getelementptr inbounds [[CLASS_A]], ptr [[P2:%.*]], i32 0, i32 1
21; CHECK-NEXT:    [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[TMP0]], ptr [[TMP1]], i32 8)
22; CHECK-NEXT:    [[TMP2:%.*]] = icmp eq i32 [[MEMCMP]], 0
23; CHECK-NEXT:    br label [[LAND_END6:%.*]]
24; CHECK:       land.end6:
25; CHECK-NEXT:    ret i1 [[TMP2]]
26;
27entry:
28  %call = tail call zeroext i1 @f2() #2
29  br i1 %call, label %land.rhs, label %land.end
30
31land.rhs:                                         ; preds = %entry
32  %call1 = tail call zeroext i1 @f2() #2
33  br label %land.end
34
35land.end:                                         ; preds = %land.rhs, %entry
36  %c = getelementptr inbounds %class.a, ptr %g, i32 0, i32 1
37  %0 = load i32, ptr %c, align 4, !tbaa !3
38  %c2 = getelementptr inbounds %class.a, ptr %p2, i32 0, i32 1
39  %1 = load i32, ptr %c2, align 4, !tbaa !3
40  %cmp = icmp eq i32 %0, %1
41  br i1 %cmp, label %land.rhs3, label %land.end6
42
43land.rhs3:                                        ; preds = %land.end
44  %h = getelementptr inbounds %class.a, ptr %g, i32 0, i32 2
45  %2 = load i32, ptr %h, align 4, !tbaa !8
46  %h4 = getelementptr inbounds %class.a, ptr %p2, i32 0, i32 2
47  %3 = load i32, ptr %h4, align 4, !tbaa !8
48  %cmp5 = icmp eq i32 %2, %3
49  br label %land.end6
50
51land.end6:                                        ; preds = %land.rhs3, %land.end
52  %4 = phi i1 [ false, %land.end ], [ %cmp5, %land.rhs3 ]
53  ret i1 %4
54}
55
56declare dso_local zeroext i1 @f2() local_unnamed_addr #1
57
58attributes #0 = { nounwind optsize "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="none" "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-features"="+cx8,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
59attributes #1 = { optsize "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "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-features"="+cx8,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
60attributes #2 = { nounwind optsize }
61
62!llvm.module.flags = !{!0, !1}
63!llvm.ident = !{!2}
64
65!0 = !{i32 1, !"NumRegisterParameters", i32 0}
66!1 = !{i32 1, !"wchar_size", i32 2}
67!2 = !{!"clang version 9.0.0 (https://github.com/llvm/llvm-project.git 1a8630ac2839d0e73fd3b15dc38501e4c6525a7e)"}
68!3 = !{!4, !5, i64 4}
69!4 = !{!"?AVa@@", !5, i64 0, !5, i64 4, !5, i64 8, !5, i64 12, !5, i64 16}
70!5 = !{!"int", !6, i64 0}
71!6 = !{!"omnipotent char", !7, i64 0}
72!7 = !{!"Simple C++ TBAA"}
73!8 = !{!4, !5, i64 8}
74