OSDN Git Service

[PM/LoopUnswitch] Add back a successor set that was removed based on
authorChandler Carruth <chandlerc@gmail.com>
Tue, 1 May 2018 09:42:09 +0000 (09:42 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 1 May 2018 09:42:09 +0000 (09:42 +0000)
commit112030e33ee98c8fa56831b93166a0169c7abc3c
tree0dac53fd94cda89551f3ead6c260f04f5ce53428
parent52c132f528d9a2325771f46304468c2677ba06c8
[PM/LoopUnswitch] Add back a successor set that was removed based on
code review.

It turns out this *is* necessary, and I read the comment on the API
correctly the first time. ;]

The `applyUpdates` routine requires that updates are "balanced". This is
in order to cleanly handle cycles like inserting, removing, nad then
re-inserting the same edge. This precludes inserting the same edge
multiple times in a row as handling that would cause the insertion logic
to become *ordered* instead of *unordered* (which is what the API
provides).

It happens that in this specific case nothing (other than an assert and
contract violation) goes wrong because we're never inserting and
removing the same edge. The implementation *happens* to do the right
thing to eliminate redundant insertions in that case.

But the requirement is there and there is an assert to catch it.
Somehow, after the code review I never did another asserts-clang build
testing loop-unswich for a long time. As a consequence, I didn't notice
this despite a bunch of testing going on, but it shows up immediately
with an asserts build of clang itself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331246 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/SimpleLoopUnswitch.cpp