[llvm] r223491 - [CodeGenPrepare] Use variables for reused values. NFC.

Ahmed Bougacha ahmed.bougacha at gmail.com
Fri Dec 5 10:04:41 PST 2014


Author: ab
Date: Fri Dec  5 12:04:40 2014
New Revision: 223491

URL: http://llvm.org/viewvc/llvm-project?rev=223491&view=rev
Log:
[CodeGenPrepare] Use variables for reused values. NFC.

Modified:
    llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp

Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=223491&r1=223490&r2=223491&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Fri Dec  5 12:04:40 2014
@@ -2962,11 +2962,13 @@ bool CodeGenPrepare::MoveExtToFormExtLoa
   if (LI->getParent() == I->getParent())
     return false;
 
+  EVT VT = TLI->getValueType(I->getType());
+  EVT LoadVT = TLI->getValueType(LI->getType());
+
   // 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->isTypeLegal(TLI->getValueType(I->getType()))) &&
+  if (!LI->hasOneUse() && TLI &&
+      (TLI->isTypeLegal(LoadVT) || !TLI->isTypeLegal(VT)) &&
       !TLI->isTruncateFree(I->getType(), LI->getType()))
     return false;
 
@@ -2978,7 +2980,7 @@ bool CodeGenPrepare::MoveExtToFormExtLoa
     assert(isa<SExtInst>(I) && "Unexpected ext type!");
     LType = ISD::SEXTLOAD;
   }
-  if (TLI && !TLI->isLoadExtLegal(LType, TLI->getValueType(LI->getType())))
+  if (TLI && !TLI->isLoadExtLegal(LType, LoadVT))
     return false;
 
   // Move the extend into the same block as the load, so that SelectionDAG





More information about the llvm-commits mailing list