[llvm] b74413b - [VPlan] Use VPSingleDef instead of VPValue in HCFG builder (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 22 03:16:15 PST 2025


Author: Florian Hahn
Date: 2025-02-22T11:15:37Z
New Revision: b74413bf91bd57877e47aa3e58c4c3d6f64d2ebe

URL: https://github.com/llvm/llvm-project/commit/b74413bf91bd57877e47aa3e58c4c3d6f64d2ebe
DIFF: https://github.com/llvm/llvm-project/commit/b74413bf91bd57877e47aa3e58c4c3d6f64d2ebe.diff

LOG: [VPlan] Use VPSingleDef instead of VPValue in HCFG builder (NFC).

Use VPSingleDef to remove unneeded casts to a recipe type.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp b/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp
index 47acf9d44e3a0..934202f27eb73 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp
@@ -322,13 +322,13 @@ void PlainCFGBuilder::createVPInstructionsForVPBB(VPBasicBlock *VPBB,
       continue;
     }
 
-    VPValue *NewVPV;
+    VPSingleDefRecipe *NewR;
     if (auto *Phi = dyn_cast<PHINode>(Inst)) {
       // Phi node's operands may have not been visited at this point. We create
       // an empty VPInstruction that we will fix once the whole plain CFG has
       // been built.
-      NewVPV = new VPWidenPHIRecipe(Phi, nullptr, Phi->getDebugLoc());
-      VPBB->appendRecipe(cast<VPWidenPHIRecipe>(NewVPV));
+      NewR = new VPWidenPHIRecipe(Phi, nullptr, Phi->getDebugLoc());
+      VPBB->appendRecipe(NewR);
       PhisToFix.push_back(Phi);
     } else {
       // Translate LLVM-IR operands into VPValue operands and set them in the
@@ -339,11 +339,11 @@ void PlainCFGBuilder::createVPInstructionsForVPBB(VPBasicBlock *VPBB,
 
       // Build VPInstruction for any arbitrary Instruction without specific
       // representation in VPlan.
-      NewVPV = cast<VPInstruction>(
+      NewR = cast<VPInstruction>(
           VPIRBuilder.createNaryOp(Inst->getOpcode(), VPOperands, Inst));
     }
 
-    IRDef2VPValue[Inst] = NewVPV;
+    IRDef2VPValue[Inst] = NewR;
   }
 }
 


        


More information about the llvm-commits mailing list