mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-08 19:25:47 +00:00
filecheckize and detrivialize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111350 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1,17 +1,22 @@
|
|||||||
; This testcase tests for various features the basicaa test should be able to
|
; This testcase tests for various features the basicaa test should be able to
|
||||||
; determine, as noted in the comments.
|
; determine, as noted in the comments.
|
||||||
|
|
||||||
; RUN: opt < %s -basicaa -gvn -instcombine -dce -S | not grep REMOVE
|
; RUN: opt < %s -basicaa -gvn -instcombine -dce -S | FileCheck %s
|
||||||
target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
|
target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
|
||||||
|
|
||||||
@Global = external global { i32 }
|
@Global = external global { i32 }
|
||||||
|
|
||||||
|
declare void @external(i32*)
|
||||||
|
|
||||||
; Array test: Test that operations on one local array do not invalidate
|
; Array test: Test that operations on one local array do not invalidate
|
||||||
; operations on another array. Important for scientific codes.
|
; operations on another array. Important for scientific codes.
|
||||||
;
|
;
|
||||||
define i32 @different_array_test(i64 %A, i64 %B) {
|
define i32 @different_array_test(i64 %A, i64 %B) {
|
||||||
%Array1 = alloca i32, i32 100
|
%Array1 = alloca i32, i32 100
|
||||||
%Array2 = alloca i32, i32 200
|
%Array2 = alloca i32, i32 200
|
||||||
|
|
||||||
|
call void @external(i32* %Array1)
|
||||||
|
call void @external(i32* %Array2)
|
||||||
|
|
||||||
%pointer = getelementptr i32* %Array1, i64 %A
|
%pointer = getelementptr i32* %Array1, i64 %A
|
||||||
%val = load i32* %pointer
|
%val = load i32* %pointer
|
||||||
@@ -22,6 +27,8 @@ define i32 @different_array_test(i64 %A, i64 %B) {
|
|||||||
%REMOVE = load i32* %pointer ; redundant with above load
|
%REMOVE = load i32* %pointer ; redundant with above load
|
||||||
%retval = sub i32 %REMOVE, %val
|
%retval = sub i32 %REMOVE, %val
|
||||||
ret i32 %retval
|
ret i32 %retval
|
||||||
|
; CHECK: @different_array_test
|
||||||
|
; CHECK: ret i32 0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Constant index test: Constant indexes into the same array should not
|
; Constant index test: Constant indexes into the same array should not
|
||||||
@@ -29,6 +36,8 @@ define i32 @different_array_test(i64 %A, i64 %B) {
|
|||||||
;
|
;
|
||||||
define i32 @constant_array_index_test() {
|
define i32 @constant_array_index_test() {
|
||||||
%Array = alloca i32, i32 100
|
%Array = alloca i32, i32 100
|
||||||
|
call void @external(i32* %Array)
|
||||||
|
|
||||||
%P1 = getelementptr i32* %Array, i64 7
|
%P1 = getelementptr i32* %Array, i64 7
|
||||||
%P2 = getelementptr i32* %Array, i64 6
|
%P2 = getelementptr i32* %Array, i64 6
|
||||||
|
|
||||||
@@ -37,6 +46,8 @@ define i32 @constant_array_index_test() {
|
|||||||
%BREMOVE = load i32* %P1
|
%BREMOVE = load i32* %P1
|
||||||
%Val = sub i32 %A, %BREMOVE
|
%Val = sub i32 %A, %BREMOVE
|
||||||
ret i32 %Val
|
ret i32 %Val
|
||||||
|
; CHECK: @constant_array_index_test
|
||||||
|
; CHECK: ret i32 0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Test that if two pointers are spaced out by a constant getelementptr, that
|
; Test that if two pointers are spaced out by a constant getelementptr, that
|
||||||
@@ -48,6 +59,8 @@ define i32 @gep_distance_test(i32* %A) {
|
|||||||
%REMOVEv = load i32* %A
|
%REMOVEv = load i32* %A
|
||||||
%r = sub i32 %REMOVEu, %REMOVEv
|
%r = sub i32 %REMOVEu, %REMOVEv
|
||||||
ret i32 %r
|
ret i32 %r
|
||||||
|
; CHECK: @gep_distance_test
|
||||||
|
; CHECK: ret i32 0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Test that if two pointers are spaced out by a constant offset, that they
|
; Test that if two pointers are spaced out by a constant offset, that they
|
||||||
@@ -60,6 +73,8 @@ define i32 @gep_distance_test2({i32,i32}* %A, i64 %distance) {
|
|||||||
%REMOVEv = load i32* %A1
|
%REMOVEv = load i32* %A1
|
||||||
%r = sub i32 %REMOVEu, %REMOVEv
|
%r = sub i32 %REMOVEu, %REMOVEv
|
||||||
ret i32 %r
|
ret i32 %r
|
||||||
|
; CHECK: @gep_distance_test2
|
||||||
|
; CHECK: ret i32 0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Test that we can do funny pointer things and that distance calc will still
|
; Test that we can do funny pointer things and that distance calc will still
|
||||||
@@ -68,16 +83,24 @@ define i32 @gep_distance_test3(i32 * %A) {
|
|||||||
%X = load i32* %A
|
%X = load i32* %A
|
||||||
%B = bitcast i32* %A to i8*
|
%B = bitcast i32* %A to i8*
|
||||||
%C = getelementptr i8* %B, i64 4
|
%C = getelementptr i8* %B, i64 4
|
||||||
%Y = load i8* %C
|
store i8 42, i8* %C
|
||||||
ret i32 8
|
%Y = load i32* %A
|
||||||
|
%R = sub i32 %X, %Y
|
||||||
|
ret i32 %R
|
||||||
|
; CHECK: @gep_distance_test3
|
||||||
|
; CHECK: ret i32 0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Test that we can disambiguate globals reached through constantexpr geps
|
; Test that we can disambiguate globals reached through constantexpr geps
|
||||||
define i32 @constexpr_test() {
|
define i32 @constexpr_test() {
|
||||||
%X = alloca i32
|
%X = alloca i32
|
||||||
|
call void @external(i32* %X)
|
||||||
|
|
||||||
%Y = load i32* %X
|
%Y = load i32* %X
|
||||||
store i32 5, i32* getelementptr ({ i32 }* @Global, i64 0, i32 0)
|
store i32 5, i32* getelementptr ({ i32 }* @Global, i64 0, i32 0)
|
||||||
%REMOVE = load i32* %X
|
%REMOVE = load i32* %X
|
||||||
%retval = sub i32 %Y, %REMOVE
|
%retval = sub i32 %Y, %REMOVE
|
||||||
ret i32 %retval
|
ret i32 %retval
|
||||||
|
; CHECK: @constexpr_test
|
||||||
|
; CHECK: ret i32 0
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user