[SimpleLoopUnswich] Fixa a bug on ComputeUnswitchedCost with partial unswitch
authorJingu Kang <jingu.kang@arm.com>
Mon, 7 Jun 2021 11:55:30 +0000 (12:55 +0100)
committerJingu Kang <jingu.kang@arm.com>
Tue, 22 Jun 2021 15:18:00 +0000 (16:18 +0100)
commit873ff5a72864fdf60614cca8adbd0d869fc9a9a2
tree67635f893d3b49a39900a3082bfcebe6a6160016
parent6c782e6eb0390097a02ae20bed7c502b8ee15696
[SimpleLoopUnswich] Fixa a bug on ComputeUnswitchedCost with partial unswitch

There was a bug from cost calculation for partially invariant unswitch.

The costs of non-duplicated blocks are substracted from the total LoopCost, so
anything that is duplicated should not be counted.

Differential Revision: https://reviews.llvm.org/D103816
llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
llvm/test/Transforms/SimpleLoopUnswitch/partial-unswitch.ll