OSDN Git Service

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