summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2010-09-21 21:54:27 +0000
committerBob Wilson <bob.wilson@apple.com>2010-09-21 21:54:27 +0000
commit71dc4d96ed39fadcdccf8c578d49a1afdae0c6ba (patch)
tree32e3d7ff834cf1c8df3b144e4556b39e268bffce /lib
parent9120f5c35b756e0b9d7747616e97df8f30edfcc8 (diff)
downloadllvm-71dc4d96ed39fadcdccf8c578d49a1afdae0c6ba.tar.gz
llvm-71dc4d96ed39fadcdccf8c578d49a1afdae0c6ba.tar.bz2
llvm-71dc4d96ed39fadcdccf8c578d49a1afdae0c6ba.tar.xz
Move a sign-extend or a zero-extend of a load to the same basic block as the
load when the type of the load is not legal, even if truncates are not free. The load is going to be legalized to an extending load anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114488 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/CodeGenPrepare.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 0e05a26d24..526107c977 100644
--- a/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -772,7 +772,8 @@ bool CodeGenPrepare::MoveExtToFormExtLoad(Instruction *I) {
// If the load has other users and the truncate is not free, this probably
// isn't worthwhile.
if (!LI->hasOneUse() &&
- TLI && !TLI->isTruncateFree(I->getType(), LI->getType()))
+ TLI && TLI->isTypeLegal(TLI->getValueType(LI->getType())) &&
+ !TLI->isTruncateFree(I->getType(), LI->getType()))
return false;
// Check whether the target supports casts folded into loads.