mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-19 02:25:01 +00:00
LoopVectorize: Pull dyn_cast into setDebugLocFromInst
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185168 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -347,8 +347,8 @@ static Instruction *getDebugLocFromInstOrOperands(Instruction *I) {
|
|||||||
|
|
||||||
/// \brief Set the debug location in the builder using the debug location in the
|
/// \brief Set the debug location in the builder using the debug location in the
|
||||||
/// instruction.
|
/// instruction.
|
||||||
static void setDebugLocFromInst(IRBuilder<> &B, const Instruction *Inst) {
|
static void setDebugLocFromInst(IRBuilder<> &B, const Value *Ptr) {
|
||||||
if (Inst)
|
if (const Instruction *Inst = dyn_cast_or_null<Instruction>(Ptr))
|
||||||
B.SetCurrentDebugLocation(Inst->getDebugLoc());
|
B.SetCurrentDebugLocation(Inst->getDebugLoc());
|
||||||
else
|
else
|
||||||
B.SetCurrentDebugLocation(DebugLoc());
|
B.SetCurrentDebugLocation(DebugLoc());
|
||||||
@@ -1267,7 +1267,7 @@ void InnerLoopVectorizer::vectorizeMemoryInstruction(Instruction *Instr,
|
|||||||
} else {
|
} else {
|
||||||
// Use the induction element ptr.
|
// Use the induction element ptr.
|
||||||
assert(isa<PHINode>(Ptr) && "Invalid induction ptr");
|
assert(isa<PHINode>(Ptr) && "Invalid induction ptr");
|
||||||
setDebugLocFromInst(Builder, cast<Instruction>(Ptr));
|
setDebugLocFromInst(Builder, Ptr);
|
||||||
VectorParts &PtrVal = getVectorValue(Ptr);
|
VectorParts &PtrVal = getVectorValue(Ptr);
|
||||||
Ptr = Builder.CreateExtractElement(PtrVal[0], Zero);
|
Ptr = Builder.CreateExtractElement(PtrVal[0], Zero);
|
||||||
}
|
}
|
||||||
@@ -2046,8 +2046,7 @@ InnerLoopVectorizer::vectorizeLoop(LoopVectorizationLegality *Legal) {
|
|||||||
LoopVectorizationLegality::ReductionDescriptor RdxDesc =
|
LoopVectorizationLegality::ReductionDescriptor RdxDesc =
|
||||||
(*Legal->getReductionVars())[RdxPhi];
|
(*Legal->getReductionVars())[RdxPhi];
|
||||||
|
|
||||||
setDebugLocFromInst(Builder,
|
setDebugLocFromInst(Builder, RdxDesc.StartValue);
|
||||||
dyn_cast<Instruction>((Value*)RdxDesc.StartValue));
|
|
||||||
|
|
||||||
// We need to generate a reduction vector from the incoming scalar.
|
// We need to generate a reduction vector from the incoming scalar.
|
||||||
// To do so, we need to generate the 'identity' vector and overide
|
// 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.
|
// Reduce all of the unrolled parts into a single vector.
|
||||||
Value *ReducedPartRdx = RdxParts[0];
|
Value *ReducedPartRdx = RdxParts[0];
|
||||||
unsigned Op = getReductionBinOp(RdxDesc.Kind);
|
unsigned Op = getReductionBinOp(RdxDesc.Kind);
|
||||||
setDebugLocFromInst(Builder, dyn_cast<Instruction>(ReducedPartRdx));
|
setDebugLocFromInst(Builder, ReducedPartRdx);
|
||||||
for (unsigned part = 1; part < UF; ++part) {
|
for (unsigned part = 1; part < UF; ++part) {
|
||||||
if (Op != Instruction::ICmp && Op != Instruction::FCmp)
|
if (Op != Instruction::ICmp && Op != Instruction::FCmp)
|
||||||
ReducedPartRdx = Builder.CreateBinOp((Instruction::BinaryOps)Op,
|
ReducedPartRdx = Builder.CreateBinOp((Instruction::BinaryOps)Op,
|
||||||
|
Reference in New Issue
Block a user