summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit4ddcb6a6b466802d52d4835312679c6458a2e2c5 (patch)
tree5a5e96170cc03a23cbd877fbd48f46ce82334873 /llvm/lib
parentff714f9992c171d54341afb6cb998d7fc23e9bd2 (diff)
downloadbcm5719-llvm-4ddcb6a6b466802d52d4835312679c6458a2e2c5.tar.gz
bcm5719-llvm-4ddcb6a6b466802d52d4835312679c6458a2e2c5.zip
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. llvm-svn: 114488
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 0e05a26d243..526107c9770 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->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.
OpenPOWER on IntegriCloud