mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
91d2f2d062
At the present time, we don't have a way to represent general dependency relationships, so everything is represented using memory dependency. In order to preserve the data dependency of a READ_REGISTER on WRITE_REGISTER, we need to model WRITE_REGISTER as writing (which we had been doing) and model READ_REGISTER as reading (which we had not been doing). Fix this, and also the way that the chain operands were generated at the SDAG level. Patch by Nicholas Paul Johnson, thanks! Test case by me. llvm-svn: 237584
35 lines
842 B
LLVM
35 lines
842 B
LLVM
; RUN: opt -S -early-cse < %s | FileCheck %s
|
|
target datalayout = "E-m:e-i64:64-n32:64"
|
|
target triple = "powerpc64-unknown-linux-gnu"
|
|
|
|
; Function Attrs: nounwind
|
|
define i64 @f(i64 %x) #0 {
|
|
entry:
|
|
%0 = call i64 @llvm.read_register.i64(metadata !0)
|
|
call void bitcast (void (...)* @foo to void ()*)()
|
|
%1 = call i64 @llvm.read_register.i64(metadata !0)
|
|
%add = add nsw i64 %0, %1
|
|
ret i64 %add
|
|
}
|
|
|
|
; CHECK-LABEL: @f
|
|
; CHECK: call i64 @llvm.read_register.i64
|
|
; CHECK: call i64 @llvm.read_register.i64
|
|
|
|
; Function Attrs: nounwind readnone
|
|
declare i64 @llvm.read_register.i64(metadata) #1
|
|
|
|
; Function Attrs: nounwind
|
|
declare void @llvm.write_register.i64(metadata, i64) #2
|
|
|
|
declare void @foo(...)
|
|
|
|
attributes #0 = { nounwind }
|
|
attributes #1 = { nounwind readnone }
|
|
attributes #2 = { nounwind }
|
|
|
|
!llvm.named.register.r1 = !{!0}
|
|
|
|
!0 = !{!"r1"}
|
|
|