1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=gvn -S < %s | FileCheck %s
4 ; Memdep had funny bug related to invariant.groups - because it did not
5 ; invalidated cache, in some very rare cases it was possible to show memory
6 ; dependence of the instruction that was deleted, but because other instruction
7 ; took it's place it resulted in call to vtable! Removing any of the branch
10 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
11 target triple = "x86_64-grtev4-linux-gnu"
16 %3 = type { %4, i64, %5 }
18 %5 = type { i64, [8 x i8] }
20 define void @fail(ptr noalias sret(i1) %arg, ptr %arg1, ptr %arg2, ptr %arg3, i1 %arg4) local_unnamed_addr #0 {
23 ; CHECK-NEXT: [[I4:%.*]] = load ptr, ptr [[ARG1:%.*]], align 8, !invariant.group [[META6:![0-9]+]]
24 ; CHECK-NEXT: [[I5:%.*]] = getelementptr inbounds ptr, ptr [[I4]], i64 6
25 ; CHECK-NEXT: [[I6:%.*]] = load ptr, ptr [[I5]], align 8, !invariant.load [[META6]]
26 ; CHECK-NEXT: [[I7:%.*]] = tail call i64 [[I6]](ptr [[ARG1]]) #[[ATTR1:[0-9]+]]
27 ; CHECK-NEXT: [[I9:%.*]] = load ptr, ptr [[ARG2:%.*]], align 8
28 ; CHECK-NEXT: store i8 0, ptr [[I9]], align 1
29 ; CHECK-NEXT: br i1 [[ARG4:%.*]], label [[BB10:%.*]], label [[BB29:%.*]]
31 ; CHECK-NEXT: [[I14_PHI_TRANS_INSERT:%.*]] = getelementptr inbounds ptr, ptr [[I4]], i64 22
32 ; CHECK-NEXT: [[I15_PRE:%.*]] = load ptr, ptr [[I14_PHI_TRANS_INSERT]], align 8, !invariant.load [[META6]]
33 ; CHECK-NEXT: br label [[BB12:%.*]]
35 ; CHECK-NEXT: [[I16:%.*]] = call i64 [[I15_PRE]](ptr nonnull [[ARG1]], ptr null, i64 0) #[[ATTR1]]
36 ; CHECK-NEXT: br i1 true, label [[BB28:%.*]], label [[BB17:%.*]]
38 ; CHECK-NEXT: br i1 true, label [[BB18:%.*]], label [[BB21:%.*]]
40 ; CHECK-NEXT: br label [[BB28]]
42 ; CHECK-NEXT: br i1 true, label [[BB25:%.*]], label [[BB26:%.*]]
44 ; CHECK-NEXT: br label [[BB28]]
46 ; CHECK-NEXT: br label [[BB28]]
48 ; CHECK-NEXT: br i1 true, label [[BB12]], label [[BB28_BB29_CRIT_EDGE:%.*]]
49 ; CHECK: bb28.bb29_crit_edge:
50 ; CHECK-NEXT: br label [[BB29]]
52 ; CHECK-NEXT: ret void
55 %i4 = load ptr, ptr %arg1, align 8, !invariant.group !6
56 %i5 = getelementptr inbounds ptr, ptr %i4, i64 6
57 %i6 = load ptr, ptr %i5, align 8, !invariant.load !6
58 %i7 = tail call i64 %i6(ptr %arg1) #1
59 %i9 = load ptr, ptr %arg2, align 8
60 store i8 0, ptr %i9, align 1
61 br i1 %arg4, label %bb10, label %bb29
66 bb12: ; preds = %bb28, %bb10
67 %i13 = load ptr, ptr %arg1, align 8, !invariant.group !6
68 %i14 = getelementptr inbounds ptr, ptr %i13, i64 22
69 %i15 = load ptr, ptr %i14, align 8, !invariant.load !6
70 %i16 = call i64 %i15(ptr nonnull %arg1, ptr null, i64 0) #1
71 br i1 %arg4, label %bb28, label %bb17
74 br i1 %arg4, label %bb18, label %bb21
95 br i1 %arg4, label %bb25, label %bb26
100 bb26: ; preds = %bb24
103 bb27: ; preds = %bb26
106 bb28: ; preds = %bb27, %bb25, %bb20, %bb12
107 br i1 %arg4, label %bb12, label %bb29
109 bb29: ; preds = %bb28, %bb
113 attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="non-leaf" "less-precise-fpmad"="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,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
114 attributes #1 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="non-leaf" "less-precise-fpmad"="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,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
116 !llvm.linker.options = !{}
117 !llvm.module.flags = !{!0, !1, !3, !4, !5}
119 !0 = !{i32 1, !"StrictVTablePointers", i32 1}
120 !1 = !{i32 3, !"StrictVTablePointersRequirement", !2}
121 !2 = !{!"StrictVTablePointers", i32 1}
122 !3 = !{i32 1, !"wchar_size", i32 4}
123 !4 = !{i32 8, !"PIC Level", i32 2}
124 !5 = !{i32 7, !"PIE Level", i32 2}