1; RUN: opt -S -early-cse < %s | FileCheck %s
2target datalayout = "E-m:e-i64:64-n32:64"
3target triple = "powerpc64-unknown-linux-gnu"
4
5; Function Attrs: nounwind
6define i64 @f(i64 %x) #0 {
7entry:
8  %0 = call i64 @llvm.read_register.i64(metadata !0)
9  call void bitcast (void (...)* @foo to void ()*)()
10  %1 = call i64 @llvm.read_register.i64(metadata !0)
11  %add = add nsw i64 %0, %1
12  ret i64 %add
13}
14
15; CHECK-LABEL: @f
16; CHECK: call i64 @llvm.read_register.i64
17; CHECK: call i64 @llvm.read_register.i64
18
19; Function Attrs: nounwind readnone
20declare i64 @llvm.read_register.i64(metadata) #1
21
22; Function Attrs: nounwind
23declare void @llvm.write_register.i64(metadata, i64) #2
24
25declare void @foo(...)
26
27attributes #0 = { nounwind }
28attributes #1 = { nounwind readnone }
29attributes #2 = { nounwind }
30
31!llvm.named.register.r1 = !{!0}
32
33!0 = !{!"r1"}
34
35