diff options
author | Jun Bum Lim <junbuml@codeaurora.org> | 2017-01-27 17:16:37 +0000 |
---|---|---|
committer | Jun Bum Lim <junbuml@codeaurora.org> | 2017-01-27 17:16:37 +0000 |
commit | b99a06b7c9f4f6559da9fefeb1011c8aefe3f34c (patch) | |
tree | f4d23b358c90ca976ab61e58859fbcc0b1e1d1c6 /llvm/lib/CodeGen | |
parent | 091f1b6ef314d4e0e37eaf438c63c307253e8b42 (diff) | |
download | bcm5719-llvm-b99a06b7c9f4f6559da9fefeb1011c8aefe3f34c.tar.gz bcm5719-llvm-b99a06b7c9f4f6559da9fefeb1011c8aefe3f34c.zip |
[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
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index bfcedaceb64..3029cb10a78 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -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))) { |