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. llvm-svn: 72366
Showing
- llvm/include/llvm/Analysis/ScalarEvolutionExpander.h 2 additions, 2 deletionsllvm/include/llvm/Analysis/ScalarEvolutionExpander.h
- llvm/lib/Analysis/ScalarEvolutionExpander.cpp 140 additions, 51 deletionsllvm/lib/Analysis/ScalarEvolutionExpander.cpp
- llvm/test/Transforms/IndVarSimplify/addrec-gep.ll 78 additions, 0 deletionsllvm/test/Transforms/IndVarSimplify/addrec-gep.ll
- llvm/test/Transforms/IndVarSimplify/gep-with-mul-base.ll 1 addition, 1 deletionllvm/test/Transforms/IndVarSimplify/gep-with-mul-base.ll
Loading
Please register or sign in to comment