Skip to content

Commit

Permalink
Fix Windows/MSVC build after 6e56046
Browse files Browse the repository at this point in the history
Commit 6e56046 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.
  • Loading branch information
eleviant committed Oct 13, 2020
1 parent 2322080 commit 836d0ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/utils/TableGen/CodeGenSchedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 836d0ad

Please sign in to comment.