mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
292c78ba68
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237584 91177308-0d34-0410-b5e6-96231b3b80d8
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"}
|
|
|