1 ; RUN: opt -S -O1 < %s | FileCheck %s
3 @a = common global i32 0, align 4
5 ; @hook_me is weak, so GMR must not eliminate the reload of @a in @f,
6 ; even though @hook_me doesn't mod or ref @a.
8 ; Function Attrs: nounwind ssp uwtable
9 define weak i32 @hook_me() {
13 ; Function Attrs: nounwind ssp uwtable
15 %1 = alloca i32, align 4
16 store i32 4, i32* @a, align 4
17 %2 = call i32 @hook_me()
18 ; CHECK: load i32, i32* @a, align 4
19 %3 = load i32, i32* @a, align 4
20 %4 = add nsw i32 %3, %2
21 store i32 %4, i32* @a, align 4
22 %5 = load i32, i32* %1