[PATCH] D28871: [CodeGenPrep]No negative cost in the ExtLd promotion
Quentin Colombet via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 26 14:15:14 PST 2017
> On Jan 25, 2017, at 12:21 PM, Jun Bum Lim via Phabricator <reviews at reviews.llvm.org> wrote:
>
> junbuml added a comment.
>
> Hi Quentin,
>
> I believe the test case I added shows the case where TotalCreatedInstsCost becomes negative :
>
> - In the very first call of extLdPromotion(), CreatedInstsCost is 0, ExtCost is 1 for the sext (%r), and NewCreatedInstsCost after promotion is 0 because the cost of sext becomes free after moving it up before %shl2.
> - Therefore, TotalCreatedInstsCost -= ExtCost becomes negative.
>
> I think propagating the negative value of TotalCreatedInstsCost is also possible, but I think ceiling it to 0 is simple and conservative enough to handle this corner case.
That’s conservative, I agree, I was wondering whether it makes sense to propagate the “gain” by allowing negative values.
Put differently, I am fine with the current approach as long as we commit to revisit it in the near future.
>
> This patch is a small particle from https://reviews.llvm.org/D27853, which should be rebased based on this.
>
> Thanks,
> Jun
>
>
> https://reviews.llvm.org/D28871
>
>
>
More information about the llvm-commits
mailing list