mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
Fix PR19657 (scalar loads not combined into vector load)
If we have common uses on separate paths in the tree; process the one with greater common depth first. This makes sure that we do not assume we need to extract a load when it is actually going to be part of a vectorized tree. Review: http://reviews.llvm.org/D3800 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210310 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -914,8 +914,20 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth) {
|
||||
if (isa<BinaryOperator>(VL0) && VL0->isCommutative()) {
|
||||
ValueList Left, Right;
|
||||
reorderInputsAccordingToOpcode(VL, Left, Right);
|
||||
buildTree_rec(Left, Depth + 1);
|
||||
buildTree_rec(Right, Depth + 1);
|
||||
BasicBlock *LeftBB = getSameBlock(Left);
|
||||
BasicBlock *RightBB = getSameBlock(Right);
|
||||
// If we have common uses on separate paths in the tree make sure we
|
||||
// process the one with greater common depth first.
|
||||
// We can use block numbering to determine the subtree traversal as
|
||||
// earler user has to come in between the common use and the later user.
|
||||
if (LeftBB && RightBB && LeftBB == RightBB &&
|
||||
getLastIndex(Right) > getLastIndex(Left)) {
|
||||
buildTree_rec(Right, Depth + 1);
|
||||
buildTree_rec(Left, Depth + 1);
|
||||
} else {
|
||||
buildTree_rec(Left, Depth + 1);
|
||||
buildTree_rec(Right, Depth + 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user