[LV] Simplify setDebugLocFromInst by using early exit (NFC).
Suggested as separate improvement in D128657.
This commit is contained in:
parent
7283f48a05
commit
b4694229aa
|
@ -248,25 +248,27 @@ void VPTransformState::addMetadata(ArrayRef<Value *> To, Instruction *From) {
|
|||
}
|
||||
|
||||
void VPTransformState::setDebugLocFromInst(const Value *V) {
|
||||
if (const Instruction *Inst = dyn_cast_or_null<Instruction>(V)) {
|
||||
const DILocation *DIL = Inst->getDebugLoc();
|
||||
|
||||
// When a FSDiscriminator is enabled, we don't need to add the multiply
|
||||
// factors to the discriminators.
|
||||
if (DIL && Inst->getFunction()->isDebugInfoForProfiling() &&
|
||||
!isa<DbgInfoIntrinsic>(Inst) && !EnableFSDiscriminator) {
|
||||
// FIXME: For scalable vectors, assume vscale=1.
|
||||
auto NewDIL =
|
||||
DIL->cloneByMultiplyingDuplicationFactor(UF * VF.getKnownMinValue());
|
||||
if (NewDIL)
|
||||
Builder.SetCurrentDebugLocation(*NewDIL);
|
||||
else
|
||||
LLVM_DEBUG(dbgs() << "Failed to create new discriminator: "
|
||||
<< DIL->getFilename() << " Line: " << DIL->getLine());
|
||||
} else
|
||||
Builder.SetCurrentDebugLocation(DIL);
|
||||
} else
|
||||
const Instruction *Inst = dyn_cast<Instruction>(V);
|
||||
if (!Inst) {
|
||||
Builder.SetCurrentDebugLocation(DebugLoc());
|
||||
return;
|
||||
}
|
||||
|
||||
const DILocation *DIL = Inst->getDebugLoc();
|
||||
// When a FSDiscriminator is enabled, we don't need to add the multiply
|
||||
// factors to the discriminators.
|
||||
if (DIL && Inst->getFunction()->isDebugInfoForProfiling() &&
|
||||
!isa<DbgInfoIntrinsic>(Inst) && !EnableFSDiscriminator) {
|
||||
// FIXME: For scalable vectors, assume vscale=1.
|
||||
auto NewDIL =
|
||||
DIL->cloneByMultiplyingDuplicationFactor(UF * VF.getKnownMinValue());
|
||||
if (NewDIL)
|
||||
Builder.SetCurrentDebugLocation(*NewDIL);
|
||||
else
|
||||
LLVM_DEBUG(dbgs() << "Failed to create new discriminator: "
|
||||
<< DIL->getFilename() << " Line: " << DIL->getLine());
|
||||
} else
|
||||
Builder.SetCurrentDebugLocation(DIL);
|
||||
}
|
||||
|
||||
BasicBlock *
|
||||
|
|
Loading…
Reference in a new issue