]> granicus.if.org Git - llvm/commit
[MachinePipeliner] Fix risky iterator usage R++, --R
authorJinsong Ji <jji@us.ibm.com>
Tue, 25 Jun 2019 21:50:56 +0000 (21:50 +0000)
committerJinsong Ji <jji@us.ibm.com>
Tue, 25 Jun 2019 21:50:56 +0000 (21:50 +0000)
commit4d1e6104e6a86a0f0a31cb8d666f4c5ae7f0568c
tree98c6d6f9e61f53e643635f16451595bc4d7f115d
parentfdb08e373c9817eb12a33d1279bbfe16fddf52ec
[MachinePipeliner] Fix risky iterator usage R++, --R

When we calculate MII, we use two loops, one with iterator R++ to
check whether we can reserve the resource, then --R to move back
the iterator to do reservation.

This is risky, as R++, --R may not point to the same element at all.
The can cause wrong MII.

Differential Revision: https://reviews.llvm.org/D63536

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364353 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MachinePipeliner.cpp
test/CodeGen/PowerPC/sms-iterator.ll