Recommit "[VPlan] Unify Value2VPValue and VPExternalDefs maps (NFCI)."
authorFlorian Hahn <flo@fhahn.com>
Tue, 18 Apr 2023 09:29:17 +0000 (10:29 +0100)
committerFlorian Hahn <flo@fhahn.com>
Tue, 18 Apr 2023 09:29:31 +0000 (10:29 +0100)
commitff0ec4f42ea035253684183a0e8de9d87ef7111a
tree5eef286883cd702cfe05e75f906aa58d779df6c1
parentd8c49d2ac9dd4f3f3ec92fcd5751e850d8d7172c
Recommit "[VPlan] Unify Value2VPValue and VPExternalDefs maps (NFCI)."

This reverts the revert commit 8c2276f89887d0a27298a1bbbd2181fa54bbb509.

The updated patch re-orders the getDefiningRecipe check in getVPalue to avoid
a use-after-free.

Original commit message:

    Before this patch, a VPlan contained 2 mappings for Values -> VPValue:
    1) Value2VPValue and 2) VPExternalDefs.

    This duplication is unnecessary and there are already cases where
    external defs are added to Value2VPValue. This patch replaces all uses
    of VPExternalDefs with Value2VPValue.

    It clarifies the naming of getOrAddVPValue (to getOrAddExternalVPValue)
    and addVPValue (to addExternalVPValue).

    At the moment, this is NFC, but will enable additional simplifications
    in D147783.

    Depends on D147891.

    Reviewed By: Ayal

    Differential Revision: https://reviews.llvm.org/D147892
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/lib/Transforms/Vectorize/VPlan.cpp
llvm/lib/Transforms/Vectorize/VPlan.h
llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp
llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp
llvm/unittests/Transforms/Vectorize/VPlanTest.cpp