1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -O2 -S %s | FileCheck %s --check-prefix=WITHGLOBALSAA
3 ; RUN: opt -O2 -enable-global-analyses=0 -S %s | FileCheck %s --check-prefix=NOGLOBALSAA
5 @glb = internal global i8 0
7 define i8 @f(ptr %ptr) {
8 ; WITHGLOBALSAA-LABEL: @f(
9 ; WITHGLOBALSAA-NEXT: store i8 1, ptr [[PTR:%.*]], align 1
10 ; WITHGLOBALSAA-NEXT: store i1 true, ptr @glb, align 1
11 ; WITHGLOBALSAA-NEXT: ret i8 1
13 ; NOGLOBALSAA-LABEL: @f(
14 ; NOGLOBALSAA-NEXT: store i8 1, ptr [[PTR:%.*]], align 1
15 ; NOGLOBALSAA-NEXT: store i1 true, ptr @glb, align 1
16 ; NOGLOBALSAA-NEXT: [[R:%.*]] = load i8, ptr [[PTR]], align 1
17 ; NOGLOBALSAA-NEXT: ret i8 [[R]]
21 %r = load i8, ptr %ptr
26 ; WITHGLOBALSAA-LABEL: @dummy(
27 ; WITHGLOBALSAA-NEXT: [[VAL_B:%.*]] = load i1, ptr @glb, align 1
28 ; WITHGLOBALSAA-NEXT: [[VAL:%.*]] = select i1 [[VAL_B]], i8 2, i8 0
29 ; WITHGLOBALSAA-NEXT: ret i8 [[VAL]]
31 ; NOGLOBALSAA-LABEL: @dummy(
32 ; NOGLOBALSAA-NEXT: [[VAL_B:%.*]] = load i1, ptr @glb, align 1
33 ; NOGLOBALSAA-NEXT: [[VAL:%.*]] = select i1 [[VAL_B]], i8 2, i8 0
34 ; NOGLOBALSAA-NEXT: ret i8 [[VAL]]
36 %val = load i8, ptr @glb