diff options
author | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-06-28 17:14:48 +0000 |
---|---|---|
committer | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-06-28 17:14:48 +0000 |
commit | ce2c766f61fb43747106a2dde34b90c1016371d4 (patch) | |
tree | 82af71b5e54f85b6c1fde6002fa5d90bcfd3916a /llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | |
parent | eec721826cc35a0c08dc5bc54db9a51dbd4fa361 (diff) | |
download | bcm5719-llvm-ce2c766f61fb43747106a2dde34b90c1016371d4.tar.gz bcm5719-llvm-ce2c766f61fb43747106a2dde34b90c1016371d4.zip |
LoopVectorize: Pull dyn_cast into setDebugLocFromInst
llvm-svn: 185168
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorize.cpp')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 5b3bfa1c81f..d4be08d6151 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -347,8 +347,8 @@ static Instruction *getDebugLocFromInstOrOperands(Instruction *I) { /// \brief Set the debug location in the builder using the debug location in the /// instruction. -static void setDebugLocFromInst(IRBuilder<> &B, const Instruction *Inst) { - if (Inst) +static void setDebugLocFromInst(IRBuilder<> &B, const Value *Ptr) { + if (const Instruction *Inst = dyn_cast_or_null<Instruction>(Ptr)) B.SetCurrentDebugLocation(Inst->getDebugLoc()); else B.SetCurrentDebugLocation(DebugLoc()); @@ -1267,7 +1267,7 @@ void InnerLoopVectorizer::vectorizeMemoryInstruction(Instruction *Instr, } else { // Use the induction element ptr. assert(isa<PHINode>(Ptr) && "Invalid induction ptr"); - setDebugLocFromInst(Builder, cast<Instruction>(Ptr)); + setDebugLocFromInst(Builder, Ptr); VectorParts &PtrVal = getVectorValue(Ptr); Ptr = Builder.CreateExtractElement(PtrVal[0], Zero); } @@ -2046,8 +2046,7 @@ InnerLoopVectorizer::vectorizeLoop(LoopVectorizationLegality *Legal) { LoopVectorizationLegality::ReductionDescriptor RdxDesc = (*Legal->getReductionVars())[RdxPhi]; - setDebugLocFromInst(Builder, - dyn_cast<Instruction>((Value*)RdxDesc.StartValue)); + setDebugLocFromInst(Builder, RdxDesc.StartValue); // We need to generate a reduction vector from the incoming scalar. // To do so, we need to generate the 'identity' vector and overide @@ -2122,7 +2121,7 @@ InnerLoopVectorizer::vectorizeLoop(LoopVectorizationLegality *Legal) { // Reduce all of the unrolled parts into a single vector. Value *ReducedPartRdx = RdxParts[0]; unsigned Op = getReductionBinOp(RdxDesc.Kind); - setDebugLocFromInst(Builder, dyn_cast<Instruction>(ReducedPartRdx)); + setDebugLocFromInst(Builder, ReducedPartRdx); for (unsigned part = 1; part < UF; ++part) { if (Op != Instruction::ICmp && Op != Instruction::FCmp) ReducedPartRdx = Builder.CreateBinOp((Instruction::BinaryOps)Op, |