summaryrefslogtreecommitdiff
path: root/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
commitec57a1acec7803fff2faa54c6ea8fec2be01aeb9 (patch)
tree04ff05c1d46c19322f1b126619745c7b42015d84 /lib
parent00d01f1a427c34f444f1935911529becfbf1d51e (diff)
downloadllvm-ec57a1acec7803fff2faa54c6ea8fec2be01aeb9.tar.gz
llvm-ec57a1acec7803fff2faa54c6ea8fec2be01aeb9.tar.bz2
llvm-ec57a1acec7803fff2faa54c6ea8fec2be01aeb9.tar.xz
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')
-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 526107c977..3221e14347 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;