mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-19 02:25:01 +00:00
two simple testcases loopreduce should handle but does not yet currently
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22682 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
; Make sure that the compare instruction occurs after the increment to avoid
|
||||||
|
; having overlapping live ranges that result in copies. We want the setcc instruction
|
||||||
|
; immediately before the conditional branch.
|
||||||
|
;
|
||||||
|
; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | %prcontext 'br bool' 1 | grep set
|
||||||
|
; XFAIL: *
|
||||||
|
|
||||||
|
void %foo(float* %D, uint %E) {
|
||||||
|
entry:
|
||||||
|
br label %no_exit
|
||||||
|
|
||||||
|
no_exit:
|
||||||
|
%indvar = phi uint [ 0, %entry ], [ %indvar.next, %no_exit ]
|
||||||
|
volatile store float 0.0, float* %D
|
||||||
|
%indvar.next = add uint %indvar, 1 ; <uint> [#uses=2]
|
||||||
|
%exitcond = seteq uint %indvar.next, %E ; <bool> [#uses=1]
|
||||||
|
br bool %exitcond, label %loopexit, label %no_exit
|
||||||
|
|
||||||
|
loopexit:
|
||||||
|
ret void
|
||||||
|
}
|
29
test/Transforms/LoopStrengthReduce/related_indvars.ll
Normal file
29
test/Transforms/LoopStrengthReduce/related_indvars.ll
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep phi | wc -l | grep 1
|
||||||
|
|
||||||
|
; This should only result in one PHI node!
|
||||||
|
; XFAIL: *
|
||||||
|
|
||||||
|
; void foo(double *D, double *E, double F) {
|
||||||
|
; while (D != E)
|
||||||
|
; *D++ = F;
|
||||||
|
; }
|
||||||
|
|
||||||
|
void %foo(double* %D, double* %E, double %F) {
|
||||||
|
entry:
|
||||||
|
%tmp.24 = seteq double* %D, %E ; <bool> [#uses=1]
|
||||||
|
br bool %tmp.24, label %return, label %no_exit
|
||||||
|
|
||||||
|
no_exit: ; preds = %no_exit, %entry
|
||||||
|
%indvar = phi uint [ 0, %entry ], [ %indvar.next, %no_exit ] ; <uint> [#uses=3]
|
||||||
|
%D_addr.0.0.rec = cast uint %indvar to int ; <int> [#uses=1]
|
||||||
|
%D_addr.0.0 = getelementptr double* %D, uint %indvar ; <double*> [#uses=1]
|
||||||
|
%inc.rec = add int %D_addr.0.0.rec, 1 ; <int> [#uses=1]
|
||||||
|
%inc = getelementptr double* %D, int %inc.rec ; <double*> [#uses=1]
|
||||||
|
store double %F, double* %D_addr.0.0
|
||||||
|
%tmp.2 = seteq double* %inc, %E ; <bool> [#uses=1]
|
||||||
|
%indvar.next = add uint %indvar, 1 ; <uint> [#uses=1]
|
||||||
|
br bool %tmp.2, label %return, label %no_exit
|
||||||
|
|
||||||
|
return: ; preds = %no_exit, %entry
|
||||||
|
ret void
|
||||||
|
}
|
Reference in New Issue
Block a user