1 ; Test if the !invariant.load metadata is maintained by GVN.
2 ; RUN: opt -basicaa -gvn -S < %s | FileCheck %s
4 define i32 @test1(i32* nocapture %p, i8* nocapture %q) {
6 ; CHECK: %x = load i32* %p, align 4, !invariant.load !0
9 %x = load i32* %p, align 4, !invariant.load !0
10 %conv = trunc i32 %x to i8
11 store i8 %conv, i8* %q, align 1
12 %y = load i32* %p, align 4, !invariant.load !0
17 define i32 @test2(i32* nocapture %p, i8* nocapture %q) {
19 ; CHECK-NOT: !invariant.load
20 ; CHECK-NOT: %y = load
22 %x = load i32* %p, align 4
23 %conv = trunc i32 %x to i8
24 store i8 %conv, i8* %q, align 1
25 %y = load i32* %p, align 4, !invariant.load !0