[llvm] [LV] Align debug location of the widen-phi to the original phi. (PR #120338)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 20 03:06:28 PST 2024


================
@@ -2291,9 +2291,10 @@ class VPWidenPHIRecipe : public VPSingleDefRecipe {
   SmallVector<VPBasicBlock *, 2> IncomingBlocks;
 
 public:
-  /// Create a new VPWidenPHIRecipe for \p Phi with start value \p Start.
-  VPWidenPHIRecipe(PHINode *Phi, VPValue *Start = nullptr)
-      : VPSingleDefRecipe(VPDef::VPWidenPHISC, ArrayRef<VPValue *>(), Phi) {
+  /// Create a new VPWidenPHIRecipe for \p Phi with start value \p Start and
+  /// debug location \p DL.
+  VPWidenPHIRecipe(PHINode *Phi, VPValue *Start = nullptr, DebugLoc DL = {})
+      : VPSingleDefRecipe(VPDef::VPWidenPHISC, ArrayRef<VPValue *>(), Phi, DL) {
----------------
Mel-Chen wrote:

I see, considering that Phi could potentially be nullptr is reasonable. 
But I have another question: Do we allow `phi->getDebugLoc()` and `DL` to be different? If not, should we add an assert in the constructor? If we do allow it, should we use `phi->getDebugLoc()` (if phi is not nullptr) or `DL`?
cc: @fhahn 

https://github.com/llvm/llvm-project/pull/120338


More information about the llvm-commits mailing list