1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -newgvn -S %s | FileCheck %s
3 ; Ensure that loads that bypass memory def-use chains get added as users of the new
4 ; MemoryDef. Otherwise this test will not pass memory verification because the value
5 ; of the load will not be reprocessed until verification.
6 ; ModuleID = 'bugpoint-reduced-simplified.bc'
7 source_filename = "bugpoint-output-f242c4f.bc"
8 target triple = "x86_64-apple-darwin16.7.0"
10 @global = external global i32 #0
11 @global.1 = external global i32 #0
13 define void @hoge(i32 %arg) {
16 ; CHECK-NEXT: br label [[BB2:%.*]]
18 ; CHECK-NEXT: br label [[BB2]]
20 ; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ 0, [[BB1:%.*]] ], [ [[ARG:%.*]], [[BB:%.*]] ]
21 ; CHECK-NEXT: br label [[BB6:%.*]]
23 ; CHECK-NEXT: [[TMP4:%.*]] = load i32, i32* @global, !h !0
24 ; CHECK-NEXT: unreachable
26 ; CHECK-NEXT: store i32 [[TMP]], i32* @global.1, !h !0
27 ; CHECK-NEXT: br i1 undef, label [[BB7:%.*]], label [[BB1]]
29 ; CHECK-NEXT: br i1 undef, label [[BB10:%.*]], label [[BB8:%.*]]
31 ; CHECK-NEXT: br i1 false, label [[BB9:%.*]], label [[BB3:%.*]]
33 ; CHECK-NEXT: store i8 undef, i8* null
34 ; CHECK-NEXT: br label [[BB3]]
36 ; CHECK-NEXT: store i32 0, i32* @global, !h !0
37 ; CHECK-NEXT: br label [[BB7]]
45 bb2: ; preds = %bb1, %bb
46 %tmp = phi i32 [ 0, %bb1 ], [ %arg, %bb ]
49 bb3: ; preds = %bb9, %bb8
50 %tmp4 = load i32, i32* @global, !h !0
51 %tmp5 = icmp eq i32 %tmp4, 0
55 store i32 %tmp, i32* @global.1, !h !0
56 br i1 undef, label %bb7, label %bb1
58 bb7: ; preds = %bb10, %bb6
59 br i1 undef, label %bb10, label %bb8
62 br i1 false, label %bb9, label %bb3
69 store i32 0, i32* @global, !h !0
73 declare void @widget()
75 attributes #0 = { align=4 }