diff options
author | Renato Golin <renato.golin@linaro.org> | 2015-08-30 10:49:04 +0000 |
---|---|---|
committer | Renato Golin <renato.golin@linaro.org> | 2015-08-30 10:49:04 +0000 |
commit | 3b1d3b0d84af2bf5a50dd31f20fb81ca74c41880 (patch) | |
tree | 661170df30d1869d3fee2a847811534e4ca1a514 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | |
parent | c7be31736ca0cbd7fca41989b805228cf87e4355 (diff) | |
download | bcm5719-llvm-3b1d3b0d84af2bf5a50dd31f20fb81ca74c41880.tar.gz bcm5719-llvm-3b1d3b0d84af2bf5a50dd31f20fb81ca74c41880.zip |
Revert "Revert "New interface function is added to VectorUtils Value *getSplatValue(Value *Val);""
This reverts commit r246379. It seems that the commit was not the culprit,
and the bot will be investigated for instability.
llvm-svn: 246380
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 63328200f8d..c958f7df019 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -22,6 +22,7 @@ #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/ValueTracking.h" +#include "llvm/Analysis/VectorUtils.h" #include "llvm/CodeGen/FastISel.h" #include "llvm/CodeGen/FunctionLoweringInfo.h" #include "llvm/CodeGen/GCMetadata.h" @@ -3150,37 +3151,32 @@ static bool getUniformBase(Value *& Ptr, SDValue& Base, SDValue& Index, SelectionDAGBuilder* SDB) { assert(Ptr->getType()->isVectorTy() && "Unexpected pointer type"); - GetElementPtrInst *Gep = dyn_cast<GetElementPtrInst>(Ptr); - if (!Gep || Gep->getNumOperands() > 2) + GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Ptr); + if (!GEP || GEP->getNumOperands() > 2) return false; - ShuffleVectorInst *ShuffleInst = - dyn_cast<ShuffleVectorInst>(Gep->getPointerOperand()); - if (!ShuffleInst || !ShuffleInst->getMask()->isNullValue() || - cast<Instruction>(ShuffleInst->getOperand(0))->getOpcode() != - Instruction::InsertElement) + Value *GEPPtrs = GEP->getPointerOperand(); + if (!(Ptr = getSplatValue(GEPPtrs))) return false; - Ptr = cast<InsertElementInst>(ShuffleInst->getOperand(0))->getOperand(1); - SelectionDAG& DAG = SDB->DAG; const TargetLowering &TLI = DAG.getTargetLoweringInfo(); // Check is the Ptr is inside current basic block // If not, look for the shuffle instruction if (SDB->findValue(Ptr)) Base = SDB->getValue(Ptr); - else if (SDB->findValue(ShuffleInst)) { - SDValue ShuffleNode = SDB->getValue(ShuffleInst); - SDLoc sdl = ShuffleNode; - Base = DAG.getNode( - ISD::EXTRACT_VECTOR_ELT, sdl, - ShuffleNode.getValueType().getScalarType(), ShuffleNode, - DAG.getConstant(0, sdl, TLI.getVectorIdxTy(DAG.getDataLayout()))); + else if (SDB->findValue(GEPPtrs)) { + SDValue GEPPtrsVal = SDB->getValue(GEPPtrs); + SDLoc sdl = GEPPtrsVal; + EVT IdxVT = TLI.getVectorIdxTy(DAG.getDataLayout()); + Base = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, sdl, + GEPPtrsVal.getValueType().getScalarType(), GEPPtrsVal, + DAG.getConstant(0, sdl, IdxVT)); SDB->setValue(Ptr, Base); } else return false; - Value *IndexVal = Gep->getOperand(1); + Value *IndexVal = GEP->getOperand(1); if (SDB->findValue(IndexVal)) { Index = SDB->getValue(IndexVal); |