mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Ding dong, the DoesntAccessMemoryFns and
OnlyReadsMemoryFns tables are dead! We get more, and more accurate, information from gcc via the readnone and readonly function attributes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44288 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load
|
||||
; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load
|
||||
|
||||
; This test requires the use of previous analyses to determine that
|
||||
; This test requires the use of previous analyses to determine that
|
||||
; doesnotmodX does not modify X (because 'sin' doesn't).
|
||||
|
||||
%X = internal global int 4
|
||||
@X = internal global i32 4 ; <i32*> [#uses=2]
|
||||
|
||||
declare double %sin(double)
|
||||
declare double @sin(double) readnone
|
||||
|
||||
int %test(int *%P) {
|
||||
store int 12, int* %X
|
||||
call double %doesnotmodX(double 1.0)
|
||||
%V = load int* %X
|
||||
ret int %V
|
||||
define i32 @test(i32* %P) {
|
||||
store i32 12, i32* @X
|
||||
call double @doesnotmodX( double 1.000000e+00 ) ; <double>:1 [#uses=0]
|
||||
%V = load i32* @X ; <i32> [#uses=1]
|
||||
ret i32 %V
|
||||
}
|
||||
|
||||
double %doesnotmodX(double %V) {
|
||||
%V2 = call double %sin(double %V)
|
||||
ret double %V2
|
||||
define double @doesnotmodX(double %V) {
|
||||
%V2 = call double @sin( double %V ) readnone ; <double> [#uses=1]
|
||||
ret double %V2
|
||||
}
|
||||
|
@@ -1,11 +1,12 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub
|
||||
declare int %strlen(sbyte*)
|
||||
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub
|
||||
|
||||
int %test(sbyte* %P) {
|
||||
%X = call int %strlen(sbyte* %P)
|
||||
%A = add int %X, 14
|
||||
%Y = call int %strlen(sbyte* %P)
|
||||
%Z = sub int %X, %Y
|
||||
%B = add int %A, %Z
|
||||
ret int %B
|
||||
declare i32 @strlen(i8*) readonly
|
||||
|
||||
define i32 @test(i8* %P) {
|
||||
%X = call i32 @strlen( i8* %P ) readonly ; <i32> [#uses=2]
|
||||
%A = add i32 %X, 14 ; <i32> [#uses=1]
|
||||
%Y = call i32 @strlen( i8* %P ) readonly ; <i32> [#uses=1]
|
||||
%Z = sub i32 %X, %Y ; <i32> [#uses=1]
|
||||
%B = add i32 %A, %Z ; <i32> [#uses=1]
|
||||
ret i32 %B
|
||||
}
|
||||
|
@@ -1,13 +1,14 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub
|
||||
declare int %strlen(sbyte*)
|
||||
declare void %use(int %X)
|
||||
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub
|
||||
|
||||
sbyte %test(sbyte* %P, sbyte* %Q) {
|
||||
%A = load sbyte* %Q
|
||||
%X = call int %strlen(sbyte* %P)
|
||||
%B = load sbyte* %Q ;; CSE with A.
|
||||
call void %use(int %X) ;; make strlen not dead
|
||||
declare i32 @strlen(i8*) readonly
|
||||
|
||||
%C = sub sbyte %A, %B
|
||||
ret sbyte %C
|
||||
declare void @use(i32)
|
||||
|
||||
define i8 @test(i8* %P, i8* %Q) {
|
||||
%A = load i8* %Q ; <i8> [#uses=1]
|
||||
%X = call i32 @strlen( i8* %P ) readonly ; <i32> [#uses=1]
|
||||
%B = load i8* %Q ; <i8> [#uses=1]
|
||||
call void @use( i32 %X )
|
||||
%C = sub i8 %A, %B ; <i8> [#uses=1]
|
||||
ret i8 %C
|
||||
}
|
||||
|
Reference in New Issue
Block a user