Skip to content

Commit 4edde52

Browse files
committed
Use std::max for freq calc.
1 parent f41fddc commit 4edde52

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,9 +2052,7 @@ uint64_t PreRARematStage::ScoredRemat::getFreqDiff(const FreqInfo &Freq) const {
20522052
// to values that will yield the worst possible score given known frequencies
20532053
// in order to penalize rematerializations from or into regions whose
20542054
// frequency is unknown.
2055-
uint64_t DefOrOne = Freq.Regions[Remat->DefRegion];
2056-
if (!DefOrOne)
2057-
DefOrOne = 1;
2055+
uint64_t DefOrOne = std::max(Freq.Regions[Remat->DefRegion], (uint64_t)1);
20582056
uint64_t UseOrMax = Freq.Regions[Remat->UseRegion];
20592057
if (!UseOrMax)
20602058
UseOrMax = Freq.MaxFreq;

0 commit comments

Comments
 (0)