diff options
author | Mikael Holmen <mikael.holmen@ericsson.com> | 2018-02-01 06:38:34 +0000 |
---|---|---|
committer | Mikael Holmen <mikael.holmen@ericsson.com> | 2018-02-01 06:38:34 +0000 |
commit | 6d06976e74dcc4ee9401d7194da49b16f57fee81 (patch) | |
tree | 0f695accdffefec477fd1b0ec20350e8db7014f7 /llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
parent | 1a6493b4e08c7789138b8087a44bcec53b9cd3fa (diff) | |
download | bcm5719-llvm-6d06976e74dcc4ee9401d7194da49b16f57fee81.tar.gz bcm5719-llvm-6d06976e74dcc4ee9401d7194da49b16f57fee81.zip |
[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
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 332c074a1df..4b8e2286ed9 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -4993,7 +4993,7 @@ Value *LSRInstance::Expand(const LSRUse &LU, const LSRFixup &LF, // Unless the addressing mode will not be folded. if (!Ops.empty() && LU.Kind == LSRUse::Address && isAMCompletelyFolded(TTI, LU, F)) { - Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), Ty); + Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), nullptr); Ops.clear(); Ops.push_back(SE.getUnknown(FullV)); } |