summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2014-12-05 18:04:40 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2014-12-05 18:04:40 +0000
commit55e3c2d9cfe0a8ed2d1e6257a914bce4e1fed201 (patch)
treec90f2cd3e8a510be79e26c8743ca0424f57be1df /llvm/lib
parentb9e9dc5e89cc85e761af8c40254352df6b751a84 (diff)
downloadbcm5719-llvm-55e3c2d9cfe0a8ed2d1e6257a914bce4e1fed201.tar.gz
bcm5719-llvm-55e3c2d9cfe0a8ed2d1e6257a914bce4e1fed201.zip
[CodeGenPrepare] Use variables for reused values. NFC.
llvm-svn: 223491
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 8d20848b3e2..a6c540b619c 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/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<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
OpenPOWER on IntegriCloud