aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2010-09-22 18:44:56 +0000
committerBob Wilson <bob.wilson@apple.com>2010-09-22 18:44:56 +0000
commit8ca8f77bb65f13ead82f99495b6bf70153efde2e (patch)
tree04ff05c1d46c19322f1b126619745c7b42015d84 /lib/Transforms
parente5a72558a47713fb4dd9776bfe3df25a9508605b (diff)
downloadexternal_llvm-8ca8f77bb65f13ead82f99495b6bf70153efde2e.zip
external_llvm-8ca8f77bb65f13ead82f99495b6bf70153efde2e.tar.gz
external_llvm-8ca8f77bb65f13ead82f99495b6bf70153efde2e.tar.bz2
When moving zext/sext to be folded with a load, ignore the issue of whether
truncates are free only in the case where the extended type is legal but the load type is not. If both types are illegal, such as when they are too big, the load may not be legalized into an extended load. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114568 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-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 526107c..3221e14 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->isTypeLegal(TLI->getValueType(LI->getType())) &&
+ TLI && (TLI->isTypeLegal(TLI->getValueType(LI->getType())) ||
+ !TLI->isTypeLegal(TLI->getValueType(I->getType()))) &&
!TLI->isTruncateFree(I->getType(), LI->getType()))
return false;