diff options
author | Stephen Hines <srhines@google.com> | 2014-04-23 16:57:46 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-04-24 15:53:16 -0700 |
commit | 36b56886974eae4f9c5ebc96befd3e7bfe5de338 (patch) | |
tree | e6cfb69fbbd937f450eeb83bfb83b9da3b01275a /lib/Analysis/CostModel.cpp | |
parent | 69a8640022b04415ae9fac62f8ab090601d8f889 (diff) | |
download | external_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.zip external_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.tar.gz external_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.tar.bz2 |
Update to LLVM 3.5a.
Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
Diffstat (limited to 'lib/Analysis/CostModel.cpp')
-rw-r--r-- | lib/Analysis/CostModel.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/Analysis/CostModel.cpp b/lib/Analysis/CostModel.cpp index f943258..b49211d 100644 --- a/lib/Analysis/CostModel.cpp +++ b/lib/Analysis/CostModel.cpp @@ -53,9 +53,9 @@ namespace { unsigned getInstructionCost(const Instruction *I) const; private: - virtual void getAnalysisUsage(AnalysisUsage &AU) const; - virtual bool runOnFunction(Function &F); - virtual void print(raw_ostream &OS, const Module*) const; + void getAnalysisUsage(AnalysisUsage &AU) const override; + bool runOnFunction(Function &F) override; + void print(raw_ostream &OS, const Module*) const override; /// The function that we analyze. Function *F; @@ -98,15 +98,12 @@ static TargetTransformInfo::OperandValueKind getOperandInfo(Value *V) { TargetTransformInfo::OperandValueKind OpInfo = TargetTransformInfo::OK_AnyValue; - // Check for a splat of a constant. - ConstantDataVector *CDV = 0; - if ((CDV = dyn_cast<ConstantDataVector>(V))) - if (CDV->getSplatValue() != NULL) - OpInfo = TargetTransformInfo::OK_UniformConstantValue; - ConstantVector *CV = 0; - if ((CV = dyn_cast<ConstantVector>(V))) - if (CV->getSplatValue() != NULL) + // Check for a splat of a constant or for a non uniform vector of constants. + if (isa<ConstantVector>(V) || isa<ConstantDataVector>(V)) { + OpInfo = TargetTransformInfo::OK_NonUniformConstantValue; + if (cast<Constant>(V)->getSplatValue() != NULL) OpInfo = TargetTransformInfo::OK_UniformConstantValue; + } return OpInfo; } @@ -337,7 +334,7 @@ static bool matchVectorSplittingReduction(const ExtractElementInst *ReduxRoot, Value *NextRdxOp; ShuffleVectorInst *Shuffle; - tie(NextRdxOp, Shuffle) = getShuffleAndOtherOprd(BinOp); + std::tie(NextRdxOp, Shuffle) = getShuffleAndOtherOprd(BinOp); // Check the current reduction operation and the shuffle use the same value. if (Shuffle == 0) @@ -439,7 +436,8 @@ unsigned CostModelAnalysis::getInstructionCost(const Instruction *I) const { case Instruction::UIToFP: case Instruction::Trunc: case Instruction::FPTrunc: - case Instruction::BitCast: { + case Instruction::BitCast: + case Instruction::AddrSpaceCast: { Type *SrcTy = I->getOperand(0)->getType(); return TTI->getCastInstrCost(I->getOpcode(), I->getType(), SrcTy); } |