tejohnson added a comment. I agree with Piotr - to me it seems more intuitive to subtract a bonus from the "Cost" and to add the penalty. I have to admit I had the same confusion the first time I looked at this code, until I discovered that the Bonus was negative. https://reviews.llvm.org/D23222