diff options
author | Pranav Bhandarkar <pranavb@codeaurora.org> | 2017-09-22 16:43:31 +0000 |
---|---|---|
committer | Pranav Bhandarkar <pranavb@codeaurora.org> | 2017-09-22 16:43:31 +0000 |
commit | 09273239d1e17e1079a07238ecc384ec5479c06f (patch) | |
tree | 5b1000bfc726b2a63512e36543ff22f30b36eb55 /llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp | |
parent | b086289787d62278089502d222135e098171715b (diff) | |
download | bcm5719-llvm-09273239d1e17e1079a07238ecc384ec5479c06f.tar.gz bcm5719-llvm-09273239d1e17e1079a07238ecc384ec5479c06f.zip |
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: 313993
Diffstat (limited to 'llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp')
-rw-r--r-- | llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp b/llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp index 77dc5f5eee7..7052503186e 100644 --- a/llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp +++ b/llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp @@ -302,6 +302,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; } |