[llvm-commits] [llvm] r114568 - /llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp

Bob Wilson bob.wilson at apple.com
Wed Sep 22 11:44:56 PDT 2010


Author: bwilson
Date: Wed Sep 22 13:44:56 2010
New Revision: 114568

URL: http://llvm.org/viewvc/llvm-project?rev=114568&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=114568&r1=114567&r2=114568&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Wed Sep 22 13:44:56 2010
@@ -772,7 +772,8 @@
   // 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;
 





More information about the llvm-commits mailing list