[llvm] 71f2c1e - [VPlan] Use early exit in ::extractLastLaneOfFirstOperand (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 23 13:56:14 PDT 2025


Author: Florian Hahn
Date: 2025-04-23T21:55:35+01:00
New Revision: 71f2c1e2045abaa4c5dcf47edfd1adbc407e7563

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

LOG: [VPlan] Use early exit in ::extractLastLaneOfFirstOperand (NFC).

Reduce indent level, as suggested in
https://github.com/llvm/llvm-project/pull/136455.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 621012f235a8d..6720140608d15 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -1142,14 +1142,14 @@ void VPIRInstruction::extractLastLaneOfFirstOperand(VPBuilder &Builder) {
          "can only update exiting operands to phi nodes");
   assert(getNumOperands() > 0 && "must have at least one operand");
   VPValue *Exiting = getOperand(0);
-  if (!Exiting->isLiveIn()) {
-    LLVMContext &Ctx = getInstruction().getContext();
-    auto &Plan = *getParent()->getPlan();
-    Exiting = Builder.createNaryOp(
-        VPInstruction::ExtractFromEnd,
-        {Exiting,
-         Plan.getOrAddLiveIn(ConstantInt::get(IntegerType::get(Ctx, 32), 1))});
-  }
+  if (Exiting->isLiveIn())
+    return;
+
+  LLVMContext &Ctx = getInstruction().getContext();
+  auto &Plan = *getParent()->getPlan();
+  Exiting = Builder.createNaryOp(VPInstruction::ExtractFromEnd,
+                                 {Exiting, Plan.getOrAddLiveIn(ConstantInt::get(
+                                               IntegerType::get(Ctx, 32), 1))});
   setOperand(0, Exiting);
 }
 


        


More information about the llvm-commits mailing list