From bf6e012f8edbe0e09d5f7e2987084573fa6af8b0 Mon Sep 17 00:00:00 2001 From: Ahmed Bougacha Date: Fri, 5 Dec 2014 18:04:40 +0000 Subject: [PATCH] [CodeGenPrepare] Use variables for reused values. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223491 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenPrepare.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/CodeGen/CodeGenPrepare.cpp b/lib/CodeGen/CodeGenPrepare.cpp index 8d20848b3e2..a6c540b619c 100644 --- a/lib/CodeGen/CodeGenPrepare.cpp +++ b/lib/CodeGen/CodeGenPrepare.cpp @@ -2962,11 +2962,13 @@ bool CodeGenPrepare::MoveExtToFormExtLoad(Instruction *I) { 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::MoveExtToFormExtLoad(Instruction *I) { assert(isa(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