1; RUN: opt -S -O1 -enable-non-lto-gmr=true < %s | FileCheck %s 2 3@a = common global i32 0, align 4 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. 7 8; Function Attrs: nounwind ssp uwtable 9define weak i32 @hook_me() { 10 ret i32 0 11} 12 13; Function Attrs: nounwind ssp uwtable 14define i32 @f() { 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 23 ret i32 %5 24} 25