@@ -97,7 +97,7 @@ using namespace llvm;
97
97
STATISTIC (NumMemSet, " Number of memset's formed from loop stores" );
98
98
STATISTIC (NumMemCpy, " Number of memcpy's formed from loop load+stores" );
99
99
STATISTIC (NumMemMove, " Number of memmove's formed from loop load+stores" );
100
- STATISTIC (NumStrLen, " Number of strlen's formed from loop loads" );
100
+ STATISTIC (NumStrLen, " Number of strlen's and wcslen's formed from loop loads" );
101
101
STATISTIC (
102
102
NumShiftUntilBitTest,
103
103
" Number of uncountable loops recognized as 'shift until bitttest' idiom" );
@@ -1669,9 +1669,9 @@ class StrlenVerifier {
1669
1669
if (!AddRecEv || !AddRecEv->isAffine ())
1670
1670
return false ;
1671
1671
1672
- // We only want RecAddExpr with recurrence step that are constant. This
1673
- // is good enough for all the idioms we want to recognize. Later we expand
1674
- // the recurrence as {base,+,a} -> (base + a * strlen) and materialize
1672
+ // We only want RecAddExpr with recurrence step that is constant. This
1673
+ // is good enough for all the idioms we want to recognize. Later we expand and materialize
1674
+ // the recurrence as {base,+,a} -> (base + a * strlen)
1675
1675
if (!dyn_cast<SCEVConstant>(AddRecEv->getStepRecurrence (*SE)))
1676
1676
return false ;
1677
1677
}
@@ -1724,7 +1724,7 @@ class StrlenVerifier {
1724
1724
// / size_t result = str - base;
1725
1725
// / \endcode
1726
1726
// /
1727
- // / will be transformed as as follow : The idiom will be replaced by a strlen
1727
+ // / will be transformed as follows : The idiom will be replaced by a strlen
1728
1728
// / computation to compute the address of the null terminator of the string.
1729
1729
// /
1730
1730
// / \code{.c}
@@ -1764,7 +1764,7 @@ bool LoopIdiomRecognize::recognizeAndInsertStrLen() {
1764
1764
BasicBlock *LoopExitBB = CurLoop->getExitBlock ();
1765
1765
1766
1766
IRBuilder<> Builder (Preheader->getTerminator ());
1767
- SCEVExpander Expander (*SE, Preheader->getModule ()->getDataLayout (), " scev " );
1767
+ SCEVExpander Expander (*SE, Preheader->getModule ()->getDataLayout (), " strlen_idiom " );
1768
1768
Value *MaterialzedBase = Expander.expandCodeFor (
1769
1769
Verifier.LoadBaseEv , Verifier.LoadBaseEv ->getType (),
1770
1770
Builder.GetInsertPoint ());
@@ -1810,9 +1810,8 @@ bool LoopIdiomRecognize::recognizeAndInsertStrLen() {
1810
1810
1811
1811
// All LCSSA Loop Phi are dead, the left over dead loop body can be cleaned
1812
1812
// up by later passes
1813
- for (PHINode *PN : Cleanup) {
1813
+ for (PHINode *PN : Cleanup)
1814
1814
RecursivelyDeleteDeadPHINode (PN);
1815
- }
1816
1815
SE->forgetLoop (CurLoop);
1817
1816
1818
1817
++NumStrLen;
0 commit comments