Skip to content

Commit 8339e4c

Browse files
elvinw-inteligcbot
authored andcommitted
Minor refactor of SpecialCasesDisableLICM
Move constexpr to the beginning of the function
1 parent b059af8 commit 8339e4c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

IGC/Compiler/CustomLoopOpt.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,9 @@ SpecialCasesDisableLICM::SpecialCasesDisableLICM() : FunctionPass(ID)
12111211

12121212
bool SpecialCasesDisableLICM::runOnFunction(llvm::Function& F)
12131213
{
1214+
constexpr size_t HIGH_BB_THRESHOLD_FOR_LICM = 2500;
1215+
constexpr size_t HIGH_LOOP_THRESHOLD_FOR_LICM = 450;
1216+
12141217
bool Changed = false;
12151218
LoopInfo* LI = nullptr;
12161219

@@ -1220,13 +1223,12 @@ bool SpecialCasesDisableLICM::runOnFunction(llvm::Function& F)
12201223
return LI;
12211224
};
12221225

1223-
if (constexpr size_t HIGH_BB_THRESHOLD_FOR_LICM = 2500;
1224-
F.size() > HIGH_BB_THRESHOLD_FOR_LICM)
1226+
if (F.size() > HIGH_BB_THRESHOLD_FOR_LICM)
12251227
{
12261228
LI = getLoopInfo();
12271229

1228-
if (constexpr size_t HIGH_LOOP_THRESHOLD_FOR_LICM = 450;
1229-
llvm::size(*LI) > HIGH_LOOP_THRESHOLD_FOR_LICM)
1230+
if (llvm::size(*LI) > HIGH_LOOP_THRESHOLD_FOR_LICM
1231+
)
12301232
{
12311233
for (auto* L : *LI)
12321234
AddLICMDisableMedatadaToSpecificLoop(*L);

0 commit comments

Comments
 (0)