]> granicus.if.org Git - llvm/commit
Use the basic cost if a GEP is not used as addressing mode
authorJun Bum Lim <junbuml@codeaurora.org>
Fri, 29 Sep 2017 14:50:16 +0000 (14:50 +0000)
committerJun Bum Lim <junbuml@codeaurora.org>
Fri, 29 Sep 2017 14:50:16 +0000 (14:50 +0000)
commitfd8d5dac8491859e0860b5195013540c455aeb02
treedaaa784008f535aa2059c22cc67df138d4ace590
parente2ff20cbface83819e447eef1345ddaa9bfec441
Use the basic cost if a GEP is not used as addressing mode

Summary:
Currently, getGEPCost() returns TCC_FREE whenever a GEP is a legal addressing mode in the target.
However, since it doesn't check its actual users, it will return FREE even in cases
where the GEP cannot be folded away as a part of actual addressing mode.
For example, if an user of the GEP is a call instruction taking the GEP as a parameter,
then the GEP may not be folded in isel.

Reviewers: hfinkel, efriedma, mcrosier, jingyue, haicheng

Reviewed By: hfinkel

Subscribers: javed.absar, llvm-commits

Differential Revision: https://reviews.llvm.org/D38085

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314517 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/TargetTransformInfo.h
include/llvm/Analysis/TargetTransformInfoImpl.h
include/llvm/CodeGen/BasicTTIImpl.h
include/llvm/IR/Operator.h
lib/Analysis/TargetTransformInfo.cpp
lib/Transforms/Scalar/NaryReassociate.cpp
lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
test/Analysis/CostModel/AArch64/gep.ll
test/Analysis/CostModel/X86/vector_gep.ll