mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
dc89737bcd
functions. Make the function attributes pass add it to known library functions and when it can deduce it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185735 91177308-0d34-0410-b5e6-96231b3b80d8
48 lines
1.2 KiB
LLVM
48 lines
1.2 KiB
LLVM
; RUN: opt < %s -functionattrs -S | FileCheck %s
|
|
@x = global i32 0
|
|
|
|
declare void @test1_1(i8* %x1_1, i8* readonly %y1_1, ...)
|
|
|
|
; CHECK: define void @test1_2(i8* %x1_2, i8* readonly %y1_2, i8* %z1_2)
|
|
define void @test1_2(i8* %x1_2, i8* %y1_2, i8* %z1_2) {
|
|
call void (i8*, i8*, ...)* @test1_1(i8* %x1_2, i8* %y1_2, i8* %z1_2)
|
|
store i32 0, i32* @x
|
|
ret void
|
|
}
|
|
|
|
; CHECK: define i8* @test2(i8* readnone %p)
|
|
define i8* @test2(i8* %p) {
|
|
store i32 0, i32* @x
|
|
ret i8* %p
|
|
}
|
|
|
|
; CHECK: define i1 @test3(i8* readnone %p, i8* readnone %q)
|
|
define i1 @test3(i8* %p, i8* %q) {
|
|
%A = icmp ult i8* %p, %q
|
|
ret i1 %A
|
|
}
|
|
|
|
declare void @test4_1(i8* nocapture) readonly
|
|
|
|
; CHECK: define void @test4_2(i8* nocapture readonly %p)
|
|
define void @test4_2(i8* %p) {
|
|
call void @test4_1(i8* %p)
|
|
ret void
|
|
}
|
|
|
|
; CHECK: define void @test5(i8** nocapture %p, i8* %q)
|
|
; Missed optz'n: we could make %q readnone, but don't break test6!
|
|
define void @test5(i8** %p, i8* %q) {
|
|
store i8* %q, i8** %p
|
|
ret void
|
|
}
|
|
|
|
declare void @test6_1()
|
|
; CHECK: define void @test6_2(i8** nocapture %p, i8* %q)
|
|
; This is not a missed optz'n.
|
|
define void @test6_2(i8** %p, i8* %q) {
|
|
store i8* %q, i8** %p
|
|
call void @test6_1()
|
|
ret void
|
|
}
|