• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -gvn-sink -S | FileCheck %s
2
3; Check that nonnull metadata for non-dominating loads is not propagated.
4; CHECK-LABEL: @test1(
5; CHECK-LABEL: if.end:
6; CHECK:  %[[ptr:.*]] = phi i32**
7; CHECK: %[[load:.*]] = load i32*, i32** %[[ptr]]
8; CHECK-NOT: !nonnull
9; CHECK: ret i32* %[[load]]
10define i32* @test1(i1 zeroext %flag, i32*** %p) {
11entry:
12  br i1 %flag, label %if.then, label %if.else
13
14if.then:
15  %a = load i32**, i32*** %p
16  %aa = load i32*, i32** %a, !nonnull !0
17  br label %if.end
18
19if.else:
20  %b = load i32**, i32*** %p
21  %bb= load i32*, i32** %b
22  br label %if.end
23
24if.end:
25  %c = phi i32* [ %aa, %if.then ], [ %bb, %if.else ]
26  ret i32* %c
27}
28
29; CHECK-LABEL: @test2(
30; CHECK-LABEL: if.end:
31; CHECK:  %[[ptr:.*]] = phi i32**
32; CHECK: %[[load:.*]] = load i32*, i32** %[[ptr]]
33; CHECK-NOT: !nonnull
34; CHECK: ret i32* %[[load]]
35define i32* @test2(i1 zeroext %flag, i32*** %p) {
36entry:
37  br i1 %flag, label %if.then, label %if.else
38
39if.then:
40  %a = load i32**, i32*** %p
41  %aa = load i32*, i32** %a
42  br label %if.end
43
44if.else:
45  %b = load i32**, i32*** %p
46  %bb= load i32*, i32** %b, !nonnull !0
47  br label %if.end
48
49if.end:
50  %c = phi i32* [ %aa, %if.then ], [ %bb, %if.else ]
51  ret i32* %c
52}
53
54
55!0 = !{}
56