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

Bob Wilson bob.wilson at apple.com
Tue Sep 21 14:54:27 PDT 2010

Author: bwilson
Date: Tue Sep 21 16:54:27 2010
New Revision: 114488

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


Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=114488&r1=114487&r2=114488&view=diff
--- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Tue Sep 21 16:54:27 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->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.

More information about the llvm-commits mailing list