[llvm] ca56966 - [VPlan] Properly retain flags when cloning VPReplicateRecipe.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 03:12:05 PST 2024


Author: Florian Hahn
Date: 2024-02-14T11:11:46Z
New Revision: ca5696668477750b4ddc31ea4cff25054dc8cf2a

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

LOG: [VPlan] Properly retain flags when cloning VPReplicateRecipe.

This makes sure the correct flags are used for the clone (i.e. the ones
present on the recipe), instead of the ones on the original IR
instruction.

At the moment, this should not change anything, as flags of replicate
recipe should not be dropped before they are cloned at the moment. But
that will change in a follow-up patch.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlan.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 162a3c4b195e53..13e1859ad6b250 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -2085,8 +2085,11 @@ class VPReplicateRecipe : public VPRecipeWithIRFlags {
   ~VPReplicateRecipe() override = default;
 
   VPRecipeBase *clone() override {
-    return new VPReplicateRecipe(getUnderlyingInstr(), operands(), IsUniform,
-                                 isPredicated() ? getMask() : nullptr);
+    auto *Copy =
+        new VPReplicateRecipe(getUnderlyingInstr(), operands(), IsUniform,
+                              isPredicated() ? getMask() : nullptr);
+    Copy->transferFlags(*this);
+    return Copy;
   }
 
   VP_CLASSOF_IMPL(VPDef::VPReplicateSC)


        


More information about the llvm-commits mailing list