Skip to content

Commit d0584e2

Browse files
committed
[CodeLayout] Update to resolve Wdangling warning.
Change cc2fbc6 introduced -Wdangling warning, use temporaries to resolve. llvm/lib/Transforms/Utils/CodeLayout.cpp:764:27: error: temporary whose address is used as value of local variable '[minDensity, maxDensity]' will be destroyed at the end of the full-expression [-Werror,-Wdangling] 764 | std::minmax(ChainPred->density(), ChainSucc->density()); llvm/lib/Transforms/Utils/CodeLayout.cpp:764:49: error: temporary whose address is used as value of local variable '[minDensity, maxDensity]' will be destroyed at the end of the full-expression [-Werror,-Wdangling] 764 | std::minmax(ChainPred->density(), ChainSucc->density());
1 parent 4d80e93 commit d0584e2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/Transforms/Utils/CodeLayout.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,8 +760,10 @@ class ExtTSPImpl {
760760
// Skip the merge if the ratio between the densities exceeds
761761
// MaxMergeDensityRatio. Smaller values of the option result in fewer
762762
// merges, and hence, more chains.
763+
auto ChainPredDensity = ChainPred->density();
764+
auto ChainSuccDensity = ChainSucc->density();
763765
auto [minDensity, maxDensity] =
764-
std::minmax(ChainPred->density(), ChainSucc->density());
766+
std::minmax(ChainPredDensity, ChainSuccDensity);
765767
assert(minDensity > 0.0 && maxDensity > 0.0 &&
766768
"incorrectly computed chain densities");
767769
const double Ratio = maxDensity / minDensity;

0 commit comments

Comments
 (0)