1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt -passes='require<loops>,newgvn' -S < %s | FileCheck %s
4 ; This used to fail with ASAN enabled and if for some reason LoopInfo remained
5 ; available during GVN. In this case BasicAA will use LI but
6 ; MergeBlockIntoPredecessor in GVN failed to update LI.
8 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
10 %struct.wibble.1028 = type { i32, i32, %struct.barney.881 }
11 %struct.barney.881 = type { %struct.zot.882 }
12 %struct.zot.882 = type { [64 x i8] }
14 ; Function Attrs: argmemonly
15 declare void @snork.1(ptr) local_unnamed_addr #0
17 define hidden zeroext i1 @eggs(ptr %arg, i1 %arg2) unnamed_addr align 2 {
18 ; CHECK-LABEL: define hidden zeroext i1 @eggs(
19 ; CHECK-SAME: ptr [[ARG:%.*]], i1 [[ARG2:%.*]]) unnamed_addr align 2 {
21 ; CHECK-NEXT: br i1 [[ARG2]], label [[BB14:%.*]], label [[BB3:%.*]]
23 ; CHECK-NEXT: [[TMP:%.*]] = getelementptr inbounds [[STRUCT_WIBBLE_1028:%.*]], ptr [[ARG]], i64 0, i32 2, i32 0, i32 0, i64 0
24 ; CHECK-NEXT: br label [[BB6:%.*]]
26 ; CHECK-NEXT: br label [[BB7:%.*]]
28 ; CHECK-NEXT: br i1 undef, label [[BB11:%.*]], label [[BB8:%.*]]
30 ; CHECK-NEXT: [[TMP9:%.*]] = load ptr, ptr [[TMP]], align 8
31 ; CHECK-NEXT: br label [[BB12:%.*]]
33 ; CHECK-NEXT: br label [[BB12]]
35 ; CHECK-NEXT: [[TMP13:%.*]] = phi ptr [ [[TMP]], [[BB11]] ], [ [[TMP9]], [[BB8]] ]
36 ; CHECK-NEXT: call void @snork.1(ptr [[TMP13]]) #[[ATTR1:[0-9]+]]
37 ; CHECK-NEXT: br label [[BB6]]
39 ; CHECK-NEXT: ret i1 false
42 br i1 %arg2, label %bb14, label %bb3
45 %tmp = getelementptr inbounds %struct.wibble.1028, ptr %arg, i64 0, i32 2, i32 0, i32 0, i64 0
48 bb6: ; preds = %bb12, %bb3
52 br i1 undef, label %bb11, label %bb8
55 %tmp9 = load ptr, ptr %tmp, align 8
61 bb12: ; preds = %bb11, %bb8
62 %tmp13 = phi ptr [ %tmp, %bb11 ], [ %tmp9, %bb8 ]
63 call void @snork.1(ptr %tmp13) #1
70 attributes #0 = { argmemonly }
71 attributes #1 = { nounwind }