1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

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
This commit is contained in:
Bob Wilson 2010-09-21 21:54:27 +00:00
parent 064f6a1a3d
commit a22747a563

View File

@ -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.