summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorRon Lieberman <ronl@codeaurora.org>2017-10-02 00:34:07 +0000
committerRon Lieberman <ronl@codeaurora.org>2017-10-02 00:34:07 +0000
commit9bcdd80b66d45242599343c2a78ab7806662feff (patch)
treec0ea8b55d4658575df346ee5dca0b3f83b0949ac /llvm/lib
parentf90493d220acae49407a6142c9ddd6841c11fc2b (diff)
downloadbcm5719-llvm-9bcdd80b66d45242599343c2a78ab7806662feff.tar.gz
bcm5719-llvm-9bcdd80b66d45242599343c2a78ab7806662feff.zip
[Hexagon] Check vector elements for equivalence in the HexagonVectorLoopCarriedReuse pass
If the two instructions being compared for equivalence have corresponding operands that are integer constants, then check their values to determine equivalence. Patch by Suyog Sarda! llvm-svn: 314642
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp b/llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp
index aeff5f8d3e4..a0fdc70e141 100644
--- a/llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp
@@ -340,6 +340,21 @@ bool HexagonVectorLoopCarriedReuse::isEquivalentOperation(Instruction *I1,
return false;
}
}
+
+ // If both the Instructions are of Vector Type and any of the element
+ // is integer constant, check their values too for equivalence.
+ if (I1->getType()->isVectorTy() && I2->getType()->isVectorTy()) {
+ unsigned NumOperands = I1->getNumOperands();
+ for (unsigned i = 0; i < NumOperands; ++i) {
+ ConstantInt *C1 = dyn_cast<ConstantInt>(I1->getOperand(i));
+ ConstantInt *C2 = dyn_cast<ConstantInt>(I2->getOperand(i));
+ if(!C1) continue;
+ assert(C2);
+ if (C1->getSExtValue() != C2->getSExtValue())
+ return false;
+ }
+ }
+
return true;
}
@@ -520,7 +535,7 @@ bool HexagonVectorLoopCarriedReuse::doVLCR() {
assert((CurLoop->getNumBlocks() == 1) &&
"Can do VLCR only on single block loops");
- bool Changed;
+ bool Changed = false;
bool Continue;
DEBUG(dbgs() << "Working on Loop: " << *CurLoop->getHeader() << "\n");
OpenPOWER on IntegriCloud