1 ; RUN: opt < %s -aa-pipeline=basic-aa -passes=gvn -S | FileCheck %s
3 ; The input *.ll is obtained by manually annotating "invariant.load" to the
4 ; two loads. With "invariant.load" metadata, the second load is redundant.
6 ; int foo(int *p, char *q) {
11 define i32 @foo(ptr nocapture %p, ptr nocapture %q) {
13 %0 = load i32, ptr %p, align 4, !invariant.load !3
14 %conv = trunc i32 %0 to i8
15 store i8 %conv, ptr %q, align 1
16 %1 = load i32, ptr %p, align 4, !invariant.load !3
17 %add = add nsw i32 %1, 1
21 ; CHECK: %0 = load i32, ptr %p
22 ; CHECK: store i8 %conv, ptr %q,
23 ; CHECK: %add = add nsw i32 %0, 1