mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Reapply the new LoopStrengthReduction code, with compile time and
bug fixes, and with improved heuristics for analyzing foreign-loop addrecs. This change also flattens IVUsers, eliminating the stride-oriented groupings, which makes it easier to work with. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95975 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
; RUN: opt < %s -loop-reduce -S | grep ugt
|
||||
; PR2535
|
||||
; RUN: llc -march=x86-64 < %s -o - | grep {cmpl \\$\[1\], %}
|
||||
|
||||
@.str = internal constant [4 x i8] c"%d\0A\00"
|
||||
|
||||
@@ -16,7 +15,7 @@ forbody:
|
||||
%add166 = or i32 %mul15, 1 ; <i32> [#uses=1] *
|
||||
call i32 (i8*, ...)* @printf( i8* noalias getelementptr ([4 x i8]* @.str, i32 0, i32 0), i32 %add166 ) nounwind
|
||||
%inc = add i32 %i.0, 1 ; <i32> [#uses=3]
|
||||
%cmp = icmp ult i32 %inc, 1027 ; <i1> [#uses=1]
|
||||
%cmp = icmp ne i32 %inc, 1027 ; <i1> [#uses=1]
|
||||
br i1 %cmp, label %forbody, label %afterfor
|
||||
|
||||
afterfor: ; preds = %forcond
|
||||
|
@@ -1,10 +1,15 @@
|
||||
; RUN: llc %s -o - --x86-asm-syntax=att | grep {cmpl \$4}
|
||||
; RUN: llc < %s -o - | FileCheck %s
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
|
||||
target triple = "x86_64-apple-darwin9"
|
||||
|
||||
; This is like change-compare-stride-trickiness-1.ll except the comparison
|
||||
; happens before the relevant use, so the comparison stride can't be
|
||||
; easily changed.
|
||||
; The comparison happens before the relevant use, but it can still be rewritten
|
||||
; to compare with zero.
|
||||
|
||||
; CHECK: foo:
|
||||
; CHECK: align
|
||||
; CHECK: incl %eax
|
||||
; CHECK-NEXT: decl %ecx
|
||||
; CHECK-NEXT: jne
|
||||
|
||||
define void @foo() nounwind {
|
||||
entry:
|
||||
|
@@ -1,10 +1,12 @@
|
||||
; RUN: llc %s -o - --x86-asm-syntax=att | grep {cmp. \$8}
|
||||
; RUN: llc %s -o - --x86-asm-syntax=att | grep {cmp. \$10}
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
|
||||
target triple = "x86_64-apple-darwin9"
|
||||
|
||||
; The comparison happens after the relevant use, so the stride can easily
|
||||
; be changed. The comparison can be done in a narrower mode than the
|
||||
; induction variable.
|
||||
; TODO: By making the first store post-increment as well, the loop setup
|
||||
; could be made simpler.
|
||||
|
||||
define void @foo() nounwind {
|
||||
entry:
|
||||
|
@@ -19,7 +19,7 @@ bb3: ; preds = %bb1
|
||||
%tmp4 = add i32 %c_addr.1, -1 ; <i32> [#uses=1]
|
||||
%c_addr.1.be = select i1 %tmp2, i32 %tmp3, i32 %tmp4 ; <i32> [#uses=1]
|
||||
%indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1]
|
||||
; CHECK: sub i32 %lsr.iv, 1
|
||||
; CHECK: add i32 %lsr.iv, -1
|
||||
br label %bb6
|
||||
|
||||
bb6: ; preds = %bb3, %entry
|
||||
|
@@ -1,5 +1,5 @@
|
||||
; Check that the index of 'P[outer]' is pulled out of the loop.
|
||||
; RUN: opt < %s -loop-reduce -S | \
|
||||
; RUN: opt < %s -loop-reduce -S -default-data-layout="e-p:32:32:32" | \
|
||||
; RUN: not grep {getelementptr.*%outer.*%INDVAR}
|
||||
|
||||
declare i1 @pred()
|
||||
|
@@ -1,5 +1,5 @@
|
||||
; Check that the index of 'P[outer]' is pulled out of the loop.
|
||||
; RUN: opt < %s -loop-reduce -S | \
|
||||
; RUN: opt < %s -loop-reduce -S -default-data-layout="e-p:32:32:32" | \
|
||||
; RUN: not grep {getelementptr.*%outer.*%INDVAR}
|
||||
|
||||
declare i1 @pred()
|
||||
|
@@ -1,7 +1,7 @@
|
||||
; Check that this test makes INDVAR and related stuff dead, because P[indvar]
|
||||
; gets reduced, making INDVAR dead.
|
||||
|
||||
; RUN: opt < %s -loop-reduce -S | not grep INDVAR
|
||||
; RUN: opt < %s -loop-reduce -S -default-data-layout="e-p:32:32:32" | not grep INDVAR
|
||||
|
||||
declare i1 @pred()
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
; RUN: opt < %s -analyze -iv-users | grep {Stride i64 {3,+,2}<%loop>:}
|
||||
; RUN: opt < %s -analyze -iv-users | grep {\{1,+,3,+,2\}<%loop> (post-inc)}
|
||||
|
||||
; The value of %r is dependent on a polynomial iteration expression.
|
||||
|
||||
|
@@ -7,10 +7,12 @@ define void @test(i32* %P) {
|
||||
; <label>:0
|
||||
br label %Loop
|
||||
Loop: ; preds = %Loop, %0
|
||||
%i = phi i32 [ 0, %0 ], [ %i.next, %Loop ]
|
||||
%INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=2]
|
||||
%STRRED = getelementptr i32* %P, i32 %INDVAR ; <i32*> [#uses=1]
|
||||
store i32 0, i32* %STRRED
|
||||
%INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1]
|
||||
%i.next = add i32 %i, 1
|
||||
%cond = call i1 @pred( ) ; <i1> [#uses=1]
|
||||
br i1 %cond, label %Loop, label %Out
|
||||
Out: ; preds = %Loop
|
||||
|
@@ -1,5 +1,5 @@
|
||||
; RUN: opt < %s -loop-reduce -S | \
|
||||
; RUN: grep {add i32 %lsr.iv.next, 1}
|
||||
; RUN: grep {add i32 %indvar630.ui, 1}
|
||||
;
|
||||
; Make sure that the use of the IV outside of the loop (the store) uses the
|
||||
; post incremented value of the IV, not the preincremented value. This
|
||||
|
Reference in New Issue
Block a user