Teach SCEVExpander to expand arithmetic involving pointers into GEP
instructions. It attempts to create high-level multi-operand GEPs, though in cases where this isn't possible it falls back to casting the pointer to i8* and emitting a GEP with that. Using GEP instructions instead of ptrtoint+arithmetic+inttoptr helps pointer analyses that don't use ScalarEvolution, such as BasicAliasAnalysis. Also, make the AddrModeMatcher more aggressive in handling GEPs. Previously it assumed that operand 0 of a GEP would require a register in almost all cases. It now does extra checking and can do more matching if operand 0 of the GEP is foldable. This fixes a problem that was exposed by SCEVExpander using GEPs. llvm-svn: 72093
Showing
- llvm/include/llvm/Analysis/ScalarEvolution.h 1 addition, 0 deletionsllvm/include/llvm/Analysis/ScalarEvolution.h
- llvm/include/llvm/Analysis/ScalarEvolutionExpander.h 10 additions, 7 deletionsllvm/include/llvm/Analysis/ScalarEvolutionExpander.h
- llvm/lib/Analysis/ScalarEvolution.cpp 7 additions, 0 deletionsllvm/lib/Analysis/ScalarEvolution.cpp
- llvm/lib/Analysis/ScalarEvolutionExpander.cpp 161 additions, 16 deletionsllvm/lib/Analysis/ScalarEvolutionExpander.cpp
- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp 6 additions, 6 deletionsllvm/lib/Transforms/Scalar/IndVarSimplify.cpp
- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp 13 additions, 12 deletionsllvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
- llvm/lib/Transforms/Utils/AddrModeMatcher.cpp 31 additions, 30 deletionsllvm/lib/Transforms/Utils/AddrModeMatcher.cpp
- llvm/test/Transforms/IndVarSimplify/preserve-gep.ll 39 additions, 0 deletionsllvm/test/Transforms/IndVarSimplify/preserve-gep.ll
- llvm/test/Transforms/LoopStrengthReduce/2009-04-28-no-reduce-mul.ll 2 additions, 1 deletion...Transforms/LoopStrengthReduce/2009-04-28-no-reduce-mul.ll
Loading
Please register or sign in to comment