[CodeGenPrep]No negative cost in the ExtLd promotion
Summary: This change prevent the signed value of cost from being negative as the value is passed as an unsigned argument. Reviewers: mcrosier, jmolloy, qcolombet, javed.absar Reviewed By: mcrosier, qcolombet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28871 llvm-svn: 293307
This commit is contained in:
@@ -4297,7 +4297,10 @@ bool CodeGenPrepare::extLdPromotion(TypePromotionTransaction &TPT,
|
||||
// one extension but leave one. However, we optimistically keep going,
|
||||
// because the new extension may be removed too.
|
||||
long long TotalCreatedInstsCost = CreatedInstsCost + NewCreatedInstsCost;
|
||||
TotalCreatedInstsCost -= ExtCost;
|
||||
// FIXME: It would be possible to propagate a negative value instead of
|
||||
// conservatively ceiling it to 0.
|
||||
TotalCreatedInstsCost =
|
||||
std::max((long long)0, (TotalCreatedInstsCost - ExtCost));
|
||||
if (!StressExtLdPromotion &&
|
||||
(TotalCreatedInstsCost > 1 ||
|
||||
!isPromotedInstructionLegal(*TLI, *DL, PromotedVal))) {
|
||||
|
||||
Reference in New Issue
Block a user