@@ -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" );
@@ -1664,9 +1664,9 @@ class StrlenVerifier {
1664
1664
if (!AddRecEv || !AddRecEv->isAffine ())
1665
1665
return false ;
1666
1666
1667
- // We only want RecAddExpr with recurrence step that are constant. This
1668
- // is good enough for all the idioms we want to recognize. Later we expand
1669
- // the recurrence as {base,+,a} -> (base + a * strlen) and materialize
1667
+ // We only want RecAddExpr with recurrence step that is constant. This
1668
+ // is good enough for all the idioms we want to recognize. Later we expand and materialize
1669
+ // the recurrence as {base,+,a} -> (base + a * strlen)
1670
1670
if (!dyn_cast<SCEVConstant>(AddRecEv->getStepRecurrence (*SE)))
1671
1671
return false ;
1672
1672
}
@@ -1719,7 +1719,7 @@ class StrlenVerifier {
1719
1719
// / size_t result = str - base;
1720
1720
// / \endcode
1721
1721
// /
1722
- // / will be transformed as as follow : The idiom will be replaced by a strlen
1722
+ // / will be transformed as follows : The idiom will be replaced by a strlen
1723
1723
// / computation to compute the address of the null terminator of the string.
1724
1724
// /
1725
1725
// / \code{.c}
@@ -1759,7 +1759,7 @@ bool LoopIdiomRecognize::recognizeAndInsertStrLen() {
1759
1759
BasicBlock *LoopExitBB = CurLoop->getExitBlock ();
1760
1760
1761
1761
IRBuilder<> Builder (Preheader->getTerminator ());
1762
- SCEVExpander Expander (*SE, Preheader->getModule ()->getDataLayout (), " scev " );
1762
+ SCEVExpander Expander (*SE, Preheader->getModule ()->getDataLayout (), " strlen_idiom " );
1763
1763
Value *MaterialzedBase = Expander.expandCodeFor (
1764
1764
Verifier.LoadBaseEv , Verifier.LoadBaseEv ->getType (),
1765
1765
Builder.GetInsertPoint ());
@@ -1805,9 +1805,8 @@ bool LoopIdiomRecognize::recognizeAndInsertStrLen() {
1805
1805
1806
1806
// All LCSSA Loop Phi are dead, the left over dead loop body can be cleaned
1807
1807
// up by later passes
1808
- for (PHINode *PN : Cleanup) {
1808
+ for (PHINode *PN : Cleanup)
1809
1809
RecursivelyDeleteDeadPHINode (PN);
1810
- }
1811
1810
SE->forgetLoop (CurLoop);
1812
1811
1813
1812
++NumStrLen;
0 commit comments