mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
LoopVectorize: External uses must use the last value in a reduction cycle
Otherwise, we don't perform operations that would have been performed on the scalar version. Fixes PR17498. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192133 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -4015,6 +4015,12 @@ bool LoopVectorizationLegality::AddReductionVar(PHINode *Phi,
|
||||
if (ExitInstruction != 0 || Cur == Phi)
|
||||
return false;
|
||||
|
||||
// The instruction used by an outside user must be the last instruction
|
||||
// before we feed back to the reduction phi. Otherwise, we loose VF-1
|
||||
// operations on the value.
|
||||
if (std::find(Phi->op_begin(), Phi->op_end(), Cur) == Phi->op_end())
|
||||
return false;
|
||||
|
||||
ExitInstruction = Cur;
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user