1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=globalopt < %s | FileCheck %s
4 ; Make sure we don't try to convert to select if the load/stores don't match
7 @g1 = internal global i64 zeroinitializer
8 @g2 = internal global i64 zeroinitializer
9 @g3 = internal global i64 zeroinitializer
11 define void @store1() {
12 ; CHECK-LABEL: @store1(
13 ; CHECK-NEXT: store i32 2, ptr @g1, align 4
14 ; CHECK-NEXT: ret void
21 ; CHECK-LABEL: @load1(
22 ; CHECK-NEXT: [[V:%.*]] = load i32, ptr @g1, align 4
23 ; CHECK-NEXT: ret i32 [[V]]
25 %v = load i32, ptr @g1
29 define void @store2() {
30 ; CHECK-LABEL: @store2(
31 ; CHECK-NEXT: store i64 2, ptr @g2, align 4
32 ; CHECK-NEXT: ret void
39 ; CHECK-LABEL: @load2(
40 ; CHECK-NEXT: [[V:%.*]] = load i32, ptr @g2, align 4
41 ; CHECK-NEXT: ret i32 [[V]]
43 %v = load i32, ptr @g2
47 define void @store3() {
48 ; CHECK-LABEL: @store3(
49 ; CHECK-NEXT: store i1 true, ptr @g3, align 1
50 ; CHECK-NEXT: ret void
57 ; CHECK-LABEL: @load3(
58 ; CHECK-NEXT: [[V_B:%.*]] = load i1, ptr @g3, align 1
59 ; CHECK-NEXT: [[V:%.*]] = select i1 [[V_B]], i64 2, i64 0
60 ; CHECK-NEXT: ret i64 [[V]]
62 %v = load i64, ptr @g3