[LSR] Don't force bases of foldable formulae to the final type.
Summary: Before emitting code for scaled registers, we prevent SCEVExpander from hoisting any scaled addressing mode by emitting all the bases first. However, these bases are being forced to the final type, resulting in some odd code. For example, if the type of the base is an integer and the final type is a pointer, we will emit an inttoptr for the base, a ptrtoint for the scale, and then a 'reverse' GEP where the GEP pointer is actually the base integer and the index is the pointer. It's more intuitive to use the pointer as a pointer and the integer as index. Patch by: Bevin Hansson Reviewers: atrick, qcolombet, sanjoy Reviewed By: qcolombet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D42103 llvm-svn: 323946
Showing
- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp 1 addition, 1 deletionllvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
- llvm/test/Transforms/LoopStrengthReduce/X86/macro-fuse-cmp.ll 26 additions, 30 deletions.../test/Transforms/LoopStrengthReduce/X86/macro-fuse-cmp.ll
- llvm/test/Transforms/LoopStrengthReduce/X86/nested-loop.ll 8 additions, 12 deletionsllvm/test/Transforms/LoopStrengthReduce/X86/nested-loop.ll
Loading
Please register or sign in to comment