1 ; RUN: opt -passes=gvn -S < %s | FileCheck %s
3 target datalayout = "e-p:64:64:64"
5 ; GVN should ignore the store to p[1] to see that the load from p[0] is
10 ; CHECK-NEXT: store i32 0, ptr %q
11 ; CHECK-NEXT: ret void
13 define void @yes(i1 %c, ptr %p, ptr %q) nounwind {
16 %p1 = getelementptr inbounds i32, ptr %p, i64 1
18 br i1 %c, label %if.else, label %if.then
29 ; GVN should ignore the store to p[1] to see that the first load from p[0] is
30 ; fully redundant. However, the second load is larger, so it's not a simple
33 ; CHECK-LABEL: @watch_out_for_size_change(
35 ; CHECK-NEXT: store i32 0, ptr %q
36 ; CHECK-NEXT: ret void
38 ; CHECK: load i64, ptr %p
41 define void @watch_out_for_size_change(i1 %c, ptr %p, ptr %q) nounwind {
44 %p1 = getelementptr inbounds i32, ptr %p, i64 1
46 br i1 %c, label %if.else, label %if.then
54 %t64 = load i64, ptr %p
55 store i64 %t64, ptr %q