OSDN Git Service

Make SwitchInstProfUpdateWrapper safer
authorYevgeny Rouban <yevgeny.rouban@azul.com>
Tue, 4 Jun 2019 09:03:39 +0000 (09:03 +0000)
committerYevgeny Rouban <yevgeny.rouban@azul.com>
Tue, 4 Jun 2019 09:03:39 +0000 (09:03 +0000)
commit48973d77b6a44e30530bb78564d347a1143edcf5
tree9132439227b36d31d40934e104aa27d2adc3cbde
parentd59be50a0a5224280e22aa6807e56827eb6c99d5
Make SwitchInstProfUpdateWrapper safer

While prof branch_weights inconsistencies are being fixed patch
by patch (pass by pass) we need SwitchInstProfUpdateWrapper to
be safe with respect to inconsistent metadata that can come from
passes that have not been fixed yet. See the bug found by @nikic
in https://reviews.llvm.org/D62126.

This patch introduces one more state (called Invalid) to the
wrapper class that allows users to work with the underlying
SwitchInst ignoring the prof metadata changes.

Created a unit test for the SwitchInstProfUpdateWrapper class.

Reviewers: davidx, nikic, eraman, reames, chandlerc
Reviewed By: davidx
Differential Revision: https://reviews.llvm.org/D62656

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362473 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Instructions.h
lib/IR/Instructions.cpp
unittests/IR/InstructionsTest.cpp