comparison test/Analysis/BasicAA/invariant_load.ll @ 0:95c75e76d11b LLVM3.4

LLVM 3.4
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Thu, 12 Dec 2013 13:56:28 +0900
parents
children 60c9769439b8
comparison
equal deleted inserted replaced
-1:000000000000 0:95c75e76d11b
1 ; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
2
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.
5 ;
6 ; int foo(int *p, char *q) {
7 ; *q = (char)*p;
8 ; return *p + 1;
9 ; }
10
11 define i32 @foo(i32* nocapture %p, i8* nocapture %q) {
12 entry:
13 %0 = load i32* %p, align 4, !invariant.load !3
14 %conv = trunc i32 %0 to i8
15 store i8 %conv, i8* %q, align 1
16 %1 = load i32* %p, align 4, !invariant.load !3
17 %add = add nsw i32 %1, 1
18 ret i32 %add
19
20 ; CHECK: foo
21 ; CHECK: %0 = load i32* %p
22 ; CHECK: store i8 %conv, i8* %q,
23 ; CHECK: %add = add nsw i32 %0, 1
24 }
25
26 !3 = metadata !{}