@@ -140,12 +140,13 @@ static cl::opt<bool, true>
140
140
// / to justify the cost. To avoid unnecessary performance penalties,
141
141
// / we disable it by default.
142
142
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);
149
150
150
151
static cl::opt<bool > UseLIRCodeSizeHeurs (
151
152
" use-lir-code-size-heurs" ,
@@ -1776,12 +1777,14 @@ bool LoopIdiomRecognize::recognizeAndInsertStrLen() {
1776
1777
1777
1778
Value *StrLenFunc = nullptr ;
1778
1779
if (Verifier.OpWidth == 8 ) {
1780
+ if (DisableLIRP::Strlen)
1781
+ return false ;
1779
1782
if (!isLibFuncEmittable (Preheader->getModule (), TLI, LibFunc_strlen))
1780
1783
return false ;
1781
1784
StrLenFunc = emitStrLen (MaterialzedBase, Builder, *DL, TLI);
1782
1785
} else {
1783
1786
if (DisableLIRP::Wcslen)
1784
- return false ;
1787
+ return false ;
1785
1788
if (!isLibFuncEmittable (Preheader->getModule (), TLI, LibFunc_wcslen))
1786
1789
return false ;
1787
1790
StrLenFunc = emitWcsLen (MaterialzedBase, Builder, *DL, TLI);
0 commit comments