1 ; RUN: opt -instcombine -S < %s | FileCheck %s
3 target datalayout = "e-m:e-p:64:64:64-i64:64-f80:128-n8:16:32:64-S128"
5 ; Check that nonnull metadata is propagated from dominating load.
6 ; CHECK-LABEL: @combine_metadata_dominance1(
8 ; CHECK: load i32*, i32** %p, align 8, !nonnull !0
9 ; CHECK-NOT: load i32*, i32** %p
10 define void @combine_metadata_dominance1(i32** %p) {
12 %a = load i32*, i32** %p, !nonnull !0
16 %b = load i32*, i32** %p
22 declare i32 @use(i32*, i32) readonly
24 ; Check that nonnull from the dominated load does not get propagated.
25 ; There are some cases where it would be safe to keep it.
26 ; CHECK-LABEL: @combine_metadata_dominance2(
28 define void @combine_metadata_dominance2(i32** %p) {
30 %a = load i32*, i32** %p
31 br i1 undef, label %bb1, label %bb2
34 %b = load i32*, i32** %p, !nonnull !0