mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
convert scalar_promote to filecheck style and merge 2003-12-13-VolatilePromote.ll into it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80521 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
251829ed87
commit
7025264add
@ -1,16 +0,0 @@
|
||||
; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext volatile 1 | grep Loop
|
||||
|
||||
@X = global i32 7 ; <i32*> [#uses=2]
|
||||
|
||||
define void @testfunc(i32 %i) {
|
||||
br label %Loop
|
||||
Loop: ; preds = %Loop, %0
|
||||
; Should not promote this to a register
|
||||
%x = volatile load i32* @X ; <i32> [#uses=1]
|
||||
%x2 = add i32 %x, 1 ; <i32> [#uses=1]
|
||||
store i32 %x2, i32* @X
|
||||
br i1 true, label %Out, label %Loop
|
||||
Out: ; preds = %Loop
|
||||
ret void
|
||||
}
|
||||
|
@ -1,13 +1,17 @@
|
||||
; RUN: llvm-as < %s | opt -licm -disable-output -stats |& \
|
||||
; RUN: grep {memory locations promoted to register}
|
||||
; RUN: llvm-as < %s | opt -licm | llvm-dis | FileCheck %s
|
||||
@X = global i32 7 ; <i32*> [#uses=4]
|
||||
|
||||
define void @testfunc(i32 %i) {
|
||||
; <label>:0
|
||||
define void @test1(i32 %i) {
|
||||
Entry:
|
||||
br label %Loop
|
||||
; CHECK: @test1
|
||||
; CHECK: Entry:
|
||||
; CHECK-NEXT: load i32* @X
|
||||
; CHECK-NEXT: br label %Loop
|
||||
|
||||
|
||||
Loop: ; preds = %Loop, %0
|
||||
%j = phi i32 [ 0, %0 ], [ %Next, %Loop ] ; <i32> [#uses=1]
|
||||
%j = phi i32 [ 0, %Entry ], [ %Next, %Loop ] ; <i32> [#uses=1]
|
||||
%x = load i32* @X ; <i32> [#uses=1]
|
||||
%x2 = add i32 %x, 1 ; <i32> [#uses=1]
|
||||
store i32 %x2, i32* @X
|
||||
@ -15,12 +19,23 @@ Loop: ; preds = %Loop, %0
|
||||
%cond = icmp eq i32 %Next, 0 ; <i1> [#uses=1]
|
||||
br i1 %cond, label %Out, label %Loop
|
||||
|
||||
Out: ; preds = %Loop
|
||||
Out:
|
||||
ret void
|
||||
; CHECK: Out:
|
||||
; CHECK-NEXT: store i32 %x2, i32* @X
|
||||
; CHECK-NEXT: ret void
|
||||
|
||||
}
|
||||
|
||||
define void @testhard(i32 %i) {
|
||||
define void @test2(i32 %i) {
|
||||
Entry:
|
||||
br label %Loop
|
||||
; CHECK: @test2
|
||||
; CHECK: Entry:
|
||||
; CHECK-NEXT: %X1 = getelementptr i32* @X, i64 0
|
||||
; CHECK-NEXT: %X2 = getelementptr i32* @X, i64 0
|
||||
; CHECK-NEXT: %X1.promoted = load i32* %X1
|
||||
; CHECK-NEXT: br label %Loop
|
||||
|
||||
Loop: ; preds = %Loop, %0
|
||||
%X1 = getelementptr i32* @X, i64 0 ; <i32*> [#uses=1]
|
||||
@ -32,4 +47,27 @@ Loop: ; preds = %Loop, %0
|
||||
|
||||
Exit: ; preds = %Loop
|
||||
ret void
|
||||
; CHECK: Exit:
|
||||
; CHECK-NEXT: store i32 %V, i32* %X1
|
||||
; CHECK-NEXT: ret void
|
||||
}
|
||||
|
||||
|
||||
|
||||
define void @test3(i32 %i) {
|
||||
; CHECK: @test3
|
||||
br label %Loop
|
||||
Loop:
|
||||
; Should not promote this to a register
|
||||
%x = volatile load i32* @X
|
||||
%x2 = add i32 %x, 1
|
||||
store i32 %x2, i32* @X
|
||||
br i1 true, label %Out, label %Loop
|
||||
|
||||
; CHECK: Loop:
|
||||
; CHECK-NEXT: volatile load
|
||||
|
||||
Out: ; preds = %Loop
|
||||
ret void
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user