Skip to content

Commit 0e951d8

Browse files
committed
fix enable wcslen flag
1 parent f0091d8 commit 0e951d8

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,13 @@ static cl::opt<bool, true>
140140
/// to justify the cost. To avoid unnecessary performance penalties,
141141
/// we disable it by default.
142142
bool DisableLIRP::Wcslen;
143-
static cl::opt<bool, true>
144-
EnableLIRPWcslen("enable-loop-idiom-wcslen",
145-
cl::desc("Proceed with loop idiom recognize pass, "
146-
"enable conversion of loop(s) to wcslen."),
147-
cl::location(DisableLIRP::Wcslen), cl::init(true),
148-
cl::ReallyHidden);
143+
static cl::opt<bool, true> EnableLIRPWcslen(
144+
"enable-loop-idiom-wcslen",
145+
cl::desc("Proceed with loop idiom recognize pass, "
146+
"enable conversion of loop(s) to wcslen."),
147+
cl::location(DisableLIRP::Wcslen), cl::init(true),
148+
cl::callback([](const bool &) { DisableLIRP::Wcslen = false; }),
149+
cl::ReallyHidden);
149150

150151
static cl::opt<bool> UseLIRCodeSizeHeurs(
151152
"use-lir-code-size-heurs",
@@ -1776,12 +1777,14 @@ bool LoopIdiomRecognize::recognizeAndInsertStrLen() {
17761777

17771778
Value *StrLenFunc = nullptr;
17781779
if (Verifier.OpWidth == 8) {
1780+
if (DisableLIRP::Strlen)
1781+
return false;
17791782
if (!isLibFuncEmittable(Preheader->getModule(), TLI, LibFunc_strlen))
17801783
return false;
17811784
StrLenFunc = emitStrLen(MaterialzedBase, Builder, *DL, TLI);
17821785
} else {
17831786
if (DisableLIRP::Wcslen)
1784-
return false;
1787+
return false;
17851788
if (!isLibFuncEmittable(Preheader->getModule(), TLI, LibFunc_wcslen))
17861789
return false;
17871790
StrLenFunc = emitWcsLen(MaterialzedBase, Builder, *DL, TLI);

0 commit comments

Comments
 (0)