summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commitb6832a437298a26c67b9c8275ee1613e74a88792 (patch)
tree4a74f8f2966c9597aa65ef97d6ac8a4231e7f0bd /llvm/lib
parente12c8ba05b8d6247fcf9d6ad3907af0f8f562124 (diff)
downloadbcm5719-llvm-b6832a437298a26c67b9c8275ee1613e74a88792.tar.gz
bcm5719-llvm-b6832a437298a26c67b9c8275ee1613e74a88792.zip
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. llvm-svn: 114568
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 526107c9770..3221e143476 100644
--- a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud