Skip to content

Commit 37383da

Browse files
committed
[MachineLICM] Fix the check for high register pressure
We should be checking the register pressure change in MI's parent block before hoisting the instruction.
1 parent 0611fdd commit 37383da

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

llvm/lib/CodeGen/MachineLICM.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,8 @@ bool MachineLICMImpl::CanCauseHighRegPressure(
12501250
if (CheapInstr && !HoistCheapInsts)
12511251
return true;
12521252

1253+
if (static_cast<int>(RegPressure[Class]) + RPIdAndCost.second >= Limit)
1254+
return true;
12531255
for (const auto &RP : BackTrace)
12541256
if (static_cast<int>(RP[Class]) + RPIdAndCost.second >= Limit)
12551257
return true;

0 commit comments

Comments
 (0)