Fix Windows/MSVC build after 6e56046f65

Commit 6e56046f65 may trigger SEGV in llvm-tablegen if the latter
is built with -DLLVM_OPTIMIZED_TABLEGEN=OFF. The reason of SEGV was
accessing stale memory after expansion of std::vector.
This commit is contained in:
Evgeny Leviant 2020-10-13 15:24:58 +03:00
parent 2322080bc3
commit 836d0addee
1 changed files with 1 additions and 1 deletions

View File

@ -1664,7 +1664,6 @@ static void inferFromTransitions(ArrayRef<PredTransition> LastTransitions,
CodeGenSchedModels &SchedModels) {
// For each PredTransition, create a new CodeGenSchedTransition, which usually
// requires creating a new SchedClass.
const CodeGenSchedClass &FromSC = SchedModels.getSchedClass(FromClassIdx);
for (ArrayRef<PredTransition>::iterator
I = LastTransitions.begin(), E = LastTransitions.end(); I != E; ++I) {
IdxVec OperWritesVariant, OperReadsVariant;
@ -1674,6 +1673,7 @@ static void inferFromTransitions(ArrayRef<PredTransition> LastTransitions,
// Transition should not contain processor indices already assigned to
// InstRWs in this scheduling class.
const CodeGenSchedClass &FromSC = SchedModels.getSchedClass(FromClassIdx);
llvm::copy_if(I->ProcIndices, std::back_inserter(SCTrans.ProcIndices),
[&FromSC](unsigned PIdx) {
return !FromSC.InstRWProcIndices.count(PIdx);