[PHITransAddr] Don't assume that instruction operands are translatable
[oota-llvm.git] / test / Transforms / GVN / preserve-tbaa.ll
1 ; RUN: opt -tbaa -basicaa -gvn -S < %s | FileCheck %s
2
3 target datalayout = "e-p:64:64:64"
4
5 ; GVN should preserve the TBAA tag on loads when doing PRE.
6
7 ; CHECK-LABEL: @test(
8 ; CHECK: %tmp33.pre = load i16, i16* %P, align 2, !tbaa !0
9 ; CHECK: br label %for.body
10 define void @test(i16 *%P, i16* %Q) nounwind {
11 entry:
12   br i1 undef, label %bb.nph, label %for.end
13
14 bb.nph:                                           ; preds = %entry
15   br label %for.body
16
17 for.body:                                         ; preds = %for.body, %bb.nph
18   %tmp33 = load i16, i16* %P, align 2, !tbaa !0
19   store i16 %tmp33, i16* %Q
20
21   store i16 0, i16* %P, align 2, !tbaa !0
22   br i1 false, label %for.end, label %for.body
23
24 for.end:                                          ; preds = %for.body, %entry
25   ret void
26 }
27
28 !0 = !{!3, !3, i64 0}
29 !1 = !{!"omnipotent char", !2}
30 !2 = !{!"Simple C/C++ TBAA", null}
31 !3 = !{!"short", !1}