Generalize SCEVExpander::visitAddRecExpr's GEP persuit, and avoid

sending SCEVUnknowns to expandAddToGEP. This avoids the need for
expandAddToGEP to bend the rules and peek into SCEVUnknown
expressions.

Factor out the code for testing whether a SCEV can be factored by
a constant for use in a GEP index. This allows it to handle
SCEVAddRecExprs, by recursing.

As a result, SCEVExpander can now put more things in GEP indices,
so it emits fewer explicit mul instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72366 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2009-05-24 18:06:31 +00:00
parent 3925043af0
commit 453aa4fbf1
4 changed files with 221 additions and 54 deletions

View File

@@ -1,6 +1,6 @@
; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
; RUN: grep add %t | count 8
; RUN: grep mul %t | count 9
; RUN: grep mul %t | count 7
define void @foo(i64 %n, i64 %m, i64 %o, double* nocapture %p) nounwind {
entry: