1 ; RUN: opt -passes=globalopt < %s -S -o - | FileCheck %s
3 ; When simplifying users of a global variable, the pass could incorrectly
4 ; return false if there were still some uses left, and no further optimizations
5 ; was done. This was caught by the pass return status check that is hidden
6 ; under EXPENSIVE_CHECKS.
8 ; CHECK: @src = internal unnamed_addr constant
11 ; CHECK-NEXT: %call = call i32 @f(i32 0)
12 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 @dst, ptr align 4 @src, i64 1, i1 false)
13 ; CHECK-NEXT: ret void
15 @src = internal unnamed_addr global [1 x i32] zeroinitializer, align 4
16 @dst = external dso_local local_unnamed_addr global i32, align 4
18 define dso_local void @d() local_unnamed_addr {
20 %0 = load i32, ptr @src, align 4
21 %call = call i32 @f(i32 %0)
22 call void @llvm.memcpy.p0.p0.i64(ptr align 4 @dst, ptr align 4 @src, i64 1, i1 false)
26 declare dso_local i32 @f(i32) local_unnamed_addr
28 declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg)