• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -O1 -S -enable-non-lto-gmr=true | FileCheck %s
2
3target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-apple-macosx10.10.0"
5
6@a = internal global [3 x i32] zeroinitializer, align 4
7
8; The important thing we're checking for here is the reload of (some element of)
9; @a after the memset.
10
11; CHECK-LABEL: @main
12; CHECK: load i32, i32* getelementptr {{.*}} @a
13; CHECK-NEXT: call void @memsetp0i8i64{{.*}} @a
14; CHECK-NEXT: load i32, i32* getelementptr {{.*}} @a
15; CHECK-NEXT: call void @memsetp0i8i64A{{.*}} @a
16; CHECK-NEXT: load i32, i32* getelementptr {{.*}} @a
17; CHECK: icmp eq
18; CHECK: br i1
19
20define i32 @main() {
21entry:
22  %0 = bitcast [3 x i32]* @a to i8*
23  %1 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @a, i64 0, i64 2), align 4
24  call void @memsetp0i8i64(i8* %0, i8 0, i64 4, i32 4, i1 false)
25  %2 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @a, i64 0, i64 2), align 4
26  call void @memsetp0i8i64A(i8* %0, i8 0, i64 4, i32 4, i1 false)
27  %3 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @a, i64 0, i64 2), align 4
28  %4 = add i32 %2, %3
29  %cmp1 = icmp eq i32 %1, %4
30  br i1 %cmp1, label %if.then, label %if.end
31
32if.then:                                          ; preds = %entr
33  call void @abort() #3
34  unreachable
35
36if.end:                                           ; preds = %entry
37  ret i32 0
38}
39
40; Function Attrs: nounwind argmemonly
41declare void @memsetp0i8i64(i8* nocapture, i8, i64, i32, i1) nounwind argmemonly
42
43; Function Attrs: nounwind inaccessiblemem_or_argmemonly
44declare void @memsetp0i8i64A(i8* nocapture, i8, i64, i32, i1) nounwind inaccessiblemem_or_argmemonly
45
46; Function Attrs: noreturn nounwind
47declare void @abort() noreturn nounwind
48