xref: /llvm-project/llvm/test/Transforms/InstCombine/load-combine-metadata.ll (revision 207854b07dd9bd0d79add49bc5af17f1aabc752f)
1; RUN: opt -passes=instcombine -S < %s | FileCheck %s
2
3target datalayout = "e-m:e-p:64:64:64-i64:64-f80:128-n8:16:32:64-S128"
4
5; CHECK-LABEL: @test_load_load_combine_metadata(
6; Check that range and AA metadata is combined
7; CHECK: %[[V:.*]] = load i32, ptr %0
8; CHECK-SAME: !tbaa !{{[0-9]+}}
9; CHECK-SAME: !range ![[RANGE:[0-9]+]]
10; CHECK-SAME: !noundef !{{[0-9]+}}
11; CHECK: store i32 %[[V]], ptr %1
12; CHECK: store i32 %[[V]], ptr %2
13define void @test_load_load_combine_metadata(ptr, ptr, ptr) {
14  %a = load i32, ptr %0, !tbaa !8, !range !0, !noundef !10, !alias.scope !5, !noalias !6
15  %b = load i32, ptr %0, !tbaa !8, !range !1, !noundef !10
16  store i32 %a, ptr %1
17  store i32 %b, ptr %2
18  ret void
19}
20
21; CHECK: ![[RANGE]] = !{i32 0, i32 5}
22!0 = !{ i32 0, i32 5 }
23!1 = !{ i32 7, i32 9 }
24!2 = !{!2}
25!3 = !{!3, !2}
26!4 = !{!4, !2}
27!5 = !{!3}
28!6 = !{!4}
29!7 = !{ !"tbaa root" }
30!8 = !{ !9, !9, i64 0 }
31!9 = !{ !"scalar type", !7}
32!10 = !{}
33