[VP][LV] Migrate vector predication pass and intrinsics from llvm-bpevl. #65
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch migrate two commit implementing the vector predication pass from LLVM bpEVL.
The two commits is based on the loop vectorizer one year ago, but now details of loop vectorizer changed and some code in these commits must be changed accordingly.
Modification to VPIntrinsics.def introduced by bpevl is dropped, because #66199 already added the same defination.
D158779 simplified the logic of
addCanonicalIVRecipes
, and move part of its code toaddVPLaneMaskPhiAndUpdateExitBranch
. Since the first commit has something to do with the moved logic, I modified the prototype ofaddActiveLaneMask
,addVPLaneMaskPhiAndUpdateExitBranch
and letaddCanonicalIVRecipes
returnNextEVL
to make sureNextEVL
is insert to the exiting block as in the origin commit.D147964 deleted the loop for setting
TripCount
in the start ofVPlan::prepareToExecute
(VPlan.cpp, line 616-621), therefore code in the first commit accessing trip count throughState.get
(example) will get undesired result and eventually crash the program. So I modified the code to getTripCount
stored in the recipes directly (VPlanRecipes.cpp, line 1829 and VPlanRecipes.cpp, line 447).#74761 remove the
CanonicalIVIncrement
VPInstruction (link) and useadd
instruction instead but part of the logic of the first commit relies on it. So I modified the processing logic of binary operator (VPlan.cpp, line 284-295) to add them.Finally I updated
vp_intrinsics.ll
. The changes are likely introduced by other changes of LV but not by mistakes in migration.