[llvm] b469422 - [LV] Simplify setDebugLocFromInst by using early exit (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 4 01:26:32 PDT 2022
Author: Florian Hahn
Date: 2022-07-04T09:25:26+01:00
New Revision: b4694229aa9d7a09d58a8e59339d14570437daf2
URL: https://github.com/llvm/llvm-project/commit/b4694229aa9d7a09d58a8e59339d14570437daf2
DIFF: https://github.com/llvm/llvm-project/commit/b4694229aa9d7a09d58a8e59339d14570437daf2.diff
LOG: [LV] Simplify setDebugLocFromInst by using early exit (NFC).
Suggested as separate improvement in D128657.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlan.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 4d709097c3062..6c0cca7ebc826 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -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 *
More information about the llvm-commits
mailing list